@kolisachint/hoocode-agent 0.5.30 → 0.5.32

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 (134) hide show
  1. package/CHANGELOG.md +234 -0
  2. package/dist/core/agent-selection-eval.d.ts +91 -0
  3. package/dist/core/agent-selection-eval.d.ts.map +1 -0
  4. package/dist/core/agent-selection-eval.js +186 -0
  5. package/dist/core/agent-selection-eval.js.map +1 -0
  6. package/dist/core/agent-session-runtime.d.ts +28 -0
  7. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  8. package/dist/core/agent-session-runtime.js +61 -2
  9. package/dist/core/agent-session-runtime.js.map +1 -1
  10. package/dist/core/builtin-skills.d.ts +61 -0
  11. package/dist/core/builtin-skills.d.ts.map +1 -0
  12. package/dist/core/builtin-skills.js +106 -0
  13. package/dist/core/builtin-skills.js.map +1 -0
  14. package/dist/core/extensions/plugins/default-marketplace/.agents-plugin/marketplace.json +5 -1
  15. package/dist/core/extensions/plugins/trigger-judge.d.ts +42 -0
  16. package/dist/core/extensions/plugins/trigger-judge.d.ts.map +1 -0
  17. package/dist/core/extensions/plugins/trigger-judge.js +121 -0
  18. package/dist/core/extensions/plugins/trigger-judge.js.map +1 -0
  19. package/dist/core/external-tools.d.ts +67 -0
  20. package/dist/core/external-tools.d.ts.map +1 -0
  21. package/dist/core/external-tools.js +120 -0
  22. package/dist/core/external-tools.js.map +1 -0
  23. package/dist/core/keybindings.d.ts +102 -30
  24. package/dist/core/keybindings.d.ts.map +1 -1
  25. package/dist/core/keybindings.js +123 -29
  26. package/dist/core/keybindings.js.map +1 -1
  27. package/dist/core/mode-prompts.d.ts +15 -3
  28. package/dist/core/mode-prompts.d.ts.map +1 -1
  29. package/dist/core/mode-prompts.js +17 -29
  30. package/dist/core/mode-prompts.js.map +1 -1
  31. package/dist/core/settings-defaults.d.ts +1 -1
  32. package/dist/core/settings-defaults.d.ts.map +1 -1
  33. package/dist/core/settings-defaults.js +1 -1
  34. package/dist/core/settings-defaults.js.map +1 -1
  35. package/dist/core/settings-manager.d.ts +10 -3
  36. package/dist/core/settings-manager.d.ts.map +1 -1
  37. package/dist/core/settings-manager.js +19 -8
  38. package/dist/core/settings-manager.js.map +1 -1
  39. package/dist/core/settings-types.d.ts +1 -1
  40. package/dist/core/settings-types.d.ts.map +1 -1
  41. package/dist/core/settings-types.js.map +1 -1
  42. package/dist/core/slash-commands.d.ts.map +1 -1
  43. package/dist/core/slash-commands.js +5 -1
  44. package/dist/core/slash-commands.js.map +1 -1
  45. package/dist/core/tool-output-view.d.ts +33 -0
  46. package/dist/core/tool-output-view.d.ts.map +1 -0
  47. package/dist/core/tool-output-view.js +31 -0
  48. package/dist/core/tool-output-view.js.map +1 -0
  49. package/dist/core/tools/edit.d.ts.map +1 -1
  50. package/dist/core/tools/edit.js +4 -0
  51. package/dist/core/tools/edit.js.map +1 -1
  52. package/dist/core/tools/propose-plugin.d.ts.map +1 -1
  53. package/dist/core/tools/propose-plugin.js +7 -7
  54. package/dist/core/tools/propose-plugin.js.map +1 -1
  55. package/dist/core/tools/subagent.d.ts +7 -1
  56. package/dist/core/tools/subagent.d.ts.map +1 -1
  57. package/dist/core/tools/subagent.js +12 -24
  58. package/dist/core/tools/subagent.js.map +1 -1
  59. package/dist/extensions/core/modes.d.ts.map +1 -1
  60. package/dist/extensions/core/modes.js +21 -23
  61. package/dist/extensions/core/modes.js.map +1 -1
  62. package/dist/extensions/core/scaffold.d.ts.map +1 -1
  63. package/dist/extensions/core/scaffold.js +28 -24
  64. package/dist/extensions/core/scaffold.js.map +1 -1
  65. package/dist/init-templates.generated.d.ts +3 -0
  66. package/dist/init-templates.generated.d.ts.map +1 -1
  67. package/dist/init-templates.generated.js +12 -0
  68. package/dist/init-templates.generated.js.map +1 -1
  69. package/dist/main.d.ts.map +1 -1
  70. package/dist/main.js +14 -1
  71. package/dist/main.js.map +1 -1
  72. package/dist/modes/interactive/command-executor.d.ts +20 -0
  73. package/dist/modes/interactive/command-executor.d.ts.map +1 -1
  74. package/dist/modes/interactive/command-executor.js +138 -9
  75. package/dist/modes/interactive/command-executor.js.map +1 -1
  76. package/dist/modes/interactive/components/footer.d.ts +4 -0
  77. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  78. package/dist/modes/interactive/components/footer.js +31 -2
  79. package/dist/modes/interactive/components/footer.js.map +1 -1
  80. package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
  81. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  82. package/dist/modes/interactive/components/scoped-models-selector.js +2 -2
  83. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  84. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  85. package/dist/modes/interactive/components/session-selector.js +2 -2
  86. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  87. package/dist/modes/interactive/components/settings-selector.d.ts +10 -2
  88. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  89. package/dist/modes/interactive/components/settings-selector.js +165 -23
  90. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  91. package/dist/modes/interactive/components/tool-chain-summary.d.ts +65 -0
  92. package/dist/modes/interactive/components/tool-chain-summary.d.ts.map +1 -0
  93. package/dist/modes/interactive/components/tool-chain-summary.js +216 -0
  94. package/dist/modes/interactive/components/tool-chain-summary.js.map +1 -0
  95. package/dist/modes/interactive/components/tool-chain.d.ts +61 -0
  96. package/dist/modes/interactive/components/tool-chain.d.ts.map +1 -0
  97. package/dist/modes/interactive/components/tool-chain.js +156 -0
  98. package/dist/modes/interactive/components/tool-chain.js.map +1 -0
  99. package/dist/modes/interactive/components/tool-execution.d.ts +55 -9
  100. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  101. package/dist/modes/interactive/components/tool-execution.js +173 -33
  102. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  103. package/dist/modes/interactive/components/tool-signal.d.ts +50 -0
  104. package/dist/modes/interactive/components/tool-signal.d.ts.map +1 -0
  105. package/dist/modes/interactive/components/tool-signal.js +151 -0
  106. package/dist/modes/interactive/components/tool-signal.js.map +1 -0
  107. package/dist/modes/interactive/interactive-mode.d.ts +50 -1
  108. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  109. package/dist/modes/interactive/interactive-mode.js +244 -29
  110. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  111. package/dist/modes/interactive/resource-display.d.ts +9 -0
  112. package/dist/modes/interactive/resource-display.d.ts.map +1 -1
  113. package/dist/modes/interactive/resource-display.js +13 -0
  114. package/dist/modes/interactive/resource-display.js.map +1 -1
  115. package/dist/utils/tools-manager.d.ts +30 -0
  116. package/dist/utils/tools-manager.d.ts.map +1 -1
  117. package/dist/utils/tools-manager.js +35 -0
  118. package/dist/utils/tools-manager.js.map +1 -1
  119. package/docs/modes.md +4 -0
  120. package/docs/plugins.md +10 -0
  121. package/docs/settings.md +42 -0
  122. package/docs/skills.md +30 -0
  123. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  124. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  125. package/examples/extensions/sandbox/package.json +1 -1
  126. package/examples/extensions/with-deps/package.json +1 -1
  127. package/package.json +5 -4
  128. package/templates/prompts/grill-bridge.md +1 -0
  129. package/templates/prompts/grill-me.md +7 -0
  130. package/templates/prompts/grill-plan.md +9 -0
  131. package/templates/prompts/task-background-agents.md +2 -0
  132. package/templates/prompts/task-background-none.md +1 -0
  133. package/templates/prompts/task-main.md +19 -0
  134. package/templates/skills/plugin-authoring/SKILL.md +81 -0
@@ -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 type { ThinkingLevel } from \"@kolisachint/hoocode-agent-core\";\nimport type { Transport } from \"@kolisachint/hoocode-ai\";\nimport {\n\tContainer,\n\tgetCapabilities,\n\tInput,\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SettingItem,\n\tSettingsList,\n\tSpacer,\n\tText,\n} from \"@kolisachint/hoocode-tui\";\nimport type { MarketplacePlatform } from \"../../../core/extensions/plugins/formats/types.js\";\nimport type { PromptSurface } from \"../../../core/light.js\";\nimport type { LearnSettingKey, WarningSettings } from \"../../../core/settings-manager.js\";\nimport { getSelectListTheme, getSettingsListTheme, getThemeDescription, theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\nimport { keyDisplayText } from \"./keybinding-hints.js\";\n\nconst SETTINGS_SUBMENU_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\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: \"Maximum reasoning (~32k tokens)\",\n};\n\ninterface ToolToggleInfo {\n\t/** Tool name (e.g. \"read\", \"bash\"). */\n\tname: string;\n\t/** Whether the tool is currently enabled (not in the persisted disabled set). */\n\tenabled: boolean;\n\t/**\n\t * What this tool's serialized schema costs on every request. Priced whether or\n\t * not it is on: for a tool that is off, this is what turning it on will cost.\n\t * Undefined for a tool that was disabled before launch, whose schema this\n\t * session never built.\n\t */\n\ttokens?: number;\n}\n\ninterface FlagInfo {\n\t/** Flag name (without the leading --). */\n\tname: string;\n\tdescription?: string;\n\ttype: \"boolean\" | \"string\";\n\t/** Current effective value. */\n\tvalue: boolean | string;\n}\n\ninterface ToolGroupInfo {\n\t/** Group identifier (e.g. \"web\", \"embsearch\"). */\n\tid: string;\n\tlabel: string;\n\tdescription: string;\n\t/** Whether the group is currently enabled (its tools are available). */\n\tenabled: boolean;\n}\n\nexport interface SettingsConfig {\n\tautoCompact: boolean;\n\ttools: ToolToggleInfo[];\n\ttoolGroups: ToolGroupInfo[];\n\tflags: FlagInfo[];\n\ttoolOutputDisplay: \"collapsed\" | \"peek\" | \"standard\";\n\ttoolOutputMaxBytes: number;\n\ttoolOutputMaxLines: number;\n\tcontextGc: boolean;\n\tshowImages: boolean;\n\timageWidthCells: number;\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tenableSkillCommands: boolean;\n\tlight: boolean;\n\tpluginInstallScope: \"user\" | \"project\";\n\tenablePluginTools: boolean;\n\t/**\n\t * settings.json keys the project file sets. A pane row writes user scope, so\n\t * anything listed here wins again on the next session however the row is set.\n\t */\n\tprojectPinnedSettings: string[];\n\t/** Platform layouts in force this session (empty = unset, per-consumer defaults apply). */\n\tplatform: MarketplacePlatform[];\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\ttransport: Transport;\n\tthinkingLevel: ThinkingLevel;\n\tavailableThinkingLevels: ThinkingLevel[];\n\tcurrentTheme: string;\n\tavailableThemes: string[];\n\thideThinkingBlock: boolean;\n\tcollapseChangelog: boolean;\n\tenableInstallTelemetry: boolean;\n\tdoubleEscapeAction: \"fork\" | \"tree\" | \"none\";\n\ttreeFilterMode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\";\n\tshowHardwareCursor: boolean;\n\teditorBorder: \"rule\" | \"box\";\n\teditorPaddingX: number;\n\tautocompleteMaxVisible: number;\n\tquietStartup: boolean;\n\tclearOnShrink: boolean;\n\tshowTerminalProgress: boolean;\n\twarnings: WarningSettings;\n\tvoiceSilenceMs: number;\n\twebtoolsTimeoutSecs: number;\n\tlearn: Record<LearnSettingKey, number>;\n\t/**\n\t * Re-measure the fixed per-turn surface (system prompt + active tool schemas).\n\t * Called on open and after every change, so a toggle that costs tokens shows\n\t * what it cost. Omitted by callers that have no session to measure.\n\t */\n\tmeasureTokenSurface?: () => PromptSurface;\n}\n\nexport interface SettingsCallbacks {\n\tonAutoCompactChange: (enabled: boolean) => void;\n\tonToolEnabledChange: (name: string, enabled: boolean) => void;\n\tonToolGroupChange: (id: string, enabled: boolean) => void;\n\tonToolOutputDisplayChange: (level: \"collapsed\" | \"peek\" | \"standard\") => void;\n\tonToolOutputMaxBytesChange: (bytes: number) => void;\n\tonToolOutputMaxLinesChange: (lines: number) => void;\n\tonContextGcChange: (enabled: boolean) => void;\n\tonFlagChange: (name: string, value: boolean | string) => 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\tonLightChange: (enabled: boolean) => void;\n\tonPluginInstallScopeChange: (scope: \"user\" | \"project\") => void;\n\tonEnablePluginToolsChange: (enabled: boolean) => void;\n\tonPlatformChange: (platforms: MarketplacePlatform[]) => 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\tonThinkingLevelChange: (level: ThinkingLevel) => void;\n\tonThemeChange: (theme: string) => void;\n\tonThemePreview?: (theme: string) => void;\n\tonHideThinkingBlockChange: (hidden: boolean) => void;\n\tonCollapseChangelogChange: (collapsed: boolean) => void;\n\tonEnableInstallTelemetryChange: (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\tonEditorBorderChange: (border: \"rule\" | \"box\") => void;\n\tonEditorPaddingXChange: (padding: number) => void;\n\tonAutocompleteMaxVisibleChange: (maxVisible: number) => void;\n\tonQuietStartupChange: (enabled: boolean) => void;\n\tonClearOnShrinkChange: (enabled: boolean) => void;\n\tonShowTerminalProgressChange: (enabled: boolean) => void;\n\tonWarningsChange: (warnings: WarningSettings) => void;\n\tonVoiceSilenceMsChange: (ms: number) => void;\n\tonWebtoolsTimeoutSecsChange: (secs: number) => void;\n\tonLearnSettingChange: (key: LearnSettingKey, value: number) => void;\n\tonCancel: () => void;\n}\n\n/**\n * The `/learn` thresholds as pane rows: the presets to cycle through, and what\n * each one buys. Kept as a table because all five are the same shape — a\n * positive integer with a handful of sensible values — and the pane, the change\n * handler and the category row all read from it rather than repeating the list.\n */\nconst LEARN_SETTINGS: ReadonlyArray<{\n\tkey: LearnSettingKey;\n\tlabel: string;\n\tdescription: string;\n\tpresets: number[];\n}> = [\n\t{\n\t\tkey: \"learnMaxSessions\",\n\t\tlabel: \"Sessions scanned\",\n\t\tdescription: \"How many recent sessions in this directory /learn mines. Raise it on a repo you touch rarely.\",\n\t\tpresets: [10, 20, 30, 50, 100],\n\t},\n\t{\n\t\tkey: \"learnMaxAgeDays\",\n\t\tlabel: \"Session age limit\",\n\t\tdescription: \"Ignore sessions older than this many days. A pattern that stopped is not a rule.\",\n\t\tpresets: [7, 14, 30, 60, 90, 180],\n\t},\n\t{\n\t\tkey: \"learnMinRepeats\",\n\t\tlabel: \"Directive repeats\",\n\t\tdescription:\n\t\t\t\"Times a directive must recur before it is proposed. The signal/noise dial: raise it for fewer, better-evidenced proposals.\",\n\t\tpresets: [2, 3, 4, 5],\n\t},\n\t{\n\t\tkey: \"learnMinRequestRepeats\",\n\t\tlabel: \"Workflow repeats\",\n\t\tdescription: \"Non-overlapping repeats a tool sequence needs before it is proposed as a skill.\",\n\t\tpresets: [2, 3, 4, 5, 6],\n\t},\n\t{\n\t\tkey: \"learnMaxProposals\",\n\t\tlabel: \"Max proposals\",\n\t\tdescription: \"Cap on each list in the digest. Every proposal costs the model context.\",\n\t\tpresets: [3, 5, 8, 12, 20],\n\t},\n];\n\nconst LEARN_KEYS: ReadonlySet<string> = new Set(LEARN_SETTINGS.map((setting) => setting.key));\n\n/**\n * Preset list for a numeric row, guaranteed to contain the value in force.\n *\n * Without this a value set by hand in settings.json — say 45 days — is absent\n * from the cycle, so the first keypress silently snaps it to the first preset,\n * discarding a deliberate choice the pane never showed as unusual. Every numeric\n * cycle row goes through this for that reason.\n */\nfunction presetValues(presets: number[], current: number): string[] {\n\tconst all = presets.includes(current) ? presets : [...presets, current].sort((a, b) => a - b);\n\treturn all.map(String);\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\tgetSettingsListTheme(),\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\n/**\n * The artifact platform targets, in the order the pane shows them. Each row is an\n * independent on/off toggle because `--platform` (and the `platform` setting it\n * mirrors) takes a list: emitting for two platforms at once is a supported shape.\n * The tokens here are the canonical ones — the CLI aliases (`copilot`, `gh`,\n * `native`) fold into these before anything reads them.\n */\nconst PLATFORM_ROWS: ReadonlyArray<{\n\tplatform: MarketplacePlatform;\n\tlabel: string;\n\tdescription: string;\n}> = [\n\t{\n\t\tplatform: \"claude\",\n\t\tlabel: \"claude\",\n\t\tdescription:\n\t\t\t\"Claude Code layout: .claude/ scaffolds, and authored plugins drop into ~/.claude/skills/<id>/. The default when nothing is set.\",\n\t},\n\t{\n\t\tplatform: \"github\",\n\t\tlabel: \"github (copilot, gh)\",\n\t\tdescription:\n\t\t\t\"Copilot layout: .github/ scaffolds, and authored plugins are produced under ~/.agents/publish/github/<id>/.\",\n\t},\n\t{\n\t\tplatform: \"agents\",\n\t\tlabel: \"agents (native)\",\n\t\tdescription:\n\t\t\t\"Cross-vendor .agents/ layout. Scaffolds only - a plugin belongs to no marketplace in this layout, so plugin authoring ignores it.\",\n\t},\n];\n\n/** Row value for the platform setting: the selection, or the fallback when it is empty. */\nfunction platformSummary(platforms: readonly MarketplacePlatform[]): string {\n\treturn platforms.length > 0 ? platforms.join(\", \") : \"default (claude)\";\n}\n\n/**\n * Submenu for the session's artifact platform targets (the `platform` setting,\n * same knob as `--platform`).\n *\n * A list rather than a cycle: the setting is a list, and the three tokens are not\n * mutually exclusive. Turning everything off is legal and means \"unset\" — the\n * per-consumer defaults come back (claude for plugins, .hoocode/ for scaffolds).\n */\nclass PlatformSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate selected: Set<MarketplacePlatform>;\n\n\tconstructor(\n\t\tplatforms: readonly MarketplacePlatform[],\n\t\tonChange: (platforms: MarketplacePlatform[]) => void,\n\t\tonDone: (summary: string) => void,\n\t) {\n\t\tsuper();\n\n\t\tthis.selected = new Set(platforms);\n\n\t\tconst items: SettingItem[] = PLATFORM_ROWS.map(({ platform, label, description }) => ({\n\t\t\tid: platform,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\tcurrentValue: this.selected.has(platform) ? \"on\" : \"off\",\n\t\t\tvalues: [\"on\", \"off\"],\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\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tconst platform = id as MarketplacePlatform;\n\t\t\t\tif (newValue === \"on\") this.selected.add(platform);\n\t\t\t\telse this.selected.delete(platform);\n\t\t\t\tonChange(this.ordered());\n\t\t\t},\n\t\t\t() => onDone(platformSummary(this.ordered())),\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\t/** Selection in the pane's order, so the persisted list does not depend on click order. */\n\tprivate ordered(): MarketplacePlatform[] {\n\t\treturn PLATFORM_ROWS.map((row) => row.platform).filter((platform) => this.selected.has(platform));\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\n/**\n * Submenu for tool availability. The first rows are group switches (web,\n * semantic search) that decide whether a group's tools\n * exist at all — this is the same master switch that governs, e.g., the\n * webfetch/websearch tools. Below them are per-tool on/off toggles for the\n * tools that are currently available.\n *\n * Group switches change tool availability and apply on the next session;\n * per-tool toggles apply live and persist. A minimum core (read/bash/edit/\n * write) is guarded so the agent can never be left with no way to act.\n */\nclass ToolsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate enabled: Map<string, boolean>;\n\tprivate static readonly CORE = new Set([\"read\", \"bash\", \"edit\", \"write\"]);\n\tprivate static readonly GROUP_PREFIX = \"group:\";\n\n\tconstructor(\n\t\ttools: ToolToggleInfo[],\n\t\tgroups: ToolGroupInfo[],\n\t\tonChange: (name: string, enabled: boolean) => void,\n\t\tonGroupChange: (id: string, enabled: boolean) => void,\n\t\tonCancel: () => void,\n\t) {\n\t\tsuper();\n\n\t\tthis.enabled = new Map(tools.map((t) => [t.name, t.enabled]));\n\n\t\tconst groupItems: SettingItem[] = groups.map((group) => ({\n\t\t\tid: `${ToolsSubmenu.GROUP_PREFIX}${group.id}`,\n\t\t\tlabel: `[group] ${group.label}`,\n\t\t\tdescription: `${group.description} Governs whether these tools exist; applies on the next session.`,\n\t\t\tcurrentValue: group.enabled ? \"on\" : \"off\",\n\t\t\tvalues: [\"on\", \"off\"],\n\t\t}));\n\n\t\tconst toolItems: SettingItem[] = tools.map((tool) => ({\n\t\t\tid: tool.name,\n\t\t\tlabel: tool.name,\n\t\t\tdescription: ToolsSubmenu.CORE.has(tool.name)\n\t\t\t\t? \"Core tool. Disabling leaves the agent unable to perform this action in every session.\"\n\t\t\t\t: \"Disable to remove this tool from the agent this session and every future session.\",\n\t\t\tcurrentValue: tool.enabled ? \"on\" : \"off\",\n\t\t\t// What the schema costs on every request, whether the tool is on or off:\n\t\t\t// off, it is the price of turning it back on. This is the number that\n\t\t\t// makes a tool worth disabling, so it belongs beside the switch.\n\t\t\tvalueSuffix: tool.tokens !== undefined ? `${tokenCount(tool.tokens)} tok/turn` : undefined,\n\t\t\tvalues: [\"on\", \"off\"],\n\t\t}));\n\n\t\tconst items = [...groupItems, ...toolItems];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 12),\n\t\t\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tconst wantEnabled = newValue === \"on\";\n\t\t\t\tif (id.startsWith(ToolsSubmenu.GROUP_PREFIX)) {\n\t\t\t\t\tonGroupChange(id.slice(ToolsSubmenu.GROUP_PREFIX.length), wantEnabled);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Guard: never let the last core tool be turned off.\n\t\t\t\tif (!wantEnabled && ToolsSubmenu.CORE.has(id)) {\n\t\t\t\t\tconst remainingCore = [...ToolsSubmenu.CORE].filter((n) => n !== id && this.enabled.get(n));\n\t\t\t\t\tif (remainingCore.length === 0) {\n\t\t\t\t\t\tthis.settingsList.updateValue(id, \"on\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.enabled.set(id, wantEnabled);\n\t\t\t\tonChange(id, wantEnabled);\n\t\t\t},\n\t\t\tonCancel,\n\t\t\t{ enableSearch: true },\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\n/** Byte-cap presets shown as human labels; mapped back to raw byte counts. */\nconst TOOL_OUTPUT_BYTE_PRESETS: ReadonlyArray<[label: string, bytes: number]> = [\n\t[\"8 KB\", 8 * 1024],\n\t[\"16 KB\", 16 * 1024],\n\t[\"32 KB\", 32 * 1024],\n\t[\"64 KB\", 64 * 1024],\n\t[\"128 KB\", 128 * 1024],\n];\n\nfunction bytesToLabel(bytes: number): string {\n\tconst match = TOOL_OUTPUT_BYTE_PRESETS.find(([, b]) => b === bytes);\n\treturn match ? match[0] : `${Math.round(bytes / 1024)} KB`;\n}\n\n/** Byte-cap labels to cycle through, including a hand-set cap that matches no preset. */\nfunction byteLabels(current: number): string[] {\n\tconst all: Array<[string, number]> = TOOL_OUTPUT_BYTE_PRESETS.some(([, bytes]) => bytes === current)\n\t\t? [...TOOL_OUTPUT_BYTE_PRESETS]\n\t\t: [...TOOL_OUTPUT_BYTE_PRESETS, [bytesToLabel(current), current]];\n\treturn all.sort((a, b) => a[1] - b[1]).map(([label]) => label);\n}\n\ninterface ToolSettingsConfig {\n\ttoolOutputDisplay: \"collapsed\" | \"peek\" | \"standard\";\n\ttoolOutputMaxBytes: number;\n\ttoolOutputMaxLines: number;\n}\n\ninterface ToolSettingsCallbacks {\n\tonToolOutputDisplayChange: (level: \"collapsed\" | \"peek\" | \"standard\") => void;\n\tonToolOutputMaxBytesChange: (bytes: number) => void;\n\tonToolOutputMaxLinesChange: (lines: number) => void;\n}\n\n/**\n * Submenu for what a tool result looks like: how much of it is rendered, and\n * where it is truncated. The display level applies to the transcript at once;\n * the caps feed the tool runtime, so they bind on future tool calls.\n *\n * Context GC is deliberately not here. It is not about a tool's output but about\n * what stays in the outgoing context, which is the Context category's subject.\n */\nclass ToolSettingsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(config: ToolSettingsConfig, callbacks: ToolSettingsCallbacks, onCancel: () => void) {\n\t\tsuper();\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"tool-output-display\",\n\t\t\t\tlabel: \"Display\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"How tool results render. 'standard': shown (expandable). 'collapsed': hidden. 'peek': hidden with a ▸ reveal caret (press the expand key to reveal).\",\n\t\t\t\tcurrentValue: config.toolOutputDisplay,\n\t\t\t\tvalues: [\"standard\", \"collapsed\", \"peek\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"output-max-bytes\",\n\t\t\t\tlabel: \"Max bytes\",\n\t\t\t\tdescription: \"Byte cap on a single read/bash result before truncation. Applies to future tool calls.\",\n\t\t\t\tcurrentValue: bytesToLabel(config.toolOutputMaxBytes),\n\t\t\t\tvalues: byteLabels(config.toolOutputMaxBytes),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"output-max-lines\",\n\t\t\t\tlabel: \"Max lines\",\n\t\t\t\tdescription: \"Line cap on a single read/bash result before truncation. Applies to future tool calls.\",\n\t\t\t\tcurrentValue: String(config.toolOutputMaxLines),\n\t\t\t\tvalues: presetValues([200, 400, 800, 1600, 3200], config.toolOutputMaxLines),\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\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"tool-output-display\":\n\t\t\t\t\t\tcallbacks.onToolOutputDisplayChange(newValue as \"collapsed\" | \"peek\" | \"standard\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"output-max-bytes\": {\n\t\t\t\t\t\tconst preset = TOOL_OUTPUT_BYTE_PRESETS.find(([label]) => label === newValue);\n\t\t\t\t\t\t// A hand-set cap has no preset entry; its label is \"<n> KB\" by\n\t\t\t\t\t\t// construction, so read the number back out of it.\n\t\t\t\t\t\tconst bytes = preset ? preset[1] : Math.round(parseFloat(newValue) * 1024);\n\t\t\t\t\t\tif (Number.isFinite(bytes) && bytes > 0) callbacks.onToolOutputMaxBytesChange(bytes);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"output-max-lines\":\n\t\t\t\t\t\tcallbacks.onToolOutputMaxLinesChange(parseInt(newValue, 10));\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\n/** Single-line text editor for a string flag value. */\nclass FlagStringEditSubmenu extends Container {\n\tprivate input: Input;\n\n\tconstructor(flagName: string, currentValue: string, done: (value?: string) => void) {\n\t\tsuper();\n\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", `Flag: --${flagName}`)), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new Text(theme.fg(\"muted\", \"Enter a value · Enter to save · Esc to cancel\"), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.input = new Input();\n\t\tthis.input.setValue(currentValue);\n\t\tthis.input.onSubmit = (value: string) => done(value);\n\t\tthis.input.onEscape = () => done();\n\t\tthis.addChild(this.input);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.input.handleInput(data);\n\t}\n}\n\n/**\n * Submenu listing extension-registered flags. Boolean flags toggle on/off;\n * string flags open a text editor. Changes persist to settings.json and are\n * applied live best-effort — extensions that read a flag only at load time\n * pick up the new value on the next launch.\n */\nclass FlagsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(flags: FlagInfo[], onChange: (name: string, value: boolean | string) => void, onCancel: () => void) {\n\t\tsuper();\n\n\t\tconst items: SettingItem[] = flags.map((flag) => {\n\t\t\tconst baseDescription = flag.description ?? \"Extension-registered flag.\";\n\t\t\tconst description = `${baseDescription} Persists across sessions; some flags need a restart to fully apply.`;\n\t\t\tif (flag.type === \"boolean\") {\n\t\t\t\treturn {\n\t\t\t\t\tid: flag.name,\n\t\t\t\t\tlabel: flag.name,\n\t\t\t\t\tdescription,\n\t\t\t\t\tcurrentValue: flag.value ? \"on\" : \"off\",\n\t\t\t\t\tvalues: [\"on\", \"off\"],\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: flag.name,\n\t\t\t\tlabel: flag.name,\n\t\t\t\tdescription,\n\t\t\t\tcurrentValue: String(flag.value ?? \"\"),\n\t\t\t\tsubmenu: (currentValue, done) => new FlagStringEditSubmenu(flag.name, currentValue, done),\n\t\t\t};\n\t\t});\n\n\t\tconst typeByName = new Map(flags.map((f) => [f.name, f.type]));\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 12),\n\t\t\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tif (typeByName.get(id) === \"boolean\") {\n\t\t\t\t\tonChange(id, newValue === \"on\");\n\t\t\t\t} else {\n\t\t\t\t\tonChange(id, newValue);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonCancel,\n\t\t\t{ enableSearch: true },\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\n/**\n * Generic submenu holding a subset of leaf settings under a category label.\n * Shares the parent's change handler so cycle rows behave exactly as they did\n * when flat; nested submenu rows (theme, thinking, warnings) keep their own\n * factories.\n */\nclass CategorySubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(items: SettingItem[], onChange: (id: string, newValue: string) => void, onCancel: () => void) {\n\t\tsuper();\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsListTheme(),\n\t\t\tonChange,\n\t\t\tonCancel,\n\t\t\t{\n\t\t\t\tenableSearch: true,\n\t\t\t},\n\t\t);\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\nclass SelectSubmenu extends Container {\n\tprivate selectList: SelectList;\n\n\tconstructor(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\toptions: SelectItem[],\n\t\tcurrentValue: string,\n\t\tonSelect: (value: string) => void,\n\t\tonCancel: () => void,\n\t\tonSelectionChange?: (value: string) => void,\n\t) {\n\t\tsuper();\n\n\t\t// Title\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", title)), 0, 0));\n\n\t\t// Description\n\t\tif (description) {\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(new Text(theme.fg(\"muted\", description), 0, 0));\n\t\t}\n\n\t\t// Spacer\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Select list\n\t\tthis.selectList = new SelectList(\n\t\t\toptions,\n\t\t\tMath.min(options.length, 10),\n\t\t\tgetSelectListTheme(),\n\t\t\tSETTINGS_SUBMENU_SELECT_LIST_LAYOUT,\n\t\t);\n\n\t\t// Pre-select current value\n\t\tconst currentIndex = options.findIndex((o) => o.value === currentValue);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value);\n\t\t};\n\n\t\tthis.selectList.onCancel = onCancel;\n\n\t\tif (onSelectionChange) {\n\t\t\tthis.selectList.onSelectionChange = (item) => {\n\t\t\t\tonSelectionChange(item.value);\n\t\t\t};\n\t\t}\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Hint\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new Text(theme.fg(\"dim\", \" Enter to select · Esc to go back\"), 0, 0));\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.selectList.handleInput(data);\n\t}\n}\n\n/**\n * Token counts, grouped and exact.\n *\n * `formatTokens` (2.7k) exists for the fixed-width chrome, where a count must\n * never grow the box it sits in. This pane is the opposite case: the point of\n * showing a number here is to compare it with another one, and \"2.7k\" hides the\n * difference between the tool that costs 2,710 and the one that costs 2,749.\n */\nfunction tokenCount(tokens: number): string {\n\treturn tokens.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n}\n\n/**\n * The fixed per-turn cost, as one line under the pane.\n *\n * Every byte of system prompt and active tool schema is re-sent on every\n * request, and the pane is where that number is decided - so the pane is where\n * it should be visible. It reports the *live* session: a tool toggle applies at\n * once and moves it, while a setting that only takes effect next session (a tool\n * group, the light preset) leaves it alone until then.\n */\nfunction formatSurfaceLine(surface: PromptSurface): string {\n\tconst tools = `${surface.tools.length} tool${surface.tools.length === 1 ? \"\" : \"s\"}`;\n\treturn (\n\t\t` Per-turn surface: ${tokenCount(surface.totalTokens)} tokens ` +\n\t\t`${theme.fg(\"dim\", `(${tokenCount(surface.systemPromptTokens)} system prompt + ${tokenCount(surface.toolSchemaTokens)} schemas, ${tools})`)}`\n\t);\n}\n\n/**\n * Main settings selector component.\n */\nexport class SettingsSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate surfaceLine?: Text;\n\tprivate measureTokenSurface?: () => PromptSurface;\n\n\tconstructor(config: SettingsConfig, callbacks: SettingsCallbacks) {\n\t\tsuper();\n\n\t\tthis.measureTokenSurface = config.measureTokenSurface;\n\n\t\tconst supportsImages = getCapabilities().images;\n\t\tconst followUpKey = keyDisplayText(\"app.message.followUp\");\n\t\tlet currentWarnings = { ...config.warnings };\n\n\t\t// A row writes the user settings file; a key the project file also sets is\n\t\t// merged over it on the next session, so say so rather than letting the row\n\t\t// look like it took.\n\t\tconst projectPinned = new Set(config.projectPinnedSettings);\n\t\tconst pinnedNote = (key: string): string =>\n\t\t\tprojectPinned.has(key)\n\t\t\t\t? ` This repo's .hoocode/settings.json sets ${key}, which overrides this row from the next session on.`\n\t\t\t\t: \"\";\n\n\t\tconst initialSurface = config.measureTokenSurface?.();\n\n\t\tconst toolsOn = config.tools.filter((t) => t.enabled).length;\n\t\tconst toolsOff = config.tools.length - toolsOn;\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: \"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: \"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: \"install-telemetry\",\n\t\t\t\tlabel: \"Install telemetry\",\n\t\t\t\tdescription: \"Send an anonymous version/update ping after changelog-detected updates\",\n\t\t\t\tcurrentValue: config.enableInstallTelemetry ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\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: \"thinking\",\n\t\t\t\tlabel: \"Thinking level\",\n\t\t\t\tdescription: \"Reasoning depth for thinking-capable models\",\n\t\t\t\tcurrentValue: config.thinkingLevel,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tnew SelectSubmenu(\n\t\t\t\t\t\t\"Thinking Level\",\n\t\t\t\t\t\t\"Select reasoning depth for thinking-capable models\",\n\t\t\t\t\t\tconfig.availableThinkingLevels.map((level) => ({\n\t\t\t\t\t\t\tvalue: level,\n\t\t\t\t\t\t\tlabel: level,\n\t\t\t\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t\t\t\t})),\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tcallbacks.onThinkingLevelChange(value as ThinkingLevel);\n\t\t\t\t\t\t\tdone(value);\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: \"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 SelectSubmenu(\n\t\t\t\t\t\t\"Theme\",\n\t\t\t\t\t\t\"Select color theme\",\n\t\t\t\t\t\tconfig.availableThemes.map((t) => ({\n\t\t\t\t\t\t\tvalue: t,\n\t\t\t\t\t\t\tlabel: t,\n\t\t\t\t\t\t\tdescription: getThemeDescription(t),\n\t\t\t\t\t\t})),\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tcallbacks.onThemeChange(value);\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t// Restore original theme on cancel\n\t\t\t\t\t\t\tcallbacks.onThemePreview?.(currentValue);\n\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\t// Preview theme on selection change\n\t\t\t\t\t\t\tcallbacks.onThemePreview?.(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\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: presetValues([60, 80, 120], config.imageWidthCells),\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// Context GC (insert after block-images), a leaf the Context category picks up.\n\t\titems.splice(items.findIndex((item) => item.id === \"block-images\") + 1, 0, {\n\t\t\tid: \"context-gc\",\n\t\t\tlabel: \"Context GC\",\n\t\t\tdescription: \"Stub superseded read results (files later edited or re-read) out of the outgoing context.\",\n\t\t\tcurrentValue: config.contextGc ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// The light preset (insert after context GC). Read at startup to pick the\n\t\t// tool set and the system prompt, so it lands on the next session.\n\t\tconst blockImagesIdx = items.findIndex((item) => item.id === \"context-gc\");\n\t\titems.splice(blockImagesIdx + 1, 0, {\n\t\t\tid: \"light\",\n\t\t\tlabel: \"Light preset\",\n\t\t\tdescription:\n\t\t\t\t\"Low-token preset for small or local models: read/write/edit/bash only with stripped schemas, a terse system prompt, and no subagents/TodoWrite/skills/context files. Applies on the next session.\",\n\t\t\tcurrentValue: config.light ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Skill commands toggle (insert after the light preset)\n\t\tconst blockImagesIndex = items.findIndex((item) => item.id === \"light\");\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// The autonomous plugin system's master switch (insert after skill-commands).\n\t\t// One flag for the lifecycle tools and the reuse nudge, so both flip together.\n\t\tconst skillCommandsIdx = items.findIndex((item) => item.id === \"skill-commands\");\n\t\titems.splice(skillCommandsIdx + 1, 0, {\n\t\t\tid: \"plugin-tools\",\n\t\t\tlabel: \"Plugin system\",\n\t\t\tdescription: `Autonomous plugin system: the lifecycle tools (SearchPlugins, InstallPlugin, ...), ProposePlugin, and the plugin-reuse nudge. Tools arrive on the next session; the nudge follows at once.${pinnedNote(\"enablePluginTools\")}`,\n\t\t\tcurrentValue: config.enablePluginTools ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Plugin install scope (insert after the master switch). Governs the\n\t\t// autonomous InstallPlugin only — /plugin install asks per install.\n\t\tconst pluginToolsIdx = items.findIndex((item) => item.id === \"plugin-tools\");\n\t\titems.splice(pluginToolsIdx + 1, 0, {\n\t\t\tid: \"plugin-install-scope\",\n\t\t\tlabel: \"Plugin install scope\",\n\t\t\tdescription: \"Where autonomous plugin installs go: user (~/.agents) or project (this repo, shared)\",\n\t\t\tcurrentValue: config.pluginInstallScope,\n\t\t\tvalues: [\"user\", \"project\"],\n\t\t});\n\n\t\t// Artifact platform targets (insert after plugin-install-scope). Set once and\n\t\t// it holds for every later session: it is the `platform` setting, which\n\t\t// `--platform` overrides for a single run.\n\t\tconst pluginScopeIdx = items.findIndex((item) => item.id === \"plugin-install-scope\");\n\t\tlet currentPlatforms = [...config.platform];\n\t\titems.splice(pluginScopeIdx + 1, 0, {\n\t\t\tid: \"platform\",\n\t\t\tlabel: \"Platform\",\n\t\t\tdescription: `Vendor layout(s) hoocode writes artifacts in: authored plugins and the /new-skill //new-agent //new-command scaffolds.${pinnedNote(\"platform\")}`,\n\t\t\tcurrentValue: platformSummary(currentPlatforms),\n\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\tnew PlatformSubmenu(\n\t\t\t\t\tcurrentPlatforms,\n\t\t\t\t\t(platforms) => {\n\t\t\t\t\t\tcurrentPlatforms = platforms;\n\t\t\t\t\t\tcallbacks.onPlatformChange(platforms);\n\t\t\t\t\t},\n\t\t\t\t\t(summary) => done(summary),\n\t\t\t\t),\n\t\t});\n\n\t\t// Hardware cursor toggle (insert after the platform row)\n\t\tconst platformIndex = items.findIndex((item) => item.id === \"platform\");\n\t\titems.splice(platformIndex + 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 border 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-border\",\n\t\t\tlabel: \"Editor border\",\n\t\t\tdescription: \"Box draws side borders, rule draws horizontal lines only\",\n\t\t\tcurrentValue: config.editorBorder,\n\t\t\tvalues: [\"box\", \"rule\"],\n\t\t});\n\n\t\t// Editor padding toggle (insert after editor-border)\n\t\tconst editorBorderIndex = items.findIndex((item) => item.id === \"editor-border\");\n\t\titems.splice(editorBorderIndex + 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// Autocomplete max visible 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: \"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: presetValues([3, 5, 7, 10, 15, 20], config.autocompleteMaxVisible),\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// Voice silence window (insert after terminal-progress)\n\t\tconst terminalProgressIndex = items.findIndex((item) => item.id === \"terminal-progress\");\n\t\titems.splice(terminalProgressIndex + 1, 0, {\n\t\t\tid: \"voice-silence-ms\",\n\t\t\tlabel: \"Voice silence window\",\n\t\t\tdescription: \"Trailing-silence (ms) before voice capture auto-stops (300-10000). Env: VOICETOOLS_SILENCE_MS.\",\n\t\t\tcurrentValue: String(config.voiceSilenceMs),\n\t\t\tvalues: presetValues([300, 500, 800, 1200, 2000, 3000, 5000, 8000, 10000], config.voiceSilenceMs),\n\t\t});\n\n\t\t// Webtools request timeout (insert after voice-silence-ms)\n\t\tconst voiceSilenceIndex = items.findIndex((item) => item.id === \"voice-silence-ms\");\n\t\titems.splice(voiceSilenceIndex + 1, 0, {\n\t\t\tid: \"webtools-timeout-secs\",\n\t\t\tlabel: \"Web tools timeout\",\n\t\t\tdescription: \"Per-request timeout (secs) for webfetch/websearch (1-120). Env: HOOCODE_WEBTOOLS_TIMEOUT.\",\n\t\t\tcurrentValue: String(config.webtoolsTimeoutSecs),\n\t\t\tvalues: presetValues([5, 10, 15, 30, 60, 120], config.webtoolsTimeoutSecs),\n\t\t});\n\n\t\t// The /learn thresholds, appended as leaf rows and gathered into their own\n\t\t// category below. They are written to the user settings.json, which /learn\n\t\t// re-reads on every invocation, so a change here applies to the next run.\n\t\tconst webtoolsIndex = items.findIndex((item) => item.id === \"webtools-timeout-secs\");\n\t\titems.splice(\n\t\t\twebtoolsIndex + 1,\n\t\t\t0,\n\t\t\t...LEARN_SETTINGS.map(({ key, label, description, presets }) => ({\n\t\t\t\tid: key,\n\t\t\t\tlabel,\n\t\t\t\tdescription,\n\t\t\t\tcurrentValue: String(config.learn[key]),\n\t\t\t\tvalues: presetValues(presets, config.learn[key]),\n\t\t\t})),\n\t\t);\n\n\t\t// Keep the tool/flag controls together as one block near the top, inserted\n\t\t// after the image/terminal splices above so they aren't leapfrogged.\n\t\tconst toolFlagGroup: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"tools\",\n\t\t\t\tlabel: \"Tools\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Enable/disable tools and tool groups (web, semantic search), each priced by what its schema costs per turn. Changes persist across sessions.\",\n\t\t\t\tcurrentValue: toolsOff > 0 ? `${toolsOn} on · ${toolsOff} off` : `${toolsOn} on`,\n\t\t\t\tvalueSuffix: initialSurface ? `${tokenCount(initialSurface.toolSchemaTokens)} tok/turn` : undefined,\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew ToolsSubmenu(\n\t\t\t\t\t\tconfig.tools,\n\t\t\t\t\t\tconfig.toolGroups,\n\t\t\t\t\t\t(name, enabled) => {\n\t\t\t\t\t\t\tcallbacks.onToolEnabledChange(name, enabled);\n\t\t\t\t\t\t\t// Applied live by the host, so the surface below is already stale.\n\t\t\t\t\t\t\tthis.refreshTokenSurface();\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(id, enabled) => callbacks.onToolGroupChange(id, enabled),\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: \"tool-output\",\n\t\t\t\tlabel: \"Tool output\",\n\t\t\t\tdescription: \"How much of a tool result is rendered, and where it is truncated.\",\n\t\t\t\tcurrentValue: config.toolOutputDisplay,\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew ToolSettingsSubmenu(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttoolOutputDisplay: config.toolOutputDisplay,\n\t\t\t\t\t\t\ttoolOutputMaxBytes: config.toolOutputMaxBytes,\n\t\t\t\t\t\t\ttoolOutputMaxLines: config.toolOutputMaxLines,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tonToolOutputDisplayChange: callbacks.onToolOutputDisplayChange,\n\t\t\t\t\t\t\tonToolOutputMaxBytesChange: callbacks.onToolOutputMaxBytesChange,\n\t\t\t\t\t\t\tonToolOutputMaxLinesChange: callbacks.onToolOutputMaxLinesChange,\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];\n\t\tif (config.flags.length > 0) {\n\t\t\ttoolFlagGroup.push({\n\t\t\t\tid: \"flags\",\n\t\t\t\tlabel: \"Flags\",\n\t\t\t\tdescription: \"Set flags registered by extensions. Changes persist across sessions.\",\n\t\t\t\tcurrentValue: `${config.flags.length} flag${config.flags.length === 1 ? \"\" : \"s\"}`,\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew FlagsSubmenu(\n\t\t\t\t\t\tconfig.flags,\n\t\t\t\t\t\t(name, value) => callbacks.onFlagChange(name, value),\n\t\t\t\t\t\t() => done(),\n\t\t\t\t\t),\n\t\t\t});\n\t\t}\n\t\t// Add borders\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Shared change handler for every leaf (cycle) setting; used by the\n\t\t// top-level list and each category submenu.\n\t\tconst applyChange = (id: string, newValue: string): void => {\n\t\t\tswitch (id) {\n\t\t\t\tcase \"autocompact\":\n\t\t\t\t\tcallbacks.onAutoCompactChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"show-images\":\n\t\t\t\t\tcallbacks.onShowImagesChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"image-width-cells\":\n\t\t\t\t\tcallbacks.onImageWidthCellsChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"auto-resize-images\":\n\t\t\t\t\tcallbacks.onAutoResizeImagesChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"block-images\":\n\t\t\t\t\tcallbacks.onBlockImagesChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"skill-commands\":\n\t\t\t\t\tcallbacks.onEnableSkillCommandsChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"light\":\n\t\t\t\t\tcallbacks.onLightChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"plugin-tools\":\n\t\t\t\t\tcallbacks.onEnablePluginToolsChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"plugin-install-scope\":\n\t\t\t\t\tcallbacks.onPluginInstallScopeChange(newValue as \"user\" | \"project\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"platform\":\n\t\t\t\t\t// Display only. Each toggle inside the submenu already applied itself;\n\t\t\t\t\t// closing it hands back the summary purely to refresh this row's value.\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"steering-mode\":\n\t\t\t\t\tcallbacks.onSteeringModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"follow-up-mode\":\n\t\t\t\t\tcallbacks.onFollowUpModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"transport\":\n\t\t\t\t\tcallbacks.onTransportChange(newValue as Transport);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"hide-thinking\":\n\t\t\t\t\tcallbacks.onHideThinkingBlockChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"collapse-changelog\":\n\t\t\t\t\tcallbacks.onCollapseChangelogChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"quiet-startup\":\n\t\t\t\t\tcallbacks.onQuietStartupChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"install-telemetry\":\n\t\t\t\t\tcallbacks.onEnableInstallTelemetryChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"double-escape-action\":\n\t\t\t\t\tcallbacks.onDoubleEscapeActionChange(newValue as \"fork\" | \"tree\" | \"none\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"tree-filter-mode\":\n\t\t\t\t\tcallbacks.onTreeFilterModeChange(\n\t\t\t\t\t\tnewValue as \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\",\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"show-hardware-cursor\":\n\t\t\t\t\tcallbacks.onShowHardwareCursorChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"editor-border\":\n\t\t\t\t\tcallbacks.onEditorBorderChange(newValue as \"rule\" | \"box\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"editor-padding\":\n\t\t\t\t\tcallbacks.onEditorPaddingXChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"autocomplete-max-visible\":\n\t\t\t\t\tcallbacks.onAutocompleteMaxVisibleChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"clear-on-shrink\":\n\t\t\t\t\tcallbacks.onClearOnShrinkChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"terminal-progress\":\n\t\t\t\t\tcallbacks.onShowTerminalProgressChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"voice-silence-ms\":\n\t\t\t\t\tcallbacks.onVoiceSilenceMsChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"webtools-timeout-secs\":\n\t\t\t\t\tcallbacks.onWebtoolsTimeoutSecsChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t// The /learn rows are keyed by their settings.json name, so they need\n\t\t\t\t\t// no case of their own — the id is the key to write.\n\t\t\t\t\tif (LEARN_KEYS.has(id)) callbacks.onLearnSettingChange(id as LearnSettingKey, parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Most rows leave the per-turn surface alone; the ones that do not (a tool\n\t\t\t// toggle, anything that rebuilds the system prompt) move it immediately.\n\t\t\t// Re-measuring after every change is cheaper than knowing which is which.\n\t\t\tthis.refreshTokenSurface();\n\t\t};\n\n\t\t// Partition the flat leaf settings into named category submenus so the\n\t\t// top level stays short. `items` holds autocompact + every leaf setting.\n\t\tconst byId = new Map(items.map((item) => [item.id, item] as const));\n\t\tconst pick = (ids: string[]): SettingItem[] =>\n\t\t\tids.map((id) => byId.get(id)).filter((item): item is SettingItem => item !== undefined);\n\t\tconst categoryRow = (id: string, label: string, description: string, ids: string[]): SettingItem => {\n\t\t\tconst members = pick(ids);\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel,\n\t\t\t\tdescription,\n\t\t\t\tcurrentValue: `${members.length} setting${members.length === 1 ? \"\" : \"s\"}`,\n\t\t\t\t// Categories shortened the top level but also hid every setting from\n\t\t\t\t// its search: searching \"theme\" matched no category label. The member\n\t\t\t\t// labels ride along as search text so the query lands on the category\n\t\t\t\t// that holds the setting.\n\t\t\t\tkeywords: members.map((member) => member.label).join(\" \"),\n\t\t\t\tsubmenu: (_currentValue, done) => new CategorySubmenu(members, applyChange, () => done()),\n\t\t\t};\n\t\t};\n\n\t\tconst topItems: SettingItem[] = [\n\t\t\t...toolFlagGroup,\n\t\t\t// What the model is sent, and how much of it. Auto-compact used to sit\n\t\t\t// alone at the top level and context GC was filed under tool settings,\n\t\t\t// which left the three settings that decide the token budget in three\n\t\t\t// different places - with the light preset in none of them.\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-context\",\n\t\t\t\t\"Context\",\n\t\t\t\t\"What the model is sent and how much of it: compaction, superseded reads, and the low-token preset.\",\n\t\t\t\t[\"autocompact\", \"context-gc\", \"light\"],\n\t\t\t),\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-behavior\",\n\t\t\t\t\"Behavior\",\n\t\t\t\t\"Agent and session behavior: steering, follow-up, thinking, escape, tree filter, transport.\",\n\t\t\t\t[\"steering-mode\", \"follow-up-mode\", \"thinking\", \"double-escape-action\", \"tree-filter-mode\", \"transport\"],\n\t\t\t),\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-interface\",\n\t\t\t\t\"Interface\",\n\t\t\t\t\"Appearance and editor: theme, thinking visibility, cursor, border, padding, autocomplete, terminal.\",\n\t\t\t\t[\n\t\t\t\t\t\"theme\",\n\t\t\t\t\t\"hide-thinking\",\n\t\t\t\t\t\"show-hardware-cursor\",\n\t\t\t\t\t\"editor-border\",\n\t\t\t\t\t\"editor-padding\",\n\t\t\t\t\t\"autocomplete-max-visible\",\n\t\t\t\t\t\"clear-on-shrink\",\n\t\t\t\t\t\"terminal-progress\",\n\t\t\t\t],\n\t\t\t),\n\t\t\t// Artifact production. `plugin-install-scope` had no category and was\n\t\t\t// therefore unreachable from the pane despite having a live callback.\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-plugins\",\n\t\t\t\t\"Plugins\",\n\t\t\t\t\"The autonomous plugin system's master switch, the vendor layout hoocode writes, and where autonomous installs land.\",\n\t\t\t\t[\"plugin-tools\", \"platform\", \"plugin-install-scope\"],\n\t\t\t),\n\t\t\tcategoryRow(\"cat-images\", \"Images\", \"Inline image rendering and resizing.\", [\n\t\t\t\t\"show-images\",\n\t\t\t\t\"image-width-cells\",\n\t\t\t\t\"auto-resize-images\",\n\t\t\t\t\"block-images\",\n\t\t\t]),\n\t\t\t// Top level rather than folded into Advanced: these are the thresholds\n\t\t\t// that decide whether /learn finds anything, and burying them is what\n\t\t\t// made them undiscoverable in the first place.\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-learn\",\n\t\t\t\t\"Learning\",\n\t\t\t\t\"Thresholds /learn mines sessions with: how far back to look, and how often something must repeat.\",\n\t\t\t\tLEARN_SETTINGS.map((setting) => setting.key),\n\t\t\t),\n\t\t\tcategoryRow(\"cat-advanced\", \"Advanced\", \"Startup, telemetry, skills, warnings, voice, and web tools.\", [\n\t\t\t\t\"quiet-startup\",\n\t\t\t\t\"collapse-changelog\",\n\t\t\t\t\"install-telemetry\",\n\t\t\t\t\"skill-commands\",\n\t\t\t\t\"warnings\",\n\t\t\t\t\"voice-silence-ms\",\n\t\t\t\t\"webtools-timeout-secs\",\n\t\t\t]),\n\t\t];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\ttopItems,\n\t\t\tMath.min(topItems.length, 10),\n\t\t\tgetSettingsListTheme(),\n\t\t\tapplyChange,\n\t\t\tcallbacks.onCancel,\n\t\t\t{\n\t\t\t\tenableSearch: true,\n\t\t\t},\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t\tif (initialSurface) {\n\t\t\tthis.surfaceLine = new Text(formatSurfaceLine(initialSurface), 0, 0);\n\t\t\tthis.addChild(this.surfaceLine);\n\t\t}\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\t/** Re-price the pane after a change that may have altered what each turn sends. */\n\tprivate refreshTokenSurface(): void {\n\t\tif (!this.surfaceLine || !this.measureTokenSurface) return;\n\t\tthis.surfaceLine.setText(formatSurfaceLine(this.measureTokenSurface()));\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 type { ThinkingLevel } from \"@kolisachint/hoocode-agent-core\";\nimport type { Transport } from \"@kolisachint/hoocode-ai\";\nimport {\n\tContainer,\n\tgetCapabilities,\n\tInput,\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SettingItem,\n\tSettingsList,\n\tSpacer,\n\tText,\n} from \"@kolisachint/hoocode-tui\";\nimport type { MarketplacePlatform } from \"../../../core/extensions/plugins/formats/types.js\";\nimport type { ExternalToolStatus } from \"../../../core/external-tools.js\";\nimport { buildRowGates, statusLabel } from \"../../../core/external-tools.js\";\nimport type { PromptSurface } from \"../../../core/light.js\";\nimport type { LearnSettingKey, WarningSettings } from \"../../../core/settings-manager.js\";\nimport {\n\tTOOL_OUTPUT_VIEW_DESCRIPTIONS,\n\tTOOL_OUTPUT_VIEWS,\n\ttype ToolOutputView,\n} from \"../../../core/tool-output-view.js\";\nimport { getSelectListTheme, getSettingsListTheme, getThemeDescription, theme } from \"../theme/theme.js\";\nimport { DynamicBorder } from \"./dynamic-border.js\";\nimport { keyDisplayText } from \"./keybinding-hints.js\";\n\nconst SETTINGS_SUBMENU_SELECT_LIST_LAYOUT: SelectListLayoutOptions = {\n\tminPrimaryColumnWidth: 12,\n\tmaxPrimaryColumnWidth: 32,\n};\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: \"Maximum reasoning (~32k tokens)\",\n};\n\ninterface ToolToggleInfo {\n\t/** Tool name (e.g. \"read\", \"bash\"). */\n\tname: string;\n\t/** Whether the tool is currently enabled (not in the persisted disabled set). */\n\tenabled: boolean;\n\t/**\n\t * What this tool's serialized schema costs on every request. Priced whether or\n\t * not it is on: for a tool that is off, this is what turning it on will cost.\n\t * Undefined for a tool that was disabled before launch, whose schema this\n\t * session never built.\n\t */\n\ttokens?: number;\n}\n\ninterface FlagInfo {\n\t/** Flag name (without the leading --). */\n\tname: string;\n\tdescription?: string;\n\ttype: \"boolean\" | \"string\";\n\t/** Current effective value. */\n\tvalue: boolean | string;\n}\n\ninterface ToolGroupInfo {\n\t/** Group identifier (e.g. \"web\", \"embsearch\"). */\n\tid: string;\n\tlabel: string;\n\tdescription: string;\n\t/** Whether the group is currently enabled (its tools are available). */\n\tenabled: boolean;\n}\n\nexport interface SettingsConfig {\n\tautoCompact: boolean;\n\ttools: ToolToggleInfo[];\n\ttoolGroups: ToolGroupInfo[];\n\t/**\n\t * The external Rust binaries and whether each one is present. Rendered as\n\t * its own top-level category, and used to annotate the rows that are gated\n\t * on a binary that is not installed.\n\t */\n\texternalTools: ExternalToolStatus[];\n\tflags: FlagInfo[];\n\ttoolOutputView: ToolOutputView;\n\ttoolOutputMaxBytes: number;\n\ttoolOutputMaxLines: number;\n\tcontextGc: boolean;\n\tshowImages: boolean;\n\timageWidthCells: number;\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tenableSkillCommands: boolean;\n\tlight: boolean;\n\tpluginInstallScope: \"user\" | \"project\";\n\tenablePluginTools: boolean;\n\t/**\n\t * settings.json keys the project file sets. A pane row writes user scope, so\n\t * anything listed here wins again on the next session however the row is set.\n\t */\n\tprojectPinnedSettings: string[];\n\t/** Platform layouts in force this session (empty = unset, per-consumer defaults apply). */\n\tplatform: MarketplacePlatform[];\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\ttransport: Transport;\n\tthinkingLevel: ThinkingLevel;\n\tavailableThinkingLevels: ThinkingLevel[];\n\tcurrentTheme: string;\n\tavailableThemes: string[];\n\thideThinkingBlock: boolean;\n\tcollapseChangelog: boolean;\n\tenableInstallTelemetry: boolean;\n\tdoubleEscapeAction: \"fork\" | \"tree\" | \"none\";\n\ttreeFilterMode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\";\n\tshowHardwareCursor: boolean;\n\teditorBorder: \"rule\" | \"box\";\n\teditorPaddingX: number;\n\tautocompleteMaxVisible: number;\n\tquietStartup: boolean;\n\tclearOnShrink: boolean;\n\tshowTerminalProgress: boolean;\n\twarnings: WarningSettings;\n\tvoiceSilenceMs: number;\n\twebtoolsTimeoutSecs: number;\n\tlearn: Record<LearnSettingKey, number>;\n\t/**\n\t * Re-measure the fixed per-turn surface (system prompt + active tool schemas).\n\t * Called on open and after every change, so a toggle that costs tokens shows\n\t * what it cost. Omitted by callers that have no session to measure.\n\t */\n\tmeasureTokenSurface?: () => PromptSurface;\n}\n\nexport interface SettingsCallbacks {\n\tonAutoCompactChange: (enabled: boolean) => void;\n\tonToolEnabledChange: (name: string, enabled: boolean) => void;\n\tonToolGroupChange: (id: string, enabled: boolean) => void;\n\tonToolOutputViewChange: (view: ToolOutputView) => void;\n\tonToolOutputMaxBytesChange: (bytes: number) => void;\n\tonToolOutputMaxLinesChange: (lines: number) => void;\n\tonContextGcChange: (enabled: boolean) => void;\n\tonFlagChange: (name: string, value: boolean | string) => 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\tonLightChange: (enabled: boolean) => void;\n\tonPluginInstallScopeChange: (scope: \"user\" | \"project\") => void;\n\tonEnablePluginToolsChange: (enabled: boolean) => void;\n\tonPlatformChange: (platforms: MarketplacePlatform[]) => 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\tonThinkingLevelChange: (level: ThinkingLevel) => void;\n\tonThemeChange: (theme: string) => void;\n\tonThemePreview?: (theme: string) => void;\n\tonHideThinkingBlockChange: (hidden: boolean) => void;\n\tonCollapseChangelogChange: (collapsed: boolean) => void;\n\tonEnableInstallTelemetryChange: (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\tonEditorBorderChange: (border: \"rule\" | \"box\") => void;\n\tonEditorPaddingXChange: (padding: number) => void;\n\tonAutocompleteMaxVisibleChange: (maxVisible: number) => void;\n\tonQuietStartupChange: (enabled: boolean) => void;\n\tonClearOnShrinkChange: (enabled: boolean) => void;\n\tonShowTerminalProgressChange: (enabled: boolean) => void;\n\tonWarningsChange: (warnings: WarningSettings) => void;\n\tonVoiceSilenceMsChange: (ms: number) => void;\n\tonWebtoolsTimeoutSecsChange: (secs: number) => void;\n\tonLearnSettingChange: (key: LearnSettingKey, value: number) => void;\n\tonCancel: () => void;\n}\n\n/**\n * The `/learn` thresholds as pane rows: the presets to cycle through, and what\n * each one buys. Kept as a table because all five are the same shape — a\n * positive integer with a handful of sensible values — and the pane, the change\n * handler and the category row all read from it rather than repeating the list.\n */\nconst LEARN_SETTINGS: ReadonlyArray<{\n\tkey: LearnSettingKey;\n\tlabel: string;\n\tdescription: string;\n\tpresets: number[];\n}> = [\n\t{\n\t\tkey: \"learnMaxSessions\",\n\t\tlabel: \"Sessions scanned\",\n\t\tdescription: \"How many recent sessions in this directory /learn mines. Raise it on a repo you touch rarely.\",\n\t\tpresets: [10, 20, 30, 50, 100],\n\t},\n\t{\n\t\tkey: \"learnMaxAgeDays\",\n\t\tlabel: \"Session age limit\",\n\t\tdescription: \"Ignore sessions older than this many days. A pattern that stopped is not a rule.\",\n\t\tpresets: [7, 14, 30, 60, 90, 180],\n\t},\n\t{\n\t\tkey: \"learnMinRepeats\",\n\t\tlabel: \"Directive repeats\",\n\t\tdescription:\n\t\t\t\"Times a directive must recur before it is proposed. The signal/noise dial: raise it for fewer, better-evidenced proposals.\",\n\t\tpresets: [2, 3, 4, 5],\n\t},\n\t{\n\t\tkey: \"learnMinRequestRepeats\",\n\t\tlabel: \"Workflow repeats\",\n\t\tdescription: \"Non-overlapping repeats a tool sequence needs before it is proposed as a skill.\",\n\t\tpresets: [2, 3, 4, 5, 6],\n\t},\n\t{\n\t\tkey: \"learnMaxProposals\",\n\t\tlabel: \"Max proposals\",\n\t\tdescription: \"Cap on each list in the digest. Every proposal costs the model context.\",\n\t\tpresets: [3, 5, 8, 12, 20],\n\t},\n];\n\nconst LEARN_KEYS: ReadonlySet<string> = new Set(LEARN_SETTINGS.map((setting) => setting.key));\n\n/**\n * Preset list for a numeric row, guaranteed to contain the value in force.\n *\n * Without this a value set by hand in settings.json — say 45 days — is absent\n * from the cycle, so the first keypress silently snaps it to the first preset,\n * discarding a deliberate choice the pane never showed as unusual. Every numeric\n * cycle row goes through this for that reason.\n */\nfunction presetValues(presets: number[], current: number): string[] {\n\tconst all = presets.includes(current) ? presets : [...presets, current].sort((a, b) => a - b);\n\treturn all.map(String);\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\tgetSettingsListTheme(),\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\n/**\n * The artifact platform targets, in the order the pane shows them. Each row is an\n * independent on/off toggle because `--platform` (and the `platform` setting it\n * mirrors) takes a list: emitting for two platforms at once is a supported shape.\n * The tokens here are the canonical ones — the CLI aliases (`copilot`, `gh`,\n * `native`) fold into these before anything reads them.\n */\nconst PLATFORM_ROWS: ReadonlyArray<{\n\tplatform: MarketplacePlatform;\n\tlabel: string;\n\tdescription: string;\n}> = [\n\t{\n\t\tplatform: \"claude\",\n\t\tlabel: \"claude\",\n\t\tdescription:\n\t\t\t\"Claude Code layout: .claude/ scaffolds, and authored plugins drop into ~/.claude/skills/<id>/. The default when nothing is set.\",\n\t},\n\t{\n\t\tplatform: \"github\",\n\t\tlabel: \"github (copilot, gh)\",\n\t\tdescription:\n\t\t\t\"Copilot layout: .github/ scaffolds, and authored plugins are produced under ~/.agents/publish/github/<id>/.\",\n\t},\n\t{\n\t\tplatform: \"agents\",\n\t\tlabel: \"agents (native)\",\n\t\tdescription:\n\t\t\t\"Cross-vendor .agents/ layout. Scaffolds only - a plugin belongs to no marketplace in this layout, so plugin authoring ignores it.\",\n\t},\n];\n\n/** Row value for the platform setting: the selection, or the fallback when it is empty. */\nfunction platformSummary(platforms: readonly MarketplacePlatform[]): string {\n\treturn platforms.length > 0 ? platforms.join(\", \") : \"default (claude)\";\n}\n\n/**\n * Submenu for the session's artifact platform targets (the `platform` setting,\n * same knob as `--platform`).\n *\n * A list rather than a cycle: the setting is a list, and the three tokens are not\n * mutually exclusive. Turning everything off is legal and means \"unset\" — the\n * per-consumer defaults come back (claude for plugins, .hoocode/ for scaffolds).\n */\nclass PlatformSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate selected: Set<MarketplacePlatform>;\n\n\tconstructor(\n\t\tplatforms: readonly MarketplacePlatform[],\n\t\tonChange: (platforms: MarketplacePlatform[]) => void,\n\t\tonDone: (summary: string) => void,\n\t) {\n\t\tsuper();\n\n\t\tthis.selected = new Set(platforms);\n\n\t\tconst items: SettingItem[] = PLATFORM_ROWS.map(({ platform, label, description }) => ({\n\t\t\tid: platform,\n\t\t\tlabel,\n\t\t\tdescription,\n\t\t\tcurrentValue: this.selected.has(platform) ? \"on\" : \"off\",\n\t\t\tvalues: [\"on\", \"off\"],\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\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tconst platform = id as MarketplacePlatform;\n\t\t\t\tif (newValue === \"on\") this.selected.add(platform);\n\t\t\t\telse this.selected.delete(platform);\n\t\t\t\tonChange(this.ordered());\n\t\t\t},\n\t\t\t() => onDone(platformSummary(this.ordered())),\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\t/** Selection in the pane's order, so the persisted list does not depend on click order. */\n\tprivate ordered(): MarketplacePlatform[] {\n\t\treturn PLATFORM_ROWS.map((row) => row.platform).filter((platform) => this.selected.has(platform));\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\n/**\n * Trailing sentence for a row whose setting is inert until an external binary\n * shows up. The row is annotated rather than hidden: the binaries were invisible\n * precisely because nothing ever mentioned them, and a row that disappears when\n * its dependency is missing teaches the user nothing at all.\n */\nfunction gateNote(gate: ExternalToolStatus | undefined): string {\n\tif (!gate || gate.installed) return \"\";\n\treturn gate.downloadable\n\t\t? ` Needs the ${gate.tool} binary, which hoocode fetches the first time this is used. Until then: ${gate.fallback}`\n\t\t: ` Needs the ${gate.tool} binary, and this environment will not fetch it. Until then: ${gate.fallback}`;\n}\n\n/** \"3 of 5 installed\" - the one number that says whether this category needs attention. */\nfunction externalCount(statuses: readonly ExternalToolStatus[]): string {\n\tconst installed = statuses.filter((status) => status.installed).length;\n\treturn `${installed} of ${statuses.length} installed`;\n}\n\n/** The capability words, so the category row says what the binaries are for. */\nfunction externalSummary(statuses: readonly ExternalToolStatus[]): string {\n\treturn statuses.map((status) => status.tool).join(\", \");\n}\n\n/** Value-column marker for a gated row, so the list shows it without selecting. */\nfunction gateSuffix(gate: ExternalToolStatus | undefined): string | undefined {\n\tif (!gate || gate.installed) return undefined;\n\treturn `needs ${gate.tool}`;\n}\n\n/**\n * Submenu for tool availability. The first rows are group switches (web,\n * semantic search) that decide whether a group's tools\n * exist at all — this is the same master switch that governs, e.g., the\n * webfetch/websearch tools. Below them are per-tool on/off toggles for the\n * tools that are currently available.\n *\n * Group switches change tool availability and apply on the next session;\n * per-tool toggles apply live and persist. A minimum core (read/bash/edit/\n * write) is guarded so the agent can never be left with no way to act.\n */\nclass ToolsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate enabled: Map<string, boolean>;\n\tprivate static readonly CORE = new Set([\"read\", \"bash\", \"edit\", \"write\"]);\n\tprivate static readonly GROUP_PREFIX = \"group:\";\n\n\tconstructor(\n\t\ttools: ToolToggleInfo[],\n\t\tgroups: ToolGroupInfo[],\n\t\t/** Rows gated on an external binary, keyed by row id. See buildRowGates. */\n\t\tgates: ReadonlyMap<string, ExternalToolStatus>,\n\t\tonChange: (name: string, enabled: boolean) => void,\n\t\tonGroupChange: (id: string, enabled: boolean) => void,\n\t\tonCancel: () => void,\n\t) {\n\t\tsuper();\n\n\t\tthis.enabled = new Map(tools.map((t) => [t.name, t.enabled]));\n\n\t\tconst groupItems: SettingItem[] = groups.map((group) => {\n\t\t\tconst id = `${ToolsSubmenu.GROUP_PREFIX}${group.id}`;\n\t\t\tconst gate = gates.get(id);\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel: `[group] ${group.label}`,\n\t\t\t\tdescription: `${group.description} Governs whether these tools exist; applies on the next session.${gateNote(gate)}`,\n\t\t\t\tcurrentValue: group.enabled ? \"on\" : \"off\",\n\t\t\t\t// The switch stays settable with the binary missing: the setting is\n\t\t\t\t// what makes hoocode fetch it, so refusing the toggle would make the\n\t\t\t\t// group unreachable forever.\n\t\t\t\tvalueSuffix: gateSuffix(gate),\n\t\t\t\tvalues: [\"on\", \"off\"],\n\t\t\t};\n\t\t});\n\n\t\tconst toolItems: SettingItem[] = tools.map((tool) => ({\n\t\t\tid: tool.name,\n\t\t\tlabel: tool.name,\n\t\t\tdescription: ToolsSubmenu.CORE.has(tool.name)\n\t\t\t\t? \"Core tool. Disabling leaves the agent unable to perform this action in every session.\"\n\t\t\t\t: \"Disable to remove this tool from the agent this session and every future session.\",\n\t\t\tcurrentValue: tool.enabled ? \"on\" : \"off\",\n\t\t\t// What the schema costs on every request, whether the tool is on or off:\n\t\t\t// off, it is the price of turning it back on. This is the number that\n\t\t\t// makes a tool worth disabling, so it belongs beside the switch.\n\t\t\tvalueSuffix: tool.tokens !== undefined ? `${tokenCount(tool.tokens)} tok/turn` : undefined,\n\t\t\tvalues: [\"on\", \"off\"],\n\t\t}));\n\n\t\tconst items = [...groupItems, ...toolItems];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 12),\n\t\t\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tconst wantEnabled = newValue === \"on\";\n\t\t\t\tif (id.startsWith(ToolsSubmenu.GROUP_PREFIX)) {\n\t\t\t\t\tonGroupChange(id.slice(ToolsSubmenu.GROUP_PREFIX.length), wantEnabled);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Guard: never let the last core tool be turned off.\n\t\t\t\tif (!wantEnabled && ToolsSubmenu.CORE.has(id)) {\n\t\t\t\t\tconst remainingCore = [...ToolsSubmenu.CORE].filter((n) => n !== id && this.enabled.get(n));\n\t\t\t\t\tif (remainingCore.length === 0) {\n\t\t\t\t\t\tthis.settingsList.updateValue(id, \"on\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.enabled.set(id, wantEnabled);\n\t\t\t\tonChange(id, wantEnabled);\n\t\t\t},\n\t\t\tonCancel,\n\t\t\t{ enableSearch: true },\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\n/**\n * Read-only detail for one external binary: what it is, whether it is here, what\n * it turns on, and what hoocode does without it.\n *\n * A submenu rather than a long `description` because the useful answer is five\n * or six lines and the pane shows descriptions on one. Nothing here is settable\n * - the binary is either on the machine or it is not - so the rows carry no\n * `values` and Enter does nothing but close.\n */\nclass ExternalToolDetailSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(status: ExternalToolStatus, onCancel: () => void) {\n\t\tsuper();\n\n\t\tconst acquisition =\n\t\t\tstatus.acquisition === \"startup\"\n\t\t\t\t? \"Downloaded in the background at startup.\"\n\t\t\t\t: status.acquisition === \"on-demand\"\n\t\t\t\t\t? \"Downloaded the first time the feature is used.\"\n\t\t\t\t\t: \"Never downloaded automatically; install it yourself.\";\n\n\t\tconst location = status.installed\n\t\t\t? status.source === \"path\"\n\t\t\t\t? `found on PATH as \\`${status.path}\\``\n\t\t\t\t: status.source === \"override\"\n\t\t\t\t\t? `${status.overrideEnv} points at ${status.path}`\n\t\t\t\t\t: `hoocode's own copy at ${status.path}`\n\t\t\t: status.downloadable\n\t\t\t\t? `${acquisition} Not on this machine yet.`\n\t\t\t\t: \"Not installed, and this environment will not download it (offline mode, or no published build for this platform).\";\n\n\t\tconst rows: ReadonlyArray<[label: string, value: string, description: string]> = [\n\t\t\t[\"Status\", statusLabel(status), location],\n\t\t\t[\n\t\t\t\t\"Enables\",\n\t\t\t\t`${status.enables.length} feature${status.enables.length === 1 ? \"\" : \"s\"}`,\n\t\t\t\tstatus.enables.join(\"; \"),\n\t\t\t],\n\t\t\t[\"Without it\", \"fallback\", status.fallback],\n\t\t\t[\"Source\", status.repo || \"-\", `Release archives come from github.com/${status.repo}. ${acquisition}`],\n\t\t\t[\"Env\", String(status.env.length), status.env.join(\" | \")],\n\t\t];\n\n\t\tconst items: SettingItem[] = rows.map(([label, value, description], index) => ({\n\t\t\tid: `detail-${index}`,\n\t\t\tlabel,\n\t\t\tcurrentValue: value,\n\t\t\tdescription,\n\t\t}));\n\n\t\tthis.settingsList = new SettingsList(items, items.length, getSettingsListTheme(), () => {}, onCancel);\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\n/**\n * The external-binary category: one row per managed Rust binary.\n *\n * These binaries were entirely invisible before this pane existed. hoocode works\n * without every one of them, which is the whole reason nobody found them: search\n * silently got slower, semantic ranking silently never happened, and web/voice\n * were simply features nobody knew were there. The row states presence; the\n * submenu states what presence buys.\n */\nclass ExternalToolsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(statuses: ExternalToolStatus[], onCancel: () => void) {\n\t\tsuper();\n\n\t\tconst items: SettingItem[] = statuses.map((status) => ({\n\t\t\tid: `ext-${status.tool}`,\n\t\t\tlabel: status.label,\n\t\t\tdescription: `${status.summary} Without it: ${status.fallback}`,\n\t\t\tcurrentValue: statusLabel(status),\n\t\t\t// The value column says whether it is here; the suffix says what it is\n\t\t\t// for, so the list reads without opening every row.\n\t\t\tvalueSuffix: status.installed ? undefined : status.downloadable ? \"auto-fetch\" : \"manual\",\n\t\t\tkeywords: [status.tool, status.repo, ...status.settingsKeys, ...status.enables].join(\" \"),\n\t\t\tsubmenu: (_currentValue, done) => new ExternalToolDetailSubmenu(status, () => done()),\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\tgetSettingsListTheme(),\n\t\t\t() => {},\n\t\t\tonCancel,\n\t\t\t{ enableSearch: true },\n\t\t);\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\n/** Byte-cap presets shown as human labels; mapped back to raw byte counts. */\nconst TOOL_OUTPUT_BYTE_PRESETS: ReadonlyArray<[label: string, bytes: number]> = [\n\t[\"8 KB\", 8 * 1024],\n\t[\"16 KB\", 16 * 1024],\n\t[\"32 KB\", 32 * 1024],\n\t[\"64 KB\", 64 * 1024],\n\t[\"128 KB\", 128 * 1024],\n];\n\nfunction bytesToLabel(bytes: number): string {\n\tconst match = TOOL_OUTPUT_BYTE_PRESETS.find(([, b]) => b === bytes);\n\treturn match ? match[0] : `${Math.round(bytes / 1024)} KB`;\n}\n\n/** Byte-cap labels to cycle through, including a hand-set cap that matches no preset. */\nfunction byteLabels(current: number): string[] {\n\tconst all: Array<[string, number]> = TOOL_OUTPUT_BYTE_PRESETS.some(([, bytes]) => bytes === current)\n\t\t? [...TOOL_OUTPUT_BYTE_PRESETS]\n\t\t: [...TOOL_OUTPUT_BYTE_PRESETS, [bytesToLabel(current), current]];\n\treturn all.sort((a, b) => a[1] - b[1]).map(([label]) => label);\n}\n\ninterface ToolSettingsConfig {\n\ttoolOutputView: ToolOutputView;\n\ttoolOutputMaxBytes: number;\n\ttoolOutputMaxLines: number;\n}\n\ninterface ToolSettingsCallbacks {\n\tonToolOutputViewChange: (view: ToolOutputView) => void;\n\tonToolOutputMaxBytesChange: (bytes: number) => void;\n\tonToolOutputMaxLinesChange: (lines: number) => void;\n}\n\n/**\n * Submenu for what a tool result looks like: how much of it is rendered, and\n * where it is truncated. The view applies to the whole transcript at once; the\n * caps feed the tool runtime, so they bind on future tool calls.\n *\n * Context GC is deliberately not here. It is not about a tool's output but about\n * what stays in the outgoing context, which is the Context category's subject.\n */\nclass ToolSettingsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(config: ToolSettingsConfig, callbacks: ToolSettingsCallbacks, onCancel: () => void) {\n\t\tsuper();\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"tool-output-view\",\n\t\t\t\tlabel: \"View\",\n\t\t\t\tdescription: `How much of a tool call the transcript shows, least to most. 'radar': ${TOOL_OUTPUT_VIEW_DESCRIPTIONS.radar}. 'glance': ${TOOL_OUTPUT_VIEW_DESCRIPTIONS.glance}. 'full': ${TOOL_OUTPUT_VIEW_DESCRIPTIONS.full}.`,\n\t\t\t\tcurrentValue: config.toolOutputView,\n\t\t\t\tvalues: [...TOOL_OUTPUT_VIEWS],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"output-max-bytes\",\n\t\t\t\tlabel: \"Max bytes\",\n\t\t\t\tdescription: \"Byte cap on a single read/bash result before truncation. Applies to future tool calls.\",\n\t\t\t\tcurrentValue: bytesToLabel(config.toolOutputMaxBytes),\n\t\t\t\tvalues: byteLabels(config.toolOutputMaxBytes),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"output-max-lines\",\n\t\t\t\tlabel: \"Max lines\",\n\t\t\t\tdescription: \"Line cap on a single read/bash result before truncation. Applies to future tool calls.\",\n\t\t\t\tcurrentValue: String(config.toolOutputMaxLines),\n\t\t\t\tvalues: presetValues([200, 400, 800, 1600, 3200], config.toolOutputMaxLines),\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\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"tool-output-view\":\n\t\t\t\t\t\tcallbacks.onToolOutputViewChange(newValue as ToolOutputView);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"output-max-bytes\": {\n\t\t\t\t\t\tconst preset = TOOL_OUTPUT_BYTE_PRESETS.find(([label]) => label === newValue);\n\t\t\t\t\t\t// A hand-set cap has no preset entry; its label is \"<n> KB\" by\n\t\t\t\t\t\t// construction, so read the number back out of it.\n\t\t\t\t\t\tconst bytes = preset ? preset[1] : Math.round(parseFloat(newValue) * 1024);\n\t\t\t\t\t\tif (Number.isFinite(bytes) && bytes > 0) callbacks.onToolOutputMaxBytesChange(bytes);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"output-max-lines\":\n\t\t\t\t\t\tcallbacks.onToolOutputMaxLinesChange(parseInt(newValue, 10));\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\n/** Single-line text editor for a string flag value. */\nclass FlagStringEditSubmenu extends Container {\n\tprivate input: Input;\n\n\tconstructor(flagName: string, currentValue: string, done: (value?: string) => void) {\n\t\tsuper();\n\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", `Flag: --${flagName}`)), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new Text(theme.fg(\"muted\", \"Enter a value · Enter to save · Esc to cancel\"), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.input = new Input();\n\t\tthis.input.setValue(currentValue);\n\t\tthis.input.onSubmit = (value: string) => done(value);\n\t\tthis.input.onEscape = () => done();\n\t\tthis.addChild(this.input);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.input.handleInput(data);\n\t}\n}\n\n/**\n * Submenu listing extension-registered flags. Boolean flags toggle on/off;\n * string flags open a text editor. Changes persist to settings.json and are\n * applied live best-effort — extensions that read a flag only at load time\n * pick up the new value on the next launch.\n */\nclass FlagsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(flags: FlagInfo[], onChange: (name: string, value: boolean | string) => void, onCancel: () => void) {\n\t\tsuper();\n\n\t\tconst items: SettingItem[] = flags.map((flag) => {\n\t\t\tconst baseDescription = flag.description ?? \"Extension-registered flag.\";\n\t\t\tconst description = `${baseDescription} Persists across sessions; some flags need a restart to fully apply.`;\n\t\t\tif (flag.type === \"boolean\") {\n\t\t\t\treturn {\n\t\t\t\t\tid: flag.name,\n\t\t\t\t\tlabel: flag.name,\n\t\t\t\t\tdescription,\n\t\t\t\t\tcurrentValue: flag.value ? \"on\" : \"off\",\n\t\t\t\t\tvalues: [\"on\", \"off\"],\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: flag.name,\n\t\t\t\tlabel: flag.name,\n\t\t\t\tdescription,\n\t\t\t\tcurrentValue: String(flag.value ?? \"\"),\n\t\t\t\tsubmenu: (currentValue, done) => new FlagStringEditSubmenu(flag.name, currentValue, done),\n\t\t\t};\n\t\t});\n\n\t\tconst typeByName = new Map(flags.map((f) => [f.name, f.type]));\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 12),\n\t\t\tgetSettingsListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tif (typeByName.get(id) === \"boolean\") {\n\t\t\t\t\tonChange(id, newValue === \"on\");\n\t\t\t\t} else {\n\t\t\t\t\tonChange(id, newValue);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonCancel,\n\t\t\t{ enableSearch: true },\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\n/**\n * Generic submenu holding a subset of leaf settings under a category label.\n * Shares the parent's change handler so cycle rows behave exactly as they did\n * when flat; nested submenu rows (theme, thinking, warnings) keep their own\n * factories.\n */\nclass CategorySubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(items: SettingItem[], onChange: (id: string, newValue: string) => void, onCancel: () => void) {\n\t\tsuper();\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsListTheme(),\n\t\t\tonChange,\n\t\t\tonCancel,\n\t\t\t{\n\t\t\t\tenableSearch: true,\n\t\t\t},\n\t\t);\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\nclass SelectSubmenu extends Container {\n\tprivate selectList: SelectList;\n\n\tconstructor(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\toptions: SelectItem[],\n\t\tcurrentValue: string,\n\t\tonSelect: (value: string) => void,\n\t\tonCancel: () => void,\n\t\tonSelectionChange?: (value: string) => void,\n\t) {\n\t\tsuper();\n\n\t\t// Title\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", title)), 0, 0));\n\n\t\t// Description\n\t\tif (description) {\n\t\t\tthis.addChild(new Spacer(1));\n\t\t\tthis.addChild(new Text(theme.fg(\"muted\", description), 0, 0));\n\t\t}\n\n\t\t// Spacer\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Select list\n\t\tthis.selectList = new SelectList(\n\t\t\toptions,\n\t\t\tMath.min(options.length, 10),\n\t\t\tgetSelectListTheme(),\n\t\t\tSETTINGS_SUBMENU_SELECT_LIST_LAYOUT,\n\t\t);\n\n\t\t// Pre-select current value\n\t\tconst currentIndex = options.findIndex((o) => o.value === currentValue);\n\t\tif (currentIndex !== -1) {\n\t\t\tthis.selectList.setSelectedIndex(currentIndex);\n\t\t}\n\n\t\tthis.selectList.onSelect = (item) => {\n\t\t\tonSelect(item.value);\n\t\t};\n\n\t\tthis.selectList.onCancel = onCancel;\n\n\t\tif (onSelectionChange) {\n\t\t\tthis.selectList.onSelectionChange = (item) => {\n\t\t\t\tonSelectionChange(item.value);\n\t\t\t};\n\t\t}\n\n\t\tthis.addChild(this.selectList);\n\n\t\t// Hint\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(new Text(theme.fg(\"dim\", \" Enter to select · Esc to go back\"), 0, 0));\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.selectList.handleInput(data);\n\t}\n}\n\n/**\n * Token counts, grouped and exact.\n *\n * `formatTokens` (2.7k) exists for the fixed-width chrome, where a count must\n * never grow the box it sits in. This pane is the opposite case: the point of\n * showing a number here is to compare it with another one, and \"2.7k\" hides the\n * difference between the tool that costs 2,710 and the one that costs 2,749.\n */\nfunction tokenCount(tokens: number): string {\n\treturn tokens.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n}\n\n/**\n * The fixed per-turn cost, as one line under the pane.\n *\n * Every byte of system prompt and active tool schema is re-sent on every\n * request, and the pane is where that number is decided - so the pane is where\n * it should be visible. It reports the *live* session: a tool toggle applies at\n * once and moves it, while a setting that only takes effect next session (a tool\n * group, the light preset) leaves it alone until then.\n */\nfunction formatSurfaceLine(surface: PromptSurface): string {\n\tconst tools = `${surface.tools.length} tool${surface.tools.length === 1 ? \"\" : \"s\"}`;\n\treturn (\n\t\t` Per-turn surface: ${tokenCount(surface.totalTokens)} tokens ` +\n\t\t`${theme.fg(\"dim\", `(${tokenCount(surface.systemPromptTokens)} system prompt + ${tokenCount(surface.toolSchemaTokens)} schemas, ${tools})`)}`\n\t);\n}\n\n/**\n * Main settings selector component.\n */\nexport class SettingsSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate surfaceLine?: Text;\n\tprivate measureTokenSurface?: () => PromptSurface;\n\n\tconstructor(config: SettingsConfig, callbacks: SettingsCallbacks) {\n\t\tsuper();\n\n\t\tthis.measureTokenSurface = config.measureTokenSurface;\n\n\t\tconst supportsImages = getCapabilities().images;\n\t\tconst followUpKey = keyDisplayText(\"app.message.followUp\");\n\t\tlet currentWarnings = { ...config.warnings };\n\n\t\t// A row writes the user settings file; a key the project file also sets is\n\t\t// merged over it on the next session, so say so rather than letting the row\n\t\t// look like it took.\n\t\tconst projectPinned = new Set(config.projectPinnedSettings);\n\t\tconst pinnedNote = (key: string): string =>\n\t\t\tprojectPinned.has(key)\n\t\t\t\t? ` This repo's .hoocode/settings.json sets ${key}, which overrides this row from the next session on.`\n\t\t\t\t: \"\";\n\n\t\t// Which rows are gated on an external binary that is not on this machine.\n\t\t// Built once so every row that needs it reads the same answer.\n\t\tconst rowGates = buildRowGates(config.externalTools);\n\n\t\tconst initialSurface = config.measureTokenSurface?.();\n\n\t\tconst toolsOn = config.tools.filter((t) => t.enabled).length;\n\t\tconst toolsOff = config.tools.length - toolsOn;\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: \"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: \"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: \"install-telemetry\",\n\t\t\t\tlabel: \"Install telemetry\",\n\t\t\t\tdescription: \"Send an anonymous version/update ping after changelog-detected updates\",\n\t\t\t\tcurrentValue: config.enableInstallTelemetry ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\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: \"thinking\",\n\t\t\t\tlabel: \"Thinking level\",\n\t\t\t\tdescription: \"Reasoning depth for thinking-capable models\",\n\t\t\t\tcurrentValue: config.thinkingLevel,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tnew SelectSubmenu(\n\t\t\t\t\t\t\"Thinking Level\",\n\t\t\t\t\t\t\"Select reasoning depth for thinking-capable models\",\n\t\t\t\t\t\tconfig.availableThinkingLevels.map((level) => ({\n\t\t\t\t\t\t\tvalue: level,\n\t\t\t\t\t\t\tlabel: level,\n\t\t\t\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t\t\t\t})),\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tcallbacks.onThinkingLevelChange(value as ThinkingLevel);\n\t\t\t\t\t\t\tdone(value);\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: \"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 SelectSubmenu(\n\t\t\t\t\t\t\"Theme\",\n\t\t\t\t\t\t\"Select color theme\",\n\t\t\t\t\t\tconfig.availableThemes.map((t) => ({\n\t\t\t\t\t\t\tvalue: t,\n\t\t\t\t\t\t\tlabel: t,\n\t\t\t\t\t\t\tdescription: getThemeDescription(t),\n\t\t\t\t\t\t})),\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tcallbacks.onThemeChange(value);\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t// Restore original theme on cancel\n\t\t\t\t\t\t\tcallbacks.onThemePreview?.(currentValue);\n\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\t// Preview theme on selection change\n\t\t\t\t\t\t\tcallbacks.onThemePreview?.(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\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: presetValues([60, 80, 120], config.imageWidthCells),\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// Context GC (insert after block-images), a leaf the Context category picks up.\n\t\titems.splice(items.findIndex((item) => item.id === \"block-images\") + 1, 0, {\n\t\t\tid: \"context-gc\",\n\t\t\tlabel: \"Context GC\",\n\t\t\tdescription: \"Stub superseded read results (files later edited or re-read) out of the outgoing context.\",\n\t\t\tcurrentValue: config.contextGc ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// The light preset (insert after context GC). Read at startup to pick the\n\t\t// tool set and the system prompt, so it lands on the next session.\n\t\tconst blockImagesIdx = items.findIndex((item) => item.id === \"context-gc\");\n\t\titems.splice(blockImagesIdx + 1, 0, {\n\t\t\tid: \"light\",\n\t\t\tlabel: \"Light preset\",\n\t\t\tdescription:\n\t\t\t\t\"Low-token preset for small or local models: read/write/edit/bash only with stripped schemas, a terse system prompt, and no subagents/TodoWrite/skills/context files. Applies on the next session.\",\n\t\t\tcurrentValue: config.light ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Skill commands toggle (insert after the light preset)\n\t\tconst blockImagesIndex = items.findIndex((item) => item.id === \"light\");\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// The autonomous plugin system's master switch (insert after skill-commands).\n\t\t// One flag for the lifecycle tools and the reuse nudge, so both flip together.\n\t\tconst skillCommandsIdx = items.findIndex((item) => item.id === \"skill-commands\");\n\t\titems.splice(skillCommandsIdx + 1, 0, {\n\t\t\tid: \"plugin-tools\",\n\t\t\tlabel: \"Plugin system\",\n\t\t\tdescription: `Autonomous plugin system: the lifecycle tools (SearchPlugins, InstallPlugin, ...), ProposePlugin, and the plugin-reuse nudge. Tools arrive on the next session; the nudge follows at once.${pinnedNote(\"enablePluginTools\")}`,\n\t\t\tcurrentValue: config.enablePluginTools ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Plugin install scope (insert after the master switch). Governs the\n\t\t// autonomous InstallPlugin only — /plugin install asks per install.\n\t\tconst pluginToolsIdx = items.findIndex((item) => item.id === \"plugin-tools\");\n\t\titems.splice(pluginToolsIdx + 1, 0, {\n\t\t\tid: \"plugin-install-scope\",\n\t\t\tlabel: \"Plugin install scope\",\n\t\t\tdescription: \"Where autonomous plugin installs go: user (~/.agents) or project (this repo, shared)\",\n\t\t\tcurrentValue: config.pluginInstallScope,\n\t\t\tvalues: [\"user\", \"project\"],\n\t\t});\n\n\t\t// Artifact platform targets (insert after plugin-install-scope). Set once and\n\t\t// it holds for every later session: it is the `platform` setting, which\n\t\t// `--platform` overrides for a single run.\n\t\tconst pluginScopeIdx = items.findIndex((item) => item.id === \"plugin-install-scope\");\n\t\tlet currentPlatforms = [...config.platform];\n\t\titems.splice(pluginScopeIdx + 1, 0, {\n\t\t\tid: \"platform\",\n\t\t\tlabel: \"Platform\",\n\t\t\tdescription: `Vendor layout(s) hoocode writes artifacts in: authored plugins and the /new-skill //new-agent //new-command scaffolds.${pinnedNote(\"platform\")}`,\n\t\t\tcurrentValue: platformSummary(currentPlatforms),\n\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\tnew PlatformSubmenu(\n\t\t\t\t\tcurrentPlatforms,\n\t\t\t\t\t(platforms) => {\n\t\t\t\t\t\tcurrentPlatforms = platforms;\n\t\t\t\t\t\tcallbacks.onPlatformChange(platforms);\n\t\t\t\t\t},\n\t\t\t\t\t(summary) => done(summary),\n\t\t\t\t),\n\t\t});\n\n\t\t// Hardware cursor toggle (insert after the platform row)\n\t\tconst platformIndex = items.findIndex((item) => item.id === \"platform\");\n\t\titems.splice(platformIndex + 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 border 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-border\",\n\t\t\tlabel: \"Editor border\",\n\t\t\tdescription: \"Box draws side borders, rule draws horizontal lines only\",\n\t\t\tcurrentValue: config.editorBorder,\n\t\t\tvalues: [\"box\", \"rule\"],\n\t\t});\n\n\t\t// Editor padding toggle (insert after editor-border)\n\t\tconst editorBorderIndex = items.findIndex((item) => item.id === \"editor-border\");\n\t\titems.splice(editorBorderIndex + 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// Autocomplete max visible 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: \"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: presetValues([3, 5, 7, 10, 15, 20], config.autocompleteMaxVisible),\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// Voice silence window (insert after terminal-progress)\n\t\tconst terminalProgressIndex = items.findIndex((item) => item.id === \"terminal-progress\");\n\t\titems.splice(terminalProgressIndex + 1, 0, {\n\t\t\tid: \"voice-silence-ms\",\n\t\t\tlabel: \"Voice silence window\",\n\t\t\tdescription: `Trailing-silence (ms) before voice capture auto-stops (300-10000). Env: VOICETOOLS_SILENCE_MS.${gateNote(rowGates.get(\"voice-silence-ms\"))}`,\n\t\t\tcurrentValue: String(config.voiceSilenceMs),\n\t\t\tvalueSuffix: gateSuffix(rowGates.get(\"voice-silence-ms\")),\n\t\t\tvalues: presetValues([300, 500, 800, 1200, 2000, 3000, 5000, 8000, 10000], config.voiceSilenceMs),\n\t\t});\n\n\t\t// Webtools request timeout (insert after voice-silence-ms)\n\t\tconst voiceSilenceIndex = items.findIndex((item) => item.id === \"voice-silence-ms\");\n\t\titems.splice(voiceSilenceIndex + 1, 0, {\n\t\t\tid: \"webtools-timeout-secs\",\n\t\t\tlabel: \"Web tools timeout\",\n\t\t\tdescription: `Per-request timeout (secs) for webfetch/websearch (1-120). Env: HOOCODE_WEBTOOLS_TIMEOUT.${gateNote(rowGates.get(\"webtools-timeout-secs\"))}`,\n\t\t\tcurrentValue: String(config.webtoolsTimeoutSecs),\n\t\t\tvalueSuffix: gateSuffix(rowGates.get(\"webtools-timeout-secs\")),\n\t\t\tvalues: presetValues([5, 10, 15, 30, 60, 120], config.webtoolsTimeoutSecs),\n\t\t});\n\n\t\t// The /learn thresholds, appended as leaf rows and gathered into their own\n\t\t// category below. They are written to the user settings.json, which /learn\n\t\t// re-reads on every invocation, so a change here applies to the next run.\n\t\tconst webtoolsIndex = items.findIndex((item) => item.id === \"webtools-timeout-secs\");\n\t\titems.splice(\n\t\t\twebtoolsIndex + 1,\n\t\t\t0,\n\t\t\t...LEARN_SETTINGS.map(({ key, label, description, presets }) => ({\n\t\t\t\tid: key,\n\t\t\t\tlabel,\n\t\t\t\tdescription,\n\t\t\t\tcurrentValue: String(config.learn[key]),\n\t\t\t\tvalues: presetValues(presets, config.learn[key]),\n\t\t\t})),\n\t\t);\n\n\t\t// Keep the tool/flag controls together as one block near the top, inserted\n\t\t// after the image/terminal splices above so they aren't leapfrogged.\n\t\tconst toolFlagGroup: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"tools\",\n\t\t\t\tlabel: \"Tools\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Enable/disable tools and tool groups (web, semantic search), each priced by what its schema costs per turn. Changes persist across sessions.\",\n\t\t\t\tcurrentValue: toolsOff > 0 ? `${toolsOn} on · ${toolsOff} off` : `${toolsOn} on`,\n\t\t\t\tvalueSuffix: initialSurface ? `${tokenCount(initialSurface.toolSchemaTokens)} tok/turn` : undefined,\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew ToolsSubmenu(\n\t\t\t\t\t\tconfig.tools,\n\t\t\t\t\t\tconfig.toolGroups,\n\t\t\t\t\t\trowGates,\n\t\t\t\t\t\t(name, enabled) => {\n\t\t\t\t\t\t\tcallbacks.onToolEnabledChange(name, enabled);\n\t\t\t\t\t\t\t// Applied live by the host, so the surface below is already stale.\n\t\t\t\t\t\t\tthis.refreshTokenSurface();\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(id, enabled) => callbacks.onToolGroupChange(id, enabled),\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: \"tool-output\",\n\t\t\t\tlabel: \"Tool output\",\n\t\t\t\tdescription: \"How much of a tool result is rendered, and where it is truncated.\",\n\t\t\t\tcurrentValue: config.toolOutputView,\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew ToolSettingsSubmenu(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttoolOutputView: config.toolOutputView,\n\t\t\t\t\t\t\ttoolOutputMaxBytes: config.toolOutputMaxBytes,\n\t\t\t\t\t\t\ttoolOutputMaxLines: config.toolOutputMaxLines,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tonToolOutputViewChange: callbacks.onToolOutputViewChange,\n\t\t\t\t\t\t\tonToolOutputMaxBytesChange: callbacks.onToolOutputMaxBytesChange,\n\t\t\t\t\t\t\tonToolOutputMaxLinesChange: callbacks.onToolOutputMaxLinesChange,\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];\n\t\tif (config.flags.length > 0) {\n\t\t\ttoolFlagGroup.push({\n\t\t\t\tid: \"flags\",\n\t\t\t\tlabel: \"Flags\",\n\t\t\t\tdescription: \"Set flags registered by extensions. Changes persist across sessions.\",\n\t\t\t\tcurrentValue: `${config.flags.length} flag${config.flags.length === 1 ? \"\" : \"s\"}`,\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew FlagsSubmenu(\n\t\t\t\t\t\tconfig.flags,\n\t\t\t\t\t\t(name, value) => callbacks.onFlagChange(name, value),\n\t\t\t\t\t\t() => done(),\n\t\t\t\t\t),\n\t\t\t});\n\t\t}\n\t\t// Add borders\n\t\tthis.addChild(new DynamicBorder());\n\n\t\t// Shared change handler for every leaf (cycle) setting; used by the\n\t\t// top-level list and each category submenu.\n\t\tconst applyChange = (id: string, newValue: string): void => {\n\t\t\tswitch (id) {\n\t\t\t\tcase \"autocompact\":\n\t\t\t\t\tcallbacks.onAutoCompactChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"show-images\":\n\t\t\t\t\tcallbacks.onShowImagesChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"image-width-cells\":\n\t\t\t\t\tcallbacks.onImageWidthCellsChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"auto-resize-images\":\n\t\t\t\t\tcallbacks.onAutoResizeImagesChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"block-images\":\n\t\t\t\t\tcallbacks.onBlockImagesChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"skill-commands\":\n\t\t\t\t\tcallbacks.onEnableSkillCommandsChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"light\":\n\t\t\t\t\tcallbacks.onLightChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"plugin-tools\":\n\t\t\t\t\tcallbacks.onEnablePluginToolsChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"plugin-install-scope\":\n\t\t\t\t\tcallbacks.onPluginInstallScopeChange(newValue as \"user\" | \"project\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"platform\":\n\t\t\t\t\t// Display only. Each toggle inside the submenu already applied itself;\n\t\t\t\t\t// closing it hands back the summary purely to refresh this row's value.\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"steering-mode\":\n\t\t\t\t\tcallbacks.onSteeringModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"follow-up-mode\":\n\t\t\t\t\tcallbacks.onFollowUpModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"transport\":\n\t\t\t\t\tcallbacks.onTransportChange(newValue as Transport);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"hide-thinking\":\n\t\t\t\t\tcallbacks.onHideThinkingBlockChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"collapse-changelog\":\n\t\t\t\t\tcallbacks.onCollapseChangelogChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"quiet-startup\":\n\t\t\t\t\tcallbacks.onQuietStartupChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"install-telemetry\":\n\t\t\t\t\tcallbacks.onEnableInstallTelemetryChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"double-escape-action\":\n\t\t\t\t\tcallbacks.onDoubleEscapeActionChange(newValue as \"fork\" | \"tree\" | \"none\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"tree-filter-mode\":\n\t\t\t\t\tcallbacks.onTreeFilterModeChange(\n\t\t\t\t\t\tnewValue as \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\",\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"show-hardware-cursor\":\n\t\t\t\t\tcallbacks.onShowHardwareCursorChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"editor-border\":\n\t\t\t\t\tcallbacks.onEditorBorderChange(newValue as \"rule\" | \"box\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"editor-padding\":\n\t\t\t\t\tcallbacks.onEditorPaddingXChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"autocomplete-max-visible\":\n\t\t\t\t\tcallbacks.onAutocompleteMaxVisibleChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"clear-on-shrink\":\n\t\t\t\t\tcallbacks.onClearOnShrinkChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"terminal-progress\":\n\t\t\t\t\tcallbacks.onShowTerminalProgressChange(newValue === \"true\");\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"voice-silence-ms\":\n\t\t\t\t\tcallbacks.onVoiceSilenceMsChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"webtools-timeout-secs\":\n\t\t\t\t\tcallbacks.onWebtoolsTimeoutSecsChange(parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t// The /learn rows are keyed by their settings.json name, so they need\n\t\t\t\t\t// no case of their own — the id is the key to write.\n\t\t\t\t\tif (LEARN_KEYS.has(id)) callbacks.onLearnSettingChange(id as LearnSettingKey, parseInt(newValue, 10));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Most rows leave the per-turn surface alone; the ones that do not (a tool\n\t\t\t// toggle, anything that rebuilds the system prompt) move it immediately.\n\t\t\t// Re-measuring after every change is cheaper than knowing which is which.\n\t\t\tthis.refreshTokenSurface();\n\t\t};\n\n\t\t// Partition the flat leaf settings into named category submenus so the\n\t\t// top level stays short. `items` holds autocompact + every leaf setting.\n\t\tconst byId = new Map(items.map((item) => [item.id, item] as const));\n\t\tconst pick = (ids: string[]): SettingItem[] =>\n\t\t\tids.map((id) => byId.get(id)).filter((item): item is SettingItem => item !== undefined);\n\t\tconst categoryRow = (id: string, label: string, description: string, ids: string[]): SettingItem => {\n\t\t\tconst members = pick(ids);\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel,\n\t\t\t\tdescription,\n\t\t\t\tcurrentValue: `${members.length} setting${members.length === 1 ? \"\" : \"s\"}`,\n\t\t\t\t// Categories shortened the top level but also hid every setting from\n\t\t\t\t// its search: searching \"theme\" matched no category label. The member\n\t\t\t\t// labels ride along as search text so the query lands on the category\n\t\t\t\t// that holds the setting.\n\t\t\t\tkeywords: members.map((member) => member.label).join(\" \"),\n\t\t\t\tsubmenu: (_currentValue, done) => new CategorySubmenu(members, applyChange, () => done()),\n\t\t\t};\n\t\t};\n\n\t\tconst topItems: SettingItem[] = [\n\t\t\t...toolFlagGroup,\n\t\t\t// What the model is sent, and how much of it. Auto-compact used to sit\n\t\t\t// alone at the top level and context GC was filed under tool settings,\n\t\t\t// which left the three settings that decide the token budget in three\n\t\t\t// different places - with the light preset in none of them.\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-context\",\n\t\t\t\t\"Context\",\n\t\t\t\t\"What the model is sent and how much of it: compaction, superseded reads, and the low-token preset.\",\n\t\t\t\t[\"autocompact\", \"context-gc\", \"light\"],\n\t\t\t),\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-behavior\",\n\t\t\t\t\"Behavior\",\n\t\t\t\t\"Agent and session behavior: steering, follow-up, thinking, escape, tree filter, transport.\",\n\t\t\t\t[\"steering-mode\", \"follow-up-mode\", \"thinking\", \"double-escape-action\", \"tree-filter-mode\", \"transport\"],\n\t\t\t),\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-interface\",\n\t\t\t\t\"Interface\",\n\t\t\t\t\"Appearance and editor: theme, thinking visibility, cursor, border, padding, autocomplete, terminal.\",\n\t\t\t\t[\n\t\t\t\t\t\"theme\",\n\t\t\t\t\t\"hide-thinking\",\n\t\t\t\t\t\"show-hardware-cursor\",\n\t\t\t\t\t\"editor-border\",\n\t\t\t\t\t\"editor-padding\",\n\t\t\t\t\t\"autocomplete-max-visible\",\n\t\t\t\t\t\"clear-on-shrink\",\n\t\t\t\t\t\"terminal-progress\",\n\t\t\t\t],\n\t\t\t),\n\t\t\t// Artifact production. `plugin-install-scope` had no category and was\n\t\t\t// therefore unreachable from the pane despite having a live callback.\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-plugins\",\n\t\t\t\t\"Plugins\",\n\t\t\t\t\"The autonomous plugin system's master switch, the vendor layout hoocode writes, and where autonomous installs land.\",\n\t\t\t\t[\"plugin-tools\", \"platform\", \"plugin-install-scope\"],\n\t\t\t),\n\t\t\tcategoryRow(\"cat-images\", \"Images\", \"Inline image rendering and resizing.\", [\n\t\t\t\t\"show-images\",\n\t\t\t\t\"image-width-cells\",\n\t\t\t\t\"auto-resize-images\",\n\t\t\t\t\"block-images\",\n\t\t\t]),\n\t\t\t// Top level rather than folded into Advanced: these are the thresholds\n\t\t\t// that decide whether /learn finds anything, and burying them is what\n\t\t\t// made them undiscoverable in the first place.\n\t\t\tcategoryRow(\n\t\t\t\t\"cat-learn\",\n\t\t\t\t\"Learning\",\n\t\t\t\t\"Thresholds /learn mines sessions with: how far back to look, and how often something must repeat.\",\n\t\t\t\tLEARN_SETTINGS.map((setting) => setting.key),\n\t\t\t),\n\t\t\t// The external binaries. Top level, not folded into Advanced: their whole\n\t\t\t// problem was that nothing in the product ever said they existed, and a\n\t\t\t// row two levels down would have been the same silence with extra steps.\n\t\t\t// This is the only category built from live machine state rather than\n\t\t\t// settings, so it is assembled here instead of going through categoryRow.\n\t\t\t{\n\t\t\t\tid: \"cat-external\",\n\t\t\t\tlabel: \"External tools\",\n\t\t\t\tdescription: `Optional Rust binaries that expand what hoocode can do: ${externalSummary(config.externalTools)}. hoocode runs without every one of them - each row says what it adds and what happens without it.`,\n\t\t\t\tcurrentValue: externalCount(config.externalTools),\n\t\t\t\tkeywords: config.externalTools\n\t\t\t\t\t.flatMap((status) => [status.tool, status.label, ...status.settingsKeys])\n\t\t\t\t\t.join(\" \"),\n\t\t\t\tsubmenu: (_currentValue, done) => new ExternalToolsSubmenu(config.externalTools, () => done()),\n\t\t\t},\n\t\t\tcategoryRow(\"cat-advanced\", \"Advanced\", \"Startup, telemetry, skills, warnings, voice, and web tools.\", [\n\t\t\t\t\"quiet-startup\",\n\t\t\t\t\"collapse-changelog\",\n\t\t\t\t\"install-telemetry\",\n\t\t\t\t\"skill-commands\",\n\t\t\t\t\"warnings\",\n\t\t\t\t\"voice-silence-ms\",\n\t\t\t\t\"webtools-timeout-secs\",\n\t\t\t]),\n\t\t];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\ttopItems,\n\t\t\tMath.min(topItems.length, 10),\n\t\t\tgetSettingsListTheme(),\n\t\t\tapplyChange,\n\t\t\tcallbacks.onCancel,\n\t\t\t{\n\t\t\t\tenableSearch: true,\n\t\t\t},\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t\tif (initialSurface) {\n\t\t\tthis.surfaceLine = new Text(formatSurfaceLine(initialSurface), 0, 0);\n\t\t\tthis.addChild(this.surfaceLine);\n\t\t}\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\t/** Re-price the pane after a change that may have altered what each turn sends. */\n\tprivate refreshTokenSurface(): void {\n\t\tif (!this.surfaceLine || !this.measureTokenSurface) return;\n\t\tthis.surfaceLine.setText(formatSurfaceLine(this.measureTokenSurface()));\n\t}\n\n\tgetSettingsList(): SettingsList {\n\t\treturn this.settingsList;\n\t}\n}\n"]}
@@ -1,4 +1,6 @@
1
1
  import { Container, getCapabilities, Input, SelectList, SettingsList, Spacer, Text, } from "@kolisachint/hoocode-tui";
2
+ import { buildRowGates, statusLabel } from "../../../core/external-tools.js";
3
+ import { TOOL_OUTPUT_VIEW_DESCRIPTIONS, TOOL_OUTPUT_VIEWS, } from "../../../core/tool-output-view.js";
2
4
  import { getSelectListTheme, getSettingsListTheme, getThemeDescription, theme } from "../theme/theme.js";
3
5
  import { DynamicBorder } from "./dynamic-border.js";
4
6
  import { keyDisplayText } from "./keybinding-hints.js";
@@ -164,6 +166,34 @@ class PlatformSubmenu extends Container {
164
166
  this.settingsList.handleInput(data);
165
167
  }
166
168
  }
169
+ /**
170
+ * Trailing sentence for a row whose setting is inert until an external binary
171
+ * shows up. The row is annotated rather than hidden: the binaries were invisible
172
+ * precisely because nothing ever mentioned them, and a row that disappears when
173
+ * its dependency is missing teaches the user nothing at all.
174
+ */
175
+ function gateNote(gate) {
176
+ if (!gate || gate.installed)
177
+ return "";
178
+ return gate.downloadable
179
+ ? ` Needs the ${gate.tool} binary, which hoocode fetches the first time this is used. Until then: ${gate.fallback}`
180
+ : ` Needs the ${gate.tool} binary, and this environment will not fetch it. Until then: ${gate.fallback}`;
181
+ }
182
+ /** "3 of 5 installed" - the one number that says whether this category needs attention. */
183
+ function externalCount(statuses) {
184
+ const installed = statuses.filter((status) => status.installed).length;
185
+ return `${installed} of ${statuses.length} installed`;
186
+ }
187
+ /** The capability words, so the category row says what the binaries are for. */
188
+ function externalSummary(statuses) {
189
+ return statuses.map((status) => status.tool).join(", ");
190
+ }
191
+ /** Value-column marker for a gated row, so the list shows it without selecting. */
192
+ function gateSuffix(gate) {
193
+ if (!gate || gate.installed)
194
+ return undefined;
195
+ return `needs ${gate.tool}`;
196
+ }
167
197
  /**
168
198
  * Submenu for tool availability. The first rows are group switches (web,
169
199
  * semantic search) that decide whether a group's tools
@@ -180,16 +210,26 @@ class ToolsSubmenu extends Container {
180
210
  enabled;
181
211
  static CORE = new Set(["read", "bash", "edit", "write"]);
182
212
  static GROUP_PREFIX = "group:";
183
- constructor(tools, groups, onChange, onGroupChange, onCancel) {
213
+ constructor(tools, groups,
214
+ /** Rows gated on an external binary, keyed by row id. See buildRowGates. */
215
+ gates, onChange, onGroupChange, onCancel) {
184
216
  super();
185
217
  this.enabled = new Map(tools.map((t) => [t.name, t.enabled]));
186
- const groupItems = groups.map((group) => ({
187
- id: `${ToolsSubmenu.GROUP_PREFIX}${group.id}`,
188
- label: `[group] ${group.label}`,
189
- description: `${group.description} Governs whether these tools exist; applies on the next session.`,
190
- currentValue: group.enabled ? "on" : "off",
191
- values: ["on", "off"],
192
- }));
218
+ const groupItems = groups.map((group) => {
219
+ const id = `${ToolsSubmenu.GROUP_PREFIX}${group.id}`;
220
+ const gate = gates.get(id);
221
+ return {
222
+ id,
223
+ label: `[group] ${group.label}`,
224
+ description: `${group.description} Governs whether these tools exist; applies on the next session.${gateNote(gate)}`,
225
+ currentValue: group.enabled ? "on" : "off",
226
+ // The switch stays settable with the binary missing: the setting is
227
+ // what makes hoocode fetch it, so refusing the toggle would make the
228
+ // group unreachable forever.
229
+ valueSuffix: gateSuffix(gate),
230
+ values: ["on", "off"],
231
+ };
232
+ });
193
233
  const toolItems = tools.map((tool) => ({
194
234
  id: tool.name,
195
235
  label: tool.name,
@@ -227,6 +267,88 @@ class ToolsSubmenu extends Container {
227
267
  this.settingsList.handleInput(data);
228
268
  }
229
269
  }
270
+ /**
271
+ * Read-only detail for one external binary: what it is, whether it is here, what
272
+ * it turns on, and what hoocode does without it.
273
+ *
274
+ * A submenu rather than a long `description` because the useful answer is five
275
+ * or six lines and the pane shows descriptions on one. Nothing here is settable
276
+ * - the binary is either on the machine or it is not - so the rows carry no
277
+ * `values` and Enter does nothing but close.
278
+ */
279
+ class ExternalToolDetailSubmenu extends Container {
280
+ settingsList;
281
+ constructor(status, onCancel) {
282
+ super();
283
+ const acquisition = status.acquisition === "startup"
284
+ ? "Downloaded in the background at startup."
285
+ : status.acquisition === "on-demand"
286
+ ? "Downloaded the first time the feature is used."
287
+ : "Never downloaded automatically; install it yourself.";
288
+ const location = status.installed
289
+ ? status.source === "path"
290
+ ? `found on PATH as \`${status.path}\``
291
+ : status.source === "override"
292
+ ? `${status.overrideEnv} points at ${status.path}`
293
+ : `hoocode's own copy at ${status.path}`
294
+ : status.downloadable
295
+ ? `${acquisition} Not on this machine yet.`
296
+ : "Not installed, and this environment will not download it (offline mode, or no published build for this platform).";
297
+ const rows = [
298
+ ["Status", statusLabel(status), location],
299
+ [
300
+ "Enables",
301
+ `${status.enables.length} feature${status.enables.length === 1 ? "" : "s"}`,
302
+ status.enables.join("; "),
303
+ ],
304
+ ["Without it", "fallback", status.fallback],
305
+ ["Source", status.repo || "-", `Release archives come from github.com/${status.repo}. ${acquisition}`],
306
+ ["Env", String(status.env.length), status.env.join(" | ")],
307
+ ];
308
+ const items = rows.map(([label, value, description], index) => ({
309
+ id: `detail-${index}`,
310
+ label,
311
+ currentValue: value,
312
+ description,
313
+ }));
314
+ this.settingsList = new SettingsList(items, items.length, getSettingsListTheme(), () => { }, onCancel);
315
+ this.addChild(this.settingsList);
316
+ }
317
+ handleInput(data) {
318
+ this.settingsList.handleInput(data);
319
+ }
320
+ }
321
+ /**
322
+ * The external-binary category: one row per managed Rust binary.
323
+ *
324
+ * These binaries were entirely invisible before this pane existed. hoocode works
325
+ * without every one of them, which is the whole reason nobody found them: search
326
+ * silently got slower, semantic ranking silently never happened, and web/voice
327
+ * were simply features nobody knew were there. The row states presence; the
328
+ * submenu states what presence buys.
329
+ */
330
+ class ExternalToolsSubmenu extends Container {
331
+ settingsList;
332
+ constructor(statuses, onCancel) {
333
+ super();
334
+ const items = statuses.map((status) => ({
335
+ id: `ext-${status.tool}`,
336
+ label: status.label,
337
+ description: `${status.summary} Without it: ${status.fallback}`,
338
+ currentValue: statusLabel(status),
339
+ // The value column says whether it is here; the suffix says what it is
340
+ // for, so the list reads without opening every row.
341
+ valueSuffix: status.installed ? undefined : status.downloadable ? "auto-fetch" : "manual",
342
+ keywords: [status.tool, status.repo, ...status.settingsKeys, ...status.enables].join(" "),
343
+ submenu: (_currentValue, done) => new ExternalToolDetailSubmenu(status, () => done()),
344
+ }));
345
+ this.settingsList = new SettingsList(items, Math.min(items.length, 10), getSettingsListTheme(), () => { }, onCancel, { enableSearch: true });
346
+ this.addChild(this.settingsList);
347
+ }
348
+ handleInput(data) {
349
+ this.settingsList.handleInput(data);
350
+ }
351
+ }
230
352
  /** Byte-cap presets shown as human labels; mapped back to raw byte counts. */
231
353
  const TOOL_OUTPUT_BYTE_PRESETS = [
232
354
  ["8 KB", 8 * 1024],
@@ -248,8 +370,8 @@ function byteLabels(current) {
248
370
  }
249
371
  /**
250
372
  * Submenu for what a tool result looks like: how much of it is rendered, and
251
- * where it is truncated. The display level applies to the transcript at once;
252
- * the caps feed the tool runtime, so they bind on future tool calls.
373
+ * where it is truncated. The view applies to the whole transcript at once; the
374
+ * caps feed the tool runtime, so they bind on future tool calls.
253
375
  *
254
376
  * Context GC is deliberately not here. It is not about a tool's output but about
255
377
  * what stays in the outgoing context, which is the Context category's subject.
@@ -260,11 +382,11 @@ class ToolSettingsSubmenu extends Container {
260
382
  super();
261
383
  const items = [
262
384
  {
263
- id: "tool-output-display",
264
- label: "Display",
265
- description: "How tool results render. 'standard': shown (expandable). 'collapsed': hidden. 'peek': hidden with a ▸ reveal caret (press the expand key to reveal).",
266
- currentValue: config.toolOutputDisplay,
267
- values: ["standard", "collapsed", "peek"],
385
+ id: "tool-output-view",
386
+ label: "View",
387
+ description: `How much of a tool call the transcript shows, least to most. 'radar': ${TOOL_OUTPUT_VIEW_DESCRIPTIONS.radar}. 'glance': ${TOOL_OUTPUT_VIEW_DESCRIPTIONS.glance}. 'full': ${TOOL_OUTPUT_VIEW_DESCRIPTIONS.full}.`,
388
+ currentValue: config.toolOutputView,
389
+ values: [...TOOL_OUTPUT_VIEWS],
268
390
  },
269
391
  {
270
392
  id: "output-max-bytes",
@@ -283,8 +405,8 @@ class ToolSettingsSubmenu extends Container {
283
405
  ];
284
406
  this.settingsList = new SettingsList(items, Math.min(items.length, 10), getSettingsListTheme(), (id, newValue) => {
285
407
  switch (id) {
286
- case "tool-output-display":
287
- callbacks.onToolOutputDisplayChange(newValue);
408
+ case "tool-output-view":
409
+ callbacks.onToolOutputViewChange(newValue);
288
410
  break;
289
411
  case "output-max-bytes": {
290
412
  const preset = TOOL_OUTPUT_BYTE_PRESETS.find(([label]) => label === newValue);
@@ -472,6 +594,9 @@ export class SettingsSelectorComponent extends Container {
472
594
  const pinnedNote = (key) => projectPinned.has(key)
473
595
  ? ` This repo's .hoocode/settings.json sets ${key}, which overrides this row from the next session on.`
474
596
  : "";
597
+ // Which rows are gated on an external binary that is not on this machine.
598
+ // Built once so every row that needs it reads the same answer.
599
+ const rowGates = buildRowGates(config.externalTools);
475
600
  const initialSurface = config.measureTokenSurface?.();
476
601
  const toolsOn = config.tools.filter((t) => t.enabled).length;
477
602
  const toolsOff = config.tools.length - toolsOn;
@@ -748,8 +873,9 @@ export class SettingsSelectorComponent extends Container {
748
873
  items.splice(terminalProgressIndex + 1, 0, {
749
874
  id: "voice-silence-ms",
750
875
  label: "Voice silence window",
751
- description: "Trailing-silence (ms) before voice capture auto-stops (300-10000). Env: VOICETOOLS_SILENCE_MS.",
876
+ description: `Trailing-silence (ms) before voice capture auto-stops (300-10000). Env: VOICETOOLS_SILENCE_MS.${gateNote(rowGates.get("voice-silence-ms"))}`,
752
877
  currentValue: String(config.voiceSilenceMs),
878
+ valueSuffix: gateSuffix(rowGates.get("voice-silence-ms")),
753
879
  values: presetValues([300, 500, 800, 1200, 2000, 3000, 5000, 8000, 10000], config.voiceSilenceMs),
754
880
  });
755
881
  // Webtools request timeout (insert after voice-silence-ms)
@@ -757,8 +883,9 @@ export class SettingsSelectorComponent extends Container {
757
883
  items.splice(voiceSilenceIndex + 1, 0, {
758
884
  id: "webtools-timeout-secs",
759
885
  label: "Web tools timeout",
760
- description: "Per-request timeout (secs) for webfetch/websearch (1-120). Env: HOOCODE_WEBTOOLS_TIMEOUT.",
886
+ description: `Per-request timeout (secs) for webfetch/websearch (1-120). Env: HOOCODE_WEBTOOLS_TIMEOUT.${gateNote(rowGates.get("webtools-timeout-secs"))}`,
761
887
  currentValue: String(config.webtoolsTimeoutSecs),
888
+ valueSuffix: gateSuffix(rowGates.get("webtools-timeout-secs")),
762
889
  values: presetValues([5, 10, 15, 30, 60, 120], config.webtoolsTimeoutSecs),
763
890
  });
764
891
  // The /learn thresholds, appended as leaf rows and gathered into their own
@@ -781,7 +908,7 @@ export class SettingsSelectorComponent extends Container {
781
908
  description: "Enable/disable tools and tool groups (web, semantic search), each priced by what its schema costs per turn. Changes persist across sessions.",
782
909
  currentValue: toolsOff > 0 ? `${toolsOn} on · ${toolsOff} off` : `${toolsOn} on`,
783
910
  valueSuffix: initialSurface ? `${tokenCount(initialSurface.toolSchemaTokens)} tok/turn` : undefined,
784
- submenu: (_currentValue, done) => new ToolsSubmenu(config.tools, config.toolGroups, (name, enabled) => {
911
+ submenu: (_currentValue, done) => new ToolsSubmenu(config.tools, config.toolGroups, rowGates, (name, enabled) => {
785
912
  callbacks.onToolEnabledChange(name, enabled);
786
913
  // Applied live by the host, so the surface below is already stale.
787
914
  this.refreshTokenSurface();
@@ -791,13 +918,13 @@ export class SettingsSelectorComponent extends Container {
791
918
  id: "tool-output",
792
919
  label: "Tool output",
793
920
  description: "How much of a tool result is rendered, and where it is truncated.",
794
- currentValue: config.toolOutputDisplay,
921
+ currentValue: config.toolOutputView,
795
922
  submenu: (_currentValue, done) => new ToolSettingsSubmenu({
796
- toolOutputDisplay: config.toolOutputDisplay,
923
+ toolOutputView: config.toolOutputView,
797
924
  toolOutputMaxBytes: config.toolOutputMaxBytes,
798
925
  toolOutputMaxLines: config.toolOutputMaxLines,
799
926
  }, {
800
- onToolOutputDisplayChange: callbacks.onToolOutputDisplayChange,
927
+ onToolOutputViewChange: callbacks.onToolOutputViewChange,
801
928
  onToolOutputMaxBytesChange: callbacks.onToolOutputMaxBytesChange,
802
929
  onToolOutputMaxLinesChange: callbacks.onToolOutputMaxLinesChange,
803
930
  }, () => done()),
@@ -962,6 +1089,21 @@ export class SettingsSelectorComponent extends Container {
962
1089
  // that decide whether /learn finds anything, and burying them is what
963
1090
  // made them undiscoverable in the first place.
964
1091
  categoryRow("cat-learn", "Learning", "Thresholds /learn mines sessions with: how far back to look, and how often something must repeat.", LEARN_SETTINGS.map((setting) => setting.key)),
1092
+ // The external binaries. Top level, not folded into Advanced: their whole
1093
+ // problem was that nothing in the product ever said they existed, and a
1094
+ // row two levels down would have been the same silence with extra steps.
1095
+ // This is the only category built from live machine state rather than
1096
+ // settings, so it is assembled here instead of going through categoryRow.
1097
+ {
1098
+ id: "cat-external",
1099
+ label: "External tools",
1100
+ description: `Optional Rust binaries that expand what hoocode can do: ${externalSummary(config.externalTools)}. hoocode runs without every one of them - each row says what it adds and what happens without it.`,
1101
+ currentValue: externalCount(config.externalTools),
1102
+ keywords: config.externalTools
1103
+ .flatMap((status) => [status.tool, status.label, ...status.settingsKeys])
1104
+ .join(" "),
1105
+ submenu: (_currentValue, done) => new ExternalToolsSubmenu(config.externalTools, () => done()),
1106
+ },
965
1107
  categoryRow("cat-advanced", "Advanced", "Startup, telemetry, skills, warnings, voice, and web tools.", [
966
1108
  "quiet-startup",
967
1109
  "collapse-changelog",