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.
- package/lib/bridge.js +9 -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
|
-
//
|
|
166
|
-
|
|
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