@codingfrees/uap-device-control 0.1.18 → 0.1.19

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
@@ -30,7 +30,9 @@ npx @codingfrees/uap-device-control@latest remote
30
30
 
31
31
  The interactive CLI uses concise human-readable status lines by default (`✅`, `❌`, `⚠️`, `🔐`, `🌐`, `🔌`, `🔧`). Use `--json` for stable JSONL output in scripts and log collectors. Only one `remote` process may use a state directory at a time; starting a second process with the same device identity fails locally instead of replacing the live broker session. OAuth refresh is serialized across processes, and access-token renewal is retried in the existing broker session rather than forcing a device reconnect.
32
32
 
33
- By default the Remote process also starts the loopback-only semantic browser bridge on port `8800`. Until the UAP Browser Extension is paired, the CLI prints a short-lived pairing code. Browser control can be disabled with `--no-browser-control` or moved to another loopback port with `--browser-port <port>`.
33
+ By default the Remote process also starts the loopback-only semantic browser bridge on port `18700`. Until the UAP Browser Extension is paired, the CLI prints a short-lived pairing code. Browser control can be disabled with `--no-browser-control` or moved to another loopback port with `--browser-port <port>`.
34
+
35
+ Existing extensions paired on the former port `8800` retain that port in browser storage. After updating npm Remote and Browser Extension, open **Device Control · Browser** in extension Settings and use **Reconnect browser bridge** with port `18700` (or the CLI-reported port). This moves the existing pairing after an explicit user action, rather than silently sending the saved bearer to a new local port or resetting device credentials. Use `browser-reset` only if pairing authority was lost or the extension was replaced.
34
36
 
35
37
  If a browser extension was replaced or lost its local token, stop `remote`, run `npx @codingfrees/uap-device-control@latest browser-reset`, then start `remote` again. This resets only the browser pairing and preserves the device identity and login.
36
38
 
@@ -377,7 +377,7 @@ async function resetBrowserBridgePairing(stateDirectory) {
377
377
  await mkdir2(stateDirectory, { recursive: true, mode: 448 });
378
378
  await writeFile2(path2.join(stateDirectory, "browser-bridge.json"), JSON.stringify({ version: 1 }) + "\n", { mode: 384 });
379
379
  }
380
- async function createBrowserBridge(stateDirectory, requestedPort = 8800, log) {
380
+ async function createBrowserBridge(stateDirectory, requestedPort = 18700, log) {
381
381
  if (!Number.isInteger(requestedPort) || requestedPort !== 0 && (requestedPort < 1024 || requestedPort > 65535)) throw new TypeError("browser bridge port is invalid");
382
382
  await mkdir2(stateDirectory, { recursive: true, mode: 448 });
383
383
  const statePath = path2.join(stateDirectory, "browser-bridge.json");
@@ -615,7 +615,7 @@ import path4 from "node:path";
615
615
  // package.json
616
616
  var package_default = {
617
617
  name: "@codingfrees/uap-device-control",
618
- version: "0.1.18",
618
+ version: "0.1.19",
619
619
  description: "Cross-platform outbound UAP Device Control client",
620
620
  type: "module",
621
621
  bin: {
@@ -1714,9 +1714,10 @@ async function runRemote(options) {
1714
1714
  options.log?.(event);
1715
1715
  if (event.event === "browser.bridge" && ["paired", "unpaired", "connected", "permissions-granted", "permissions-required"].includes(String(event.status))) refreshSession();
1716
1716
  };
1717
- const browser = options.browserControl === false ? void 0 : await createBrowserBridge(options.stateDirectory, options.browserPort ?? 8800, browserLog).catch((error) => {
1717
+ const browserPort = options.browserPort ?? 18700;
1718
+ const browser = options.browserControl === false ? void 0 : await createBrowserBridge(options.stateDirectory, browserPort, browserLog).catch((error) => {
1718
1719
  if (!optionalBrowserBridgeFailure(error)) throw error;
1719
- options.log?.({ event: "browser.bridge", status: "unavailable" });
1720
+ options.log?.({ event: "browser.bridge", status: "unavailable", port: browserPort, errorCode: String(error.code) });
1720
1721
  return void 0;
1721
1722
  });
1722
1723
  if (browser) {
@@ -2068,7 +2069,7 @@ function parseDeviceControlArguments(args, cwd = process.cwd()) {
2068
2069
  const allowedServices = [];
2069
2070
  let service = false;
2070
2071
  let browserControl = true;
2071
- let browserPort = 8800;
2072
+ let browserPort = 18700;
2072
2073
  let json2 = false;
2073
2074
  for (let index = command === "help" ? args.length : 1; index < args.length; index++) {
2074
2075
  const option = args[index];
@@ -2184,7 +2185,13 @@ function formatCliEvent(event, json2 = false) {
2184
2185
  if (status === "ready")
2185
2186
  return "\u{1F310} Browser bridge ready \xB7 127.0.0.1:" + String(event.port) + (event.pairingStored ? " \xB7 pairing saved \xB7 extension offline; new extension? stop Remote, then run: npx @codingfrees/uap-device-control@latest browser-reset" : " \xB7 waiting for pairing");
2186
2187
  if (status === "pairing-required") return "\u26A0\uFE0F Browser extension not connected; remote control continues without browser tools \xB7 pairing code " + String(event.pairingCode) + " \xB7 port " + String(event.port);
2187
- if (status === "unavailable") return "\u26A0\uFE0F Browser control unavailable; remote control continues with files, terminal and processes";
2188
+ if (status === "unavailable") {
2189
+ const code = ["EADDRINUSE", "EACCES", "EAFNOSUPPORT", "EPROTONOSUPPORT"].includes(String(event.errorCode)) ? String(event.errorCode) : "UNKNOWN";
2190
+ const port2 = Number.isInteger(event.port) && Number(event.port) >= 1024 && Number(event.port) <= 65535 ? Number(event.port) : 18700;
2191
+ const alternate = port2 === 65535 ? 8801 : port2 + 1;
2192
+ const help = code === "EADDRINUSE" ? "port already in use; inspect the listener or retry remote --browser-port " + alternate : code === "EACCES" ? "local port access denied; check reserved ports or retry remote --browser-port " + alternate : code === "EAFNOSUPPORT" || code === "EPROTONOSUPPORT" ? "local TCP/IPv4 networking unavailable; check OS networking" : "local bridge could not start";
2193
+ return "\u26A0\uFE0F Browser control unavailable \xB7 port " + port2 + " \xB7 " + code + " \xB7 " + help + "; files, terminal and processes remain available";
2194
+ }
2188
2195
  if (status === "paired") return "\u2705 UAP Browser Extension paired";
2189
2196
  if (status === "connected") return "\u{1F310} UAP Browser Extension connected";
2190
2197
  if (status === "unpaired") return "\u{1F50C} UAP Browser Extension unpaired";
@@ -2240,7 +2247,7 @@ Remote options:
2240
2247
  --read-only-root <id=path> Add a read-only filesystem root
2241
2248
  --allow-executable <path> Allow an executable for terminal commands
2242
2249
  --allow-service <name> Allow a native service
2243
- --browser-port <port> Browser extension bridge port (default: 8800)
2250
+ --browser-port <port> Browser extension bridge port (default: 18700)
2244
2251
  --no-browser-control Run without browser integration
2245
2252
  --state-dir <path> Override the local state directory
2246
2253
  --origin <https-origin> Override the Device Control service origin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingfrees/uap-device-control",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Cross-platform outbound UAP Device Control client",
5
5
  "type": "module",
6
6
  "bin": {