feat(agent): introduced idle progress recaps and optional session titles

- Added idle recap functionality to EventController to display goals and next actions when the agent is inactive.
- Updated session parsing in gc-cli and memories to correctly support optional title entries in session files.
This commit is contained in:
can1357
2026-06-27 15:13:10 +02:00
parent 222b036a11
commit d18e2c2f4d
3 changed files with 89 additions and 16 deletions
+17 -10
View File
@@ -434,17 +434,24 @@ function sessionIdFromSessionPath(sessionPath: string): string | undefined {
}
function sessionIdFromSessionText(text: string): string | undefined {
const line = text
.split(/\r?\n/)
.find(candidate => candidate.trim().length > 0)
?.trim();
if (!line) return undefined;
try {
const record = JSON.parse(line) as { type?: unknown; id?: unknown };
return record.type === "session" && typeof record.id === "string" && record.id.length > 0 ? record.id : undefined;
} catch {
return undefined;
let sawTitleSlot = false;
for (const rawLine of text.split(/\r?\n/)) {
const line = rawLine.trim();
if (!line) continue;
try {
const record = JSON.parse(line) as { type?: unknown; id?: unknown };
if (!sawTitleSlot && record.type === "title") {
sawTitleSlot = true;
continue;
}
return record.type === "session" && typeof record.id === "string" && record.id.length > 0
? record.id
: undefined;
} catch {
return undefined;
}
}
return undefined;
}
async function archivedSessionIdFromFile(file: string): Promise<string | undefined> {