@usagefleet/cli 1.2.120 → 1.2.121
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/dist/release.js +1 -1
- package/dist/service.js +3 -1
- package/dist/tailer.js +10 -3
- package/package.json +1 -1
package/dist/release.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by .github/workflows/release.yml.
|
|
2
|
-
export const RELEASE_VERSION = "1.2.
|
|
2
|
+
export const RELEASE_VERSION = "1.2.121";
|
package/dist/service.js
CHANGED
|
@@ -115,7 +115,9 @@ function programArgs() {
|
|
|
115
115
|
// re-invokable script, so the service launches the executable itself.
|
|
116
116
|
return [process.execPath, 'watch'];
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
// V8's default young generation kept the idle daemon at ~66 MB footprint; 1 MB semi-spaces
|
|
119
|
+
// hold it at ~34 MB for the same CPU. Only works as a launch flag, and bun ignores it.
|
|
120
|
+
return [stableNodePath(process.execPath), '--max-semi-space-size=1', script, 'watch'];
|
|
119
121
|
}
|
|
120
122
|
function macPlistPath() {
|
|
121
123
|
return join(homedir(), 'Library', 'LaunchAgents', `${LABEL}.plist`);
|
package/dist/tailer.js
CHANGED
|
@@ -3,6 +3,8 @@ import { parseLine } from './parser.js';
|
|
|
3
3
|
import { dim, line, tilde, yellow } from './ui.js';
|
|
4
4
|
/** Max bytes read from a single file per cycle (bounds memory on huge backlogs). */
|
|
5
5
|
const MAX_READ = 16 * 1024 * 1024;
|
|
6
|
+
// Both parsers need a `usage` object, and about 3/4 of log bytes are lines without one.
|
|
7
|
+
const USAGE_KEY = Buffer.from('"usage"');
|
|
6
8
|
/**
|
|
7
9
|
* The working directory of a pi session, read from the file's first line
|
|
8
10
|
* (`{"type":"session",…,"cwd":"/path"}`). pi's message lines carry no cwd, and
|
|
@@ -74,13 +76,18 @@ export function tailFile(filePath, prev, source = 'cli') {
|
|
|
74
76
|
return { consumedBytes: 0, nextState: base, records: [] };
|
|
75
77
|
}
|
|
76
78
|
const consumed = buf.subarray(0, lastNl + 1);
|
|
77
|
-
|
|
79
|
+
// Decode only the lines that can hold usage: decoding and splitting the whole
|
|
80
|
+
// 16 MB read peaked a first-run backlog at ~490 MB RSS.
|
|
78
81
|
const records = [];
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
let at = consumed.indexOf(USAGE_KEY);
|
|
83
|
+
while (at !== -1) {
|
|
84
|
+
const lineStart = consumed.lastIndexOf(0x0a, at) + 1;
|
|
85
|
+
const lineEnd = consumed.indexOf(0x0a, at);
|
|
86
|
+
const rec = parseLine(consumed.toString('utf-8', lineStart, lineEnd), source, sessionCwd);
|
|
81
87
|
if (rec) {
|
|
82
88
|
records.push(rec);
|
|
83
89
|
}
|
|
90
|
+
at = consumed.indexOf(USAGE_KEY, lineEnd);
|
|
84
91
|
}
|
|
85
92
|
const consumedBytes = consumed.length;
|
|
86
93
|
return {
|