@felan-ai/ext-rtk-optimizer 0.3.0 → 0.4.1
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 +18 -8
- package/dist/command.d.ts +0 -2
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +1 -13
- package/dist/command.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -18
- package/dist/index.js.map +1 -1
- package/dist/output-compactor.d.ts +4 -2
- package/dist/output-compactor.d.ts.map +1 -1
- package/dist/output-compactor.js +56 -13
- package/dist/output-compactor.js.map +1 -1
- package/dist/recovery.d.ts +9 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +64 -0
- package/dist/recovery.js.map +1 -0
- package/dist/rtk-gain.d.ts +24 -0
- package/dist/rtk-gain.d.ts.map +1 -0
- package/dist/rtk-gain.js +259 -0
- package/dist/rtk-gain.js.map +1 -0
- package/dist/techniques/truncate.d.ts +9 -0
- package/dist/techniques/truncate.d.ts.map +1 -1
- package/dist/techniques/truncate.js +77 -6
- package/dist/techniques/truncate.js.map +1 -1
- package/package.json +2 -2
- package/dist/output-metrics.d.ts +0 -15
- package/dist/output-metrics.d.ts.map +0 -1
- package/dist/output-metrics.js +0 -50
- package/dist/output-metrics.js.map +0 -1
package/dist/output-metrics.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export class OutputMetrics {
|
|
2
|
-
#records = [];
|
|
3
|
-
track(original, filtered, tool, techniques) {
|
|
4
|
-
const originalChars = original.length;
|
|
5
|
-
const filteredChars = filtered.length;
|
|
6
|
-
const savingsPercent = originalChars === 0 ? 0 : Math.round(((originalChars - filteredChars) / originalChars) * 10_000) / 100;
|
|
7
|
-
const record = {
|
|
8
|
-
timestamp: new Date().toISOString(),
|
|
9
|
-
tool,
|
|
10
|
-
techniques: techniques.join(',') || 'none',
|
|
11
|
-
originalChars,
|
|
12
|
-
filteredChars,
|
|
13
|
-
savingsPercent,
|
|
14
|
-
};
|
|
15
|
-
this.#records.push(record);
|
|
16
|
-
return record;
|
|
17
|
-
}
|
|
18
|
-
clear() {
|
|
19
|
-
this.#records.length = 0;
|
|
20
|
-
}
|
|
21
|
-
summary() {
|
|
22
|
-
if (this.#records.length === 0)
|
|
23
|
-
return 'RTK output compaction metrics: no data yet.';
|
|
24
|
-
const totalOriginal = sum(this.#records, (record) => record.originalChars);
|
|
25
|
-
const totalFiltered = sum(this.#records, (record) => record.filteredChars);
|
|
26
|
-
const totalSaved = totalOriginal - totalFiltered;
|
|
27
|
-
const savingsPercent = totalOriginal === 0 ? 0 : (totalSaved / totalOriginal) * 100;
|
|
28
|
-
const byTool = new Map();
|
|
29
|
-
for (const record of this.#records) {
|
|
30
|
-
const current = byTool.get(record.tool) ?? { count: 0, original: 0, filtered: 0 };
|
|
31
|
-
current.count += 1;
|
|
32
|
-
current.original += record.originalChars;
|
|
33
|
-
current.filtered += record.filteredChars;
|
|
34
|
-
byTool.set(record.tool, current);
|
|
35
|
-
}
|
|
36
|
-
return [
|
|
37
|
-
'RTK output compaction metrics',
|
|
38
|
-
`calls=${this.#records.length}, saved=${totalSaved.toLocaleString()} chars (${savingsPercent.toFixed(1)}%)`,
|
|
39
|
-
...[...byTool].map(([tool, current]) => {
|
|
40
|
-
const saved = current.original - current.filtered;
|
|
41
|
-
const percent = current.original === 0 ? 0 : (saved / current.original) * 100;
|
|
42
|
-
return `- ${tool}: ${current.count} calls, saved ${saved.toLocaleString()} chars (${percent.toFixed(1)}%)`;
|
|
43
|
-
}),
|
|
44
|
-
].join('\n');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function sum(values, select) {
|
|
48
|
-
return values.reduce((total, value) => total + select(value), 0);
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=output-metrics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-metrics.js","sourceRoot":"","sources":["../src/output-met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