INNER CODE UNIT · TypeScript
last
open-gitagent/clawless · src/audit.ts:114
const last = this.entries[this.entries.length - 1].timestamp;
const lines: string[] = [];
lines.push(`=== AUDIT LOG (${first} — ${last}) ===`);
lines.push(`Total entries: ${this.entries.length}`);
// Group entries by source
const grouped = new Map<AuditSource, AuditEntry[]>();
for (const entry of this.entries) {
const src = entry.source ?? 'system';
if (!grouped.has(src)) grouped.set(src, []);
grouped.get(src)!.push(entry);
}
for (const source of SOURCE_ORDER) {
const entries = grouped.get(source);
if (!entries || entries.length === 0) continue;