@neurynae/toolcairn-mcp 0.10.14 → 0.10.15
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/index.js +18 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1346,17 +1346,33 @@ var ARCHIVE_BATCH = 2500;
|
|
|
1346
1346
|
async function appendAudit(projectRoot, entry) {
|
|
1347
1347
|
await mkdir3(joinConfigDir(projectRoot), { recursive: true });
|
|
1348
1348
|
const auditPath = joinAuditPath(projectRoot);
|
|
1349
|
-
const line = `${JSON.stringify(entry)}
|
|
1349
|
+
const line = `${JSON.stringify(normalizeAuditEntry(entry))}
|
|
1350
1350
|
`;
|
|
1351
1351
|
await appendFile(auditPath, line, "utf-8");
|
|
1352
1352
|
await rotateIfNeeded(projectRoot, auditPath);
|
|
1353
1353
|
}
|
|
1354
|
+
function normalizeAuditEntry(entry) {
|
|
1355
|
+
return {
|
|
1356
|
+
action: entry.action,
|
|
1357
|
+
tool: entry.tool,
|
|
1358
|
+
timestamp: entry.timestamp,
|
|
1359
|
+
reason: entry.reason,
|
|
1360
|
+
mcp_tool: entry.mcp_tool ?? null,
|
|
1361
|
+
query_id: entry.query_id ?? null,
|
|
1362
|
+
duration_ms: entry.duration_ms ?? null,
|
|
1363
|
+
status: entry.status ?? "ok",
|
|
1364
|
+
outcome: entry.outcome ?? null,
|
|
1365
|
+
replaced_by: entry.replaced_by ?? null,
|
|
1366
|
+
candidates: entry.candidates ?? null,
|
|
1367
|
+
metadata: entry.metadata ?? null
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1354
1370
|
async function bulkAppendAudit(projectRoot, entries) {
|
|
1355
1371
|
if (entries.length === 0)
|
|
1356
1372
|
return;
|
|
1357
1373
|
await mkdir3(joinConfigDir(projectRoot), { recursive: true });
|
|
1358
1374
|
const auditPath = joinAuditPath(projectRoot);
|
|
1359
|
-
const payload = entries.map((e) => `${JSON.stringify(e)}
|
|
1375
|
+
const payload = entries.map((e) => `${JSON.stringify(normalizeAuditEntry(e))}
|
|
1360
1376
|
`).join("");
|
|
1361
1377
|
await appendFile(auditPath, payload, "utf-8");
|
|
1362
1378
|
await rotateIfNeeded(projectRoot, auditPath);
|