Repository navigation
Feature: print CLI replies in the order they happened, and fix loose numbered lists - #99
Merged
Merged
Conversation
AIService now raises OnResponseTextDelta with each chunk of a streaming chat turn, OnResponseStreamStarted at the start of every model call attempt, and exposes IsStreamingModelCall. A tool call that starts while the flag is true was made mid-reply, so the text before it is final; a text-written call runs after the stream, when it is false. The CLI uses these to print the text written before a tool call as its own block above the call's line, then prints only the rest of the turn once it finishes. Each auto-continuation turn prints as its own block. ReplyText.Unshown reconciles what was printed early with the turn's authoritative text, and is shared with the Desktop app. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A list with blank lines between items is loose, so Markdig wraps each item's text in <p> with whitespace-only text nodes around it. That whitespace led the item, pushing its text below the number and leaving a blank line after every item. The item's inline text is now trimmed at the ends; spacing between inline elements and the break between two paragraphs are kept. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the model writes something before using a tool ("let me check the docs…") and then answers afterwards, the CLI used to hold everything until the very end and print it as one block, below all of the tool lines. The two parts now print separately and in the order they happened: the lead-in above the tool line, the answer below it.
This PR also fixes numbered lists that rendered with each number alone on its own line.
What changed
AIServicenow reports reply text while it streams (OnResponseTextDelta), when each model call starts (OnResponseStreamStarted), and whether a model call is currently streaming (IsStreamingModelCall). The CLI uses these below. MandoCode Desktop uses the same hooks to show replies as they're written (separate Desktop PR).ReplyTexthelper: works out what's left to print by removing the already-printed parts from the final reply. Desktop uses it too.Why this was done
A reply printed out of order was hard to follow. The sentence the model wrote before looking something up ended up glued to the answer it wrote afterwards, below the tool calls that happened in between. Separately, numbered lists from some models came out with every number on a line of its own and a blank line after each item.
How it was tested
ReplyTextand for loose-list rendering. The full harness test suite passes.Notes
[Unreleased].