// Tool-calls display preference — side-effect-free at import time.
// Call bootstrapToolCalls() once from main.tsx before render.
export type ToolCallsPreference = 'yes' | 'no'
export function getToolCallsPreference(): ToolCallsPreference {
const stored = localStorage.getItem('showToolCalls')
if (stored === 'no') return 'no'
return 'yes'
}
export function bootstrapToolCalls(): void {
const val = getToolCallsPreference()
document.documentElement.dataset['showToolcalls'] = val === 'yes' ? 'true' : 'false'
}
export function setToolCalls(value: ToolCallsPreference | null): void {
if (value === null) {
localStorage.removeItem('showToolCalls')
document.documentElement.dataset['showToolcalls'] = 'true'
} else {
localStorage.setItem('showToolCalls', value)
document.documentElement.dataset['showToolcalls'] = value === 'yes' ? 'true' : 'false'
}
}