/** * Settings modal component for tmux-pilot. * * Provides a TUI settings editor with number validation, * YAML persistence, and search support. * * Renders as a full-editor replacement via ctx.ui.custom(). * Uses DynamicBorder for top/bottom borders, SettingsList * with enableSearch for the main content area. */ import type { ExtensionCommandContext, ExtensionUIContext } from "@earendil-works/pi-coding-agent"; import type { Component } from "@earendil-works/pi-tui"; import type { Document } from "yaml"; interface ValidationOk { valid: true; value: number | string; } interface ValidationErr { valid: false; error: string; } type ValidationResult = ValidationOk | ValidationErr; /** * Validate a raw string value against a setting definition. * * - number: parses with Number(), checks isNaN / isFinite, enforces integer * conversion and min/max bounds. * - enum: enforces membership in the allowed option set. * - string: applies the definition's shape validator. */ export declare function validateSetting(id: string, rawValue: string): ValidationResult; export declare function setEntrySetting(document: Document.Parsed, id: string, value: number | string): void; /** * Full-editor-replacement modal for editing tmux-pilot settings. * * Layout: * DynamicBorder (top, accent) * SettingsList (6 items, searchable) * DynamicBorder (bottom, accent) * * Each item opens a text Input submenu. On valid submit the value * is persisted to tmux-pilot.config.yaml and a notification is shown. * On invalid the submenu stays open with an error notification. * Escape in the main list calls the onClose callback (used by custom()). */ export declare class SettingsModalComponent implements Component { private topBorder; private bottomBorder; private settingsList; private ui; private configDir; private configPath; constructor(configDir: string, ui: ExtensionUIContext, onClose: () => void); render(width: number): string[]; handleInput(data: string): void; invalidate(): void; /** * Create a SettingItem with a number-input submenu. * * The submenu opens an Input pre-filled with the current value. * On submit the value is validated. If valid the setting is persisted; * if invalid an error notification is shown and the submenu stays open. */ private buildItem; /** * Called by SettingsList when a value changes via submenu submit. * Re-validates (the submenu already validated), persists, and notifies. */ private onChange; /** * Read effective settings from the composed configuration. * * Mapping: * subagent-execution.max-concurrent-agents → maxConcurrent * subagent-execution.tmux-server → subagentTmuxServer * subagent-widget.* → displayMode, placement, etc. */ private static readSettings; /** * Write a single setting value and persist to disk. * Returns true on success, false on failure. * * Uses atomic write (tmp + rename) to prevent file corruption on crash. * Re-reads config from disk before mutating to reduce the race window. */ private writeSetting; } /** * Create a handler suitable for `pi.registerCommand()`. * * The handler replaces the editor area with the settings modal via * `ctx.ui.custom()`. Pressing Escape restores the editor. */ export declare function createSettingsCommandHandler(): (args: string, ctx: ExtensionCommandContext) => Promise; export {}; //# sourceMappingURL=settings-modal.d.ts.map