3e237e177a
* feat: add code-walkthrough backend (MCP tool, service, persistence, WS events) * feat: render agent code walkthroughs as line-anchored cards + editor window * test: add code-walkthrough re-emit mock-agent scenario * fix: rework code-walkthrough UX (floating card, line reveal, minimize, clickable file) * fix: improve code walkthrough editor UX * fix: backfill walkthrough launcher after websocket connect * fix: improve walkthrough requests and editor anchors * fix: clear walkthrough highlights on close * feat: add walkthrough discard and prompt customization * fix: send walkthrough requests through saved prompt * fix: support postgres built-in prompt seeding * fix: address walkthrough review feedback * fix: address walkthrough review follow-ups * fix: harden walkthrough lifecycle races * fix: reuse walkthrough notification cleanup * fix: guard stale walkthrough file opens * fix: abort stale file opens before paint * fix: stabilize github settings e2e readiness * fix: use stable github settings e2e selector
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
const WALKTHROUGH_NOTIFICATION_KEY = "kandev.walkthrough.lastSeenByTask";
|
|
|
|
export type WalkthroughNotificationState = Record<string, string | null>;
|
|
|
|
function readState(): WalkthroughNotificationState {
|
|
if (typeof window === "undefined") return {};
|
|
try {
|
|
const raw = window.localStorage.getItem(WALKTHROUGH_NOTIFICATION_KEY);
|
|
return raw ? (JSON.parse(raw) as WalkthroughNotificationState) : {};
|
|
} catch {
|
|
return {};
|
|
}
|
|
}
|
|
|
|
function writeState(state: WalkthroughNotificationState): void {
|
|
if (typeof window === "undefined") return;
|
|
try {
|
|
window.localStorage.setItem(WALKTHROUGH_NOTIFICATION_KEY, JSON.stringify(state));
|
|
} catch {
|
|
// Ignore write failures.
|
|
}
|
|
}
|
|
|
|
export function getWalkthroughNotificationState(): WalkthroughNotificationState {
|
|
return readState();
|
|
}
|
|
|
|
export function setWalkthroughLastSeen(taskId: string, timestamp: string | null): void {
|
|
const state = readState();
|
|
if (timestamp === null) {
|
|
delete state[taskId];
|
|
} else {
|
|
state[taskId] = timestamp;
|
|
}
|
|
writeState(state);
|
|
}
|
|
|
|
export function getWalkthroughLastSeen(taskId: string): string | null {
|
|
const state = readState();
|
|
return state[taskId] ?? null;
|
|
}
|