MCPcopy
hub / github.com/slopus/happy / persistSession

Function persistSession

packages/happy-cli/src/persistence.ts:436–446  ·  view source on GitHub ↗
(sessionId: string, session: PersistedSession)

Source from the content-addressed store, hash-verified

434}
435
436export function persistSession(sessionId: string, session: PersistedSession): void {
437 try {
438 const existing = readPersistedSessions();
439 existing[sessionId] = session;
440 const tmpFile = configuration.sessionsFile + '.tmp';
441 writeFileSync(tmpFile, JSON.stringify({ sessions: existing }, null, 2), 'utf-8');
442 renameSync(tmpFile, configuration.sessionsFile);
443 } catch (error) {
444 logger.debug(`[PERSISTENCE] Failed to persist session ${sessionId}:`, error);
445 }
446}
447

Callers 1

onHappySessionWebhookFunction · 0.90

Calls 2

readPersistedSessionsFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected