refactor(cli): unify wire path through TelepathClient via RttTransport#6
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors telepath-cli to route all RPC traffic through telepath-host::TelepathClient by introducing an RTT Read/Write adapter, eliminating duplicated framing/serde logic in the CLI.
Changes:
- Added
RttTransport(owningSession + Rtt) that implementsstd::io::Read + Writefor probe-rs RTT I/O. - Updated
telepath-clipingand REPL to useTelepathClient::call_raw, plus atransport_mut()accessor to drain RTT debug logs. - Simplified CLI dependencies by removing direct
telepath-wireandcobsusage in favor oftelepath-host.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tools/telepath-cli/src/rtt_transport.rs | Adds RTT adapter implementing Read/Write, deadline handling, and debug log draining. |
| tools/telepath-cli/src/main.rs | Switches ping + REPL to use TelepathClient over RttTransport; removes inline wire/framing logic. |
| tools/telepath-cli/Cargo.toml | Drops direct wire/framing deps; adds telepath-host dependency. |
| crates/telepath-host/src/lib.rs | Adds TelepathClient::transport_mut() for side-channel transport access. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace inline COBS/postcard/RTT logic in cmd_ping with TelepathClient::call_raw. Add RttTransport (tools/telepath-cli/src/rtt_transport.rs) that owns Session+Rtt and implements std::io::Read+Write, bridging probe-rs's &mut Core per-call API to the trait interface. Add transport_mut() to TelepathClient for side-channel access (debug log draining). Remove direct cobs and telepath-wire deps from telepath-cli. Closes #2 References Stage A (A2) in #3 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Read::read returns Ok(0) immediately when buf.is_empty() (std::io contract) - TimedOut error message changed to "RTT read deadline exceeded"; no longer claims a fixed 5s value that the caller may have configured differently - set_read_deadline doc clarified: deadline persists across all subsequent reads (correct for TelepathClient::call_raw's whole-RPC semantics); added clear_read_deadline() as the symmetric inverse Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tarotene
force-pushed
the
feat/cli-rtt-transport
branch
from
May 20, 2026 16:45
27f4341 to
aaa293c
Compare
This was referenced May 20, 2026
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
tools/telepath-cli/src/rtt_transport.rs:RttTransportstruct that ownsSession + Rttand implementsstd::io::Read + std::io::Write, bridging probe-rs's&mut Core-per-call API to the trait interface expected byTelepathClientcmd_ping; replace withTelepathClient::call_rawRead::readbusy-loops with 1ms sleep until data arrives, preventingread_exactfrom seeingOk(0)as EOF; respects a configurableread_deadline(default: 5 seconds)drain_debug_logs(RTT ch0 passthrough) moved intoRttTransportand called fromcmd_pingand the REPL loop via the newTelepathClient::transport_mut()accessorcobs,telepath-wiredeps fromtelepath-cli/Cargo.toml; addtelepath-hostpath depTest plan
cd tools/telepath-cli && cargo build— cleancd tools/telepath-cli && cargo clippy -- -D warnings— cleancd tools/telepath-cli && cargo fmt --check— cleancargo build --workspace(root) — workspace unaffected; telepath-host re-compiles withtransport_mut()cd examples/nrf52840-dk && cargo run --releasethencd tools/telepath-cli && cargo run -- ping→ping -> 0xDEADBEEFCloses #2
References Stage A (A2) in #3
🤖 Generated with Claude Code