Skip to content

Add web Settings and workspace management (S5) - #142

Merged
yansfil merged 13 commits into
mainfrom
feature/web-shell-pivot-s5
Sep 24, 2026
Merged

yansfil merged 13 commits into
mainfrom
feature/web-shell-pivot-s5

Conversation

@yansfil

@yansfil yansfil commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Related: agents/prd/web-shell-pivot-s5/prd.md (S5, after #141)

Summary

웹 셸에서 Swift로 돌아가지 않고 Settings(General·Appearance·Agents·Devices·Shortcuts)와 진단을 보고, 프로젝트 pin·Workspace purpose·worktree 생성/삭제·원격 기기를 관리할 수 있게 했습니다.
사이드바 맨 아래 기기 전환기(native HideDevicePicker 형태)에서 연결된 SSH 기기를 고르면 그 host의 프로젝트·agent·보이는 탭·pane 배치와 실시간 터미널이 보이고, 입력과 split/close/zoom/focus/탭 명령은 그 host의 정확한 pane에만 갑니다.
Swift만 하던 worktree 삭제 실행과 생성 후 agent 시작을 core 워커로 옮겨 두 셸이 같은 실행자를 쓰고, 클라이언트가 삭제 완료를 주장할 수 있던 worktree_removal_finished 이벤트를 없앴습니다.
hided는 핸드셰이크 뒤 daemon 프레임을 보내고, Settings 관찰 플래그를 연결별 수요로 소유합니다.

스크린샷은 격리 fixture(가상 기기 Studio Mac)에서 찍었습니다.

사이드바 아래 기기 전환기 원격 host의 탭·split pane과 실시간 출력
Device picker Remote split
연결 끊김: stale 배너·Retry, pane은 disconnected 기기 제거 뒤 로컬 탭 유지, 끊긴 기기로 split은 미전송
Remote disconnected Local after remove
Settings · Appearance: accent 4색과 interface font Settings · Shortcuts: pane chord 편집(Split right를 ⌥R로 바꾼 상태)
Settings appearance Settings shortcuts

Review

  • 판단해 주세요: 웹은 원격 탭을 따로 고르지 않고 host의 focus를 따라갑니다. core가 attach하는 탭이 그것뿐이라, 탭 전환도 remote_control focus_tab으로 host를 움직입니다.
  • 판단해 주세요: 원격 선택 중 find·reopen·탭 재정렬·파일 팔레트·우측 패널 파일은 로컬에서 실행하지 않고 안내 문구로 거절합니다(원격 파일/worktree 관리는 범위 밖).
  • 판단해 주세요: 연결이 끊기면 마지막 배치를 stale 배너·Retry와 함께 남기고 아무 명령도 보내지 않습니다. 배치를 지우는 편이 낫다면 알려 주세요.
  • 판단해 주세요: Shortcuts는 Swift 8개 중 7개만 편집합니다. 8번째 Toggle Conversation은 PRD Non-goals가 뺀 대화 화면에 묶여 "macOS app only"로 표시되며, B9의 "8개" 문구와 다릅니다.
  • 판단해 주세요: Settings accent 4색을 AccentChoice 토큰으로 승격했습니다(design/tokens.json, HideTheme, Pen 변수 4개). 값은 그대로입니다.
  • 조심해서 볼 파일: web/src/actions.ts - failure path, 원격 명령이 로컬 id나 로컬 대상으로 fallback하지 않는지(remoteHost, sendRemote, requestClose).
  • 조심해서 볼 파일: herdr-core/src/runtime/terminal.rs return_keyboard_to_local_pane - Herdr/core ownership, 로컬로 돌아올 때 키보드 pane을 원격 id에서 되돌림.
  • 조심해서 볼 파일: herdr-core/src/runtime/devices.rs rebuild_device_rows - 기기 등록/제거가 catalog 전체 재구성으로 로컬 탭을 비우던 문제를 기기 행만 갱신으로 바꿈.
  • 조심해서 볼 파일: herdr-core/src/worktree_cleanup.rs remove_confirmed, worktree_control.rs - 되돌릴 수 없는 삭제 직전 재검사, lock 밖 Git 실행(runtime mutex).
  • 조심해서 볼 파일: herdr-core/src/runtime/session.rs task agent_phase - snapshot wire에 필드 2개 추가, Swift는 선택 필드로 디코드.
  • 조심해서 볼 파일: hided/src/server.rs - ai_settings.observing 분리와 연결 종료 시 수요 해제.
  • 질문: 생성 직후 새 pane 포커스를 웹이 focus_pane으로 명시합니다. core ingest가 pending focus를 직접 등록하는 편이 나을까요?

Evidence

  • 확인한 것 (fixture 제어): 격리 HOME의 hided + 로컬/원격 Herdr 0.9.1 두 개 + loopback 전용 sshd(검증된 host key, 암호 없음)를 Herdr Browser pane(chromux CDP)에서 조작.
  • 원격 marker 입력은 원격 pane에만 기록, ⌘D split은 원격 2 pane·로컬 1 pane 유지, zoom·클릭 포커스·⌥⇧W close는 원격 w1:p1만 닫히고 로컬 w1:p1은 남음.
  • 새 탭·탭 전환·탭 닫기 원격 한정, 로컬 복귀 뒤 ⌘D는 로컬 split, terminal.keyboard_returned_local 진단이 원격 id에서 로컬 pane으로 복귀를 기록.
  • 연결 끊김 시 stale 배너·"disconnected" 캡션, split은 안내만 뜨고 미전송, Retry는 실제 새 시도, 재연결 뒤 입력 도달.
  • 선택 중 기기 제거 뒤 원격 Herdr·workspace·pane 생존(재등록 시 같은 pane 기록), 로컬 탭은 즉시 유지.
  • 원격 행 메뉴: pin·새 worktree는 이유와 함께 비활성, purpose는 Herdr 0.9.1 이상에서 허용.
  • 확인한 것 (실제 원격 host, 읽기 전용): 준비된 SSH alias로 실제 Mac을 격리 HOME에 등록(IdentityFile 경로만 참조, 키 복사 없음, host key는 기존 기록과 대조 고정).
  • 선택하지 않은 채 연결 성공, Test 7/7 통과, snapshot에서 Herdr 0.9.1·workspace 25·tab 31·agent 12·attach pane 0 확인 후 제거. 그 host의 pane·프로젝트·서버에는 입력·포커스·split·close를 하지 않았습니다.
  • 연결만으로는 session.snapshot·agent.list·pane.updated 구독만 쓰고 remote_control은 사용자 요청 경로에서만 시작됨을 코드로 대조.
  • 확인한 것 (자동): verify-cargo.sh lint, verify-cargo.sh test 1,098개 통과(실패 0), 신규 core 테스트 2개(로컬 복귀 키보드, 선택 기기 제거 뒤 로컬 탭 유지).
  • web typecheck·lint·vitest 165개(원격 라우팅 9개 포함)·build, 로컬 Playwright 32개(pinned Herdr 0.9.1), design contract, workstation identity 등 스크립트 게이트 통과.
  • 확인하지 못한 것: 실제 원격 host의 pane 제어는 권한 밖이라 fixture로만 증명. Test의 pty 단계가 통과했는데, 준비 안내에는 그 키에 PTY 할당이 금지돼 있다고 되어 있어 대조가 필요합니다.
  • 스크린샷은 로그인된 브라우저가 없어 user-attachments 대신 PR 작성자 계정의 secret gist에 올렸습니다(저장소에는 커밋하지 않음).
  • 확인하지 못한 것: 로컬 Swift 6.3.1은 이 PR이 건드리지 않은 HerdrApp.swift:241을 data race로 거부합니다(CI macos-15 swift shell 통과).
  • 확인하지 못한 것: acceptance_timeout_ends_cli_spawned_before_watcher 간헐 실패(이번 실행은 통과), 설치 앱의 hook 설치 성공 경로(standalone hided는 helper 없음으로 거절).
  • 확인하지 못한 것: 원격·로컬 pane 사이 구분선이 없음, plugin pane PATH에 node가 없어 hide.browser host가 조용히 종료됨(QA pane만 --env PATH로 우회).
  • 확인하지 못한 것: 이미 push된 70846bc 커밋 본문에 agent 이름이 백틱 없이 있어 check-no-attribution.py 기본 범위가 실패합니다. force push 없이는 고칠 수 없어 그대로 둡니다.
  • 생성물: design/hide-ui.lib.pen은 gen-pen.mjs가 accent 변수 4개를 추가한 diff입니다.
B1-B24 범위 점검
  • 구현·증명: B1, B2, B3, B4, B5, B8, B10, B11, B12, B13, B14, B15, B16, B17, B18, B19, B20, B22 (실제 웹 QA 또는 core·e2e 테스트).
  • 구현·부분 증명: B9(7/8, 위 판단 항목), B21(설정 복원 확인, 진행중 mutation 비재실행은 core 테스트만), B23·B24(경계와 off-lock은 게이트·테스트, 프로세스 수 측정은 미실행).
  • 구현·미검증: B6 다음 소비 요청의 provider 적용, B7 설치 성공 경로.
  • 범위 안 누락: 없음. B18의 지난 Test 결과가 현재 상태로 읽히던 문제는 실행 시각 표시로 고침.
  • 명시적 제외: 원격 파일·worktree 관리, 원격 find/reopen/재정렬, Toggle Conversation.

Breaking change

  • worktree_removal_finished 이벤트 제거, worktree_removal.phase의 ready가 removing으로 바뀜. 같은 커밋의 Swift 셸만 소비자이며 저장 상태·설치 경로는 그대로입니다.

AI tooling: 대부분 AI 도구로 작성. 격리 Herdr 두 개와 Browser pane에서 모든 원격 흐름을 직접 조작하고 두 Herdr의 pane 목록·레이아웃을 매 단계 대조.

Verification record
  • base efd4e13, head 42c142e; S5 continuation commits cf10555, 4e04744, 5b080d1, 42c142e.
  • scripts/verify-cargo.sh lint 0, scripts/verify-cargo.sh test 0 (1,098 passed, 0 failed, 9 ignored).
  • web: tsc --noEmit, eslint src e2e, vitest run 165/165, vite build, Playwright 32/32 with Herdr 0.9.1.
  • scripts: check-design-contract.mjs, design-controls.test.mjs, check-hide-design.mjs, check-no-workstation-identity.sh, check-capability-readers-off-lock.sh, check-harness-ignore-anchor.sh 0; check-no-attribution.py --range 70846bc..HEAD 0.
  • Local Swift gates (check-shortcut-contract.sh, check-right-panel-sections.sh) fail at the pre-existing HerdrApp.swift:241 under Swift 6.3.1; CI runs them on macos-15.

Worktree deletion and starting the chosen agent in a created pane were
executed by the Swift shell, so the web shell had no executor and any
client could claim a removal finished. Both now run on the core worker
that owns the request:

- The close worker rechecks Git's registration, HEAD, branch, protected
  base, nested worktrees and dirt against the confirmed request, then runs
  non-force `git worktree remove` and `git branch -d` itself. The
  `worktree_removal_finished` event is gone; phases are closing, removing,
  finished, failed. Only a pane outside the set Herdr confirmed closed
  counts as appearing during the confirmation.
- The creation worker starts the agent with `agent.start` after the
  creation is published and reports `agent_phase`/`agent_message` apart
  from it; a missing CLI fails before Herdr is asked, a transport failure
  is unknown, and `task_agent_retry` reuses the recorded pane.
- A new branch name is checked with `git check-ref-format` before any
  worktree is created.
- `retry_connect` makes a real new connection attempt for a device.
- `ui_state.browser_shortcut_bindings` holds the web host's pane chords
  apart from the Swift host's, kept when a save omits it.
- `create_pane` is refused while an SSH device is selected, so a split
  never falls back to this machine.
- A hook install refusal is announced, and a saved AI choice reads as
  chosen without waiting for the next launch.

The Swift shell now only reports the core's results.
hided sends a `daemon` frame after a valid handshake (version, pid,
schema, state paths, Herdr binary and socket, idle policy) for Settings >
General; it never carries the token.

The core has one flag that runs the provider probe and the hook
diagnosis while Settings > Agents is open. With several pages connected,
the daemon now records each connection's `ai_settings.observing` as its
own demand and moves the flag only on the first observer in and the last
one out; a connection that closes releases its demand.
The four accents Settings offers were literals in the native sheet. The
web sheet needs their values and swatches from the token authority, so
they are AccentChoice tokens in HideTheme, design/tokens.json, the Pen
map and the generated CSS.
The web shell gains the native Settings sections less Pet, opened from
the sidebar gear or ⌥, and returning focus to the work on close:

- General: the daemon, Herdr state with its cause, environment checks,
  recent diagnostics and a redacted Copy diagnostics.
- Appearance: accent choices and interface font 11-17, applied from the
  core's ui_state and restored on reload; terminal and editor sizes stay
  their own.
- Agents: CLI availability and sign-in, Background AI provider and model,
  and hook install behind a confirmation that names the file.
- Devices: register, Test, Retry, select and remove SSH devices; with a
  device selected the shell shows its context instead of local tabs and
  sends no local pane command.
- Shortcuts: record, apply and reset the seven browser pane chords, with
  Chrome-reserved, conflicting and modifier-less chords refused in the
  row; the window listener and the ⌘/ sheet read the same registry.

Project and checkout rows get a ⋯ menu (also on right-click) for
Pin/Unpin, New worktree, purpose and worktree deletion; each dialog reads
only its own request's receipt. A created worktree's pane is focused once
listed, and closing a dialog gives terminal focus back without reporting
it as an operator move. The ui_state echo no longer carries the
registration lists, which their own events own.
ARCHITECTURE covers the core-owned removal and agent start, the daemon
frame and observation demand, web Settings and management, the selected
device context and the per-host shortcut overrides. The hook, AI
provider, design and contribution guides follow the changed behavior.
The sheet lists 27 commands now, and Settings is the eighth chord moved
because Chrome keeps ⌘,.
The daemon frame arrives before the snapshot, and marking the page live
on it ran the reconnect buffer reconciliation with no open documents, so
a recovery draft was discarded. The frame is stored and the page turns
live on the snapshot, as before.
- create_worktree accepts only the claude and codex agent kinds, since the
  kind reaches agent.start and runs in the new pane.
- A task cannot take the slot while a created pane's agent start is still
  due, so its answer and Retry are not lost.
- retry_connect compares the remote state `connected`, so a connected
  device is never torn down from a stale screen.
- The daemon announces an observation change while its demand is locked,
  so two transitions reach the core in order.
- The Agents tab declares its demand again after a reconnect.
… edits

Typing into a remote pane leaves the core's terminal pane on that host's
scoped id. Selecting this machine again, or losing the selected device,
now hands the keyboard back to the local selected pane (or the focused
checkout's active pane) and records terminal.keyboard_returned_local, so
keys never keep flowing to the host the operator left while the local
session is idle.

Registering or removing a device rebuilt the whole catalog from
registrations, which dropped every checkout's tabs until the next
session publish. Device edits now rebuild only the device rows and keep
each row's agent count. rebuild_catalog stays as test setup only.
The sidebar ends in a device switcher like the native picker: a chip
naming the selected device opens one list of devices with their
connection and agent count, arrow keys move focus, and Enter or a click
selects. Selecting a connected device shows that host's projects,
agents, visible tab and pane layout with live terminal output, following
the tab the core attaches.

Split, zoom, close, focus, tab create, switch and close go out as
remote_control for that exact target with a fresh request id, from the
host's scoped ids, and nothing is sent while it is not connected. Find,
reopen, reorder and the file palette are refused with a notice rather
than run on this machine, and the right panel says remote files are not
available. A lost connection keeps the last layout on screen behind a
stale banner with Retry. Selecting this machine again restores the local
context without touching the remote work.
The last Test result stays under the device row after the connection
changes, so "Connection test passed" beside "not connected" read as the
current state. A finished test now names the time it ran.
@yansfil
yansfil merged commit aa7a915 into main Sep 24, 2026
6 checks passed
@yansfil
yansfil deleted the feature/web-shell-pivot-s5 branch September 24, 2026 09:06
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
…ule (with-hide#2160)

Closes with-hide/hide-private#580
Closes with-hide/hide-private#606
Closes with-hide/hide-private#607
Closes with-hide/hide-private#608
Closes with-hide/hide-private#609
Closes with-hide/hide-private#385
Closes with-hide/hide-private#386
Closes with-hide/hide-private#387
Closes with-hide/hide-private#240
Closes with-hide/hide-private#241

## Summary

Windows에서 기기 연결과 hook 시험의 첫 PowerShell 시작이 가끔 60-90 s 동안 아무 말 없이 멈췄습니다.
원인은 PowerShell이 처음 쓰는 명령(`Write-Output`, `New-Object`, `Add-Type`,
`Test-Path`)을 찾으려고 설치된 모듈 전체(러너에서 약 260개)를 읽는 데 있었습니다. 모듈 목록 캐시를 쓸 수 없으면
한 번에 12-38 s가 걸렸습니다.
이제 기기 시작 스크립트는 자동 로드를 끄고 쓰는 모듈 하나만 이름으로 불러옵니다. 캐시 없이도 1 s 안쪽입니다. 제한 시간은
그대로입니다.
첫 시작이 기한을 넘기면 실패 메시지가 그 프로세스의 pid, 쓴 CPU 시간 대 경과 시간, 받은 캐시 경로를 말합니다.

## Review

- **조심해서 볼 파일**: `hide-node/src/ssh/bootstrap.rs` - 실제 기기에 가는 래퍼입니다. 모든
로그인 셸의 따옴표 안에 들어가므로 따옴표 없는 형태로 썼고, 그
검사(`the_powershell_wrapper_holds_nothing_a_login_shell_reads_inside_quotes`)는
그대로 통과합니다. 자동 로드가 꺼져 있어 스크립트가 앞으로 Utility 밖의 cmdlet을 쓰면 그 자리에서 이름과 함께
실패합니다.
- **조심해서 볼 파일**: `hide-platform/src/process.rs` - 새 사실 `cpu_time(pid)`
하나(macOS `proc_pidinfo` + 시간 기준, Linux `/proc/<pid>/stat`, Windows
`GetProcessTimes`), 세 시스템 계약 시험
`processor_time_counts_a_process_s_work_and_not_its_wait`.
- **판단해 주세요**: PowerShell 로그인 셸(DefaultShell=powershell)은 래퍼 전에 `exec`를
찾습니다. 캐시가 차가우면 그 한 번은 여전히 전체 모듈을 읽습니다(측정 38 s). POSIX 첫 문장 앞에는 아무것도 둘 수
없어 이 PR에서 다루지 않았습니다.
- 반복 중 드러난, 이 PR이 바꾸지 않은 시험: with-hide/hide-private#636,
with-hide/hide-private#637, with-hide/hide-private#638. Cursor hook의 같은
종류 후속은 with-hide/hide-private#630에 적었습니다.
- 이 그룹에서 뺀 이슈(다른 원인): with-hide/hide-private#523, with-hide#532, with-hide#142.

## Evidence

- **확인한 것**: 원인 측정(새 windows-latest 러너, 임시 workflow, run 42198773191,
42199406507): 캐시 없이 `Write-Output` 17.4 s, 다시 12.1 s, 넷 동시 32 s; 자동 로드
끄고 Utility import 후 `Write-Output`/`New-Object`/`Add-Type` 0.87 s.
- **확인한 것**: 20회 반복, retries 0, 임시 push workflow(리뷰 전에 지움). run
42201192406: 러너 5대 x 4회, bootstrap windows_tests 20/20 통과(10회는 빈 캐시).
run 42203347592: 새 러너 20대 x 1회, bootstrap windows_tests 20/20(10대는 빈
캐시), hide-agent-hooks `it`의 Windows 레인
선택(`hook_deadline|windows_hook_command|windows_scripts`) 20/20 통과.
- **확인한 것**: 고친 두 줄을 지키는 Windows 시험:
`the_start_script_runs_under_an_empty_module_cache_without_building_one`(빈
캐시에서 실제 스크립트가 캐시를 만들지 않음, import 줄)과
`a_cmdlet_outside_the_wrappers_import_fails_by_name_and_starts_no_search`(import
밖 cmdlet은 이름과 함께 바로 실패, 자동 로드 줄). PR의 run 42212770068에서 1.0 s, 3.6 s로
통과. 자동 로드 줄만 지운 임시 브랜치 run 42212808334에서는 두 번째 시험이 실패(`Get-Item`을 21 s
검색 끝에 찾음).
- **확인한 것**: `cpu_time` 계약 시험 macOS 로컬과 Windows 러너(run 42203347592)에서
통과. clippy, fmt 로컬 통과.
- **확인하지 못한 것**: 실패한 CI 회차에서 러너의 기본 캐시(`C:\PSModuleAnalysisCachePath`)가
왜 쓸 수 없었는지. 이제 캐시와 상관없이 기다리지 않으므로 고치는 데는 필요 없지만, 다시 멈추면 새 기한 보고가 이를
말합니다.
- **확인하지 못한 것**: hooks lib 시험
`codex_daemon::tests::a_windows_codex_that_runs_node_answers_its_features`가
새 러너 20대 중 8대에서 실패(Node 첫 시작이 5 s 제품 기한을 넘김, PowerShell 아님, 이 PR과 무관):
with-hide/hide-private#638.
- **확인하지 못한 것**: Linux에서의 `cpu_time` 계약은 이 PR의 os contract 레인이 확인합니다.
- **확인하지 못한 것**: 실제 Windows 기기 연결(ssh)은 돌리지 않았습니다. 같은 스크립트를 실제
`powershell.exe`와 네 로그인 셸로 돌리는 bootstrap windows_tests로 확인했습니다.

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

- 임시 workflow 커밋: 023fd9f, 16699a3, 8bef1a4, ddbb606, 777f9fc;
제거 6ee02e1.

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