Skip to content

feat(agent): markdown rendering, spacing fixes, and API endpoint update#849

Merged
codyde merged 3 commits intomasterfrom
feat/agent-repl-polish
Apr 17, 2026
Merged

feat(agent): markdown rendering, spacing fixes, and API endpoint update#849
codyde merged 3 commits intomasterfrom
feat/agent-repl-polish

Conversation

@codyde
Copy link
Copy Markdown
Collaborator

@codyde codyde commented Apr 17, 2026

Summary

  • Convert each agent response block into GitHub-style markdown via termimad once streaming completes (on ToolCallReady / WorkflowCompleted); text still streams raw in real-time
  • Fix spacing in the REPL — one blank line between consecutive agent responses, tool spinner stays directly attached to preceding text, visible ✓ Done / ✗ Tool failed badge after each tool call
  • Update chat endpoint from /api/v1/chat to /api/v1/agent to match the new backboard route
  • Refactor streaming loop: bundle state into HumanRenderer, extract stream_human / stream_json / tool_badge helpers (drops ~60 lines of duplication between run_single_shot and run_repl)

Test plan

  • railway agent — single-turn response renders as markdown after streaming completes
  • railway agent — multi-tool-call turn shows ✓ Done after each tool and a blank line before the next Railway Agent: header
  • railway agent -p "…" — single-shot human and --json output both work
  • railway agent --json in REPL — JSON output still captures thread_id for continuation
  • Errors / aborts still display correctly
  • Non-TTY output (piped to a file) doesn't emit ANSI escapes or spinner

🤖 Generated with Claude Code

codyde and others added 2 commits April 17, 2026 00:43
The thinking spinner and the Chunk/ToolCallReady handlers were each
unconditionally emitting a `println!()`, stacking multiple blank lines
between user input and the agent's response. Drop the unconditional
newline before the initial spinner, and only emit a leading newline in
the Chunk/ToolCallReady handlers when a spinner wasn't just cleared
(since `finish_and_clear` already leaves the cursor on a blank line).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Stream raw text during agent responses, then re-render each block with
  termimad on ToolCallReady / WorkflowCompleted for GitHub-style markdown
- Track block start position via crossterm cursor::position so the re-render
  only erases the current block, not prior tool output
- Render a "✓ Done" / "✗ Tool failed" badge after each tool call so the
  indicator stays visible once the spinner finishes
- Insert a blank line between consecutive agent responses within a turn;
  keep the tool spinner directly attached to the preceding text
- Update chat endpoint from /api/v1/chat to /api/v1/agent
- Refactor: bundle streaming state into HumanRenderer, extract
  stream_human / stream_json / tool_badge helpers to drop ~60 lines of
  duplication between run_single_shot and run_repl

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codyde codyde added the release/minor Author minor release label Apr 17, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@m-abdelwahab m-abdelwahab self-requested a review April 17, 2026 15:58
@codyde codyde merged commit 49941e3 into master Apr 17, 2026
6 checks passed
@codyde codyde deleted the feat/agent-repl-polish branch April 17, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/minor Author minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants