23 lines
1.8 KiB
JavaScript
23 lines
1.8 KiB
JavaScript
/** Read only retained REA inventory; never opens the installed target. */
|
|
import fs from 'node:fs'
|
|
const input = '.tmp/rea-workbuddy-takeover-2026-10-15.json'
|
|
const pin = '035254bc76310ea46317433e4840602094543ef323d2d5c5aff7c131729de918'
|
|
const retained = JSON.parse(fs.readFileSync(input, 'utf8'))
|
|
const record = retained.records.find(item => item.provider.id === 'rea-javascript-application')
|
|
if (record.normalized_result.root_artifact_sha256 !== pin) throw new Error('Root pin mismatch')
|
|
const files = new Map()
|
|
for (const node of record.normalized_result.graph.nodes) for (const observation of node.observations) {
|
|
const p = observation.properties
|
|
if (observation.evidence.extractor.operation !== 'inventory-relevant-file') continue
|
|
if ((!p.path.startsWith('main/') && !/(?:expert|daemon|plugin|agent|schema)/i.test(p.path)) || p.path.startsWith('node_modules/')) continue
|
|
files.set(p.path, { path: p.path, sha256: observation.evidence.artifact.sha256, bytes: p.bytes,
|
|
fileKind: p.file_kind, unpacked: p.unpacked, textStatus: p.text_status })
|
|
}
|
|
const output = '.tmp/rea-expert-package-inventory.json'
|
|
fs.writeFileSync(output, JSON.stringify({ input, evidenceId: record.evidence_id, rootSha256: pin,
|
|
inventoryGraphSha256: record.normalized_result.inventory_graph_sha256,
|
|
inputPath: record.normalized_result.input_path, scope: 'matching paths in retained relevant-file inventory; not all archive entries',
|
|
files: [...files.values()].sort((a,b) => a.path.localeCompare(b.path)) }, null, 2))
|
|
console.log(JSON.stringify({ output, evidenceId: record.evidence_id, count: files.size,
|
|
candidates: [...files.values()].filter(file => /^main\/(?:daemon|runtime-handlers|module\.app-server|server)\./.test(file.path) || /expert-manager|marketplace\.json/.test(file.path)) },null,2))
|