Skip to content

feat(defterm): Stage A — attach to an externally-created PTY#35

Merged
yeroo merged 1 commit into
mainfrom
feat/defterm-attach
Jul 8, 2026
Merged

feat(defterm): Stage A — attach to an externally-created PTY#35
yeroo merged 1 commit into
mainfrom
feat/defterm-attach

Conversation

@yeroo

@yeroo yeroo commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Stage A of Default Terminal delegation (T2-13) — see docs/defterm-feasibility.md for the full staged plan.

Adds the ability for agwinterm to host a console session it did not spawn — the prerequisite for the Windows default-terminal handoff, where conhost/OpenConsole hands the terminal the pipe + signal handles of an already-running console client.

What lands

  • AttachedPty : IPtyConnection over externally-provided handles: conOut (read console VT output), conIn (write user input), a signal pipe (resize via the ConPTY resize packet), and an optional client process handle for exit detection.
  • TerminalSession.Attach(...) wires it into the existing emulator pump + input path; exit reports on client death or output-pipe EOF.

Safe & self-contained

No COM, no registry, nothing system-wide. This is pure plumbing that's independently testable.

Verification

New raw-pipe test (no real ConPTY/child needed): external output pumps into the emulator and input routes back out the conIn pipe. 110/110 Core, 17/17 Pty.

Next stages (need sandbox testing)

  • B — out-of-proc ITerminalHandoff3 COM server (CLSID + handoff → Attach)
  • C — "set as default terminal" registry (HKCU\Console\%%Startup) + OpenConsole delegation, with a one-click revert

🤖 Generated with Claude Code

First stage of Default Terminal delegation (T2-13). Adds the ability for
agwinterm to host a console session it did NOT spawn — the prerequisite for
the Windows default-terminal handoff, where conhost/OpenConsole hands the
terminal the pipe/signal handles of an already-running console client.

- AttachedPty : IPtyConnection over externally-provided handles (conOut
  read, conIn write, signal pipe for resize via the ConPTY resize packet,
  optional client process handle for exit detection).
- TerminalSession.Attach(...) wires it into the existing emulator pump /
  input path; exit is reported on client death or output-pipe EOF.

Safe and self-contained: no COM, no registry, nothing system-wide yet.
Verified with a raw-pipe test — external output pumps into the emulator and
input routes back out the conIn pipe. 110/110 Core, 17/17 Pty.

Next: Stage B (out-of-proc ITerminalHandoff3 COM server) and Stage C (set-
as-default-terminal registry + OpenConsole), both needing sandbox testing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yeroo
yeroo merged commit 1009329 into main Jul 8, 2026
1 check passed
@yeroo
yeroo deleted the feat/defterm-attach branch July 8, 2026 18:46
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