Merge port/pr-642:AI 生成提交信息(Ctrl+G / 多行提交框 / 可固定生成模型)

无冲突。本分支是「建议提交信息」的唯一实现来源(纯逻辑 src/commit-message.ts +
三条宿主路由 ctx.llm / agentDefaultModel / 设置缝 + CommitModelSettings.tsx +
多行 textarea / Ctrl+G / ✨ 按钮);随后合入的 port/pr-434 只取其 Push/Pull 部分,
434 的重复 suggest 接线/图标/CSS/词典键在那一批里删除。

Co-authored-by: rainmanhhh <13862623+rainmanhhh@users.noreply.github.com>
This commit is contained in:
Menghuan1918andrainmanhhh committed 2026-10-05 02:38:21 +08:00
commit 4c61cc59cd
34 files changed
+2177 -43

No files matched your search

+257
View File
@@ -0,0 +1,257 @@
/**
* The Git card's pinned-model setting: which provider/model drafts commit
* messages. It renders through the descriptor's `settings.render` seam because
* the option list is DISCOVERED at runtime (`git.models` asks the harness what
* it can serve) — a declarative toggle can only declare a static option set.
*
* Shape: a "follow the conversation" SWITCH plus a searchable `provider/model`
* box. Following is the default (an empty stored value), and it disables the
* box: while the panel tracks the conversation there is nothing to pin. The
* box is a filter over the discovered catalog AND accepts a hand-typed
* `provider/model` route, so a model the harness never advertises stays
* selectable.
*
* The value lives in the descriptor's own plugin-settings blob
* (`pluginSettings.git.commitModel`); empty/absent means "follow".
*/
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { Menu } from '@deepseek-ai/dsh-client-ui-primitives'
import { api, type GitModelCatalog } from '../api.ts'
import { t } from '../locales.ts'
import type { SidebarSettingsRenderProps } from '../service.ts'
import { Notice } from '../ui/index.ts'
import css from './changes.module.css'
/** The plugin-owned setting key (mirrored host-side in src/index.ts). */
export const COMMIT_MODEL_SETTING_KEY = 'commitModel'
/** Cap of the filtered candidate list (a huge catalog stays scrollable). */
const OPTION_LIMIT = 40
/**
* One selectable route. The displayed text IS the route (`provider/model`) —
* the same string the search box filters on and the host dispatches on — so a
* catalog entry and the harness default read identically instead of one being
* a decorated "<provider> · <model>" rendering.
*/
interface ModelOption {
/** The stored and displayed `provider/model` route. */
value: string
/** Source badge text ('' for a plain catalog entry). */
note: string
}
/** The stored `provider/model` route of one option ('' = follow). */
function routeValue(provider: string, model: string): string {
return `${provider}/${model}`
}
/** Build the candidate list: harness default and used routes first, then the
* adapter catalog. De-duplicated by route, newest/most-relevant first. */
function optionsOf(catalog: GitModelCatalog | null): ModelOption[] {
if (catalog === null) return []
const options: ModelOption[] = []
const seen = new Set<string>()
const push = (provider: string, model: string, note: string): void => {
const value = routeValue(provider, model)
if (seen.has(value)) return
seen.add(value)
options.push({ value, note })
}
if (catalog.default !== undefined) {
push(catalog.default.provider, catalog.default.model, t('commitModelDefaultNote'))
}
for (const route of catalog.recent) {
push(route.provider, route.model, t('commitModelRecentNote'))
}
for (const provider of catalog.providers) {
for (const model of provider.models) {
push(provider.provider, model.id, '')
}
}
return options
}
export function CommitModelSettings(props: SidebarSettingsRenderProps) {
const { store, pluginSettings, updatePluginSetting } = props
const sessionId = store.getSnapshot().sessionId
const stored = pluginSettings[COMMIT_MODEL_SETTING_KEY]
const value = typeof stored === 'string' ? stored : ''
const [catalog, setCatalog] = useState<GitModelCatalog | null>(null)
const [error, setError] = useState<string | null>(null)
// Following is the DEFAULT (an empty stored value). The switch keeps its own
// draft so it can be turned off before any model is picked — the stored value
// then stays empty and generation still follows the conversation.
const [follow, setFollow] = useState(value === '')
// The search box is a FILTER, never a projection of the stored value: after
// picking a route it clears, so reopening the menu lists every candidate
// instead of filtering down to the one already selected. The selection
// itself is shown on its own line (below).
const [query, setQuery] = useState('')
const [invalid, setInvalid] = useState(false)
const [open, setOpen] = useState(false)
useEffect(() => {
if (sessionId === undefined) return
let cancelled = false
setError(null)
api.gitModels({ sessionId })
.then(view => { if (!cancelled) setCatalog(view) })
.catch((reason: unknown) => {
if (cancelled) return
setError(reason instanceof Error ? reason.message : String(reason))
})
return () => { cancelled = true }
}, [sessionId])
const inputRef = useRef<HTMLInputElement | null>(null)
const options = useMemo(() => optionsOf(catalog), [catalog])
const needle = query.trim().toLowerCase()
const matches = useMemo(
() => (needle === ''
? options.slice(0, OPTION_LIMIT)
: options.filter(option => option.value.toLowerCase().includes(needle)).slice(0, OPTION_LIMIT)),
[options, needle],
)
const listOpen = open && !follow && matches.length > 0
/**
* The primitives Menu lays its portalled list out from the anchor rect but
* sizes it from CSS (`min-width: 218px`, `max-width: 360px`) — it has no
* "match the anchor width" mode, and its `className` only reaches the root
* wrapper. The list is a direct child of <body> (portal), so it is reachable
* here: while open, pin its width to the input's own width so the dropdown
* is never narrower than the box it drops out of.
*/
useLayoutEffect(() => {
if (!listOpen) return
const sync = (): void => {
const input = inputRef.current
if (input === null) return
const width = Math.round(input.getBoundingClientRect().width)
if (width <= 0) return
const children: Element[] = Array.from(document.body.children)
for (let index = children.length - 1; index >= 0; index--) {
const element = children[index]
if (!(element instanceof HTMLElement) || element.getAttribute('role') !== 'menu') continue
// A floor, never a ceiling: the card may grow past the input to fit a
// long route plus its source badge (the Menu's own max-width caps it).
element.style.minWidth = `${width}px`
element.style.removeProperty('max-width')
return
}
}
sync()
window.addEventListener('resize', sync)
return () => { window.removeEventListener('resize', sync) }
}, [listOpen, matches.length])
/** Commit one typed/clicked route (both halves must be non-empty). */
const commitRoute = (raw: string): boolean => {
const trimmed = raw.trim()
const slash = trimmed.indexOf('/')
const provider = slash <= 0 ? '' : trimmed.slice(0, slash).trim()
const model = slash < 0 ? '' : trimmed.slice(slash + 1).trim()
if (provider === '' || model === '') {
setInvalid(true)
return false
}
setInvalid(false)
setQuery('')
updatePluginSetting(COMMIT_MODEL_SETTING_KEY, routeValue(provider, model))
return true
}
const pick = (option: ModelOption): void => {
// Clear the filter (see the `query` note above) and close.
setQuery('')
setInvalid(false)
setOpen(false)
updatePluginSetting(COMMIT_MODEL_SETTING_KEY, option.value)
}
return (
<div className={css.commitModel}>
<div className={css.commitModelRow}>
<span className={css.commitModelTitle}>{t('commitModelTitle')}</span>
<label className={css.commitModelSwitch}>
<input
type="checkbox"
checked={follow}
onChange={(event) => {
const next = event.currentTarget.checked
setFollow(next)
if (next) {
setQuery('')
setInvalid(false)
updatePluginSetting(COMMIT_MODEL_SETTING_KEY, '')
}
}}
/>
<span>{t('commitModelFollow')}</span>
</label>
</div>
<div className={css.commitModelDesc}>{t('commitModelDesc')}</div>
{/* The candidate menu is PORTALLED (the primitives Menu), like every
other dropdown in the side card: this panel renders inside the
settings modal, whose body clips overflow, so an in-flow or absolute
list would be cut off at the dialog edge. The input itself is the
menu's anchor, so typing filters the open menu in place. */}
<div className={css.commitModelBox}>
{!follow && value !== '' && (
<div className={css.commitModelCurrent}>{t('commitModelCurrent', { route: value })}</div>
)}
<Menu
open={open && !follow && matches.length > 0}
className={css.commitModelMenuRoot}
anchor={(
<input
ref={inputRef}
className={css.commitModelInput}
type="text"
value={query}
disabled={follow}
placeholder={t('commitModelSearchPlaceholder')}
aria-label={t('commitModelSearchPlaceholder')}
onChange={(event) => {
setQuery(event.currentTarget.value)
setInvalid(false)
setOpen(true)
}}
onFocus={() => { setOpen(true) }}
onKeyDown={(event) => {
if (event.key === 'Enter') {
if (commitRoute(event.currentTarget.value)) setOpen(false)
}
if (event.key === 'Escape') setOpen(false)
}}
/>
)}
items={matches.map(option => ({
id: option.value,
label: (
<span className={css.commitModelOption}>
<span className={css.commitModelOptionText}>{option.value}</span>
{option.note !== '' && <span className={css.commitModelOptionNote}>{option.note}</span>}
</span>
),
}))}
selectedId={value === '' ? undefined : value}
onSelect={(id) => {
const option = matches.find(candidate => candidate.value === id)
if (option !== undefined) pick(option)
}}
onClose={() => { setOpen(false) }}
portal
/>
</div>
{invalid && <Notice kind="error" tone="inline">{t('commitModelInvalid')}</Notice>}
{catalog !== null && !catalog.llm && <Notice kind="hint" tone="inline">{t('commitModelUnavailable')}</Notice>}
{catalog !== null && catalog.llm && options.length === 0 && (
<Notice kind="hint" tone="inline">{t('commitModelEmpty')}</Notice>
)}
{error !== null && <Notice kind="error" tone="inline">{error}</Notice>}
</div>
)
}
+127 -17
View File
@@ -26,19 +26,19 @@
* failures used to land under the commit box, which read as "your commit
* failed" for an action the user never ran.
*/
import { memo, useCallback, useEffect, useMemo, useRef, useState, type MouseEvent, type ReactNode } from 'react'
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type MouseEvent, type ReactNode } from 'react'
import {
Button, IconChevronRightOutlineRegular, IconCodeOutlineRegular, IconCopyOutlineRegular, IconPlusOutlineRegular,
IconTrashOutlineRegular, Input, Menu, writeClipboard,
IconSparkleRegular, IconTrashOutlineRegular, Menu, writeClipboard,
} from '@deepseek-ai/dsh-client-ui-primitives'
import type { Context } from '../../context-types.ts'
import type { GitLogEntry, GitStatusEntry, GitStatusResult, GitWorktree, SessionScope } from '../api.ts'
import { api } from '../api.ts'
import { api, SidebarApiError } from '../api.ts'
import { builtinFileIcon, builtinFolderIcon } from '../file-icons.tsx'
import { usePolling } from '../use-polling.ts'
import { baseName, relativeTo } from '../paths.ts'
import { resolveSidebarPath } from '../paths.ts'
import { relativeTime, t } from '../locales.ts'
import { isZh, relativeTime, t } from '../locales.ts'
import type { SidebarDiffRef, SidebarStore } from '../state.ts'
import {
ConfirmDialog, IconButton, Notice, SectionHeader, StatusBadge, invalidateGitStatus, statusOfXY,
@@ -121,6 +121,12 @@ const LOG_BATCH = 20
* within ~30s, without a second git process per status tick. */
const WORKTREE_POLL_MS = 30_000
/** Commit-box growth contract: one line is 18px with 6px of padding above and
* below (mirrored by `changes.module.css`), and it scrolls past six lines. */
const COMMIT_BOX_LINE_HEIGHT = 18
const COMMIT_BOX_PADDING_Y = 6
const COMMIT_BOX_MAX_ROWS = 6
/** A stable empty entry list: the tree memo must not rebuild on every render
* just because `snapshot?.entries ?? []` minted a new array. */
const NO_ENTRIES: readonly GitStatusEntry[] = []
@@ -296,6 +302,28 @@ export function GitLens(props: GitLensProps) {
const [logFailed, setLogFailed] = useState(false)
const [commitMsg, setCommitMsg] = useState('')
const [busy, setBusy] = useState(false)
/** Whether a commit-message suggestion is being generated host-side (the
* host streams the diff through the harness LLM — no agent is spawned). */
const [suggesting, setSuggesting] = useState(false)
/** The route the next suggestion would use, for the button's tooltip. */
const [commitModel, setCommitModel] = useState<string | undefined>(undefined)
/** Whether a COMMIT is in flight (a subset of `busy`, which also covers
* staging/checkout): the input reports it with its own busy label. */
const [committing, setCommitting] = useState(false)
/** The commit box grows with its text, up to the scroll cap below. */
const commitBoxRef = useRef<HTMLTextAreaElement | null>(null)
useLayoutEffect(() => {
const box = commitBoxRef.current
// A layout-less environment (tests) reports 0: leave the CSS height alone.
if (box === null || box.scrollHeight === 0) return
const max = COMMIT_BOX_LINE_HEIGHT * COMMIT_BOX_MAX_ROWS + COMMIT_BOX_PADDING_Y * 2
// Reset first: a scrollHeight measured against the current height can only
// ever grow, so a deleted line would leave the box too tall.
box.style.height = 'auto'
const next = Math.min(box.scrollHeight, max)
box.style.height = `${next}px`
box.style.overflowY = box.scrollHeight > max ? 'auto' : 'hidden'
}, [commitMsg])
/** The commit bar's ONE status line (commit / stage / discard / revert). */
const [actionError, setActionError] = useState<string | null>(null)
/** The lens-level error banner (refresh / branch switch / history paging). */
@@ -338,6 +366,23 @@ export function GitLens(props: GitLensProps) {
return repoRootRef.current === undefined ? { ...base } : { ...base, repoRoot: repoRootRef.current }
}, [])
/** Label the generate button with the model the next suggestion would use.
* Re-read whenever the panel becomes visible: the pinned route lives in the
* side card settings, so a change made there lands on the next visit. */
const scopeSessionId = scope.sessionId
const scopeCwd = scope.cwd
useEffect(() => {
if (!visible) return
let cancelled = false
api.gitCommitModel({ sessionId: scopeSessionId, ...(scopeCwd === undefined ? {} : { cwd: scopeCwd }) })
.then(view => {
if (cancelled) return
setCommitModel(view.route === undefined ? undefined : `${view.route.provider}/${view.route.model}`)
})
.catch(() => { if (!cancelled) setCommitModel(undefined) })
return () => { cancelled = true }
}, [visible, scopeSessionId, scopeCwd])
// Keep the session cwd and pass the child selection explicitly: an attached
// session overrides client cwd, so changing cwd alone still reads the first
// repository. The status store includes repoRoot in its cache key.
@@ -549,8 +594,39 @@ export function GitLens(props: GitLensProps) {
const commit = (): void => {
const message = commitMsg.trim()
if (message === '' || busy) return
void runAction(() => api.gitCommit(gitScopeNow(), message, selectedWorktree), errorMessage, () => { setCommitMsg('') })
if (message === '' || busy || suggesting) return
setCommitting(true)
void runAction(
() => api.gitCommit(gitScopeNow(), message, selectedWorktree),
errorMessage,
() => { setCommitMsg('') },
).finally(() => { setCommitting(false) })
}
/** The generate button's label/tooltip: names the model when one resolves,
* so the user knows which provider the draft will run on. */
const generateLabel = commitModel === undefined
? t('generateCommitMessage')
: t('generateCommitMessageWith', { model: commitModel })
/** Ask the host to draft a commit message from the pending changes, then
* fill the message box (still editable; regenerating is allowed). */
const suggestMessage = async (): Promise<void> => {
if (busy || suggesting) return
setSuggesting(true)
setActionError(null)
try {
const { message } = await api.gitSuggestMessage(gitScopeNow(), isZh() ? 'zh' : 'en', selectedWorktree)
setCommitMsg(message)
} catch (reason) {
if (reason instanceof SidebarApiError && reason.code === 'git-suggest-empty') {
setActionError(t('suggestCommitEmpty'))
} else {
setActionError(`${t('suggestCommitError')}: ${errorMessage(reason)}`)
}
} finally {
setSuggesting(false)
}
}
/** Switching the selected checkout changes which rows are legitimate to act
@@ -875,20 +951,54 @@ export function GitLens(props: GitLensProps) {
{isRepo && (
<div className={css.commitBar}>
<div className={css.commitRow}>
<Input
className={css.commitInput}
placeholder={t('commitPlaceholder')}
value={commitMsg}
disabled={busy}
onChange={(event) => { setCommitMsg(event.target.value); setActionError(null) }}
onKeyDown={(event) => {
if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') commit()
}}
/>
<span className={css.commitInputWrap}>
{/* A native textarea (the primitives ship no multiline input):
commit messages carry a subject AND a body, and Enter must
insert a newline — submitting stays on Ctrl/Cmd+Enter. */}
<textarea
ref={commitBoxRef}
className={css.commitInput}
// While busy the placeholder steps aside for the sweep label.
placeholder={busy || suggesting ? '' : t('commitPlaceholder')}
value={commitMsg}
disabled={busy || suggesting}
aria-busy={busy || suggesting}
aria-label={t('commitPlaceholder')}
rows={1}
onChange={(event) => { setCommitMsg(event.currentTarget.value); setActionError(null) }}
onKeyDown={(event) => {
if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') commit()
// Ctrl/Cmd+G drafts the message, mirroring the button (the
// placeholder advertises it).
if ((event.ctrlKey || event.metaKey) && (event.key === 'g' || event.key === 'G')) {
event.preventDefault()
void suggestMessage()
}
}}
/>
{/* Only the two per-input operations get a label: other `busy`
work (staging, checkout) disables the box silently. */}
{(suggesting || committing) && (
<span className={css.commitBusyText} role="status" aria-live="polite">
{suggesting ? t('generatingCommitMessage') : t('committingMessage')}
</span>
)}
</span>
<button
type="button"
className={suggesting ? `${css.suggestButton} ${css.suggestBusy}` : css.suggestButton}
aria-label={generateLabel}
aria-busy={suggesting}
title={generateLabel}
disabled={busy || suggesting || (stagedEntries.length === 0 && unstagedEntries.length === 0)}
onClick={() => { void suggestMessage() }}
>
<IconSparkleRegular size={14} />
</button>
<Button
variant="primary"
size="sm"
disabled={busy || commitMsg.trim() === '' || stagedEntries.length === 0}
disabled={busy || suggesting || commitMsg.trim() === '' || stagedEntries.length === 0}
onClick={commit}
>
{t('commit')}
+253 -1
View File
@@ -208,7 +208,259 @@
background: var(--dsw-alias-bg-base);
}
.commitRow { display: flex; align-items: center; gap: 6px; }
.commitInput { flex: 1; min-width: 0; }
/* The commit-message box and its busy overlay: the input keeps its own
flex sizing through a wrapper so the overlay can sit exactly on top of it
while the host generates or commits. */
.commitInputWrap {
position: relative;
display: flex;
flex: 1;
min-width: 0;
}
/* The multiline commit box: a native textarea styled to match the primitives
Input (layer fill, hairline border, brand focus ring). Flex sizing keeps it
inside the row — `width: 100%` would overflow its own padding/border. */
.commitInput {
flex: 1;
min-width: 0;
box-sizing: border-box;
/* One line by default; GitLens grows it with the text (18px per line,
6px vertical padding, six lines before it scrolls). The bounds here are
the stylesheet's half of that contract. */
min-height: 30px;
max-height: 120px;
padding: 6px 8px;
border: 0.5px solid var(--dsw-alias-border-l4);
border-radius: 8px;
background: var(--dsw-alias-bg-layer-1);
color: var(--dsw-alias-label-primary);
font: var(--dsw-font-s-13);
line-height: 18px;
resize: none;
overflow-y: hidden;
}
.commitInput:focus {
outline: none;
border-color: var(--dsw-alias-brand-primary);
}
.commitInput::placeholder {
color: var(--dsw-alias-label-dimmed);
}
.commitInput:disabled {
opacity: 0.5;
}
/* Busy text in the input's place: the running-status sweep used by the side
chat (gradient text scrolled by background-position). The real placeholder
is cleared while busy, so the two never overlap. */
.commitBusyText {
position: absolute;
inset: 0;
display: flex;
align-items: center;
/* Matches the textarea's own padding so the label sits where the text would. */
padding: 6px 8px;
pointer-events: none;
font: var(--dsw-font-xxs-12);
background-image: linear-gradient(
90deg,
var(--dsw-alias-label-tertiary) 0%,
var(--dsw-alias-label-primary) 50%,
var(--dsw-alias-label-tertiary) 100%
);
background-size: 200% 100%;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: commitSweep 2.6s linear infinite;
}
@keyframes commitSweep {
from { background-position: 200% 0; }
to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
.commitBusyText { animation: none; }
}
/* The AI commit-message button: a quiet square secondary button beside the
input. While the host streams a suggestion it pulses. */
.suggestButton {
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
border: 1px solid var(--dsw-alias-border-l1);
border-radius: 6px;
background: transparent;
color: var(--dsw-alias-label-secondary);
cursor: pointer;
}
.suggestButton:hover:not(:disabled) {
background: var(--dsw-alias-interactive-bg-hover);
color: var(--dsw-alias-label-primary);
}
.suggestButton:disabled {
opacity: 0.45;
cursor: default;
}
.suggestBusy {
color: var(--dsw-alias-interactive-bg-hover-accent);
animation: commitSuggestPulse 1.2s ease-in-out infinite;
}
@keyframes commitSuggestPulse {
50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
.suggestBusy { animation: none; }
}
/* The Git card's pinned-model setting (rendered through settings.render). */
.commitModel {
display: flex;
flex-direction: column;
gap: 4px;
padding: 8px 12px;
}
.commitModelTitle {
font: var(--dsw-font-xxs-strong-12);
color: var(--dsw-alias-label-primary);
}
.commitModelDesc {
font: var(--dsw-font-xxs-12);
color: var(--dsw-alias-label-tertiary);
}
/* Follow-the-conversation switch: a native checkbox (real semantics and
focus) beside its label, matching the side card's switch rows. */
.commitModelRow {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.commitModelSwitch {
display: inline-flex;
align-items: center;
gap: 6px;
font: var(--dsw-font-xxs-12);
color: var(--dsw-alias-label-primary);
cursor: pointer;
}
.commitModelSwitch input {
accent-color: var(--dsw-alias-interactive-bg-hover-accent);
}
/* The searchable route box: the wrapper span the Menu renders around the
input. Its default `.root` is `display: inline-flex`, which shrinks to the
input's intrinsic width — overridden here so the box fills the panel. The
candidate list itself is portalled to <body> (see the component), so its
width is pinned to the input at runtime. */
.commitModelMenuRoot {
display: block;
width: 100%;
}
.commitModelBox {
display: block;
}
/* The stored route, shown on its own line: the search box below stays an empty
filter, so reopening the picker lists every candidate instead of filtering
down to the model that is already selected. */
.commitModelCurrent {
margin-bottom: 4px;
font: var(--dsw-font-xxs-strong-12);
color: var(--dsw-alias-label-primary);
overflow-wrap: anywhere;
}
.commitModelInput {
width: 100%;
box-sizing: border-box;
height: 26px;
padding: 0 6px;
border: 1px solid var(--dsw-alias-border-l2);
border-radius: 6px;
background: var(--dsw-alias-bg-layer-2);
color: var(--dsw-alias-label-primary);
font: var(--dsw-font-xxs-12);
}
.commitModelInput:disabled {
opacity: 0.45;
cursor: default;
}
/* One candidate row inside the portalled Menu: the route text plus its source
badge. The menu shell (background, hover, radius) is the primitive's. */
.commitModelOption {
display: flex;
align-items: center;
gap: 8px;
/* border-box, or `width: 100%` plus the horizontal padding overflows its
label box by 12px — which the Menu's `.itemLabel{overflow:hidden}` then
slices off the trailing badge. */
box-sizing: border-box;
width: 100%;
padding: 4px 6px;
border: none;
border-radius: 4px;
background: transparent;
color: var(--dsw-alias-label-primary);
font: var(--dsw-font-xxs-12);
text-align: left;
cursor: pointer;
}
.commitModelOption:hover {
background: var(--dsw-alias-interactive-bg-hover);
}
/* `flex-basis: auto` (NOT `1`, which is basis 0) matters here: the menu card
is sized shrink-to-fit, and a zero basis makes that intrinsic width ignore
the route text — the card then converges on the input's width alone and the
trailing badge is clipped by the Menu's own `.itemLabel{overflow:hidden}`.
With auto the text contributes its real width, and `min-width: 0` still lets
it ellipsize when the card hits the Menu's max-width. */
.commitModelOptionText {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The badge keeps its full width under any shrink pressure. */
.commitModelOptionNote {
flex: 0 0 auto;
min-width: max-content;
white-space: nowrap;
color: var(--dsw-alias-label-tertiary);
}
.commitModelHint {
font: var(--dsw-font-xxs-12);
color: var(--dsw-alias-label-tertiary);
}
/* ── History ───────────────────────────────────────────────────────────── */