claude-chrome-android 1.2.2 → 1.3.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.
package/README.md CHANGED
@@ -66,6 +66,31 @@ The bridge serves the CRX at `http://127.0.0.1:18963/ext/crx` — open this URL
66
66
  |----------|---------|-------------|
67
67
  | `BRIDGE_PORT` | `18963` | WebSocket/HTTP server port |
68
68
  | `BRIDGE_URL` | `http://127.0.0.1:18963` | Bridge URL for MCP relay |
69
+ | `BRIDGE_TOKEN` | *(empty)* | Optional shared secret for auth |
70
+ | `BRIDGE_LOG_LEVEL` | `info` | debug, info, warn, error |
71
+ | `CDP_PORT` | `9223` | ADB forward port for Chrome DevTools Protocol |
72
+
73
+ ## Changelog
74
+
75
+ ### 1.2.2
76
+
77
+ - Fix CDP pending commands hanging on WebSocket close (reject immediately)
78
+ - Fix unhandled rejection in native host stdout/stderr readers
79
+ - Add `typeof data.id === "number"` guard for CDP message handler
80
+ - Add `MAX_PENDING_PORT_REQUESTS` (100) size cap in extension
81
+ - Add 60s max recording duration for GIF creator
82
+ - Add WeakMap reverse index for O(1) element ref lookup in content script
83
+ - Bump extension to v1.9.1
84
+
85
+ ### 1.2.1
86
+
87
+ - Fix watchdog socket deletion cascade
88
+ - Tighten path traversal check, fix FD leak
89
+ - Validate JS runtime before launching in url-opener
90
+
91
+ ### 1.1.0
92
+
93
+ - Initial npm release with MCP server, FIFO queue, multi-session support
69
94
 
70
95
  ## License
71
96
 
Binary file
package/dist/cli.js CHANGED
@@ -5361,6 +5361,42 @@ var init_claude_chrome_bridge = __esm({
5361
5361
  targets: this.cachedTargets.filter((t) => t.type === "page").length
5362
5362
  };
5363
5363
  }
5364
+ /**
5365
+ * Send Memory.simulatePressureNotification to all page renderers to force GC
5366
+ * and release cached resources. Called after tab close or on demand via /memory-pressure.
5367
+ * Uses "moderate" level to trigger GC without killing renderers.
5368
+ */
5369
+ async simulateMemoryPressure() {
5370
+ if (!this.isAvailable()) return { targeted: 0, errors: 0 };
5371
+ await this.refreshTargets();
5372
+ const pages = this.cachedTargets.filter((t) => t.type === "page");
5373
+ let targeted = 0;
5374
+ let errors = 0;
5375
+ for (const page of pages) {
5376
+ try {
5377
+ let sessionId = this.sessionMap.get(page.targetId);
5378
+ if (!sessionId) {
5379
+ const attach = await this.sendCommand("Target.attachToTarget", {
5380
+ targetId: page.targetId,
5381
+ flatten: true
5382
+ });
5383
+ sessionId = attach.sessionId;
5384
+ this.sessionMap.set(page.targetId, sessionId);
5385
+ }
5386
+ await this.sendCommand("Memory.simulatePressureNotification", {
5387
+ level: "moderate"
5388
+ }, sessionId);
5389
+ targeted++;
5390
+ } catch (err) {
5391
+ log("debug", `CDP: memory pressure failed for ${page.url} \u2014 ${err.message}`);
5392
+ errors++;
5393
+ }
5394
+ }
5395
+ if (targeted > 0) {
5396
+ log("info", `CDP: sent memory pressure to ${targeted} page renderer(s)`);
5397
+ }
5398
+ return { targeted, errors };
5399
+ }
5364
5400
  /** Schedule exponential backoff reconnect: 2s, 4s, 8s, 16s, max 30s */
5365
5401
  scheduleExpBackoff() {
5366
5402
  if (this.backoffTimer) return;
@@ -5530,6 +5566,13 @@ var init_claude_chrome_bridge = __esm({
5530
5566
  { headers: { "Content-Type": "application/json" } }
5531
5567
  );
5532
5568
  }
5569
+ if (url.pathname === "/memory-pressure" && req.method === "POST") {
5570
+ const result = await cdpManager.simulateMemoryPressure();
5571
+ return new Response(
5572
+ JSON.stringify(result),
5573
+ { headers: { "Content-Type": "application/json" } }
5574
+ );
5575
+ }
5533
5576
  if (url.pathname === "/gif" && req.method === "POST") {
5534
5577
  try {
5535
5578
  const body = await req.json();
@@ -5758,6 +5801,10 @@ var init_claude_chrome_bridge = __esm({
5758
5801
  ws.send(JSON.stringify({ type: "pong" }));
5759
5802
  return;
5760
5803
  }
5804
+ if (parsed.type === "tab_removed") {
5805
+ log("info", `Tab ${parsed.tabId} removed (mcp=${parsed.wasMcpTab}), scheduling memory pressure`);
5806
+ setTimeout(() => cdpManager.simulateMemoryPressure(), 2e3);
5807
+ }
5761
5808
  if (parsed.type === "tool_response" && parsed.result?.result?.tabs) {
5762
5809
  const tabs = parsed.result.result.tabs;
5763
5810
  log("debug", `CDP: caching ${tabs.length} tab URLs from tabs_context_mcp`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-chrome-android",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Claude Code Browser Bridge for Android — connects Claude Code CLI to Chrome/Edge via WebSocket",
5
5
  "author": "willstone",
6
6
  "license": "MIT",
@@ -16,7 +16,8 @@
16
16
  "README.md"
17
17
  ],
18
18
  "scripts": {
19
- "build": "node build.cjs"
19
+ "build": "node build.cjs",
20
+ "pub": "bash publish.sh"
20
21
  },
21
22
  "devDependencies": {
22
23
  "esbuild": "^0.24.0",