返回 DeepSeek-Reasonix
app-memory-aggregate.mjs
根目录 / desktop / frontend / bench / app-memory-aggregate.mjs
1 import { readdirSync, readFileSync, writeFileSync } from "node:fs";
2 import path from "node:path";
3 import { aggregateShards } from "./app-memory-shards.mjs";
4 const [directory, manifestFile, output, sourceSHA] = process.argv.slice(2);
5 if (!directory || !manifestFile || !output || !sourceSHA) throw new Error("aggregate requires reports directory, manifest, output and source SHA");
6 const files = readdirSync(directory, { recursive: true }).filter(file => path.basename(file) === "report.json");
7 const reports = files.map(file => JSON.parse(readFileSync(path.join(directory, file), "utf8")));
8 const result = aggregateShards(reports, JSON.parse(readFileSync(manifestFile, "utf8")), sourceSHA);
9 writeFileSync(output, JSON.stringify(result, null, 2));
10 console.log(`App memory: ${result.screeningLevel} screening passed with ${result.protocol.shards} independent shard(s); heap attribution remains pending.`);
11
11 lines Plain Text