cdpm-mcp 0.1.2 → 0.1.3

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,10 @@
3
3
  버전 번호는 `package.json`에서 관리해요. 확인: `cdpm --version` (직접 받았으면 `node dist/cli.js --version`).
4
4
  업데이트 방법은 README의 "업데이트" 항목을 보세요.
5
5
 
6
+ ## 0.1.3 (2026-10-11)
7
+
8
+ - macOS Dock 아이콘: 켜면서 시작 주소를 바로 열면 빈 탭이 없어서 디자인이 다른 예비 아이콘이 들어가던 문제를 고쳤어요. 빈 탭이 없으면 열려 있는 일반 페이지 탭에서(페이지와 분리된 실행 공간) 그리고, 그래도 못 그렸으면 다음에 붙을 때 다시 그려 바꿔요.
9
+
6
10
  ## 0.1.2 (2026-10-11)
7
11
 
8
12
  - Claude Code 전용 부분을 클라이언트에 따라 나눴어요. 연결한 클라이언트 이름이 `claude-code`일 때만 서브에이전트(Agent 도구·`cdpm-browser`) 안내를 주고 자동 설정(`~/.claude`의 상태줄·규칙·서브에이전트·권한)을 해요. Cursor·Claude Desktop 등에는 공통 안내만 주고 Claude Code 설정을 건드리지 않아요. README에 다른 클라이언트 등록 방법을 넣었어요.
@@ -52,24 +52,33 @@ export function drawScript(slot, color) {
52
52
  return btoa(bin);
53
53
  })()`;
54
54
  }
55
- /** 저장해 둔 그림, 없으면 이 슬롯의 빈 탭(about:blank)에서 그려 저장. 빈 탭이 없으면 기본 그리기. */
55
+ /**
56
+ * 저장해 둔 그림, 없으면 이 슬롯의 탭에서 Chrome 캔버스로 그려 저장 (맥 글꼴로 그려짐).
57
+ * 켜면서 시작 주소를 바로 열면 빈 탭이 없으므로, 빈 탭이 없으면 열려 있는 일반 페이지 탭에서 그린다
58
+ * (페이지와 분리된 실행 공간이라 페이지에는 영향 없음). 그래도 못 그리면 예비 그림을 주고 fallback=true.
59
+ */
56
60
  async function dockImage(slot) {
57
61
  const file = pngPath(slot);
58
62
  if (fs.existsSync(file))
59
- return fs.readFileSync(file).toString('base64');
63
+ return { b64: fs.readFileSync(file).toString('base64'), fallback: false };
60
64
  let b64;
61
- const blank = (await listPages(slot, 3000).catch(() => [])).find((p) => p.url === 'about:blank');
62
- if (blank) {
63
- const s = await pageSession(slot, blank.id).catch(() => undefined);
65
+ const pages = await listPages(slot, 3000).catch(() => []);
66
+ // 빈 탭 먼저, 없으면 일반 페이지 (chrome:// 같은 내부 페이지는 그릴 수 없음)
67
+ const candidates = [...pages.filter((p) => p.url === 'about:blank'), ...pages.filter((p) => /^(https?|file|data):/i.test(p.url))];
68
+ for (const page of candidates) {
69
+ const s = await pageSession(slot, page.id).catch(() => undefined);
64
70
  const r = await s?.evaluate(drawScript(slot, colorOf(slot)), { awaitPromise: true, timeoutMs: 5000 }).catch(() => undefined);
65
- if (typeof r?.value === 'string' && r.value.length > 100)
71
+ if (typeof r?.value === 'string' && r.value.length > 100) {
66
72
  b64 = r.value;
73
+ break;
74
+ }
67
75
  }
76
+ // 저장하지 않음: 다음에 붙을 때 다시 제대로 그린다
68
77
  if (!b64)
69
- return encodePng(renderIcon(slot, SIZE), SIZE).toString('base64'); // 저장하지 않음: 다음에 빈 탭이 있으면 제대로 그린다
78
+ return { b64: encodePng(renderIcon(slot, SIZE), SIZE).toString('base64'), fallback: true };
70
79
  fs.mkdirSync(path.dirname(file), { recursive: true });
71
80
  fs.writeFileSync(file, Buffer.from(b64, 'base64'));
72
- return b64;
81
+ return { b64, fallback: false };
73
82
  }
74
83
  /** 이 프로세스가 이미 아이콘을 넣은 Chrome (슬롯:PID) */
75
84
  const applied = new Set();
@@ -81,12 +90,14 @@ export async function applyDock(slot, pid) {
81
90
  if (applied.has(key))
82
91
  return;
83
92
  try {
84
- const image = await dockImage(slot);
93
+ const { b64: image, fallback } = await dockImage(slot);
85
94
  const conn = await browserConnection(slot);
86
95
  await conn.send('Browser.setDockTile', { image }, 5000);
87
96
  if (applied.size > 200)
88
97
  applied.clear(); // 끝난 Chrome(pid)의 기록이 쌓이지 않게
89
- applied.add(key);
98
+ // 예비 그림이면 기록하지 않는다: 다음에 붙을 때 다시 제대로 그려 바꾼다
99
+ if (!fallback)
100
+ applied.add(key);
90
101
  }
91
102
  catch {
92
103
  // 다음에 붙을 때 다시 시도
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdpm-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "CDP Manager - an MCP server that runs Chrome slots 1-30 over CDP so multiple Claude agents can share and drive them by number",
5
5
  "type": "module",
6
6
  "bin": {