cdpm-mcp 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +21 -0
  3. package/README.ko.md +245 -0
  4. package/README.md +167 -2
  5. package/dist/agent-setup.js +134 -0
  6. package/dist/auto-setup.js +110 -0
  7. package/dist/cdp/client.js +127 -0
  8. package/dist/cdp/downloads.js +69 -0
  9. package/dist/cdp/network.js +118 -0
  10. package/dist/cdp/sessions.js +519 -0
  11. package/dist/cdp/targets.js +43 -0
  12. package/dist/chrome/finder.js +87 -0
  13. package/dist/chrome/launcher.js +52 -0
  14. package/dist/chrome/proxy.js +109 -0
  15. package/dist/claude-md-setup.js +68 -0
  16. package/dist/cli.js +230 -0
  17. package/dist/errors.js +3 -0
  18. package/dist/index.js +26 -0
  19. package/dist/install.js +34 -0
  20. package/dist/page/actions.js +1101 -0
  21. package/dist/page/keys.js +115 -0
  22. package/dist/page/snapshot.js +283 -0
  23. package/dist/paths.js +43 -0
  24. package/dist/pause.js +74 -0
  25. package/dist/proxy-forwarder.js +191 -0
  26. package/dist/registry/lock.js +93 -0
  27. package/dist/registry/messages.js +106 -0
  28. package/dist/registry/store.js +27 -0
  29. package/dist/service.js +340 -0
  30. package/dist/slots.js +72 -0
  31. package/dist/statusline-setup.js +142 -0
  32. package/dist/statusline.js +82 -0
  33. package/dist/taskbar/dock.js +94 -0
  34. package/dist/taskbar/icon-gdi.js +191 -0
  35. package/dist/taskbar/icon.js +300 -0
  36. package/dist/taskbar/watcher.js +65 -0
  37. package/dist/taskbar/win32.js +135 -0
  38. package/dist/tools/format.js +48 -0
  39. package/dist/tools/read.js +81 -0
  40. package/dist/tools/register.js +907 -0
  41. package/dist/util.js +111 -0
  42. package/dist/version.js +3 -0
  43. package/package.json +62 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # 변경 내역
2
+
3
+ 버전 번호는 `package.json`에서 관리해요. 확인: `cdpm --version` (직접 받았으면 `node dist/cli.js --version`).
4
+ 업데이트 방법은 README의 "업데이트" 항목을 보세요.
5
+
6
+ ## 0.1.0 (2026-10-10)
7
+
8
+ 첫 공개 버전.
9
+
10
+ - Chrome 슬롯 1~30번을 순수 CDP로 실행·조종 (슬롯 N = 포트 14049+N, 1번=14050, `CDPM_PORT_BASE`로 옮길 수 있음, 슬롯마다 프로필). 켜 달라고 할 때만 켜고, 창 모드·헤드리스는 사용자가 정해요. 여러 슬롯은 `slots`/`count`로 한 번에 작은 번호부터. `url`/`urls`로 켜자마자 시작 페이지를 열어요. 사용자가 부탁하면 `proxy`/`proxies`로 슬롯마다 프록시(http/https/socks5, 아이디·비밀번호 포함)를 붙여 켜요.
11
+ - 여러 에이전트가 같은 슬롯을 나눠 씀: 탭마다 연 사람·마지막 행동 기록, 남의 탭 조작 경고(막지 않음), 같은 탭 조작은 줄 세움, `slot_send`/`slot_inbox`로 대화. 여러 슬롯에 다른 일을 맡기면 슬롯마다 서브에이전트로 병렬 처리하도록 안내.
12
+ - 서로 다른 Claude 세션도 같은 탭은 탭 잠금 파일로 줄 서서 입력이 섞이지 않음. 오래 켜 두는 작업용: 응답 없는 탭을 기다리는 명령은 10분 단위로 다시 걸고, 30분 동안 안 쓴 멈춘 탭 연결은 정리, 명령마다 거는 알림창 감시는 명령이 끝나면 바로 풀고, 주소가 안 바뀌는 SPA에서도 요소 번호 기록이 쌓이지 않음.
13
+ - 조작 도구에 `read`(text / snapshot / changes)로 조작 뒤 화면을 같은 결과에 바로 붙임. `browser_fill`로 입력칸 여러 개를 한 번에 채우고 제출.
14
+ - 긴 페이지 쪽 나누기·찾기, 뒤 탭 읽기·조작·캡처(사용자 화면 안 바꿈), 네트워크 보기·요청 막기, 다운로드 알림, 알림창은 Claude가 내용을 보고 `browser_dialog`로 직접 확인·취소 (시키지 않은 결제·삭제 같은 확정 창만 사용자에게 묻기).
15
+ - 창 크기·위치·뷰포트·확대를 절대 바꾸지 않음. 클립보드 키, 외부 프로그램을 여는 링크, 드롭다운 클릭은 거부.
16
+ - 마우스 올리기(`browser_hover`), 끌어 놓기(`browser_drag`: 드래그 앤 드롭·슬라이더, 놓을 곳은 ref·글자·픽셀), 새로고침(`browser_reload`), 앞으로(`browser_forward`), 다운로드 끝 기다리기와 저장 경로(`browser_download_wait`), PDF 저장(`browser_pdf`). 클릭이 다운로드로 바뀌면 바로 돌아와요.
17
+ - 파일 올리기 `browser_upload`: 파일 칸에 바로 넣거나, 파일 칸·"첨부" 버튼을 클릭하면 OS 파일 선택 창을 가로채 두고(사용자 화면에 안 뜸) 그 자리에 넣어요.
18
+ - 아이콘: Windows 작업표시줄, macOS Dock에 슬롯 색·번호 아이콘.
19
+ - 상태줄 `CDPM 1 NAVER 2 Daum`: 켜진 슬롯과 마지막으로 쓴 탭 제목 (3초마다 갱신). 터미널 폭에 맞춰 제목을 줄이고, 넘치면 번호만, 그래도 넘치면 `+N`. Windows는 마지막 창을 닫으면, macOS는 Cmd+Q로 끝내면 슬롯이 끝나요.
20
+ - 한 에이전트는 한 슬롯만 (다른 슬롯은 거절하고 서브에이전트로 나누라고 안내, 비교 작업만 `multiSlot: true`). 결과물도 서브에이전트가 각자 쓰고 메인은 합치기만.
21
+ - 설치하면 자동 설정 (MCP 서버가 처음 켜질 때 한 번, 원래 파일 백업): 상태줄, 사용자 `CLAUDE.md` 병렬 처리 규칙, CDPM 전용 서브에이전트 `cdpm-browser`(CDPM 도구와 파일 쓰기만, `CLAUDE.md` 안 읽음 → 실측 슬롯 3개 병렬 작업 28.7초 → 20.6초, 사용량 약 37% 감소). `cdpm unsetup`으로 되돌리기, `CDPM_NO_AUTO_SETUP=1`로 끄기.
22
+ - 서브에이전트 동시 20개 제한 안내.
23
+ - 자동 설정에 권한 허용 목록 포함: CDPM 도구 전체(`mcp__<등록 이름>`)를 `permissions.allow`에 넣어 자동 모드의 보안 검사가 입력을 막지 않게 해요.
24
+ - 업데이트로 자동 설정이 다시 돌 때 항목마다 판단: 남아 있는 것은 새 내용으로 갱신, 사용자가 지운 것(`cdpm unsetup` 포함)은 되살리지 않음. 다시 넣으려면 `cdpm setup`.
25
+ - 큰 페이지에서 입력칸 찾기(`browser_snapshot interactive=true`, `find="제목|subject"`), 주소가 바뀌는 순간 돌아오는 대기(`browser_wait url`, 최대 600초). 버튼이 눌릴 수 있게 될 때까지(`enabled`), 데이터 응답이 올 때까지 기다려 본문까지 받기(`response`).
26
+ - 다른 사이트 iframe(별도 프로세스, 결제창·소셜 로그인 등) 안의 요소도 보이고 입력·클릭·선택·읽기가 돼요. 같은 사이트 iframe, 열린·닫힌 Shadow DOM도 지원.
27
+ - 에이전트끼리 실시간 협업: `slot_send`는 다른 슬롯 담당에게도 보낼 수 있고, `slot_inbox wait`는 메시지가 오면 0.1초 안에 돌아와요 (최대 600초). `browser_wait`는 메시지가 오면 바로 멈춰요. 협업이 필요한 작업에만 신호를 주고받고, 별개 작업은 각자 진행해요.
28
+ - 사용자가 슬롯 멈추기·다시 시작(`slot_pause`/`slot_resume`, `cdpm pause`/`cdpm resume`): 멈추면 조작은 바로 거절, 하던 조작도 다음 입력 직전에 멈춤, 기다리기도 바로 끝남. 다시 시작하면 에이전트를 메시지로 바로 깨움.
29
+ - 다른 슬롯 화면 보기는 막지 않아요 (한 에이전트 = 한 슬롯 규칙은 조작에만). 기다림은 최소한으로, 고정 시간 대기는 쓰지 않도록 안내해요.
30
+ - 서브에이전트는 한 메시지에서 모두 백그라운드(`run_in_background: true`)로 한꺼번에 띄우고, 지시는 슬롯·이름·할 일만 1~3줄로 (cdpm-browser가 규칙을 이미 알고 있음).
31
+ - 역할 구분 (여러 슬롯 작업, 사이트와 상관없이): 메인은 사용자와 대화·슬롯 켜기/끄기·일 나눠 주기·결과 합치기만, 서브에이전트는 맡은 슬롯 하나의 이동·읽기·조작·감지·결과물까지 전부. 슬롯 하나로 끝나는 간단한 일만 메인이 직접 해도 돼요.
32
+ - 어느 사이트든 사용자 로그인·본인 인증·보안문자 등은 "됐다고 알려 달라"고 하지 않고 서브에이전트가 스스로 감지해요. 화면을 건드리지 않고(새로고침 없이 입력 중인 내용 그대로) 주소 변화(`browser_wait url`), 글자가 사라짐(`gone`, 예: 로그인 폼), 글자가 나타남(`text`)으로 알아채요.
33
+ - Windows 11, macOS 지원.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IGELHARINE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ko.md ADDED
@@ -0,0 +1,245 @@
1
+ # CDPM — CDP Manager
2
+
3
+ [English README](README.md)
4
+
5
+ > **설치를 부탁받았다면 (Claude·AI 에이전트용)** 아래 순서대로 하세요.
6
+ > 1. Node.js 22 이상과 Google Chrome이 있는지 확인해요. 없으면 사용자에게 알리고 멈춰요.
7
+ > 2. `npm install -g cdpm-mcp@latest` 를 실행해요 (이미 설치돼 있어도 그대로 실행 → 최신으로 업데이트).
8
+ > 3. `cdpm install` 을 실행해요 (`cdpm`을 못 찾으면 `node "$(npm root -g)/cdpm-mcp/dist/cli.js" install`). Claude Code 등록과 상태줄·규칙·서브에이전트·권한 설정을 한 번에 해요. 예전에 git으로 받아 등록해 둔 것도 새 위치로 바꿔요.
9
+ > 4. Chrome 슬롯을 켜지 말고, 질문하거나 내부 설명을 덧붙이지 마세요. 성공하면 "CDPM <버전> 설치 완료. Claude Code를 다시 시작하면 쓸 수 있어요." 한 줄만 답해요 (버전은 `cdpm --version`). 실패하면 어느 단계에서 왜 실패했는지만 말해요.
10
+
11
+ **Chrome 1~30번 슬롯**을 CDP(Chrome DevTools Protocol)로 띄워 두고, 여러 Claude 세션과 서브에이전트가 번호만으로 같은 브라우저를 나눠 쓰고 조종하게 해 주는 MCP 서버예요. *"3번 켜줘"*, *"3번 봐줘"* 한마디면 돼요.
12
+
13
+ - **순수 CDP**: Playwright, Puppeteer, 우회 패치를 쓰지 않아요. 디버깅 포트만 연 일반 Chrome에 진짜 입력 이벤트를 보내요.
14
+ - **번호 슬롯**: 슬롯 N은 CDP 포트 `14049 + N`을 써요 (1번 = 14050 … 30번 = 14079). 흔히 쓰이는 9222와 부딪히지 않도록 고른 구간이고, 이 구간을 다른 프로그램이 쓰면 환경변수 `CDPM_PORT_BASE`로 시작 번호를 옮길 수 있어요. 슬롯마다 프로필 폴더가 따로 있어서 로그인이 슬롯별로 유지돼요. 범위 밖 포트는 다루지 않아요.
15
+ - **켜 달라고 할 때만 켜요**: 꺼진 슬롯은 다른 도구가 절대 켜지 않아요. 번호 없이 "켜줘"라고 하면 비어 있는 가장 작은 번호로 켜요.
16
+ - **슬롯마다 작업표시줄 버튼**: 슬롯 색 브라우저 창 모양에 번호가 들어간 아이콘으로 버튼이 따로 떠요. 작업표시줄이 아이콘을 줄여 그리는 방식을 미리 보정해서 24px에서도 또렷해요 (Windows 글꼴로 그려서 저장소에 글꼴 파일이 없어요). 창 제목도 "3번"으로 보여요 (Chrome 창 이름 기능이라 페이지는 알 수 없어요).
17
+ - **여러 에이전트용 설계**: 모든 도구에 `slot`을 명시해요. 탭마다 누가 열었고 누가 마지막으로 건드렸는지 기록하고, 남이 최근에 쓴 탭을 조작하면 막지 않고 알려줘요. 같은 탭에 동시에 온 명령은 줄 세워 하나씩 실행해요.
18
+ - **에이전트끼리 대화**: `slot_send` / `slot_inbox`. 안 읽은 메시지는 모든 도구 결과 맨 위에도 붙어요.
19
+ - **상태줄**: `cdpm statusline`이 떠 있는 슬롯을 슬롯 색 번호와 마지막으로 조작한 탭의 제목으로 출력해요 (`CDPM 1 NAVER 2 Daum`). 에이전트 이름은 넣지 않아요.
20
+ - **사용자 PC를 건드리지 않아요**: 창 크기·위치·뷰포트·확대 비율을 바꾸지 않고, OS 창(파일 선택·메일 앱 등)을 띄우는 동작은 거부해요. 아래 "하지 않는 것"을 보세요.
21
+
22
+ > Windows 11과 macOS에서 쓸 수 있어요. 슬롯별 아이콘은 Windows는 작업표시줄, macOS는 Dock에 들어가요 (아래 "macOS" 참고).
23
+ > Linux는 시험 단계예요. Chrome 찾기와 데이터 폴더 코드는 있지만 리눅스 PC에서 시험해 보지 않았고, 슬롯별 아이콘은 없어요.
24
+
25
+ ## 필요한 것
26
+
27
+ - Node.js 22 이상
28
+ - Google Chrome (자동으로 찾아요. Windows: 레지스트리 `App Paths` → 표준 설치 폴더. macOS: `/Applications` → `~/Applications` → Spotlight. Linux: `/usr/bin/google-chrome` → `google-chrome-stable` → `/opt/google/chrome/chrome`)
29
+
30
+ ## 설치
31
+
32
+ ```sh
33
+ npm install -g cdpm-mcp
34
+ cdpm install
35
+ ```
36
+
37
+ `cdpm install`이 Claude Code에 CDPM을 등록하고, 상태줄·병렬 처리 규칙·전용 서브에이전트·권한 허용 목록까지 한 번에 설정해요. 끝나면 Claude Code를 다시 시작하세요.
38
+
39
+ ### 직접 받아서 (개발용)
40
+
41
+ ```sh
42
+ git clone https://github.com/IGELHARINE/CDPM.git
43
+ cd CDPM
44
+ npm install
45
+ node dist/cli.js install
46
+ ```
47
+
48
+ ### 업데이트
49
+
50
+ ```sh
51
+ npm install -g cdpm-mcp@latest
52
+ ```
53
+
54
+ 그다음 Claude Code를 다시 시작하면 돼요. 직접 받았으면 클론 폴더에서 `git fetch origin && git reset --hard origin/main` 하고 `npm install`. MCP 등록과 상태줄 설정은 그대로 둬도 돼요. 버전은 `node dist/cli.js --version`으로 확인하고, 바뀐 점은 [CHANGELOG.md](CHANGELOG.md)에 있어요.
55
+
56
+ Claude에게는 "CDPM 업데이트해줘"라고 하면 돼요.
57
+
58
+ ### 설치하면 자동으로 되는 것
59
+
60
+ MCP 서버가 처음 켜질 때 한 번, 따로 설정하지 않아도 이렇게 해 둬요 (원래 파일은 `.before-cdpm`으로 백업):
61
+ - Claude Code 상태줄에 슬롯 표시 켜기 (3초마다 갱신)
62
+ - 사용자 `CLAUDE.md`에 "여러 슬롯에 다른 일을 시키면 슬롯마다 서브에이전트로 병렬, 결과물도 나눠 쓰기" 규칙 넣기 (Claude는 MCP 안내보다 사용자 지시를 더 잘 따라요)
63
+ - CDPM 전용 서브에이전트 `cdpm-browser` 설치 (`~/.claude/agents/`): CDPM 도구와 파일 쓰기만 갖고 `CLAUDE.md`를 읽지 않아서 빨리 시작해요. 실측으로 슬롯 3개 병렬 작업이 중간값 28.7초 → 20.6초, 사용량 약 37% 감소. 모델과 노력 수준은 메인과 같아요. CDPM을 등록한 이름(예: `cdpm`)을 찾아서 맞춰 만들어요.
64
+ - Claude Code 권한 허용 목록(`settings.json`의 `permissions.allow`)에 CDPM 도구 전체(`mcp__cdpm`) 넣기: 자동 모드의 보안 검사가 입력(`browser_type`·`browser_fill` 등)을 막아 작업이 멈추지 않게 해요. 대신 Claude가 CDPM으로 하는 입력·클릭(메일 보내기, 글쓰기 등)을 매번 묻지 않아요.
65
+ - 서브에이전트는 동시에 20개까지라, 슬롯 20개가 넘으면 나눠 띄우라고 안내해요 (늘리려면 `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`).
66
+
67
+ 되돌리기는 `cdpm unsetup`, 처음부터 안 하게 하려면 환경변수 `CDPM_NO_AUTO_SETUP=1`. CDPM을 업데이트해서 자동 설정 내용이 바뀌면 한 번 더 도는데, 항목마다 따로 판단해요: 남아 있는 항목은 새 내용으로 바꾸고, 사용자가 직접 지운 항목(`cdpm unsetup` 포함)은 다시 넣지 않아요. 지운 것까지 다시 넣으려면 `cdpm setup`.
68
+
69
+ ### 상태줄만 다시 설정
70
+
71
+ `cdpm install`(과 서버가 처음 켜질 때)이 이미 켜 둬요. 상태줄만 다시 하려면 `cdpm statusline-setup`. 상태줄이 없으면 Claude 설정에 넣고, ccstatusline을 쓰면 위젯을 추가하고, 다른 상태줄을 쓰면 바꾸지 않고 덧붙일 명령만 알려줘요. 원래 파일은 `.before-cdpm`으로 백업해요.
72
+
73
+ ## 사용법
74
+
75
+ > 3번 켜줘 → 네이버로 가줘
76
+ > 하나 켜줘 (번호 없음 → 비어 있는 가장 작은 슬롯)
77
+ > 3번 헤드리스로 켜줘 (창 모드인지 헤드리스인지 말하지 않으면 Claude가 먼저 물어봐요)
78
+ > 서브에이전트 A는 1번, B는 2번 써
79
+ > 둘 다 5번 써. A는 가격 조사, B는 리뷰 수집. 서로 얘기하면서 해
80
+ > 3번에 네이버 로그인돼 있으니까 새 탭 열어서 홍길동한테 메일 보내 줘 (다른 Claude 세션이 3번 첫 탭을 쓰는 중이어도 돼요)
81
+ > 3번 멈춰 → (직접 조작) → 3번 다시 해
82
+
83
+ ### 한 슬롯을 여러 에이전트가 나눠 쓰기
84
+
85
+ 한 슬롯(Chrome 하나)을 여러 에이전트가 탭을 나눠 동시에 쓸 수 있어요. 서로 다른 Claude 세션이어도 같아요.
86
+
87
+ - **탭마다 따로, 동시에**: 조작은 탭마다 줄을 서요. A가 1번 탭에 입력하는 동안 B가 2번 탭을 클릭할 수 있고, 같은 탭에 동시에 온 명령만 차례로 처리해요. 서로 다른 Claude 세션이어도 탭 잠금 파일로 줄을 서서, 두 세션이 한 탭에 동시에 입력해도 글자가 섞이지 않아요 (잠금을 잡은 세션이 죽으면 바로 풀리고, 2분 넘게 안 끝나면 기다리지 않고 알려 줘요). 뒤에 있는 탭도 앞으로 가져오지 않고 조작해요.
88
+ - **로그인은 같이 써요**: 슬롯 하나는 프로필 하나라서, 한 탭에서 로그인한 사이트는 새 탭에서도 로그인돼 있어요 (탭마다 따로 인증하는 일부 사이트는 예외).
89
+ - **새 탭은 뒤에서 열려요**: `browser_tab_new`는 사용자가 보는 탭이나 다른 에이전트가 쓰는 탭을 바꾸지 않아요. 연 에이전트는 그 뒤로 자기 탭을 기본으로 써요.
90
+ - **서로 알아요**: 세션마다 이름이 따로 붙고(`claude-a3f1` 등, 서브에이전트는 자기 이름), 탭마다 연 사람과 마지막 행동이 머리말에 보여요. 남이 방금 쓴 탭을 조작하면 막지 않고 알려 줘요. 같은 계정으로 서로 반대되는 일을 할 때는 `slot_send`로 알리면서 해요.
91
+ - **한 에이전트는 한 슬롯**: 한 에이전트가 1분 안에 다른 슬롯을 조작하려 하면 거절하고, 그 슬롯 전용 서브에이전트를 띄우라고 안내해요 (여러 슬롯을 함께 비교하는 일만 `multiSlot: true`). 화면 읽기는 막지 않아요.
92
+ - 슬롯은 번호로 말해 주세요 ("3번 브라우저"). "브라우저 B"처럼 이름으로 말하면 Claude가 상태를 보고 추측해야 해요.
93
+
94
+ ### 모든 결과의 모양
95
+
96
+ ```
97
+ [3번] 탭 3개 · 2번 탭 [t7]에서 실행함
98
+ 1. [t1] 네이버 메인 naver.com 연 사람: (외부)
99
+ > 2. [t7] ·앞 쿠팡 노트북 검색 coupang.com/np/... 연 사람: 가격비교 마지막: 가격비교 클릭 (방금)
100
+ 3. [t9] 상품 리뷰 coupang.com/vp/... 연 사람: 리뷰수집 마지막: 리뷰수집 스크롤 (12초 전)
101
+ [주의] 이 탭 [t7]은 리뷰수집이 8초 전에 입력했어요. 같이 쓰는 중이면 slot_send로 알려 주세요.
102
+ 새 메시지 1개 (여기서 읽음 처리됨 — slot_inbox에는 다시 나오지 않아요)
103
+ 리뷰수집 (5초 전): 나 [t9]에서 리뷰 보고 있어. [t7]은 너 써.
104
+ ---
105
+ (도구 본래 결과)
106
+ ```
107
+
108
+ - `>` 이번에 실행한 탭, `·앞` 그 창에서 지금 화면 앞에 보이는 탭 (창이 여러 개면 창마다 하나)
109
+ - 탭 번호는 CDPM이 탭을 처음 본 순서이고, `t7` 같은 ID는 탭이 살아 있는 동안 바뀌지 않아요.
110
+
111
+ ### 탭 규칙
112
+
113
+ | 상황 | 동작 |
114
+ |---|---|
115
+ | 탭 1개 | 그 탭 |
116
+ | 이 에이전트가 이전에 쓴(또는 새로 연) 탭이 있음 | 그 탭 |
117
+ | 처음 + 보기 도구 | 앞에 보이는 탭 |
118
+ | 처음 + 조작 도구 | `tab`을 지정할 때까지 실행하지 않음 |
119
+
120
+ ### 뒤에 있는 탭
121
+
122
+ 뒤에 있는 탭도 탭을 바꾸지 않고 읽고, 조작하고, 캡처할 수 있어요. Chrome은 뒤 탭을 다시 그리지 않기 때문에, 조작·캡처하는 그 순간에만 `Emulation.setFocusEmulationEnabled`를 켜서 그리게 하고 끝나면 바로 꺼요. 사용자 화면(탭 전환, 창)은 바뀌지 않아요. 다만 그 순간에는 페이지 쪽에서 탭이 포커스를 받은 것처럼 보여서(`document.hasFocus()` 등), 사이트가 알아챌 수는 있어요.
123
+
124
+ ### 긴 페이지
125
+
126
+ `browser_snapshot`은 위에서부터 1쪽(약 1.2만 자)만 보여주고 끝에 "1/8쪽 · 다음: page=2"를 붙여요.
127
+ - `page=2`로 이어 보면 쪽 머리에 위쪽 맥락이 붙고, ref 번호는 쪽이 달라도 같아요.
128
+ - `find="글자"`는 그 글자가 들어간 줄(띄어쓰기 무시)과 위쪽 맥락, 바로 아래 두 줄을 보여줘요.
129
+ - `ref="e40"`은 그 요소 아래만 보여줘요.
130
+ - 글 내용은 `browser_text`가 더 짧아요.
131
+
132
+ 같은 요소는 페이지가 바뀌기 전까지 같은 ref 번호를 유지해요. 새 번호는 에이전트마다 탭과 상관없이 겹치지 않게 발급돼서, 다른 탭이나 예전 페이지의 ref를 쓰면 항상 거부돼요.
133
+
134
+ ## 도구
135
+
136
+ 모든 도구는 `slot`(1~30)과 `agent`(내 표시 이름)를 받아요. 조작 도구는 `tab`, `summary`(지금 하는 일 한 줄, browser_status에 표시), `read`도 받아요. `read: "text" | "snapshot" | "changes"`를 넣으면 조작 뒤 화면이 같은 결과에 바로 붙어서 따로 읽으러 갈 필요가 없어요. `changes`는 직전 스냅샷 대비 새로 생기거나 사라진 줄만 보여줘서 가장 짧아요 (클릭 결과 확인용).
137
+
138
+ | 도구 | 하는 일 |
139
+ |---|---|
140
+ | `browser_status` | 떠 있는 슬롯, 탭, 연 사람, 마지막 행동, 요약, 알림창 |
141
+ | `browser_launch` | 슬롯 켜기 (사용자가 켜 달라고 할 때만). `slot` 생략 시 비어 있는 가장 작은 번호. 여러 개는 `slots`(번호 목록)나 `count`(개수)로 한 번에 작은 번호부터 켜요. `url`(모두 같은 주소)이나 `urls`(슬롯마다)로 켜자마자 시작 페이지를 열어요. 창 모드(보임)·헤드리스(안 보임)는 사용자가 정해요: 말하지 않았으면 Claude가 먼저 물어봐요 (`headless` 없이 부르면 꺼진 슬롯은 켜지 않아요). `headless: true`면 `--headless`만 추가. `proxy`/`proxies`는 사용자가 프록시를 써 달라고 할 때만 넣어요: `주소:포트`, `http://아이디:비번@주소:포트`, `socks5://...`, `주소:포트:아이디:비번`. 넣지 않으면 프록시 관련 인자는 하나도 붙지 않아요. 아이디·비밀번호가 있는 프록시는 그 슬롯 전용 중계 프로그램이 인증을 붙여 주고, 그 Chrome이 꺼지면 같이 꺼져요 |
142
+ | `browser_close` | 정상 종료 (프로필 유지) |
143
+ | `browser_tabs` / `browser_tab_new` / `browser_tab_close` / `browser_tab_select` | 탭 목록 / 새 탭(뒤에서 열림, ID 반환) / 닫기 / 앞으로 가져오기(사용자가 원할 때만) |
144
+ | `browser_snapshot` | 접근성 트리 텍스트 + `[e12]` ref. `page` / `find` / `ref` |
145
+ | `browser_text` | 본문 글자 (main/article 우선, `ref`로 요소만, `page`로 이어보기) |
146
+ | `browser_screenshot` | 보이는 화면 PNG (뒤 탭도). 전체 페이지 캡처는 없음 |
147
+ | `browser_navigate` / `browser_back` | 이동 / 뒤로 (로딩까지 대기, 느린 서버는 오류가 아니라 "아직 로딩 중") |
148
+ | `browser_click` | ref를 진짜 마우스로 클릭. 가려져 있으면 알려줌, 새 탭이 열리면 알려줌, 폼 검증에 걸리면 이유를 알려줌 |
149
+ | `browser_type` | 글자마다 진짜 키 이벤트로 입력 (`clear`, `submit`, `fast`). 입력 후 실제 값 확인. 날짜·시간 칸은 형식 확인 후 값 지정 |
150
+ | `browser_fill` | 같은 페이지의 입력칸 여러 개를 차례로 채우고, 원하면 `submit`("Enter" 또는 버튼 ref). 실패·페이지 바뀜·알림창이면 그 자리에서 멈춤 |
151
+ | `browser_dialog` | 떠 있는 알림창(alert/confirm/prompt/beforeunload) 확인·취소 (prompt는 `text`로 입력). Claude가 내용을 보고 판단 |
152
+ | `browser_forward` / `browser_reload` | 앞으로 / 새로고침 (Chrome 새로고침 그대로, `ignore_cache`) |
153
+ | `browser_hover` | 진짜 마우스를 요소 위에 올리기 (마우스를 올려야 열리는 메뉴) |
154
+ | `browser_drag` | 진짜 마우스로 끌어 놓기: 드래그 앤 드롭·슬라이더·순서 바꾸기. 놓을 곳은 `to`(ref)·`to_text`(글자)·`dx`/`dy`. HTML 드래그도 OS 드래그 없이 처리. `draggable` 요소에도 ref가 붙어요 |
155
+ | `browser_download_wait` | 다운로드가 끝날 때까지 기다리고 저장된 파일 경로 돌려주기 (다운로드 폴더는 사용자 Chrome 설정 그대로) |
156
+ | `browser_pdf` | 지금 페이지를 PDF로 저장 (경로를 안 주면 다운로드 폴더에 제목으로) |
157
+ | `browser_upload` | 파일 올리기: 파일 칸 ref에 바로 넣거나, "첨부" 버튼을 클릭한 뒤(OS 파일 창은 CDPM이 가로채서 사용자 화면에 안 뜸) ref 없이 넣기 |
158
+ | `browser_select` | `<select>` 드롭다운: 포커스 후 키로 이동 (Windows는 화살표 키, macOS는 항목 앞글자 입력. 진짜 이벤트, 목록 창 없음) |
159
+ | `browser_press_key` | `Enter`, `Tab`, `Control+A`(macOS는 `Meta+A`) 등 (복사·붙여넣기 키는 거부) |
160
+ | `browser_scroll` | ref로 스크롤 또는 정확히 `dy`픽셀 (결과에 위치 A → B) |
161
+ | `browser_wait` | 글자(본문·제목)가 나타날 때까지 / `gone`(글자가 사라질 때까지) / `url`(주소가 바뀔 때까지) / `enabled`(버튼·입력칸이 눌릴 수 있게 될 때까지) / `response`(주소가 맞는 네트워크 응답이 다 올 때까지, 응답 본문을 돌려줌: SPA 목록 뒤의 JSON 등. 클릭하는 동안 이미 온 응답도 잡고, 요청을 새로 보내지 않아요) / `network_idle` / N초 |
162
+ | `browser_eval` | JavaScript 실행 (isolated world: DOM은 보이지만 페이지 전역 변수는 안 보임) |
163
+ | `browser_network` / `browser_network_detail` | 요청 목록(최근 500개, 30분) / 헤더·보낸 데이터·응답 본문 |
164
+ | `browser_block` | 주소 패턴으로 요청 막기·해제 (그 세션이 살아 있는 동안만, 다른 에이전트에게도 표시) |
165
+ | `slot_send` / `slot_inbox` | 에이전트에게 메시지 (받는 쪽 슬롯 번호로, 다른 슬롯 담당에게도) / 받기 (`wait`: 오는 즉시 0.1초 안에 돌아옴, 최대 600초). `browser_wait` 중에 메시지가 오면 기다리기가 바로 멈춰요 |
166
+ | `slot_pause` / `slot_resume` | 사용자가 "3번 멈춰"라고 할 때 슬롯 멈추기: 조작은 바로 모두 거절되고, 이미 하던 조작도 다음 키·마우스 입력 직전에 멈추고, 기다리기도 바로 끝나요. 화면 읽기는 그대로 돼요. 다시 시작하면 메시지로 에이전트를 바로 깨워서 화면을 다시 읽고 이어 가요. 모든 Claude 세션에 적용 |
167
+
168
+ 서브에이전트는 부모 세션의 MCP 프로세스를 같이 써요. 그래서 **서브에이전트마다 `agent` 이름을 따로 주세요.** 여러 슬롯에 각각 다른 일을 시키면("3개 띄워서 네이버, 다음, 구글 뉴스") Claude가 기본으로 슬롯마다 서브에이전트를 띄워 병렬로 처리해요. 하나씩 돌아가며 하지 않아요.
169
+
170
+ ## 상태줄
171
+
172
+ `cdpm statusline`은 한 줄을 출력하고 약 0.1초 만에 끝나요 (로컬 기록부와 켜진 슬롯 포트의 탭만 빠르게 확인). 상태줄 켜기를 하면 3초마다 다시 그려요.
173
+
174
+ ```
175
+ CDPM 1 NAVER 2 쿠팡 3
176
+ ```
177
+
178
+ 켜진 슬롯을 번호 순서로 슬롯 색 번호로 보여줘요. 슬롯마다 마지막으로 조작한 탭의 페이지 제목이 보여요 (에이전트 이름은 넣지 않아요. 빈 탭·새 탭만 남으면 번호만). 켜고 끄기, 작업관리자에서 강제 종료, Chrome 창을 직접 닫는 것(Windows)·Cmd+Q(맥)도 다음 갱신 때 바로 반영돼요. 제목은 그 탭의 지금 제목이에요. 터미널 폭에 맞춰서, 넘치면 제목을 점점 짧게 → 번호만 → 그래도 넘치면 `+N`으로 줄여요 (ccstatusline이 알려 주는 폭 기준). 멈춘 슬롯(`slot_pause`·`cdpm pause`)은 번호가 슬롯 색 대신 흐린 회색으로 보여요. 하나도 없으면 흐린 회색으로 `CDPM -`를 보여요.
179
+
180
+ `cdpm install`이나 `cdpm statusline-setup`으로 켜요 (위 "상태줄 켜기"). 직접 넣으려면:
181
+
182
+ - **ccstatusline**: *Custom Command* 위젯에 `"C:\Program Files\nodejs\node.exe" "C:\경로\CDPM\dist\cli.js" statusline` (preserve colors 켜기)
183
+ - **기본 상태줄**: `~/.claude/settings.json`의 `statusLine.command`에 같은 명령
184
+
185
+ ## CLI
186
+
187
+ ```
188
+ cdpm MCP 서버 실행 (stdio)
189
+ cdpm install Claude Code에 등록하고 자동 설정까지 (설치 뒤 한 번)
190
+ cdpm setup 상태줄·CLAUDE.md 규칙·cdpm-browser 서브에이전트·권한 허용 목록 넣기 (지웠던 것도 다시 넣음. 서버가 처음 켜질 때 자동으로도 함)
191
+ cdpm unsetup CDPM이 넣은 위 설정 빼기
192
+ cdpm --version 버전 보기
193
+ cdpm launch [슬롯...] 슬롯 켜기 (여러 개면 작은 번호부터, 번호 없으면 비어 있는 가장 작은 슬롯)
194
+ cdpm launch --headless [슬롯...] 창 없이 켜기
195
+ cdpm close <슬롯...> | --all 정상 종료
196
+ cdpm pause <슬롯...> | --all 멈추기: 그 슬롯의 에이전트 조작을 바로 모두 막음
197
+ cdpm resume <슬롯...> | --all 다시 시작: 기다리던 에이전트를 바로 깨움
198
+ cdpm purge <슬롯> 꺼진 슬롯의 프로필(로그인 정보) 삭제
199
+ cdpm status 슬롯 현황
200
+ cdpm statusline 상태줄용 한 줄
201
+ cdpm statusline-setup Claude Code 상태줄에 슬롯 표시 켜기 (원래 설정 백업)
202
+ ```
203
+
204
+ ## macOS
205
+
206
+ - 슬롯 실행·조작·네트워크·에이전트 대화·상태줄 등 기능은 Windows와 같아요.
207
+ - 슬롯마다 Dock 아이콘이 Windows와 같은 슬롯 색·번호 아이콘으로 바뀌어요. Chrome의 CDP 명령 `Browser.setDockTile`을 써서, 앱을 복사하거나 서명을 바꾸지 않아요. CDPM 밖에서 Chrome이 다시 켜지면 기본 아이콘으로 돌아가고, CDPM이 다음에 켜거나 붙을 때 다시 넣어요. 이 코드는 macOS에서만 돌아요.
208
+ - 맥 방식대로, 창을 닫아도(빨간 X, Cmd+W) 슬롯은 남아요. 상태줄에는 마지막으로 쓴 탭 제목이 계속 보이고, Cmd+Q로 Chrome을 끝내면 슬롯도 끝나고 상태줄에서 빠져요. (Windows는 마지막 창을 닫으면 슬롯이 끝나요.)
209
+ - macOS Chrome은 키 이벤트만으로는 `Cmd+A` 같은 편집 단축키가 동작하지 않아서, `Meta+A`(전체 선택)·`Meta+Z`(되돌리기)·`Meta+←/→`·`Option+←/→` 등은 같은 키 이벤트에 Chrome 편집 명령을 함께 보내요. 사람이 그 키를 눌렀을 때와 같은 동작이에요.
210
+ - `<select>`는 화살표 키를 누르면 macOS 목록 창이 떠서, 항목 앞글자를 쳐서 골라요. 앞글자가 같은 항목이 먼저 있어 고르지 못하면 값을 직접 넣고 알려줘요.
211
+
212
+ ## 저장 위치
213
+
214
+ Windows `%LOCALAPPDATA%\cdpm\`, macOS `~/Library/Application Support/cdpm/`, Linux `~/.cdpm/` (환경변수 `CDPM_HOME`으로 바꿀 수 있어요)
215
+
216
+ | 경로 | 내용 |
217
+ |---|---|
218
+ | `registry.json` | 슬롯, 탭, 연 사람·마지막 행동, 요약, 요청 막기 규칙 |
219
+ | `messages\<슬롯>.jsonl` | 슬롯별 메시지 (1000줄 넘으면 최근 500줄) |
220
+ | `messages\<슬롯>.cursors.json` | 에이전트별로 어디까지 읽었는지 (최근 200명) |
221
+ | `locks\` | 탭 조작 잠금 파일 (여러 Claude 세션이 같은 탭을 동시에 조작하지 않게. 조작이 끝나면 지워지고, 죽은 프로세스가 남긴 것은 1분마다 정리) |
222
+ | `auto-setup.json` | 자동 설정을 어느 버전까지 했는지, 어떤 항목을 넣었는지 (지운 항목을 되살리지 않으려고) |
223
+ | `profiles\<슬롯>\` | 슬롯별 Chrome 프로필 |
224
+ | `icons\<슬롯>.ico` | 작업표시줄 아이콘 |
225
+ | `config.json` | 선택: `{"chromePath": "...", "extraArgs": []}` |
226
+
227
+ ## CDPM이 하지 않는 것 / 막는 것
228
+
229
+ - User-Agent·지문 변경, 기기 에뮬레이션, 페이지 스크립트 주입, Chrome 패치를 하지 않아요.
230
+ - 실행 인자는 `--remote-debugging-port`, `--user-data-dir`, `--no-first-run`, `--no-default-browser-check`, `--window-name=N번`뿐이에요 (헤드리스 요청 시 `--headless`, 사용자가 프록시를 부탁했을 때만 `--proxy-server`와 `--force-webrtc-ip-handling-policy=disable_non_proxied_udp` 추가). 헤드리스 Chrome은 User-Agent에 `HeadlessChrome`이 그대로 찍혀요.
231
+ - 창 크기·위치·상태, 뷰포트, 확대 비율을 바꾸지 않아요. 페이지가 클릭 때문에 전체 화면이 되면 바로 해제해요.
232
+ - `Runtime.enable`을 쓰지 않고, 판단용 스크립트는 전부 isolated world에서 실행해요.
233
+ - 알림창(alert/confirm/prompt/beforeunload)을 정해진 규칙으로 자동 처리하지 않아요. 떠 있으면 알리고, Claude가 내용을 보고 `browser_dialog`로 직접 확인·취소해요. 사용자가 시키지 않은 되돌릴 수 없는 일(결제·삭제 등)을 확정하는 창일 때만 먼저 물어봐요.
234
+ - 거부하는 동작: `mailto:`·`tel:`·앱 전용 주소 클릭/이동(다른 프로그램 실행), `<select>` 클릭(목록 창), `Ctrl+C/X/V`·`Shift+Insert`(사용자 클립보드)
235
+ - 파일 응답으로 이동해서 다운로드가 시작되면 파일 이름과 함께 알려줘요 (Chrome 기본 다운로드 폴더에 저장돼요).
236
+
237
+ ## 검증
238
+
239
+ - 단위 테스트 56개, 통합 테스트 33개 (`npm test`, `npm run test:integration` — 테스트 포트 29222~로 진짜 Chrome 사용)
240
+ - 오래 켜 두기 시험 (`npm run test:long`, 약 20분): 화면을 계속 새로 그리는 SPA에서 반복마다 새 에이전트 이름으로 4,000회 → CDPM 서버 힙은 일정한 범위(26~39MB) 안에서만 오르내리고 계속 늘지 않음, 페이지는 요소 1,421개·JS 힙 0.8MB 그대로. 세션 3개가 한 슬롯을 600회씩 동시에 사용(탭 1,800개 열고 닫기, 중간에 슬롯 3번 재시작) → 세션마다 힙 약 20MB 그대로, 남은 잠금 파일·탭 없음.
241
+ - 서브에이전트 15명이 슬롯 30개를 동시에 쓰는 실사용 테스트: 테스트 전후로 창 30개 위치·크기·상태, 탭 52개 뷰포트(`innerWidth×innerHeight`), 확대 비율이 모두 그대로임을 확인
242
+
243
+ ## 라이선스
244
+
245
+ MIT
package/README.md CHANGED
@@ -1,3 +1,168 @@
1
- # Temporary Holding Version
1
+ # CDPM — CDP Manager
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [한국어 README](README.ko.md)
4
+
5
+ > **Asked to install this? (for Claude / AI agents)** Do these steps in order.
6
+ > 1. Check that Node.js 22+ and Google Chrome are installed. If not, tell the user and stop.
7
+ > 2. Run `npm install -g cdpm-mcp@latest` (also when already installed: this updates it).
8
+ > 3. Run `cdpm install` (if `cdpm` isn't found: `node "$(npm root -g)/cdpm-mcp/dist/cli.js" install`). It registers CDPM with Claude Code and sets up the status line, rules, subagent and permissions; an older git-clone registration is switched to the new location.
9
+ > 4. Do not launch any Chrome slot, ask questions, or explain internals. On success reply with exactly one line in the user's language, e.g. "CDPM <version> installed. Restart Claude Code to use it." (version: `cdpm --version`). If a step failed, say only which step and why.
10
+
11
+ An MCP server that runs **Chrome slots 1–30** over the Chrome DevTools Protocol, so several Claude sessions and subagents can share and drive the same browsers just by number: *"turn on slot 3"*, *"check slot 3"*.
12
+
13
+ - **Pure CDP.** No Playwright, no Puppeteer, no stealth patches. A normal Chrome with a debugging port, driven with real input events.
14
+ - **Numbered slots.** Slot *N* uses CDP port `14049 + N` (slot 1 = 14050 … slot 30 = 14079) and its own profile folder. The range avoids the common default 9222; set `CDPM_PORT_BASE` to move it if something else uses those ports. Ports outside that range are not managed.
15
+ - **Starts only when asked.** No tool ever starts a closed slot except `browser_launch`. Without a number, the lowest free slot is used.
16
+ - **One taskbar button per slot**, with a browser-window icon in the slot color and the slot number, pre-corrected so the taskbar shows it pixel-sharp (drawn with the system font via GDI+, so no font files ship in the repo). The window title shows "3번" via Chrome's own window-name feature (pages can't see it).
17
+ - **Built for many agents.** Every tool takes `slot` explicitly, records who opened each tab and who touched it last, warns (without blocking) when you act on a tab someone else just used, and serializes concurrent commands on the same tab.
18
+ - **Agents can talk** with `slot_send` / `slot_inbox`; unread messages are also delivered at the top of every result.
19
+ - **Status line.** `cdpm statusline` prints live slots as slot-colored numbers; each slot shows the title of the tab last acted on (no agent names; only blank/new tabs left shows just the number): `CDPM 1 NAVER 2 Daum`. It fits the terminal width (from ccstatusline): titles shrink first, then only numbers, then `+N` for the rest. A paused slot (`slot_pause` / `cdpm pause`) shows its number in dim gray instead of its slot color. A dim `CDPM -` when none are running. Ending a slot's Chrome yourself (closing its last window on Windows, Cmd+Q on macOS) removes it right away, and titles are read live.
20
+ - **Leaves the user's PC alone.** No window, viewport or zoom changes, and actions that would pop up OS windows are refused (see below).
21
+
22
+ > Works on Windows 11 and macOS. Per-slot icons: taskbar on Windows, Dock on macOS (see "macOS" below).
23
+ > Linux is experimental: the code paths exist (Chrome lookup, data folder) but it has not been tested on a Linux machine, and there are no per-slot icons.
24
+
25
+ ## Requirements
26
+
27
+ - Node.js 22+
28
+ - Google Chrome (found automatically. Windows: registry `App Paths`, then standard install folders. macOS: `/Applications`, `~/Applications`, then Spotlight. Linux: `/usr/bin/google-chrome`, `google-chrome-stable`, `/opt/google/chrome/chrome`)
29
+
30
+ ## Install
31
+
32
+ ```sh
33
+ npm install -g cdpm-mcp
34
+ cdpm install
35
+ ```
36
+
37
+ `cdpm install` registers CDPM with Claude Code and sets up the status line, the parallel-work rule, the `cdpm-browser` subagent and the permission allow list in one go. Restart Claude Code afterwards.
38
+
39
+ ### From a clone (development)
40
+
41
+ ```sh
42
+ git clone https://github.com/IGELHARINE/CDPM.git
43
+ cd CDPM
44
+ npm install
45
+ node dist/cli.js install
46
+ ```
47
+
48
+ ### Update
49
+
50
+ ```sh
51
+ npm install -g cdpm-mcp@latest
52
+ ```
53
+
54
+ Then restart Claude Code. From a clone: `git fetch origin && git reset --hard origin/main` and `npm install`. The MCP registration and status line setting stay as they are. Check the version with `node dist/cli.js --version`; changes are listed in [CHANGELOG.md](CHANGELOG.md).
55
+
56
+ Or just ask Claude: "update CDPM".
57
+
58
+ ### What happens automatically
59
+
60
+ The first time the MCP server starts, CDPM sets these up once, with no extra steps (original files backed up as `.before-cdpm`):
61
+ - the slot display in Claude Code's status line (redrawn every 3 s)
62
+ - a rule in the user's `CLAUDE.md`: when several slots get different jobs, use one subagent per slot in parallel and let each write its own part of the output (Claude follows user instructions more reliably than MCP guidance)
63
+ - a CDPM-only subagent `cdpm-browser` in `~/.claude/agents/`: only CDPM tools plus file writing, no `CLAUDE.md`, so it starts faster (measured on a 3-slot parallel job: median 28.7 s -> 20.6 s, about 37% less usage); same model and effort as the main agent. It uses whatever name CDPM is registered under.
64
+ - CDPM tools (`mcp__cdpm`) in Claude Code's permission allow list (`permissions.allow` in `settings.json`), so auto mode's classifier doesn't block typing and filling mid-task. Claude then performs CDPM input and clicks (sending mail, posting) without asking each time.
65
+ - subagents run at most 20 at once, so beyond 20 slots Claude is told to launch them in batches (raise with `CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS`).
66
+
67
+ Undo with `cdpm unsetup`; skip it entirely with `CDPM_NO_AUTO_SETUP=1`. When an update changes the automatic setup it runs once more, item by item: items still present are refreshed, items you removed (including with `cdpm unsetup`) are not brought back. `cdpm setup` re-adds everything.
68
+
69
+ ### Status line only
70
+
71
+ `cdpm install` (and the first server start) already turns it on. To redo only the status line: `cdpm statusline-setup`. With no status line it adds one to Claude's settings; with ccstatusline it adds a widget; with any other status line it changes nothing and prints the command to append. The original file is backed up as `.before-cdpm`.
72
+
73
+ ## How it behaves
74
+
75
+ Each result starts with a header: the slot's tabs (`>` = acted on now, `·앞` = the tab in front in its window), warnings, and new messages (marked as read there).
76
+
77
+ **Tab rules:** one tab → that tab; the agent's last-used (or newly opened) tab → that tab; first use → view tools take the front tab, action tools require `tab`. Tab numbers follow first-seen order; IDs like `t7` never change while the tab lives.
78
+
79
+ **Sharing one slot:** several agents (even in different Claude sessions) can work in one slot at the same time, each in its own tab. Commands queue per tab, so agent A can type in tab 1 while agent B clicks in tab 2; only commands on the same tab wait for each other, across Claude sessions too (a per-tab lock file), so two sessions typing into one tab never interleave; a lock held by a dead process is released at once, and one held over 2 minutes is reported instead of waited on. One slot is one Chrome profile, so a site logged in in one tab is logged in in a new tab too (except sites that authenticate per tab). `browser_tab_new` opens in the background, so neither the user's view nor another agent's tab changes, and the opener keeps using its own tab. Every session gets its own name (`claude-a3f1`, subagents use theirs); headers show who opened and last used each tab, and acting on a tab someone else just used is reported, not blocked. One agent drives one slot: acting on a second slot within a minute is refused with advice to start a subagent for it (`multiSlot: true` for comparisons); reading other slots is always allowed. Refer to slots by number ("slot 3"); a name like "browser B" makes Claude guess.
80
+
81
+ **Background tabs** can be read, driven and captured without switching tabs: while acting on a hidden tab, CDPM briefly enables `Emulation.setFocusEmulationEnabled` so Chrome paints it, then turns it off. The user's view does not change, but during that moment the page sees the tab as focused (`document.hasFocus()` etc.), so a site could notice.
82
+
83
+ **Long pages:** `browser_snapshot` returns page 1 (~12k chars) with "1/8 · next: page=2". Later pages carry their ancestor context; refs stay the same across pages. `find` matches lines ignoring whitespace and shows ancestors plus the next two lines; `ref` shows one subtree. `browser_text` is shorter for reading content. The same element keeps the same ref until navigation, and new refs are unique per agent across tabs, so a ref from another tab or an old page is always rejected.
84
+
85
+ ## Tools
86
+
87
+ All tools take `slot` (1–30) and `agent` (display name). Action tools also take `tab`, `summary` and `read`: `read: "text" | "snapshot" | "changes"` attaches the page after the action to the same result (no separate read call). `changes` shows only lines added or removed since the agent's previous snapshot of that page — the shortest way to see what a click did.
88
+
89
+ | Tool | What it does |
90
+ |---|---|
91
+ | `browser_status` | Live slots, tabs, openers, last actions, summaries, dialogs |
92
+ | `browser_launch` | Start a slot — only when the user asks; no `slot` = lowest free; `slots` (list) or `count` start several at once, lowest first; `url` / `urls` open a start page right away. Window or headless is the user's choice: if they didn't say, Claude asks first (without `headless`, a closed slot is not started). `headless: true` adds only `--headless`. `proxy` / `proxies` (only when the user asks for a proxy): `host:port`, `http://user:pass@host:port`, `socks5://...`, `host:port:user:pass`. Without it, no proxy flag is added at all. Proxies with a username and password go through a small per-slot local relay that adds the credentials and exits with that Chrome |
93
+ | `browser_close` | Close gracefully (profile kept) |
94
+ | `browser_tabs` / `browser_tab_new` / `browser_tab_close` / `browser_tab_select` | List / open in background (returns ID) / close / bring to front (only when the user wants) |
95
+ | `browser_snapshot` | Accessibility text with refs; `page`, `find`, `ref` |
96
+ | `browser_text` | Readable text (main/article first, or one `ref`), paginated |
97
+ | `browser_screenshot` | Visible area as PNG, background tabs included; no full-page capture |
98
+ | `browser_navigate` / `browser_back` | Waits for load; slow servers are reported as "still loading", not as errors |
99
+ | `browser_click` | Real mouse click; reports covering elements, new tabs, form-validation failures |
100
+ | `browser_type` | Real key events per character (`clear`, `submit`, `fast`); verifies the value; date/time inputs are set after format validation |
101
+ | `browser_fill` | Fill several inputs on one page in order, then optionally `submit` ("Enter" or a button ref); stops at the first failure, page change or dialog |
102
+ | `browser_dialog` | Accept or dismiss an open alert/confirm/prompt/beforeunload (`text` for prompt). Claude decides from the message |
103
+ | `browser_forward` / `browser_reload` | Forward / reload (Chrome's own reload, `ignore_cache`) |
104
+ | `browser_hover` | Real mouse over an element (hover-only menus) |
105
+ | `browser_drag` | Real mouse drag: drag-and-drop, sliders, reordering. Drop on `to` (ref), `to_text` (text) or `dx`/`dy`. HTML5 drags are handled without an OS drag; `draggable` elements get refs |
106
+ | `browser_download_wait` | Wait for a download to finish and return the saved file path (Chrome's download folder setting is kept) |
107
+ | `browser_pdf` | Save the page as PDF (default: Downloads folder, named after the title) |
108
+ | `browser_upload` | Upload files: into a file input by ref, or after clicking an "attach" button (CDPM intercepts the OS file dialog so it never appears) without a ref |
109
+ | `browser_select` | `<select>`: focus + keys (arrow keys on Windows, option prefix on macOS; trusted events, no popup) |
110
+ | `browser_press_key` | `Enter`, `Tab`, `Control+A` (`Meta+A` on macOS), … (clipboard keys refused) |
111
+ | `browser_scroll` | To a ref, or exactly `dy` pixels (reports position A → B) |
112
+ | `browser_wait` | Text in body or title / `gone` (text disappears) / `url` change / `enabled` (a button or input stops being disabled) / `response` (a network response whose URL matches finishes; returns its body, e.g. the JSON behind an SPA list — responses that arrived while you clicked are caught too; nothing extra is sent) / `network_idle` / N seconds |
113
+ | `browser_eval` | JavaScript in an isolated world (DOM visible, page globals not) |
114
+ | `browser_network` / `browser_network_detail` | Requests (last 500, 30 min) / headers, post data, body |
115
+ | `browser_block` | Block/unblock URL patterns (while the session lives; visible to other agents) |
116
+ | `slot_send` / `slot_inbox` | Message an agent (use the receiver's slot number, works across slots) / receive (`wait` returns within ~0.1 s of a message, up to 600 s). A message also interrupts `browser_wait` immediately |
117
+ | `slot_pause` / `slot_resume` | Pause a slot when the user says so ("stop slot 3"): every action is refused at once, an action already running stops before its next key or mouse event, and waits return. Reading the screen still works. Resume wakes the agents with a message so they re-read the page and continue. Applies to every Claude session |
118
+
119
+ Subagents share their parent's MCP process — give each one its own `agent` name. When several slots get different jobs ("open 3: Naver, Daum, Google News"), Claude runs them in parallel by default, one subagent per slot, not one after another.
120
+
121
+ ## Status line
122
+
123
+ `cdpm statusline` exits in ~0.1 s (local registry plus a quick tab check on each live slot port); setup makes Claude Code redraw it every 3 s. Turned on by `cdpm install`; redo with `cdpm statusline-setup`. To wire it by hand: for **ccstatusline**, add a *Custom Command* widget with `"C:\Program Files\nodejs\node.exe" "C:\path\to\CDPM\dist\cli.js" statusline` (preserve colors). Otherwise point `statusLine.command` at the same command.
124
+
125
+ ## CLI
126
+
127
+ ```
128
+ cdpm run the MCP server (stdio)
129
+ cdpm install register with Claude Code and run the automatic setup (once after installing)
130
+ cdpm setup add the status line, CLAUDE.md rule, cdpm-browser subagent and permission allow list, including ones you removed (also done automatically on first server start)
131
+ cdpm unsetup remove what CDPM added
132
+ cdpm --version print the version
133
+ cdpm launch [slot...] start slots (ascending order; no number = lowest free)
134
+ cdpm launch --headless [slot...] start without a window
135
+ cdpm close <slot...> | --all close gracefully
136
+ cdpm pause <slot...> | --all pause: stop all agent actions on the slot immediately
137
+ cdpm resume <slot...> | --all resume: wake the waiting agents
138
+ cdpm purge <slot> delete a closed slot's profile
139
+ cdpm status | statusline
140
+ cdpm statusline-setup turn on the slot display in Claude Code's status line (backs up settings)
141
+ ```
142
+
143
+ Data lives in `%LOCALAPPDATA%\cdpm\` on Windows `~/Library/Application Support/cdpm/` on macOS and `~/.cdpm/` on Linux (`CDPM_HOME` overrides): `registry.json`, `messages\<slot>.jsonl` (last 500 lines once over 1000) and `messages\<slot>.cursors.json` (read position per agent, latest 200), `locks\` (per-tab lock files so Claude sessions never drive one tab at once; removed when the action ends, leftovers of dead processes cleaned every minute), `profiles\<slot>\`, `icons\`, `auto-setup.json` (which setup version ran and which items CDPM added, so removed items are not brought back), optional `config.json` (`chromePath`, `extraArgs`).
144
+
145
+ ## macOS
146
+
147
+ - Launching, driving, network tools, agent messaging and the status line work the same as on Windows.
148
+ - Each slot's Dock icon is set to the same slot-colored numbered icon as on Windows, through Chrome's own CDP command `Browser.setDockTile` (no app copying or re-signing). It returns to the normal Chrome icon if Chrome restarts outside CDPM, and is set again the next time CDPM launches or attaches. This code runs only on macOS.
149
+ - Following the Mac convention, closing a slot's window (red button, Cmd+W) keeps the slot; the status line keeps showing the last-used tab title. Quitting Chrome with Cmd+Q ends the slot and removes it. (On Windows, closing the last window ends the slot.)
150
+ - Chrome on macOS doesn't run editing shortcuts from key events alone, so `Meta+A` (select all), `Meta+Z` (undo), `Meta+←/→`, `Option+←/→` and similar also send the matching Chrome editing command with the same key event — the same thing a person pressing the key gets.
151
+ - Arrow keys on a `<select>` open the macOS popup menu, so `browser_select` types the start of the option text instead. If an earlier option shares that prefix, it sets the value directly and says so.
152
+
153
+ ## What CDPM does not do / refuses
154
+
155
+ - No user-agent or fingerprint changes, device emulation, page script injection, or Chrome patching.
156
+ - Launch flags are only `--remote-debugging-port`, `--user-data-dir`, `--no-first-run`, `--no-default-browser-check`, `--window-name` (plus `--headless` on request, and `--proxy-server` + `--force-webrtc-ip-handling-policy=disable_non_proxied_udp` only when the user asks for a proxy; headless Chrome still reports `HeadlessChrome`).
157
+ - Never changes window size/position/state, viewport, or zoom; if a click makes the page fullscreen, it is exited immediately.
158
+ - No `Runtime.enable`; helper scripts run in an isolated world.
159
+ - Dialogs (alert/confirm/prompt/beforeunload) are reported, never handled automatically. Claude reads the message and handles it itself with `browser_dialog` (accept or dismiss); it asks the user only when the dialog would confirm something irreversible the user did not ask for (a payment, a deletion).
160
+ - Refuses: `mailto:`/`tel:`/app-scheme links (would launch other programs), clicking `<select>` (popup), `Ctrl+C/X/V`/`Shift+Insert` (user clipboard). Downloads triggered by navigation are reported with the file name.
161
+
162
+ ## Verification
163
+
164
+ 56 unit and 33 integration tests (`npm test`, `npm run test:integration`, real Chrome on test ports 29222+). Long-running checks (`npm run test:long`, ~20 min): 4,000 rounds on an SPA that replaces its DOM, with a new agent name every round, kept the CDPM server heap within a fixed band (26–39 MB, no upward trend) and the page at 1,421 DOM nodes / 0.8 MB JS heap; 3 sessions sharing one slot for 600 rounds each (1,800 tabs opened and closed, the slot restarted 3 times) stayed at ~20 MB heap per session with no lock files or tabs left behind. A 15-subagent, 30-slot concurrent run confirmed that all 30 windows' position/size/state and all 52 tabs' viewport (`innerWidth×innerHeight`) and zoom were unchanged.
165
+
166
+ ## License
167
+
168
+ MIT