Repository navigation
tole v0.10.0
tole v0.10.0
TUI steering, follow-up queue, collapsible output, @file, markdown & diff styling (#462).
Added
- TUI steering, follow-up queue, collapsible output,
@file, markdown and diff styling (#462):Enterwhile a turn runs pushes the draft on the existing soft-interrupt queue (#377), so the turn commits it as an attributed user message at its next safe point and continues (nothing is cancelled; a steer the turn never reached runs next, or returns to the editor after a cancel);Alt+Enterqueues a follow-up shown asqueued: …rows above the editor, the head runs after the turn ends with an answer (one at a time),Alt+Uppops the last back into the editor, andEsc/Ctrl+Ccancel and return the whole queue to the editor.Ctrl+Oexpands/collapses tool output (multi-line results are collapsed to the first line plus[+n lines · Ctrl+O]),Ctrl+Thides/shows reasoning; both are UI state only. Typing@opens a file panel (depth ≤ 3, ≤ 2000 files listed, 50 shown,Tab/Enterinsert the path); answers get minimal markdown styling (headings,**bold**, inline code, fenced code) and+/-/@@rows of tool output are green/red/dim, all sanitized before styling. Not included (deferred): tables, nested lists, italics and links in markdown; retroactive collapse of already-printed scrollback; diffs beyond the 200-character tool preview;@insertion at an in-buffer cursor. - TUI model picker, thinking level and slash-command menu (#461):
/modelandCtrl+Lopen a filter-as-you-type picker over the provider's/models,/model <id>sets one directly,Ctrl+Pcycles the models used in this run;/thinking [level]andShift+Tabcycleminimal → low → medium → high → unsetand the editor border shows the level; typing/opens a command menu (Tabcompletes,Up/Downselect) for/compact,/new,/resume(picker over the global session index),/session(the status lines),/nameand/quit; unknown commands are refused with a prefix hint. Model, effort and name are session registers (fact/model,fact/reasoning_effort,fact/session_name), so the next provider call uses them and they survivetole resume;/nameis whatsessions --allandresume <name>show./compactrequests the forced pass before the next prompt (no mid-turn compaction; its optional instructions are not supported yet and are reported as ignored). Not included (deferred):/resumepaging beyond the newest 50, replaying the old transcript after/new//resume. - Terminal UI MVP (#460): bare
toleon a TTY now talks to the agent. Inline viewport with a streaming transcript (answer text as it arrives, reasoning dimmed, tool calls and results as compact lines), a multi-line editor (Entersends,Shift+Enter/Alt+Enter/Ctrl+Jnewline,Up/Downhistory), a footer (folder, session, model, effort,context used / window (%), session tokens from thestatussnapshot), inliney/napproval for Write and Destructive tools (the normal--allow/--yesrules still apply), andEscto cancel the running turn. Sessions are ordinary tole sessions (tole resume,sessions --all). Hiddentole tuisubcommand (what baretoleruns) goes through the normal config gate. Not included (deferred): in-line cursor movement, slash commands beyond/quit, memory loop, MCP prompt commands, sibling notices, soft interrupts (#377/#383). - Reasoning effort (#457):
--effort <minimal|low|medium|high>/TOLE_REASONING_EFFORT/ configreasoning_effort(flag > env > config > user config > unset, validated; shown bytole config check) is sent asreasoning_efforton OpenAI-compatible chat completions only when set, so an unset request body is byte-identical. A session's durablefact/reasoning_effortregister overrides it and survives resume (an empty or invalid value falls back to the default). A provider that answers HTTP 400 namingreasoning_effortgets ONE degraded retry without it: the rejection is remembered for that provider and recorded under the namespacedtole_degradedkey of the step's usage row, never counted as a provider step. New core API:openai::{parse_reasoning_effort, REASONING_EFFORTS},OpenAiProvider::with_reasoning_effort,Provider::last_degraded(default None). Not included (deferred): a setter for the register (the TUI/thinkingcommand, #464) and the ACP config option. - Multi-client daemon design note (#382):
docs/daemon-design.mdrecords how jcode's daemon works (single server, Unix socket, client registry, 5-minute idle timeout,exec()hot-reload, client auto-reconnect), a clearly speculative mapping onto tole, the user stories that would un-park it, and an explicit anti-goal. PARKED (tier B): docs only, no code, nothing to build without a user story and owner approval. - Claude Code session import (#381):
tole import-claude <transcript.jsonl>imports a Claude Code session (the~/.claude/projectsJSONL orclaude -p --output-format stream-jsonoutput) as a NEW tole sessioncc-<claude-session-id>; continue it withtole resume cc-<id> "<prompt>". Prompts and assistant text become messages,tool_use/tool_resultblocks become intent / result entries (Claude Code tool names are kept as history only, never executed), model, version, branch and timestamps are recorded in thefact/cc_importregister, and the header takes the transcript's cwd. Additive: existing sessions are untouched and importing the same session twice is refused. Malformed lines, thinking blocks and sidechain (subagent) lines are skipped (malformed ones with a warning); a dangling prompt or open tool call at the end is dropped and reported so the session rests atFinal. New core API:ccimport::{import_file, import_str, CcImport},JsonlStorage::cwd. Not included (deferred): attaching to a runningclaudeprocess (and its double-attach guard), image blocks, a live provider round trip (unverified). - Detach a running turn (#217): stop waiting without aborting anything.
POST /sessions/{id}/detach(serve;202,409when no turn runs) and the MCP tooltole_session_detachset a newCancelToken::detach()flag. The running tool settles and its result is committed; before the next provider call the turn writes a durabledetachedentry and settlespc=Finalas the newTurnOutcome::Detached(stop reasondetached;tole runexits 9). The session stays prompt-resumable, and a cancel always outranks a detach. A background job started withjob_startin a serve/MCP/ACP session now nudges that session when it exits: a notice ([tole] background job <id> finished …) is queued on the soft-interrupt queue and delivered at the next safe point, which is the next turn's first when the session is idle. New core API:CancelToken::{detach, is_detached},TurnOutcome::Detached,JobStartTool::with_completion_notice. Not included (deferred): the Ctrl-B key and atole detachcommand forchat/run(they have no concurrent input while a turn runs; this lands with the terminal UI, #464), moving an in-flightrun_commandinto a job (tools are not interruptible mid-call), nudges that survive a host restart (the queue is in memory;job_pollstill has the result), and the ACP face. - MCP prompts and resources (#213): the MCP client now probes each server's
prompts/resourcescapabilities (probe-first: a server that advertises neither is never asked and adds nothing). Intole chat, a server's prompts are listed at startup and invoked as/mcp:<server>:<prompt> [key=value ...]; the server renders the prompt, tole prints it and sends it as that turn's user message (text parts only, capped at 256k chars). Servers that advertiseresourcesadd one ReadOnlymcp_read {server, uri}tool (resources/read; text contents only). Server prompt text is server-controlled content (threat-model note added); tool calls it provokes still pass the approver. New core API:mcp::{probe_server_extras, get_server_prompt, parse_prompt_command, McpReadTool, McpExtras, McpPromptInfo}. Not included (deferred):tole prompt runoutside chat, quoted/spaced argument values, resource templates,resources/listsurfacing, and subscriptions. - Session forks (#210):
tole branch <id> [--at <entry-id>]starts a new session holding the source's history up to a settled entry (a final assistant answer; default: the last one), so approach B can be tried without losing approach A; continue it withtole resume <new-id> "<prompt>".tole sessions --treenests forks under the session they were cut from. A fork is a separate append-only file whose header recordsforkedFrom: {session, entry}(additive; older files replay unchanged), so replay and todo hydration are correct per branch and the source is never touched. Usage rows and registers are not copied. New core API:JsonlStorage::fork/forked_from,storage::ForkOrigin.--atand the default cut only accept a final assistant message with no tool calls hanging off it. Not included (deferred): several leaves inside one file with lineage-following readers, resume by branch head, and a--forkflag onresume. - Image input (#212):
tole run|chat|mission --image <path|data:…;base64,…>(repeatable) attaches images to the first message, andtole_core::turn::run_turn_with_imagesis the embedder entry point. Paths must resolve inside the workspace jail (..and symlink escapes refused); inline images are spilled to<codecora home>/tole/images/; png/jpeg/gif/webp sniffed from bytes, 10 MiB cap. The OpenAI wire getstext+image_urlcontent parts; the write-once log stores only a reference (payload.images:path,mime,bytes,fnv1a64), and each request re-loads the file re-checking jail and hash, so replay/resume keeps working and a changed or missing file reaches the model as an[image unavailable: …]note. A non-vision model is a loudmodel-capabilityerror:TOLE_VISION=0refuses before any request, and a 400/415/422 naming images becomes the same error. New core API:image::{resolve, data_url, ImageRef},OpenAiProvider::{with_image_roots, with_vision}. Image tokens appear in the request size (tole_wire.history_chars) and the provider-reported usage. Not included: images referenced inside prompt text (only--image), images on ACP/serve/MCP faces, a real vision-model round trip (unverified). - Context-overflow recovery and a missing-window warning (#481). A provider HTTP 400/413/422 whose error text says the request exceeded the context window (
context_length_exceeded, "maximum context length", "prompt is too long", ...) now ends the turn with the provider's message plus(compaction will run on the next resume)and records a durablefact/context_overflowregister in the commit that settles the turn; the nextresume <id> "<prompt>"/chatmessage forces one compaction pass first (independent of window detection and threshold), clears the flag, then runs the prompt. Owner decision 2026-11-03: compaction stays between turns — no compact-and-retry in place.--no-compactionalso disables the recovery pass; a failed summary call keeps the flag.tole doctor --tier catalognow prints a non-fatal!warning (exit code and ledger unchanged) namingTOLE_CONTEXT_WINDOW=<tokens>when neither the setting nor/modelsgives a window, and reports the window it found otherwise. New core API:compaction::{is_context_overflow, mark_overflow, overflow_pending, clear_overflow};doctor::run_clitakes the configured window. Not included (deferred): a built-in window table and a 24 h disk cache. - Bounded provider retry (#478): a turn now retries 429, any 5xx, connection/timeout errors, stream read failures and empty completions up to 3 times (was one retry for timeout/429 only), waiting 1/2/4 s with jitter or the
Retry-Afterseconds from the error text ((retry-after: N), #474), capped at 30 s. The wait is cancel-aware (1 s slices on theCancelToken) and each retry is a durableprovider transient failure, retryingentry written before the wait. Other 4xx stay fail-loud. An empty completion that outlasts its retries still does not fail over to the reserve. - Interruptible provider calls (#484): a cancel (Esc,
--timeout, ACPsession/cancel, serve cancel) now interrupts a provider call already in flight instead of waiting for the provider to answer or the 120 s HTTP timeout. New additiveProvider::complete_with_cancel(&mut self, transcript, &CancelToken)(default delegates tocomplete, so embedders and mocks are unchanged);OpenAiProviderruns the request on a helper thread and re-checks the token every 100 ms,FailoverProviderandBox<P>forward it, and the turn loop calls it. On cancel the thread is abandoned, nothing is committed for the call, and the turn settles as cancelled as before (resumable). A streaming call also stops reading and stays silent on the live sinks. The abandoned request may still be billed by the provider. Measured:tole run --timeout 1against a provider silent for 8 s returned after 8.25 s, now about 1 s, in stream and non-stream modes.
Changed
- Storage syncs once per durable commit point instead of once per commit (#483): a tool step issued about 4.8
fdatasynccalls (5.7 with a Write tool); it now issues 2 (intent before the effect,finishafter it) and a final answer 1, measured by the newfsync_budgettest through the real turn loop. NewCommit::defer_sync()writes a line without syncing; the next durable commit'sfdatasyncpersists it. The turn loop defers only the usage row, theToolCallhop,wrote_this_turnand the settlement, each always followed by a durable commit. File format, replay, torn-tail repair and poison semantics are unchanged. - Sequential read-only tool-call batches (#480): when one model response carries several tool calls and ALL of them are registered ReadOnly tools, the turn loop now runs them in model order, each as its own effect sandwich, inside ONE model step, instead of running the first and dropping the rest (the model re-asked each, costing a round trip apiece; measured 11 of 22 calls re-asked on glm-5.1). Any non-ReadOnly or unknown tool in the response keeps the old first-call-only behaviour. This is NOT concurrent execution. A failed call stops the batch and the remaining calls get a
not executederror result. New additiveProvider::last_extra_tool_calls(default empty;ProviderOutputis unchanged),machine::begin_batch_member, and a"batch": truemarker on the 2nd..Nth intents that the OpenAI wire flattening merges into one assistanttool_callsarray. Design note:docs/tool-batches.md. The PRD non-goal now reads "no concurrent execution; sequential batches supported". - Release builds use thin LTO, a single codegen unit and
strip = true(#482): thetolebinary shrinks from 16.7 MB to about 9 MB. The profile is also set incrates/tole-cli/Cargo.tomlsocargo install tole-cligets it (the workspace-root profile is not packaged).panic = "abort"is deliberately not set: Mutex poison recovery and the serve/ACP/MCP daemons rely on unwinding.
Fixed
--on-pretool/--on-posttool/--on-turnendon a build without theshell-toolsfeature (--no-default-features) are now refused with a clear error instead of being silently ignored (the hook never ran and a Write tool executed under--yes).- Pre/post hook timeout raised from 5 s to 30 s, matching the turn-end gates (#493): hooks may be verification gates (lint/tests), and a loaded host could exceed 5 s, so the timeout (a non-blocking failure by design) silently skipped the hook and turned a deny into an allow. This was the root cause of the #493 CI flake.
- A denied approval or
--on-pretoolexit 2 no longer strands a headless caller (#476, owner decision 2026-11-03). The turn still parks in Planning, so a baretole resume <id>is unchanged, buttole resume <id> "<prompt>"now settles the parked turn and runs the new prompt (it was refused withrun_turn requires pc Idle or Final), which makes the--on-pretoolhelp text true. The denial is now visible to the model's next request through a synthetic user-roledenial_noteentry (marked like the stop-gate feedback, never opens a turn); it was an orphan error entry the wire dropped, so a policy deny was asked for again and again. A denied replay of a crash-interrupted effect now saysthe outcome is UNKNOWN: the effect may have run before the interruption; check state before retryinginstead of reading like a user refusal. Denied effects still never execute; the loop guard and step budget are unchanged. - A non-stream completion with empty content and no tool calls now fails with
malformed response: empty stream (no content, no tool calls), like stream mode, instead of returning an emptyFinalwith exit code 0 (#478). - A provider HTTP error now carries its body:
http status: 400 Bad Request — <scrubbed 200-char snippet>, plus(retry-after: N)when the header is present (#474). The chat-completions client no longer lets ureq drop the body of a 4xx/5xx (http_status_as_error(false), that request only); the/modelsprobes keep theirErron non-2xx. Thehttp status: Nprefix is unchanged and a snippet never changes retry or failover classification. - Streaming provider requests reuse one connection (#479):
complete_streamingstops atdata: [DONE]and left the chunked terminator unread, so every streamed request opened a new TCP+TLS connection (26 requests, 26 connections; non-stream mode used 1). After a clean end of stream the rest of the body is now read to EOF on a detachedtole-sse-drainthread, so the turn never waits for it. At most 2 drain threads live per provider (a server that never ends the body parks a thread and socket until the agent timeout); past that, and after an error, the reader is dropped and the connection closes as before. No change to whatcomplete_streamingreturns. - A second process can no longer write to a session another process has open (#475): a writable
JsonlStorageholds an exclusive advisory lock on a sidecar<id>.jsonl.lock(survivescompact(), released by the OS on crash), taken before the torn-tail repair, andresume/chat --resumeagainst a held session fails withsession is open for writing by pid Ninstead of appending stale records (duplicated seq, unreadable session). Each append also checks the file length against the last known good length (newStorageError::StaleHandle);StorageError::Lockedis new. Read-only commands (status,sessions) are unaffected. - Approval prompts now also escape the Arabic letter mark (U+061C), the Mongolian vowel separator (U+180E), the word joiner and invisible math operators (U+2060–U+2064) and the deprecated format characters (U+206A–U+206F); they could visually reorder or hide text (pre-tag scan of 0.9.0).
- The API key is redacted from replayed tool-call arguments on the wire, as it already was from message text and tool results (E11).
- Compaction with
keep_turnsof 2 or more no longer cuts before the previous summary, which made the summary call replay the raw transcript and drop that summary. Only embedders could hit it; the CLI keeps one turn. tole sessions,sessions --all,tole statusand session-name lookup replay session files read-only (JsonlStorage::open_read_only): they no longer truncate a torn last line that another process may still be appending.agent_polland the concurrent-agent cap no longer treat a recycled pid as the agent: a live pid whose command line does not name the agent (every child is launched with--sessions-dir <agents>/<id>/sessions) is another process, so a dead child whose number was reused no longer holds a cap slot or reads as "running" forever (pre-tag scan of 0.9.0). Identity, not clocks or executable names: a wall-clock age check would read a live agent as dead after a clock jump, and a launcher changes the process name. An unreadable command line keeps the plain liveness check.
Full diff: v0.9.0...v0.10.0