Files
codecraft/web/src/prefs.ts
T
Richard ZinkandClaude Opus 5.5 49262c612c Users, file manager, image generation, budgets and agent workflow
- User management: local accounts (Argon2) and OpenID Connect, admin/user
  roles, per-user folders plus admin-shared folders, read-only session
  sharing, event filtering per user
- File manager with CodeMirror editor and git client (status, diff,
  stage, commit, branches, fetch/pull/push, log, clone/init)
- Image generation via fal.ai: generate_image tool and image page
- Budgets: monthly limits per provider, provider balances/costs
  (OpenRouter, Anthropic admin cost report, fal.ai), price discovery
- Subagents on other models, background tasks, concurrency limits per
  host/model/subagent
- MCP tools loaded on demand (mcp_search/mcp_call), read-only hints
- Permission mode "auto", safe read-only commands always allowed
- Persistent message queue with attachments, deletable
- Live reasoning incl. <think> tags, activity animations, CSS themes,
  mobile layout, statistics per user, upload size handling
- Docker: named volume for state, localhost-bound port

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 16:54:08 +01:00

28 lines
768 B
TypeScript

// Per-device display preferences (localStorage), observable from React.
import { useSyncExternalStore } from "react";
export type ReasoningMode = "collapsed" | "live" | "expanded" | "hidden";
const KEY = "codecraft.reasoning";
const listeners = new Set<() => void>();
export function getReasoningMode(): ReasoningMode {
const v = localStorage.getItem(KEY);
return v === "live" || v === "expanded" || v === "hidden" ? v : "collapsed";
}
export function setReasoningMode(mode: ReasoningMode) {
localStorage.setItem(KEY, mode);
listeners.forEach((l) => l());
}
export function useReasoningMode(): ReasoningMode {
return useSyncExternalStore(
(l) => {
listeners.add(l);
return () => listeners.delete(l);
},
getReasoningMode,
);
}