feat: add experimental session memory source

This commit is contained in:
Peter Steinberger
2026-01-17 18:53:48 +00:00
parent 8ec4af4641
commit 0e49dca53c
13 changed files with 445 additions and 42 deletions

View File

@@ -0,0 +1,23 @@
type SessionTranscriptUpdate = {
sessionFile: string;
};
type SessionTranscriptListener = (update: SessionTranscriptUpdate) => void;
const SESSION_TRANSCRIPT_LISTENERS = new Set<SessionTranscriptListener>();
export function onSessionTranscriptUpdate(listener: SessionTranscriptListener): () => void {
SESSION_TRANSCRIPT_LISTENERS.add(listener);
return () => {
SESSION_TRANSCRIPT_LISTENERS.delete(listener);
};
}
export function emitSessionTranscriptUpdate(sessionFile: string): void {
const trimmed = sessionFile.trim();
if (!trimmed) return;
const update = { sessionFile: trimmed };
for (const listener of SESSION_TRANSCRIPT_LISTENERS) {
listener(update);
}
}