apex-code 0.5.2 → 0.6.1
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.
- package/CHANGELOG.md +24 -0
- package/README.md +41 -2
- package/dist/core/agent-session.d.ts +37 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +264 -60
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/default-tool-names.d.ts +7 -0
- package/dist/core/default-tool-names.d.ts.map +1 -0
- package/dist/core/default-tool-names.js +14 -0
- package/dist/core/default-tool-names.js.map +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +2 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +16 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +7 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/permissions/startup.d.ts +1 -1
- package/dist/core/permissions/startup.d.ts.map +1 -1
- package/dist/core/permissions/startup.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +13 -9
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +13 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/contract.d.ts +1 -0
- package/dist/core/tools/contract.d.ts.map +1 -1
- package/dist/core/tools/contract.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/plan-present.d.ts +13 -12
- package/dist/core/tools/plan-present.d.ts.map +1 -1
- package/dist/core/tools/plan-present.js +32 -19
- package/dist/core/tools/plan-present.js.map +1 -1
- package/dist/core/tools/renderers/index.d.ts +1 -1
- package/dist/core/tools/renderers/index.d.ts.map +1 -1
- package/dist/core/tools/renderers/index.js +2 -0
- package/dist/core/tools/renderers/index.js.map +1 -1
- package/dist/core/tools/renderers/todo-write.d.ts +7 -0
- package/dist/core/tools/renderers/todo-write.d.ts.map +1 -0
- package/dist/core/tools/renderers/todo-write.js +58 -0
- package/dist/core/tools/renderers/todo-write.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +13 -2
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +56 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/error-summary.d.ts +2 -0
- package/dist/modes/interactive/components/error-summary.d.ts.map +1 -1
- package/dist/modes/interactive/components/error-summary.js +10 -0
- package/dist/modes/interactive/components/error-summary.js.map +1 -1
- package/dist/modes/interactive/components/first-use-hints.d.ts +1 -1
- package/dist/modes/interactive/components/first-use-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-use-hints.js +1 -0
- package/dist/modes/interactive/components/first-use-hints.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +6 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +38 -11
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +5 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/task-panel.d.ts +27 -0
- package/dist/modes/interactive/components/task-panel.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-panel.js +92 -0
- package/dist/modes/interactive/components/task-panel.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +9 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +81 -8
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-panel.d.ts +7 -0
- package/dist/modes/interactive/components/tool-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-panel.js +35 -0
- package/dist/modes/interactive/components/tool-panel.js.map +1 -1
- package/dist/modes/interactive/components/turn-summary.d.ts +6 -0
- package/dist/modes/interactive/components/turn-summary.d.ts.map +1 -0
- package/dist/modes/interactive/components/turn-summary.js +12 -0
- package/dist/modes/interactive/components/turn-summary.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +10 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +191 -22
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/keybindings.md +21 -2
- package/docs/settings.md +8 -0
- package/npm-shrinkwrap.json +5 -5
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAG/E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;GAGG;AACH,SAAS,kBAAkB,CAAC,IAAY,EAAU;IACjD,qFAAqF;IACrF,OAA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9C,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5C,iFAAiF;YACjF,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport { areExperimentalFeaturesEnabled } from \"../../../core/experimental.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { PermissionMode } from \"../../../core/permissions/store.ts\";\nimport { addUsageToTotals, createUsageTotals } from \"../../../core/usage-totals.ts\";\nimport { theme } from \"../theme/theme.ts\";\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/**\n * Format token counts for compact footer display.\n */\nexport function formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\n/** Cells in the context gauge. Eight reads as a bar without crowding the tray. */\nconst CONTEXT_GAUGE_CELLS = 8;\n\n/**\n * A filled bar for the context window, split into its filled and empty runs so\n * the caller can colour them separately.\n *\n * This is a redundant channel and never the only one: the percentage beside it\n * states the same value as text (WCAG 1.4.1). An unknown percentage renders an\n * empty track rather than guessing a position.\n */\nexport function renderContextGauge(\n\tpercent: number | undefined,\n\tsymbolPreset: \"unicode\" | \"ascii\",\n): { filled: string; empty: string } {\n\tconst filledGlyph = symbolPreset === \"ascii\" ? \"#\" : \"█\";\n\tconst emptyGlyph = symbolPreset === \"ascii\" ? \"-\" : \"░\";\n\tif (percent === undefined) {\n\t\treturn { filled: \"\", empty: emptyGlyph.repeat(CONTEXT_GAUGE_CELLS) };\n\t}\n\tconst clamped = Math.min(100, Math.max(0, percent));\n\t// Any non-zero usage lights at least one cell, so the bar never reads empty\n\t// while the window is genuinely filling.\n\tconst cells = clamped === 0 ? 0 : Math.max(1, Math.round((clamped / 100) * CONTEXT_GAUGE_CELLS));\n\treturn { filled: filledGlyph.repeat(cells), empty: emptyGlyph.repeat(CONTEXT_GAUGE_CELLS - cells) };\n}\n\n/** Accessibility/display settings the footer reads (roadmap Phase 8, task 8.6). */\nexport interface FooterAccessibilitySettings {\n\tgetSymbolPreset(): \"unicode\" | \"ascii\";\n\tgetColorBlindMode(): boolean;\n\tgetTokenUsageDisplay(): \"off\" | \"compact\" | \"full\";\n}\n\nconst DEFAULT_ACCESSIBILITY_SETTINGS: FooterAccessibilitySettings = {\n\tgetSymbolPreset: () => \"unicode\",\n\tgetColorBlindMode: () => false,\n\tgetTokenUsageDisplay: () => \"compact\",\n};\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~/${relativeToHome.replaceAll(\"\\\\\", \"/\")}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\tprivate permissionMode: PermissionMode = \"default\";\n\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\tprivate accessibilitySettings: FooterAccessibilitySettings;\n\tprivate activity: Component | undefined;\n\n\tconstructor(\n\t\tsession: AgentSession,\n\t\tfooterData: ReadonlyFooterDataProvider,\n\t\taccessibilitySettings: FooterAccessibilitySettings = DEFAULT_ACCESSIBILITY_SETTINGS,\n\t) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\n\t\tthis.accessibilitySettings = accessibilitySettings;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t\t// The usage totals are cached against the previous session's entry\n\t\t// version; a session switch must not reuse them.\n\t\tthis.usageCache = undefined;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\tsetPermissionMode(mode: PermissionMode): void {\n\t\tthis.permissionMode = mode;\n\t}\n\n\t/**\n\t * The working indicator, rendered inline in the tray instead of in its own\n\t * rows above the editor.\n\t *\n\t * Taking the component rather than a string keeps the spinner animation, the\n\t * extension-supplied `WorkingIndicatorOptions`, and disposal where they already\n\t * live. This setter only moves where the line is drawn, so it cannot disturb\n\t * the usage cache.\n\t */\n\tsetActivity(activity: Component | undefined): void {\n\t\tthis.activity = activity;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\t/**\n\t * Usage totals walked from all session entries. getEntries() copies the\n\t * whole entry list, so this is cached against the session manager's\n\t * entries version: without the cache the footer re-walked the entire\n\t * transcript on every rendered frame.\n\t */\n\tprivate usageCache?: {\n\t\tversion: number;\n\t\ttotals: ReturnType<typeof createUsageTotals>;\n\t\tlatestCacheHitRate?: number;\n\t};\n\n\tprivate computeUsage(): {\n\t\ttotals: ReturnType<typeof createUsageTotals>;\n\t\tlatestCacheHitRate?: number;\n\t} {\n\t\tconst version = this.session.sessionManager.getEntriesVersion();\n\t\tif (this.usageCache && this.usageCache.version === version) {\n\t\t\treturn { totals: this.usageCache.totals, latestCacheHitRate: this.usageCache.latestCacheHitRate };\n\t\t}\n\n\t\tconst usageTotals = createUsageTotals();\n\t\tlet latestCacheHitRate: number | undefined;\n\n\t\tfor (const entry of this.session.sessionManager.getEntries()) {\n\t\t\tif (entry.type === \"usage\") {\n\t\t\t\taddUsageToTotals(usageTotals, entry.usage);\n\t\t\t} else if (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\taddUsageToTotals(usageTotals, entry.message.usage);\n\n\t\t\t\tconst latestPromptTokens =\n\t\t\t\t\tentry.message.usage.input + entry.message.usage.cacheRead + entry.message.usage.cacheWrite;\n\t\t\t\tlatestCacheHitRate =\n\t\t\t\t\tlatestPromptTokens > 0 ? (entry.message.usage.cacheRead / latestPromptTokens) * 100 : undefined;\n\t\t\t} else if (entry.type === \"message\" && entry.message.role === \"toolResult\" && entry.message.usage) {\n\t\t\t\taddUsageToTotals(usageTotals, entry.message.usage);\n\t\t\t} else if ((entry.type === \"branch_summary\" || entry.type === \"compaction\") && entry.usage) {\n\t\t\t\taddUsageToTotals(usageTotals, entry.usage);\n\t\t\t}\n\t\t}\n\n\t\tthis.usageCache = { version, totals: usageTotals, latestCacheHitRate };\n\t\treturn { totals: usageTotals, latestCacheHitRate };\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\t\tconst symbolPreset = this.accessibilitySettings.getSymbolPreset();\n\t\tconst colorBlindMode = this.accessibilitySettings.getColorBlindMode();\n\t\tconst tokenUsageDisplay = this.accessibilitySettings.getTokenUsageDisplay();\n\t\tconst upSymbol = symbolPreset === \"ascii\" ? \"^\" : \"↑\";\n\t\tconst downSymbol = symbolPreset === \"ascii\" ? \"v\" : \"↓\";\n\t\tconst bulletSymbol = symbolPreset === \"ascii\" ? \"-\" : \"•\";\n\t\t// One line, unpadded, so the fit ladder can measure it as a segment. Loader\n\t\t// prepends a blank row to stand off from the transcript, which the tray does\n\t\t// not need, so this takes the first row that actually carries the message.\n\t\tconst activityLine = this.activity\n\t\t\t?.render(width)\n\t\t\t.map((line) => line.replace(/ +$/, \"\"))\n\t\t\t.find((line) => line.length > 0);\n\n\t\t// Calculate cumulative usage from ALL session entries (not just post-compaction messages),\n\t\t// cached against the session's entry version (see computeUsage).\n\t\tconst { totals: usageTotals, latestCacheHitRate } = this.computeUsage();\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\t// The gauge lights a cell for any usage at all, so a figure that rounds to zero says so.\n\t\tconst contextPercent =\n\t\t\tcontextUsage?.percent === null\n\t\t\t\t? \"?\"\n\t\t\t\t: contextPercentValue > 0 && contextPercentValue < 0.05\n\t\t\t\t\t? \"<0.1\"\n\t\t\t\t\t: contextPercentValue.toFixed(1);\n\n\t\t// Replace home directory with ~\n\t\tlet pwd = formatCwdForFooter(this.session.sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\n\t\t// Add git branch if available\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tif (branch) {\n\t\t\tpwd = `${pwd} (${branch})`;\n\t\t}\n\n\t\t// Add session name if set\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tif (sessionName) {\n\t\t\tpwd = `${pwd} ${bulletSymbol} ${sessionName}`;\n\t\t}\n\n\t\t// Build stats line. tokenUsageDisplay: \"off\" hides this whole section\n\t\t// (context% and model name are separate and always shown); \"full\" shows\n\t\t// exact counts instead of formatTokens' abbreviation.\n\t\tconst formatTokenCount = tokenUsageDisplay === \"full\" ? (n: number) => n.toLocaleString() : formatTokens;\n\t\tconst statsParts = [];\n\t\tif (tokenUsageDisplay !== \"off\") {\n\t\t\tif (usageTotals.input) statsParts.push(`${upSymbol}${formatTokenCount(usageTotals.input)}`);\n\t\t\tif (usageTotals.output) statsParts.push(`${downSymbol}${formatTokenCount(usageTotals.output)}`);\n\t\t\tif (usageTotals.cacheRead) statsParts.push(`R${formatTokenCount(usageTotals.cacheRead)}`);\n\t\t\tif (usageTotals.cacheWrite) statsParts.push(`W${formatTokenCount(usageTotals.cacheWrite)}`);\n\t\t\tif ((usageTotals.cacheRead > 0 || usageTotals.cacheWrite > 0) && latestCacheHitRate !== undefined) {\n\t\t\t\tstatsParts.push(`cache ${Math.round(latestCacheHitRate)}%`);\n\t\t\t}\n\t\t}\n\n\t\t// Kimi Coding is subscription-backed despite using API-key authentication.\n\t\tconst usingSubscription = state.model\n\t\t\t? state.model.provider === \"kimi-coding\" || this.session.modelRuntime.isUsingSubscription(state.model.provider)\n\t\t\t: false;\n\t\tif (tokenUsageDisplay !== \"off\" && (usageTotals.cost || usingSubscription)) {\n\t\t\tconst costStr = `$${usageTotals.cost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tstatsParts.push(costStr);\n\t\t}\n\n\t\t// Context pressure is signalled through text at every setting -- never\n\t\t// color alone (WCAG 1.4.1) -- with color as an additional channel. The\n\t\t// default error/warning pair (red/amber) is already distinguishable for\n\t\t// most red-green colorblindness; colorBlindMode's palette adjustment\n\t\t// moves the critical (>90%) threshold to \"accent\" -- a hue outside that\n\t\t// red/amber family entirely -- rather than relying on a style attribute\n\t\t// like bold/underline, which several terminals (and this theme's own\n\t\t// chalk-backed style methods, suppressed outside a real TTY) silently\n\t\t// drop, making it an unreliable second channel.\n\t\tlet contextPercentStr: string;\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst pressureMarker = contextPercentValue > 90 ? \"!!\" : contextPercentValue > 70 ? \"!\" : \"\";\n\t\tconst contextPercentDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t\t: `${contextPercent}%${pressureMarker}/${formatTokens(contextWindow)}${autoIndicator}`;\n\t\tif (contextPercentValue > 90) {\n\t\t\tcontextPercentStr = theme.fg(colorBlindMode ? \"accent\" : \"error\", contextPercentDisplay);\n\t\t} else if (contextPercentValue > 70) {\n\t\t\tcontextPercentStr = theme.fg(\"warning\", contextPercentDisplay);\n\t\t} else {\n\t\t\tcontextPercentStr = contextPercentDisplay;\n\t\t}\n\t\t// Only worth saying when pressure is real and nothing will act on its own.\n\t\t// With auto-compaction on, the \"(auto)\" marker above already answers it.\n\t\tconst compactPrompt =\n\t\t\tcontextPercentValue > 70 && !this.autoCompactEnabled ? theme.fg(\"warning\", \"/compact soon\") : undefined;\n\t\tstatsParts.push(contextPercentStr);\n\t\tif (compactPrompt) statsParts.push(compactPrompt);\n\t\tif (activityLine) statsParts.unshift(activityLine);\n\t\tif (areExperimentalFeaturesEnabled()) {\n\t\t\tstatsParts.push(`${theme.fg(\"dim\", bulletSymbol)} ${theme.bold(theme.fg(\"warning\", \"xp\"))}`);\n\t\t}\n\n\t\t// Permission posture is always named, including `default`. It is operational\n\t\t// state rather than routine telemetry: hiding the safe default would make the\n\t\t// tray change meaning by omission, while hiding bypass would conceal risk.\n\t\t// Text carries the signal and color remains a second channel (WCAG 1.4.1).\n\t\tconst modeColor =\n\t\t\tthis.permissionMode === \"bypassPermissions\" ? \"error\" : this.permissionMode === \"default\" ? \"dim\" : \"warning\";\n\t\tstatsParts.unshift(theme.fg(modeColor, this.permissionMode));\n\n\t\tif (tokenUsageDisplay !== \"full\") {\n\t\t\tconst separator = theme.fg(\"dim\", symbolPreset === \"ascii\" ? \" - \" : \" · \");\n\t\t\tconst compactPermissionNames: Record<PermissionMode, string> = {\n\t\t\t\tdefault: \"default\",\n\t\t\t\tplan: \"plan\",\n\t\t\t\tacceptEdits: \"accept\",\n\t\t\t\tbypassPermissions: \"bypass\",\n\t\t\t\tdontAsk: \"dontAsk\",\n\t\t\t};\n\t\t\tconst permissionColor =\n\t\t\t\tthis.permissionMode === \"bypassPermissions\"\n\t\t\t\t\t? \"error\"\n\t\t\t\t\t: this.permissionMode === \"default\"\n\t\t\t\t\t\t? \"dim\"\n\t\t\t\t\t\t: \"warning\";\n\t\t\tconst permissionFull = theme.fg(permissionColor, this.permissionMode);\n\t\t\tconst permissionCompact = theme.fg(permissionColor, compactPermissionNames[this.permissionMode]);\n\t\t\tconst compactPercent = contextPercent === \"?\" ? \"?\" : contextPercentValue.toFixed(0);\n\t\t\tconst compactPressure = contextPercentValue > 90 ? \"!!\" : contextPercentValue > 70 ? \"!\" : \"\";\n\t\t\tconst contextColor =\n\t\t\t\tcontextPercentValue > 90\n\t\t\t\t\t? colorBlindMode\n\t\t\t\t\t\t? \"accent\"\n\t\t\t\t\t\t: \"error\"\n\t\t\t\t\t: contextPercentValue > 70\n\t\t\t\t\t\t? \"warning\"\n\t\t\t\t\t\t: \"dim\";\n\t\t\t// The gauge rides along only in the roomy form. The compact form drops\n\t\t\t// it, which is what lets it keep winning the fit ladder below.\n\t\t\tconst gauge = renderContextGauge(contextPercent === \"?\" ? undefined : contextPercentValue, symbolPreset);\n\t\t\t// Below the warning threshold the text is dim, which would make the bar\n\t\t\t// invisible; the fill takes the accent there and tracks the text colour\n\t\t\t// at every level that actually signals pressure.\n\t\t\tconst gaugeColor = contextColor === \"dim\" ? \"accent\" : contextColor;\n\t\t\t// An empty run would still emit an open/close SGR pair, so skip it.\n\t\t\tconst paintRun = (color: Parameters<typeof theme.fg>[0], text: string) => (text ? theme.fg(color, text) : \"\");\n\t\t\tconst contextGauged =\n\t\t\t\ttheme.fg(contextColor, \"context \") +\n\t\t\t\tpaintRun(gaugeColor, gauge.filled) +\n\t\t\t\tpaintRun(\"borderMuted\", gauge.empty) +\n\t\t\t\ttheme.fg(contextColor, ` ${contextPercent}%${pressureMarker}`);\n\t\t\tconst contextFull = theme.fg(contextColor, `context ${contextPercent}%${pressureMarker}`);\n\t\t\tconst contextCompact = theme.fg(contextColor, `ctx ${compactPercent}%${compactPressure}`);\n\n\t\t\tconst joinSegments = (segments: string[]): string => segments.join(separator);\n\t\t\tconst fits = (segments: string[]): boolean => visibleWidth(joinSegments(segments)) <= width;\n\t\t\tconst safetyFirst = (...rest: Array<string | undefined>): string[] => [\n\t\t\t\tpermissionFull,\n\t\t\t\t...rest.filter((segment): segment is string => segment !== undefined),\n\t\t\t];\n\t\t\tlet left: string[] = safetyFirst(compactPrompt, activityLine);\n\t\t\tlet right = contextGauged;\n\n\t\t\t// The gauge is decoration over a value the text already states, so it\n\t\t\t// is the first thing to go. Dropping it must not cost the tray its\n\t\t\t// spelled-out permission mode, which is why this is its own rung.\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tright = contextFull;\n\t\t\t}\n\n\t\t\t// Activity is operational, so it outranks every optional segment below.\n\t\t\t// It still yields to the safety posture and to the pressure reading,\n\t\t\t// which are the two things the tray must never lose.\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tleft = safetyFirst(compactPrompt);\n\t\t\t}\n\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tleft = safetyFirst();\n\t\t\t}\n\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tleft = [permissionCompact];\n\t\t\t\tright = contextCompact;\n\t\t\t}\n\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tconst safetyOnly = left[0];\n\t\t\t\tconst line =\n\t\t\t\t\tvisibleWidth(safetyOnly) <= width ? safetyOnly : truncateToWidth(safetyOnly, Math.max(0, width), \"\");\n\t\t\t\treturn width > 0 ? [line] : [];\n\t\t\t}\n\n\t\t\tconst optional: string[] = [];\n\t\t\toptional.push(theme.fg(\"dim\", state.model?.id || \"no-model\"));\n\t\t\tif (state.model?.reasoning && state.thinkingLevel && state.thinkingLevel !== \"off\") {\n\t\t\t\toptional.push(theme.fg(\"dim\", state.thinkingLevel));\n\t\t\t}\n\t\t\tif (tokenUsageDisplay !== \"off\" && (usageTotals.input || usageTotals.output)) {\n\t\t\t\toptional.push(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${upSymbol}${formatTokens(usageTotals.input)} ${downSymbol}${formatTokens(usageTotals.output)}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (\n\t\t\t\ttokenUsageDisplay !== \"off\" &&\n\t\t\t\t(usageTotals.cacheRead > 0 || usageTotals.cacheWrite > 0) &&\n\t\t\t\tlatestCacheHitRate !== undefined\n\t\t\t) {\n\t\t\t\toptional.push(theme.fg(\"dim\", `cache ${Math.round(latestCacheHitRate)}%`));\n\t\t\t}\n\t\t\tif (tokenUsageDisplay !== \"off\" && (usageTotals.cost || usingSubscription)) {\n\t\t\t\toptional.push(theme.fg(\"dim\", `$${usageTotals.cost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`));\n\t\t\t}\n\t\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\t\toptional.push(theme.fg(\"dim\", state.model.provider));\n\t\t\t}\n\t\t\tif (areExperimentalFeaturesEnabled()) optional.push(theme.fg(\"warning\", \"xp\"));\n\t\t\toptional.push(theme.fg(\"dim\", pwd));\n\n\t\t\tfor (const segment of optional) {\n\t\t\t\tif (fits([...left, segment, right])) left.push(segment);\n\t\t\t}\n\n\t\t\tconst leftText = joinSegments(left);\n\t\t\tconst padding = \" \".repeat(Math.max(1, width - visibleWidth(leftText) - visibleWidth(right)));\n\t\t\tconst tray = leftText ? `${leftText}${padding}${right}` : right;\n\t\t\tconst lines = [tray];\n\t\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\t\tif (extensionStatuses.size > 0) {\n\t\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\t\tlines.push(truncateToWidth(sortedStatuses.join(\" \"), width, theme.fg(\"dim\", \"...\")));\n\t\t\t}\n\t\t\treturn lines;\n\t\t}\n\n\t\tlet statsLeft = statsParts.join(\" \");\n\n\t\t// Add model name on the right side, plus thinking level if model supports it\n\t\tconst modelName = state.model?.id || \"no-model\";\n\n\t\tlet statsLeftWidth = visibleWidth(statsLeft);\n\n\t\t// If statsLeft is too wide, truncate it\n\t\tif (statsLeftWidth > width) {\n\t\t\t// Permission mode is the first segment and must remain textual at every\n\t\t\t// positive width. An ellipsis suffix can consume the entire narrow line.\n\t\t\tstatsLeft = truncateToWidth(statsLeft, width, \"\");\n\t\t\tstatsLeftWidth = visibleWidth(statsLeft);\n\t\t}\n\n\t\t// Calculate available space for padding (minimum 2 spaces between stats and model)\n\t\tconst minPadding = 2;\n\n\t\t// Add thinking level indicator if model supports reasoning\n\t\tlet rightSideWithoutProvider = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\trightSideWithoutProvider =\n\t\t\t\tthinkingLevel === \"off\"\n\t\t\t\t\t? `${modelName} ${bulletSymbol} thinking off`\n\t\t\t\t\t: `${modelName} ${bulletSymbol} ${thinkingLevel}`;\n\t\t}\n\n\t\t// Prepend the provider in parentheses if there are multiple providers and there's enough room\n\t\tlet rightSide = rightSideWithoutProvider;\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\trightSide = `(${state.model!.provider}) ${rightSideWithoutProvider}`;\n\t\t\tif (statsLeftWidth + minPadding + visibleWidth(rightSide) > width) {\n\t\t\t\t// Too wide, fall back\n\t\t\t\trightSide = rightSideWithoutProvider;\n\t\t\t}\n\t\t}\n\n\t\tconst rightSideWidth = visibleWidth(rightSide);\n\t\tconst totalNeeded = statsLeftWidth + minPadding + rightSideWidth;\n\n\t\tlet statsLine: string;\n\t\tif (totalNeeded <= width) {\n\t\t\t// Both fit - add padding to right-align model\n\t\t\tconst padding = \" \".repeat(width - statsLeftWidth - rightSideWidth);\n\t\t\tstatsLine = statsLeft + padding + rightSide;\n\t\t} else {\n\t\t\t// Need to truncate right side\n\t\t\tconst availableForRight = width - statsLeftWidth - minPadding;\n\t\t\tif (availableForRight > 0) {\n\t\t\t\tconst truncatedRight = truncateToWidth(rightSide, availableForRight, \"\");\n\t\t\t\tconst truncatedRightWidth = visibleWidth(truncatedRight);\n\t\t\t\tconst padding = \" \".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));\n\t\t\t\tstatsLine = statsLeft + padding + truncatedRight;\n\t\t\t} else {\n\t\t\t\t// Not enough space for right side at all\n\t\t\t\tstatsLine = statsLeft;\n\t\t\t}\n\t\t}\n\n\t\t// Apply dim to each part separately. statsLeft may contain color codes (for context %)\n\t\t// that end with a reset, which would clear an outer dim wrapper. So we dim the parts\n\t\t// before and after the colored section independently.\n\t\tconst dimStatsLeft = theme.fg(\"dim\", statsLeft);\n\t\tconst remainder = statsLine.slice(statsLeft.length); // padding + rightSide\n\t\tconst dimRemainder = theme.fg(\"dim\", remainder);\n\n\t\tconst pwdLine = truncateToWidth(theme.fg(\"dim\", pwd), width, theme.fg(\"dim\", \"...\"));\n\t\tconst lines = [pwdLine, dimStatsLeft + dimRemainder];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"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AA,CACb;CACD","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { type Component, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport { areExperimentalFeaturesEnabled } from \"../../../core/experimental.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { PermissionModeOrigin } from \"../../../core/permissions/startup.ts\";\nimport type { PermissionMode } from \"../../../core/permissions/store.ts\";\nimport type { ChatDetail } from \"../../../core/settings-manager.ts\";\nimport { addUsageToTotals, createUsageTotals } from \"../../../core/usage-totals.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { keyDisplayText } from \"./keybinding-hints.ts\";\n\n/**\n * Sanitize text for display in a single-line status.\n * Removes newlines, tabs, carriage returns, and other control characters.\n */\nfunction sanitizeStatusText(text: string): string {\n\t// Replace newlines, tabs, carriage returns with space, then collapse multiple spaces\n\treturn text\n\t\t.replace(/[\\r\\n\\t]/g, \" \")\n\t\t.replace(/ +/g, \" \")\n\t\t.trim();\n}\n\n/**\n * Format token counts for compact footer display.\n */\nexport function formatTokens(count: number): string {\n\tif (count < 1000) return count.toString();\n\tif (count < 10000) return `${(count / 1000).toFixed(1)}k`;\n\tif (count < 1000000) return `${Math.round(count / 1000)}k`;\n\tif (count < 10000000) return `${(count / 1000000).toFixed(1)}M`;\n\treturn `${Math.round(count / 1000000)}M`;\n}\n\n/** Cells in the context gauge. Eight reads as a bar without crowding the tray. */\nconst CONTEXT_GAUGE_CELLS = 8;\n\n/**\n * A filled bar for the context window, split into its filled and empty runs so\n * the caller can colour them separately.\n *\n * This is a redundant channel and never the only one: the percentage beside it\n * states the same value as text (WCAG 1.4.1). An unknown percentage renders an\n * empty track rather than guessing a position.\n */\nexport function renderContextGauge(\n\tpercent: number | undefined,\n\tsymbolPreset: \"unicode\" | \"ascii\",\n): { filled: string; empty: string } {\n\tconst filledGlyph = symbolPreset === \"ascii\" ? \"#\" : \"█\";\n\tconst emptyGlyph = symbolPreset === \"ascii\" ? \"-\" : \"░\";\n\tif (percent === undefined) {\n\t\treturn { filled: \"\", empty: emptyGlyph.repeat(CONTEXT_GAUGE_CELLS) };\n\t}\n\tconst clamped = Math.min(100, Math.max(0, percent));\n\t// Any non-zero usage lights at least one cell, so the bar never reads empty\n\t// while the window is genuinely filling.\n\tconst cells = clamped === 0 ? 0 : Math.max(1, Math.round((clamped / 100) * CONTEXT_GAUGE_CELLS));\n\treturn { filled: filledGlyph.repeat(cells), empty: emptyGlyph.repeat(CONTEXT_GAUGE_CELLS - cells) };\n}\n\n/** Accessibility/display settings the footer reads (roadmap Phase 8, task 8.6). */\nexport interface FooterAccessibilitySettings {\n\tgetSymbolPreset(): \"unicode\" | \"ascii\";\n\tgetColorBlindMode(): boolean;\n\tgetTokenUsageDisplay(): \"off\" | \"compact\" | \"full\";\n}\n\nconst DEFAULT_ACCESSIBILITY_SETTINGS: FooterAccessibilitySettings = {\n\tgetSymbolPreset: () => \"unicode\",\n\tgetColorBlindMode: () => false,\n\tgetTokenUsageDisplay: () => \"compact\",\n};\n\nexport function formatCwdForFooter(cwd: string, home: string | undefined): string {\n\tif (!home) return cwd;\n\n\tconst resolvedCwd = resolve(cwd);\n\tconst resolvedHome = resolve(home);\n\tconst relativeToHome = relative(resolvedHome, resolvedCwd);\n\tconst isInsideHome =\n\t\trelativeToHome === \"\" ||\n\t\t(relativeToHome !== \"..\" && !relativeToHome.startsWith(`..${sep}`) && !isAbsolute(relativeToHome));\n\n\tif (!isInsideHome) return cwd;\n\treturn relativeToHome === \"\" ? \"~\" : `~/${relativeToHome.replaceAll(\"\\\\\", \"/\")}`;\n}\n\n/**\n * Footer component that shows pwd, token stats, and context usage.\n * Computes token/context stats from session, gets git branch and extension statuses from provider.\n */\nexport class FooterComponent implements Component {\n\tprivate autoCompactEnabled = true;\n\tprivate permissionMode: PermissionMode = \"default\";\n\tprivate permissionModeOrigin: PermissionModeOrigin | undefined;\n\tprivate session: AgentSession;\n\tprivate footerData: ReadonlyFooterDataProvider;\n\tprivate accessibilitySettings: FooterAccessibilitySettings;\n\tprivate activity: Component | undefined;\n\n\tconstructor(\n\t\tsession: AgentSession,\n\t\tfooterData: ReadonlyFooterDataProvider,\n\t\taccessibilitySettings: FooterAccessibilitySettings = DEFAULT_ACCESSIBILITY_SETTINGS,\n\t) {\n\t\tthis.session = session;\n\t\tthis.footerData = footerData;\n\t\tthis.accessibilitySettings = accessibilitySettings;\n\t}\n\n\tprivate chatDetail?: ChatDetail;\n\n\tsetChatDetail(detail: ChatDetail): void {\n\t\tthis.chatDetail = detail;\n\t}\n\n\tsetSession(session: AgentSession): void {\n\t\tthis.session = session;\n\t\t// The usage totals are cached against the previous session's entry\n\t\t// version; a session switch must not reuse them.\n\t\tthis.usageCache = undefined;\n\t}\n\n\tsetAutoCompactEnabled(enabled: boolean): void {\n\t\tthis.autoCompactEnabled = enabled;\n\t}\n\n\tsetPermissionMode(mode: PermissionMode, origin?: PermissionModeOrigin): void {\n\t\tthis.permissionMode = mode;\n\t\tthis.permissionModeOrigin = origin;\n\t}\n\n\t/**\n\t * The working indicator, rendered inline in the tray instead of in its own\n\t * rows above the editor.\n\t *\n\t * Taking the component rather than a string keeps the spinner animation, the\n\t * extension-supplied `WorkingIndicatorOptions`, and disposal where they already\n\t * live. This setter only moves where the line is drawn, so it cannot disturb\n\t * the usage cache.\n\t */\n\tsetActivity(activity: Component | undefined): void {\n\t\tthis.activity = activity;\n\t}\n\n\t/**\n\t * No-op: git branch caching now handled by provider.\n\t * Kept for compatibility with existing call sites in interactive-mode.\n\t */\n\tinvalidate(): void {\n\t\t// No-op: git branch is cached/invalidated by provider\n\t}\n\n\t/**\n\t * Clean up resources.\n\t * Git watcher cleanup now handled by provider.\n\t */\n\tdispose(): void {\n\t\t// Git watcher cleanup handled by provider\n\t}\n\n\t/**\n\t * Usage totals walked from all session entries. getEntries() copies the\n\t * whole entry list, so this is cached against the session manager's\n\t * entries version: without the cache the footer re-walked the entire\n\t * transcript on every rendered frame.\n\t */\n\tprivate usageCache?: {\n\t\tversion: number;\n\t\ttotals: ReturnType<typeof createUsageTotals>;\n\t\tlatestCacheHitRate?: number;\n\t};\n\n\tprivate computeUsage(): {\n\t\ttotals: ReturnType<typeof createUsageTotals>;\n\t\tlatestCacheHitRate?: number;\n\t} {\n\t\tconst version = this.session.sessionManager.getEntriesVersion();\n\t\tif (this.usageCache && this.usageCache.version === version) {\n\t\t\treturn { totals: this.usageCache.totals, latestCacheHitRate: this.usageCache.latestCacheHitRate };\n\t\t}\n\n\t\tconst usageTotals = createUsageTotals();\n\t\tlet latestCacheHitRate: number | undefined;\n\n\t\tfor (const entry of this.session.sessionManager.getEntries()) {\n\t\t\tif (entry.type === \"usage\") {\n\t\t\t\taddUsageToTotals(usageTotals, entry.usage);\n\t\t\t} else if (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\t\taddUsageToTotals(usageTotals, entry.message.usage);\n\n\t\t\t\tconst latestPromptTokens =\n\t\t\t\t\tentry.message.usage.input + entry.message.usage.cacheRead + entry.message.usage.cacheWrite;\n\t\t\t\tlatestCacheHitRate =\n\t\t\t\t\tlatestPromptTokens > 0 ? (entry.message.usage.cacheRead / latestPromptTokens) * 100 : undefined;\n\t\t\t} else if (entry.type === \"message\" && entry.message.role === \"toolResult\" && entry.message.usage) {\n\t\t\t\taddUsageToTotals(usageTotals, entry.message.usage);\n\t\t\t} else if ((entry.type === \"branch_summary\" || entry.type === \"compaction\") && entry.usage) {\n\t\t\t\taddUsageToTotals(usageTotals, entry.usage);\n\t\t\t}\n\t\t}\n\n\t\tthis.usageCache = { version, totals: usageTotals, latestCacheHitRate };\n\t\treturn { totals: usageTotals, latestCacheHitRate };\n\t}\n\n\trender(width: number): string[] {\n\t\tconst state = this.session.state;\n\t\tconst symbolPreset = this.accessibilitySettings.getSymbolPreset();\n\t\tconst colorBlindMode = this.accessibilitySettings.getColorBlindMode();\n\t\tconst tokenUsageDisplay = this.accessibilitySettings.getTokenUsageDisplay();\n\t\tconst upSymbol = symbolPreset === \"ascii\" ? \"^\" : \"↑\";\n\t\tconst downSymbol = symbolPreset === \"ascii\" ? \"v\" : \"↓\";\n\t\tconst bulletSymbol = symbolPreset === \"ascii\" ? \"-\" : \"•\";\n\t\t// One line, unpadded, so the fit ladder can measure it as a segment. Loader\n\t\t// prepends a blank row to stand off from the transcript, which the tray does\n\t\t// not need, so this takes the first row that actually carries the message.\n\t\tconst activityLine = this.activity\n\t\t\t?.render(width)\n\t\t\t.map((line) => line.replace(/ +$/, \"\"))\n\t\t\t.find((line) => line.length > 0);\n\n\t\t// Calculate cumulative usage from ALL session entries (not just post-compaction messages),\n\t\t// cached against the session's entry version (see computeUsage).\n\t\tconst { totals: usageTotals, latestCacheHitRate } = this.computeUsage();\n\n\t\t// Calculate context usage from session (handles compaction correctly).\n\t\t// After compaction, tokens are unknown until the next LLM response.\n\t\tconst contextUsage = this.session.getContextUsage();\n\t\tconst contextWindow = contextUsage?.contextWindow ?? state.model?.contextWindow ?? 0;\n\t\tconst contextPercentValue = contextUsage?.percent ?? 0;\n\t\t// The gauge lights a cell for any usage at all, so a figure that rounds to zero says so.\n\t\tconst contextPercent =\n\t\t\tcontextUsage?.percent === null\n\t\t\t\t? \"?\"\n\t\t\t\t: contextPercentValue > 0 && contextPercentValue < 0.05\n\t\t\t\t\t? \"<0.1\"\n\t\t\t\t\t: contextPercentValue.toFixed(1);\n\n\t\t// Replace home directory with ~\n\t\tlet pwd = formatCwdForFooter(this.session.sessionManager.getCwd(), process.env.HOME || process.env.USERPROFILE);\n\n\t\t// Add git branch if available\n\t\tconst branch = this.footerData.getGitBranch();\n\t\tif (branch) {\n\t\t\tpwd = `${pwd} (${branch})`;\n\t\t}\n\n\t\t// Add session name if set\n\t\tconst sessionName = this.session.sessionManager.getSessionName();\n\t\tif (sessionName) {\n\t\t\tpwd = `${pwd} ${bulletSymbol} ${sessionName}`;\n\t\t}\n\n\t\t// Build stats line. tokenUsageDisplay: \"off\" hides this whole section\n\t\t// (context% and model name are separate and always shown); \"full\" shows\n\t\t// exact counts instead of formatTokens' abbreviation.\n\t\tconst formatTokenCount = tokenUsageDisplay === \"full\" ? (n: number) => n.toLocaleString() : formatTokens;\n\t\tconst statsParts = [];\n\t\tif (tokenUsageDisplay !== \"off\") {\n\t\t\tif (usageTotals.input) statsParts.push(`${upSymbol}${formatTokenCount(usageTotals.input)}`);\n\t\t\tif (usageTotals.output) statsParts.push(`${downSymbol}${formatTokenCount(usageTotals.output)}`);\n\t\t\tif (usageTotals.cacheRead) statsParts.push(`R${formatTokenCount(usageTotals.cacheRead)}`);\n\t\t\tif (usageTotals.cacheWrite) statsParts.push(`W${formatTokenCount(usageTotals.cacheWrite)}`);\n\t\t\tif ((usageTotals.cacheRead > 0 || usageTotals.cacheWrite > 0) && latestCacheHitRate !== undefined) {\n\t\t\t\tstatsParts.push(`cache ${Math.round(latestCacheHitRate)}%`);\n\t\t\t}\n\t\t}\n\n\t\t// Kimi Coding is subscription-backed despite using API-key authentication.\n\t\tconst usingSubscription = state.model\n\t\t\t? state.model.provider === \"kimi-coding\" || this.session.modelRuntime.isUsingSubscription(state.model.provider)\n\t\t\t: false;\n\t\tif (tokenUsageDisplay !== \"off\" && (usageTotals.cost || usingSubscription)) {\n\t\t\tconst costStr = `$${usageTotals.cost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`;\n\t\t\tstatsParts.push(costStr);\n\t\t}\n\n\t\t// Context pressure is signalled through text at every setting -- never\n\t\t// color alone (WCAG 1.4.1) -- with color as an additional channel. The\n\t\t// default error/warning pair (red/amber) is already distinguishable for\n\t\t// most red-green colorblindness; colorBlindMode's palette adjustment\n\t\t// moves the critical (>90%) threshold to \"accent\" -- a hue outside that\n\t\t// red/amber family entirely -- rather than relying on a style attribute\n\t\t// like bold/underline, which several terminals (and this theme's own\n\t\t// chalk-backed style methods, suppressed outside a real TTY) silently\n\t\t// drop, making it an unreliable second channel.\n\t\tlet contextPercentStr: string;\n\t\tconst autoIndicator = this.autoCompactEnabled ? \" (auto)\" : \"\";\n\t\tconst pressureMarker = contextPercentValue > 90 ? \"!!\" : contextPercentValue > 70 ? \"!\" : \"\";\n\t\tconst contextPercentDisplay =\n\t\t\tcontextPercent === \"?\"\n\t\t\t\t? `?/${formatTokens(contextWindow)}${autoIndicator}`\n\t\t\t\t: `${contextPercent}%${pressureMarker}/${formatTokens(contextWindow)}${autoIndicator}`;\n\t\tif (contextPercentValue > 90) {\n\t\t\tcontextPercentStr = theme.fg(colorBlindMode ? \"accent\" : \"error\", contextPercentDisplay);\n\t\t} else if (contextPercentValue > 70) {\n\t\t\tcontextPercentStr = theme.fg(\"warning\", contextPercentDisplay);\n\t\t} else {\n\t\t\tcontextPercentStr = contextPercentDisplay;\n\t\t}\n\t\t// Only worth saying when pressure is real and nothing will act on its own.\n\t\t// With auto-compaction on, the \"(auto)\" marker above already answers it.\n\t\tconst compactPrompt =\n\t\t\tcontextPercentValue > 70 && !this.autoCompactEnabled ? theme.fg(\"warning\", \"/compact soon\") : undefined;\n\t\tstatsParts.push(contextPercentStr);\n\t\tif (compactPrompt) statsParts.push(compactPrompt);\n\t\tif (activityLine) statsParts.unshift(activityLine);\n\t\tif (areExperimentalFeaturesEnabled()) {\n\t\t\tstatsParts.push(`${theme.fg(\"dim\", bulletSymbol)} ${theme.bold(theme.fg(\"warning\", \"xp\"))}`);\n\t\t}\n\n\t\t// Permission posture is always named, including `default`. It is operational\n\t\t// state rather than routine telemetry: hiding the safe default would make the\n\t\t// tray change meaning by omission, while hiding bypass would conceal risk.\n\t\t// Text carries the signal and color remains a second channel (WCAG 1.4.1).\n\t\tconst modeColor =\n\t\t\tthis.permissionMode === \"bypassPermissions\" ? \"error\" : this.permissionMode === \"default\" ? \"dim\" : \"warning\";\n\t\tconst sessionMarker = this.permissionModeOrigin === \"interactive\" ? \" (session)\" : \"\";\n\t\tconst cycleKey = this.session.hasPermissionGate ? keyDisplayText(\"app.permissionMode.cycle\") : \"\";\n\t\tconst cycleHint = cycleKey ? theme.fg(\"dim\", `${cycleKey} mode`) : undefined;\n\t\tconst compactPermissionNames: Record<PermissionMode, string> = {\n\t\t\tdefault: \"default\",\n\t\t\tplan: \"plan\",\n\t\t\tacceptEdits: \"accept\",\n\t\t\tbypassPermissions: \"bypass\",\n\t\t\tdontAsk: \"dontAsk\",\n\t\t};\n\t\tconst permissionName = this.permissionMode + sessionMarker;\n\t\tconst safetyName =\n\t\t\tsessionMarker && visibleWidth(permissionName) > width\n\t\t\t\t? compactPermissionNames[this.permissionMode] + sessionMarker\n\t\t\t\t: permissionName;\n\t\tstatsParts.unshift(theme.fg(modeColor, safetyName));\n\t\tif (cycleHint) statsParts.push(cycleHint);\n\n\t\tif (tokenUsageDisplay !== \"full\") {\n\t\t\tconst separator = theme.fg(\"dim\", symbolPreset === \"ascii\" ? \" - \" : \" · \");\n\t\t\tconst permissionColor =\n\t\t\t\tthis.permissionMode === \"bypassPermissions\"\n\t\t\t\t\t? \"error\"\n\t\t\t\t\t: this.permissionMode === \"default\"\n\t\t\t\t\t\t? \"dim\"\n\t\t\t\t\t\t: \"warning\";\n\t\t\tconst permissionFull = theme.fg(permissionColor, this.permissionMode + sessionMarker);\n\t\t\tconst permissionCompact = theme.fg(\n\t\t\t\tpermissionColor,\n\t\t\t\tcompactPermissionNames[this.permissionMode] + sessionMarker,\n\t\t\t);\n\t\t\tconst compactPercent = contextPercent === \"?\" ? \"?\" : contextPercentValue.toFixed(0);\n\t\t\tconst compactPressure = contextPercentValue > 90 ? \"!!\" : contextPercentValue > 70 ? \"!\" : \"\";\n\t\t\tconst contextColor =\n\t\t\t\tcontextPercentValue > 90\n\t\t\t\t\t? colorBlindMode\n\t\t\t\t\t\t? \"accent\"\n\t\t\t\t\t\t: \"error\"\n\t\t\t\t\t: contextPercentValue > 70\n\t\t\t\t\t\t? \"warning\"\n\t\t\t\t\t\t: \"dim\";\n\t\t\t// The gauge rides along only in the roomy form. The compact form drops\n\t\t\t// it, which is what lets it keep winning the fit ladder below.\n\t\t\tconst gauge = renderContextGauge(contextPercent === \"?\" ? undefined : contextPercentValue, symbolPreset);\n\t\t\t// Below the warning threshold the text is dim, which would make the bar\n\t\t\t// invisible; the fill takes the accent there and tracks the text colour\n\t\t\t// at every level that actually signals pressure.\n\t\t\tconst gaugeColor = contextColor === \"dim\" ? \"accent\" : contextColor;\n\t\t\t// An empty run would still emit an open/close SGR pair, so skip it.\n\t\t\tconst paintRun = (color: Parameters<typeof theme.fg>[0], text: string) => (text ? theme.fg(color, text) : \"\");\n\t\t\tconst contextGauged =\n\t\t\t\ttheme.fg(contextColor, \"context \") +\n\t\t\t\tpaintRun(gaugeColor, gauge.filled) +\n\t\t\t\tpaintRun(\"borderMuted\", gauge.empty) +\n\t\t\t\ttheme.fg(contextColor, ` ${contextPercent}%${pressureMarker}`);\n\t\t\tconst contextFull = theme.fg(contextColor, `context ${contextPercent}%${pressureMarker}`);\n\t\t\tconst contextCompact = theme.fg(contextColor, `ctx ${compactPercent}%${compactPressure}`);\n\n\t\t\tconst joinSegments = (segments: string[]): string => segments.join(separator);\n\t\t\tconst fits = (segments: string[]): boolean => visibleWidth(joinSegments(segments)) <= width;\n\t\t\tconst safetyFirst = (...rest: Array<string | undefined>): string[] => [\n\t\t\t\tpermissionFull,\n\t\t\t\t...rest.filter((segment): segment is string => segment !== undefined),\n\t\t\t];\n\t\t\tlet left: string[] = safetyFirst(compactPrompt, activityLine);\n\t\t\tlet right = contextGauged;\n\n\t\t\t// The gauge is decoration over a value the text already states, so it\n\t\t\t// is the first thing to go. Dropping it must not cost the tray its\n\t\t\t// spelled-out permission mode, which is why this is its own rung.\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tright = contextFull;\n\t\t\t}\n\n\t\t\t// Activity is operational, so it outranks every optional segment below.\n\t\t\t// It still yields to the safety posture and to the pressure reading,\n\t\t\t// which are the two things the tray must never lose.\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tleft = safetyFirst(compactPrompt);\n\t\t\t}\n\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tleft = safetyFirst();\n\t\t\t}\n\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tleft = [permissionCompact];\n\t\t\t\tright = contextCompact;\n\t\t\t}\n\n\t\t\tif (!fits([...left, right])) {\n\t\t\t\tconst safetyOnly = left[0];\n\t\t\t\tconst line =\n\t\t\t\t\tvisibleWidth(safetyOnly) <= width ? safetyOnly : truncateToWidth(safetyOnly, Math.max(0, width), \"\");\n\t\t\t\treturn width > 0 ? [line] : [];\n\t\t\t}\n\n\t\t\tconst optional: string[] = [];\n\n\t\t\tif (cycleHint) optional.push(cycleHint);\n\t\t\toptional.push(theme.fg(\"dim\", state.model?.id || \"no-model\"));\n\t\t\tconst detailHint = this.chatDetail\n\t\t\t\t? theme.fg(\"dim\", `${this.chatDetail} ${keyDisplayText(\"app.tools.expand\")}`)\n\t\t\t\t: undefined;\n\t\t\tif (detailHint) optional.push(detailHint);\n\t\t\tif (state.model?.reasoning && state.thinkingLevel && state.thinkingLevel !== \"off\") {\n\t\t\t\toptional.push(theme.fg(\"dim\", state.thinkingLevel));\n\t\t\t}\n\t\t\tif (tokenUsageDisplay !== \"off\" && (usageTotals.input || usageTotals.output)) {\n\t\t\t\toptional.push(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${upSymbol}${formatTokens(usageTotals.input)} ${downSymbol}${formatTokens(usageTotals.output)}`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (\n\t\t\t\ttokenUsageDisplay !== \"off\" &&\n\t\t\t\t(usageTotals.cacheRead > 0 || usageTotals.cacheWrite > 0) &&\n\t\t\t\tlatestCacheHitRate !== undefined\n\t\t\t) {\n\t\t\t\toptional.push(theme.fg(\"dim\", `cache ${Math.round(latestCacheHitRate)}%`));\n\t\t\t}\n\t\t\tif (tokenUsageDisplay !== \"off\" && (usageTotals.cost || usingSubscription)) {\n\t\t\t\toptional.push(theme.fg(\"dim\", `$${usageTotals.cost.toFixed(3)}${usingSubscription ? \" (sub)\" : \"\"}`));\n\t\t\t}\n\t\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\t\toptional.push(theme.fg(\"dim\", state.model.provider));\n\t\t\t}\n\t\t\tif (areExperimentalFeaturesEnabled()) optional.push(theme.fg(\"warning\", \"xp\"));\n\t\t\toptional.push(theme.fg(\"dim\", pwd));\n\n\t\t\tfor (const segment of optional) {\n\t\t\t\tif (fits([...left, segment, right])) left.push(segment);\n\t\t\t\telse if (segment === detailHint && this.chatDetail && fits([...left, this.chatDetail, right]))\n\t\t\t\t\tleft.push(theme.fg(\"dim\", this.chatDetail));\n\t\t\t}\n\n\t\t\tconst leftText = joinSegments(left);\n\t\t\tconst padding = \" \".repeat(Math.max(1, width - visibleWidth(leftText) - visibleWidth(right)));\n\t\t\tconst tray = leftText ? `${leftText}${padding}${right}` : right;\n\t\t\tconst lines = [tray];\n\t\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\t\tif (extensionStatuses.size > 0) {\n\t\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\t\tlines.push(truncateToWidth(sortedStatuses.join(\" \"), width, theme.fg(\"dim\", \"...\")));\n\t\t\t}\n\t\t\treturn lines;\n\t\t}\n\n\t\tif (this.chatDetail) statsParts.push(theme.fg(\"dim\", `${this.chatDetail} ${keyDisplayText(\"app.tools.expand\")}`));\n\t\tlet statsLeft = statsParts.join(\" \");\n\n\t\t// Add model name on the right side, plus thinking level if model supports it\n\t\tconst modelName = state.model?.id || \"no-model\";\n\n\t\tlet statsLeftWidth = visibleWidth(statsLeft);\n\n\t\t// If statsLeft is too wide, truncate it\n\t\tif (statsLeftWidth > width) {\n\t\t\t// Permission mode is the first segment and must remain textual at every\n\t\t\t// positive width. An ellipsis suffix can consume the entire narrow line.\n\t\t\tstatsLeft = truncateToWidth(statsLeft, width, \"\");\n\t\t\tstatsLeftWidth = visibleWidth(statsLeft);\n\t\t}\n\n\t\t// Calculate available space for padding (minimum 2 spaces between stats and model)\n\t\tconst minPadding = 2;\n\n\t\t// Add thinking level indicator if model supports reasoning\n\t\tlet rightSideWithoutProvider = modelName;\n\t\tif (state.model?.reasoning) {\n\t\t\tconst thinkingLevel = state.thinkingLevel || \"off\";\n\t\t\trightSideWithoutProvider =\n\t\t\t\tthinkingLevel === \"off\"\n\t\t\t\t\t? `${modelName} ${bulletSymbol} thinking off`\n\t\t\t\t\t: `${modelName} ${bulletSymbol} ${thinkingLevel}`;\n\t\t}\n\n\t\t// Prepend the provider in parentheses if there are multiple providers and there's enough room\n\t\tlet rightSide = rightSideWithoutProvider;\n\t\tif (this.footerData.getAvailableProviderCount() > 1 && state.model) {\n\t\t\trightSide = `(${state.model!.provider}) ${rightSideWithoutProvider}`;\n\t\t\tif (statsLeftWidth + minPadding + visibleWidth(rightSide) > width) {\n\t\t\t\t// Too wide, fall back\n\t\t\t\trightSide = rightSideWithoutProvider;\n\t\t\t}\n\t\t}\n\n\t\tconst rightSideWidth = visibleWidth(rightSide);\n\t\tconst totalNeeded = statsLeftWidth + minPadding + rightSideWidth;\n\n\t\tlet statsLine: string;\n\t\tif (totalNeeded <= width) {\n\t\t\t// Both fit - add padding to right-align model\n\t\t\tconst padding = \" \".repeat(width - statsLeftWidth - rightSideWidth);\n\t\t\tstatsLine = statsLeft + padding + rightSide;\n\t\t} else {\n\t\t\t// Need to truncate right side\n\t\t\tconst availableForRight = width - statsLeftWidth - minPadding;\n\t\t\tif (availableForRight > 0) {\n\t\t\t\tconst truncatedRight = truncateToWidth(rightSide, availableForRight, \"\");\n\t\t\t\tconst truncatedRightWidth = visibleWidth(truncatedRight);\n\t\t\t\tconst padding = \" \".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));\n\t\t\t\tstatsLine = statsLeft + padding + truncatedRight;\n\t\t\t} else {\n\t\t\t\t// Not enough space for right side at all\n\t\t\t\tstatsLine = statsLeft;\n\t\t\t}\n\t\t}\n\n\t\t// Apply dim to each part separately. statsLeft may contain color codes (for context %)\n\t\t// that end with a reset, which would clear an outer dim wrapper. So we dim the parts\n\t\t// before and after the colored section independently.\n\t\tconst dimStatsLeft = theme.fg(\"dim\", statsLeft);\n\t\tconst remainder = statsLine.slice(statsLeft.length); // padding + rightSide\n\t\tconst dimRemainder = theme.fg(\"dim\", remainder);\n\n\t\tconst pwdLine = truncateToWidth(theme.fg(\"dim\", pwd), width, theme.fg(\"dim\", \"...\"));\n\t\tconst lines = [pwdLine, dimStatsLeft + dimRemainder];\n\n\t\t// Add extension statuses on a single line, sorted by key alphabetically\n\t\tconst extensionStatuses = this.footerData.getExtensionStatuses();\n\t\tif (extensionStatuses.size > 0) {\n\t\t\tconst sortedStatuses = Array.from(extensionStatuses.entries())\n\t\t\t\t.sort(([a], [b]) => a.localeCompare(b))\n\t\t\t\t.map(([, text]) => sanitizeStatusText(text));\n\t\t\tconst statusLine = sortedStatuses.join(\" \");\n\t\t\t// Truncate to terminal width with dim ellipsis for consistency with footer style\n\t\t\tlines.push(truncateToWidth(statusLine, width, theme.fg(\"dim\", \"...\")));\n\t\t}\n\n\t\treturn lines;\n\t}\n}\n"]}
|
|
@@ -11,6 +11,10 @@ import { type TerminalTheme } from "../theme/theme.ts";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const PERMISSION_MODE_OVERRIDE_HINTS: Partial<Record<PermissionModeOrigin, string>>;
|
|
13
13
|
export interface SettingsConfig {
|
|
14
|
+
taskListTool?: {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
projectControlled: boolean;
|
|
17
|
+
};
|
|
14
18
|
autoCompact: boolean;
|
|
15
19
|
defaultModel: string;
|
|
16
20
|
currentModel?: Model<any>;
|
|
@@ -59,6 +63,7 @@ export interface SettingsConfig {
|
|
|
59
63
|
warnings: WarningSettings;
|
|
60
64
|
}
|
|
61
65
|
export interface SettingsCallbacks {
|
|
66
|
+
onTaskListToolChange?: (enabled: boolean) => void;
|
|
62
67
|
onAutoCompactChange: (enabled: boolean) => void;
|
|
63
68
|
onShowImagesChange: (enabled: boolean) => void;
|
|
64
69
|
onImageWidthCellsChange: (width: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAEN,SAAS,EAET,KAAK,mBAAmB,EAGxB,YAAY,EAIZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAEN,KAAK,gBAAgB,EAErB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAA+C,KAAK,aAAa,EAAS,MAAM,mBAAmB,CAAC;AA6D3G;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAMxF,CAAC;AAsBF,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,sBAAsB,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;IAC9C,UAAU,EAAE,OA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IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,4BAA4B,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACrE,2BAA2B,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjE,8BAA8B,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,gBAAgB,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IACtD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAsZD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,YAAY,CAAe;IAEnC,YAAY,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EA+gB/D;IAED,eAAe,IAAI,YAAY,CAE9B;CACD","sourcesContent":["import { getSupportedThinkingLevels, type Model, type Transport } from \"@earendil-works/pi-ai\";\nimport {\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\ttype ScrollViewScrollbar,\n\ttype SelectItem,\n\ttype SettingItem,\n\tSettingsList,\n\ttype SettingsListTheme,\n\tSpacer,\n\tText,\n} from \"@earendil-works/pi-tui\";\nimport type { ThinkingLevel } from \"apex-code-agent-core\";\nimport { formatHttpIdleTimeoutMs, HTTP_IDLE_TIMEOUT_CHOICES } from \"../../../core/http-dispatcher.ts\";\nimport type { PermissionModeOrigin } from \"../../../core/permissions/startup.ts\";\nimport { PERMISSION_MODES, type PermissionMode } from \"../../../core/permissions/store.ts\";\nimport {\n\tCACHE_WARMING_MODES,\n\ttype CacheWarmingMode,\n\tCHAT_DETAILS,\n\ttype ChatDetail,\n\ttype DefaultProjectTrust,\n\ttype FullscreenExitOutput,\n\ttype MermaidRenderingMode,\n\ttype TuiMode,\n\ttype WarningSettings,\n} from \"../../../core/settings-manager.ts\";\nimport { getSettingsListTheme, parseAutoThemeSetting, type TerminalTheme, theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { hintRow, keyDisplayText } from \"./keybinding-hints.ts\";\nimport { withComposerPrompt } from \"./prompt-input.ts\";\nimport { SelectSubmenu, SteppedSubmenu, type SteppedSubmenuStep } from \"./settings-submenu.ts\";\n\n/** The two hint rows `pi-tui`'s settings list writes, with and without search. */\nconst SETTINGS_LIST_HINT_ROWS = new Set([\n\t\"Type to search · Enter/Space to change · Esc to cancel\",\n\t\"Enter/Space to change · Esc to cancel\",\n]);\n\n/**\n * The settings list is `pi-tui`'s and writes its own hint row, but the theme it paints with is\n * ours, so the row is swapped here for the shared grammar. The search box's prompt already\n * says typing searches.\n */\nfunction getSettingsSelectorListTheme(): SettingsListTheme {\n\tconst base = getSettingsListTheme();\n\treturn {\n\t\t...base,\n\t\thint: (text: string) =>\n\t\t\tSETTINGS_LIST_HINT_ROWS.has(text.trim())\n\t\t\t\t? hintRow([\n\t\t\t\t\t\t[[\"tui.select.confirm\", { literal: \"space\" }], \"change\"],\n\t\t\t\t\t\t[\"tui.select.cancel\", \"close\"],\n\t\t\t\t\t])\n\t\t\t\t: base.hint(text),\n\t};\n}\n\nconst MODEL_PICKER_LAYOUT = { minPrimaryColumnWidth: 12, maxPrimaryColumnWidth: 46 };\n\nconst THINKING_DESCRIPTIONS: Record<ThinkingLevel, string> = {\n\toff: \"No reasoning\",\n\tminimal: \"Very brief reasoning (~1k tokens)\",\n\tlow: \"Light reasoning (~2k tokens)\",\n\tmedium: \"Moderate reasoning (~8k tokens)\",\n\thigh: \"Deep reasoning (~16k tokens)\",\n\txhigh: \"Extra-high reasoning (~32k tokens)\",\n\tmax: \"Maximum reasoning\",\n};\n\nconst DEFAULT_PROJECT_TRUST_LABELS: Record<DefaultProjectTrust, string> = {\n\task: \"Ask\",\n\talways: \"Always trust\",\n\tnever: \"Never trust\",\n};\n\nconst DEFAULT_PROJECT_TRUST_BY_LABEL = new Map(\n\tObject.entries(DEFAULT_PROJECT_TRUST_LABELS).map(([value, label]) => [label, value as DefaultProjectTrust]),\n);\n\nconst PERMISSION_MODE_DESCRIPTIONS: Record<PermissionMode, string> = {\n\tdefault: \"Ask for anything policy does not already allow\",\n\tplan: \"Block file writes, commands, and delegation while you investigate\",\n\tacceptEdits: \"Auto-allow file edits inside the workspace; still ask for anything outside it, commands and network\",\n\tdontAsk: \"Never prompt; deny anything not already permitted\",\n\tbypassPermissions: \"Allow every tool call without asking\",\n};\n\n/**\n * What outranks a user-scope write, phrased for someone deciding whether to bother.\n * `user` and `default` are absent because neither shadows anything this menu writes.\n */\nexport const PERMISSION_MODE_OVERRIDE_HINTS: Partial<Record<PermissionModeOrigin, string>> = {\n\tflag: \"--permission-mode on the command line\",\n\tlocal: \".apex-code/permissions.local.json in this project\",\n\tproject: \".apex-code/permissions.json in this project\",\n\tcommand: \"a command-scoped override in this session\",\n\tsession: \"a session-scoped override\",\n};\n\n/** Empty when the session has no permission gate, so the row simply does not exist. */\nfunction permissionModeItems(current: SettingsConfig[\"permissionMode\"], callbacks: SettingsCallbacks): SettingItem[] {\n\tif (!current) return [];\n\treturn [\n\t\t{\n\t\t\tid: \"permission-mode\",\n\t\t\tlabel: \"Permission mode\",\n\t\t\tdescription: PERMISSION_MODE_DESCRIPTIONS[current.mode],\n\t\t\tcurrentValue: current.mode,\n\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\tnew PermissionModeSubmenu(\n\t\t\t\t\tcurrentValue as PermissionMode,\n\t\t\t\t\tcurrent.origin,\n\t\t\t\t\t(mode) => callbacks.onPermissionModeChange(mode),\n\t\t\t\t\tdone,\n\t\t\t\t),\n\t\t},\n\t];\n}\n\nexport interface SettingsConfig {\n\tautoCompact: boolean;\n\tdefaultModel: string;\n\tcurrentModel?: Model<any>;\n\tavailableDefaultModels: readonly Model<any>[];\n\tshowImages: boolean;\n\timageWidthCells: number;\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tenableSkillCommands: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\ttransport: Transport;\n\thttpIdleTimeoutMs: number;\n\tcacheWarmingMode: CacheWarmingMode;\n\tthinkingLevel: ThinkingLevel;\n\tavailableThinkingLevels: ThinkingLevel[];\n\tmodelThinkingLevels: Record<string, ThinkingLevel>;\n\tcurrentTheme: string;\n\tterminalTheme: TerminalTheme;\n\tavailableThemes: string[];\n\thideThinkingBlock: boolean;\n\tchatDetail: ChatDetail;\n\tmermaidRenderingMode: MermaidRenderingMode;\n\tshowCacheMissNotices: boolean;\n\tcollapseChangelog: boolean;\n\tsendProviderAttribution: boolean;\n\tdoubleEscapeAction: \"fork\" | \"tree\" | \"none\";\n\ttreeFilterMode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\";\n\tshowHardwareCursor: boolean;\n\teditorPaddingX: number;\n\toutputPad: 0 | 1;\n\tautocompleteMaxVisible: number;\n\tquietStartup: boolean;\n\tdefaultProjectTrust: DefaultProjectTrust;\n\t/** Absent when the session runs without a permission gate; the row is then hidden. */\n\tpermissionMode?: { mode: PermissionMode; origin: PermissionModeOrigin };\n\tclearOnShrink: boolean;\n\tshowTerminalProgress: boolean;\n\ttuiMode: TuiMode;\n\tfullscreenExitOutput: FullscreenExitOutput;\n\tfullscreenScrollbar: ScrollViewScrollbar;\n\tfullscreenCopyOnSelect: boolean;\n\twarnings: WarningSettings;\n}\n\nexport interface SettingsCallbacks {\n\tonAutoCompactChange: (enabled: boolean) => void;\n\tonShowImagesChange: (enabled: boolean) => void;\n\tonImageWidthCellsChange: (width: number) => void;\n\tonAutoResizeImagesChange: (enabled: boolean) => void;\n\tonBlockImagesChange: (blocked: boolean) => void;\n\tonEnableSkillCommandsChange: (enabled: boolean) => void;\n\tonSteeringModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonFollowUpModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonTransportChange: (transport: Transport) => void;\n\tonHttpIdleTimeoutMsChange: (timeoutMs: number) => void;\n\tonCacheWarmingModeChange: (mode: CacheWarmingMode) => void;\n\tonModelThinkingLevelChange: (provider: string, modelId: string, level: ThinkingLevel) => void;\n\tonModelThinkingLevelRemove: (provider: string, modelId: string) => void;\n\tonThemeChange: (theme: string) => void;\n\tonThemePreview?: (theme: string) => void;\n\tonHideThinkingBlockChange: (hidden: boolean) => void;\n\tonChatDetailChange: (detail: ChatDetail) => void;\n\tonMermaidRenderingModeChange: (mode: MermaidRenderingMode) => void;\n\tonShowCacheMissNoticesChange: (shown: boolean) => void;\n\tonCollapseChangelogChange: (collapsed: boolean) => void;\n\tonSendProviderAttributionChange: (enabled: boolean) => void;\n\tonDoubleEscapeActionChange: (action: \"fork\" | \"tree\" | \"none\") => void;\n\tonTreeFilterModeChange: (mode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\") => void;\n\tonShowHardwareCursorChange: (enabled: boolean) => void;\n\tonEditorPaddingXChange: (padding: number) => void;\n\tonOutputPadChange: (padding: 0 | 1) => void;\n\tonAutocompleteMaxVisibleChange: (maxVisible: number) => void;\n\tonQuietStartupChange: (enabled: boolean) => void;\n\tonDefaultProjectTrustChange: (defaultProjectTrust: DefaultProjectTrust) => void;\n\tonPermissionModeChange: (mode: PermissionMode) => void;\n\tonClearOnShrinkChange: (enabled: boolean) => void;\n\tonShowTerminalProgressChange: (enabled: boolean) => void;\n\tonTuiModeChange: (mode: TuiMode) => void;\n\tonFullscreenExitOutputChange: (output: FullscreenExitOutput) => void;\n\tonFullscreenScrollbarChange: (mode: ScrollViewScrollbar) => void;\n\tonFullscreenCopyOnSelectChange: (enabled: boolean) => void;\n\tonWarningsChange: (warnings: WarningSettings) => void;\n\tonCancel: () => void;\n}\n\n/**\n * A submenu component for selecting from a list of options.\n */\nclass WarningSettingsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate state: WarningSettings;\n\n\tconstructor(warnings: WarningSettings, onChange: (warnings: WarningSettings) => void, onCancel: () => void) {\n\t\tsuper();\n\n\t\tthis.state = { ...warnings };\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"anthropic-extra-usage\",\n\t\t\t\tlabel: \"Anthropic extra usage\",\n\t\t\t\tdescription: \"Warn when Anthropic subscription auth may use paid extra usage\",\n\t\t\t\tcurrentValue: (this.state.anthropicExtraUsage ?? true) ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"anthropic-extra-usage\":\n\t\t\t\t\t\tthis.state = { ...this.state, anthropicExtraUsage: newValue === \"true\" };\n\t\t\t\t\t\tonChange({ ...this.state });\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tonCancel,\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\nconst CLEAR_OVERRIDE_VALUE = \"__clear__\";\n\nfunction modelSettingKey(model: Model<any>): string {\n\treturn `${model.provider}/${model.id}`;\n}\n\nfunction modelDisplayLabel(model: Model<any>): string {\n\treturn `${model.id} [${model.provider}]`;\n}\n\nfunction modelThinkingOverridesSummary(overrides: Record<string, ThinkingLevel>): string {\n\tconst count = Object.keys(overrides).length;\n\tif (count === 0) return \"none\";\n\treturn `${count} configured`;\n}\n\nfunction modelItemLabel(model: Model<any>): string {\n\treturn `${model.id} ${theme.fg(\"muted\", `[${model.provider}]`)}`;\n}\n\n/**\n * Permission mode picker, mode list then a confirm step for `bypassPermissions`.\n * The confirm exists because the mode list is arrow-cyclable like every other\n * settings row, so \"allow every tool call\" is otherwise one stray keypress away.\n */\nclass PermissionModeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly current: PermissionMode;\n\tprivate readonly origin: PermissionModeOrigin;\n\tprivate readonly onSelect: (mode: PermissionMode) => void;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\n\tconstructor(\n\t\tcurrent: PermissionMode,\n\t\torigin: PermissionModeOrigin,\n\t\tonSelect: (mode: PermissionMode) => void,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.current = current;\n\t\tthis.origin = origin;\n\t\tthis.onSelect = onSelect;\n\t\tthis.onDone = onDone;\n\t\tthis.showModeList();\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(component: Component): void {\n\t\tthis.clear();\n\t\tthis.addChild(component);\n\t\tthis.inputComponent = component;\n\t}\n\n\tprivate description(): string {\n\t\tconst overridden =\n\t\t\tthis.origin !== \"user\" && this.origin !== \"default\"\n\t\t\t\t? ` Currently set by ${PERMISSION_MODE_OVERRIDE_HINTS[this.origin]}.`\n\t\t\t\t: \"\";\n\t\treturn `Saved to user scope and applied to the next tool call.${overridden}`;\n\t}\n\n\tprivate showModeList(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Permission mode\",\n\t\t\t\tthis.description(),\n\t\t\t\tPERMISSION_MODES.map((mode) => ({\n\t\t\t\t\tvalue: mode,\n\t\t\t\t\tlabel: mode,\n\t\t\t\t\tdescription: PERMISSION_MODE_DESCRIPTIONS[mode],\n\t\t\t\t})),\n\t\t\t\tthis.current,\n\t\t\t\t(value) => {\n\t\t\t\t\tconst mode = value as PermissionMode;\n\t\t\t\t\tif (mode === \"bypassPermissions\") {\n\t\t\t\t\t\tthis.showBypassConfirm();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(mode);\n\t\t\t\t\tthis.onDone(mode);\n\t\t\t\t},\n\t\t\t\t() => this.onDone(),\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate showBypassConfirm(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Bypass all permission checks?\",\n\t\t\t\t\"Every tool call runs without asking, in every project, until you change this back. Nothing else confines the session: it writes anywhere your account can and reaches any host. Run inside a container or VM if the work is untrusted.\",\n\t\t\t\t[\n\t\t\t\t\t{ value: \"no\", label: `No, keep ${this.current}`, description: \"Return to the mode list\" },\n\t\t\t\t\t{ value: \"yes\", label: \"Yes, bypass\", description: \"Allow every tool call without asking\" },\n\t\t\t\t],\n\t\t\t\t\"no\",\n\t\t\t\t(value) => {\n\t\t\t\t\tif (value !== \"yes\") {\n\t\t\t\t\t\tthis.showModeList();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(\"bypassPermissions\");\n\t\t\t\t\tthis.onDone(\"bypassPermissions\");\n\t\t\t\t},\n\t\t\t\t() => this.showModeList(),\n\t\t\t),\n\t\t);\n\t}\n}\n\nfunction themeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn availableThemes.map((name) => ({\n\t\tvalue: name,\n\t\tlabel: `${name === currentTheme ? \"✓ \" : \" \"}${name}`,\n\t}));\n}\n\nconst AUTOMATIC_THEME_VALUE = \"/\";\n\nfunction singleModeThemeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn [\n\t\t{\n\t\t\tvalue: AUTOMATIC_THEME_VALUE,\n\t\t\tlabel: \" Automatic\",\n\t\t\tdescription: \"Use separate themes for light and dark terminal appearance\",\n\t\t},\n\t\t...themeItems(availableThemes, currentTheme),\n\t];\n}\n\nfunction preferredTheme(availableThemes: string[], preferred: string | undefined, fallback: string): string {\n\tif (preferred && availableThemes.includes(preferred)) return preferred;\n\tif (availableThemes.includes(fallback)) return fallback;\n\treturn availableThemes[0] ?? fallback;\n}\n\nfunction defaultAutomaticThemes(\n\tcurrentThemeSetting: string,\n\tavailableThemes: string[],\n): { lightTheme: string; darkTheme: string } {\n\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\tif (autoTheme) return autoTheme;\n\n\tconst currentFixedTheme = currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\tconst themeName = preferredTheme(availableThemes, currentFixedTheme, \"dark\");\n\treturn { lightTheme: themeName, darkTheme: themeName };\n}\n\nclass ThemeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly callbacks: SettingsCallbacks;\n\tprivate readonly availableThemes: string[];\n\tprivate readonly terminalTheme: TerminalTheme;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\tprivate readonly originalThemeSetting: string;\n\tprivate mode: \"single\" | \"automatic\";\n\tprivate singleTheme: string;\n\tprivate lightTheme: string;\n\tprivate darkTheme: string;\n\n\tconstructor(\n\t\tcurrentThemeSetting: string,\n\t\tterminalTheme: TerminalTheme,\n\t\tavailableThemes: string[],\n\t\tcallbacks: SettingsCallbacks,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.callbacks = callbacks;\n\t\tthis.availableThemes = availableThemes;\n\t\tthis.terminalTheme = terminalTheme;\n\t\tthis.onDone = onDone;\n\t\tthis.originalThemeSetting = currentThemeSetting;\n\t\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\t\tconst automaticThemes = defaultAutomaticThemes(currentThemeSetting, availableThemes);\n\t\tconst fixedTheme = autoTheme || currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\t\tthis.mode = autoTheme ? \"automatic\" : \"single\";\n\t\tthis.lightTheme = automaticThemes.lightTheme;\n\t\tthis.darkTheme = automaticThemes.darkTheme;\n\t\tthis.singleTheme = preferredTheme(\n\t\t\tavailableThemes,\n\t\t\tfixedTheme ?? (autoTheme ? this.getActiveAutomaticTheme() : undefined),\n\t\t\t\"dark\",\n\t\t);\n\n\t\tif (this.mode === \"automatic\") {\n\t\t\tthis.showAutomaticMenu();\n\t\t} else {\n\t\t\tthis.showSingleMenu();\n\t\t}\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(renderComponent: Component, inputComponent: Component = renderComponent): void {\n\t\tthis.clear();\n\t\tthis.addChild(renderComponent);\n\t\tthis.inputComponent = inputComponent;\n\t}\n\n\tprivate showSingleMenu(): void {\n\t\tthis.mode = \"single\";\n\t\tconst menu = new SelectSubmenu(\n\t\t\t\"Theme\",\n\t\t\t\"Select a theme, or choose Automatic to follow terminal appearance.\",\n\t\t\tsingleModeThemeItems(this.availableThemes, this.singleTheme),\n\t\t\tthis.singleTheme,\n\t\t\t(value) => {\n\t\t\t\tif (value === AUTOMATIC_THEME_VALUE) {\n\t\t\t\t\tthis.mode = \"automatic\";\n\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\tthis.showAutomaticMenu();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.singleTheme = value;\n\t\t\t\tthis.apply(value);\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t\t(value) => {\n\t\t\t\tthis.callbacks.onThemePreview?.(value === AUTOMATIC_THEME_VALUE ? this.getAutomaticThemeSetting() : value);\n\t\t\t},\n\t\t);\n\t\tthis.setContent(menu);\n\t}\n\n\tprivate showAutomaticMenu(): void {\n\t\tthis.mode = \"automatic\";\n\t\tconst content = new Container();\n\t\tcontent.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Automatic theme\")), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Choose themes for terminal light and dark appearance.\"), 0, 0));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Light/dark detection requires terminal support.\"), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"light-theme\",\n\t\t\t\tlabel: \"Light theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is light\",\n\t\t\t\tcurrentValue: this.lightTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Light Theme\",\n\t\t\t\t\t\t\"Select the theme to use for light terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.lightTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"dark-theme\",\n\t\t\t\tlabel: \"Dark theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is dark\",\n\t\t\t\tcurrentValue: this.darkTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Dark Theme\",\n\t\t\t\t\t\t\"Select the theme to use for dark terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.darkTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"apply\",\n\t\t\t\tlabel: \"Apply\",\n\t\t\t\tdescription: \"Save and go back\",\n\t\t\t\tcurrentValue: \"save and go back\",\n\t\t\t\tvalues: [\"save and go back\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"single-mode\",\n\t\t\t\tlabel: \"Change mode\",\n\t\t\t\tdescription: \"Switch to one theme for light and dark\",\n\t\t\t\tcurrentValue: \"switch to single theme\",\n\t\t\t\tvalues: [\"switch to single theme\"],\n\t\t\t},\n\t\t];\n\n\t\tconst settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"single-mode\":\n\t\t\t\t\t\tthis.mode = \"single\";\n\t\t\t\t\t\tthis.singleTheme = this.getActiveAutomaticTheme();\n\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.singleTheme);\n\t\t\t\t\t\tthis.showSingleMenu();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"apply\":\n\t\t\t\t\t\tthis.apply(this.getAutomaticThemeSetting());\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t);\n\t\tcontent.addChild(settingsList);\n\t\tthis.setContent(content, settingsList);\n\t}\n\n\tprivate createThemeSelect(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\tcurrentValue: string,\n\t\tdone: (selectedValue?: string) => void,\n\t\tonSelect: (value: string) => void,\n\t): SelectSubmenu {\n\t\treturn new SelectSubmenu(\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\tthemeItems(this.availableThemes, currentValue),\n\t\t\tcurrentValue,\n\t\t\tonSelect,\n\t\t\t() => {\n\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\tdone();\n\t\t\t},\n\t\t\t(value) => this.callbacks.onThemePreview?.(value),\n\t\t);\n\t}\n\n\tprivate getThemeSetting(): string {\n\t\treturn this.mode === \"automatic\" ? this.getAutomaticThemeSetting() : this.singleTheme;\n\t}\n\n\tprivate getActiveAutomaticTheme(): string {\n\t\treturn this.terminalTheme === \"light\" ? this.lightTheme : this.darkTheme;\n\t}\n\n\tprivate getAutomaticThemeSetting(): string {\n\t\treturn `${this.lightTheme}/${this.darkTheme}`;\n\t}\n\n\tprivate apply(themeSetting: string): void {\n\t\tthis.onDone(themeSetting);\n\t}\n\n\tprivate cancel(): void {\n\t\tthis.callbacks.onThemePreview?.(this.originalThemeSetting);\n\t\tthis.onDone();\n\t}\n}\n\n/**\n * Main settings selector component.\n */\nexport class SettingsSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(config: SettingsConfig, callbacks: SettingsCallbacks) {\n\t\tsuper();\n\n\t\tconst supportsImages = getCapabilities().images;\n\t\tconst followUpKey = keyDisplayText(\"app.message.followUp\");\n\t\tconst cycleThinkingKey = keyDisplayText(\"app.thinking.cycle\");\n\t\tlet currentWarnings = { ...config.warnings };\n\t\tconst currentModelThinkingLevels = { ...config.modelThinkingLevels };\n\t\tconst defaultModelByValue = new Map(\n\t\t\tconfig.availableDefaultModels.map((model) => [modelSettingKey(model), model]),\n\t\t);\n\t\tconst currentDefaultModelKey = defaultModelByValue.has(config.defaultModel) ? config.defaultModel : undefined;\n\t\tconst currentModelKey = config.currentModel ? modelSettingKey(config.currentModel) : undefined;\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"autocompact\",\n\t\t\t\tlabel: \"Auto-compact\",\n\t\t\t\tdescription: \"Automatically compact context when it gets too large\",\n\t\t\t\tcurrentValue: config.autoCompact ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"steering-mode\",\n\t\t\t\tlabel: \"Steering mode\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.\",\n\t\t\t\tcurrentValue: config.steeringMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"follow-up-mode\",\n\t\t\t\tlabel: \"Follow-up mode\",\n\t\t\t\tdescription: `${followUpKey} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,\n\t\t\t\tcurrentValue: config.followUpMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"transport\",\n\t\t\t\tlabel: \"Transport\",\n\t\t\t\tdescription: \"Preferred transport for providers that support multiple transports\",\n\t\t\t\tcurrentValue: config.transport,\n\t\t\t\tvalues: [\"sse\", \"websocket\", \"websocket-cached\", \"auto\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"http-idle-timeout\",\n\t\t\t\tlabel: \"HTTP idle timeout\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.\",\n\t\t\t\tcurrentValue: formatHttpIdleTimeoutMs(config.httpIdleTimeoutMs),\n\t\t\t\tvalues: HTTP_IDLE_TIMEOUT_CHOICES.map((choice) => choice.label),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-warming-mode\",\n\t\t\t\tlabel: \"Cache warming\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"off; streaming while the agent runs; idle also between runs while continuation stays profitable\",\n\t\t\t\tcurrentValue: config.cacheWarmingMode,\n\t\t\t\tvalues: [...CACHE_WARMING_MODES],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"hide-thinking\",\n\t\t\t\tlabel: \"Hide thinking\",\n\t\t\t\tdescription: \"Hide thinking blocks in assistant responses\",\n\t\t\t\tcurrentValue: config.hideThinkingBlock ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"chat-detail\",\n\t\t\t\tlabel: \"Conversation detail\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Overview collapses everything; details shows diffs and follows the Hide thinking preference; all shows full tool output and thinking\",\n\t\t\t\tcurrentValue: config.chatDetail,\n\t\t\t\tvalues: [...CHAT_DETAILS],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"mermaid-rendering\",\n\t\t\t\tlabel: \"Mermaid diagrams\",\n\t\t\t\tdescription: \"Render Mermaid code blocks as Unicode diagrams\",\n\t\t\t\tcurrentValue: config.mermaidRenderingMode,\n\t\t\t\tvalues: [\"off\", \"final\", \"streaming\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-miss-notices\",\n\t\t\t\tlabel: \"Cache miss notices\",\n\t\t\t\tdescription: \"Show transcript notices for cache costs and provider recovery diagnostics\",\n\t\t\t\tcurrentValue: config.showCacheMissNotices ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"collapse-changelog\",\n\t\t\t\tlabel: \"Collapse changelog\",\n\t\t\t\tdescription: \"Show condensed changelog after updates\",\n\t\t\t\tcurrentValue: config.collapseChangelog ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"quiet-startup\",\n\t\t\t\tlabel: \"Quiet startup\",\n\t\t\t\tdescription: \"Disable verbose printing at startup\",\n\t\t\t\tcurrentValue: config.quietStartup ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"send-provider-attribution\",\n\t\t\t\tlabel: \"Provider attribution headers\",\n\t\t\t\tdescription: \"Identify this CLI to your configured LLM provider (e.g. OpenRouter billing origin)\",\n\t\t\t\tcurrentValue: config.sendProviderAttribution ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"default-project-trust\",\n\t\t\t\tlabel: \"Default project trust\",\n\t\t\t\tdescription: \"Fallback behavior when no extension or saved trust decision decides project trust\",\n\t\t\t\tcurrentValue: DEFAULT_PROJECT_TRUST_LABELS[config.defaultProjectTrust],\n\t\t\t\tvalues: Object.values(DEFAULT_PROJECT_TRUST_LABELS),\n\t\t\t},\n\t\t\t...permissionModeItems(config.permissionMode, callbacks),\n\t\t\t{\n\t\t\t\tid: \"double-escape-action\",\n\t\t\t\tlabel: \"Double-escape action\",\n\t\t\t\tdescription: \"Action when pressing Escape twice with empty editor\",\n\t\t\t\tcurrentValue: config.doubleEscapeAction,\n\t\t\t\tvalues: [\"tree\", \"fork\", \"none\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tree-filter-mode\",\n\t\t\t\tlabel: \"Tree filter mode\",\n\t\t\t\tdescription: \"Default filter when opening /tree\",\n\t\t\t\tcurrentValue: config.treeFilterMode,\n\t\t\t\tvalues: [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"warnings\",\n\t\t\t\tlabel: \"Warnings\",\n\t\t\t\tdescription: \"Enable or disable individual warnings\",\n\t\t\t\tcurrentValue: \"configure\",\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew WarningSettingsSubmenu(\n\t\t\t\t\t\tcurrentWarnings,\n\t\t\t\t\t\t(warnings) => {\n\t\t\t\t\t\t\tcurrentWarnings = warnings;\n\t\t\t\t\t\t\tcallbacks.onWarningsChange(warnings);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => done(),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"model-thinking\",\n\t\t\t\tlabel: \"Default thinking level per model\",\n\t\t\t\tdescription: `Override the default thinking level for specific models. ${cycleThinkingKey} cycles in-session.`,\n\t\t\t\tcurrentValue: modelThinkingOverridesSummary(currentModelThinkingLevels),\n\t\t\t\tsubmenu: (_currentValue, done) => {\n\t\t\t\t\tconst steps: SteppedSubmenuStep[] = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"model\",\n\t\t\t\t\t\t\ttitle: \"Per-Model Thinking Level\",\n\t\t\t\t\t\t\tdescription: \"Select a model to configure\",\n\t\t\t\t\t\t\toptions: () => {\n\t\t\t\t\t\t\t\tconst sorted = [...config.availableDefaultModels].sort((a, b) => {\n\t\t\t\t\t\t\t\t\tconst aKey = modelSettingKey(a);\n\t\t\t\t\t\t\t\t\tconst bKey = modelSettingKey(b);\n\t\t\t\t\t\t\t\t\tif (aKey === currentModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentModelKey) return 1;\n\t\t\t\t\t\t\t\t\tif (aKey === currentDefaultModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentDefaultModelKey) return 1;\n\t\t\t\t\t\t\t\t\treturn a.provider.localeCompare(b.provider);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = sorted.map((model) => {\n\t\t\t\t\t\t\t\t\tconst key = modelSettingKey(model);\n\t\t\t\t\t\t\t\t\tconst override = currentModelThinkingLevels[key];\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tvalue: key,\n\t\t\t\t\t\t\t\t\t\tlabel: modelItemLabel(model),\n\t\t\t\t\t\t\t\t\t\tdescription: override ?? undefined,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (items.length === 0) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: \"__none__\",\n\t\t\t\t\t\t\t\t\t\tlabel: \"No models available\",\n\t\t\t\t\t\t\t\t\t\tdescription: \"Log in to a provider or configure an API key first\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: () => currentModelKey ?? currentDefaultModelKey,\n\t\t\t\t\t\t\tsearchable: true,\n\t\t\t\t\t\t\tlayout: MODEL_PICKER_LAYOUT,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"level\",\n\t\t\t\t\t\t\ttitle: (ctx) => {\n\t\t\t\t\t\t\t\tconst m = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\treturn `Thinking Level for ${m ? modelDisplayLabel(m) : ctx.model}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdescription: \"Select default thinking level for this model\",\n\t\t\t\t\t\t\toptions: (ctx) => {\n\t\t\t\t\t\t\t\tconst model = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\tif (!model) return [];\n\t\t\t\t\t\t\t\tconst levels = (\n\t\t\t\t\t\t\t\t\tmodel.reasoning ? getSupportedThinkingLevels(model) : [\"off\"]\n\t\t\t\t\t\t\t\t) as ThinkingLevel[];\n\t\t\t\t\t\t\t\tconst activeLevel = currentModelThinkingLevels[ctx.model];\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = levels.map((level) => ({\n\t\t\t\t\t\t\t\t\tvalue: level,\n\t\t\t\t\t\t\t\t\tlabel: `${level === activeLevel ? \"✓ \" : \" \"}${level}`,\n\t\t\t\t\t\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\tif (currentModelThinkingLevels[ctx.model] !== undefined) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: CLEAR_OVERRIDE_VALUE,\n\t\t\t\t\t\t\t\t\t\tlabel: \" (clear override)\",\n\t\t\t\t\t\t\t\t\t\tdescription: `Revert to global default (${config.thinkingLevel})`,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: (ctx) => currentModelThinkingLevels[ctx.model],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\n\t\t\t\t\tconst summary = () => modelThinkingOverridesSummary(currentModelThinkingLevels);\n\n\t\t\t\t\treturn new SteppedSubmenu(\n\t\t\t\t\t\tsteps,\n\t\t\t\t\t\t(selections) => {\n\t\t\t\t\t\t\tconst model = defaultModelByValue.get(selections.model);\n\t\t\t\t\t\t\tif (!model) return;\n\t\t\t\t\t\t\tif (selections.level === CLEAR_OVERRIDE_VALUE) {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelRemove(model.provider, model.id);\n\t\t\t\t\t\t\t\tdelete currentModelThinkingLevels[selections.model];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelChange(\n\t\t\t\t\t\t\t\t\tmodel.provider,\n\t\t\t\t\t\t\t\t\tmodel.id,\n\t\t\t\t\t\t\t\t\tselections.level as ThinkingLevel,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcurrentModelThinkingLevels[selections.model] = selections.level as ThinkingLevel;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tdone(summary());\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ loop: true },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tui-mode\",\n\t\t\t\tlabel: \"TUI mode\",\n\t\t\t\tdescription: \"Interface layout; fullscreen mode is experimental\",\n\t\t\t\tcurrentValue: config.tuiMode,\n\t\t\t\tvalues: [\"regular\", \"fullscreen\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-exit-output\",\n\t\t\t\tlabel: \"Fullscreen exit output\",\n\t\t\t\tdescription: \"Print the transcript or only a session resume hint when exiting fullscreen mode\",\n\t\t\t\tcurrentValue: config.fullscreenExitOutput,\n\t\t\t\tvalues: [\"transcript\", \"resume-hint\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-scrollbar\",\n\t\t\t\tlabel: \"Fullscreen scrollbar\",\n\t\t\t\tdescription: \"Scrollbar behavior in fullscreen mode; has no effect in regular mode\",\n\t\t\t\tcurrentValue: config.fullscreenScrollbar,\n\t\t\t\tvalues: [\"auto\", \"always\", \"hidden\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-copy-on-select\",\n\t\t\t\tlabel: \"Fullscreen copy on select\",\n\t\t\t\tdescription: \"Automatically copy selected text in fullscreen mode; disable to copy selections with Ctrl+X\",\n\t\t\t\tcurrentValue: config.fullscreenCopyOnSelect ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"theme\",\n\t\t\t\tlabel: \"Theme\",\n\t\t\t\tdescription: \"Color theme for the interface\",\n\t\t\t\tcurrentValue: config.currentTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tnew ThemeSubmenu(currentValue, config.terminalTheme, config.availableThemes, callbacks, done),\n\t\t\t},\n\t\t];\n\n\t\t// Only show image toggle if terminal supports it\n\t\tif (supportsImages) {\n\t\t\t// Insert after autocompact\n\t\t\titems.splice(1, 0, {\n\t\t\t\tid: \"show-images\",\n\t\t\t\tlabel: \"Show images\",\n\t\t\t\tdescription: \"Render images inline in terminal\",\n\t\t\t\tcurrentValue: config.showImages ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t});\n\t\t\titems.splice(2, 0, {\n\t\t\t\tid: \"image-width-cells\",\n\t\t\t\tlabel: \"Image width\",\n\t\t\t\tdescription: \"Preferred inline image width in terminal cells\",\n\t\t\t\tcurrentValue: String(config.imageWidthCells),\n\t\t\t\tvalues: [\"60\", \"80\", \"120\"],\n\t\t\t});\n\t\t}\n\n\t\t// Image auto-resize toggle (always available, affects both attached and read images)\n\t\titems.splice(supportsImages ? 3 : 1, 0, {\n\t\t\tid: \"auto-resize-images\",\n\t\t\tlabel: \"Auto-resize images\",\n\t\t\tdescription: \"Resize large images to 2000x2000 max for better model compatibility\",\n\t\t\tcurrentValue: config.autoResizeImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Block images toggle (always available, insert after auto-resize-images)\n\t\tconst autoResizeIndex = items.findIndex((item) => item.id === \"auto-resize-images\");\n\t\titems.splice(autoResizeIndex + 1, 0, {\n\t\t\tid: \"block-images\",\n\t\t\tlabel: \"Block images\",\n\t\t\tdescription: \"Prevent images from being sent to LLM providers\",\n\t\t\tcurrentValue: config.blockImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Skill commands toggle (insert after block-images)\n\t\tconst blockImagesIndex = items.findIndex((item) => item.id === \"block-images\");\n\t\titems.splice(blockImagesIndex + 1, 0, {\n\t\t\tid: \"skill-commands\",\n\t\t\tlabel: \"Skill commands\",\n\t\t\tdescription: \"Register skills as /skill:name commands\",\n\t\t\tcurrentValue: config.enableSkillCommands ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Hardware cursor toggle (insert after skill-commands)\n\t\tconst skillCommandsIndex = items.findIndex((item) => item.id === \"skill-commands\");\n\t\titems.splice(skillCommandsIndex + 1, 0, {\n\t\t\tid: \"show-hardware-cursor\",\n\t\t\tlabel: \"Show hardware cursor\",\n\t\t\tdescription: \"Show the terminal cursor while still positioning it for IME support\",\n\t\t\tcurrentValue: config.showHardwareCursor ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Editor padding toggle (insert after show-hardware-cursor)\n\t\tconst hardwareCursorIndex = items.findIndex((item) => item.id === \"show-hardware-cursor\");\n\t\titems.splice(hardwareCursorIndex + 1, 0, {\n\t\t\tid: \"editor-padding\",\n\t\t\tlabel: \"Editor padding\",\n\t\t\tdescription: \"Horizontal padding for input editor (0-3)\",\n\t\t\tcurrentValue: String(config.editorPaddingX),\n\t\t\tvalues: [\"0\", \"1\", \"2\", \"3\"],\n\t\t});\n\n\t\t// Output padding toggle (insert after editor-padding)\n\t\tconst editorPaddingIndex = items.findIndex((item) => item.id === \"editor-padding\");\n\t\titems.splice(editorPaddingIndex + 1, 0, {\n\t\t\tid: \"output-padding\",\n\t\t\tlabel: \"Output padding\",\n\t\t\tdescription: \"Horizontal padding for user messages, assistant messages, and thinking\",\n\t\t\tcurrentValue: String(config.outputPad),\n\t\t\tvalues: [\"0\", \"1\"],\n\t\t});\n\n\t\t// Autocomplete max visible toggle (insert after output-padding)\n\t\tconst outputPaddingIndex = items.findIndex((item) => item.id === \"output-padding\");\n\t\titems.splice(outputPaddingIndex + 1, 0, {\n\t\t\tid: \"autocomplete-max-visible\",\n\t\t\tlabel: \"Autocomplete max items\",\n\t\t\tdescription: \"Max visible items in autocomplete dropdown (3-20)\",\n\t\t\tcurrentValue: String(config.autocompleteMaxVisible),\n\t\t\tvalues: [\"3\", \"5\", \"7\", \"10\", \"15\", \"20\"],\n\t\t});\n\n\t\t// Clear on shrink toggle (insert after autocomplete-max-visible)\n\t\tconst autocompleteIndex = items.findIndex((item) => item.id === \"autocomplete-max-visible\");\n\t\titems.splice(autocompleteIndex + 1, 0, {\n\t\t\tid: \"clear-on-shrink\",\n\t\t\tlabel: \"Clear on shrink\",\n\t\t\tdescription: \"Clear empty rows when content shrinks (may cause flicker)\",\n\t\t\tcurrentValue: config.clearOnShrink ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Terminal progress toggle (insert after clear-on-shrink)\n\t\tconst clearOnShrinkIndex = items.findIndex((item) => item.id === \"clear-on-shrink\");\n\t\titems.splice(clearOnShrinkIndex + 1, 0, {\n\t\t\tid: \"terminal-progress\",\n\t\t\tlabel: \"Terminal progress\",\n\t\t\tdescription: \"Show OSC 9;4 progress indicators in the terminal tab bar\",\n\t\t\tcurrentValue: config.showTerminalProgress ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Add borders\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Settings\")), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\t10,\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"autocompact\":\n\t\t\t\t\t\tcallbacks.onAutoCompactChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-images\":\n\t\t\t\t\t\tcallbacks.onShowImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image-width-cells\":\n\t\t\t\t\t\tcallbacks.onImageWidthCellsChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"auto-resize-images\":\n\t\t\t\t\t\tcallbacks.onAutoResizeImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"block-images\":\n\t\t\t\t\t\tcallbacks.onBlockImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"skill-commands\":\n\t\t\t\t\t\tcallbacks.onEnableSkillCommandsChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"steering-mode\":\n\t\t\t\t\t\tcallbacks.onSteeringModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"follow-up-mode\":\n\t\t\t\t\t\tcallbacks.onFollowUpModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"transport\":\n\t\t\t\t\t\tcallbacks.onTransportChange(newValue as Transport);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"http-idle-timeout\": {\n\t\t\t\t\t\tconst choice = HTTP_IDLE_TIMEOUT_CHOICES.find((item) => item.label === newValue);\n\t\t\t\t\t\tif (choice) {\n\t\t\t\t\t\t\tcallbacks.onHttpIdleTimeoutMsChange(choice.timeoutMs);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"cache-warming-mode\":\n\t\t\t\t\t\tcallbacks.onCacheWarmingModeChange(newValue as CacheWarmingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"hide-thinking\":\n\t\t\t\t\t\tcallbacks.onHideThinkingBlockChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"chat-detail\":\n\t\t\t\t\t\tcallbacks.onChatDetailChange(newValue as ChatDetail);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"mermaid-rendering\":\n\t\t\t\t\t\tcallbacks.onMermaidRenderingModeChange(newValue as MermaidRenderingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"cache-miss-notices\":\n\t\t\t\t\t\tcallbacks.onShowCacheMissNoticesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"collapse-changelog\":\n\t\t\t\t\t\tcallbacks.onCollapseChangelogChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"quiet-startup\":\n\t\t\t\t\t\tcallbacks.onQuietStartupChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"send-provider-attribution\":\n\t\t\t\t\t\tcallbacks.onSendProviderAttributionChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"default-project-trust\": {\n\t\t\t\t\t\tconst defaultProjectTrust = DEFAULT_PROJECT_TRUST_BY_LABEL.get(newValue);\n\t\t\t\t\t\tif (defaultProjectTrust) {\n\t\t\t\t\t\t\tcallbacks.onDefaultProjectTrustChange(defaultProjectTrust);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"double-escape-action\":\n\t\t\t\t\t\tcallbacks.onDoubleEscapeActionChange(newValue as \"fork\" | \"tree\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tree-filter-mode\":\n\t\t\t\t\t\tcallbacks.onTreeFilterModeChange(\n\t\t\t\t\t\t\tnewValue as \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-hardware-cursor\":\n\t\t\t\t\t\tcallbacks.onShowHardwareCursorChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"editor-padding\":\n\t\t\t\t\t\tcallbacks.onEditorPaddingXChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"output-padding\":\n\t\t\t\t\t\tcallbacks.onOutputPadChange(newValue === \"0\" ? 0 : 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"autocomplete-max-visible\":\n\t\t\t\t\t\tcallbacks.onAutocompleteMaxVisibleChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"clear-on-shrink\":\n\t\t\t\t\t\tcallbacks.onClearOnShrinkChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"terminal-progress\":\n\t\t\t\t\t\tcallbacks.onShowTerminalProgressChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tui-mode\":\n\t\t\t\t\t\tcallbacks.onTuiModeChange(newValue as TuiMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-exit-output\":\n\t\t\t\t\t\tcallbacks.onFullscreenExitOutputChange(newValue as FullscreenExitOutput);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-scrollbar\":\n\t\t\t\t\t\tcallbacks.onFullscreenScrollbarChange(newValue as ScrollViewScrollbar);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-copy-on-select\":\n\t\t\t\t\t\tcallbacks.onFullscreenCopyOnSelectChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"theme\":\n\t\t\t\t\t\tcallbacks.onThemeChange(newValue);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcallbacks.onCancel,\n\t\t\t{ enableSearch: true },\n\t\t);\n\n\t\t// `pi-tui` builds this list's search box itself, so its prompt is swapped on the way out.\n\t\tconst settingsList = this.settingsList;\n\t\tthis.addChild({\n\t\t\trender: (width: number) => {\n\t\t\t\tconst lines = settingsList.render(width);\n\t\t\t\treturn lines.length > 0 ? [withComposerPrompt(lines[0]!), ...lines.slice(1)] : lines;\n\t\t\t},\n\t\t\tinvalidate: () => settingsList.invalidate(),\n\t\t});\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSettingsList(): SettingsList {\n\t\treturn this.settingsList;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"settings-selector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/settings-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAEN,SAAS,EAET,KAAK,mBAAmB,EAGxB,YAAY,EAIZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAEN,KAAK,gBAAgB,EAErB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAA+C,KAAK,aAAa,EAAS,MAAM,mBAAmB,CAAC;AA6D3G;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAOxF,CAAC;AAwBF,MAAM,WAAW,cAAc;IAC9B,YAAY,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,iBAAiB,EAAE,OAAO,CAA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AC;IACjD,2BAA2B,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAChF,sBAAsB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACvD,qBAAqB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,4BAA4B,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,eAAe,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,4BAA4B,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACrE,2BAA2B,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjE,8BAA8B,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,gBAAgB,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IACtD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAyZD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACvD,OAAO,CAAC,YAAY,CAAe;IAEnC,YAAY,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EA6hB/D;IAED,eAAe,IAAI,YAAY,CAE9B;CACD","sourcesContent":["import { getSupportedThinkingLevels, type Model, type Transport } from \"@earendil-works/pi-ai\";\nimport {\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\ttype ScrollViewScrollbar,\n\ttype SelectItem,\n\ttype SettingItem,\n\tSettingsList,\n\ttype SettingsListTheme,\n\tSpacer,\n\tText,\n} from \"@earendil-works/pi-tui\";\nimport type { ThinkingLevel } from \"apex-code-agent-core\";\nimport { formatHttpIdleTimeoutMs, HTTP_IDLE_TIMEOUT_CHOICES } from \"../../../core/http-dispatcher.ts\";\nimport type { PermissionModeOrigin } from \"../../../core/permissions/startup.ts\";\nimport { PERMISSION_MODES, type PermissionMode } from \"../../../core/permissions/store.ts\";\nimport {\n\tCACHE_WARMING_MODES,\n\ttype CacheWarmingMode,\n\tCHAT_DETAILS,\n\ttype ChatDetail,\n\ttype DefaultProjectTrust,\n\ttype FullscreenExitOutput,\n\ttype MermaidRenderingMode,\n\ttype TuiMode,\n\ttype WarningSettings,\n} from \"../../../core/settings-manager.ts\";\nimport { getSettingsListTheme, parseAutoThemeSetting, type TerminalTheme, theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { hintRow, keyDisplayText } from \"./keybinding-hints.ts\";\nimport { withComposerPrompt } from \"./prompt-input.ts\";\nimport { SelectSubmenu, SteppedSubmenu, type SteppedSubmenuStep } from \"./settings-submenu.ts\";\n\n/** The two hint rows `pi-tui`'s settings list writes, with and without search. */\nconst SETTINGS_LIST_HINT_ROWS = new Set([\n\t\"Type to search · Enter/Space to change · Esc to cancel\",\n\t\"Enter/Space to change · Esc to cancel\",\n]);\n\n/**\n * The settings list is `pi-tui`'s and writes its own hint row, but the theme it paints with is\n * ours, so the row is swapped here for the shared grammar. The search box's prompt already\n * says typing searches.\n */\nfunction getSettingsSelectorListTheme(): SettingsListTheme {\n\tconst base = getSettingsListTheme();\n\treturn {\n\t\t...base,\n\t\thint: (text: string) =>\n\t\t\tSETTINGS_LIST_HINT_ROWS.has(text.trim())\n\t\t\t\t? hintRow([\n\t\t\t\t\t\t[[\"tui.select.confirm\", { literal: \"space\" }], \"change\"],\n\t\t\t\t\t\t[\"tui.select.cancel\", \"close\"],\n\t\t\t\t\t])\n\t\t\t\t: base.hint(text),\n\t};\n}\n\nconst MODEL_PICKER_LAYOUT = { minPrimaryColumnWidth: 12, maxPrimaryColumnWidth: 46 };\n\nconst THINKING_DESCRIPTIONS: Record<ThinkingLevel, string> = {\n\toff: \"No reasoning\",\n\tminimal: \"Very brief reasoning (~1k tokens)\",\n\tlow: \"Light reasoning (~2k tokens)\",\n\tmedium: \"Moderate reasoning (~8k tokens)\",\n\thigh: \"Deep reasoning (~16k tokens)\",\n\txhigh: \"Extra-high reasoning (~32k tokens)\",\n\tmax: \"Maximum reasoning\",\n};\n\nconst DEFAULT_PROJECT_TRUST_LABELS: Record<DefaultProjectTrust, string> = {\n\task: \"Ask\",\n\talways: \"Always trust\",\n\tnever: \"Never trust\",\n};\n\nconst DEFAULT_PROJECT_TRUST_BY_LABEL = new Map(\n\tObject.entries(DEFAULT_PROJECT_TRUST_LABELS).map(([value, label]) => [label, value as DefaultProjectTrust]),\n);\n\nconst PERMISSION_MODE_DESCRIPTIONS: Record<PermissionMode, string> = {\n\tdefault: \"Ask for anything policy does not already allow\",\n\tplan: \"Block file writes, commands, and delegation while you investigate\",\n\tacceptEdits: \"Auto-allow file edits inside the workspace; still ask for anything outside it, commands and network\",\n\tdontAsk: \"Never prompt; deny anything not already permitted\",\n\tbypassPermissions: \"Allow every tool call without asking\",\n};\n\n/**\n * What outranks a user-scope write, phrased for someone deciding whether to bother.\n * `user` and `default` are absent because neither shadows anything this menu writes.\n */\nexport const PERMISSION_MODE_OVERRIDE_HINTS: Partial<Record<PermissionModeOrigin, string>> = {\n\tinteractive: \"the interactive permission mode\",\n\tflag: \"--permission-mode on the command line\",\n\tlocal: \".apex-code/permissions.local.json in this project\",\n\tproject: \".apex-code/permissions.json in this project\",\n\tcommand: \"a command-scoped override in this session\",\n\tsession: \"a session-scoped override\",\n};\n\n/** Empty when the session has no permission gate, so the row simply does not exist. */\nfunction permissionModeItems(current: SettingsConfig[\"permissionMode\"], callbacks: SettingsCallbacks): SettingItem[] {\n\tif (!current) return [];\n\treturn [\n\t\t{\n\t\t\tid: \"permission-mode\",\n\t\t\tlabel: \"Permission mode\",\n\t\t\tdescription:\n\t\t\t\tPERMISSION_MODE_DESCRIPTIONS[current.mode] +\n\t\t\t\t(current.origin === \"interactive\" ? \" The saved default is shadowed for this session.\" : \"\"),\n\t\t\tcurrentValue: current.mode,\n\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\tnew PermissionModeSubmenu(\n\t\t\t\t\tcurrentValue as PermissionMode,\n\t\t\t\t\tcurrent.origin,\n\t\t\t\t\t(mode) => callbacks.onPermissionModeChange(mode),\n\t\t\t\t\tdone,\n\t\t\t\t),\n\t\t},\n\t];\n}\n\nexport interface SettingsConfig {\n\ttaskListTool?: { enabled: boolean; projectControlled: boolean };\n\tautoCompact: boolean;\n\tdefaultModel: string;\n\tcurrentModel?: Model<any>;\n\tavailableDefaultModels: readonly Model<any>[];\n\tshowImages: boolean;\n\timageWidthCells: number;\n\tautoResizeImages: boolean;\n\tblockImages: boolean;\n\tenableSkillCommands: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\ttransport: Transport;\n\thttpIdleTimeoutMs: number;\n\tcacheWarmingMode: CacheWarmingMode;\n\tthinkingLevel: ThinkingLevel;\n\tavailableThinkingLevels: ThinkingLevel[];\n\tmodelThinkingLevels: Record<string, ThinkingLevel>;\n\tcurrentTheme: string;\n\tterminalTheme: TerminalTheme;\n\tavailableThemes: string[];\n\thideThinkingBlock: boolean;\n\tchatDetail: ChatDetail;\n\tmermaidRenderingMode: MermaidRenderingMode;\n\tshowCacheMissNotices: boolean;\n\tcollapseChangelog: boolean;\n\tsendProviderAttribution: boolean;\n\tdoubleEscapeAction: \"fork\" | \"tree\" | \"none\";\n\ttreeFilterMode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\";\n\tshowHardwareCursor: boolean;\n\teditorPaddingX: number;\n\toutputPad: 0 | 1;\n\tautocompleteMaxVisible: number;\n\tquietStartup: boolean;\n\tdefaultProjectTrust: DefaultProjectTrust;\n\t/** Absent when the session runs without a permission gate; the row is then hidden. */\n\tpermissionMode?: { mode: PermissionMode; origin: PermissionModeOrigin };\n\tclearOnShrink: boolean;\n\tshowTerminalProgress: boolean;\n\ttuiMode: TuiMode;\n\tfullscreenExitOutput: FullscreenExitOutput;\n\tfullscreenScrollbar: ScrollViewScrollbar;\n\tfullscreenCopyOnSelect: boolean;\n\twarnings: WarningSettings;\n}\n\nexport interface SettingsCallbacks {\n\tonTaskListToolChange?: (enabled: boolean) => void;\n\tonAutoCompactChange: (enabled: boolean) => void;\n\tonShowImagesChange: (enabled: boolean) => void;\n\tonImageWidthCellsChange: (width: number) => void;\n\tonAutoResizeImagesChange: (enabled: boolean) => void;\n\tonBlockImagesChange: (blocked: boolean) => void;\n\tonEnableSkillCommandsChange: (enabled: boolean) => void;\n\tonSteeringModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonFollowUpModeChange: (mode: \"all\" | \"one-at-a-time\") => void;\n\tonTransportChange: (transport: Transport) => void;\n\tonHttpIdleTimeoutMsChange: (timeoutMs: number) => void;\n\tonCacheWarmingModeChange: (mode: CacheWarmingMode) => void;\n\tonModelThinkingLevelChange: (provider: string, modelId: string, level: ThinkingLevel) => void;\n\tonModelThinkingLevelRemove: (provider: string, modelId: string) => void;\n\tonThemeChange: (theme: string) => void;\n\tonThemePreview?: (theme: string) => void;\n\tonHideThinkingBlockChange: (hidden: boolean) => void;\n\tonChatDetailChange: (detail: ChatDetail) => void;\n\tonMermaidRenderingModeChange: (mode: MermaidRenderingMode) => void;\n\tonShowCacheMissNoticesChange: (shown: boolean) => void;\n\tonCollapseChangelogChange: (collapsed: boolean) => void;\n\tonSendProviderAttributionChange: (enabled: boolean) => void;\n\tonDoubleEscapeActionChange: (action: \"fork\" | \"tree\" | \"none\") => void;\n\tonTreeFilterModeChange: (mode: \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\") => void;\n\tonShowHardwareCursorChange: (enabled: boolean) => void;\n\tonEditorPaddingXChange: (padding: number) => void;\n\tonOutputPadChange: (padding: 0 | 1) => void;\n\tonAutocompleteMaxVisibleChange: (maxVisible: number) => void;\n\tonQuietStartupChange: (enabled: boolean) => void;\n\tonDefaultProjectTrustChange: (defaultProjectTrust: DefaultProjectTrust) => void;\n\tonPermissionModeChange: (mode: PermissionMode) => void;\n\tonClearOnShrinkChange: (enabled: boolean) => void;\n\tonShowTerminalProgressChange: (enabled: boolean) => void;\n\tonTuiModeChange: (mode: TuiMode) => void;\n\tonFullscreenExitOutputChange: (output: FullscreenExitOutput) => void;\n\tonFullscreenScrollbarChange: (mode: ScrollViewScrollbar) => void;\n\tonFullscreenCopyOnSelectChange: (enabled: boolean) => void;\n\tonWarningsChange: (warnings: WarningSettings) => void;\n\tonCancel: () => void;\n}\n\n/**\n * A submenu component for selecting from a list of options.\n */\nclass WarningSettingsSubmenu extends Container {\n\tprivate settingsList: SettingsList;\n\tprivate state: WarningSettings;\n\n\tconstructor(warnings: WarningSettings, onChange: (warnings: WarningSettings) => void, onCancel: () => void) {\n\t\tsuper();\n\n\t\tthis.state = { ...warnings };\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"anthropic-extra-usage\",\n\t\t\t\tlabel: \"Anthropic extra usage\",\n\t\t\t\tdescription: \"Warn when Anthropic subscription auth may use paid extra usage\",\n\t\t\t\tcurrentValue: (this.state.anthropicExtraUsage ?? true) ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t];\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"anthropic-extra-usage\":\n\t\t\t\t\t\tthis.state = { ...this.state, anthropicExtraUsage: newValue === \"true\" };\n\t\t\t\t\t\tonChange({ ...this.state });\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tonCancel,\n\t\t);\n\n\t\tthis.addChild(this.settingsList);\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.settingsList.handleInput(data);\n\t}\n}\n\nconst CLEAR_OVERRIDE_VALUE = \"__clear__\";\n\nfunction modelSettingKey(model: Model<any>): string {\n\treturn `${model.provider}/${model.id}`;\n}\n\nfunction modelDisplayLabel(model: Model<any>): string {\n\treturn `${model.id} [${model.provider}]`;\n}\n\nfunction modelThinkingOverridesSummary(overrides: Record<string, ThinkingLevel>): string {\n\tconst count = Object.keys(overrides).length;\n\tif (count === 0) return \"none\";\n\treturn `${count} configured`;\n}\n\nfunction modelItemLabel(model: Model<any>): string {\n\treturn `${model.id} ${theme.fg(\"muted\", `[${model.provider}]`)}`;\n}\n\n/**\n * Permission mode picker, mode list then a confirm step for `bypassPermissions`.\n * The confirm exists because the mode list is arrow-cyclable like every other\n * settings row, so \"allow every tool call\" is otherwise one stray keypress away.\n */\nclass PermissionModeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly current: PermissionMode;\n\tprivate readonly origin: PermissionModeOrigin;\n\tprivate readonly onSelect: (mode: PermissionMode) => void;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\n\tconstructor(\n\t\tcurrent: PermissionMode,\n\t\torigin: PermissionModeOrigin,\n\t\tonSelect: (mode: PermissionMode) => void,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.current = current;\n\t\tthis.origin = origin;\n\t\tthis.onSelect = onSelect;\n\t\tthis.onDone = onDone;\n\t\tthis.showModeList();\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(component: Component): void {\n\t\tthis.clear();\n\t\tthis.addChild(component);\n\t\tthis.inputComponent = component;\n\t}\n\n\tprivate description(): string {\n\t\tif (this.origin === \"interactive\") {\n\t\t\treturn \"Saved to user scope for future sessions. The saved default is shadowed by the interactive mode for this session.\";\n\t\t}\n\t\tconst overridden =\n\t\t\tthis.origin !== \"user\" && this.origin !== \"default\"\n\t\t\t\t? ` Currently set by ${PERMISSION_MODE_OVERRIDE_HINTS[this.origin]}.`\n\t\t\t\t: \"\";\n\t\treturn `Saved to user scope and applied to the next tool call.${overridden}`;\n\t}\n\n\tprivate showModeList(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Permission mode\",\n\t\t\t\tthis.description(),\n\t\t\t\tPERMISSION_MODES.map((mode) => ({\n\t\t\t\t\tvalue: mode,\n\t\t\t\t\tlabel: mode,\n\t\t\t\t\tdescription: PERMISSION_MODE_DESCRIPTIONS[mode],\n\t\t\t\t})),\n\t\t\t\tthis.current,\n\t\t\t\t(value) => {\n\t\t\t\t\tconst mode = value as PermissionMode;\n\t\t\t\t\tif (mode === \"bypassPermissions\") {\n\t\t\t\t\t\tthis.showBypassConfirm();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(mode);\n\t\t\t\t\tthis.onDone(mode);\n\t\t\t\t},\n\t\t\t\t() => this.onDone(),\n\t\t\t),\n\t\t);\n\t}\n\n\tprivate showBypassConfirm(): void {\n\t\tthis.setContent(\n\t\t\tnew SelectSubmenu(\n\t\t\t\t\"Bypass all permission checks?\",\n\t\t\t\t\"Every tool call runs without asking, in every project, until you change this back. Nothing else confines the session: it writes anywhere your account can and reaches any host. Run inside a container or VM if the work is untrusted.\",\n\t\t\t\t[\n\t\t\t\t\t{ value: \"no\", label: `No, keep ${this.current}`, description: \"Return to the mode list\" },\n\t\t\t\t\t{ value: \"yes\", label: \"Yes, bypass\", description: \"Allow every tool call without asking\" },\n\t\t\t\t],\n\t\t\t\t\"no\",\n\t\t\t\t(value) => {\n\t\t\t\t\tif (value !== \"yes\") {\n\t\t\t\t\t\tthis.showModeList();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onSelect(\"bypassPermissions\");\n\t\t\t\t\tthis.onDone(\"bypassPermissions\");\n\t\t\t\t},\n\t\t\t\t() => this.showModeList(),\n\t\t\t),\n\t\t);\n\t}\n}\n\nfunction themeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn availableThemes.map((name) => ({\n\t\tvalue: name,\n\t\tlabel: `${name === currentTheme ? \"✓ \" : \" \"}${name}`,\n\t}));\n}\n\nconst AUTOMATIC_THEME_VALUE = \"/\";\n\nfunction singleModeThemeItems(availableThemes: string[], currentTheme: string): SelectItem[] {\n\treturn [\n\t\t{\n\t\t\tvalue: AUTOMATIC_THEME_VALUE,\n\t\t\tlabel: \" Automatic\",\n\t\t\tdescription: \"Use separate themes for light and dark terminal appearance\",\n\t\t},\n\t\t...themeItems(availableThemes, currentTheme),\n\t];\n}\n\nfunction preferredTheme(availableThemes: string[], preferred: string | undefined, fallback: string): string {\n\tif (preferred && availableThemes.includes(preferred)) return preferred;\n\tif (availableThemes.includes(fallback)) return fallback;\n\treturn availableThemes[0] ?? fallback;\n}\n\nfunction defaultAutomaticThemes(\n\tcurrentThemeSetting: string,\n\tavailableThemes: string[],\n): { lightTheme: string; darkTheme: string } {\n\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\tif (autoTheme) return autoTheme;\n\n\tconst currentFixedTheme = currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\tconst themeName = preferredTheme(availableThemes, currentFixedTheme, \"dark\");\n\treturn { lightTheme: themeName, darkTheme: themeName };\n}\n\nclass ThemeSubmenu extends Container {\n\tprivate inputComponent: Component | undefined;\n\tprivate readonly callbacks: SettingsCallbacks;\n\tprivate readonly availableThemes: string[];\n\tprivate readonly terminalTheme: TerminalTheme;\n\tprivate readonly onDone: (selectedValue?: string) => void;\n\tprivate readonly originalThemeSetting: string;\n\tprivate mode: \"single\" | \"automatic\";\n\tprivate singleTheme: string;\n\tprivate lightTheme: string;\n\tprivate darkTheme: string;\n\n\tconstructor(\n\t\tcurrentThemeSetting: string,\n\t\tterminalTheme: TerminalTheme,\n\t\tavailableThemes: string[],\n\t\tcallbacks: SettingsCallbacks,\n\t\tonDone: (selectedValue?: string) => void,\n\t) {\n\t\tsuper();\n\t\tthis.callbacks = callbacks;\n\t\tthis.availableThemes = availableThemes;\n\t\tthis.terminalTheme = terminalTheme;\n\t\tthis.onDone = onDone;\n\t\tthis.originalThemeSetting = currentThemeSetting;\n\t\tconst autoTheme = parseAutoThemeSetting(currentThemeSetting);\n\t\tconst automaticThemes = defaultAutomaticThemes(currentThemeSetting, availableThemes);\n\t\tconst fixedTheme = autoTheme || currentThemeSetting.includes(\"/\") ? undefined : currentThemeSetting;\n\t\tthis.mode = autoTheme ? \"automatic\" : \"single\";\n\t\tthis.lightTheme = automaticThemes.lightTheme;\n\t\tthis.darkTheme = automaticThemes.darkTheme;\n\t\tthis.singleTheme = preferredTheme(\n\t\t\tavailableThemes,\n\t\t\tfixedTheme ?? (autoTheme ? this.getActiveAutomaticTheme() : undefined),\n\t\t\t\"dark\",\n\t\t);\n\n\t\tif (this.mode === \"automatic\") {\n\t\t\tthis.showAutomaticMenu();\n\t\t} else {\n\t\t\tthis.showSingleMenu();\n\t\t}\n\t}\n\n\thandleInput(data: string): void {\n\t\tthis.inputComponent?.handleInput?.(data);\n\t}\n\n\tprivate setContent(renderComponent: Component, inputComponent: Component = renderComponent): void {\n\t\tthis.clear();\n\t\tthis.addChild(renderComponent);\n\t\tthis.inputComponent = inputComponent;\n\t}\n\n\tprivate showSingleMenu(): void {\n\t\tthis.mode = \"single\";\n\t\tconst menu = new SelectSubmenu(\n\t\t\t\"Theme\",\n\t\t\t\"Select a theme, or choose Automatic to follow terminal appearance.\",\n\t\t\tsingleModeThemeItems(this.availableThemes, this.singleTheme),\n\t\t\tthis.singleTheme,\n\t\t\t(value) => {\n\t\t\t\tif (value === AUTOMATIC_THEME_VALUE) {\n\t\t\t\t\tthis.mode = \"automatic\";\n\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\tthis.showAutomaticMenu();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.singleTheme = value;\n\t\t\t\tthis.apply(value);\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t\t(value) => {\n\t\t\t\tthis.callbacks.onThemePreview?.(value === AUTOMATIC_THEME_VALUE ? this.getAutomaticThemeSetting() : value);\n\t\t\t},\n\t\t);\n\t\tthis.setContent(menu);\n\t}\n\n\tprivate showAutomaticMenu(): void {\n\t\tthis.mode = \"automatic\";\n\t\tconst content = new Container();\n\t\tcontent.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Automatic theme\")), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Choose themes for terminal light and dark appearance.\"), 0, 0));\n\t\tcontent.addChild(new Text(theme.fg(\"muted\", \"Light/dark detection requires terminal support.\"), 0, 0));\n\t\tcontent.addChild(new Spacer(1));\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"light-theme\",\n\t\t\t\tlabel: \"Light theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is light\",\n\t\t\t\tcurrentValue: this.lightTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Light Theme\",\n\t\t\t\t\t\t\"Select the theme to use for light terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.lightTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"dark-theme\",\n\t\t\t\tlabel: \"Dark theme\",\n\t\t\t\tdescription: \"Theme to use in automatic mode when the terminal is dark\",\n\t\t\t\tcurrentValue: this.darkTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tthis.createThemeSelect(\n\t\t\t\t\t\t\"Dark Theme\",\n\t\t\t\t\t\t\"Select the theme to use for dark terminal appearance\",\n\t\t\t\t\t\tcurrentValue,\n\t\t\t\t\t\tdone,\n\t\t\t\t\t\t(value) => {\n\t\t\t\t\t\t\tthis.darkTheme = value;\n\t\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\t\t\t\tdone(value);\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"apply\",\n\t\t\t\tlabel: \"Apply\",\n\t\t\t\tdescription: \"Save and go back\",\n\t\t\t\tcurrentValue: \"save and go back\",\n\t\t\t\tvalues: [\"save and go back\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"single-mode\",\n\t\t\t\tlabel: \"Change mode\",\n\t\t\t\tdescription: \"Switch to one theme for light and dark\",\n\t\t\t\tcurrentValue: \"switch to single theme\",\n\t\t\t\tvalues: [\"switch to single theme\"],\n\t\t\t},\n\t\t];\n\n\t\tconst settingsList = new SettingsList(\n\t\t\titems,\n\t\t\tMath.min(items.length, 10),\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"single-mode\":\n\t\t\t\t\t\tthis.mode = \"single\";\n\t\t\t\t\t\tthis.singleTheme = this.getActiveAutomaticTheme();\n\t\t\t\t\t\tthis.callbacks.onThemePreview?.(this.singleTheme);\n\t\t\t\t\t\tthis.showSingleMenu();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"apply\":\n\t\t\t\t\t\tthis.apply(this.getAutomaticThemeSetting());\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => this.cancel(),\n\t\t);\n\t\tcontent.addChild(settingsList);\n\t\tthis.setContent(content, settingsList);\n\t}\n\n\tprivate createThemeSelect(\n\t\ttitle: string,\n\t\tdescription: string,\n\t\tcurrentValue: string,\n\t\tdone: (selectedValue?: string) => void,\n\t\tonSelect: (value: string) => void,\n\t): SelectSubmenu {\n\t\treturn new SelectSubmenu(\n\t\t\ttitle,\n\t\t\tdescription,\n\t\t\tthemeItems(this.availableThemes, currentValue),\n\t\t\tcurrentValue,\n\t\t\tonSelect,\n\t\t\t() => {\n\t\t\t\tthis.callbacks.onThemePreview?.(this.getThemeSetting());\n\t\t\t\tdone();\n\t\t\t},\n\t\t\t(value) => this.callbacks.onThemePreview?.(value),\n\t\t);\n\t}\n\n\tprivate getThemeSetting(): string {\n\t\treturn this.mode === \"automatic\" ? this.getAutomaticThemeSetting() : this.singleTheme;\n\t}\n\n\tprivate getActiveAutomaticTheme(): string {\n\t\treturn this.terminalTheme === \"light\" ? this.lightTheme : this.darkTheme;\n\t}\n\n\tprivate getAutomaticThemeSetting(): string {\n\t\treturn `${this.lightTheme}/${this.darkTheme}`;\n\t}\n\n\tprivate apply(themeSetting: string): void {\n\t\tthis.onDone(themeSetting);\n\t}\n\n\tprivate cancel(): void {\n\t\tthis.callbacks.onThemePreview?.(this.originalThemeSetting);\n\t\tthis.onDone();\n\t}\n}\n\n/**\n * Main settings selector component.\n */\nexport class SettingsSelectorComponent extends Container {\n\tprivate settingsList: SettingsList;\n\n\tconstructor(config: SettingsConfig, callbacks: SettingsCallbacks) {\n\t\tsuper();\n\n\t\tconst supportsImages = getCapabilities().images;\n\t\tconst followUpKey = keyDisplayText(\"app.message.followUp\");\n\t\tconst cycleThinkingKey = keyDisplayText(\"app.thinking.cycle\");\n\t\tlet currentWarnings = { ...config.warnings };\n\t\tconst currentModelThinkingLevels = { ...config.modelThinkingLevels };\n\t\tconst defaultModelByValue = new Map(\n\t\t\tconfig.availableDefaultModels.map((model) => [modelSettingKey(model), model]),\n\t\t);\n\t\tconst currentDefaultModelKey = defaultModelByValue.has(config.defaultModel) ? config.defaultModel : undefined;\n\t\tconst currentModelKey = config.currentModel ? modelSettingKey(config.currentModel) : undefined;\n\n\t\tconst items: SettingItem[] = [\n\t\t\t{\n\t\t\t\tid: \"autocompact\",\n\t\t\t\tlabel: \"Auto-compact\",\n\t\t\t\tdescription: \"Automatically compact context when it gets too large\",\n\t\t\t\tcurrentValue: config.autoCompact ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"steering-mode\",\n\t\t\t\tlabel: \"Steering mode\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.\",\n\t\t\t\tcurrentValue: config.steeringMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"follow-up-mode\",\n\t\t\t\tlabel: \"Follow-up mode\",\n\t\t\t\tdescription: `${followUpKey} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,\n\t\t\t\tcurrentValue: config.followUpMode,\n\t\t\t\tvalues: [\"one-at-a-time\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"transport\",\n\t\t\t\tlabel: \"Transport\",\n\t\t\t\tdescription: \"Preferred transport for providers that support multiple transports\",\n\t\t\t\tcurrentValue: config.transport,\n\t\t\t\tvalues: [\"sse\", \"websocket\", \"websocket-cached\", \"auto\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"http-idle-timeout\",\n\t\t\t\tlabel: \"HTTP idle timeout\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.\",\n\t\t\t\tcurrentValue: formatHttpIdleTimeoutMs(config.httpIdleTimeoutMs),\n\t\t\t\tvalues: HTTP_IDLE_TIMEOUT_CHOICES.map((choice) => choice.label),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-warming-mode\",\n\t\t\t\tlabel: \"Cache warming\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"off; streaming while the agent runs; idle also between runs while continuation stays profitable\",\n\t\t\t\tcurrentValue: config.cacheWarmingMode,\n\t\t\t\tvalues: [...CACHE_WARMING_MODES],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"hide-thinking\",\n\t\t\t\tlabel: \"Hide thinking\",\n\t\t\t\tdescription: \"Hide thinking blocks in assistant responses\",\n\t\t\t\tcurrentValue: config.hideThinkingBlock ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"chat-detail\",\n\t\t\t\tlabel: \"Conversation detail\",\n\t\t\t\tdescription:\n\t\t\t\t\t\"Overview collapses everything; details shows diffs and follows the Hide thinking preference; all shows full tool output and thinking\",\n\t\t\t\tcurrentValue: config.chatDetail,\n\t\t\t\tvalues: [...CHAT_DETAILS],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"mermaid-rendering\",\n\t\t\t\tlabel: \"Mermaid diagrams\",\n\t\t\t\tdescription: \"Render Mermaid code blocks as Unicode diagrams\",\n\t\t\t\tcurrentValue: config.mermaidRenderingMode,\n\t\t\t\tvalues: [\"off\", \"final\", \"streaming\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"cache-miss-notices\",\n\t\t\t\tlabel: \"Cache miss notices\",\n\t\t\t\tdescription: \"Show transcript notices for cache costs and provider recovery diagnostics\",\n\t\t\t\tcurrentValue: config.showCacheMissNotices ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"collapse-changelog\",\n\t\t\t\tlabel: \"Collapse changelog\",\n\t\t\t\tdescription: \"Show condensed changelog after updates\",\n\t\t\t\tcurrentValue: config.collapseChangelog ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"quiet-startup\",\n\t\t\t\tlabel: \"Quiet startup\",\n\t\t\t\tdescription: \"Disable verbose printing at startup\",\n\t\t\t\tcurrentValue: config.quietStartup ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"send-provider-attribution\",\n\t\t\t\tlabel: \"Provider attribution headers\",\n\t\t\t\tdescription: \"Identify this CLI to your configured LLM provider (e.g. OpenRouter billing origin)\",\n\t\t\t\tcurrentValue: config.sendProviderAttribution ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"default-project-trust\",\n\t\t\t\tlabel: \"Default project trust\",\n\t\t\t\tdescription: \"Fallback behavior when no extension or saved trust decision decides project trust\",\n\t\t\t\tcurrentValue: DEFAULT_PROJECT_TRUST_LABELS[config.defaultProjectTrust],\n\t\t\t\tvalues: Object.values(DEFAULT_PROJECT_TRUST_LABELS),\n\t\t\t},\n\t\t\t...permissionModeItems(config.permissionMode, callbacks),\n\t\t\t{\n\t\t\t\tid: \"double-escape-action\",\n\t\t\t\tlabel: \"Double-escape action\",\n\t\t\t\tdescription: \"Action when pressing Escape twice with empty editor\",\n\t\t\t\tcurrentValue: config.doubleEscapeAction,\n\t\t\t\tvalues: [\"tree\", \"fork\", \"none\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tree-filter-mode\",\n\t\t\t\tlabel: \"Tree filter mode\",\n\t\t\t\tdescription: \"Default filter when opening /tree\",\n\t\t\t\tcurrentValue: config.treeFilterMode,\n\t\t\t\tvalues: [\"default\", \"no-tools\", \"user-only\", \"labeled-only\", \"all\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"warnings\",\n\t\t\t\tlabel: \"Warnings\",\n\t\t\t\tdescription: \"Enable or disable individual warnings\",\n\t\t\t\tcurrentValue: \"configure\",\n\t\t\t\tsubmenu: (_currentValue, done) =>\n\t\t\t\t\tnew WarningSettingsSubmenu(\n\t\t\t\t\t\tcurrentWarnings,\n\t\t\t\t\t\t(warnings) => {\n\t\t\t\t\t\t\tcurrentWarnings = warnings;\n\t\t\t\t\t\t\tcallbacks.onWarningsChange(warnings);\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => done(),\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"model-thinking\",\n\t\t\t\tlabel: \"Default thinking level per model\",\n\t\t\t\tdescription: `Override the default thinking level for specific models. ${cycleThinkingKey} cycles in-session.`,\n\t\t\t\tcurrentValue: modelThinkingOverridesSummary(currentModelThinkingLevels),\n\t\t\t\tsubmenu: (_currentValue, done) => {\n\t\t\t\t\tconst steps: SteppedSubmenuStep[] = [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"model\",\n\t\t\t\t\t\t\ttitle: \"Per-Model Thinking Level\",\n\t\t\t\t\t\t\tdescription: \"Select a model to configure\",\n\t\t\t\t\t\t\toptions: () => {\n\t\t\t\t\t\t\t\tconst sorted = [...config.availableDefaultModels].sort((a, b) => {\n\t\t\t\t\t\t\t\t\tconst aKey = modelSettingKey(a);\n\t\t\t\t\t\t\t\t\tconst bKey = modelSettingKey(b);\n\t\t\t\t\t\t\t\t\tif (aKey === currentModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentModelKey) return 1;\n\t\t\t\t\t\t\t\t\tif (aKey === currentDefaultModelKey) return -1;\n\t\t\t\t\t\t\t\t\tif (bKey === currentDefaultModelKey) return 1;\n\t\t\t\t\t\t\t\t\treturn a.provider.localeCompare(b.provider);\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = sorted.map((model) => {\n\t\t\t\t\t\t\t\t\tconst key = modelSettingKey(model);\n\t\t\t\t\t\t\t\t\tconst override = currentModelThinkingLevels[key];\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tvalue: key,\n\t\t\t\t\t\t\t\t\t\tlabel: modelItemLabel(model),\n\t\t\t\t\t\t\t\t\t\tdescription: override ?? undefined,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (items.length === 0) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: \"__none__\",\n\t\t\t\t\t\t\t\t\t\tlabel: \"No models available\",\n\t\t\t\t\t\t\t\t\t\tdescription: \"Log in to a provider or configure an API key first\",\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: () => currentModelKey ?? currentDefaultModelKey,\n\t\t\t\t\t\t\tsearchable: true,\n\t\t\t\t\t\t\tlayout: MODEL_PICKER_LAYOUT,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"level\",\n\t\t\t\t\t\t\ttitle: (ctx) => {\n\t\t\t\t\t\t\t\tconst m = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\treturn `Thinking Level for ${m ? modelDisplayLabel(m) : ctx.model}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdescription: \"Select default thinking level for this model\",\n\t\t\t\t\t\t\toptions: (ctx) => {\n\t\t\t\t\t\t\t\tconst model = defaultModelByValue.get(ctx.model);\n\t\t\t\t\t\t\t\tif (!model) return [];\n\t\t\t\t\t\t\t\tconst levels = (\n\t\t\t\t\t\t\t\t\tmodel.reasoning ? getSupportedThinkingLevels(model) : [\"off\"]\n\t\t\t\t\t\t\t\t) as ThinkingLevel[];\n\t\t\t\t\t\t\t\tconst activeLevel = currentModelThinkingLevels[ctx.model];\n\t\t\t\t\t\t\t\tconst items: SelectItem[] = levels.map((level) => ({\n\t\t\t\t\t\t\t\t\tvalue: level,\n\t\t\t\t\t\t\t\t\tlabel: `${level === activeLevel ? \"✓ \" : \" \"}${level}`,\n\t\t\t\t\t\t\t\t\tdescription: THINKING_DESCRIPTIONS[level],\n\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\tif (currentModelThinkingLevels[ctx.model] !== undefined) {\n\t\t\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\t\t\tvalue: CLEAR_OVERRIDE_VALUE,\n\t\t\t\t\t\t\t\t\t\tlabel: \" (clear override)\",\n\t\t\t\t\t\t\t\t\t\tdescription: `Revert to global default (${config.thinkingLevel})`,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn items;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreselect: (ctx) => currentModelThinkingLevels[ctx.model],\n\t\t\t\t\t\t},\n\t\t\t\t\t];\n\n\t\t\t\t\tconst summary = () => modelThinkingOverridesSummary(currentModelThinkingLevels);\n\n\t\t\t\t\treturn new SteppedSubmenu(\n\t\t\t\t\t\tsteps,\n\t\t\t\t\t\t(selections) => {\n\t\t\t\t\t\t\tconst model = defaultModelByValue.get(selections.model);\n\t\t\t\t\t\t\tif (!model) return;\n\t\t\t\t\t\t\tif (selections.level === CLEAR_OVERRIDE_VALUE) {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelRemove(model.provider, model.id);\n\t\t\t\t\t\t\t\tdelete currentModelThinkingLevels[selections.model];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcallbacks.onModelThinkingLevelChange(\n\t\t\t\t\t\t\t\t\tmodel.provider,\n\t\t\t\t\t\t\t\t\tmodel.id,\n\t\t\t\t\t\t\t\t\tselections.level as ThinkingLevel,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcurrentModelThinkingLevels[selections.model] = selections.level as ThinkingLevel;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tdone(summary());\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ loop: true },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"tui-mode\",\n\t\t\t\tlabel: \"TUI mode\",\n\t\t\t\tdescription: \"Interface layout; fullscreen mode is experimental\",\n\t\t\t\tcurrentValue: config.tuiMode,\n\t\t\t\tvalues: [\"regular\", \"fullscreen\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-exit-output\",\n\t\t\t\tlabel: \"Fullscreen exit output\",\n\t\t\t\tdescription: \"Print the transcript or only a session resume hint when exiting fullscreen mode\",\n\t\t\t\tcurrentValue: config.fullscreenExitOutput,\n\t\t\t\tvalues: [\"transcript\", \"resume-hint\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-scrollbar\",\n\t\t\t\tlabel: \"Fullscreen scrollbar\",\n\t\t\t\tdescription: \"Scrollbar behavior in fullscreen mode; has no effect in regular mode\",\n\t\t\t\tcurrentValue: config.fullscreenScrollbar,\n\t\t\t\tvalues: [\"auto\", \"always\", \"hidden\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"fullscreen-copy-on-select\",\n\t\t\t\tlabel: \"Fullscreen copy on select\",\n\t\t\t\tdescription: \"Automatically copy selected text in fullscreen mode; disable to copy selections with Ctrl+X\",\n\t\t\t\tcurrentValue: config.fullscreenCopyOnSelect ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"theme\",\n\t\t\t\tlabel: \"Theme\",\n\t\t\t\tdescription: \"Color theme for the interface\",\n\t\t\t\tcurrentValue: config.currentTheme,\n\t\t\t\tsubmenu: (currentValue, done) =>\n\t\t\t\t\tnew ThemeSubmenu(currentValue, config.terminalTheme, config.availableThemes, callbacks, done),\n\t\t\t},\n\t\t];\n\n\t\t// Only show image toggle if terminal supports it\n\t\tif (supportsImages) {\n\t\t\t// Insert after autocompact\n\t\t\titems.splice(1, 0, {\n\t\t\t\tid: \"show-images\",\n\t\t\t\tlabel: \"Show images\",\n\t\t\t\tdescription: \"Render images inline in terminal\",\n\t\t\t\tcurrentValue: config.showImages ? \"true\" : \"false\",\n\t\t\t\tvalues: [\"true\", \"false\"],\n\t\t\t});\n\t\t\titems.splice(2, 0, {\n\t\t\t\tid: \"image-width-cells\",\n\t\t\t\tlabel: \"Image width\",\n\t\t\t\tdescription: \"Preferred inline image width in terminal cells\",\n\t\t\t\tcurrentValue: String(config.imageWidthCells),\n\t\t\t\tvalues: [\"60\", \"80\", \"120\"],\n\t\t\t});\n\t\t}\n\n\t\t// Image auto-resize toggle (always available, affects both attached and read images)\n\t\titems.splice(supportsImages ? 3 : 1, 0, {\n\t\t\tid: \"auto-resize-images\",\n\t\t\tlabel: \"Auto-resize images\",\n\t\t\tdescription: \"Resize large images to 2000x2000 max for better model compatibility\",\n\t\t\tcurrentValue: config.autoResizeImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Block images toggle (always available, insert after auto-resize-images)\n\t\tconst autoResizeIndex = items.findIndex((item) => item.id === \"auto-resize-images\");\n\t\titems.splice(autoResizeIndex + 1, 0, {\n\t\t\tid: \"block-images\",\n\t\t\tlabel: \"Block images\",\n\t\t\tdescription: \"Prevent images from being sent to LLM providers\",\n\t\t\tcurrentValue: config.blockImages ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Skill commands toggle (insert after block-images)\n\t\tconst blockImagesIndex = items.findIndex((item) => item.id === \"block-images\");\n\t\titems.splice(blockImagesIndex + 1, 0, {\n\t\t\tid: \"skill-commands\",\n\t\t\tlabel: \"Skill commands\",\n\t\t\tdescription: \"Register skills as /skill:name commands\",\n\t\t\tcurrentValue: config.enableSkillCommands ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Hardware cursor toggle (insert after skill-commands)\n\t\tconst skillCommandsIndex = items.findIndex((item) => item.id === \"skill-commands\");\n\t\titems.splice(skillCommandsIndex + 1, 0, {\n\t\t\tid: \"show-hardware-cursor\",\n\t\t\tlabel: \"Show hardware cursor\",\n\t\t\tdescription: \"Show the terminal cursor while still positioning it for IME support\",\n\t\t\tcurrentValue: config.showHardwareCursor ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Editor padding toggle (insert after show-hardware-cursor)\n\t\tconst hardwareCursorIndex = items.findIndex((item) => item.id === \"show-hardware-cursor\");\n\t\titems.splice(hardwareCursorIndex + 1, 0, {\n\t\t\tid: \"editor-padding\",\n\t\t\tlabel: \"Editor padding\",\n\t\t\tdescription: \"Horizontal padding for input editor (0-3)\",\n\t\t\tcurrentValue: String(config.editorPaddingX),\n\t\t\tvalues: [\"0\", \"1\", \"2\", \"3\"],\n\t\t});\n\n\t\t// Output padding toggle (insert after editor-padding)\n\t\tconst editorPaddingIndex = items.findIndex((item) => item.id === \"editor-padding\");\n\t\titems.splice(editorPaddingIndex + 1, 0, {\n\t\t\tid: \"output-padding\",\n\t\t\tlabel: \"Output padding\",\n\t\t\tdescription: \"Horizontal padding for user messages, assistant messages, and thinking\",\n\t\t\tcurrentValue: String(config.outputPad),\n\t\t\tvalues: [\"0\", \"1\"],\n\t\t});\n\n\t\t// Autocomplete max visible toggle (insert after output-padding)\n\t\tconst outputPaddingIndex = items.findIndex((item) => item.id === \"output-padding\");\n\t\titems.splice(outputPaddingIndex + 1, 0, {\n\t\t\tid: \"autocomplete-max-visible\",\n\t\t\tlabel: \"Autocomplete max items\",\n\t\t\tdescription: \"Max visible items in autocomplete dropdown (3-20)\",\n\t\t\tcurrentValue: String(config.autocompleteMaxVisible),\n\t\t\tvalues: [\"3\", \"5\", \"7\", \"10\", \"15\", \"20\"],\n\t\t});\n\n\t\t// Clear on shrink toggle (insert after autocomplete-max-visible)\n\t\tconst autocompleteIndex = items.findIndex((item) => item.id === \"autocomplete-max-visible\");\n\t\titems.splice(autocompleteIndex + 1, 0, {\n\t\t\tid: \"clear-on-shrink\",\n\t\t\tlabel: \"Clear on shrink\",\n\t\t\tdescription: \"Clear empty rows when content shrinks (may cause flicker)\",\n\t\t\tcurrentValue: config.clearOnShrink ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\t// Terminal progress toggle (insert after clear-on-shrink)\n\t\tconst clearOnShrinkIndex = items.findIndex((item) => item.id === \"clear-on-shrink\");\n\t\titems.splice(clearOnShrinkIndex + 1, 0, {\n\t\t\tid: \"terminal-progress\",\n\t\t\tlabel: \"Terminal progress\",\n\t\t\tdescription: \"Show OSC 9;4 progress indicators in the terminal tab bar\",\n\t\t\tcurrentValue: config.showTerminalProgress ? \"true\" : \"false\",\n\t\t\tvalues: [\"true\", \"false\"],\n\t\t});\n\n\t\tif (config.taskListTool)\n\t\t\titems.push({\n\t\t\t\tid: \"task-list-tool\",\n\t\t\t\tlabel: \"Task-list tool\",\n\t\t\t\tdescription: config.taskListTool.projectControlled\n\t\t\t\t\t? \"Controlled by project defaultTools. Edit project settings to change this future-session default.\"\n\t\t\t\t\t: \"Enable todo_write by default for new sessions. Current tools and reload keep their selection.\",\n\t\t\t\tcurrentValue: config.taskListTool.enabled ? \"enabled\" : \"disabled\",\n\t\t\t\tvalues: config.taskListTool.projectControlled ? undefined : [\"disabled\", \"enabled\"],\n\t\t\t});\n\n\t\t// Add borders\n\t\tthis.addChild(new DynamicBorder());\n\t\tthis.addChild(new Text(theme.bold(theme.fg(\"accent\", \"Settings\")), 0, 0));\n\t\tthis.addChild(new Spacer(1));\n\n\t\tthis.settingsList = new SettingsList(\n\t\t\titems,\n\t\t\t10,\n\t\t\tgetSettingsSelectorListTheme(),\n\t\t\t(id, newValue) => {\n\t\t\t\tswitch (id) {\n\t\t\t\t\tcase \"task-list-tool\":\n\t\t\t\t\t\tif (!config.taskListTool?.projectControlled) callbacks.onTaskListToolChange?.(newValue === \"enabled\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"autocompact\":\n\t\t\t\t\t\tcallbacks.onAutoCompactChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-images\":\n\t\t\t\t\t\tcallbacks.onShowImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"image-width-cells\":\n\t\t\t\t\t\tcallbacks.onImageWidthCellsChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"auto-resize-images\":\n\t\t\t\t\t\tcallbacks.onAutoResizeImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"block-images\":\n\t\t\t\t\t\tcallbacks.onBlockImagesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"skill-commands\":\n\t\t\t\t\t\tcallbacks.onEnableSkillCommandsChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"steering-mode\":\n\t\t\t\t\t\tcallbacks.onSteeringModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"follow-up-mode\":\n\t\t\t\t\t\tcallbacks.onFollowUpModeChange(newValue as \"all\" | \"one-at-a-time\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"transport\":\n\t\t\t\t\t\tcallbacks.onTransportChange(newValue as Transport);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"http-idle-timeout\": {\n\t\t\t\t\t\tconst choice = HTTP_IDLE_TIMEOUT_CHOICES.find((item) => item.label === newValue);\n\t\t\t\t\t\tif (choice) {\n\t\t\t\t\t\t\tcallbacks.onHttpIdleTimeoutMsChange(choice.timeoutMs);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"cache-warming-mode\":\n\t\t\t\t\t\tcallbacks.onCacheWarmingModeChange(newValue as CacheWarmingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"hide-thinking\":\n\t\t\t\t\t\tcallbacks.onHideThinkingBlockChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"chat-detail\":\n\t\t\t\t\t\tcallbacks.onChatDetailChange(newValue as ChatDetail);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"mermaid-rendering\":\n\t\t\t\t\t\tcallbacks.onMermaidRenderingModeChange(newValue as MermaidRenderingMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"cache-miss-notices\":\n\t\t\t\t\t\tcallbacks.onShowCacheMissNoticesChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"collapse-changelog\":\n\t\t\t\t\t\tcallbacks.onCollapseChangelogChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"quiet-startup\":\n\t\t\t\t\t\tcallbacks.onQuietStartupChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"send-provider-attribution\":\n\t\t\t\t\t\tcallbacks.onSendProviderAttributionChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"default-project-trust\": {\n\t\t\t\t\t\tconst defaultProjectTrust = DEFAULT_PROJECT_TRUST_BY_LABEL.get(newValue);\n\t\t\t\t\t\tif (defaultProjectTrust) {\n\t\t\t\t\t\t\tcallbacks.onDefaultProjectTrustChange(defaultProjectTrust);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"double-escape-action\":\n\t\t\t\t\t\tcallbacks.onDoubleEscapeActionChange(newValue as \"fork\" | \"tree\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tree-filter-mode\":\n\t\t\t\t\t\tcallbacks.onTreeFilterModeChange(\n\t\t\t\t\t\t\tnewValue as \"default\" | \"no-tools\" | \"user-only\" | \"labeled-only\" | \"all\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"show-hardware-cursor\":\n\t\t\t\t\t\tcallbacks.onShowHardwareCursorChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"editor-padding\":\n\t\t\t\t\t\tcallbacks.onEditorPaddingXChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"output-padding\":\n\t\t\t\t\t\tcallbacks.onOutputPadChange(newValue === \"0\" ? 0 : 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"autocomplete-max-visible\":\n\t\t\t\t\t\tcallbacks.onAutocompleteMaxVisibleChange(parseInt(newValue, 10));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"clear-on-shrink\":\n\t\t\t\t\t\tcallbacks.onClearOnShrinkChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"terminal-progress\":\n\t\t\t\t\t\tcallbacks.onShowTerminalProgressChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"tui-mode\":\n\t\t\t\t\t\tcallbacks.onTuiModeChange(newValue as TuiMode);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-exit-output\":\n\t\t\t\t\t\tcallbacks.onFullscreenExitOutputChange(newValue as FullscreenExitOutput);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-scrollbar\":\n\t\t\t\t\t\tcallbacks.onFullscreenScrollbarChange(newValue as ScrollViewScrollbar);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fullscreen-copy-on-select\":\n\t\t\t\t\t\tcallbacks.onFullscreenCopyOnSelectChange(newValue === \"true\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"theme\":\n\t\t\t\t\t\tcallbacks.onThemeChange(newValue);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t},\n\t\t\tcallbacks.onCancel,\n\t\t\t{ enableSearch: true },\n\t\t);\n\n\t\t// `pi-tui` builds this list's search box itself, so its prompt is swapped on the way out.\n\t\tconst settingsList = this.settingsList;\n\t\tthis.addChild({\n\t\t\trender: (width: number) => {\n\t\t\t\tconst lines = settingsList.render(width);\n\t\t\t\treturn lines.length > 0 ? [withComposerPrompt(lines[0]!), ...lines.slice(1)] : lines;\n\t\t\t},\n\t\t\tinvalidate: () => settingsList.invalidate(),\n\t\t});\n\t\tthis.addChild(new DynamicBorder());\n\t}\n\n\tgetSettingsList(): SettingsList {\n\t\treturn this.settingsList;\n\t}\n}\n"]}
|
|
@@ -58,6 +58,7 @@ const PERMISSION_MODE_DESCRIPTIONS = {
|
|
|
58
58
|
* `user` and `default` are absent because neither shadows anything this menu writes.
|
|
59
59
|
*/
|
|
60
60
|
export const PERMISSION_MODE_OVERRIDE_HINTS = {
|
|
61
|
+
interactive: "the interactive permission mode",
|
|
61
62
|
flag: "--permission-mode on the command line",
|
|
62
63
|
local: ".apex-code/permissions.local.json in this project",
|
|
63
64
|
project: ".apex-code/permissions.json in this project",
|
|
@@ -72,7 +73,8 @@ function permissionModeItems(current, callbacks) {
|
|
|
72
73
|
{
|
|
73
74
|
id: "permission-mode",
|
|
74
75
|
label: "Permission mode",
|
|
75
|
-
description: PERMISSION_MODE_DESCRIPTIONS[current.mode]
|
|
76
|
+
description: PERMISSION_MODE_DESCRIPTIONS[current.mode] +
|
|
77
|
+
(current.origin === "interactive" ? " The saved default is shadowed for this session." : ""),
|
|
76
78
|
currentValue: current.mode,
|
|
77
79
|
submenu: (currentValue, done) => new PermissionModeSubmenu(currentValue, current.origin, (mode) => callbacks.onPermissionModeChange(mode), done),
|
|
78
80
|
},
|
|
@@ -154,6 +156,9 @@ class PermissionModeSubmenu extends Container {
|
|
|
154
156
|
this.inputComponent = component;
|
|
155
157
|
}
|
|
156
158
|
description() {
|
|
159
|
+
if (this.origin === "interactive") {
|
|
160
|
+
return "Saved to user scope for future sessions. The saved default is shadowed by the interactive mode for this session.";
|
|
161
|
+
}
|
|
157
162
|
const overridden = this.origin !== "user" && this.origin !== "default"
|
|
158
163
|
? ` Currently set by ${PERMISSION_MODE_OVERRIDE_HINTS[this.origin]}.`
|
|
159
164
|
: "";
|
|
@@ -729,12 +734,26 @@ export class SettingsSelectorComponent extends Container {
|
|
|
729
734
|
currentValue: config.showTerminalProgress ? "true" : "false",
|
|
730
735
|
values: ["true", "false"],
|
|
731
736
|
});
|
|
737
|
+
if (config.taskListTool)
|
|
738
|
+
items.push({
|
|
739
|
+
id: "task-list-tool",
|
|
740
|
+
label: "Task-list tool",
|
|
741
|
+
description: config.taskListTool.projectControlled
|
|
742
|
+
? "Controlled by project defaultTools. Edit project settings to change this future-session default."
|
|
743
|
+
: "Enable todo_write by default for new sessions. Current tools and reload keep their selection.",
|
|
744
|
+
currentValue: config.taskListTool.enabled ? "enabled" : "disabled",
|
|
745
|
+
values: config.taskListTool.projectControlled ? undefined : ["disabled", "enabled"],
|
|
746
|
+
});
|
|
732
747
|
// Add borders
|
|
733
748
|
this.addChild(new DynamicBorder());
|
|
734
749
|
this.addChild(new Text(theme.bold(theme.fg("accent", "Settings")), 0, 0));
|
|
735
750
|
this.addChild(new Spacer(1));
|
|
736
751
|
this.settingsList = new SettingsList(items, 10, getSettingsSelectorListTheme(), (id, newValue) => {
|
|
737
752
|
switch (id) {
|
|
753
|
+
case "task-list-tool":
|
|
754
|
+
if (!config.taskListTool?.projectControlled)
|
|
755
|
+
callbacks.onTaskListToolChange?.(newValue === "enabled");
|
|
756
|
+
break;
|
|
738
757
|
case "autocompact":
|
|
739
758
|
callbacks.onAutoCompactChange(newValue === "true");
|
|
740
759
|
break;
|