Skip to content

The open-source app everyone uses to manage agents at work

763 B
Raw Blame
const STORAGE_KEY = "paperclip:composer-effort";

/** Undefined means no preference; null is the user's explicit Default choice. */
export function getLastComposerEffort(companyId: string): string | null | undefined {
  try {
    const raw = localStorage.getItem(`${STORAGE_KEY}:${companyId}`);
    if (raw === null) return undefined;
    const value: unknown = JSON.parse(raw);
    return value === null || typeof value === "string" ? value : undefined;
  } catch {
    return undefined;
  }
}

export function rememberComposerEffort(companyId: string, effort: string | null): void {
  try {
    localStorage.setItem(`${STORAGE_KEY}:${companyId}`, JSON.stringify(effort));
  } catch {
    // The current run setting still works without persistent storage.
  }
}