clawdex-mobile 5.0.5 → 5.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawdex-mobile",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "Private-network mobile bridge and CLI for Codex and OpenCode",
5
5
  "keywords": [
6
6
  "codex",
@@ -74,6 +74,65 @@ function bridgeLogFile(rootDir) {
74
74
  return path.join(rootDir, ".bridge.log");
75
75
  }
76
76
 
77
+ function extractLatestPairingQrBlock(logContents) {
78
+ const lines = logContents.split(/\r?\n/);
79
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
80
+ const line = lines[index];
81
+ if (line.includes("Bridge pairing QR (scan from mobile onboarding):")) {
82
+ const endIndex = lines.findIndex(
83
+ (entry, offset) =>
84
+ offset > index && entry.includes("QR contains bridge URL + token for one-tap onboarding.")
85
+ );
86
+ if (endIndex !== -1) {
87
+ return lines.slice(index, endIndex + 1).join("\n").trimEnd();
88
+ }
89
+ }
90
+
91
+ if (line.includes("Bridge token QR fallback (scan from mobile onboarding):")) {
92
+ const endIndex = lines.findIndex(
93
+ (entry, offset) =>
94
+ offset > index &&
95
+ entry.includes("Full pairing QR unavailable because BRIDGE_HOST=")
96
+ );
97
+ if (endIndex !== -1) {
98
+ return lines.slice(index, endIndex + 1).join("\n").trimEnd();
99
+ }
100
+ }
101
+ }
102
+
103
+ return null;
104
+ }
105
+
106
+ function printLatestPairingQr(logPath, startOffset = 0) {
107
+ try {
108
+ const raw = fs.readFileSync(logPath, "utf8");
109
+ const contents = startOffset > 0 ? raw.slice(startOffset) : raw;
110
+ const qrBlock = extractLatestPairingQrBlock(contents);
111
+ if (!qrBlock) {
112
+ return false;
113
+ }
114
+ console.log("");
115
+ console.log(qrBlock);
116
+ console.log("");
117
+ return true;
118
+ } catch {
119
+ return false;
120
+ }
121
+ }
122
+
123
+ async function waitForLatestPairingQr(logPath, startOffset, timeoutMs = 4000) {
124
+ const startedAt = Date.now();
125
+
126
+ while (Date.now() - startedAt < timeoutMs) {
127
+ if (printLatestPairingQr(logPath, startOffset)) {
128
+ return true;
129
+ }
130
+ await sleep(250);
131
+ }
132
+
133
+ return false;
134
+ }
135
+
77
136
  function readPidFile(rootDir) {
78
137
  try {
79
138
  const raw = fs.readFileSync(bridgePidFile(rootDir), "utf8").trim();
@@ -259,6 +318,7 @@ async function spawnDetachedAndWait(command, args, options) {
259
318
  console.log(`Bridge already running (pid ${existingPid}).`);
260
319
  console.log(`Logs: ${logPath}`);
261
320
  console.log(`Bridge is healthy at http://${formatHostForUrl(host)}:${port}`);
321
+ printLatestPairingQr(logPath);
262
322
  return;
263
323
  }
264
324
  } else if (existingPid) {
@@ -274,6 +334,7 @@ async function spawnDetachedAndWait(command, args, options) {
274
334
 
275
335
  const output = fs.openSync(logPath, "a");
276
336
  const error = fs.openSync(logPath, "a");
337
+ const logStartOffset = fs.existsSync(logPath) ? fs.statSync(logPath).size : 0;
277
338
 
278
339
  const child = spawn(command, args, {
279
340
  cwd,
@@ -302,6 +363,9 @@ async function spawnDetachedAndWait(command, args, options) {
302
363
  try {
303
364
  const endpoint = await waitForHealth(env, child.pid, healthTimeoutMs);
304
365
  console.log(`Bridge is healthy at http://${formatHostForUrl(endpoint.host)}:${endpoint.port}`);
366
+ if (!(await waitForLatestPairingQr(logPath, logStartOffset))) {
367
+ console.log("Pairing QR not found in the new bridge startup log. Open logs if you need to inspect startup output.");
368
+ }
305
369
  } catch (error) {
306
370
  removePidFile(rootDir);
307
371
  console.error(`error: ${error.message}. Check logs: ${logPath}`);
@@ -149,7 +149,7 @@ dependencies = [
149
149
 
150
150
  [[package]]
151
151
  name = "codex-rust-bridge"
152
- version = "5.0.5"
152
+ version = "5.0.6"
153
153
  dependencies = [
154
154
  "axum",
155
155
  "base64",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "codex-rust-bridge"
3
- version = "5.0.5"
3
+ version = "5.0.6"
4
4
  edition = "2021"
5
5
 
6
6
  [dependencies]