apex-code 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +41 -2
  3. package/dist/core/agent-session.d.ts +37 -0
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +264 -60
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/default-tool-names.d.ts +7 -0
  8. package/dist/core/default-tool-names.d.ts.map +1 -0
  9. package/dist/core/default-tool-names.js +14 -0
  10. package/dist/core/default-tool-names.js.map +1 -0
  11. package/dist/core/extensions/runner.d.ts.map +1 -1
  12. package/dist/core/extensions/runner.js +2 -0
  13. package/dist/core/extensions/runner.js.map +1 -1
  14. package/dist/core/extensions/types.d.ts +3 -0
  15. package/dist/core/extensions/types.d.ts.map +1 -1
  16. package/dist/core/extensions/types.js.map +1 -1
  17. package/dist/core/keybindings.d.ts +11 -1
  18. package/dist/core/keybindings.d.ts.map +1 -1
  19. package/dist/core/keybindings.js +6 -1
  20. package/dist/core/keybindings.js.map +1 -1
  21. package/dist/core/permissions/startup.d.ts +1 -1
  22. package/dist/core/permissions/startup.d.ts.map +1 -1
  23. package/dist/core/permissions/startup.js.map +1 -1
  24. package/dist/core/sdk.d.ts.map +1 -1
  25. package/dist/core/sdk.js +13 -9
  26. package/dist/core/sdk.js.map +1 -1
  27. package/dist/core/settings-manager.d.ts +4 -0
  28. package/dist/core/settings-manager.d.ts.map +1 -1
  29. package/dist/core/settings-manager.js +13 -0
  30. package/dist/core/settings-manager.js.map +1 -1
  31. package/dist/core/slash-commands.d.ts.map +1 -1
  32. package/dist/core/slash-commands.js +1 -0
  33. package/dist/core/slash-commands.js.map +1 -1
  34. package/dist/core/tools/contract.d.ts +1 -0
  35. package/dist/core/tools/contract.d.ts.map +1 -1
  36. package/dist/core/tools/contract.js.map +1 -1
  37. package/dist/core/tools/index.d.ts +1 -1
  38. package/dist/core/tools/index.d.ts.map +1 -1
  39. package/dist/core/tools/index.js.map +1 -1
  40. package/dist/core/tools/plan-present.d.ts +13 -12
  41. package/dist/core/tools/plan-present.d.ts.map +1 -1
  42. package/dist/core/tools/plan-present.js +32 -19
  43. package/dist/core/tools/plan-present.js.map +1 -1
  44. package/dist/core/tools/renderers/index.d.ts +1 -1
  45. package/dist/core/tools/renderers/index.d.ts.map +1 -1
  46. package/dist/core/tools/renderers/index.js +2 -0
  47. package/dist/core/tools/renderers/index.js.map +1 -1
  48. package/dist/core/tools/renderers/todo-write.d.ts +7 -0
  49. package/dist/core/tools/renderers/todo-write.d.ts.map +1 -0
  50. package/dist/core/tools/renderers/todo-write.js +58 -0
  51. package/dist/core/tools/renderers/todo-write.js.map +1 -0
  52. package/dist/index.d.ts +2 -2
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/index.js.map +1 -1
  56. package/dist/modes/interactive/components/first-use-hints.d.ts +1 -1
  57. package/dist/modes/interactive/components/first-use-hints.d.ts.map +1 -1
  58. package/dist/modes/interactive/components/first-use-hints.js +1 -0
  59. package/dist/modes/interactive/components/first-use-hints.js.map +1 -1
  60. package/dist/modes/interactive/components/footer.d.ts +3 -1
  61. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  62. package/dist/modes/interactive/components/footer.js +25 -11
  63. package/dist/modes/interactive/components/footer.js.map +1 -1
  64. package/dist/modes/interactive/components/settings-selector.d.ts +5 -0
  65. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  66. package/dist/modes/interactive/components/settings-selector.js +20 -1
  67. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  68. package/dist/modes/interactive/components/task-panel.d.ts +27 -0
  69. package/dist/modes/interactive/components/task-panel.d.ts.map +1 -0
  70. package/dist/modes/interactive/components/task-panel.js +92 -0
  71. package/dist/modes/interactive/components/task-panel.js.map +1 -0
  72. package/dist/modes/interactive/components/turn-summary.d.ts +6 -0
  73. package/dist/modes/interactive/components/turn-summary.d.ts.map +1 -0
  74. package/dist/modes/interactive/components/turn-summary.js +12 -0
  75. package/dist/modes/interactive/components/turn-summary.js.map +1 -0
  76. package/dist/modes/interactive/interactive-mode.d.ts +9 -0
  77. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  78. package/dist/modes/interactive/interactive-mode.js +162 -11
  79. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  80. package/dist/package-manager-cli.d.ts.map +1 -1
  81. package/dist/package-manager-cli.js +31 -72
  82. package/dist/package-manager-cli.js.map +1 -1
  83. package/docs/keybindings.md +19 -1
  84. package/docs/settings.md +8 -0
  85. package/npm-shrinkwrap.json +5 -5
  86. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"settings-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-selector.ts"],"names":[],"mappings":"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","sourcesContent":["import { getSupportedThinkingLevels, type Model, type Transport } from \"@earendil-works/pi-ai\";\nimport {\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\ttype ScrollViewScrollbar,\n\ttype SelectItem,\n\ttype SettingItem,\n\tSettingsList,\n\ttype SettingsListTheme,\n\tSpacer,\n\tText,\n} from \"@earendil-works/pi-tui\";\nimport type { ThinkingLevel } from \"apex-code-agent-core\";\nimport { formatHttpIdleTimeoutMs, HTTP_IDLE_TIMEOUT_CHOICES } from \"../../../core/http-dispatcher.ts\";\nimport type { PermissionModeOrigin } from \"../../../core/permissions/startup.ts\";\nimport { PERMISSION_MODES, type PermissionMode } from \"../../../core/permissions/store.ts\";\nimport {\n\tCACHE_WARMING_MODES,\n\ttype CacheWarmingMode,\n\tCHAT_DETAILS,\n\ttype ChatDetail,\n\ttype DefaultProjectTrust,\n\ttype FullscreenExitOutput,\n\ttype MermaidRenderingMode,\n\ttype TuiMode,\n\ttype WarningSettings,\n} from \"../../../core/settings-manager.ts\";\nimport { getSettingsListTheme, parseAutoThemeSetting, type TerminalTheme, theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { hintRow, keyDisplayText } from \"./keybinding-hints.ts\";\nimport { withComposerPrompt } from \"./prompt-input.ts\";\nimport { SelectSubmenu, SteppedSubmenu, type SteppedSubmenuStep } from \"./settings-submenu.ts\";\n\n/** The two hint rows `pi-tui`'s settings list writes, with and without search. */\nconst SETTINGS_LIST_HINT_ROWS = new Set([\n\t\"Type to search · Enter/Space to change · Esc to cancel\",\n\t\"Enter/Space to change · Esc to cancel\",\n]);\n\n/**\n * The settings list is `pi-tui`'s and writes its own hint row, but the theme it paints with is\n * ours, so the row is swapped here for the shared grammar. The search box's prompt already\n * says typing searches.\n */\nfunction getSettingsSelectorListTheme(): SettingsListTheme {\n\tconst base = getSettingsListTheme();\n\treturn {\n\t\t...base,\n\t\thint: (text: string) =>\n\t\t\tSETTINGS_LIST_HINT_ROWS.has(text.trim())\n\t\t\t\t? hintRow([\n\t\t\t\t\t\t[[\"tui.select.confirm\", { literal: \"space\" }], \"change\"],\n\t\t\t\t\t\t[\"tui.select.cancel\", \"close\"],\n\t\t\t\t\t])\n\t\t\t\t: base.hint(text),\n\t};\n}\n\nconst MODEL_PICKER_LAYOUT = { minPrimaryColumnWidth: 12, maxPrimaryColumnWidth: 46 };\n\nconst THINKING_DESCRIPTIONS: Record<ThinkingLevel, string> = {\n\toff: \"No reasoning\",\n\tminimal: \"Very brief reasoning (~1k tokens)\",\n\tlow: \"Light reasoning (~2k tokens)\",\n\tmedium: \"Moderate reasoning (~8k tokens)\",\n\thigh: \"Deep reasoning (~16k tokens)\",\n\txhigh: \"Extra-high reasoning (~32k tokens)\",\n\tmax: \"Maximum reasoning\",\n};\n\nconst DEFAULT_PROJECT_TRUST_LABELS: Record<DefaultProjectTrust, string> = {\n\task: \"Ask\",\n\talways: \"Always trust\",\n\tnever: \"Never trust\",\n};\n\nconst DEFAULT_PROJECT_TRUST_BY_LABEL = new Map(\n\tObject.entries(DEFAULT_PROJECT_TRUST_LABELS).map(([value, label]) => [label, value as DefaultProjectTrust]),\n);\n\nconst PERMISSION_MODE_DESCRIPTIONS: Record<PermissionMode, string> = {\n\tdefault: \"Ask for anything policy does not already allow\",\n\tplan: \"Block file writes, commands, and delegation while you investigate\",\n\tacceptEdits: \"Auto-allow file edits inside the workspace; still ask for anything outside it, commands and network\",\n\tdontAsk: \"Never prompt; deny anything not already permitted\",\n\tbypassPermissions: \"Allow every tool call without asking\",\n};\n\n/**\n * What outranks a user-scope write, phrased for someone deciding whether to bother.\n * `user` and `default` are absent because neither shadows anything this menu writes.\n */\nexport const PERMISSION_MODE_OVERRIDE_HINTS: Partial<Record<PermissionModeOrigin, string>> = {\n\tflag: \"--permission-mode on the command line\",\n\tlocal: \".apex-code/permissions.local.json in this project\",\n\tproject: \".apex-code/permissions.json in this project\",\n\tcommand: \"a command-scoped override in this session\",\n\tsession: \"a session-scoped override\",\n};\n\n/** Empty when the session has no permission gate, so the row simply does not exist. */\nfunction permissionModeItems(current: SettingsConfig[\"permissionMode\"], callbacks: SettingsCallbacks): SettingItem[] {\n\tif (!current) return [];\n\treturn [\n\t\t{\n\t\t\tid: \"permission-mode\",\n\t\t\tlabel: \"Permission mode\",\n\t\t\tdescription: PERMISSION_MODE_DESCRIPTIONS[current.mode],\n\t\t\tcurrentValue: current.mode,\n\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\tnew PermissionModeSubmenu(\n\t\t\t\t\tcurrentValue as PermissionMode,\n\t\t\t\t\tcurrent.origin,\n\t\t\t\t\t(mode) => callbacks.onPermissionModeChange(mode),\n\t\t\t\t\tdone,\n\t\t\t\t),\n\t\t},\n\t];\n}\n\nexport interface SettingsConfig {\n\tautoCompact: boolean;\n\tdefaultModel: string;\n\tcurrentModel?: Model<any>;\n\tavailableDefaultModels: readonly Model<any>[];\n\tshowImages: boolean;\n\timageWidthCells: number;\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tenableSkillCommands: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\ttransport: Transport;\n\thttpIdleTimeoutMs: number;\n\tcacheWarmingMode: CacheWarmingMode;\n\tthinkingLevel: ThinkingLevel;\n\tavailableThinkingLevels: ThinkingLevel[];\n\tmodelThinkingLevels: Record<string, ThinkingLevel>;\n\tcurrentTheme: string;\n\tterminalTheme: TerminalTheme;\n\tavailableThemes: string[];\n\thideThinkingBlock: boolean;\n\tchatDetail: ChatDetail;\n\tmermaidRenderingMode: MermaidRenderingMode;\n\tshowCacheMissNotices: boolean;\n\tcollapseChangelog: boolean;\n\tsendProviderAttribution: boolean;\n\tdoubleEscapeAction: \"fork\" | \"tree\" | \"none\";\n\ttreeFilterMode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\";\n\tshowHardwareCursor: boolean;\n\teditorPaddingX: number;\n\toutputPad: 0 | 1;\n\tautocompleteMaxVisible: number;\n\tquietStartup: boolean;\n\tdefaultProjectTrust: DefaultProjectTrust;\n\t/** Absent when the session runs without a permission gate; the row is then hidden. */\n\tpermissionMode?: { mode: PermissionMode; origin: PermissionModeOrigin };\n\tclearOnShrink: boolean;\n\tshowTerminalProgress: boolean;\n\ttuiMode: TuiMode;\n\tfullscreenExitOutput: FullscreenExitOutput;\n\tfullscreenScrollbar: ScrollViewScrollbar;\n\tfullscreenCopyOnSelect: boolean;\n\twarnings: WarningSettings;\n}\n\nexport interface SettingsCallbacks {\n\tonAutoCompactChange: (enabled: boolean) => void;\n\tonShowImagesChange: (enabled: boolean) => void;\n\tonImageWidthCellsChange: (width: number) => void;\n\tonAutoResizeImagesChange: (enabled: boolean) => void;\n\tonBlockImagesChange: (blocked: boolean) => void;\n\tonEnableSkillCommandsChange: (enabled: boolean) => void;\n\tonSteeringModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonFollowUpModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonTransportChange: (transport: Transport) => void;\n\tonHttpIdleTimeoutMsChange: (timeoutMs: number) => void;\n\tonCacheWarmingModeChange: (mode: CacheWarmingMode) => void;\n\tonModelThinkingLevelChange: (provider: string, modelId: string, level: ThinkingLevel) => void;\n\tonModelThinkingLevelRemove: (provider: string, modelId: string) => void;\n\tonThemeChange: (theme: string) => void;\n\tonThemePreview?: (theme: string) => void;\n\tonHideThinkingBlockChange: (hidden: boolean) => void;\n\tonChatDetailChange: (detail: ChatDetail) => void;\n\tonMermaidRenderingModeChange: (mode: MermaidRenderingMode) => void;\n\tonShowCacheMissNoticesChange: (shown: boolean) => void;\n\tonCollapseChangelogChange: (collapsed: boolean) => void;\n\tonSendProviderAttributionChange: (enabled: boolean) => void;\n\tonDoubleEscapeActionChange: (action: \"fork\" | \"tree\" | \"none\") => void;\n\tonTreeFilterModeChange: (mode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\") => void;\n\tonShowHardwareCursorChange: (enabled: boolean) => void;\n\tonEditorPaddingXChange: (padding: number) => void;\n\tonOutputPadChange: (padding: 0 | 1) => void;\n\tonAutocompleteMaxVisibleChange: (maxVisible: number) => void;\n\tonQuietStartupChange: (enabled: boolean) => void;\n\tonDefaultProjectTrustChange: (defaultProjectTrust: DefaultProjectTrust) => void;\n\tonPermissionModeChange: (mode: PermissionMode) => void;\n\tonClearOnShrinkChange: (enabled: boolean) => void;\n\tonShowTerminalProgressChange: (enabled: boolean) => void;\n\tonTuiModeChange: (mode: TuiMode) => void;\n\tonFullscreenExitOutputChange: (output: FullscreenExitOutput) => void;\n\tonFullscreenScrollbarChange: (mode: ScrollViewScrollbar) => void;\n\tonFullscreenCopyOnSelectChange: (enabled: boolean) => void;\n\tonWarningsChange: (warnings: WarningSettings) => void;\n\tonCancel: () => void;\n}\n\n/**\n * A submenu component for selecting from a list of options.\n */\nclass WarningSettingsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate state: WarningSettings;\n\n\tconstructor(warnings: WarningSettings, onChange: (warnings: WarningSettings) => void, onCancel: () => void) {\n\t\tsuper();\n\n\t\tthis.state = { ...warnings };\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"anthropic-extra-usage\",\n\t\t\t\tlabel: \"Anthropic extra usage\",\n\t\t\t\tdescription: \"Warn when Anthropic subscription auth may use paid extra usage\",\n\t\t\t\tcurrentValue: (this.state.anthropicExtraUsage ?? true) ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"anthropic-extra-usage\":\n\t\t\t\t\t\tthis.state = { ...this.state, anthropicExtraUsage: newValue === \"true\" };\n\t\t\t\t\t\tonChange({ ...this.state });\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tonCancel,\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\nconst CLEAR_OVERRIDE_VALUE = \"__clear__\";\n\nfunction modelSettingKey(model: Model<any>): string {\n\treturn `${model.provider}/${model.id}`;\n}\n\nfunction modelDisplayLabel(model: Model<any>): string {\n\treturn `${model.id} [${model.provider}]`;\n}\n\nfunction modelThinkingOverridesSummary(overrides: Record<string, ThinkingLevel>): string {\n\tconst count = Object.keys(overrides).length;\n\tif (count === 0) return \"none\";\n\treturn `${count} configured`;\n}\n\nfunction modelItemLabel(model: Model<any>): string {\n\treturn `${model.id} ${theme.fg(\"muted\", `[${model.provider}]`)}`;\n}\n\n/**\n * Permission mode picker, mode list then a confirm step for `bypassPermissions`.\n * The confirm exists because the mode list is arrow-cyclable like every other\n * settings row, so \"allow every tool call\" is otherwise one stray keypress away.\n */\nclass PermissionModeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly current: PermissionMode;\n\tprivate readonly origin: PermissionModeOrigin;\n\tprivate readonly onSelect: (mode: PermissionMode) => void;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\n\tconstructor(\n\t\tcurrent: PermissionMode,\n\t\torigin: PermissionModeOrigin,\n\t\tonSelect: (mode: PermissionMode) => void,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.current = current;\n\t\tthis.origin = origin;\n\t\tthis.onSelect = onSelect;\n\t\tthis.onDone = onDone;\n\t\tthis.showModeList();\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(component: Component): void {\n\t\tthis.clear();\n\t\tthis.addChild(component);\n\t\tthis.inputComponent = component;\n\t}\n\n\tprivate description(): string {\n\t\tconst overridden =\n\t\t\tthis.origin !== \"user\" && this.origin !== \"default\"\n\t\t\t\t? ` Currently set by ${PERMISSION_MODE_OVERRIDE_HINTS[this.origin]}.`\n\t\t\t\t: \"\";\n\t\treturn `Saved to user scope and applied to the next tool call.${overridden}`;\n\t}\n\n\tprivate showModeList(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Permission mode\",\n\t\t\t\tthis.description(),\n\t\t\t\tPERMISSION_MODES.map((mode) => ({\n\t\t\t\t\tvalue: mode,\n\t\t\t\t\tlabel: mode,\n\t\t\t\t\tdescription: PERMISSION_MODE_DESCRIPTIONS[mode],\n\t\t\t\t})),\n\t\t\t\tthis.current,\n\t\t\t\t(value) => {\n\t\t\t\t\tconst mode = value as PermissionMode;\n\t\t\t\t\tif (mode === \"bypassPermissions\") {\n\t\t\t\t\t\tthis.showBypassConfirm();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(mode);\n\t\t\t\t\tthis.onDone(mode);\n\t\t\t\t},\n\t\t\t\t() => this.onDone(),\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate showBypassConfirm(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Bypass all permission checks?\",\n\t\t\t\t\"Every tool call runs without asking, in every project, until you change this back. Nothing else confines the session: it writes anywhere your account can and reaches any host. Run inside a container or VM if the work is untrusted.\",\n\t\t\t\t[\n\t\t\t\t\t{ value: \"no\", label: `No, keep ${this.current}`, description: \"Return to the mode list\" },\n\t\t\t\t\t{ value: \"yes\", label: \"Yes, bypass\", description: \"Allow every tool call without asking\" },\n\t\t\t\t],\n\t\t\t\t\"no\",\n\t\t\t\t(value) => {\n\t\t\t\t\tif (value !== \"yes\") {\n\t\t\t\t\t\tthis.showModeList();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(\"bypassPermissions\");\n\t\t\t\t\tthis.onDone(\"bypassPermissions\");\n\t\t\t\t},\n\t\t\t\t() => this.showModeList(),\n\t\t\t),\n\t\t);\n\t}\n}\n\nfunction themeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn availableThemes.map((name) => ({\n\t\tvalue: name,\n\t\tlabel: `${name === currentTheme ? \"✓ \" : \" \"}${name}`,\n\t}));\n}\n\nconst AUTOMATIC_THEME_VALUE = \"/\";\n\nfunction singleModeThemeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn [\n\t\t{\n\t\t\tvalue: AUTOMATIC_THEME_VALUE,\n\t\t\tlabel: \" Automatic\",\n\t\t\tdescription: \"Use separate themes for light and dark terminal appearance\",\n\t\t},\n\t\t...themeItems(availableThemes, currentTheme),\n\t];\n}\n\nfunction preferredTheme(availableThemes: string[], preferred: string | undefined, fallback: string): string {\n\tif (preferred && availableThemes.includes(preferred)) return preferred;\n\tif (availableThemes.includes(fallback)) return fallback;\n\treturn availableThemes[0] ?? fallback;\n}\n\nfunction defaultAutomaticThemes(\n\tcurrentThemeSetting: string,\n\tavailableThemes: string[],\n): { lightTheme: string; darkTheme: string } {\n\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\tif (autoTheme) return autoTheme;\n\n\tconst currentFixedTheme = currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\tconst themeName = preferredTheme(availableThemes, currentFixedTheme, \"dark\");\n\treturn { lightTheme: themeName, darkTheme: themeName };\n}\n\nclass ThemeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly callbacks: SettingsCallbacks;\n\tprivate readonly availableThemes: string[];\n\tprivate readonly terminalTheme: TerminalTheme;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\tprivate readonly originalThemeSetting: string;\n\tprivate mode: \"single\" | \"automatic\";\n\tprivate singleTheme: string;\n\tprivate lightTheme: string;\n\tprivate darkTheme: string;\n\n\tconstructor(\n\t\tcurrentThemeSetting: string,\n\t\tterminalTheme: TerminalTheme,\n\t\tavailableThemes: string[],\n\t\tcallbacks: SettingsCallbacks,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.callbacks = callbacks;\n\t\tthis.availableThemes = availableThemes;\n\t\tthis.terminalTheme = terminalTheme;\n\t\tthis.onDone = onDone;\n\t\tthis.originalThemeSetting = currentThemeSetting;\n\t\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\t\tconst automaticThemes = defaultAutomaticThemes(currentThemeSetting, availableThemes);\n\t\tconst fixedTheme = autoTheme || currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\t\tthis.mode = autoTheme ? \"automatic\" : \"single\";\n\t\tthis.lightTheme = automaticThemes.lightTheme;\n\t\tthis.darkTheme = automaticThemes.darkTheme;\n\t\tthis.singleTheme = preferredTheme(\n\t\t\tavailableThemes,\n\t\t\tfixedTheme ?? (autoTheme ? this.getActiveAutomaticTheme() : undefined),\n\t\t\t\"dark\",\n\t\t);\n\n\t\tif (this.mode === \"automatic\") {\n\t\t\tthis.showAutomaticMenu();\n\t\t} else {\n\t\t\tthis.showSingleMenu();\n\t\t}\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(renderComponent: Component, inputComponent: Component = renderComponent): void {\n\t\tthis.clear();\n\t\tthis.addChild(renderComponent);\n\t\tthis.inputComponent = inputComponent;\n\t}\n\n\tprivate showSingleMenu(): void {\n\t\tthis.mode = \"single\";\n\t\tconst menu = new SelectSubmenu(\n\t\t\t\"Theme\",\n\t\t\t\"Select a theme, or choose Automatic to follow terminal appearance.\",\n\t\t\tsingleModeThemeItems(this.availableThemes, this.singleTheme),\n\t\t\tthis.singleTheme,\n\t\t\t(value) => {\n\t\t\t\tif (value === AUTOMATIC_THEME_VALUE) {\n\t\t\t\t\tthis.mode = \"automatic\";\n\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\tthis.showAutomaticMenu();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.singleTheme = value;\n\t\t\t\tthis.apply(value);\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t\t(value) => {\n\t\t\t\tthis.callbacks.onThemePreview?.(value === AUTOMATIC_THEME_VALUE ? this.getAutomaticThemeSetting() : value);\n\t\t\t},\n\t\t);\n\t\tthis.setContent(menu);\n\t}\n\n\tprivate showAutomaticMenu(): void {\n\t\tthis.mode = \"automatic\";\n\t\tconst content = new Container();\n\t\tcontent.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Automatic theme\")), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Choose themes for terminal light and dark appearance.\"), 0, 0));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Light/dark detection requires terminal support.\"), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"light-theme\",\n\t\t\t\tlabel: \"Light theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is light\",\n\t\t\t\tcurrentValue: this.lightTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Light Theme\",\n\t\t\t\t\t\t\"Select the theme to use for light terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.lightTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"dark-theme\",\n\t\t\t\tlabel: \"Dark theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is dark\",\n\t\t\t\tcurrentValue: this.darkTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Dark Theme\",\n\t\t\t\t\t\t\"Select the theme to use for dark terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.darkTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"apply\",\n\t\t\t\tlabel: \"Apply\",\n\t\t\t\tdescription: \"Save and go back\",\n\t\t\t\tcurrentValue: \"save and go back\",\n\t\t\t\tvalues: [\"save and go back\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"single-mode\",\n\t\t\t\tlabel: \"Change mode\",\n\t\t\t\tdescription: \"Switch to one theme for light and dark\",\n\t\t\t\tcurrentValue: \"switch to single theme\",\n\t\t\t\tvalues: [\"switch to single theme\"],\n\t\t\t},\n\t\t];\n\n\t\tconst settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"single-mode\":\n\t\t\t\t\t\tthis.mode = \"single\";\n\t\t\t\t\t\tthis.singleTheme = this.getActiveAutomaticTheme();\n\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.singleTheme);\n\t\t\t\t\t\tthis.showSingleMenu();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"apply\":\n\t\t\t\t\t\tthis.apply(this.getAutomaticThemeSetting());\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t);\n\t\tcontent.addChild(settingsList);\n\t\tthis.setContent(content, settingsList);\n\t}\n\n\tprivate createThemeSelect(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\tcurrentValue: string,\n\t\tdone: (selectedValue?: string) => void,\n\t\tonSelect: (value: string) => void,\n\t): SelectSubmenu {\n\t\treturn new SelectSubmenu(\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\tthemeItems(this.availableThemes, currentValue),\n\t\t\tcurrentValue,\n\t\t\tonSelect,\n\t\t\t() => {\n\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\tdone();\n\t\t\t},\n\t\t\t(value) => this.callbacks.onThemePreview?.(value),\n\t\t);\n\t}\n\n\tprivate getThemeSetting(): string {\n\t\treturn this.mode === \"automatic\" ? this.getAutomaticThemeSetting() : this.singleTheme;\n\t}\n\n\tprivate getActiveAutomaticTheme(): string {\n\t\treturn this.terminalTheme === \"light\" ? this.lightTheme : this.darkTheme;\n\t}\n\n\tprivate getAutomaticThemeSetting(): string {\n\t\treturn `${this.lightTheme}/${this.darkTheme}`;\n\t}\n\n\tprivate apply(themeSetting: string): void {\n\t\tthis.onDone(themeSetting);\n\t}\n\n\tprivate cancel(): void {\n\t\tthis.callbacks.onThemePreview?.(this.originalThemeSetting);\n\t\tthis.onDone();\n\t}\n}\n\n/**\n * Main settings selector component.\n */\nexport class SettingsSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(config: SettingsConfig, callbacks: SettingsCallbacks) {\n\t\tsuper();\n\n\t\tconst supportsImages = getCapabilities().images;\n\t\tconst followUpKey = keyDisplayText(\"app.message.followUp\");\n\t\tconst cycleThinkingKey = keyDisplayText(\"app.thinking.cycle\");\n\t\tlet currentWarnings = { ...config.warnings };\n\t\tconst currentModelThinkingLevels = { ...config.modelThinkingLevels };\n\t\tconst defaultModelByValue = new Map(\n\t\t\tconfig.availableDefaultModels.map((model) => [modelSettingKey(model), model]),\n\t\t);\n\t\tconst currentDefaultModelKey = defaultModelByValue.has(config.defaultModel) ? config.defaultModel : undefined;\n\t\tconst currentModelKey = config.currentModel ? modelSettingKey(config.currentModel) : undefined;\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"autocompact\",\n\t\t\t\tlabel: \"Auto-compact\",\n\t\t\t\tdescription: \"Automatically compact context when it gets too large\",\n\t\t\t\tcurrentValue: config.autoCompact ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"steering-mode\",\n\t\t\t\tlabel: \"Steering mode\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.\",\n\t\t\t\tcurrentValue: config.steeringMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"follow-up-mode\",\n\t\t\t\tlabel: \"Follow-up mode\",\n\t\t\t\tdescription: `${followUpKey} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,\n\t\t\t\tcurrentValue: config.followUpMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"transport\",\n\t\t\t\tlabel: \"Transport\",\n\t\t\t\tdescription: \"Preferred transport for providers that support multiple transports\",\n\t\t\t\tcurrentValue: config.transport,\n\t\t\t\tvalues: [\"sse\", \"websocket\", \"websocket-cached\", \"auto\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"http-idle-timeout\",\n\t\t\t\tlabel: \"HTTP idle timeout\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.\",\n\t\t\t\tcurrentValue: formatHttpIdleTimeoutMs(config.httpIdleTimeoutMs),\n\t\t\t\tvalues: HTTP_IDLE_TIMEOUT_CHOICES.map((choice) => choice.label),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-warming-mode\",\n\t\t\t\tlabel: \"Cache warming\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"off; streaming while the agent runs; idle also between runs while continuation stays profitable\",\n\t\t\t\tcurrentValue: config.cacheWarmingMode,\n\t\t\t\tvalues: [...CACHE_WARMING_MODES],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"hide-thinking\",\n\t\t\t\tlabel: \"Hide thinking\",\n\t\t\t\tdescription: \"Hide thinking blocks in assistant responses\",\n\t\t\t\tcurrentValue: config.hideThinkingBlock ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"chat-detail\",\n\t\t\t\tlabel: \"Conversation detail\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Overview collapses everything; details shows diffs and follows the Hide thinking preference; all shows full tool output and thinking\",\n\t\t\t\tcurrentValue: config.chatDetail,\n\t\t\t\tvalues: [...CHAT_DETAILS],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"mermaid-rendering\",\n\t\t\t\tlabel: \"Mermaid diagrams\",\n\t\t\t\tdescription: \"Render Mermaid code blocks as Unicode diagrams\",\n\t\t\t\tcurrentValue: config.mermaidRenderingMode,\n\t\t\t\tvalues: [\"off\", \"final\", \"streaming\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-miss-notices\",\n\t\t\t\tlabel: \"Cache miss notices\",\n\t\t\t\tdescription: \"Show transcript notices for cache costs and provider recovery diagnostics\",\n\t\t\t\tcurrentValue: config.showCacheMissNotices ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"collapse-changelog\",\n\t\t\t\tlabel: \"Collapse changelog\",\n\t\t\t\tdescription: \"Show condensed changelog after updates\",\n\t\t\t\tcurrentValue: config.collapseChangelog ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"quiet-startup\",\n\t\t\t\tlabel: \"Quiet startup\",\n\t\t\t\tdescription: \"Disable verbose printing at startup\",\n\t\t\t\tcurrentValue: config.quietStartup ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"send-provider-attribution\",\n\t\t\t\tlabel: \"Provider attribution headers\",\n\t\t\t\tdescription: \"Identify this CLI to your configured LLM provider (e.g. OpenRouter billing origin)\",\n\t\t\t\tcurrentValue: config.sendProviderAttribution ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"default-project-trust\",\n\t\t\t\tlabel: \"Default project trust\",\n\t\t\t\tdescription: \"Fallback behavior when no extension or saved trust decision decides project trust\",\n\t\t\t\tcurrentValue: DEFAULT_PROJECT_TRUST_LABELS[config.defaultProjectTrust],\n\t\t\t\tvalues: Object.values(DEFAULT_PROJECT_TRUST_LABELS),\n\t\t\t},\n\t\t\t...permissionModeItems(config.permissionMode, callbacks),\n\t\t\t{\n\t\t\t\tid: \"double-escape-action\",\n\t\t\t\tlabel: \"Double-escape action\",\n\t\t\t\tdescription: \"Action when pressing Escape twice with empty editor\",\n\t\t\t\tcurrentValue: config.doubleEscapeAction,\n\t\t\t\tvalues: [\"tree\", \"fork\", \"none\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tree-filter-mode\",\n\t\t\t\tlabel: \"Tree filter mode\",\n\t\t\t\tdescription: \"Default filter when opening /tree\",\n\t\t\t\tcurrentValue: config.treeFilterMode,\n\t\t\t\tvalues: [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"warnings\",\n\t\t\t\tlabel: \"Warnings\",\n\t\t\t\tdescription: \"Enable or disable individual warnings\",\n\t\t\t\tcurrentValue: \"configure\",\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew WarningSettingsSubmenu(\n\t\t\t\t\t\tcurrentWarnings,\n\t\t\t\t\t\t(warnings) => {\n\t\t\t\t\t\t\tcurrentWarnings = warnings;\n\t\t\t\t\t\t\tcallbacks.onWarningsChange(warnings);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => done(),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"model-thinking\",\n\t\t\t\tlabel: \"Default thinking level per model\",\n\t\t\t\tdescription: `Override the default thinking level for specific models. ${cycleThinkingKey} cycles in-session.`,\n\t\t\t\tcurrentValue: modelThinkingOverridesSummary(currentModelThinkingLevels),\n\t\t\t\tsubmenu: (_currentValue, done) => {\n\t\t\t\t\tconst steps: SteppedSubmenuStep[] = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"model\",\n\t\t\t\t\t\t\ttitle: \"Per-Model Thinking Level\",\n\t\t\t\t\t\t\tdescription: \"Select a model to configure\",\n\t\t\t\t\t\t\toptions: () => {\n\t\t\t\t\t\t\t\tconst sorted = [...config.availableDefaultModels].sort((a, b) => {\n\t\t\t\t\t\t\t\t\tconst aKey = modelSettingKey(a);\n\t\t\t\t\t\t\t\t\tconst bKey = modelSettingKey(b);\n\t\t\t\t\t\t\t\t\tif (aKey === currentModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentModelKey) return 1;\n\t\t\t\t\t\t\t\t\tif (aKey === currentDefaultModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentDefaultModelKey) return 1;\n\t\t\t\t\t\t\t\t\treturn a.provider.localeCompare(b.provider);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = sorted.map((model) => {\n\t\t\t\t\t\t\t\t\tconst key = modelSettingKey(model);\n\t\t\t\t\t\t\t\t\tconst override = currentModelThinkingLevels[key];\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tvalue: key,\n\t\t\t\t\t\t\t\t\t\tlabel: modelItemLabel(model),\n\t\t\t\t\t\t\t\t\t\tdescription: override ?? undefined,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (items.length === 0) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: \"__none__\",\n\t\t\t\t\t\t\t\t\t\tlabel: \"No models available\",\n\t\t\t\t\t\t\t\t\t\tdescription: \"Log in to a provider or configure an API key first\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: () => currentModelKey ?? currentDefaultModelKey,\n\t\t\t\t\t\t\tsearchable: true,\n\t\t\t\t\t\t\tlayout: MODEL_PICKER_LAYOUT,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"level\",\n\t\t\t\t\t\t\ttitle: (ctx) => {\n\t\t\t\t\t\t\t\tconst m = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\treturn `Thinking Level for ${m ? modelDisplayLabel(m) : ctx.model}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdescription: \"Select default thinking level for this model\",\n\t\t\t\t\t\t\toptions: (ctx) => {\n\t\t\t\t\t\t\t\tconst model = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\tif (!model) return [];\n\t\t\t\t\t\t\t\tconst levels = (\n\t\t\t\t\t\t\t\t\tmodel.reasoning ? getSupportedThinkingLevels(model) : [\"off\"]\n\t\t\t\t\t\t\t\t) as ThinkingLevel[];\n\t\t\t\t\t\t\t\tconst activeLevel = currentModelThinkingLevels[ctx.model];\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = levels.map((level) => ({\n\t\t\t\t\t\t\t\t\tvalue: level,\n\t\t\t\t\t\t\t\t\tlabel: `${level === activeLevel ? \"✓ \" : \" \"}${level}`,\n\t\t\t\t\t\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\tif (currentModelThinkingLevels[ctx.model] !== undefined) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: CLEAR_OVERRIDE_VALUE,\n\t\t\t\t\t\t\t\t\t\tlabel: \" (clear override)\",\n\t\t\t\t\t\t\t\t\t\tdescription: `Revert to global default (${config.thinkingLevel})`,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: (ctx) => currentModelThinkingLevels[ctx.model],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\n\t\t\t\t\tconst summary = () => modelThinkingOverridesSummary(currentModelThinkingLevels);\n\n\t\t\t\t\treturn new SteppedSubmenu(\n\t\t\t\t\t\tsteps,\n\t\t\t\t\t\t(selections) => {\n\t\t\t\t\t\t\tconst model = defaultModelByValue.get(selections.model);\n\t\t\t\t\t\t\tif (!model) return;\n\t\t\t\t\t\t\tif (selections.level === CLEAR_OVERRIDE_VALUE) {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelRemove(model.provider, model.id);\n\t\t\t\t\t\t\t\tdelete currentModelThinkingLevels[selections.model];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelChange(\n\t\t\t\t\t\t\t\t\tmodel.provider,\n\t\t\t\t\t\t\t\t\tmodel.id,\n\t\t\t\t\t\t\t\t\tselections.level as ThinkingLevel,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcurrentModelThinkingLevels[selections.model] = selections.level as ThinkingLevel;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tdone(summary());\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ loop: true },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tui-mode\",\n\t\t\t\tlabel: \"TUI mode\",\n\t\t\t\tdescription: \"Interface layout; fullscreen mode is experimental\",\n\t\t\t\tcurrentValue: config.tuiMode,\n\t\t\t\tvalues: [\"regular\", \"fullscreen\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-exit-output\",\n\t\t\t\tlabel: \"Fullscreen exit output\",\n\t\t\t\tdescription: \"Print the transcript or only a session resume hint when exiting fullscreen mode\",\n\t\t\t\tcurrentValue: config.fullscreenExitOutput,\n\t\t\t\tvalues: [\"transcript\", \"resume-hint\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-scrollbar\",\n\t\t\t\tlabel: \"Fullscreen scrollbar\",\n\t\t\t\tdescription: \"Scrollbar behavior in fullscreen mode; has no effect in regular mode\",\n\t\t\t\tcurrentValue: config.fullscreenScrollbar,\n\t\t\t\tvalues: [\"auto\", \"always\", \"hidden\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-copy-on-select\",\n\t\t\t\tlabel: \"Fullscreen copy on select\",\n\t\t\t\tdescription: \"Automatically copy selected text in fullscreen mode; disable to copy selections with Ctrl+X\",\n\t\t\t\tcurrentValue: config.fullscreenCopyOnSelect ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"theme\",\n\t\t\t\tlabel: \"Theme\",\n\t\t\t\tdescription: \"Color theme for the interface\",\n\t\t\t\tcurrentValue: config.currentTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tnew ThemeSubmenu(currentValue, config.terminalTheme, config.availableThemes, callbacks, done),\n\t\t\t},\n\t\t];\n\n\t\t// Only show image toggle if terminal supports it\n\t\tif (supportsImages) {\n\t\t\t// Insert after autocompact\n\t\t\titems.splice(1, 0, {\n\t\t\t\tid: \"show-images\",\n\t\t\t\tlabel: \"Show images\",\n\t\t\t\tdescription: \"Render images inline in terminal\",\n\t\t\t\tcurrentValue: config.showImages ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t});\n\t\t\titems.splice(2, 0, {\n\t\t\t\tid: \"image-width-cells\",\n\t\t\t\tlabel: \"Image width\",\n\t\t\t\tdescription: \"Preferred inline image width in terminal cells\",\n\t\t\t\tcurrentValue: String(config.imageWidthCells),\n\t\t\t\tvalues: [\"60\", \"80\", \"120\"],\n\t\t\t});\n\t\t}\n\n\t\t// Image auto-resize toggle (always available, affects both attached and read images)\n\t\titems.splice(supportsImages ? 3 : 1, 0, {\n\t\t\tid: \"auto-resize-images\",\n\t\t\tlabel: \"Auto-resize images\",\n\t\t\tdescription: \"Resize large images to 2000x2000 max for better model compatibility\",\n\t\t\tcurrentValue: config.autoResizeImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Block images toggle (always available, insert after auto-resize-images)\n\t\tconst autoResizeIndex = items.findIndex((item) => item.id === \"auto-resize-images\");\n\t\titems.splice(autoResizeIndex + 1, 0, {\n\t\t\tid: \"block-images\",\n\t\t\tlabel: \"Block images\",\n\t\t\tdescription: \"Prevent images from being sent to LLM providers\",\n\t\t\tcurrentValue: config.blockImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Skill commands toggle (insert after block-images)\n\t\tconst blockImagesIndex = items.findIndex((item) => item.id === \"block-images\");\n\t\titems.splice(blockImagesIndex + 1, 0, {\n\t\t\tid: \"skill-commands\",\n\t\t\tlabel: \"Skill commands\",\n\t\t\tdescription: \"Register skills as /skill:name commands\",\n\t\t\tcurrentValue: config.enableSkillCommands ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Hardware cursor toggle (insert after skill-commands)\n\t\tconst skillCommandsIndex = items.findIndex((item) => item.id === \"skill-commands\");\n\t\titems.splice(skillCommandsIndex + 1, 0, {\n\t\t\tid: \"show-hardware-cursor\",\n\t\t\tlabel: \"Show hardware cursor\",\n\t\t\tdescription: \"Show the terminal cursor while still positioning it for IME support\",\n\t\t\tcurrentValue: config.showHardwareCursor ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Editor padding toggle (insert after show-hardware-cursor)\n\t\tconst hardwareCursorIndex = items.findIndex((item) => item.id === \"show-hardware-cursor\");\n\t\titems.splice(hardwareCursorIndex + 1, 0, {\n\t\t\tid: \"editor-padding\",\n\t\t\tlabel: \"Editor padding\",\n\t\t\tdescription: \"Horizontal padding for input editor (0-3)\",\n\t\t\tcurrentValue: String(config.editorPaddingX),\n\t\t\tvalues: [\"0\", \"1\", \"2\", \"3\"],\n\t\t});\n\n\t\t// Output padding toggle (insert after editor-padding)\n\t\tconst editorPaddingIndex = items.findIndex((item) => item.id === \"editor-padding\");\n\t\titems.splice(editorPaddingIndex + 1, 0, {\n\t\t\tid: \"output-padding\",\n\t\t\tlabel: \"Output padding\",\n\t\t\tdescription: \"Horizontal padding for user messages, assistant messages, and thinking\",\n\t\t\tcurrentValue: String(config.outputPad),\n\t\t\tvalues: [\"0\", \"1\"],\n\t\t});\n\n\t\t// Autocomplete max visible toggle (insert after output-padding)\n\t\tconst outputPaddingIndex = items.findIndex((item) => item.id === \"output-padding\");\n\t\titems.splice(outputPaddingIndex + 1, 0, {\n\t\t\tid: \"autocomplete-max-visible\",\n\t\t\tlabel: \"Autocomplete max items\",\n\t\t\tdescription: \"Max visible items in autocomplete dropdown (3-20)\",\n\t\t\tcurrentValue: String(config.autocompleteMaxVisible),\n\t\t\tvalues: [\"3\", \"5\", \"7\", \"10\", \"15\", \"20\"],\n\t\t});\n\n\t\t// Clear on shrink toggle (insert after autocomplete-max-visible)\n\t\tconst autocompleteIndex = items.findIndex((item) => item.id === \"autocomplete-max-visible\");\n\t\titems.splice(autocompleteIndex + 1, 0, {\n\t\t\tid: \"clear-on-shrink\",\n\t\t\tlabel: \"Clear on shrink\",\n\t\t\tdescription: \"Clear empty rows when content shrinks (may cause flicker)\",\n\t\t\tcurrentValue: config.clearOnShrink ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Terminal progress toggle (insert after clear-on-shrink)\n\t\tconst clearOnShrinkIndex = items.findIndex((item) => item.id === \"clear-on-shrink\");\n\t\titems.splice(clearOnShrinkIndex + 1, 0, {\n\t\t\tid: \"terminal-progress\",\n\t\t\tlabel: \"Terminal progress\",\n\t\t\tdescription: \"Show OSC 9;4 progress indicators in the terminal tab bar\",\n\t\t\tcurrentValue: config.showTerminalProgress ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Add borders\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Settings\")), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\t10,\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"autocompact\":\n\t\t\t\t\t\tcallbacks.onAutoCompactChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-images\":\n\t\t\t\t\t\tcallbacks.onShowImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image-width-cells\":\n\t\t\t\t\t\tcallbacks.onImageWidthCellsChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"auto-resize-images\":\n\t\t\t\t\t\tcallbacks.onAutoResizeImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"block-images\":\n\t\t\t\t\t\tcallbacks.onBlockImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"skill-commands\":\n\t\t\t\t\t\tcallbacks.onEnableSkillCommandsChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"steering-mode\":\n\t\t\t\t\t\tcallbacks.onSteeringModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"follow-up-mode\":\n\t\t\t\t\t\tcallbacks.onFollowUpModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"transport\":\n\t\t\t\t\t\tcallbacks.onTransportChange(newValue as Transport);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"http-idle-timeout\": {\n\t\t\t\t\t\tconst choice = HTTP_IDLE_TIMEOUT_CHOICES.find((item) => item.label === newValue);\n\t\t\t\t\t\tif (choice) {\n\t\t\t\t\t\t\tcallbacks.onHttpIdleTimeoutMsChange(choice.timeoutMs);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"cache-warming-mode\":\n\t\t\t\t\t\tcallbacks.onCacheWarmingModeChange(newValue as CacheWarmingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"hide-thinking\":\n\t\t\t\t\t\tcallbacks.onHideThinkingBlockChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"chat-detail\":\n\t\t\t\t\t\tcallbacks.onChatDetailChange(newValue as ChatDetail);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"mermaid-rendering\":\n\t\t\t\t\t\tcallbacks.onMermaidRenderingModeChange(newValue as MermaidRenderingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"cache-miss-notices\":\n\t\t\t\t\t\tcallbacks.onShowCacheMissNoticesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"collapse-changelog\":\n\t\t\t\t\t\tcallbacks.onCollapseChangelogChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"quiet-startup\":\n\t\t\t\t\t\tcallbacks.onQuietStartupChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"send-provider-attribution\":\n\t\t\t\t\t\tcallbacks.onSendProviderAttributionChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"default-project-trust\": {\n\t\t\t\t\t\tconst defaultProjectTrust = DEFAULT_PROJECT_TRUST_BY_LABEL.get(newValue);\n\t\t\t\t\t\tif (defaultProjectTrust) {\n\t\t\t\t\t\t\tcallbacks.onDefaultProjectTrustChange(defaultProjectTrust);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"double-escape-action\":\n\t\t\t\t\t\tcallbacks.onDoubleEscapeActionChange(newValue as \"fork\" | \"tree\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tree-filter-mode\":\n\t\t\t\t\t\tcallbacks.onTreeFilterModeChange(\n\t\t\t\t\t\t\tnewValue as \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-hardware-cursor\":\n\t\t\t\t\t\tcallbacks.onShowHardwareCursorChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"editor-padding\":\n\t\t\t\t\t\tcallbacks.onEditorPaddingXChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"output-padding\":\n\t\t\t\t\t\tcallbacks.onOutputPadChange(newValue === \"0\" ? 0 : 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"autocomplete-max-visible\":\n\t\t\t\t\t\tcallbacks.onAutocompleteMaxVisibleChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"clear-on-shrink\":\n\t\t\t\t\t\tcallbacks.onClearOnShrinkChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"terminal-progress\":\n\t\t\t\t\t\tcallbacks.onShowTerminalProgressChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tui-mode\":\n\t\t\t\t\t\tcallbacks.onTuiModeChange(newValue as TuiMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-exit-output\":\n\t\t\t\t\t\tcallbacks.onFullscreenExitOutputChange(newValue as FullscreenExitOutput);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-scrollbar\":\n\t\t\t\t\t\tcallbacks.onFullscreenScrollbarChange(newValue as ScrollViewScrollbar);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-copy-on-select\":\n\t\t\t\t\t\tcallbacks.onFullscreenCopyOnSelectChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"theme\":\n\t\t\t\t\t\tcallbacks.onThemeChange(newValue);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcallbacks.onCancel,\n\t\t\t{ enableSearch: true },\n\t\t);\n\n\t\t// `pi-tui` builds this list's search box itself, so its prompt is swapped on the way out.\n\t\tconst settingsList = this.settingsList;\n\t\tthis.addChild({\n\t\t\trender: (width: number) => {\n\t\t\t\tconst lines = settingsList.render(width);\n\t\t\t\treturn lines.length > 0 ? [withComposerPrompt(lines[0]!), ...lines.slice(1)] : lines;\n\t\t\t},\n\t\t\tinvalidate: () => settingsList.invalidate(),\n\t\t});\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSettingsList(): SettingsList {\n\t\treturn this.settingsList;\n\t}\n}\n"]}
1
+ {"version":3,"file":"settings-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-selector.ts"],"names":[],"mappings":"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","sourcesContent":["import { getSupportedThinkingLevels, type Model, type Transport } from \"@earendil-works/pi-ai\";\nimport {\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\ttype ScrollViewScrollbar,\n\ttype SelectItem,\n\ttype SettingItem,\n\tSettingsList,\n\ttype SettingsListTheme,\n\tSpacer,\n\tText,\n} from \"@earendil-works/pi-tui\";\nimport type { ThinkingLevel } from \"apex-code-agent-core\";\nimport { formatHttpIdleTimeoutMs, HTTP_IDLE_TIMEOUT_CHOICES } from \"../../../core/http-dispatcher.ts\";\nimport type { PermissionModeOrigin } from \"../../../core/permissions/startup.ts\";\nimport { PERMISSION_MODES, type PermissionMode } from \"../../../core/permissions/store.ts\";\nimport {\n\tCACHE_WARMING_MODES,\n\ttype CacheWarmingMode,\n\tCHAT_DETAILS,\n\ttype ChatDetail,\n\ttype DefaultProjectTrust,\n\ttype FullscreenExitOutput,\n\ttype MermaidRenderingMode,\n\ttype TuiMode,\n\ttype WarningSettings,\n} from \"../../../core/settings-manager.ts\";\nimport { getSettingsListTheme, parseAutoThemeSetting, type TerminalTheme, theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { hintRow, keyDisplayText } from \"./keybinding-hints.ts\";\nimport { withComposerPrompt } from \"./prompt-input.ts\";\nimport { SelectSubmenu, SteppedSubmenu, type SteppedSubmenuStep } from \"./settings-submenu.ts\";\n\n/** The two hint rows `pi-tui`'s settings list writes, with and without search. */\nconst SETTINGS_LIST_HINT_ROWS = new Set([\n\t\"Type to search · Enter/Space to change · Esc to cancel\",\n\t\"Enter/Space to change · Esc to cancel\",\n]);\n\n/**\n * The settings list is `pi-tui`'s and writes its own hint row, but the theme it paints with is\n * ours, so the row is swapped here for the shared grammar. The search box's prompt already\n * says typing searches.\n */\nfunction getSettingsSelectorListTheme(): SettingsListTheme {\n\tconst base = getSettingsListTheme();\n\treturn {\n\t\t...base,\n\t\thint: (text: string) =>\n\t\t\tSETTINGS_LIST_HINT_ROWS.has(text.trim())\n\t\t\t\t? hintRow([\n\t\t\t\t\t\t[[\"tui.select.confirm\", { literal: \"space\" }], \"change\"],\n\t\t\t\t\t\t[\"tui.select.cancel\", \"close\"],\n\t\t\t\t\t])\n\t\t\t\t: base.hint(text),\n\t};\n}\n\nconst MODEL_PICKER_LAYOUT = { minPrimaryColumnWidth: 12, maxPrimaryColumnWidth: 46 };\n\nconst THINKING_DESCRIPTIONS: Record<ThinkingLevel, string> = {\n\toff: \"No reasoning\",\n\tminimal: \"Very brief reasoning (~1k tokens)\",\n\tlow: \"Light reasoning (~2k tokens)\",\n\tmedium: \"Moderate reasoning (~8k tokens)\",\n\thigh: \"Deep reasoning (~16k tokens)\",\n\txhigh: \"Extra-high reasoning (~32k tokens)\",\n\tmax: \"Maximum reasoning\",\n};\n\nconst DEFAULT_PROJECT_TRUST_LABELS: Record<DefaultProjectTrust, string> = {\n\task: \"Ask\",\n\talways: \"Always trust\",\n\tnever: \"Never trust\",\n};\n\nconst DEFAULT_PROJECT_TRUST_BY_LABEL = new Map(\n\tObject.entries(DEFAULT_PROJECT_TRUST_LABELS).map(([value, label]) => [label, value as DefaultProjectTrust]),\n);\n\nconst PERMISSION_MODE_DESCRIPTIONS: Record<PermissionMode, string> = {\n\tdefault: \"Ask for anything policy does not already allow\",\n\tplan: \"Block file writes, commands, and delegation while you investigate\",\n\tacceptEdits: \"Auto-allow file edits inside the workspace; still ask for anything outside it, commands and network\",\n\tdontAsk: \"Never prompt; deny anything not already permitted\",\n\tbypassPermissions: \"Allow every tool call without asking\",\n};\n\n/**\n * What outranks a user-scope write, phrased for someone deciding whether to bother.\n * `user` and `default` are absent because neither shadows anything this menu writes.\n */\nexport const PERMISSION_MODE_OVERRIDE_HINTS: Partial<Record<PermissionModeOrigin, string>> = {\n\tinteractive: \"the interactive permission mode\",\n\tflag: \"--permission-mode on the command line\",\n\tlocal: \".apex-code/permissions.local.json in this project\",\n\tproject: \".apex-code/permissions.json in this project\",\n\tcommand: \"a command-scoped override in this session\",\n\tsession: \"a session-scoped override\",\n};\n\n/** Empty when the session has no permission gate, so the row simply does not exist. */\nfunction permissionModeItems(current: SettingsConfig[\"permissionMode\"], callbacks: SettingsCallbacks): SettingItem[] {\n\tif (!current) return [];\n\treturn [\n\t\t{\n\t\t\tid: \"permission-mode\",\n\t\t\tlabel: \"Permission mode\",\n\t\t\tdescription:\n\t\t\t\tPERMISSION_MODE_DESCRIPTIONS[current.mode] +\n\t\t\t\t(current.origin === \"interactive\" ? \" The saved default is shadowed for this session.\" : \"\"),\n\t\t\tcurrentValue: current.mode,\n\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\tnew PermissionModeSubmenu(\n\t\t\t\t\tcurrentValue as PermissionMode,\n\t\t\t\t\tcurrent.origin,\n\t\t\t\t\t(mode) => callbacks.onPermissionModeChange(mode),\n\t\t\t\t\tdone,\n\t\t\t\t),\n\t\t},\n\t];\n}\n\nexport interface SettingsConfig {\n\ttaskListTool?: { enabled: boolean; projectControlled: boolean };\n\tautoCompact: boolean;\n\tdefaultModel: string;\n\tcurrentModel?: Model<any>;\n\tavailableDefaultModels: readonly Model<any>[];\n\tshowImages: boolean;\n\timageWidthCells: number;\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tenableSkillCommands: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\ttransport: Transport;\n\thttpIdleTimeoutMs: number;\n\tcacheWarmingMode: CacheWarmingMode;\n\tthinkingLevel: ThinkingLevel;\n\tavailableThinkingLevels: ThinkingLevel[];\n\tmodelThinkingLevels: Record<string, ThinkingLevel>;\n\tcurrentTheme: string;\n\tterminalTheme: TerminalTheme;\n\tavailableThemes: string[];\n\thideThinkingBlock: boolean;\n\tchatDetail: ChatDetail;\n\tmermaidRenderingMode: MermaidRenderingMode;\n\tshowCacheMissNotices: boolean;\n\tcollapseChangelog: boolean;\n\tsendProviderAttribution: boolean;\n\tdoubleEscapeAction: \"fork\" | \"tree\" | \"none\";\n\ttreeFilterMode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\";\n\tshowHardwareCursor: boolean;\n\teditorPaddingX: number;\n\toutputPad: 0 | 1;\n\tautocompleteMaxVisible: number;\n\tquietStartup: boolean;\n\tdefaultProjectTrust: DefaultProjectTrust;\n\t/** Absent when the session runs without a permission gate; the row is then hidden. */\n\tpermissionMode?: { mode: PermissionMode; origin: PermissionModeOrigin };\n\tclearOnShrink: boolean;\n\tshowTerminalProgress: boolean;\n\ttuiMode: TuiMode;\n\tfullscreenExitOutput: FullscreenExitOutput;\n\tfullscreenScrollbar: ScrollViewScrollbar;\n\tfullscreenCopyOnSelect: boolean;\n\twarnings: WarningSettings;\n}\n\nexport interface SettingsCallbacks {\n\tonTaskListToolChange?: (enabled: boolean) => void;\n\tonAutoCompactChange: (enabled: boolean) => void;\n\tonShowImagesChange: (enabled: boolean) => void;\n\tonImageWidthCellsChange: (width: number) => void;\n\tonAutoResizeImagesChange: (enabled: boolean) => void;\n\tonBlockImagesChange: (blocked: boolean) => void;\n\tonEnableSkillCommandsChange: (enabled: boolean) => void;\n\tonSteeringModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonFollowUpModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonTransportChange: (transport: Transport) => void;\n\tonHttpIdleTimeoutMsChange: (timeoutMs: number) => void;\n\tonCacheWarmingModeChange: (mode: CacheWarmingMode) => void;\n\tonModelThinkingLevelChange: (provider: string, modelId: string, level: ThinkingLevel) => void;\n\tonModelThinkingLevelRemove: (provider: string, modelId: string) => void;\n\tonThemeChange: (theme: string) => void;\n\tonThemePreview?: (theme: string) => void;\n\tonHideThinkingBlockChange: (hidden: boolean) => void;\n\tonChatDetailChange: (detail: ChatDetail) => void;\n\tonMermaidRenderingModeChange: (mode: MermaidRenderingMode) => void;\n\tonShowCacheMissNoticesChange: (shown: boolean) => void;\n\tonCollapseChangelogChange: (collapsed: boolean) => void;\n\tonSendProviderAttributionChange: (enabled: boolean) => void;\n\tonDoubleEscapeActionChange: (action: \"fork\" | \"tree\" | \"none\") => void;\n\tonTreeFilterModeChange: (mode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\") => void;\n\tonShowHardwareCursorChange: (enabled: boolean) => void;\n\tonEditorPaddingXChange: (padding: number) => void;\n\tonOutputPadChange: (padding: 0 | 1) => void;\n\tonAutocompleteMaxVisibleChange: (maxVisible: number) => void;\n\tonQuietStartupChange: (enabled: boolean) => void;\n\tonDefaultProjectTrustChange: (defaultProjectTrust: DefaultProjectTrust) => void;\n\tonPermissionModeChange: (mode: PermissionMode) => void;\n\tonClearOnShrinkChange: (enabled: boolean) => void;\n\tonShowTerminalProgressChange: (enabled: boolean) => void;\n\tonTuiModeChange: (mode: TuiMode) => void;\n\tonFullscreenExitOutputChange: (output: FullscreenExitOutput) => void;\n\tonFullscreenScrollbarChange: (mode: ScrollViewScrollbar) => void;\n\tonFullscreenCopyOnSelectChange: (enabled: boolean) => void;\n\tonWarningsChange: (warnings: WarningSettings) => void;\n\tonCancel: () => void;\n}\n\n/**\n * A submenu component for selecting from a list of options.\n */\nclass WarningSettingsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate state: WarningSettings;\n\n\tconstructor(warnings: WarningSettings, onChange: (warnings: WarningSettings) => void, onCancel: () => void) {\n\t\tsuper();\n\n\t\tthis.state = { ...warnings };\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"anthropic-extra-usage\",\n\t\t\t\tlabel: \"Anthropic extra usage\",\n\t\t\t\tdescription: \"Warn when Anthropic subscription auth may use paid extra usage\",\n\t\t\t\tcurrentValue: (this.state.anthropicExtraUsage ?? true) ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"anthropic-extra-usage\":\n\t\t\t\t\t\tthis.state = { ...this.state, anthropicExtraUsage: newValue === \"true\" };\n\t\t\t\t\t\tonChange({ ...this.state });\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tonCancel,\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\nconst CLEAR_OVERRIDE_VALUE = \"__clear__\";\n\nfunction modelSettingKey(model: Model<any>): string {\n\treturn `${model.provider}/${model.id}`;\n}\n\nfunction modelDisplayLabel(model: Model<any>): string {\n\treturn `${model.id} [${model.provider}]`;\n}\n\nfunction modelThinkingOverridesSummary(overrides: Record<string, ThinkingLevel>): string {\n\tconst count = Object.keys(overrides).length;\n\tif (count === 0) return \"none\";\n\treturn `${count} configured`;\n}\n\nfunction modelItemLabel(model: Model<any>): string {\n\treturn `${model.id} ${theme.fg(\"muted\", `[${model.provider}]`)}`;\n}\n\n/**\n * Permission mode picker, mode list then a confirm step for `bypassPermissions`.\n * The confirm exists because the mode list is arrow-cyclable like every other\n * settings row, so \"allow every tool call\" is otherwise one stray keypress away.\n */\nclass PermissionModeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly current: PermissionMode;\n\tprivate readonly origin: PermissionModeOrigin;\n\tprivate readonly onSelect: (mode: PermissionMode) => void;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\n\tconstructor(\n\t\tcurrent: PermissionMode,\n\t\torigin: PermissionModeOrigin,\n\t\tonSelect: (mode: PermissionMode) => void,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.current = current;\n\t\tthis.origin = origin;\n\t\tthis.onSelect = onSelect;\n\t\tthis.onDone = onDone;\n\t\tthis.showModeList();\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(component: Component): void {\n\t\tthis.clear();\n\t\tthis.addChild(component);\n\t\tthis.inputComponent = component;\n\t}\n\n\tprivate description(): string {\n\t\tif (this.origin === \"interactive\") {\n\t\t\treturn \"Saved to user scope for future sessions. The saved default is shadowed by the interactive mode for this session.\";\n\t\t}\n\t\tconst overridden =\n\t\t\tthis.origin !== \"user\" && this.origin !== \"default\"\n\t\t\t\t? ` Currently set by ${PERMISSION_MODE_OVERRIDE_HINTS[this.origin]}.`\n\t\t\t\t: \"\";\n\t\treturn `Saved to user scope and applied to the next tool call.${overridden}`;\n\t}\n\n\tprivate showModeList(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Permission mode\",\n\t\t\t\tthis.description(),\n\t\t\t\tPERMISSION_MODES.map((mode) => ({\n\t\t\t\t\tvalue: mode,\n\t\t\t\t\tlabel: mode,\n\t\t\t\t\tdescription: PERMISSION_MODE_DESCRIPTIONS[mode],\n\t\t\t\t})),\n\t\t\t\tthis.current,\n\t\t\t\t(value) => {\n\t\t\t\t\tconst mode = value as PermissionMode;\n\t\t\t\t\tif (mode === \"bypassPermissions\") {\n\t\t\t\t\t\tthis.showBypassConfirm();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(mode);\n\t\t\t\t\tthis.onDone(mode);\n\t\t\t\t},\n\t\t\t\t() => this.onDone(),\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate showBypassConfirm(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Bypass all permission checks?\",\n\t\t\t\t\"Every tool call runs without asking, in every project, until you change this back. Nothing else confines the session: it writes anywhere your account can and reaches any host. Run inside a container or VM if the work is untrusted.\",\n\t\t\t\t[\n\t\t\t\t\t{ value: \"no\", label: `No, keep ${this.current}`, description: \"Return to the mode list\" },\n\t\t\t\t\t{ value: \"yes\", label: \"Yes, bypass\", description: \"Allow every tool call without asking\" },\n\t\t\t\t],\n\t\t\t\t\"no\",\n\t\t\t\t(value) => {\n\t\t\t\t\tif (value !== \"yes\") {\n\t\t\t\t\t\tthis.showModeList();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(\"bypassPermissions\");\n\t\t\t\t\tthis.onDone(\"bypassPermissions\");\n\t\t\t\t},\n\t\t\t\t() => this.showModeList(),\n\t\t\t),\n\t\t);\n\t}\n}\n\nfunction themeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn availableThemes.map((name) => ({\n\t\tvalue: name,\n\t\tlabel: `${name === currentTheme ? \"✓ \" : \" \"}${name}`,\n\t}));\n}\n\nconst AUTOMATIC_THEME_VALUE = \"/\";\n\nfunction singleModeThemeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn [\n\t\t{\n\t\t\tvalue: AUTOMATIC_THEME_VALUE,\n\t\t\tlabel: \" Automatic\",\n\t\t\tdescription: \"Use separate themes for light and dark terminal appearance\",\n\t\t},\n\t\t...themeItems(availableThemes, currentTheme),\n\t];\n}\n\nfunction preferredTheme(availableThemes: string[], preferred: string | undefined, fallback: string): string {\n\tif (preferred && availableThemes.includes(preferred)) return preferred;\n\tif (availableThemes.includes(fallback)) return fallback;\n\treturn availableThemes[0] ?? fallback;\n}\n\nfunction defaultAutomaticThemes(\n\tcurrentThemeSetting: string,\n\tavailableThemes: string[],\n): { lightTheme: string; darkTheme: string } {\n\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\tif (autoTheme) return autoTheme;\n\n\tconst currentFixedTheme = currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\tconst themeName = preferredTheme(availableThemes, currentFixedTheme, \"dark\");\n\treturn { lightTheme: themeName, darkTheme: themeName };\n}\n\nclass ThemeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly callbacks: SettingsCallbacks;\n\tprivate readonly availableThemes: string[];\n\tprivate readonly terminalTheme: TerminalTheme;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\tprivate readonly originalThemeSetting: string;\n\tprivate mode: \"single\" | \"automatic\";\n\tprivate singleTheme: string;\n\tprivate lightTheme: string;\n\tprivate darkTheme: string;\n\n\tconstructor(\n\t\tcurrentThemeSetting: string,\n\t\tterminalTheme: TerminalTheme,\n\t\tavailableThemes: string[],\n\t\tcallbacks: SettingsCallbacks,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.callbacks = callbacks;\n\t\tthis.availableThemes = availableThemes;\n\t\tthis.terminalTheme = terminalTheme;\n\t\tthis.onDone = onDone;\n\t\tthis.originalThemeSetting = currentThemeSetting;\n\t\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\t\tconst automaticThemes = defaultAutomaticThemes(currentThemeSetting, availableThemes);\n\t\tconst fixedTheme = autoTheme || currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\t\tthis.mode = autoTheme ? \"automatic\" : \"single\";\n\t\tthis.lightTheme = automaticThemes.lightTheme;\n\t\tthis.darkTheme = automaticThemes.darkTheme;\n\t\tthis.singleTheme = preferredTheme(\n\t\t\tavailableThemes,\n\t\t\tfixedTheme ?? (autoTheme ? this.getActiveAutomaticTheme() : undefined),\n\t\t\t\"dark\",\n\t\t);\n\n\t\tif (this.mode === \"automatic\") {\n\t\t\tthis.showAutomaticMenu();\n\t\t} else {\n\t\t\tthis.showSingleMenu();\n\t\t}\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(renderComponent: Component, inputComponent: Component = renderComponent): void {\n\t\tthis.clear();\n\t\tthis.addChild(renderComponent);\n\t\tthis.inputComponent = inputComponent;\n\t}\n\n\tprivate showSingleMenu(): void {\n\t\tthis.mode = \"single\";\n\t\tconst menu = new SelectSubmenu(\n\t\t\t\"Theme\",\n\t\t\t\"Select a theme, or choose Automatic to follow terminal appearance.\",\n\t\t\tsingleModeThemeItems(this.availableThemes, this.singleTheme),\n\t\t\tthis.singleTheme,\n\t\t\t(value) => {\n\t\t\t\tif (value === AUTOMATIC_THEME_VALUE) {\n\t\t\t\t\tthis.mode = \"automatic\";\n\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\tthis.showAutomaticMenu();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.singleTheme = value;\n\t\t\t\tthis.apply(value);\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t\t(value) => {\n\t\t\t\tthis.callbacks.onThemePreview?.(value === AUTOMATIC_THEME_VALUE ? this.getAutomaticThemeSetting() : value);\n\t\t\t},\n\t\t);\n\t\tthis.setContent(menu);\n\t}\n\n\tprivate showAutomaticMenu(): void {\n\t\tthis.mode = \"automatic\";\n\t\tconst content = new Container();\n\t\tcontent.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Automatic theme\")), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Choose themes for terminal light and dark appearance.\"), 0, 0));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Light/dark detection requires terminal support.\"), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"light-theme\",\n\t\t\t\tlabel: \"Light theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is light\",\n\t\t\t\tcurrentValue: this.lightTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Light Theme\",\n\t\t\t\t\t\t\"Select the theme to use for light terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.lightTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"dark-theme\",\n\t\t\t\tlabel: \"Dark theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is dark\",\n\t\t\t\tcurrentValue: this.darkTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Dark Theme\",\n\t\t\t\t\t\t\"Select the theme to use for dark terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.darkTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"apply\",\n\t\t\t\tlabel: \"Apply\",\n\t\t\t\tdescription: \"Save and go back\",\n\t\t\t\tcurrentValue: \"save and go back\",\n\t\t\t\tvalues: [\"save and go back\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"single-mode\",\n\t\t\t\tlabel: \"Change mode\",\n\t\t\t\tdescription: \"Switch to one theme for light and dark\",\n\t\t\t\tcurrentValue: \"switch to single theme\",\n\t\t\t\tvalues: [\"switch to single theme\"],\n\t\t\t},\n\t\t];\n\n\t\tconst settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"single-mode\":\n\t\t\t\t\t\tthis.mode = \"single\";\n\t\t\t\t\t\tthis.singleTheme = this.getActiveAutomaticTheme();\n\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.singleTheme);\n\t\t\t\t\t\tthis.showSingleMenu();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"apply\":\n\t\t\t\t\t\tthis.apply(this.getAutomaticThemeSetting());\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t);\n\t\tcontent.addChild(settingsList);\n\t\tthis.setContent(content, settingsList);\n\t}\n\n\tprivate createThemeSelect(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\tcurrentValue: string,\n\t\tdone: (selectedValue?: string) => void,\n\t\tonSelect: (value: string) => void,\n\t): SelectSubmenu {\n\t\treturn new SelectSubmenu(\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\tthemeItems(this.availableThemes, currentValue),\n\t\t\tcurrentValue,\n\t\t\tonSelect,\n\t\t\t() => {\n\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\tdone();\n\t\t\t},\n\t\t\t(value) => this.callbacks.onThemePreview?.(value),\n\t\t);\n\t}\n\n\tprivate getThemeSetting(): string {\n\t\treturn this.mode === \"automatic\" ? this.getAutomaticThemeSetting() : this.singleTheme;\n\t}\n\n\tprivate getActiveAutomaticTheme(): string {\n\t\treturn this.terminalTheme === \"light\" ? this.lightTheme : this.darkTheme;\n\t}\n\n\tprivate getAutomaticThemeSetting(): string {\n\t\treturn `${this.lightTheme}/${this.darkTheme}`;\n\t}\n\n\tprivate apply(themeSetting: string): void {\n\t\tthis.onDone(themeSetting);\n\t}\n\n\tprivate cancel(): void {\n\t\tthis.callbacks.onThemePreview?.(this.originalThemeSetting);\n\t\tthis.onDone();\n\t}\n}\n\n/**\n * Main settings selector component.\n */\nexport class SettingsSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(config: SettingsConfig, callbacks: SettingsCallbacks) {\n\t\tsuper();\n\n\t\tconst supportsImages = getCapabilities().images;\n\t\tconst followUpKey = keyDisplayText(\"app.message.followUp\");\n\t\tconst cycleThinkingKey = keyDisplayText(\"app.thinking.cycle\");\n\t\tlet currentWarnings = { ...config.warnings };\n\t\tconst currentModelThinkingLevels = { ...config.modelThinkingLevels };\n\t\tconst defaultModelByValue = new Map(\n\t\t\tconfig.availableDefaultModels.map((model) => [modelSettingKey(model), model]),\n\t\t);\n\t\tconst currentDefaultModelKey = defaultModelByValue.has(config.defaultModel) ? config.defaultModel : undefined;\n\t\tconst currentModelKey = config.currentModel ? modelSettingKey(config.currentModel) : undefined;\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"autocompact\",\n\t\t\t\tlabel: \"Auto-compact\",\n\t\t\t\tdescription: \"Automatically compact context when it gets too large\",\n\t\t\t\tcurrentValue: config.autoCompact ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"steering-mode\",\n\t\t\t\tlabel: \"Steering mode\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.\",\n\t\t\t\tcurrentValue: config.steeringMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"follow-up-mode\",\n\t\t\t\tlabel: \"Follow-up mode\",\n\t\t\t\tdescription: `${followUpKey} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,\n\t\t\t\tcurrentValue: config.followUpMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"transport\",\n\t\t\t\tlabel: \"Transport\",\n\t\t\t\tdescription: \"Preferred transport for providers that support multiple transports\",\n\t\t\t\tcurrentValue: config.transport,\n\t\t\t\tvalues: [\"sse\", \"websocket\", \"websocket-cached\", \"auto\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"http-idle-timeout\",\n\t\t\t\tlabel: \"HTTP idle timeout\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.\",\n\t\t\t\tcurrentValue: formatHttpIdleTimeoutMs(config.httpIdleTimeoutMs),\n\t\t\t\tvalues: HTTP_IDLE_TIMEOUT_CHOICES.map((choice) => choice.label),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-warming-mode\",\n\t\t\t\tlabel: \"Cache warming\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"off; streaming while the agent runs; idle also between runs while continuation stays profitable\",\n\t\t\t\tcurrentValue: config.cacheWarmingMode,\n\t\t\t\tvalues: [...CACHE_WARMING_MODES],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"hide-thinking\",\n\t\t\t\tlabel: \"Hide thinking\",\n\t\t\t\tdescription: \"Hide thinking blocks in assistant responses\",\n\t\t\t\tcurrentValue: config.hideThinkingBlock ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"chat-detail\",\n\t\t\t\tlabel: \"Conversation detail\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Overview collapses everything; details shows diffs and follows the Hide thinking preference; all shows full tool output and thinking\",\n\t\t\t\tcurrentValue: config.chatDetail,\n\t\t\t\tvalues: [...CHAT_DETAILS],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"mermaid-rendering\",\n\t\t\t\tlabel: \"Mermaid diagrams\",\n\t\t\t\tdescription: \"Render Mermaid code blocks as Unicode diagrams\",\n\t\t\t\tcurrentValue: config.mermaidRenderingMode,\n\t\t\t\tvalues: [\"off\", \"final\", \"streaming\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-miss-notices\",\n\t\t\t\tlabel: \"Cache miss notices\",\n\t\t\t\tdescription: \"Show transcript notices for cache costs and provider recovery diagnostics\",\n\t\t\t\tcurrentValue: config.showCacheMissNotices ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"collapse-changelog\",\n\t\t\t\tlabel: \"Collapse changelog\",\n\t\t\t\tdescription: \"Show condensed changelog after updates\",\n\t\t\t\tcurrentValue: config.collapseChangelog ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"quiet-startup\",\n\t\t\t\tlabel: \"Quiet startup\",\n\t\t\t\tdescription: \"Disable verbose printing at startup\",\n\t\t\t\tcurrentValue: config.quietStartup ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"send-provider-attribution\",\n\t\t\t\tlabel: \"Provider attribution headers\",\n\t\t\t\tdescription: \"Identify this CLI to your configured LLM provider (e.g. OpenRouter billing origin)\",\n\t\t\t\tcurrentValue: config.sendProviderAttribution ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"default-project-trust\",\n\t\t\t\tlabel: \"Default project trust\",\n\t\t\t\tdescription: \"Fallback behavior when no extension or saved trust decision decides project trust\",\n\t\t\t\tcurrentValue: DEFAULT_PROJECT_TRUST_LABELS[config.defaultProjectTrust],\n\t\t\t\tvalues: Object.values(DEFAULT_PROJECT_TRUST_LABELS),\n\t\t\t},\n\t\t\t...permissionModeItems(config.permissionMode, callbacks),\n\t\t\t{\n\t\t\t\tid: \"double-escape-action\",\n\t\t\t\tlabel: \"Double-escape action\",\n\t\t\t\tdescription: \"Action when pressing Escape twice with empty editor\",\n\t\t\t\tcurrentValue: config.doubleEscapeAction,\n\t\t\t\tvalues: [\"tree\", \"fork\", \"none\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tree-filter-mode\",\n\t\t\t\tlabel: \"Tree filter mode\",\n\t\t\t\tdescription: \"Default filter when opening /tree\",\n\t\t\t\tcurrentValue: config.treeFilterMode,\n\t\t\t\tvalues: [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"warnings\",\n\t\t\t\tlabel: \"Warnings\",\n\t\t\t\tdescription: \"Enable or disable individual warnings\",\n\t\t\t\tcurrentValue: \"configure\",\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew WarningSettingsSubmenu(\n\t\t\t\t\t\tcurrentWarnings,\n\t\t\t\t\t\t(warnings) => {\n\t\t\t\t\t\t\tcurrentWarnings = warnings;\n\t\t\t\t\t\t\tcallbacks.onWarningsChange(warnings);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => done(),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"model-thinking\",\n\t\t\t\tlabel: \"Default thinking level per model\",\n\t\t\t\tdescription: `Override the default thinking level for specific models. ${cycleThinkingKey} cycles in-session.`,\n\t\t\t\tcurrentValue: modelThinkingOverridesSummary(currentModelThinkingLevels),\n\t\t\t\tsubmenu: (_currentValue, done) => {\n\t\t\t\t\tconst steps: SteppedSubmenuStep[] = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"model\",\n\t\t\t\t\t\t\ttitle: \"Per-Model Thinking Level\",\n\t\t\t\t\t\t\tdescription: \"Select a model to configure\",\n\t\t\t\t\t\t\toptions: () => {\n\t\t\t\t\t\t\t\tconst sorted = [...config.availableDefaultModels].sort((a, b) => {\n\t\t\t\t\t\t\t\t\tconst aKey = modelSettingKey(a);\n\t\t\t\t\t\t\t\t\tconst bKey = modelSettingKey(b);\n\t\t\t\t\t\t\t\t\tif (aKey === currentModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentModelKey) return 1;\n\t\t\t\t\t\t\t\t\tif (aKey === currentDefaultModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentDefaultModelKey) return 1;\n\t\t\t\t\t\t\t\t\treturn a.provider.localeCompare(b.provider);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = sorted.map((model) => {\n\t\t\t\t\t\t\t\t\tconst key = modelSettingKey(model);\n\t\t\t\t\t\t\t\t\tconst override = currentModelThinkingLevels[key];\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tvalue: key,\n\t\t\t\t\t\t\t\t\t\tlabel: modelItemLabel(model),\n\t\t\t\t\t\t\t\t\t\tdescription: override ?? undefined,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (items.length === 0) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: \"__none__\",\n\t\t\t\t\t\t\t\t\t\tlabel: \"No models available\",\n\t\t\t\t\t\t\t\t\t\tdescription: \"Log in to a provider or configure an API key first\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: () => currentModelKey ?? currentDefaultModelKey,\n\t\t\t\t\t\t\tsearchable: true,\n\t\t\t\t\t\t\tlayout: MODEL_PICKER_LAYOUT,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"level\",\n\t\t\t\t\t\t\ttitle: (ctx) => {\n\t\t\t\t\t\t\t\tconst m = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\treturn `Thinking Level for ${m ? modelDisplayLabel(m) : ctx.model}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdescription: \"Select default thinking level for this model\",\n\t\t\t\t\t\t\toptions: (ctx) => {\n\t\t\t\t\t\t\t\tconst model = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\tif (!model) return [];\n\t\t\t\t\t\t\t\tconst levels = (\n\t\t\t\t\t\t\t\t\tmodel.reasoning ? getSupportedThinkingLevels(model) : [\"off\"]\n\t\t\t\t\t\t\t\t) as ThinkingLevel[];\n\t\t\t\t\t\t\t\tconst activeLevel = currentModelThinkingLevels[ctx.model];\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = levels.map((level) => ({\n\t\t\t\t\t\t\t\t\tvalue: level,\n\t\t\t\t\t\t\t\t\tlabel: `${level === activeLevel ? \"✓ \" : \" \"}${level}`,\n\t\t\t\t\t\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\tif (currentModelThinkingLevels[ctx.model] !== undefined) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: CLEAR_OVERRIDE_VALUE,\n\t\t\t\t\t\t\t\t\t\tlabel: \" (clear override)\",\n\t\t\t\t\t\t\t\t\t\tdescription: `Revert to global default (${config.thinkingLevel})`,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: (ctx) => currentModelThinkingLevels[ctx.model],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\n\t\t\t\t\tconst summary = () => modelThinkingOverridesSummary(currentModelThinkingLevels);\n\n\t\t\t\t\treturn new SteppedSubmenu(\n\t\t\t\t\t\tsteps,\n\t\t\t\t\t\t(selections) => {\n\t\t\t\t\t\t\tconst model = defaultModelByValue.get(selections.model);\n\t\t\t\t\t\t\tif (!model) return;\n\t\t\t\t\t\t\tif (selections.level === CLEAR_OVERRIDE_VALUE) {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelRemove(model.provider, model.id);\n\t\t\t\t\t\t\t\tdelete currentModelThinkingLevels[selections.model];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelChange(\n\t\t\t\t\t\t\t\t\tmodel.provider,\n\t\t\t\t\t\t\t\t\tmodel.id,\n\t\t\t\t\t\t\t\t\tselections.level as ThinkingLevel,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcurrentModelThinkingLevels[selections.model] = selections.level as ThinkingLevel;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tdone(summary());\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ loop: true },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tui-mode\",\n\t\t\t\tlabel: \"TUI mode\",\n\t\t\t\tdescription: \"Interface layout; fullscreen mode is experimental\",\n\t\t\t\tcurrentValue: config.tuiMode,\n\t\t\t\tvalues: [\"regular\", \"fullscreen\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-exit-output\",\n\t\t\t\tlabel: \"Fullscreen exit output\",\n\t\t\t\tdescription: \"Print the transcript or only a session resume hint when exiting fullscreen mode\",\n\t\t\t\tcurrentValue: config.fullscreenExitOutput,\n\t\t\t\tvalues: [\"transcript\", \"resume-hint\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-scrollbar\",\n\t\t\t\tlabel: \"Fullscreen scrollbar\",\n\t\t\t\tdescription: \"Scrollbar behavior in fullscreen mode; has no effect in regular mode\",\n\t\t\t\tcurrentValue: config.fullscreenScrollbar,\n\t\t\t\tvalues: [\"auto\", \"always\", \"hidden\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-copy-on-select\",\n\t\t\t\tlabel: \"Fullscreen copy on select\",\n\t\t\t\tdescription: \"Automatically copy selected text in fullscreen mode; disable to copy selections with Ctrl+X\",\n\t\t\t\tcurrentValue: config.fullscreenCopyOnSelect ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"theme\",\n\t\t\t\tlabel: \"Theme\",\n\t\t\t\tdescription: \"Color theme for the interface\",\n\t\t\t\tcurrentValue: config.currentTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tnew ThemeSubmenu(currentValue, config.terminalTheme, config.availableThemes, callbacks, done),\n\t\t\t},\n\t\t];\n\n\t\t// Only show image toggle if terminal supports it\n\t\tif (supportsImages) {\n\t\t\t// Insert after autocompact\n\t\t\titems.splice(1, 0, {\n\t\t\t\tid: \"show-images\",\n\t\t\t\tlabel: \"Show images\",\n\t\t\t\tdescription: \"Render images inline in terminal\",\n\t\t\t\tcurrentValue: config.showImages ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t});\n\t\t\titems.splice(2, 0, {\n\t\t\t\tid: \"image-width-cells\",\n\t\t\t\tlabel: \"Image width\",\n\t\t\t\tdescription: \"Preferred inline image width in terminal cells\",\n\t\t\t\tcurrentValue: String(config.imageWidthCells),\n\t\t\t\tvalues: [\"60\", \"80\", \"120\"],\n\t\t\t});\n\t\t}\n\n\t\t// Image auto-resize toggle (always available, affects both attached and read images)\n\t\titems.splice(supportsImages ? 3 : 1, 0, {\n\t\t\tid: \"auto-resize-images\",\n\t\t\tlabel: \"Auto-resize images\",\n\t\t\tdescription: \"Resize large images to 2000x2000 max for better model compatibility\",\n\t\t\tcurrentValue: config.autoResizeImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Block images toggle (always available, insert after auto-resize-images)\n\t\tconst autoResizeIndex = items.findIndex((item) => item.id === \"auto-resize-images\");\n\t\titems.splice(autoResizeIndex + 1, 0, {\n\t\t\tid: \"block-images\",\n\t\t\tlabel: \"Block images\",\n\t\t\tdescription: \"Prevent images from being sent to LLM providers\",\n\t\t\tcurrentValue: config.blockImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Skill commands toggle (insert after block-images)\n\t\tconst blockImagesIndex = items.findIndex((item) => item.id === \"block-images\");\n\t\titems.splice(blockImagesIndex + 1, 0, {\n\t\t\tid: \"skill-commands\",\n\t\t\tlabel: \"Skill commands\",\n\t\t\tdescription: \"Register skills as /skill:name commands\",\n\t\t\tcurrentValue: config.enableSkillCommands ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Hardware cursor toggle (insert after skill-commands)\n\t\tconst skillCommandsIndex = items.findIndex((item) => item.id === \"skill-commands\");\n\t\titems.splice(skillCommandsIndex + 1, 0, {\n\t\t\tid: \"show-hardware-cursor\",\n\t\t\tlabel: \"Show hardware cursor\",\n\t\t\tdescription: \"Show the terminal cursor while still positioning it for IME support\",\n\t\t\tcurrentValue: config.showHardwareCursor ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Editor padding toggle (insert after show-hardware-cursor)\n\t\tconst hardwareCursorIndex = items.findIndex((item) => item.id === \"show-hardware-cursor\");\n\t\titems.splice(hardwareCursorIndex + 1, 0, {\n\t\t\tid: \"editor-padding\",\n\t\t\tlabel: \"Editor padding\",\n\t\t\tdescription: \"Horizontal padding for input editor (0-3)\",\n\t\t\tcurrentValue: String(config.editorPaddingX),\n\t\t\tvalues: [\"0\", \"1\", \"2\", \"3\"],\n\t\t});\n\n\t\t// Output padding toggle (insert after editor-padding)\n\t\tconst editorPaddingIndex = items.findIndex((item) => item.id === \"editor-padding\");\n\t\titems.splice(editorPaddingIndex + 1, 0, {\n\t\t\tid: \"output-padding\",\n\t\t\tlabel: \"Output padding\",\n\t\t\tdescription: \"Horizontal padding for user messages, assistant messages, and thinking\",\n\t\t\tcurrentValue: String(config.outputPad),\n\t\t\tvalues: [\"0\", \"1\"],\n\t\t});\n\n\t\t// Autocomplete max visible toggle (insert after output-padding)\n\t\tconst outputPaddingIndex = items.findIndex((item) => item.id === \"output-padding\");\n\t\titems.splice(outputPaddingIndex + 1, 0, {\n\t\t\tid: \"autocomplete-max-visible\",\n\t\t\tlabel: \"Autocomplete max items\",\n\t\t\tdescription: \"Max visible items in autocomplete dropdown (3-20)\",\n\t\t\tcurrentValue: String(config.autocompleteMaxVisible),\n\t\t\tvalues: [\"3\", \"5\", \"7\", \"10\", \"15\", \"20\"],\n\t\t});\n\n\t\t// Clear on shrink toggle (insert after autocomplete-max-visible)\n\t\tconst autocompleteIndex = items.findIndex((item) => item.id === \"autocomplete-max-visible\");\n\t\titems.splice(autocompleteIndex + 1, 0, {\n\t\t\tid: \"clear-on-shrink\",\n\t\t\tlabel: \"Clear on shrink\",\n\t\t\tdescription: \"Clear empty rows when content shrinks (may cause flicker)\",\n\t\t\tcurrentValue: config.clearOnShrink ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Terminal progress toggle (insert after clear-on-shrink)\n\t\tconst clearOnShrinkIndex = items.findIndex((item) => item.id === \"clear-on-shrink\");\n\t\titems.splice(clearOnShrinkIndex + 1, 0, {\n\t\t\tid: \"terminal-progress\",\n\t\t\tlabel: \"Terminal progress\",\n\t\t\tdescription: \"Show OSC 9;4 progress indicators in the terminal tab bar\",\n\t\t\tcurrentValue: config.showTerminalProgress ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\tif (config.taskListTool)\n\t\t\titems.push({\n\t\t\t\tid: \"task-list-tool\",\n\t\t\t\tlabel: \"Task-list tool\",\n\t\t\t\tdescription: config.taskListTool.projectControlled\n\t\t\t\t\t? \"Controlled by project defaultTools. Edit project settings to change this future-session default.\"\n\t\t\t\t\t: \"Enable todo_write by default for new sessions. Current tools and reload keep their selection.\",\n\t\t\t\tcurrentValue: config.taskListTool.enabled ? \"enabled\" : \"disabled\",\n\t\t\t\tvalues: config.taskListTool.projectControlled ? undefined : [\"disabled\", \"enabled\"],\n\t\t\t});\n\n\t\t// Add borders\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Settings\")), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\t10,\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"task-list-tool\":\n\t\t\t\t\t\tif (!config.taskListTool?.projectControlled) callbacks.onTaskListToolChange?.(newValue === \"enabled\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"autocompact\":\n\t\t\t\t\t\tcallbacks.onAutoCompactChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-images\":\n\t\t\t\t\t\tcallbacks.onShowImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image-width-cells\":\n\t\t\t\t\t\tcallbacks.onImageWidthCellsChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"auto-resize-images\":\n\t\t\t\t\t\tcallbacks.onAutoResizeImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"block-images\":\n\t\t\t\t\t\tcallbacks.onBlockImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"skill-commands\":\n\t\t\t\t\t\tcallbacks.onEnableSkillCommandsChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"steering-mode\":\n\t\t\t\t\t\tcallbacks.onSteeringModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"follow-up-mode\":\n\t\t\t\t\t\tcallbacks.onFollowUpModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"transport\":\n\t\t\t\t\t\tcallbacks.onTransportChange(newValue as Transport);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"http-idle-timeout\": {\n\t\t\t\t\t\tconst choice = HTTP_IDLE_TIMEOUT_CHOICES.find((item) => item.label === newValue);\n\t\t\t\t\t\tif (choice) {\n\t\t\t\t\t\t\tcallbacks.onHttpIdleTimeoutMsChange(choice.timeoutMs);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"cache-warming-mode\":\n\t\t\t\t\t\tcallbacks.onCacheWarmingModeChange(newValue as CacheWarmingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"hide-thinking\":\n\t\t\t\t\t\tcallbacks.onHideThinkingBlockChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"chat-detail\":\n\t\t\t\t\t\tcallbacks.onChatDetailChange(newValue as ChatDetail);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"mermaid-rendering\":\n\t\t\t\t\t\tcallbacks.onMermaidRenderingModeChange(newValue as MermaidRenderingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"cache-miss-notices\":\n\t\t\t\t\t\tcallbacks.onShowCacheMissNoticesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"collapse-changelog\":\n\t\t\t\t\t\tcallbacks.onCollapseChangelogChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"quiet-startup\":\n\t\t\t\t\t\tcallbacks.onQuietStartupChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"send-provider-attribution\":\n\t\t\t\t\t\tcallbacks.onSendProviderAttributionChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"default-project-trust\": {\n\t\t\t\t\t\tconst defaultProjectTrust = DEFAULT_PROJECT_TRUST_BY_LABEL.get(newValue);\n\t\t\t\t\t\tif (defaultProjectTrust) {\n\t\t\t\t\t\t\tcallbacks.onDefaultProjectTrustChange(defaultProjectTrust);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"double-escape-action\":\n\t\t\t\t\t\tcallbacks.onDoubleEscapeActionChange(newValue as \"fork\" | \"tree\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tree-filter-mode\":\n\t\t\t\t\t\tcallbacks.onTreeFilterModeChange(\n\t\t\t\t\t\t\tnewValue as \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-hardware-cursor\":\n\t\t\t\t\t\tcallbacks.onShowHardwareCursorChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"editor-padding\":\n\t\t\t\t\t\tcallbacks.onEditorPaddingXChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"output-padding\":\n\t\t\t\t\t\tcallbacks.onOutputPadChange(newValue === \"0\" ? 0 : 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"autocomplete-max-visible\":\n\t\t\t\t\t\tcallbacks.onAutocompleteMaxVisibleChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"clear-on-shrink\":\n\t\t\t\t\t\tcallbacks.onClearOnShrinkChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"terminal-progress\":\n\t\t\t\t\t\tcallbacks.onShowTerminalProgressChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tui-mode\":\n\t\t\t\t\t\tcallbacks.onTuiModeChange(newValue as TuiMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-exit-output\":\n\t\t\t\t\t\tcallbacks.onFullscreenExitOutputChange(newValue as FullscreenExitOutput);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-scrollbar\":\n\t\t\t\t\t\tcallbacks.onFullscreenScrollbarChange(newValue as ScrollViewScrollbar);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-copy-on-select\":\n\t\t\t\t\t\tcallbacks.onFullscreenCopyOnSelectChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"theme\":\n\t\t\t\t\t\tcallbacks.onThemeChange(newValue);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcallbacks.onCancel,\n\t\t\t{ enableSearch: true },\n\t\t);\n\n\t\t// `pi-tui` builds this list's search box itself, so its prompt is swapped on the way out.\n\t\tconst settingsList = this.settingsList;\n\t\tthis.addChild({\n\t\t\trender: (width: number) => {\n\t\t\t\tconst lines = settingsList.render(width);\n\t\t\t\treturn lines.length > 0 ? [withComposerPrompt(lines[0]!), ...lines.slice(1)] : lines;\n\t\t\t},\n\t\t\tinvalidate: () => settingsList.invalidate(),\n\t\t});\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSettingsList(): SettingsList {\n\t\treturn this.settingsList;\n\t}\n}\n"]}
@@ -58,6 +58,7 @@ const PERMISSION_MODE_DESCRIPTIONS = {
58
58
  * `user` and `default` are absent because neither shadows anything this menu writes.
59
59
  */
60
60
  export const PERMISSION_MODE_OVERRIDE_HINTS = {
61
+ interactive: "the interactive permission mode",
61
62
  flag: "--permission-mode on the command line",
62
63
  local: ".apex-code/permissions.local.json in this project",
63
64
  project: ".apex-code/permissions.json in this project",
@@ -72,7 +73,8 @@ function permissionModeItems(current, callbacks) {
72
73
  {
73
74
  id: "permission-mode",
74
75
  label: "Permission mode",
75
- description: PERMISSION_MODE_DESCRIPTIONS[current.mode],
76
+ description: PERMISSION_MODE_DESCRIPTIONS[current.mode] +
77
+ (current.origin === "interactive" ? " The saved default is shadowed for this session." : ""),
76
78
  currentValue: current.mode,
77
79
  submenu: (currentValue, done) => new PermissionModeSubmenu(currentValue, current.origin, (mode) => callbacks.onPermissionModeChange(mode), done),
78
80
  },
@@ -154,6 +156,9 @@ class PermissionModeSubmenu extends Container {
154
156
  this.inputComponent = component;
155
157
  }
156
158
  description() {
159
+ if (this.origin === "interactive") {
160
+ return "Saved to user scope for future sessions. The saved default is shadowed by the interactive mode for this session.";
161
+ }
157
162
  const overridden = this.origin !== "user" && this.origin !== "default"
158
163
  ? ` Currently set by ${PERMISSION_MODE_OVERRIDE_HINTS[this.origin]}.`
159
164
  : "";
@@ -729,12 +734,26 @@ export class SettingsSelectorComponent extends Container {
729
734
  currentValue: config.showTerminalProgress ? "true" : "false",
730
735
  values: ["true", "false"],
731
736
  });
737
+ if (config.taskListTool)
738
+ items.push({
739
+ id: "task-list-tool",
740
+ label: "Task-list tool",
741
+ description: config.taskListTool.projectControlled
742
+ ? "Controlled by project defaultTools. Edit project settings to change this future-session default."
743
+ : "Enable todo_write by default for new sessions. Current tools and reload keep their selection.",
744
+ currentValue: config.taskListTool.enabled ? "enabled" : "disabled",
745
+ values: config.taskListTool.projectControlled ? undefined : ["disabled", "enabled"],
746
+ });
732
747
  // Add borders
733
748
  this.addChild(new DynamicBorder());
734
749
  this.addChild(new Text(theme.bold(theme.fg("accent", "Settings")), 0, 0));
735
750
  this.addChild(new Spacer(1));
736
751
  this.settingsList = new SettingsList(items, 10, getSettingsSelectorListTheme(), (id, newValue) => {
737
752
  switch (id) {
753
+ case "task-list-tool":
754
+ if (!config.taskListTool?.projectControlled)
755
+ callbacks.onTaskListToolChange?.(newValue === "enabled");
756
+ break;
738
757
  case "autocompact":
739
758
  callbacks.onAutoCompactChange(newValue === "true");
740
759
  break;