claude-chrome-android 1.7.0 → 1.7.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Will Stone
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.md CHANGED
@@ -189,6 +189,13 @@ and the last reason).
189
189
 
190
190
  ## Changelog
191
191
 
192
+ ### 1.7.1
193
+
194
+ - After waking a tab or taking a screenshot, the bridge brings back the task that was in front through its root package's launcher intent. Starting the focused activity by component left Edge on top of apps that run inside another app's task, such as a Chrome web app
195
+ - Bundles `ws` 8.23.0 (fixes GHSA-96hv-2xvq-fx4p memory-exhaustion DoS and GHSA-58qx-3vcg-4xpx uninitialised-memory disclosure in the bridge's WebSocket server); builds with esbuild 0.28; drops the unused `@anthropic-ai/claude-code` dev dependency
196
+ - The package now ships its MIT `LICENSE`
197
+ - Extension 1.13.1: the CRX contains only the files Edge loads (no store listing, privacy or tester notes); built with crx3 2.0
198
+
192
199
  ### 1.7.0
193
200
 
194
201
  - Tools work while Edge is not the foreground app: Edge's renderer processes are exempted from Android's cached-apps freezer; tabs Edge froze itself are detected and woken (screen on, unlocked, no call; refocuses the previous app), or fail in ~2 s with the reason (`BRIDGE_WAKE_FROZEN_TABS=0`)
Binary file
package/dist/cli.js CHANGED
@@ -6,11 +6,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esm = (fn, res) => function __init() {
10
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ var __esm = (fn, res, err) => function __init() {
10
+ if (err) throw err[0];
11
+ try {
12
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ } catch (e) {
14
+ throw err = [e], e;
15
+ }
11
16
  };
12
17
  var __commonJS = (cb, mod) => function __require() {
13
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ try {
19
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
20
+ } catch (e) {
21
+ throw mod = 0, e;
22
+ }
14
23
  };
15
24
  var __export = (target, all) => {
16
25
  for (var name in all)
@@ -57,10 +66,10 @@ var require_constants = __commonJS({
57
66
  EMPTY_BUFFER: Buffer.alloc(0),
58
67
  GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
59
68
  hasBlob,
60
- kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
61
- kListener: Symbol("kListener"),
62
- kStatusCode: Symbol("status-code"),
63
- kWebSocket: Symbol("websocket"),
69
+ kForOnEventAttribute: /* @__PURE__ */ Symbol("kIsForOnEventAttribute"),
70
+ kListener: /* @__PURE__ */ Symbol("kListener"),
71
+ kStatusCode: /* @__PURE__ */ Symbol("status-code"),
72
+ kWebSocket: /* @__PURE__ */ Symbol("websocket"),
64
73
  NOOP: () => {
65
74
  }
66
75
  };
@@ -158,8 +167,8 @@ var require_limiter = __commonJS({
158
167
  "node_modules/ws/lib/limiter.js"(exports2, module2) {
159
168
  "use strict";
160
169
  init_import_meta_shim();
161
- var kDone = Symbol("kDone");
162
- var kRun = Symbol("kRun");
170
+ var kDone = /* @__PURE__ */ Symbol("kDone");
171
+ var kRun = /* @__PURE__ */ Symbol("kRun");
163
172
  var Limiter = class {
164
173
  /**
165
174
  * Creates a new `Limiter`.
@@ -215,11 +224,11 @@ var require_permessage_deflate = __commonJS({
215
224
  var { kStatusCode } = require_constants();
216
225
  var FastBuffer = Buffer[Symbol.species];
217
226
  var TRAILER = Buffer.from([0, 0, 255, 255]);
218
- var kPerMessageDeflate = Symbol("permessage-deflate");
219
- var kTotalLength = Symbol("total-length");
220
- var kCallback = Symbol("callback");
221
- var kBuffers = Symbol("buffers");
222
- var kError = Symbol("error");
227
+ var kPerMessageDeflate = /* @__PURE__ */ Symbol("permessage-deflate");
228
+ var kTotalLength = /* @__PURE__ */ Symbol("total-length");
229
+ var kCallback = /* @__PURE__ */ Symbol("callback");
230
+ var kBuffers = /* @__PURE__ */ Symbol("buffers");
231
+ var kError = /* @__PURE__ */ Symbol("error");
223
232
  var zlibLimiter;
224
233
  var PerMessageDeflate2 = class {
225
234
  /**
@@ -1429,7 +1438,7 @@ var require_sender = __commonJS({
1429
1438
  var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
1430
1439
  var { isBlob, isValidStatusCode } = require_validation();
1431
1440
  var { mask: applyMask, toBuffer } = require_buffer_util();
1432
- var kByteLength = Symbol("kByteLength");
1441
+ var kByteLength = /* @__PURE__ */ Symbol("kByteLength");
1433
1442
  var maskBuffer = Buffer.alloc(4);
1434
1443
  var RANDOM_POOL_SIZE = 8 * 1024;
1435
1444
  var randomPool;
@@ -1918,14 +1927,14 @@ var require_event_target = __commonJS({
1918
1927
  "use strict";
1919
1928
  init_import_meta_shim();
1920
1929
  var { kForOnEventAttribute, kListener } = require_constants();
1921
- var kCode = Symbol("kCode");
1922
- var kData = Symbol("kData");
1923
- var kError = Symbol("kError");
1924
- var kMessage = Symbol("kMessage");
1925
- var kReason = Symbol("kReason");
1926
- var kTarget = Symbol("kTarget");
1927
- var kType = Symbol("kType");
1928
- var kWasClean = Symbol("kWasClean");
1930
+ var kCode = /* @__PURE__ */ Symbol("kCode");
1931
+ var kData = /* @__PURE__ */ Symbol("kData");
1932
+ var kError = /* @__PURE__ */ Symbol("kError");
1933
+ var kMessage = /* @__PURE__ */ Symbol("kMessage");
1934
+ var kReason = /* @__PURE__ */ Symbol("kReason");
1935
+ var kTarget = /* @__PURE__ */ Symbol("kTarget");
1936
+ var kType = /* @__PURE__ */ Symbol("kType");
1937
+ var kWasClean = /* @__PURE__ */ Symbol("kWasClean");
1929
1938
  var Event = class {
1930
1939
  /**
1931
1940
  * Create a new `Event`.
@@ -2330,7 +2339,7 @@ var require_websocket = __commonJS({
2330
2339
  } = require_event_target();
2331
2340
  var { format, parse } = require_extension();
2332
2341
  var { toBuffer } = require_buffer_util();
2333
- var kAborted = Symbol("kAborted");
2342
+ var kAborted = /* @__PURE__ */ Symbol("kAborted");
2334
2343
  var protocolVersions = [8, 13];
2335
2344
  var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
2336
2345
  var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
@@ -5512,7 +5521,7 @@ var init_claude_chrome_bridge = __esm({
5512
5521
  }
5513
5522
  shot = await this.sendCommand("Page.captureScreenshot", { format: "png" }, sessionId);
5514
5523
  } finally {
5515
- this.refocus(before.focus, "captured screenshot");
5524
+ this.refocus(before, "captured screenshot");
5516
5525
  }
5517
5526
  if (shot?.data) {
5518
5527
  log("info", `CDP: Page.captureScreenshot captured ~${Math.round(shot.data.length * 3 / 4)} bytes`);
@@ -5740,29 +5749,65 @@ var init_claude_chrome_bridge = __esm({
5740
5749
  lastWakeAt = 0;
5741
5750
  wakeInFlight = null;
5742
5751
  /**
5743
- * One adb call for everything a wake decision needs: whether the screen is
5744
- * on, whether the keyguard (lock screen) is showing, whether a phone call is
5745
- * active, and the focused activity ("pkg/cls", or null for system windows
5746
- * such as the notification shade).
5752
+ * Everything a wake decision needs, in two small adb calls: whether the
5753
+ * screen is on, whether the keyguard (lock screen) is showing, whether a
5754
+ * phone call is active, and what to bring back afterwards. `focus` is the
5755
+ * focused activity ("pkg/cls", or null for system windows such as the
5756
+ * notification shade); `taskPackage` is the package at the ROOT of the top
5757
+ * task. They differ for activities that run inside another app's task, e.g.
5758
+ * a Chrome web app (focus com.android.chrome/...SameTaskWebApkActivity,
5759
+ * root org.chromium.webapk.<id>): starting such an activity by component
5760
+ * does not bring the task back, while the root package's launcher intent
5761
+ * resumes the existing task.
5747
5762
  */
5748
5763
  readDeviceState() {
5749
- const out = runSync(adb(
5750
- "shell",
5751
- "dumpsys power | grep -m1 mWakefulness=; dumpsys window | grep -E -m2 'mCurrentFocus|isKeyguardShowing'; dumpsys telephony.registry | grep -m1 mCallState"
5752
- ), { timeoutMs: 4e3 }).stdout.toString();
5764
+ const out = runSync(
5765
+ adb(
5766
+ "shell",
5767
+ "dumpsys power | grep -m1 mWakefulness=; dumpsys window | grep -E -m2 'mCurrentFocus|isKeyguardShowing'; dumpsys telephony.registry | grep -m1 mCallState; dumpsys activity activities | grep -m1 topResumedActivity"
5768
+ ),
5769
+ { timeoutMs: 4e3 }
5770
+ ).stdout.toString();
5753
5771
  const focusLine = out.split("\n").find((l) => l.includes("mCurrentFocus")) ?? "";
5772
+ const taskId = /topResumedActivity=.*\st(\d+)\}/.exec(out)?.[1] ?? null;
5773
+ let taskPackage = null;
5774
+ if (taskId) {
5775
+ const recents = runSync(
5776
+ adb("shell", "dumpsys activity recents | grep -E 'Recent #|^ intent='"),
5777
+ { timeoutMs: 4e3 }
5778
+ ).stdout.toString().split("\n");
5779
+ const header = recents.findIndex((l) => l.includes(` #${taskId} `));
5780
+ const intentLine = header >= 0 ? recents[header + 1] ?? "" : "";
5781
+ taskPackage = /cmp=([^/\s}]+)\//.exec(intentLine)?.[1] ?? null;
5782
+ }
5754
5783
  return {
5755
5784
  awake: /mWakefulness=Awake/.test(out),
5756
5785
  keyguard: /isKeyguardShowing=true/.test(out),
5757
5786
  inCall: /mCallState=[12]\b/.test(out),
5758
- focus: /\s(\S+\/\S+)\}/.exec(focusLine)?.[1] ?? null
5787
+ focus: /\s(\S+\/\S+)\}/.exec(focusLine)?.[1] ?? null,
5788
+ taskPackage
5759
5789
  };
5760
5790
  }
5761
- /** Start the previously focused activity again after Edge was brought forward. */
5791
+ /**
5792
+ * Bring back what was in front before Edge was brought forward: relaunch the
5793
+ * top task's root package through its launcher intent (resumes the task as
5794
+ * it was), falling back to starting the focused activity by component.
5795
+ */
5762
5796
  refocus(previous, why) {
5763
- if (!previous || previous.startsWith("com.microsoft.emmx.canary/")) return;
5764
- runSync(adb("shell", "am", "start", "-n", previous), { timeoutMs: 5e3 });
5765
- log("info", `CDP: ${why}; refocused ${previous}`);
5797
+ const edge = "com.microsoft.emmx.canary";
5798
+ if (previous.taskPackage && previous.taskPackage !== edge) {
5799
+ const launch = runSync(
5800
+ adb("shell", "monkey", "-p", previous.taskPackage, "-c", "android.intent.category.LAUNCHER", "1"),
5801
+ { timeoutMs: 8e3 }
5802
+ );
5803
+ if (launch.exitCode === 0 && !/No activities found|aborted/i.test(launch.stdout.toString())) {
5804
+ log("info", `CDP: ${why}; resumed task of ${previous.taskPackage}`);
5805
+ return;
5806
+ }
5807
+ }
5808
+ if (!previous.focus || previous.focus.startsWith(`${edge}/`)) return;
5809
+ runSync(adb("shell", "am", "start", "-n", previous.focus), { timeoutMs: 5e3 });
5810
+ log("info", `CDP: ${why}; refocused ${previous.focus}`);
5766
5811
  }
5767
5812
  /**
5768
5813
  * Wake a frozen tab: Page.bringToFront makes it visible (Chromium resumes
@@ -5793,7 +5838,7 @@ var init_claude_chrome_bridge = __esm({
5793
5838
  } catch {
5794
5839
  return false;
5795
5840
  } finally {
5796
- this.refocus(state.focus, `woke frozen tab ${tabId ?? "active"}`);
5841
+ this.refocus(state, `woke frozen tab ${tabId ?? "active"}`);
5797
5842
  }
5798
5843
  })();
5799
5844
  try {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "Claude Code Browser Bridge",
4
- "version": "1.13.0",
4
+ "version": "1.13.1",
5
5
  "description": "Bridges Claude Code CLI to Edge Android via WebSocket",
6
6
  "permissions": [
7
7
  "activeTab",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "claude-chrome-android",
3
- "version": "1.7.0",
4
- "description": "Claude Code Browser Bridge for Android \u2014 connects Claude Code CLI to Chrome/Edge via WebSocket",
3
+ "version": "1.7.1",
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",
7
7
  "repository": {
@@ -23,13 +23,12 @@
23
23
  "typecheck": "tsc --noEmit -p tsconfig.json"
24
24
  },
25
25
  "devDependencies": {
26
- "@anthropic-ai/claude-code": "*",
27
- "@types/bun": "1.4.3",
28
- "@types/node": "26.6.5",
26
+ "@types/bun": "1.4.5",
27
+ "@types/node": "26.6.11",
29
28
  "@types/ws": "8.18.2",
30
- "esbuild": "^0.24.0",
29
+ "esbuild": "^0.28.2",
31
30
  "typescript": "^5.9.3",
32
- "ws": "^8.18.0"
31
+ "ws": "^8.23.0"
33
32
  },
34
33
  "keywords": [
35
34
  "claude",