Skip to content

refactor(ptyhost): move PtyHost + ImagePasteHost + FilePasteHost interfaces - #322

Merged
attson merged 1 commit into
mainfrom
refactor/move-ptyhost-interfaces
Aug 4, 2026
Merged

refactor(ptyhost): move PtyHost + ImagePasteHost + FilePasteHost interfaces#322
attson merged 1 commit into
mainfrom
refactor/move-ptyhost-interfaces

Conversation

@attson

@attson attson commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Milestone 6-d. The three interfaces have always described "what a PTY-owning host must implement to be adopted by the relay". They lived in `internal/relay/adopt.go` by history — but they're not relay-specific types; they're the abstract contract for anything that owns a PTY-like byte stream (a real OS PTY, an SSH channel, a browser bridge, a test double).

Move to `internal/ptyhost/interfaces.go` alongside the concrete `Host` struct they were shadowing. `adopt.go` now imports `internal/ptyhost` and qualifies as `ptyhost.PtyHost` / `ptyhost.ImagePasteHost` / `ptyhost.FilePasteHost`.

Changes:

  • `adopt.go`: drop the three type decls; import `ptyhost`; update the `AdoptSession(host ptyhost.PtyHost)` signature and the two type assertions on paste-capable adapters.
  • No consumer names the types explicitly (`desktopPtyHost` / `sshPtyHost` satisfy them structurally). The interfaces are moved, not renamed; any adapter compiled before this change still satisfies them.
  • `adopt_test.go` only mentions the names in comments — no code change.
  • `.gitignore`: add `.claude/` for local worktree hygiene.

Test plan

  • `go build ./...` clean
  • `go test ./internal/... ./desktop/...` green (relay + desktop suites including AdoptSession round-trips)

…rfaces

The three interfaces have always described "what a PTY-owning host must
implement to be adopted by the relay". They lived in
internal/relay/adopt.go by history — but they're not relay-specific
types; they're the abstract contract for anything that owns a PTY-like
byte stream (a real OS PTY, an SSH channel, a browser bridge, a test
double).

Move to internal/ptyhost/interfaces.go alongside the concrete Host
struct they were shadowing. adopt.go now imports internal/ptyhost and
qualifies as ptyhost.PtyHost / ptyhost.ImagePasteHost /
ptyhost.FilePasteHost.

- adopt.go: drop the three type decls; import ptyhost; update the
  AdoptSession(host ptyhost.PtyHost) signature and the two type
  assertions on paste-capable adapters.
- No consumer names the types explicitly (desktopPtyHost / sshPtyHost
  satisfy them structurally). The interfaces are moved, not renamed;
  any adapter compiled before this change still satisfies them.
- adopt_test.go only mentions the names in comments — no code change.

`go test ./internal/... ./desktop/...` green (relay + desktop suites
including AdoptSession round-trips).
@attson
attson merged commit dfcfb83 into main Aug 4, 2026
7 checks passed
@attson
attson deleted the refactor/move-ptyhost-interfaces branch August 4, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant