// Maps our live-turn sessionKey → OpenCode's own session id (`ses_…`), the analog of
// sidecar/claude/state.ts's sessionKey→claude-uuid map. In-memory only: OpenCode's SQLite store is
// the durable record, and a fresh key just creates a new OpenCode session.

const sessionKeyToOpenCode = new Map<string, string>();

export const getOpenCodeSession = (sessionKey: string): string | undefined => sessionKeyToOpenCode.get(sessionKey);

export const setOpenCodeSession = (sessionKey: string, opencodeSessionId: string): void => {
  sessionKeyToOpenCode.set(sessionKey, opencodeSessionId);
};

export const clearOpenCodeSession = (sessionKey: string): void => {
  sessionKeyToOpenCode.delete(sessionKey);
};
