Skip to content

Show the agent's conversation on the phone - #252

Merged
yansfil merged 6 commits into
mainfrom
mobile-conversation
Sep 29, 2026
Merged

yansfil merged 6 commits into
mainfrom
mobile-conversation

Conversation

@yansfil

@yansfil yansfil commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Related: #251 (가로 overflow 수정). 이 브랜치는 #251 커밋 위에 쌓여 있어서, #251을 먼저 머지하면 diff가 이 PR 몫만 남습니다.

Summary

폰 상세에서 Claude/Codex agent의 마지막 화면만 보였습니다.
두 agent는 터미널의 alternate screen에서 돌기 때문에 Herdr가 scrollback을 0줄로 보관하고, pane.read는 현재 화면(약 56줄)만 돌려줍니다.
이제 상세는 대화 탭으로 열립니다. hided가 Herdr가 보고한 세션의 transcript를 읽어, 내 메시지와 agent 답변을 30개씩 페이지로 보냅니다.
agent 답변의 Markdown(제목, 목록, 표, 코드 블록, 인용)은 메시지마다 한 번 파싱해 그립니다. 링크와 이미지는 텍스트로만 보여서 페이지가 어디로도 이동하지 않습니다.
위로 당기면 이전 페이지를 불러오고, agent가 새로 쓰는 메시지는 저절로 붙습니다.
터미널 탭은 지금까지의 pane 화면입니다. 대화가 없는 agent(SSH 기기, 세션 미보고, Claude/Codex 외)는 전처럼 터미널만 보입니다.

대화 탭. Before는 전환 버튼이 한 줄을 따로 차지하고, After는 ← 목록과 경과 시간 사이로 옮겨 헤더가 188px에서 133px로 줄었습니다. 본문은 Markdown으로 그린 agent 답변. iPhone 13 크기(390px), 합성 대화 내용.

Review

  • 판단해 주세요: 코드 블록은 색 입히기 없이 폰 폭에서 줄바꿈합니다. 링크는 누를 수 없는 텍스트입니다.
  • 판단해 주세요: 세션을 보고하지 않은 pane은 대화 탭을 숨깁니다. 같은 폴더의 최신 transcript는 옆 pane의 것일 수 있어서입니다. 지금 Codex pane은 대부분 세션을 보고하지 않아 터미널만 보입니다.
  • 판단해 주세요: 대화 | 터미널을 맨 윗줄 가운데에 둬서 헤더가 따로 늘지 않습니다. 목록 버튼, 전환, 경과 시간이 한 줄에 들어갑니다(390px 폭 기준).
  • 조심해서 볼 파일: hided/src/mobile/phone.rs - 열린 상세마다 1초에 한 번 도는 task(high-frequency path). 대화 탭에서는 pane.get 한 번과 transcript 길이 확인만 하고, 늘어난 만큼만 읽습니다.
  • 조심해서 볼 파일: hided/src/mobile/conversation.rs - 폰으로 나가는 내용의 경계. 도구 출력과 injected context는 걸러지고, 메시지 하나는 20,000자에서 잘립니다.
  • 조심해서 볼 파일: hide-session/src/lib.rs read_page_before - 거꾸로 읽는 경계 계산(off-by-one 위험).
  • 조심해서 볼 파일: web/src/mobile/markdown.tsx - transcript 텍스트를 React 요소로 그리는 곳. HTML은 문자열로만 들어가 React가 escape합니다(dangerouslySetInnerHTML 없음).

Evidence

  • 확인한 것: e2e/mobile.spec.ts 2개 통과(실제 hided + 격리된 Herdr). 70턴 transcript에서 30 → 60 → 70개 불러오기, 새 메시지 도착, 폰으로 간 frame에 도구 출력과 injected 문구 없음, 가로 overflow 0, 세션 없는 pane은 탭 없이 터미널.
  • 확인한 것: 실제 transcript 측정. 96MB 파일에서 대화 텍스트는 0.3MB(0.3%). 가장 큰 60개 파일 중 57개에 256KB 넘는 줄(1,845개, 대부분 도구 결과)이 있어서, 기존 SessionCursor 대신 크기와 상관없이 긴 줄을 건너뛰는 거꾸로 읽기를 씁니다.
  • 확인한 것: Markdown 파싱 비용. 이 Mac에서 가장 큰 transcript의 agent 답변 370개(112KB)를 전부 파싱하는 데 5.6ms, 가장 긴 30개는 2.5ms. 메시지는 도착 후 바뀌지 않아 한 번만 파싱합니다. e2e는 굵게, 목록, 코드 블록이 그려지고 **가 남지 않는 것을 확인합니다.
  • 확인한 것: hide-session 27개, hided lib 135개, hided --test mobile 8개, web unit 25개(Markdown 3개 포함)/typecheck/lint/build, verify-web.sh 전체, verify-cargo.sh lint, 디자인 계약 검사 통과.
  • 확인하지 못한 것: hided의 나머지 통합 테스트(handshake 등)는 로컬 디스크가 가득 차서(여유 약 400MB) 링크하지 못했습니다. CI 결과로 확인이 필요합니다.
  • 확인하지 못한 것: 실제 iPhone, 실제 Claude/Codex 세션, 원격 tailnet에서는 확인하지 못했습니다. 설치된 앱에도 넣지 않았습니다. Markdown 캡처는 디스크 부족으로 WebKit을 다시 설치하지 못해 Chromium의 iPhone 에뮬레이션으로 찍었습니다.
추가 증거

Markdown(제목, 목록, 표, 코드 블록, 인용), 다크 모드, 터미널 탭. 전환 버튼을 옮기기 전 캡처입니다.

AI tooling: 대부분 AI 도구. 캡처와 e2e 단언을 대조했고, 레이아웃(터미널식 기록)과 대화/터미널 전환은 사용자가 직접 골랐습니다.

The pane is as wide as the desktop, so its rows drawn with white-space: pre
scrolled the phone's detail sideways. Each row now wraps at the phone's
width, a row drawn only with box-drawing characters (a TUI's rule) is clipped
to one line instead of stacking, and a row's trailing background padding
stops at the page margin.
Claude Code and Codex draw in the alternate screen, so Herdr keeps no
scrollback for their panes and pane.read gives a phone only the screen.
hided now reads the transcript of the session Herdr reports for the pane,
on this Mac, and sends the phone its operator and agent messages in pages
of 30, read backwards from a byte cursor, then what the agent appends.
Tool output and injected context stay on the Mac, and a transcript line of
any size is passed over instead of stopping the reader.

hide-session gains read_page_before, the backwards reader both use.
A detail now opens on 대화: the agent's newest 30 messages from its
transcript, the operator's as ❯ blocks and the agent's text at full width,
with the time after each turn and older pages a pull to the top away, up to
300 messages. 대화 | 터미널 switches to the pane's rows; an agent with no
conversation (an SSH device, no reported session, not Claude or Codex)
shows its terminal alone, as before.
A poll read a 512 KiB window for every append, however small; it now reads
back only as far as the bytes appended, up to that window.
Agent messages showed their Markdown marks as text. Each message is now
parsed once with @lezer/markdown and GFM, already the editor's grammar, and
drawn as plain elements: headings, emphasis, lists, tables, quotes, and code
wrapped at the phone's width without highlighting. A link or an image stays
its text, so nothing on the page navigates. The operator's own messages
stay plain.
The switch had a row of its own under the agent's head, and the header took
188 of the phone's points. It now sits between ← 목록 and the elapsed time,
a row that was already 44 points tall, so the header is 133.
@yansfil
yansfil merged commit 5862773 into main Sep 29, 2026
8 checks passed
@yansfil
yansfil deleted the mobile-conversation branch September 29, 2026 03:45
yansfil added a commit that referenced this pull request Oct 29, 2026
…d stages (#1837)

Closes with-hide/hide-private#252
Related: with-hide/hide-private#221, with-hide/hide-private#171,
with-hide/hide-private#135, with-hide/hide-private#207,
with-hide/hide-private#216

## Summary

On Windows a right-click on a terminal link also opened the link, beside
the menu: a folder link revealed its folder and an HTML link loaded its
page again.
xterm opens a link on the release of any mouse button, and on Windows
the right-click menu appears after that release; now a right-click opens
only the menu, and the primary and middle buttons open links as before.
Separately, the first page a test opens on Windows sometimes stays
`loading` for the whole 10 s `--wait`, and nothing said where it
stopped.
Each load the core asks for now logs when its route came, when it
committed and when its own load call settled, against that load alone,
with the display, the native page id and the time; the browser spec
records the native page's own state when that first wait gives up.

스크린샷 없음: the shell change is which mouse button opens a terminal link;
nothing drawn changes.

## Review

- **조심해서 볼 파일**: `web/src/terminalLinkProvider.ts` - both link paths
(detected and OSC 8) go through one `opens(event)` check, which refuses
only the right button.
- **조심해서 볼 파일**: `desktop/src/main/browser.ts` - each `load()` holds its
own `CoreLoad`; a commit counts only after its own `loadURL`, its stop
is that call's promise, a newer load or failed route ends it; three
lines per core-asked load.

### Per issue

- #252 terminal-links "terminal HTML opens a rendered page": fixed at
the cause above; the spec now also asserts one `browser_open`, which a
right-click activation adds on Windows every run.
- #221, #171, #135, #207 (browser.spec first `--wait` open stays
`loading`, status 2): cause not proven yet. Host log shows
`view_created`/`page_visible` then nothing for 10 s, no route or load
failure; core log has no stale-report refusal, so the core got `loading`
and never `loaded`. Only the first page of a fresh profile fails. This
PR adds the evidence that names the stage.
- Their older signature, `shellPage` 30 s in `fixture.ts`, is the
desktop startup flake handled by the flaky2-win-desktop change.
- #216 reveal-external (rail tool click left unpressed): last seen
2026-10-20, before the rail was rebuilt (#1552); not touched here.

## Evidence

- **확인한 것**: web unit test that a right-click's release opens no link
fails without the fix and passes with it.
- **확인한 것**: macOS desktop e2e 1/2 failed once fetching the pinned Herdr
(`curl: Failed to connect to github.com`); its rerun passed.
- **확인한 것**: desktop unit tests: a reopen waiting for its route while
the earlier load commits and stops, two checkouts' same id and load told
apart by `contents`, a failed route then a page navigation; all three
fail on the previous code.
- **확인한 것**: web unit tests: right button opens nothing, primary and
middle open; ⌘-click on macOS, Ctrl-click on Windows/Linux still open
externally.
- **확인한 것**: Windows desktop e2e 19/19, no flaky test, in three runs: PR
verify 40852660304 and nightly `lane=windows` 40857562866 on e09dc15,
PR verify 40873166675 on 1b89a27 (all jobs green).
- **확인하지 못한 것**: the stage of the stuck first load: neither Windows run
reproduced it; the issues say how to read the next failure.
- **확인하지 못한 것**: nightly 40857562866 failed `agent journey fake model
(windows)` on `guidance_memory`; untouched by this diff, passed on
main's 10-28 nightly, not checked on current main.
- **확인하지 못한 것**: the full web unit suite locally (67 failures at load
average ~300 on this Mac, not read); CI's web unit lane passed on
1b89a27.

<details><summary>Verification record</summary>

- Head 1b89a27; CI tested merge bf853d1 (1b89a27 into main
1849300), PR verify 40873166675: success, every job.
- Earlier head e09dc15: PR verify 40852660304 success after one rerun
of the macOS desktop job (github.com unreachable fetching Herdr);
nightly `lane=windows` 40857562866: desktop and web e2e green, `agent
journey fake model (windows)` failed on `guidance_memory`, outside this
diff.
- Local (this Mac, load 100-300): web and desktop typecheck and lint
pass; desktop unit 297 passed; `terminalLinkProvider.test.ts` 43 passed;
`browser.test.ts` 26 passed.
- Not run: desktop e2e locally (no build on this disk), Windows locally
(no Windows host).
- Limit: the stuck first page load did not recur in three Windows runs,
so its stage is still unproven; #221, #171, #135 and #207 stay open with
the reading guide.

</details>
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