Skip to content

feat(tui-harness): add SVG screenshots and HTTP transport#571

Merged
jesseturner21 merged 6 commits intomainfrom
feat/tui-screenshot-svg
Mar 19, 2026
Merged

feat(tui-harness): add SVG screenshots and HTTP transport#571
jesseturner21 merged 6 commits intomainfrom
feat/tui-screenshot-svg

Conversation

@aidandaly24
Copy link
Contributor

Description

Adds two major capabilities to the TUI agent harness:

  1. SVG Terminal Screenshots — A zero-dependency renderer that walks the xterm buffer cell-by-cell, resolves ANSI 256-color palette and RGB colors, groups consecutive cells with identical styles into spans, and emits a self-contained SVG with optional macOS-style window chrome. Supports dark/light themes, cursor rendering, and XML escaping. Integrated into TuiSession.screenshot() and the tui_screenshot MCP tool with format: 'svg', theme, and savePath parameters.

  2. HTTP Transport — Adds StreamableHTTPServerTransport support so the MCP server can run as an independent HTTP process outside Claude Code's sandbox. This fixes the posix_spawnp failure that prevented node-pty from spawning PTY child processes when the server ran as a sandboxed stdio subprocess. Supports --http and --port CLI flags, with stdio mode preserved as default for backward compatibility.

Related Issue

Closes #

Documentation PR

N/A — documentation is included in this PR (docs/tui-harness.md).

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Additional testing:

  • 8 new unit tests for SVG renderer (themes, window chrome, cursor, XML escaping, custom title)
  • End-to-end HTTP transport test: initialize → tui_launch (PTY spawn) → tui_send_keys → tui_screenshot → tui_close
  • Verified SVG screenshot of AgentCore CLI create page with correct colors, text content, and layout

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@aidandaly24 aidandaly24 requested a review from a team March 19, 2026 15:51
@github-actions github-actions bot added the size/xl PR size: XL label Mar 19, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 19, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.22% 4898 / 11332
🔵 Statements 42.81% 5188 / 12116
🔵 Functions 42.47% 900 / 2119
🔵 Branches 44.69% 3163 / 7077
Generated in workflow #1041 for commit 2808262 by the Vitest Coverage Report Action

Copy link
Contributor

@jesseturner21 jesseturner21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send it

@aidandaly24 aidandaly24 force-pushed the feat/tui-screenshot-svg branch from f09fe37 to fd6b483 Compare March 19, 2026 15:58
@github-actions github-actions bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 19, 2026
Zero-dependency SVG renderer that walks the xterm buffer cell-by-cell,
resolves ANSI 256-color palette and RGB colors, groups consecutive cells
with identical styles into spans, and emits a self-contained SVG with
optional macOS-style window chrome.

Includes dark and light themes, cursor rendering, and XML escaping.
Add screenshot() method to TuiSession, export renderer types from barrel,
and extend tui_screenshot MCP tool with format (text/svg), theme
(dark/light), and savePath parameters.
Document MCP tool usage for SVG screenshots, library API, theme options,
and markdown embedding instructions.
Add StreamableHTTPServerTransport support so the MCP server can run as
an independent HTTP process outside Claude Code's sandbox. This fixes
the posix_spawnp failure that prevented node-pty from spawning PTY
child processes when the server ran as a sandboxed stdio subprocess.

Supports --http and --port flags, with stdio mode preserved as default
for backward compatibility.
Switch .mcp.json from stdio to HTTP transport (http://127.0.0.1:24100/mcp)
and add scripts/start-tui-harness.sh for one-command server startup.
Document the sandbox limitation with stdio transport and how HTTP mode
solves it. Include quick start, Claude Code configuration, custom port
options, and backward compatibility notes.
@aidandaly24 aidandaly24 force-pushed the feat/tui-screenshot-svg branch from fd6b483 to 2808262 Compare March 19, 2026 16:05
@github-actions github-actions bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 19, 2026
@jesseturner21 jesseturner21 merged commit 9d964d5 into main Mar 19, 2026
18 of 19 checks passed
@jesseturner21 jesseturner21 deleted the feat/tui-screenshot-svg branch March 19, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants