Repository navigation
feat: read every agent's session as ACP thread updates - #1902
Merged
Merged
Conversation
Results carry no call id, so they pair with the turn's calls by order and not at all when the counts differ. An update keeps its call's diffs ahead of its output, since ACP replaces a call's content.
Name the converter, the declaration and the same-task sample a new agent needs, the checks that fail without them, and how the thread reader pages, caps and marks what it reads.
This was referenced Oct 30, 2026
yansfil
added a commit
that referenced
this pull request
Oct 30, 2026
…pane (#1910) Related: PRD session-docs-and-assistant (Desk 1차) B25, B26, B27, B29 · #1902 (thread reader) · #1907 (Desk screen parts) ## Summary Desk가 띄운 세션 하나를 스레드로 보이고, 스레드 입력칸의 말을 그 pane에만 넣습니다. 코어가 pane 하나의 스레드를 열면 그 세션이 도는 기기의 node가 잠금 밖에서 기록을 읽고, 세션이 일하는 동안 새로 쓴 부분만 다시 읽어 snapshot에 둡니다. 화면(`ThreadPanel`)은 #1907의 확정 부품 위에 store를 이어, 머리 둘째 줄에 Hide가 띄울 때 고른 모델을, 대화 안에 `hide` 명령이 만든 Hide 부품(계획, 새 세션, 편지, View, 미션)을, 받은 편지는 `✉ 보낸 이에게서 받음` 한 줄로, 도는 명령은 `실행 중 0:12`로 그립니다. 스레드가 이름을 부르는 세션은 코어가 페이지를 만들 때 지금 등록으로 pane을 찾아 두므로, 칩을 누르면 그 세션으로 갑니다(끝난 세션은 이름만). 기록을 못 읽으면 이유 한 줄과 `터미널로`가 보이고, 입력은 Enter로 보내며(IME 조합 중엔 안 보냄) pane이 받을 때까지 말이 칸에 남고, pane이 다른 세션으로 바뀌었거나 없으면 보내지 않고 이유를 보입니다. 보내기 직전(첨부 준비, pane 허락을 받은 뒤)에 pane을 한 번 더 확인하므로, 기다리는 사이 pane이 바뀌면 아무것도 치지 않습니다. 닫힌 스레드로 간 입력은 버리지 않고 `닫힘`으로 답해, 입력칸에 말이 돌아옵니다. #1907 재리뷰의 스레드 몫(hint ref, 질문 두 번, 접힌 줄 aria-label, 주석 두 곳)도 여기서 고쳤습니다. 화면이 놓일 자리(lane의 도구 칸)는 lane 노드가 붙이고, 지금은 갤러리 `scene=desk-thread`에서 store로 그려집니다.      ## Review - **판단해 주세요**: 입력은 터미널에 직접 친 것과 다릅니다(D-62). 에이전트가 bracketed paste를 켜 두면 Herdr가 말을 붙여넣기로 감싸므로, 긴 글이 Claude Code에서 `[Pasted text]` 덩어리로 보이고 줄바꿈은 제출되지 않습니다. attach와 PTY 크기를 건드리지 않으려고 고른 길이고 `docs/UI_BEHAVIOR.md`, Session thread에 적었습니다. - **판단해 주세요**: 스레드는 코어 전체에 하나만 열립니다(세션 기록과 같은 선례). 두 창이 다른 스레드를 열면 나중 것이 이깁니다. - **판단해 주세요**: pane이 바뀐 때의 말 "이 pane에서 이제 다른 세션이 돌아요. 이 스레드에서는 보내지 않아요", 없을 때 "이 세션의 pane이 없어요. 보낼 곳이 없어요". - **조심해서 볼 파일**: `herdr-core/src/runtime/session_thread.rs` - runtime mutex 안에서는 상태만 바꾸고 node 읽기, 페이지 만들기(Hide 부품, 이름 붙은 세션 찾기), activity 확인, 첨부 스테이징, `pane.send_input`은 모두 worker에서 돕니다. 입력 worker는 스테이징·permit·sleep gate를 지난 뒤 잠금을 한 번 더 잡아 `thread_input_target`(같은 generation, pane Same)을 보고, 잠금을 놓은 뒤 보냅니다. gate의 admission을 쥔 채 잠금을 잡지만, sleep 쪽 drain 대기는 잠금 밖에서 돌므로 서로 기다리지 않습니다. 열려 있지 않은 스레드로 온 입력은 request id로 `closed` 답을 받습니다. - **조심해서 볼 파일**: `herdr-core/src/coordination/mod.rs` - `registered_record`로 이름·agent id를 지금 등록에 맞춥니다(기존 resolve가 같은 함수를 씀). 페이지 worker는 ledger Arc를 잠금 밖에서 읽습니다. - **조심해서 볼 파일**: 입력은 엔진 경계(#1903)의 `delivery_engine(device).submit_text`로 보냅니다. 거절 코드 `not_found`는 `pane_gone`, 답이 없으면 `uncertain`(말이 들어갔을 수 있음), 그 밖은 `unavailable`입니다. - **조심해서 볼 파일**: `herdr-core/src/runtime/delivery.rs` - 관찰마다 thread 참조를 만들고 끝에 `follow_session_thread`를 부릅니다(Herdr 세션 읽기마다 도는 고빈도 경로, 열린 스레드가 없으면 즉시 반환). - **조심해서 볼 파일**: `hide-node-link/src/protocol.rs` - main이 65(기기 hook 상태)를 썼으므로 `Call::SessionThread`는 protocol 66입니다. - **조심해서 볼 파일**: `web/src/components/desk/thread-panel.tsx` - 보이는 동안 스레드를 열고 닫으며, 입력의 `request_id`로 보냄/거절을 맞춰 말을 지웁니다. `hided/src/server.rs`는 클라이언트가 보낸 `session_thread_input`을 경계에서 거절합니다. - **후속(리뷰 사소, 이 PR에서 안 고침)**: hided `handle_thread_input`이 첨부 stage를 commit한 뒤 코어가 거절하면(pane_changed 등) 커밋된 파일이 에이징 정리까지 남습니다(terminal attachment 선례와 같음). `delivery.rs`가 Herdr 세션 읽기마다 에이전트마다 `ThreadReference` 문자열을 복제합니다(session 필드와 같은 수준). - **비용 검토**: 스레드가 열려 있고 그 에이전트가 working일 때만 250 ms 틱이 1초마다 `SessionActivity`(크기와 시각) 하나를 띄웁니다. 바뀌면 뒤 페이지 하나(512 KiB 남짓)를 읽고, 끝이 그대로면 snapshot을 바꾸지 않습니다. 동시에 읽기 하나+빚 하나, 이전 페이지 하나, activity 하나, 입력 하나. 지난 페이지는 최대 4장. `docs/PERFORMANCE_TESTING.md` 원장에 적었습니다. - **원칙**: engineering #4·#10 거절은 이유 코드(`no_record`, `pane_changed` 등)로 화면에, 읽기 실패 세부는 진단 로그로. #5 세션 찾기는 코어(등록 원장), 그리기는 web adapter(`threadScreen`), 부품은 props만. #7 첨부는 기존 스테이징과 `terminal_attachments`를, 입력은 폰 답장의 permit·sleep gate를, 파일 고르기는 `Input` 부품을 재사용. #14 worker는 runtime을 weak로 잡고 호출 하나로 끝남. #15 페이지·요청·입력에 상한. design #5 #1907의 부품과 공용 칩을 그대로 씀, #9 읽는 중·못 읽음·막힘을 한 줄로, #13 node 연결 끊김은 `connected` false로 흐리게만, #12 한국어 글을 라이트·다크 캡처로 확인. ## Evidence - **확인한 것**: 실제 Herdr와 hided(`web/e2e/session-thread.spec.ts`, 4/4, repeat-each 3) - Pi pane의 기록이 스레드로 읽히고, 세션이 새 줄을 쓰고 Herdr에 working으로 보고하면 그 줄이 스레드에 이어지며, 입력 `계속해 주세요`가 그 pane에만 들어가고 다른 pane에는 안 감. - **확인한 것**: `bash scripts/verify-web.sh` exit 0 on 0a254f3 - web 2366, desktop 302, typecheck·lint·build; `node scripts/check-design-contract.mjs` ok. 그 안에 `thread-panel.test.tsx`(열고 닫기, Enter 보내기·IME 안 보냄·받을 때까지 말 유지, 거절 이유·pane 바뀜 막힘), `threadView.test.ts`(세션 칩 찾기, 계획 한 번, View·미션 부품), `desk.test.ts`(보낸 이별 편지 묶기, 명령 시작 시각, 질문 한 곳). - **확인한 것**: `cargo nextest` session_thread 12개 - newest 읽기 뒤 앞으로만 읽기, 512 KiB 페이지 보관, `no_record`, 이름 붙은 세션이 지금 등록의 pane으로 찾아짐, FakeHerdr로 입력이 그 pane에 한 번 가고 바뀐 pane에는 안 감, 기기 pane의 입력은 그 기기의 Herdr로. 입력 거절 셋: `input_to_a_gone_pane_is_refused_as_pane_gone_and_a_closed_pane_is_never_asked`(Herdr `pane_not_found`면 `pane_gone`, 닫힌 pane은 Herdr 요청 0), `input_whose_pane_changes_while_it_waits_for_its_permit_is_never_typed`(permit을 잡아 둔 사이 터미널이 바뀌면 Herdr 요청 0, `pane_changed`; 재확인을 빼면 실패함을 확인), `input_for_a_thread_that_is_no_longer_open_is_answered_as_closed`. protocol·node contract 16개, clippy `-D warnings`(herdr-core), fmt 통과. - **확인한 것**: `thread-panel.test.tsx` 5개 - 위 셋에 더해 다른 pane 스레드에 온 `closed` 답으로 말이 돌아옴, 위 끝 스크롤 세 번에 이전 페이지 요청 한 번, 상태가 바뀐 뒤에야 다시 한 번. - **확인한 것**: 갤러리 `scene=desk-thread` 4장면(live/asking/failed/held) 라이트·다크 캡처, 위 스크린샷. - **확인하지 못한 것**: 패키지 후보 앱에서 스레드 열기와 입력(화면이 놓일 자리가 lane 노드에서 생김). 기기 pane의 첨부 스테이징은 코드 경로만 있고 테스트 없음. 원격 코어에 node 데몬으로 붙은 화면의 스레드 첨부는 `unknown_stage`로 거절됨(말은 감), 문서에 적은 한계. <details><summary>Verification record</summary> - head: 0a254f3 (main merged at ecbfa34, origin/main 382b88c) - verify-web.sh: exit 0 on 0a254f3, web 2366 passed / 3 skipped, desktop 302 passed / 4 skipped - e2e: web/e2e/session-thread.spec.ts 4/4 (repeat-each 3) on bf4ef5b - cargo nextest session_thread: 12 passed (5 repeats); clippy -D warnings herdr-core; protocol/node_contract/hello filter: 16 passed </details>
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.
Related: #1898 (adds the
ACP serverssection the new Adding an agent step links to), with-hide/hide-private#379Summary
Hide could not yet draw an agent's conversation as one thread: each agent keeps its own record format, and nothing turned them into one shape.
Now
hide-sessionreads the session of every supported agent (Claude Code, Codex, OpenCode 1.18 and 2.0, Pi, omp, Grok, Antigravity) as ACP session updates: messages, thinking, tool calls with input, diffs, output and images, and plans.It reads the agent's own files and writes nothing; agents still run in Herdr panes, and nothing in the app serves a thread yet (that is the Desk work that follows).
Each agent's declaration states whether its thread is read, and a sample of the same task per agent proves each converter, so a new agent cannot ship without one.
Review
hide-session/src/thread/build.rs- one builder all converters share: caps,_meta.hidemarks, same-id refinement, diffs kept ahead of output because an ACP update replaces a call's content.hide-session/src/thread/mod.rs- page reading newest first, 4 MiB window, cursor refused on a replaced file, named refusals.hide-agent-adapter/src/lib.rs,declarations.rs- newthreadcapability on every row.Cargo.lock,workspace-hack/Cargo.toml- new dependencyagent-client-protocol-schema =1.14.0, default features off;merge-ordernames build: bump schemars from 0.8.22 to 1.2.3 #1458 as touching the same files.Evidence
cargo nextestover hide-session, hide-agent-adapter, hide-agent-hooks and hide-kit: 1017 passed; workspace clippy, fmt and hakari clean.codex-rs/protocolat rust-v0.155.1.Verification record
PRD session-thread-acp (local), B1-B18.
Head f746f37 on main e7e62b2.