import { configureTuiAppearance, TUI_ACTIVITY_INDICATOR_OPTIONS, TUI_STATUS_PRESENTATION_OPTIONS, } from "@luan.sh/pi-libtui"; import { createSettings } from "../sdk.ts"; const textEffectOptions = [ { value: "off", label: "Off", description: "Keep activity text steady." }, { value: "sweep", label: "Sweep", description: "Move a narrow highlight across activity text." }, { value: "glow", label: "Glow", description: "Move a broader multi-step glow across activity text." }, { value: "rainbow", label: "Rainbow", description: "Move a semantic color wave across activity text." }, { value: "rainbow-glow", label: "Rainbow glow", description: "Move a broad rainbow glow and subdued color trail across activity text.", }, { value: "lightning", label: "Lightning", description: "Move fast-mode strike and shine effects across activity text.", }, { value: "aurora", label: "Aurora wave", description: "Roll a luminous magenta-blue-cyan wave through activity text.", }, { value: "glitch", label: "Glitch", description: "Flash deterministic cyberpunk artifacts through activity text." }, { value: "crush", label: "Crush", description: "Resolve a moving field of artifacts back into activity text." }, ] as const; const inheritedIndicatorOptions = [ { value: "inherit", label: "Default", description: "Use the general activity indicator." }, ...TUI_ACTIVITY_INDICATOR_OPTIONS, ] as const; const messageOptions = [ { value: "phase", label: "Phase", description: "Show the current request phase." }, { value: "typewriter", label: "Typewriter", description: "Type rotating themed status messages." }, ] as const; const inheritedMessageOptions = [ { value: "inherit", label: "Default", description: "Use the general activity message." }, ...messageOptions, ] as const; const inheritedTextEffectOptions = [ { value: "inherit", label: "Default", description: "Use the general text effect." }, ...textEffectOptions, ] as const; const pulseEffectOptions = [ { value: "off", label: "Off", description: "Keep the composed indicator and text at their rendered colors." }, { value: "pulse", label: "Pulse", description: "Fade the composed indicator and text smoothly between dim and bright.", }, { value: "color", label: "Color pulse", description: "Pulse the colors of the composed indicator and text without changing their shapes.", }, ] as const; const inheritedPulseEffectOptions = [ { value: "inherit", label: "Default", description: "Use the general pulse effect." }, ...pulseEffectOptions, ] as const; const inheritedPresentationOptions = [ { value: "inherit", label: "Default", description: "Use the general status presentation." }, ...TUI_STATUS_PRESENTATION_OPTIONS, ] as const; export const tuiSettings = createSettings({ namespace: "pi-libtui", label: "TUI", apply: "live", definitions: { iconPack: { category: "appearance", section: "Style", label: "Icon pack", description: "Icon set used by shared TUI components.", type: "enum", default: "auto", options: [ { value: "auto", label: "Auto", description: "Use bundled Nerd Font support in known terminals; Unicode otherwise.", }, { value: "nerd-fonts", label: "Nerd Fonts", description: "Patched-font icons." }, { value: "unicode", label: "Unicode", description: "Plain text Unicode symbols." }, { value: "emoji", label: "Emoji", description: "Color emoji symbols." }, ], }, activityIndicator: { category: "appearance", page: "animations", section: "General", preview: "activity-marker", label: "Activity indicator", description: "Compact one-to-four-cell animation shown beside active work.", type: "enum", default: "braille-wave", options: TUI_ACTIVITY_INDICATOR_OPTIONS, }, activityMessage: { category: "appearance", page: "animations", section: "General", preview: "activity-message", label: "Activity message", description: "Text source used by the standard inline composition.", type: "enum", default: "phase", options: messageOptions, }, textEffect: { category: "appearance", page: "animations", section: "General", preview: "text-effect", label: "Text effect", description: "Motion painted across the composed activity text.", type: "enum", default: "sweep", options: textEffectOptions, }, textEffectScope: { category: "appearance", page: "animations", section: "General", label: "Text effect scope", description: "Choose whether the effect paints only the message or the whole inline composition.", type: "enum", default: "message", options: [ { value: "message", label: "Message", description: "Paint only the activity message." }, { value: "inline", label: "Whole inline", description: "Paint the indicator, separator, and message as one unit.", }, ], }, pulseEffect: { category: "appearance", page: "animations", section: "General", preview: "pulse-effect", label: "Pulse effect", description: "Pulse composed over the selected indicator and text effect.", type: "enum", default: "off", options: pulseEffectOptions, }, statusPresentation: { category: "appearance", page: "animations", section: "General", preview: "status-presentation", label: "Status presentation", description: "Choose the standard inline composition or an exclusive status presentation.", type: "enum", default: "standard", options: TUI_STATUS_PRESENTATION_OPTIONS, }, animationSpeed: { category: "appearance", page: "animations", section: "General", preview: "animation-speed", label: "Animation speed", description: "Pace of every activity indicator, text effect, and status presentation.", type: "enum", default: "relaxed", options: [ { value: "slow", label: "Slow", description: "Run animations at 60% of their normal pace." }, { value: "relaxed", label: "Relaxed", description: "Run animations at 80% of their normal pace." }, { value: "normal", label: "Normal", description: "Use each animation's designed pace." }, { value: "fast", label: "Fast", description: "Run animations at 135% of their normal pace." }, { value: "very-fast", label: "Very fast", description: "Run animations at 170% of their normal pace." }, ], }, animationSmoothness: { category: "appearance", page: "animations", section: "General", preview: "animation-smoothness", label: "Animation smoothness", description: "Maximum repaint frequency used to preserve animation frames.", type: "enum", default: "balanced", options: [ { value: "economy", label: "Economy", description: "Use at most about 13 redraws per second." }, { value: "balanced", label: "Balanced", description: "Use at most about 30 redraws per second." }, { value: "smooth", label: "Smooth", description: "Use at most about 45 redraws per second." }, { value: "ultra", label: "Ultra", description: "Use at most about 60 redraws per second." }, ], }, thinkingIndicator: { category: "appearance", page: "animations", section: "Thinking", preview: "activity-marker", label: "Indicator", description: "Indicator shown while the model is reasoning.", type: "enum", default: "braille-pulse", options: inheritedIndicatorOptions, }, thinkingMessage: { category: "appearance", page: "animations", section: "Thinking", preview: "activity-message", label: "Message", description: "Message source used while the model is reasoning.", type: "enum", default: "inherit", options: inheritedMessageOptions, }, thinkingTextEffect: { category: "appearance", page: "animations", section: "Thinking", preview: "text-effect", label: "Text effect", description: "Text effect shown while the model is reasoning.", type: "enum", default: "glow", options: inheritedTextEffectOptions, }, thinkingPulseEffect: { category: "appearance", page: "animations", section: "Thinking", preview: "pulse-effect", label: "Pulse effect", description: "Pulse effect used while the model is reasoning.", type: "enum", default: "pulse", options: inheritedPulseEffectOptions, }, thinkingPresentation: { category: "appearance", page: "animations", section: "Thinking", preview: "status-presentation", label: "Status presentation", description: "Status presentation shown while the model is reasoning.", type: "enum", default: "inherit", options: inheritedPresentationOptions, }, workingIndicator: { category: "appearance", page: "animations", section: "Working", preview: "activity-marker", label: "Indicator", description: "Indicator shown while the model generates a response.", type: "enum", default: "braille-scanline", options: inheritedIndicatorOptions, }, workingMessage: { category: "appearance", page: "animations", section: "Working", preview: "activity-message", label: "Message", description: "Message source used while the model generates a response.", type: "enum", default: "inherit", options: inheritedMessageOptions, }, workingTextEffect: { category: "appearance", page: "animations", section: "Working", preview: "text-effect", label: "Text effect", description: "Text effect shown while the model generates a response.", type: "enum", default: "rainbow-glow", options: inheritedTextEffectOptions, }, workingPulseEffect: { category: "appearance", page: "animations", section: "Working", preview: "pulse-effect", label: "Pulse effect", description: "Pulse effect used while the model generates a response.", type: "enum", default: "color", options: inheritedPulseEffectOptions, }, workingPresentation: { category: "appearance", page: "animations", section: "Working", preview: "status-presentation", label: "Status presentation", description: "Status presentation shown while the model generates a response.", type: "enum", default: "inherit", options: inheritedPresentationOptions, }, toolIndicator: { category: "appearance", page: "animations", section: "Tool", preview: "activity-marker", label: "Indicator", description: "Indicator shown while a tool is executing.", type: "enum", default: "inherit", options: inheritedIndicatorOptions, }, toolMessage: { category: "appearance", page: "animations", section: "Tool", preview: "activity-message", label: "Message", description: "Message source used while a tool is executing.", type: "enum", default: "inherit", options: inheritedMessageOptions, }, toolTextEffect: { category: "appearance", page: "animations", section: "Tool", preview: "text-effect", label: "Text effect", description: "Text effect shown while a tool is executing.", type: "enum", default: "inherit", options: inheritedTextEffectOptions, }, toolPulseEffect: { category: "appearance", page: "animations", section: "Tool", preview: "pulse-effect", label: "Pulse effect", description: "Pulse effect used while a tool is executing.", type: "enum", default: "inherit", options: inheritedPulseEffectOptions, }, toolPresentation: { category: "appearance", page: "animations", section: "Tool", preview: "status-presentation", label: "Status presentation", description: "Status presentation shown while a tool is executing.", type: "enum", default: "inherit", options: inheritedPresentationOptions, }, powerline: { category: "appearance", section: "Style", label: "Powerline separators", description: "Use rounded Powerline separators where supported.", type: "boolean", default: false, }, powerlineButtons: { category: "appearance", section: "Style", label: "Powerline buttons", description: "Use rounded Powerline caps for buttons.", type: "boolean", default: false, }, softCursor: { category: "appearance", section: "Style", label: "Softer virtual cursor", description: "Use a muted surface for virtual editor cursors.", type: "boolean", default: false, }, userMessageBubbles: { category: "appearance", label: "User message bubbles", description: "Show user messages in right-aligned bubbles instead of full-width rows.", type: "boolean", default: true, }, insertionCursor: { category: "appearance", page: "terminal", section: "Cursor", label: "Insertion cursor", description: "Cursor used while editing text.", type: "enum", default: "virtual", options: cursorOptions(), }, navigationCursor: { category: "appearance", page: "terminal", section: "Cursor", label: "Navigation cursor", description: "Cursor used while navigating without a selection.", type: "enum", default: "virtual", options: cursorOptions(), }, selectionCursor: { category: "appearance", page: "terminal", section: "Cursor", label: "Selection cursor", description: "Cursor used at the active end of a selection.", type: "enum", default: "virtual", options: cursorOptions(), }, }, }); function cursorOptions() { return [ { value: "virtual", label: "Virtual", description: "Paint the cursor into the TUI." }, { value: "terminal-default", label: "Terminal default", description: "Use the terminal's default cursor." }, { value: "blinking-block", label: "Blinking block", description: "Use a blinking block cursor." }, { value: "steady-block", label: "Steady block", description: "Use a steady block cursor." }, { value: "blinking-underline", label: "Blinking underline", description: "Use a blinking underline cursor." }, { value: "steady-underline", label: "Steady underline", description: "Use a steady underline cursor." }, { value: "blinking-bar", label: "Blinking bar", description: "Use a blinking bar cursor." }, { value: "steady-bar", label: "Steady bar", description: "Use a steady bar cursor." }, ] as const; } export function registerTuiSettings(): () => void { return tuiSettings.register((settings) => configureTuiAppearance(settings)); }