дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 03:05:40 +02:00
Agents can report model ids with nested provider paths, which made long rows that lost their provider context. The model picker now shows the short name under a provider heading with the remaining path as detail. Searchable Select matches several tokens across label, detail and hidden keywords, with fuzzy matching, and keeps a heading while one of its items matches. Select now has an explicit section option, separate from disabled, so a heading can never be selected and a disabled option is not rendered as a heading. Existing section rows in provider options and Find in Files scopes use it. Keyboard navigation skips headings in filtered lists. Co-authored-by: dimassfeb-09 <[email protected]>
29 рядки
1.3 KiB
TypeScript
29 рядки
1.3 KiB
TypeScript
/** The New Task page's agent picker. */
|
||
import type { AgentProvider } from "@/bindings";
|
||
import type { tx as Tx } from "@/platform/i18n";
|
||
import type { SelectOption } from "@/ui";
|
||
|
||
/** Picker entry that opens Settings › Tools › Agents instead of choosing an agent. */
|
||
export const ADD_AGENT = "__addAgent__";
|
||
|
||
/**
|
||
* Installed agents first; the rest under a "Not installed" title, with the command they
|
||
* need; then More agents…. Registry agents show their version, or the update on offer.
|
||
*/
|
||
export function providerOptions(
|
||
providers: readonly AgentProvider[],
|
||
tx: typeof Tx,
|
||
icon: (id: string) => string,
|
||
): SelectOption[] {
|
||
const version = (p: AgentProvider) =>
|
||
p.source.kind !== "registry" ? undefined : p.source.update ? tx`${p.source.update} available` : p.source.version;
|
||
const installed = providers.filter((p) => p.installed);
|
||
const missing = providers.filter((p) => !p.installed);
|
||
return [
|
||
...installed.map((p) => ({ value: p.id, label: p.name, icon: icon(p.id), detail: version(p) })),
|
||
...(missing.length ? [{ value: "__missing__", label: tx("Not installed"), section: true }] : []),
|
||
...missing.map((p) => ({ value: p.id, label: p.name, icon: icon(p.id), detail: p.command })),
|
||
{ value: ADD_AGENT, label: tx("More agents…") },
|
||
];
|
||
}
|