feat(renderer): sub-plan C.1 — SwiftTerm fork + capture/replay harness#1
Merged
Conversation
Tracks logos-renderer-base branch (pinned to v1.13.0 — upstream main currently broken with undefined SyncDebug references). Behavior identical to upstream v1.13.0 until C.2 begins renderer modifications. Fork URL: https://github.com/PsychQuant/SwiftTerm
Standalone Swift Package executable for recording + replaying PTY streams into SwiftTerm. Lives in Tools/ — not bundled into Logos app. CLI skeleton with ArgumentParser; Record + Replay subcommands stubbed out, implementations in next tasks. Adapted from plan: renamed main.swift to SwiftTermReplay.swift to satisfy Swift's @main + executable-target rule.
Uses openpty + posix_spawn to launch child in a PTY (fork() is unavailable in modern Swift on Darwin). Tees stdout to: (a) ttyrec file with little-endian Int32 (sec, usec, len) headers, (b) parent's stdout for user visibility. POSIX_SPAWN_SETSID (0x0400 on Darwin) makes the child a new session leader, which acquires the slave PTY as its controlling terminal. Tested with 'ls -la /tmp' — produces valid ttyrec format. Note: arguments after the subcommand name must use -- separator if they look like flags (e.g. 'record --output file.ttyrec -- ls -la').
NSApp host with TerminalView. Parses ttyrec format (3 little-endian Int32 headers + payload chunks). Feeds bytes via view.feed(byteArray:) at recorded timing scaled by --speed multiplier (1.0=real, 0=instant). Now we can: (a) record any claude scenario once, (b) replay it deterministically through renderer changes in C.2+. Provides regression visibility we lack from one-shot live runs. Smoke-tested: /tmp/test-ls.ttyrec parses to 1 chunk and feeds without error. (Window display verified manually — running headless replay exits cleanly via timeout.)
…ements Captures recorded (2 of 5 planned): - 01-simple-streaming.ttyrec - 02-edit-tool.ttyrec Tool refinements: - Package.swift excludes Captures/ from compilation (test fixtures only) - Recorder.swift improvements (+13 lines) - Replayer.swift improvements (+16/-11 lines) Missing (deferred to follow-up): - 03-plan-mode.ttyrec - 04-rate-limit.ttyrec (best effort) - 05-permission.ttyrec - docs/renderer-c1-retrospective.md (C.2 starting points) - baseline screenshots in docs/renderer-baselines/ Background agent rate-limited mid-Task-6.
SwiftTerm 1.13 internals map (entry points, color/font props, caret). Hypothesized tearing pattern for 02-edit-tool.ttyrec (pending visual verification). 5 concrete C.2 starting points: drawRect vs CALayer, buffer-at-parser vs buffer-at-cell, CVDisplayLink timing, first acceptance test, prototype risk. Background-agent-execution lessons: pre-create forks, isolate branches, prefer inline over background for long-running plans.
kiki830621
added a commit
that referenced
this pull request
May 26, 2026
…40 tests pass Cumulative milestone: Logos shell + claude host + 5-rule auto-handle. The #1 killer feature is live: claude no longer blocks on known prompts (rate-limit / trust / Bash permission / press-Enter) while you stepped away. 8 test suites total. PR #1 (sub-plan C.1 partial) awaiting review + merge. Sub-plan C.2 (frame-rate renderer) and sub-plan E (multi-account) are independent next steps.
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
Sub-plan C.1 partial completion via background agent (rate-limited mid-Task-6).
What's done
PsychQuant/SwiftTermfork (logos-renderer-basebranch)Tools/SwiftTermReplay/— standalone Swift Package withrecord+replaysubcommands01-simple-streaming,02-edit-tool)docs/renderer-c1-retrospective.mdwith C.2 starting pointsWhat's deferred
docs/renderer-baselines/directory contentsReview notes
971e3d6). Main has D-Tasks 2-7 (auto-handle complete). Merging this PR will combine fork-swap + auto-handle on main.swift build+swift testboth green on this branch (31 tests).cd Tools/SwiftTermReplay && swift buildbuilds standalone tool.Test plan