cdpm-mcp 0.1.4 → 0.1.5

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  버전 번호는 `package.json`에서 관리해요. 확인: `cdpm --version` (직접 받았으면 `node dist/cli.js --version`).
4
4
  업데이트 방법은 README의 "업데이트" 항목을 보세요.
5
5
 
6
+ ## 0.1.5 (2026-10-12)
7
+
8
+ - AI가 읽는 글을 모두 영어로 바꿨어요 (토큰 절약): 서버 안내, 도구·인자 설명, 도구 결과·오류·경고, 탭 머리말, 시간 표시(`just now`, `5s ago`), `cdpm-browser` 지침, CLAUDE.md 규칙 블록. 서버 안내와 지침에 "사용자에게는 사용자가 쓰는 언어로 답한다"를 넣었어요. CLI 출력과 설치·설정 안내, 작업표시줄 창 이름("3번")은 한국어 그대로예요.
9
+ - 헤드리스는 사용자가 "헤드리스·안 보이게"라고 말했을 때만 켜고, 말하지 않았으면 먼저 물어보도록 안내를 분명히 했어요.
10
+ - 몇 분씩 걸리는 기다림(대량 수집 완료, 로그인 등)은 메인이 직접 하지 않고 백그라운드 서브에이전트에 맡긴 뒤 사용자와 대화를 이어 가도록 안내해요.
11
+ - 한 슬롯 안에서 탭마다 할 일이 다르면(예: "1번의 첫 탭은 로그인, 둘째 탭은 다른 사이트") 탭마다 서브에이전트를 맡기고, 순서가 있으면 `slot_send`/`slot_inbox` 신호로 잇도록 안내해요.
12
+
6
13
  ## 0.1.4 (2026-10-12)
7
14
 
8
15
  - VS Code 등을 닫으면 슬롯 Chrome이 같이 꺼지던 문제를 고쳤어요. VS Code는 닫힐 때 자기가 띄운 프로세스를 자식의 자식까지 줄기째 강제 종료하는데, 슬롯 Chrome이 CDPM의 자식으로 남아 있었어요. 이제 중간 다리 프로세스로 띄워 부모 없는 프로세스로 만들어서, CDPM·Claude Code·VS Code가 꺼져도 슬롯은 살아 있어요. 프록시 중계 프로그램도 같아요.
package/README.ko.md CHANGED
@@ -18,6 +18,7 @@
18
18
  - **여러 에이전트용 설계**: 모든 도구에 `slot`을 명시해요. 탭마다 누가 열었고 누가 마지막으로 건드렸는지 기록하고, 남이 최근에 쓴 탭을 조작하면 막지 않고 알려줘요. 같은 탭에 동시에 온 명령은 줄 세워 하나씩 실행해요.
19
19
  - **에이전트끼리 대화**: `slot_send` / `slot_inbox`. 안 읽은 메시지는 모든 도구 결과 맨 위에도 붙어요.
20
20
  - **상태줄**: `cdpm statusline`이 떠 있는 슬롯을 슬롯 색 번호와 마지막으로 조작한 탭의 제목으로 출력해요 (`CDPM 1 NAVER 2 Daum`). 에이전트 이름은 넣지 않아요.
21
+ - **AI용 글은 영어**: 서버 안내, 도구 설명, 도구 결과는 토큰을 아끼려고 영어로 되어 있어요. Claude는 사용자가 쓰는 언어(한국어 등)로 답하도록 안내받아요. CLI 출력은 한국어예요.
21
22
  - **사용자 PC를 건드리지 않아요**: 창 크기·위치·뷰포트·확대 비율을 바꾸지 않고, OS 창(파일 선택·메일 앱 등)을 띄우는 동작은 거부해요. 아래 "하지 않는 것"을 보세요.
22
23
 
23
24
  > Windows 11과 macOS에서 쓸 수 있어요. 슬롯별 아이콘은 Windows는 작업표시줄, macOS는 Dock에 들어가요 (아래 "macOS" 참고).
package/README.md CHANGED
@@ -18,6 +18,7 @@ An MCP server that runs **Chrome slots 1–30** over the Chrome DevTools Protoco
18
18
  - **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.
19
19
  - **Agents can talk** with `slot_send` / `slot_inbox`; unread messages are also delivered at the top of every result.
20
20
  - **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.
21
+ - **English for the AI.** Server instructions, tool descriptions and tool results are in English to save tokens; Claude is told to answer in the user's language. CLI output is in Korean.
21
22
  - **Leaves the user's PC alone.** No window, viewport or zoom changes, and actions that would pop up OS windows are refused (see below).
22
23
 
23
24
  > Works on Windows 11 and macOS. Per-slot icons: taskbar on Windows, Dock on macOS (see "macOS" below).
@@ -43,24 +43,26 @@ export function agentFile(names) {
43
43
  const tools = [...names.flatMap((n) => AGENT_TOOLS.map((t) => `mcp__${n}__${t}`)), 'Write'];
44
44
  return `---
45
45
  name: cdpm-browser
46
- description: CDPM 브라우저 슬롯 하나를 맡아 이동·읽기·클릭·입력을 하는 서브에이전트. 여러 CDPM 슬롯에 각각 다른 일을 시킬 때 슬롯마다 하나씩, 한 메시지에서 함께 띄운다.
46
+ description: Subagent that owns one CDPM browser slot and navigates, reads, clicks and types in it. When several CDPM slots get different jobs, start one per slot, all in a single message.
47
47
  tools: ${tools.join(', ')}
48
48
  omitClaudeMd: true
49
49
  ---
50
50
  ${MARK}
51
- 너는 CDPM 브라우저 슬롯 하나를 맡은 작업자다. 메인 에이전트는 사용자와 대화하고 슬롯을 켜고 일을 나눠 주고 결과를 합칠 뿐, 이 슬롯 화면은 네가 전부 맡는다.
52
- 메인의 지시는 짧다 (슬롯 번호, 네 agent 이름, 할 일). 나머지 방법은 아래 규칙대로 스스로 판단해서 바로 움직인다.
53
- - 맡은 slot 번호와 agent 이름을 모든 CDPM 도구에 그대로 넣는다. 다른 슬롯은 건드리지 않는다.
54
- - 화면이 필요하면 조작 도구에 read를 붙여 한 번에 받는다 (글은 text, 누를 게 필요하면 snapshot, 바뀐 것만 보려면 changes).
55
- - 같은 페이지의 입력칸 여러 개는 browser_fill 한 번으로 채운다.
56
- - 맡은 일의 주소 이동부터 직접 한다 (메인은 슬롯만 켜 둔다). 메인이 켜면서 시작 페이지를 이미 열어 뒀으면 다시 이동하지 않고 그 화면에서 바로 시작한다 (먼저 browser_snapshot interactive=true로 확인).
57
- - 기다림은 최소한으로. 고정 시간 대기는 쓰지 않는다. 버튼이 켜지길 기다리면 browser_wait enabled, 검색 결과·목록처럼 화면 뒤에서 데이터를 받아 오는 페이지는 화면을 읽는 대신 클릭 뒤 browser_wait response(주소 일부)로 응답 JSON을 바로 받는다.
58
- - 어느 사이트든 사용자가 로그인·본인 인증·보안문자 등을 해야 하면 "됐다고 알려 달라"고 하지 않는다. 화면을 건드리지 않고(새로고침·다시 이동 금지: 입력 중인 내용이 사라짐) browser_wait url(주소 변화) / gone(로그인 폼 글자가 사라짐) / text(로그인 뒤에만 보이는 글자)로 완료를 감지하고 바로 이어서 진행한다.
59
- - 다른 에이전트와 함께 일하면 실시간으로 신호를 주고받는다: 내 일을 끝내면 바로 slot_send(slot=상대 슬롯, to=상대 이름)로 알리고, 상대를 기다릴 때는 화면을 반복해서 새로고침하지 말고 slot_inbox(slot=내 슬롯, wait=120~600)로 기다린다 (오는 즉시 돌아옴). 신호를 받으면 바로 확인하고 움직인다.
60
- - 사용자가 슬롯을 멈추면 조작이 "[멈춤]"으로 거절된다. 그때는 조작하지 말고 slot_inbox(slot=내 슬롯, wait=600)로 기다리다가, "[다시 시작]" 메시지를 받으면 browser_snapshot으로 화면을 다시 읽고 이어 간다. 스스로 다시 시작하지 않는다.
61
- - 다른 슬롯 화면이 필요하면 보기 도구(browser_snapshot·browser_text)로 직접 본다 (조작은 하지 않는다).
62
- - 알림창이 뜨면 웬만하면 내용을 보고 직접 판단해서 browser_dialog로 확인·취소한다. 맡은 일에 없던 되돌릴 수 없는 일(결제·삭제 등)을 확정하는 창일 때만 처리하지 말고 메인에 보고한다.
63
- - 결과물(보고서·HTML 조각·표 등)은 요청받은 자기 몫만 만들어 짧게 돌려준다. 파일로 달라고 했으면 그 경로에 쓴다.
51
+ You own one CDPM browser slot. The main agent talks to the user, launches slots, hands out work and merges results; everything on this slot's screen is yours.
52
+ Instructions from the main agent are short (slot number, your agent name, the task). Work out the rest from these rules and act right away.
53
+ - Report back in the language the main agent/user uses.
54
+ - Pass your slot number and agent name to every CDPM tool. Never touch other slots.
55
+ - If assigned a specific tab, pass that tab to every tool and leave other tabs alone. If told to use a new tab, open one with browser_tab_new and use its ID. If your work depends on another tab's owner finishing first, wait for their signal with slot_inbox(wait); when your own work is done, notify whoever is waiting with slot_send immediately.
56
+ - When you need the screen, add read to the action tool to get it in one call (text for content, snapshot when you need things to click, changes to see only what changed).
57
+ - Fill multiple fields on the same page with a single browser_fill.
58
+ - Do your own navigation (the main agent only launches the slot). If the start page is already open from launch, start there without navigating again (check first with browser_snapshot interactive=true).
59
+ - Keep waiting to a minimum; never use fixed-time sleeps. For jobs that take minutes (e.g. bulk collection), check progress briefly now and then and return results as soon as it finishes. To wait for a button to enable, use browser_wait enabled. For pages that load data in the background (search results, lists), click and then use browser_wait response (URL fragment) to get the response JSON directly instead of reading the screen.
60
+ - When the user must log in, verify identity, solve a CAPTCHA, etc. on any site, never ask them to tell you when done. Leave the screen alone (no reload or re-navigation: it wipes their input) and detect completion with browser_wait url (URL change) / gone (login form text disappears) / text (text shown only after login), then continue.
61
+ - When working with other agents, signal in real time: as soon as your part is done, notify them with slot_send(slot=their slot, to=their name); when waiting on them, don't keep refreshing the screen, use slot_inbox(slot=your slot, wait=120-600) (returns as soon as a message arrives). Act on signals immediately.
62
+ - If the user pauses the slot, actions are rejected with a pause notice. Then stop acting and wait with slot_inbox(slot=your slot, wait=600); on the resume message, re-read the screen with browser_snapshot and continue. Never resume on your own.
63
+ - To see another slot's screen, use read-only tools (browser_snapshot, browser_text) on it directly (no actions).
64
+ - When a dialog appears, normally read it and accept/dismiss it yourself with browser_dialog. Only if it confirms something irreversible outside your task (payment, deletion, etc.), leave it and report to the main agent.
65
+ - Return only your own requested part of the output (report, HTML fragment, table, etc.), briefly. If asked for a file, write it to that path.
64
66
  `;
65
67
  }
66
68
  /** 설치(또는 최신으로 갱신). 사용자가 직접 만든 같은 이름의 파일은 건드리지 않는다. */
@@ -12,7 +12,7 @@ import { claudeMdPath, hasCdpmRules, setupClaudeMd } from './claude-md-setup.js'
12
12
  import { cdpmHome } from './paths.js';
13
13
  import { isStatuslineConfigured, setupStatusline } from './statusline-setup.js';
14
14
  /** 자동 설정 내용이 바뀌면 올린다 (그때 한 번 더 적용). */
15
- export const AUTO_SETUP_VERSION = 13; // 2: cdpm-browser 서브에이전트, 3: 권한 허용 목록, 4: 실시간 협업 규칙, 5: 메인은 켜기만·로그인 자동 감지, 6: 역할 구분, 7: 백그라운드로 한꺼번에·짧은 지시, 8: 켜면서 시작 주소 열기, 9: 서브에이전트 도구 추가(업로드·마우스 올리기 등), 10: 알림창 처리(browser_dialog), 11: 알림창은 웬만하면 직접 처리, 12: browser_wait enabled·response, 13: 멈춤·다시 시작
15
+ export const AUTO_SETUP_VERSION = 14; // 2: cdpm-browser 서브에이전트, 3: 권한 허용 목록, 4: 실시간 협업 규칙, 5: 메인은 켜기만·로그인 자동 감지, 6: 역할 구분, 7: 백그라운드로 한꺼번에·짧은 지시, 8: 켜면서 시작 주소 열기, 9: 서브에이전트 도구 추가(업로드·마우스 올리기 등), 10: 알림창 처리(browser_dialog), 11: 알림창은 웬만하면 직접 처리, 12: browser_wait enabled·response, 13: 멈춤·다시 시작, 14: 헤드리스는 말했을 때만·긴 기다림은 백그라운드·슬롯별 다른 일 예시·한 슬롯 안 탭마다 다른 일도 서브에이전트
16
16
  export function setupItems() {
17
17
  return [
18
18
  { name: 'statusline', present: () => isStatuslineConfigured(), apply: () => setupStatusline().message },
@@ -22,7 +22,7 @@ export class CdpConnection {
22
22
  const ws = new WebSocket(url);
23
23
  const timer = setTimeout(() => {
24
24
  ws.close();
25
- reject(new CdpmError(`CDP 연결 시간 초과: ${url}`));
25
+ reject(new CdpmError(`CDP connect timed out: ${url}`));
26
26
  }, timeoutMs);
27
27
  ws.addEventListener('open', () => {
28
28
  clearTimeout(timer);
@@ -30,19 +30,19 @@ export class CdpConnection {
30
30
  }, { once: true });
31
31
  ws.addEventListener('error', () => {
32
32
  clearTimeout(timer);
33
- reject(new CdpmError(`CDP 연결 실패: ${url}`));
33
+ reject(new CdpmError(`CDP connect failed: ${url}`));
34
34
  }, { once: true });
35
35
  });
36
36
  }
37
37
  send(method, params = {}, timeoutMs = 30_000, sessionId) {
38
38
  if (this.closed)
39
- return Promise.reject(new CdpmError(`CDP 연결이 끊어졌습니다 (${method}).`));
39
+ return Promise.reject(new CdpmError(`CDP connection closed (${method}).`));
40
40
  const id = this.nextId++;
41
41
  return new Promise((resolve, reject) => {
42
42
  const timer = setTimeout(() => {
43
43
  this.pending.delete(id);
44
- reject(new CdpTimeoutError(`Chrome이 ${Math.round(timeoutMs / 1000)}초 동안 응답하지 않았어요 (${method}). ` +
45
- '페이지가 무겁거나, 네트워크가 느리거나, 알림창이 떠 있을 수 있어요. 잠시 뒤 다시 시도하거나 browser_tabs로 상태를 확인하세요.'));
44
+ reject(new CdpTimeoutError(`Chrome did not respond for ${Math.round(timeoutMs / 1000)}s (${method}). ` +
45
+ 'The page may be heavy, the network slow, or a dialog open. Retry shortly or check with browser_tabs.'));
46
46
  }, timeoutMs);
47
47
  this.pending.set(id, { resolve, reject, timer, method });
48
48
  this.ws.send(JSON.stringify({ id, method, params, ...(sessionId ? { sessionId } : {}) }));
@@ -106,7 +106,7 @@ export class CdpConnection {
106
106
  this.pending.delete(msg.id);
107
107
  clearTimeout(p.timer);
108
108
  if (msg.error)
109
- p.reject(new CdpmError(`${p.method} 실패: ${msg.error.message}`));
109
+ p.reject(new CdpmError(`${p.method} failed: ${msg.error.message}`));
110
110
  else
111
111
  p.resolve(msg.result);
112
112
  return;
@@ -139,7 +139,7 @@ export class CdpConnection {
139
139
  this.closed = true;
140
140
  for (const [, p] of this.pending) {
141
141
  clearTimeout(p.timer);
142
- p.reject(new CdpmError(`CDP 연결이 끊어졌습니다 (${p.method}). 탭이 닫혔거나 Chrome이 종료됐을 수 있어요.`));
142
+ p.reject(new CdpmError(`CDP connection closed (${p.method}). The tab or Chrome may have closed.`));
143
143
  }
144
144
  this.pending.clear();
145
145
  for (const h of this.closedHandlers)
@@ -52,17 +52,17 @@ export async function waitDownload(slot, timeoutSec, stop) {
52
52
  if (d && d.state !== 'inProgress') {
53
53
  d.reported = true;
54
54
  if (d.state === 'canceled')
55
- return `다운로드가 취소됐어요: ${d.file}`;
55
+ return `Download canceled: ${d.file}`;
56
56
  const size = d.totalBytes || d.receivedBytes;
57
- return `다운로드가 끝났어요: ${d.filePath ?? d.file}${size ? ` (${(size / 1024).toFixed(1)}KB)` : ''}`;
57
+ return `Download finished: ${d.filePath ?? d.file}${size ? ` (${(size / 1024).toFixed(1)}KB)` : ''}`;
58
58
  }
59
59
  const why = stop?.();
60
60
  if (why)
61
61
  return why;
62
62
  if (Date.now() > until) {
63
63
  if (d)
64
- return `${timeoutSec}초 안에 다운로드가 끝나지 않았어요: ${d.file} (${d.receivedBytes}/${d.totalBytes || '?'}바이트). 더 기다리려면 다시 부르세요.`;
65
- throw new Error('진행 중이거나 최근에 시작된 다운로드가 없어요. 다운로드 버튼을 누른 뒤에 부르세요.');
64
+ return `Download not finished after ${timeoutSec}s: ${d.file} (${d.receivedBytes}/${d.totalBytes || '?'} bytes). Call again to keep waiting.`;
65
+ throw new Error('No download in progress or recently started. Call this after clicking the download button.');
66
66
  }
67
67
  await new Promise((r) => setTimeout(r, 100));
68
68
  }
@@ -78,7 +78,7 @@ export class PageSession {
78
78
  * 잠금을 잡은 프로세스가 죽으면 바로 풀린다. 다른 세션의 조작이 2분 넘게 끝나지 않으면 기다리지 않고 알린다.
79
79
  */
80
80
  exclusive(fn) {
81
- const locked = () => withFileLock(paths.tabLock(this.slot, this.targetId), fn, TAB_LOCK_WAIT_MS, '다른 Claude 세션이 이 탭을 2분 넘게 조작하고 있어요. 그 세션에 slot_send로 물어보거나 자기 탭(browser_tab_new)에서 하세요.');
81
+ const locked = () => withFileLock(paths.tabLock(this.slot, this.targetId), fn, TAB_LOCK_WAIT_MS, 'Another Claude session has been using this tab for over 2 min. Ask it via slot_send or use your own tab (browser_tab_new).');
82
82
  const run = this.chain.then(locked, locked);
83
83
  this.chain = run.then(() => undefined, () => undefined);
84
84
  return run;
@@ -288,11 +288,11 @@ export class PageSession {
288
288
  /** 붙을 때 탭이 아직 답하지 않음 (알림창이 떠 있거나 무거운 작업 중). 응답이 오면 자동으로 풀린다. */
289
289
  markUnresponsive() {
290
290
  this.pendingEnable = true;
291
- this.dialog ??= { type: '응답 대기', message: '탭이 아직 응답하지 않아요 (알림창이 떠 있거나 무거운 작업 중)', at: new Date().toISOString() };
291
+ this.dialog ??= { type: 'unresponsive', message: 'Tab not responding yet (dialog open or busy)', at: new Date().toISOString() };
292
292
  }
293
293
  /** 붙을 때 보낸 Page.enable이 나중에라도 끝나면: 탭이 다시 움직인다는 신호 */
294
294
  enabledLater() {
295
- if (this.dialog?.type === '응답 대기')
295
+ if (this.dialog?.type === 'unresponsive')
296
296
  this.dialog = undefined;
297
297
  if (this.pendingEnable) {
298
298
  this.pendingEnable = false;
@@ -301,8 +301,8 @@ export class PageSession {
301
301
  }
302
302
  assertNoDialog() {
303
303
  if (this.dialog) {
304
- throw new CdpmError(`이 탭에 ${this.dialog.type} 알림창이 떠 있어요: "${this.dialog.message}"\n` +
305
- '내용을 보고 판단해서 browser_dialog로 직접 처리하세요 (확인 accept: true, 취소 false). 사용자가 시키지 않은 되돌릴 수 없는 일(결제·삭제 등)을 확정하는 창일 때만 사용자에게 물어보세요.');
304
+ throw new CdpmError(`A ${this.dialog.type} dialog is open on this tab: "${this.dialog.message}"\n` +
305
+ 'Read it and handle it yourself with browser_dialog (accept: true = OK, false = cancel). Ask the user only if it confirms something irreversible they did not request (payment, deletion, etc.).');
306
306
  }
307
307
  }
308
308
  }
@@ -385,7 +385,7 @@ export async function browserConnection(slot) {
385
385
  return cached;
386
386
  const p = await probe(slot);
387
387
  if (p.state !== 'chrome')
388
- throw new CdpmError(`${slot}번 Chrome이 떠 있지 않습니다 (포트 ${portOf(slot)}).`);
388
+ throw new CdpmError(`Chrome is not running on slot ${slot} (port ${portOf(slot)}).`);
389
389
  const conn = await CdpConnection.connect(p.version.webSocketDebuggerUrl);
390
390
  conn.onClosed(() => browserConns.delete(slot));
391
391
  browserConns.set(slot, conn);
@@ -409,7 +409,7 @@ export async function pageSession(slot, targetId, wsUrl) {
409
409
  url = t?.webSocketDebuggerUrl;
410
410
  }
411
411
  if (!url)
412
- throw new CdpmError('탭을 찾을 수 없습니다 (닫혔을 수 있어요).');
412
+ throw new CdpmError('Tab not found (it may have been closed).');
413
413
  const conn = await CdpConnection.connect(url);
414
414
  const session = new PageSession(slot, targetId, conn);
415
415
  conn.onClosed(() => pageSessions.delete(key));
@@ -21,7 +21,7 @@ export async function probe(slot, timeoutMs = 1500) {
21
21
  return { state: 'other', detail: `HTTP ${res.status}` };
22
22
  }
23
23
  catch {
24
- return { state: 'other', detail: `HTTP ${res.status} (JSON 아님)` };
24
+ return { state: 'other', detail: `HTTP ${res.status} (not JSON)` };
25
25
  }
26
26
  }
27
27
  /** 탭(page) 목록. Chrome이 돌려주는 순서 그대로 (첫 번째가 가장 최근 활성 탭). */
@@ -41,9 +41,9 @@ export function findChromeWith(deps) {
41
41
  const found = candidates.find((p) => deps.exists(p));
42
42
  if (found)
43
43
  return found;
44
- throw new CdpmError('Chrome을 찾지 못했습니다. 찾아본 경로:\n' +
44
+ throw new CdpmError('Chrome not found. Searched:\n' +
45
45
  candidates.map((c) => ` - ${c}`).join('\n') +
46
- `\n${paths.config()} 파일에 {"chromePath": "Chrome 실행 파일 전체 경로"}를 넣어 직접 지정할 수 있어요.`);
46
+ `\nSet it manually in ${paths.config()}: {"chromePath": "<full path to Chrome executable>"}`);
47
47
  }
48
48
  function regQuery(key) {
49
49
  try {
@@ -32,7 +32,7 @@ export async function launchChrome(slot, opts = {}) {
32
32
  ({ pid } = await spawnOrphan(chrome, [...chromeArgs(slot, opts), ...extra, opts.url || 'about:blank'], { hide: false }));
33
33
  }
34
34
  catch (e) {
35
- throw new CdpmError(`Chrome 실행 실패: ${e.message}`);
35
+ throw new CdpmError(`Failed to launch Chrome: ${e.message}`);
36
36
  }
37
37
  const deadline = Date.now() + READY_TIMEOUT_MS;
38
38
  while (Date.now() < deadline) {
@@ -40,11 +40,11 @@ export async function launchChrome(slot, opts = {}) {
40
40
  if (p.state === 'chrome')
41
41
  return { pid, version: p.version };
42
42
  if (!pidAlive(pid)) {
43
- throw new CdpmError(`${slot}번 Chrome이 켜지자마자 종료됐어요. ` +
44
- `같은 프로필(${paths.profile(slot)})을 쓰는 Chrome이 디버깅 포트 없이 이미 떠 있으면, 새 Chrome은 그쪽에 창만 넘기고 끝나요. 그 창을 닫고 다시 켜 주세요.`);
43
+ throw new CdpmError(`Slot ${slot} Chrome exited right after launch. ` +
44
+ `If a Chrome using the same profile (${paths.profile(slot)}) is already running without a debugging port, the new one hands its window over and exits. Close that window and launch again.`);
45
45
  }
46
46
  await sleep(100);
47
47
  }
48
- throw new CdpmError(`${slot}번 Chrome을 실행했지만 ${READY_TIMEOUT_MS / 1000}초 안에 CDP 포트(${portOf(slot)})가 열리지 않았습니다. ` +
49
- `같은 프로필(${paths.profile(slot)})을 쓰는 Chrome이 디버깅 포트 없이 이미 떠 있을 수 있어요. 그 창을 닫고 다시 시도해 주세요.`);
48
+ throw new CdpmError(`Slot ${slot} Chrome started, but CDP port ${portOf(slot)} did not open within ${READY_TIMEOUT_MS / 1000}s. ` +
49
+ `A Chrome using the same profile (${paths.profile(slot)}) may already be running without a debugging port. Close it and try again.`);
50
50
  }
@@ -12,13 +12,13 @@ const SCHEMES = { http: 'http', https: 'https', socks: 'socks5', socks5: 'socks5
12
12
  */
13
13
  export function parseProxy(input) {
14
14
  let s = input.trim();
15
- const bad = () => new CdpmError(`프록시 주소를 알아보지 못했어요: "${maskProxyText(input)}". 예: 1.2.3.4:8080, http://아이디:비번@1.2.3.4:8080, socks5://1.2.3.4:1080, 1.2.3.4:8080:아이디:비번`);
15
+ const bad = () => new CdpmError(`Unrecognized proxy: "${maskProxyText(input)}". Examples: 1.2.3.4:8080, http://user:pass@1.2.3.4:8080, socks5://1.2.3.4:1080, 1.2.3.4:8080:user:pass`);
16
16
  let scheme = 'http';
17
17
  const m = /^([a-z0-9]+):\/\//i.exec(s);
18
18
  if (m) {
19
19
  const sc = SCHEMES[m[1].toLowerCase()];
20
20
  if (!sc)
21
- throw new CdpmError(`지원하지 않는 프록시 종류예요: ${m[1]} (http, https, socks5, socks4만 돼요)`);
21
+ throw new CdpmError(`Unsupported proxy scheme: ${m[1]} (use http, https, socks5 or socks4)`);
22
22
  scheme = sc;
23
23
  s = s.slice(m[0].length);
24
24
  }
@@ -60,7 +60,7 @@ export function parseProxy(input) {
60
60
  user = dec(user);
61
61
  pass = dec(pass);
62
62
  if (user && scheme === 'socks4')
63
- throw new CdpmError('socks4 프록시는 아이디·비밀번호를 쓸 수 없어요. socks5나 http로 주세요.');
63
+ throw new CdpmError('socks4 proxies do not support username/password. Use socks5 or http.');
64
64
  return { scheme, host: hp[1], port, ...(user ? { user, pass: pass ?? '' } : {}) };
65
65
  }
66
66
  /** 결과에 보여 줄 때: 비밀번호는 가린다. */
@@ -92,6 +92,6 @@ async function startForwarder(slot, p) {
92
92
  return Number(/LISTEN (\d+)/.exec(line ?? '')?.[1]);
93
93
  }
94
94
  catch (e) {
95
- throw new CdpmError(`프록시 중계 프로그램을 띄우지 못했어요: ${e.message}`);
95
+ throw new CdpmError(`Failed to start proxy forwarder: ${e.message}`);
96
96
  }
97
97
  }
@@ -7,23 +7,26 @@ import path from 'node:path';
7
7
  const START = '<!-- CDPM:START (cdpm setup이 관리하는 부분) -->';
8
8
  const END = '<!-- CDPM:END -->';
9
9
  export const CDPM_RULES = `${START}
10
- ## CDPM (Chrome 슬롯 MCP) 사용 규칙
10
+ ## CDPM (Chrome slot MCP) rules
11
11
 
12
- - 역할 구분 (여러 슬롯을 쓰는 작업은 사이트와 상관없이 항상):
13
- - 메인: 사용자와 대화, 슬롯 켜기·끄기, 서브에이전트에게 일 나눠 주기, 결과 합쳐서 보고. 슬롯 화면을 직접 이동·읽기·조작하지 않는다.
14
- - 서브에이전트(cdpm-browser): 맡은 슬롯 하나의 주소 이동·읽기·입력·클릭, 로그인 등 완료 감지, 자기 몫 결과물, 필요하면 다른 서브에이전트와 신호까지 전부.
15
- - 슬롯 하나로 끝나는 간단한 일은 메인이 직접 해도 된다.
16
- - 여러 CDPM 슬롯에 각각 다른 일을 시키면(예: "5개 띄워서 하나는 네이버, 하나는 유튜브…") 메인이 직접 처리하지 않는다.
17
- 1. browser_launch 한 번으로 슬롯을 모두 켠다 (slots 또는 count). 시작 페이지를 알면 url/urls로 켜면서 바로 연다. 메인은 여기까지만 하고, 주소 이동·읽기·조작은 처음부터 서브에이전트가 한다.
18
- 2. 한 메시지 안에서 Agent 도구를 슬롯 수만큼 함께 불러 서브에이전트를 한꺼번에 띄운다. 모두 run_in_background: true로 (앞 서브에이전트가 끝나길 기다리지 않게). subagent_type은 "cdpm-browser"(CDPM 전용, 빨리 시작)를 쓴다.
19
- - 지시는 1~3줄로 짧게: 슬롯 번호, agent 이름(예: "네이버담당"), 할 일만. cdpm-browser는 CDPM 사용법·규칙을 이미 알고 있으니 다시 설명하지 않는다 (긴 지시를 쓰는 시간만큼 늦어진다).
20
- - 서브에이전트는 동시에 20개까지만 뜬다. 슬롯이 20개를 넘으면 20개를 먼저 띄우고 끝나는 대로 나머지를 띄운다 (늘리려면 환경변수 CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS).
21
- 3. 결과물(보고서·HTML 조각·표 등)도 각 서브에이전트가 자기 몫을 써서 돌려주고, 메인은 합치기만 한다.
22
- - 한 에이전트는 한 슬롯만 조작한다 (CDPM이 다른 슬롯 조작을 거절한다. 다른 슬롯 화면 보기는 괜찮다).
23
- - 어느 사이트든 사용자가 로그인·본인 인증·보안문자 등을 해야 해도 "됐다고 알려 달라"고 하지 않는다. 서브에이전트를 먼저 띄워 두고 각자 화면을 건드리지 않고(새로고침 금지) browser_wait url/gone/text로 완료를 감지해 이어서 진행하게 한다.
24
- - 기다림은 최소한으로. 서브에이전트끼리 협업하면(서로 메일 주고받기 등) 일을 끝내는 즉시 slot_send로 상대에게 알리고, 상대를 기다릴 때는 slot_inbox wait로 기다리게 한다 (화면을 반복해서 새로고침하지 않는다). 서브에이전트에게 긴 고정 대기를 지시하지 않는다.
25
- - 화면이 필요하면 조작 도구에 read를 붙여 한 번에 받는다 (글은 text, 누를 게 필요하면 snapshot, 바뀐 것만 보려면 changes).
26
- - When several CDPM slots get different jobs, start one cdpm-browser subagent per slot in a single message (at most 20 at once), let each write its own part of the output, and only merge in the main agent.
12
+ - Reply to the user in the user's language.
13
+ - Roles (always, for any job using multiple slots or tabs, on any site):
14
+ - Main: talks to the user, launches/closes slots, hands work to subagents, merges and reports results. Never navigates, reads or acts on slot screens itself.
15
+ - Subagent (cdpm-browser): everything on its one slot: navigation, reading, typing, clicking, detecting login completion, its own part of the output, and signaling other subagents when needed.
16
+ - A simple job on a single slot can be done by the main agent directly.
17
+ - Windowed (visible) vs headless is the user's call: headless: true only if the user says "headless", "hidden", "no window"; false for "show the window", "headful" (in any language). If unspecified, don't guess; ask first (once for multiple slots).
18
+ - When several CDPM slots get different jobs (e.g. "open 5, one for Naver, one for YouTube...", "log in on slot 1 and open another site on slot 2"), the main agent does not do them itself.
19
+ 1. Launch all slots with one browser_launch (slots or count). If start pages are known, open them at launch with url/urls. The main agent stops there; subagents do all navigation, reading and actions from the start.
20
+ 2. In one message, call the Agent tool once per slot to start all subagents together, each with run_in_background: true (don't wait for one to finish). Use subagent_type "cdpm-browser" (CDPM-only, starts fast).
21
+ - Keep instructions to 1-3 lines: slot number, agent name (e.g. "naver"), task. cdpm-browser already knows CDPM usage and rules; don't repeat them (long instructions only add delay).
22
+ - At most 20 subagents run at once. With more than 20 slots, start 20 first and the rest as they finish (raise via env CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS).
23
+ 3. Each subagent writes and returns its own part of the output (report, HTML fragment, table, etc.); the main agent only merges.
24
+ - If tabs within one slot get different jobs (e.g. "slot 1 first tab logs in, second tab does X on another site"), assign one subagent per tab just like slots (the main agent doesn't switch tabs doing them in turn). Each uses only its assigned tab number or opens its own with browser_tab_new, with a distinct agent name per tab (e.g. "slot1-tab1"). Same slot, so the one-agent-one-slot rule doesn't apply; actions queue per tab and run concurrently. If a tab's job depends on another finishing first (e.g. needs login), the dependent owner waits with slot_inbox(wait) and the other notifies with slot_send as soon as done (login carries over to other tabs since they share the profile).
25
+ - One agent acts on one slot only (CDPM rejects actions on another slot; viewing other slots is fine).
26
+ - When the user must log in, verify identity, solve a CAPTCHA, etc. on any site, never ask them to say when done. Start the subagents first and have each detect completion with browser_wait url/gone/text without touching the screen (no reload), then continue.
27
+ - Waits that may take minutes (bulk collection/processing, waiting for user login, etc.) are not done by the main agent: hand them to a background subagent (run_in_background: true), tell the user the current status right away and keep talking. While the main agent blocks on browser_wait or a long foreground shell command, it can't answer the user.
28
+ - Keep waiting minimal. When subagents collaborate (e.g. exchanging emails), each notifies the other with slot_send as soon as its part is done and waits with slot_inbox wait (no repeated screen refreshes). Never instruct subagents to use long fixed waits.
29
+ - When you need the screen, add read to the action tool to get it in one call (text for content, snapshot when you need things to click, changes to see only what changed).
27
30
  ${END}`;
28
31
  export function claudeMdPath() {
29
32
  const dir = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude');
package/dist/cli.js CHANGED
@@ -16,7 +16,7 @@ const lazy = {
16
16
  format: () => import('./tools/format.js'),
17
17
  registry: () => import('./registry/store.js'),
18
18
  };
19
- const CLI_AGENT = '사람(CLI)';
19
+ const CLI_AGENT = 'user (CLI)';
20
20
  const HELP = `cdpm ${VERSION} - CDP Manager
21
21
 
22
22
  사용법:
package/dist/orphan.js CHANGED
@@ -36,14 +36,14 @@ export function spawnOrphan(cmd, args, opts = {}) {
36
36
  });
37
37
  let out = '';
38
38
  bridge.stdout.on('data', (d) => (out += String(d)));
39
- bridge.on('error', (e) => reject(new CdpmError(`실행하지 못했어요: ${e.message}`)));
39
+ bridge.on('error', (e) => reject(new CdpmError(`Failed to start: ${e.message}`)));
40
40
  bridge.on('exit', () => {
41
41
  const pid = Number(/PID (\d+)/.exec(out)?.[1]);
42
42
  const line = /LINE (.*)/.exec(out)?.[1];
43
43
  if (pid && (!opts.waitLine || line))
44
44
  return resolve({ pid, line });
45
- const why = /ERR (.*)/.exec(out)?.[1] ?? (/EXIT (.*)/.exec(out) ? `바로 끝났어요 (종료 코드 ${/EXIT (.*)/.exec(out)[1]})` : /TIMEOUT/.test(out) ? '준비 신호가 오지 않았어요' : out.trim());
46
- reject(new CdpmError(`실행하지 못했어요: ${why}`));
45
+ const why = /ERR (.*)/.exec(out)?.[1] ?? (/EXIT (.*)/.exec(out) ? `exited immediately (code ${/EXIT (.*)/.exec(out)[1]})` : /TIMEOUT/.test(out) ? 'no ready signal' : out.trim());
46
+ reject(new CdpmError(`Failed to start: ${why}`));
47
47
  });
48
48
  });
49
49
  }