chore: snapshot main sync
This commit is contained in:
@@ -159,9 +159,6 @@ function isoDate(d?: Date): string {
|
||||
return `${dt.getFullYear()}${String(dt.getMonth() + 1).padStart(2, '0')}${String(dt.getDate()).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function isTodayIso(iso: string): boolean {
|
||||
return iso.startsWith(new Date().toISOString().slice(0, 10));
|
||||
}
|
||||
|
||||
function tryParseJson<T>(raw: string): T | null {
|
||||
try {
|
||||
@@ -277,7 +274,6 @@ export async function startSession(task: string, basePath?: string): Promise<Sta
|
||||
// L2 user correction scan
|
||||
const allCorrections = await scanAllTrailsForCorrections(basePath);
|
||||
|
||||
// Check for unfinished sessions
|
||||
const unfinishedSessions = await findUnfinishedSessions(basePath);
|
||||
|
||||
return {
|
||||
@@ -363,7 +359,6 @@ export async function endSession(basePath?: string): Promise<EndSessionResult |
|
||||
// Read current trail for stats
|
||||
const trailLines = await readLines(trail);
|
||||
|
||||
// Extract user_correction records
|
||||
const corrections: UserCorrectionRecord[] = [];
|
||||
for (const line of trailLines) {
|
||||
const record = tryParseJson<UserCorrectionRecord>(line);
|
||||
@@ -401,7 +396,6 @@ export async function endSession(basePath?: string): Promise<EndSessionResult |
|
||||
const summaryFile = summaryPath(sessionId, basePath);
|
||||
await writeFile(summaryFile, summaryContent, 'utf-8');
|
||||
|
||||
// Update session.json
|
||||
const session = await getSessionJson(sessionId, basePath);
|
||||
if (session) {
|
||||
session.status = 'completed';
|
||||
@@ -410,7 +404,6 @@ export async function endSession(basePath?: string): Promise<EndSessionResult |
|
||||
await updateIndexStatus(sessionId, 'completed', basePath);
|
||||
}
|
||||
|
||||
// Update index.json record count
|
||||
const idx = await getIndex(basePath);
|
||||
if (idx) {
|
||||
for (const e of idx.entries) {
|
||||
@@ -507,7 +500,6 @@ export async function recoverSession(
|
||||
// L2: user corrections + conclusions + daily anomalies
|
||||
result.userCorrections = await scanAllTrailsForCorrections(basePath);
|
||||
|
||||
// Extract conclusions from trail entries
|
||||
const allTrailLines = await readLines(trailPath(activeSessionId ?? '', basePath));
|
||||
for (const line of allTrailLines) {
|
||||
const record = tryParseJson<AuditTrailEntry>(line);
|
||||
@@ -581,7 +573,6 @@ export async function generateDailyReport(
|
||||
}
|
||||
}
|
||||
|
||||
// Check for anomalies.json
|
||||
if (existsSync(rDir)) {
|
||||
const sessionDirs = await readdir(rDir, { withFileTypes: true });
|
||||
for (const d of sessionDirs) {
|
||||
|
||||
Reference in New Issue
Block a user