Repository navigation
ripple v0.12.0
Two themes drive this release. (1) pwsh output fidelity — encoded_scriptblock multi-line delivery (faster than tempfile, no disk I/O, same dot-source scope semantics) is now the default, unlocked by a fix to the VT interpreter feed that had the baseline grid drifting one chunk past the OSC C boundary. Non-terminating errors now surface as ⚠ Completed with errors + Errors: N on the status line so Write-Error / cmdlet failures can't hide behind a green ✓ just because the process exited 0. Stale $LASTEXITCODE no longer leaks from a preceding native-exe pipeline into the next pure-PS pipeline's reported exit code. (2) Output rendering hardening at the MCP boundary — OSC 8 hyperlinks are preserved as <URI> cells instead of dropped, dangling SGR on either side of the output block is cleaned up (leading no-op reset stripped, trailing reset added when output ends mid-colour), stale SGR no longer bleeds onto cells that are overwritten with different characters, and ripple-exec tempfile paths are stripped from PowerShell ConciseView error summaries so ripple's implementation detail stops leaking into AI error traces.
Separately: a new list_shells MCP tool replaces startup stderr noise with a queryable discovery endpoint (startup stderr is now two-tier — silent modes only surface user-actionable load issues); AI-initiated cd is no longer misattributed as user drift (replaced the cwd-snapshot heuristic with a provenance counter); PTY width tracks the visible ConHost width instead of flooring at 200 so \r-based self-repainting Write-Progress bars work; a safety-net try/finally guarantees HandleExecuteAsync releases the user-input hold gate on every exception path.
Acknowledgments
- @doraemonkeys — PR #7 (
\xNN→\uNNNNinsend_inputdocs) and PR #8 (surfacesend_inputin the busy-timeout hint). Both landed as in-repo doc fixes that close discoverability gaps the AI consumer would otherwise hit exactly when it needed to rescue a stuck console.
Added
-
Errors: Ncounter on the status line for PowerShell commands. PowerShell maintains an automatic per-runspace$ErrorArrayList that accumulates every cmdlet non-terminating error,Write-Errorinvocation, and thrown exception.ShellIntegration/integration.ps1snapshots$Error.CountatPreCommandLookupActionand emits the post-command delta as a new OSC 633;E;{N} marker; the worker carries the value throughCompletedCommandSnapshot.ErrorCount, the proxy reads it from the response, andFormatStatusLine(andBuildStatusLinefor cached drains) prepend| Errors: Nwhen N > 0. Zero is silent so the happy path keeps the existing line shape. Other shells emit no OSC E and stay at zero — no analogous always-on counter exists forWrite-Warning/Write-Information(cmdlets bypass any user-defined proxy via$PSCmdlet.WriteWarning, so they can't be reliably counted from inside the integration script), so warnings and info are intentionally not tracked. Three regression asserts inOscParserTestscover OSC E parsing (positive count, zero, malformed payload defaults to 0). -
OSC 8 hyperlinks preserved as
<URI>in the MCP response. Modern terminals (xterm, Windows Terminal, iTerm2, VS Code) accept\e]8;;<URI>\a link-text \e]8;;\ato make link-text clickable. Build tools (dotnet, some linters),Write-Information, and IDE integrations emit these around file paths and documentation URLs. Previously ripple dropped them with every other OSC, losing the destination — the AI saw only the link-text and couldn't reference the URI back to the user. NowCommandOutputRendererdetects OSC 8 (open and close variants, both BEL- and ST-terminated) and injects the captured URI into the grid as<URI>cells right after the link-text, e.g."click here<https://example.com/>". All other OSCs still drop silently. Six asserts added toCommandOutputFinalizerTestscovering BEL/ST terminators, params segment (id=foobetween the semicolons), unclosed opens, stray closes, and mix with surrounding OSC 0/7 traffic. -
MCP tool hint when large output spills to disk. When a command's output exceeds the 15 KB threshold and gets written to a spill file, the preview now surfaces ripple's own
search_files/read_fileMCP tools as the recommended way to drill into the spill file — instead of leaving the AI to reach for shellgrep/cat(which round-trips through the same PTY the command just ran in). The hint uses bare tool names so it stays valid no matter which MCP client prefix wraps ripple (ripple/ripple-stable/ripple-devall resolve via the client's tool list). -
encoded_scriptblockmulti-line delivery mode for the pwsh adapter. Newmultiline_deliveryschema value. Base64-encodes the multi-line body and sends a single-line. ([ScriptBlock]::Create([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String(<b64>))))invocation. Dot-sourcing preserves caller scope the same as the tempfile path but avoids disk I/O and history-filter bookkeeping entirely. Shares the body builder (BuildMultiLineTempfileBody) with the tempfile path so both deliveries produce identical echo + OSC-C semantics — only the delivery wrapper differs. Roughly 0.3–0.5s faster than tempfile on the warm path for the common multi-line case. -
⚠ Completed with errorsstatus badge. Post-command status splits into three outcomes instead of two:exit != 0→✗ Failed,exit == 0, errors > 0→⚠ Completed with errors,exit == 0, errors == 0→✓ Completed. pwsh commands that hit aWrite-Erroror non-terminating cmdlet failure exit 0 but bump$Error— a plain green ✓ understated what the AI needed to look at. The ⚠ badge pairs with the existingErrors: Ntag so one status line carries both outcome category and error count without a second round trip. Applied consistently at both the Tools surface andConsoleWorker's own rendering so the two sites can't drift. -
list_shellsMCP tool. Discovery endpoint for what values the current ripple build accepts as theshellargument toexecute_command/start_console. Returns a JSON object with ashellsarray — one entry per registered adapter carrying name, aliases, description, family (shell/repl/debugger), source (embedded/external), and the executablestart_consolewould actually launch (ornull+executable_notewhen the name / override is not on PATH). The tool description also documents that any absolute path can be passed asshellto launch an unregistered REPL — with the caveat that without a matching adapter ripple runs it in a minimal mode (no prompt-boundary detection, no exit code, no cwd tracking), so a YAML in~/.ripple/adapters/is the right move for anything used regularly. Aload_issuesobject on the response carries every parse error / collision / override detected at startup with auser_actionableflag.
Changed
-
Startup stderr goes two-tier. CLI modes (
--test,--list-adapters,--adapter-tests, etc.) still print the full[ripple adapters info]/WARNINGsummary — a human is reading the terminal. Silent modes (MCP stdio server, ConPTY worker via--console) now suppress the info-level roll-up entirely and print only the subset of issues a user can act on: parse errors and collisions involving an external YAML the user dropped in~/.ripple/adapters/. Embedded-only failures are ripple bugs the user can't fix, and firing them at every prompt was noise without a path to resolution. AI consumers needing the full picture calllist_shells. Supporting helpers on the registry:AdapterLoader.ParseErroris now a record carryingEmbedded/Externalsource;AdapterRegistry.LoadReportgainsCollision(withIsUserActionable),HasUserActionableIssues, andUserActionableSummary; the load report is persisted alongsideDefaultviaSetDefault(registry, report)solist_shellssurfaces startup issues without re-running the load.--list-adaptersoutput is updated for the typed report (parse errors show[source]prefix, collisions show(user-actionable)suffix). -
pwsh multi-line delivery default flipped to
encoded_scriptblock. Now that the baseline-bleed race that previously tripped encoded delivery is fixed upstream (see the OSC-aligned_vtStatefeed under Fixed),adapters/pwsh.yamldefaults toencoded_scriptblock. 20+ consecutive burn-in runs of the original bleed repro (if ($true) { "a"; "b"; 1..3 | ForEach-Object { "iter $_" } }) produce clean output on the new default.tempfileremains selectable for bodies whose decoded length would exceed PSReadLine's input line cap. -
execute_commandbusy-timeout hint now mentionssend_input. When a command times out, the response header previously pointed only atwait_for_completion, which never returns when the command is actually stuck on an interactive prompt (pager,Read-Host, y/n confirmation). The hint now surfacessend_inputas a peer tool with a role label (wait_for_completion (retrieve result), send_input (if stuck on interactive prompt / pager)) so the rescue path is discoverable at the moment it's needed. Contributed by @doraemonkeys in PR #8. -
send_inputdocumentation recommends JSON-native\uNNNNescapes. Both the tool andinputparameter[Description]strings previously advised C-style\xNNhex escapes (e.g.\x03for Ctrl+C,\x1b[Afor arrow-up). JSON does not accept\xNN, so strict parsers rejected callers and lenient parsers passed through four literal characters — either way the advertised "send Ctrl+C" behavior did not reach the PTY, and agents following the docs verbatim got stuck rescuing pager-blocked consoles. The docs now recommend\u0003/\u001b[Aand include an explicit note that JSON does not accept\xNN. Runtime behavior is unchanged:ConsoleWorker.UnescapeInputstill recognises the old\xNNform and is covered by existing tests; the new\uNNNNform is decoded by the JSON layer into real control bytes and passes throughUnescapeInputuntouched. Contributed by @doraemonkeys in PR #7. -
GHA workflow actions bumped to v5.
actions/{checkout,setup-dotnet,setup-node,upload-artifact,download-artifact}move from@v4to@v5ahead of GitHub's forced Node.js 24 switch on 2026-06-02 and Node 20 removal on 2026-09-16. No API changes needed.azure/login@v2is already on Node 24 and stays.
Fixed
-
Dangling SGR at output boundaries is now cleaned up. Two symmetric boundary cases previously leaked visible noise or bled colour into consumer state: (a) a LEADING
\e[m/\e[0mreset that serves no purpose at the MCP boundary (the consumer hasn't applied any SGR yet), e.g. Write-Progress cleanup dropping a reset at the bar's column which then attached as the SgrPrefix of the first non-bar character and showed up as[maftergarbage; (b) a MISSING trailing reset when the output ends mid-colour — observed whenWrite-Erroror a coloured diagnostic's final byte is the message text, with no\e[0mto close, leaving the consumer's next prompt stuck red.CommandOutputFinalizer.CleanStringnow strips leading reset-only SGR sequences AND appends\e[0mwhen the cumulative SGR state at end-of-output is non-default (determined by scanning the last SGR sequence: parameters empty or all-zero = reset, anything else = setter). Eight regression asserts inCommandOutputFinalizerTestscover single / chained leading resets, preserved leading setters, missing / existing / bare-form trailing resets, plain text with no SGR, and the combined case. -
Tempfile path no longer leaks into multi-line AI command error output. Multi-line AI commands are wrapped into a
.ripple-exec-<pid>-<guid>.ps1(or.cmd/.sh) file and dot-sourced, which is invisible for the happy path but PowerShell'sConciseViewerror renderer prefixes the summary with{Cmdlet}: {TempfilePath}:{Line}, exposing ripple's implementation detail. AI consumers had no way to know that path was a wrapper they didn't write — it just looked like an unrelated file in their error trace.CommandOutputFinalizer.CleanStringnow strips any line containing aripple-exec-<pid>-<hex>.{ps1,cmd,sh}reference (Windows or POSIX flavor); theLine | N | <source>block below — which carries the actual diagnostic — is preserved untouched. Single-line AI commands never wrap, so they never produced this leakage and stay unaffected. Five regression asserts inCommandOutputFinalizerTestscover pwsh ConciseView output, bash on POSIX, cmd.exe.cmdpaths, mid-line occurrences, and a negative case verifying that unrelated.ps1paths are untouched. -
Stale SGR no longer bleeds into text that overwrites previous cells.
CommandOutputRenderer.WriteCharusedprefix ?? existing.SgrPrefixon every cell overwrite, which inherited the old cell's SGR prefix whenever no new SGR was pending. That's correct for ConPTY repaint idempotence (same char redrawn should keep its color), but wrong for genuine content changes: PowerShell'sWrite-ProgressMinimal view leaves reverse-video\e[7mcells on the row it used for the bar, and the cleanup path doesn't reset the SGR attribute on those cells before normal text later writes over them. Observed:Write-Progress ... ; "after"produced[mafter [7mprogress(garbled — reverse video leaked into random words). Fixed by splitting the overwrite decision: (a) new SGR pending → use it; (b) same char, no new SGR → keep existing (repaint); (c) different char, no new SGR → drop existing SGR — the previous character and its SGR belonged together. Three regression asserts added toCommandOutputFinalizerTests: overwrite-diff drops stale SGR, repaint-same-char preserves it, partial overwrite drops on touched cells while leaving the tail untouched. -
Stale
$LASTEXITCODEno longer bleeds into subsequent pure-PowerShell pipelines.ShellIntegration/integration.ps1's prompt fn previously read$global:LASTEXITCODEverbatim as the OSC D exit code.$LASTEXITCODEis only updated by native executables, so after e.g.cmd /c "exit 7"the value stayed at 7 and every subsequent innocent PS pipeline (1..3 | ForEach-Object {...},Get-Date) was reported asFailed (exit 7). Fixed by: (1) capturing$?as the first statement of the prompt fn — it's PowerShell's canonical pipeline-success indicator and is updated by cmdlets, natives, and statements alike; (2) snapshotting$LASTEXITCODEatPreCommandLookupActionso the prompt fn can tell whether the value was updated BY this pipeline or inherited; (3) resolving the exit code in priority order:$?true → 0;$?false and$LASTEXITCODEchanged non-zero → use it;$?false otherwise → generic failure 1. Multi-line AI pipelines (run via. 'tempfile.ps1'; Remove-Item '...') would otherwise see$?reflect Remove-Item, soBuildMultiLineTempfileBodynow stashes$?and$LASTEXITCODEinto globals inside the tempfile's scope that the prompt fn reads with priority. Two regression tests added toadapters/pwsh.yaml:cmdlet_error_surfaces_exit_1(cmdlet error → exit 1, not stale 0) andlastexitcode_does_not_leak_after_native(setup native exit 7, eval pure PS → must be exit 0). -
AI's own
cdis no longer misattributed as a user-initiated drift. Drift detection previously compared the source console'sLastAiCwdagainst the currentOSC 633;P;Cwd=snapshot; if the two diverged for any reason — including internal state lag such as standby-rotation ordering or a race betweenRecordShellCwdand the nextget_status— the proxy concluded the human had moved the shell and emitted a spurioussource #N was moved by user to '...'; ran in #M at your last known cwd '...'routing notice while silently reverting the AI to a stale cwd. Replaced with a provenance counter (CommandTracker.UserCmdsSinceLastAi) that increments exactly once per user-typed command at OSC A (closing a user-busy cycle) and resets to 0 on everyRegisterCommand. The worker now exposes the counter as auserCmdsSinceLastAifield onget_status, andConsoleManager.PlanExecutionAsyncreads it instead of comparing cwd snapshots. AI-initiated cd → counter stays 0 → no drift; user-initiated command (cd or otherwise) → counter increments → drift handled correctly. Removes the oldIsCwdDriftedhelper and its unit tests; adds 13 new provenance-counter asserts toCommandTrackerTestscovering pwsh (B→C→D→A), bash/zsh (C→D→A), bare-OSC-A repeats, startup-OSC-B gating, and the interleaved AI-cd / user-cmd / AI-cmd scenario that reproduces the original bug in unit form. -
Explicit LineFeed clears a stale soft-wrap flag on baseline rows. An explicit LineFeed means the destination row is a new logical line, not a soft-wrap continuation. Baseline rows that were wrap continuations of pre-command content (e.g. a long input echo that has since been erased) previously kept their
ContinuedFromAboveflag, causing the render-time join logic to chain command-emitted rows onto predecessors and produce collapsed output likeabiter 1\niter 2instead ofa\nb\niter 1\niter 2. Clearing the flag when LineFeed targets a row within the baseline range lets each command-written line stand on its own at render time. -
PTY width tracks the visible console width instead of flooring at 200. The old floor-at-200 policy was meant to dodge mid-word soft-wraps in AI output but broke self-repainting lines. pwsh's
Write-Progresspads its bar to the declared PTY width; when that exceeded the visible ConHost width the bar wrapped physically and the trailing\rreturned only to the wrapped row, leaving each progress update stacked vertically instead of overwriting in place. Matching the visible width makes\r-based in-place repainting behave correctly. Mid-word splits on very narrow terminals remain a theoretical edge case the AI can still read around (and they match what the user is looking at anyway). Same change in the spawn-time path and inResizeMonitorLoop— they stayed in sync with the old policy and stay in sync with the new one. -
_vtStatefed in OSC-aligned slices so baseline reflects the OSC C boundary.ConsoleWorker.ReadOutputLoopused to advance the live VT interpreter with an entire PTY chunk before the OSC event loop ran, so the snapshot handed toCommandOutputRendereratCommandExecutedreflected end-of-chunk state rather than the screen at the OSC C byte. When a single PTY read straddled OSC C and downstream command-output bytes — the common case onencoded_scriptblockmulti-line delivery — the baseline grid carried cells from the command output the renderer was about to replay and the cursor landed past the row the AI expected first output to reach. The renderer then wrote"a"onto a row whose stale tail was"ter 3", producing"ater 3"(or dropped the line entirely when the cursor ended up on an already-written row). Feed the VT interpreter in slices aligned to OSC event offsets instead. Snapshot atCommandExecutednow reflects state as of the OSC C byte exactly. Cleaned text (OSC 633 stripped) is equivalent to raw for VT interpretation — OSC is dropped byApplyOsc, DSR queries are stripped upstream — so no state semantics change.CommandOutputRendererTestsnow documents the renderer's baseline sensitivity and the slice-by-offset happy-path assertion. -
_holdUserInputgate and_heldUserInputqueue are now guaranteed to release on every exit path. The hold-gate + queue mechanism (held user keystrokes replay after the AI command finishes so partial typed input isn't lost) previously leaked on any unhandled exception path —WriteToPtyfailures,Task.WhenAnysurfacing an unexpected exception type,snapshotTaskLocalthrowing non-TimeoutException/ non-InvalidOperationException. The flag would stay true, user keystrokes kept piling into a queue nobody would drain, and the nextexecute_commandwould start with an already-poisoned shell.HandleExecuteAsyncnow wraps the body from_holdUserInput = trueonwards in try/finally and callsReleaseHeldUserInput()from the finally. Explicit releases on the happy path, timeout branch, and finalize-failed branch are preserved so the shell still gets the "head start" semantics (release before JSON serialization, keystrokes replay while the proxy formats the response).ReleaseHeldUserInputis idempotent (flag assignment +TryDequeueloop empty-exit + flushtry/catch) so the duplicate call on normal paths is a no-op.