claude-bridge-cli 1.2.7 → 1.2.8

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.
Files changed (2) hide show
  1. package/lib/bridge.js +9 -2
  2. package/package.json +1 -1
package/lib/bridge.js CHANGED
@@ -162,8 +162,15 @@ function parseSessionFile(filePath) {
162
162
  } catch {}
163
163
  }
164
164
  }
165
- // Rough message count: assume ~500 bytes/line average for big files.
166
- msgCount = Math.max(1, Math.floor(stat.size / 500));
165
+ // Count newlines accurately by streaming chunks.
166
+ const COUNT_BUF = Buffer.alloc(64 * 1024);
167
+ let pos = 0;
168
+ while (pos < stat.size) {
169
+ const got = fs.readSync(fd, COUNT_BUF, 0, COUNT_BUF.length, pos);
170
+ if (got <= 0) break;
171
+ for (let i = 0; i < got; i++) if (COUNT_BUF[i] === 0x0A) msgCount++;
172
+ pos += got;
173
+ }
167
174
  } finally {
168
175
  fs.closeSync(fd);
169
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-bridge-cli",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Use Claude Code from your browser. Runs a local server that connects your browser tools to the Claude CLI.",
5
5
  "main": "lib/bridge.js",
6
6
  "bin": {