Fix executable candidate source labels

This commit is contained in:
bulai0408 2026-05-31 18:14:32 +08:00
parent dac8f0ee66
commit c4aac5f92b
2 changed files with 11 additions and 6 deletions

View file

@ -3147,11 +3147,8 @@ export function SettingsDialog({
?.path ||
selected.path ||
'';
const cliStrings = cliPathStrings(
locale,
displayAgentName(selected),
envKey,
);
const agentName = displayAgentName(selected);
const cliStrings = cliPathStrings(locale, agentName, envKey);
return (
<div className="agent-candidates">
<div className="agent-candidates-head">
@ -3180,7 +3177,11 @@ export function SettingsDialog({
{candidate.version ||
t('common.installed')}
{' · '}
{candidate.source}
{cliExecutableSourceLabel(
locale,
agentName,
candidate.source,
)}
</span>
</div>
<div className="agent-candidate-actions">

View file

@ -2038,6 +2038,10 @@ describe('SettingsDialog execution settings Local CLI interactions', () => {
expect(screen.getByText('Detected OpenCode binaries')).toBeTruthy();
expect(screen.getByText('/opt/homebrew/bin/opencode')).toBeTruthy();
expect(screen.getByText('/Users/mac/.opencode/bin/opencode')).toBeTruthy();
expect(screen.getByText(/opencode 1\.1\.14 · the PATH OpenCode CLI/)).toBeTruthy();
expect(screen.getByText(/opencode 1\.2\.0 · the known OpenCode install/)).toBeTruthy();
expect(screen.queryByText(/opencode 1\.1\.14 · path/)).toBeNull();
expect(screen.queryByText(/opencode 1\.2\.0 · known/)).toBeNull();
fireEvent.click(screen.getByRole('button', { name: /Use OpenCode binary \/Users\/mac\/\.opencode\/bin\/opencode/i }));