Skip to content

Commit b569b8a

Browse files
committed
feat(agents): show availability status in agent selector
1 parent a9d6840 commit b569b8a

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

electron/ipc/agents.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { execFileSync } from 'child_process';
2+
13
interface AgentDef {
24
id: string;
35
name: string;
@@ -6,6 +8,7 @@ interface AgentDef {
68
resume_args: string[];
79
skip_permissions_args: string[];
810
description: string;
11+
available?: boolean;
912
}
1013

1114
const DEFAULT_AGENTS: AgentDef[] = [
@@ -47,6 +50,18 @@ const DEFAULT_AGENTS: AgentDef[] = [
4750
},
4851
];
4952

53+
function isCommandAvailable(command: string): boolean {
54+
try {
55+
execFileSync('which', [command], { encoding: 'utf8', timeout: 3000 });
56+
return true;
57+
} catch {
58+
return false;
59+
}
60+
}
61+
5062
export function listAgents(): AgentDef[] {
51-
return DEFAULT_AGENTS;
63+
return DEFAULT_AGENTS.map((agent) => ({
64+
...agent,
65+
available: isCommandAvailable(agent.command),
66+
}));
5267
}

src/components/AgentSelector.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ export function AgentSelector(props: AgentSelectorProps) {
4949
}}
5050
>
5151
{agent.name}
52+
{agent.available === false && (
53+
<span
54+
style={{
55+
'font-size': '10px',
56+
color: theme.fgMuted,
57+
'margin-left': '4px',
58+
}}
59+
>
60+
(not installed)
61+
</span>
62+
)}
5263
</button>
5364
);
5465
}}

src/ipc/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface AgentDef {
1313
resume_args?: string[];
1414
skip_permissions_args?: string[];
1515
description: string;
16+
available?: boolean;
1617
}
1718

1819
export interface CreateTaskResult {

0 commit comments

Comments
 (0)