Skip to content

tole v0.10.0

Choose a tag to compare

@ajianaz ajianaz released this 04 Nov 07:47
· 6 commits to main since this release
c5bb74b

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): Enter while 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+Enter queues a follow-up shown as queued: … rows above the editor, the head runs after the turn ends with an answer (one at a time), Alt+Up pops the last back into the editor, and Esc / Ctrl+C cancel and return the whole queue to the editor. Ctrl+O expands/collapses tool output (multi-line results are collapsed to the first line plus [+n lines · Ctrl+O]), Ctrl+T hides/shows reasoning; both are UI state only. Typing @ opens a file panel (depth ≤ 3, ≤ 2000 files listed, 50 shown, Tab/Enter insert 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): /model and Ctrl+L open a filter-as-you-type picker over the provider's /models, /model <id> sets one directly, Ctrl+P cycles the models used in this run; /thinking [level] and Shift+Tab cycle minimal → low → medium → high → unset and the editor border shows the level; typing / opens a command menu (Tab completes, Up/Down select) for /compact, /new, /resume (picker over the global session index), /session (the status lines), /name and /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 survive tole resume; /name is what sessions --all and resume <name> show. /compact requests 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): /resume paging beyond the newest 50, replaying the old transcript after /new / /resume.
  • Terminal UI MVP (#460): bare tole on 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 (Enter sends, Shift+Enter / Alt+Enter / Ctrl+J newline, Up/Down history), a footer (folder, session, model, effort, context used / window (%), session tokens from the status snapshot), inline y/n approval for Write and Destructive tools (the normal --allow / --yes rules still apply), and Esc to cancel the running turn. Sessions are ordinary tole sessions (tole resume, sessions --all). Hidden tole tui subcommand (what bare tole runs) 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 / config reasoning_effort (flag > env > config > user config > unset, validated; shown by tole config check) is sent as reasoning_effort on OpenAI-compatible chat completions only when set, so an unset request body is byte-identical. A session's durable fact/reasoning_effort register overrides it and survives resume (an empty or invalid value falls back to the default). A provider that answers HTTP 400 naming reasoning_effort gets ONE degraded retry without it: the rejection is remembered for that provider and recorded under the namespaced tole_degraded key 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 /thinking command, #464) and the ACP config option.
  • Multi-client daemon design note (#382): docs/daemon-design.md records 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/projects JSONL or claude -p --output-format stream-json output) as a NEW tole session cc-<claude-session-id>; continue it with tole resume cc-<id> "<prompt>". Prompts and assistant text become messages, tool_use / tool_result blocks become intent / result entries (Claude Code tool names are kept as history only, never executed), model, version, branch and timestamps are recorded in the fact/cc_import register, 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 at Final. New core API: ccimport::{import_file, import_str, CcImport}, JsonlStorage::cwd. Not included (deferred): attaching to a running claude process (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, 409 when no turn runs) and the MCP tool tole_session_detach set a new CancelToken::detach() flag. The running tool settles and its result is committed; before the next provider call the turn writes a durable detached entry and settles pc=Final as the new TurnOutcome::Detached (stop reason detached; tole run exits 9). The session stays prompt-resumable, and a cancel always outranks a detach. A background job started with job_start in 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 a tole detach command for chat/run (they have no concurrent input while a turn runs; this lands with the terminal UI, #464), moving an in-flight run_command into a job (tools are not interruptible mid-call), nudges that survive a host restart (the queue is in memory; job_poll still has the result), and the ACP face.
  • MCP prompts and resources (#213): the MCP client now probes each server's prompts/resources capabilities (probe-first: a server that advertises neither is never asked and adds nothing). In tole 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 advertise resources add one ReadOnly mcp_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 run outside chat, quoted/spaced argument values, resource templates, resources/list surfacing, 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 with tole resume <new-id> "<prompt>". tole sessions --tree nests forks under the session they were cut from. A fork is a separate append-only file whose header records forkedFrom: {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. --at and 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 --fork flag on resume.
  • Image input (#212): tole run|chat|mission --image <path|data:…;base64,…> (repeatable) attaches images to the first message, and tole_core::turn::run_turn_with_images is 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 gets text + image_url content 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 loud model-capability error: TOLE_VISION=0 refuses 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 durable fact/context_overflow register in the commit that settles the turn; the next resume <id> "<prompt>" / chat message 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-compaction also disables the recovery pass; a failed summary call keeps the flag. tole doctor --tier catalog now prints a non-fatal ! warning (exit code and ledger unchanged) naming TOLE_CONTEXT_WINDOW=<tokens> when neither the setting nor /models gives a window, and reports the window it found otherwise. New core API: compaction::{is_context_overflow, mark_overflow, overflow_pending, clear_overflow}; doctor::run_cli takes 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-After seconds from the error text ((retry-after: N), #474), capped at 30 s. The wait is cancel-aware (1 s slices on the CancelToken) and each retry is a durable provider transient failure, retrying entry 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, ACP session/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 additive Provider::complete_with_cancel(&mut self, transcript, &CancelToken) (default delegates to complete, so embedders and mocks are unchanged); OpenAiProvider runs the request on a helper thread and re-checks the token every 100 ms, FailoverProvider and Box<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 1 against 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 fdatasync calls (5.7 with a Write tool); it now issues 2 (intent before the effect, finish after it) and a final answer 1, measured by the new fsync_budget test through the real turn loop. New Commit::defer_sync() writes a line without syncing; the next durable commit's fdatasync persists it. The turn loop defers only the usage row, the ToolCall hop, wrote_this_turn and 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 executed error result. New additive Provider::last_extra_tool_calls (default empty; ProviderOutput is unchanged), machine::begin_batch_member, and a "batch": true marker on the 2nd..Nth intents that the OpenAI wire flattening merges into one assistant tool_calls array. 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): the tole binary shrinks from 16.7 MB to about 9 MB. The profile is also set in crates/tole-cli/Cargo.toml so cargo install tole-cli gets 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-turnend on a build without the shell-tools feature (--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-pretool exit 2 no longer strands a headless caller (#476, owner decision 2026-11-03). The turn still parks in Planning, so a bare tole resume <id> is unchanged, but tole resume <id> "<prompt>" now settles the parked turn and runs the new prompt (it was refused with run_turn requires pc Idle or Final), which makes the --on-pretool help text true. The denial is now visible to the model's next request through a synthetic user-role denial_note entry (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 says the outcome is UNKNOWN: the effect may have run before the interruption; check state before retrying instead 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 empty Final with 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 /models probes keep their Err on non-2xx. The http status: N prefix is unchanged and a snippet never changes retry or failover classification.
  • Streaming provider requests reuse one connection (#479): complete_streaming stops at data: [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 detached tole-sse-drain thread, 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 what complete_streaming returns.
  • A second process can no longer write to a session another process has open (#475): a writable JsonlStorage holds an exclusive advisory lock on a sidecar <id>.jsonl.lock (survives compact(), released by the OS on crash), taken before the torn-tail repair, and resume/chat --resume against a held session fails with session is open for writing by pid N instead of appending stale records (duplicated seq, unreadable session). Each append also checks the file length against the last known good length (new StorageError::StaleHandle); StorageError::Locked is 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_turns of 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 status and 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_poll and 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