11import { PixelLoader } from "@/renderer/components/common" ;
22import { getRegisteredProviders , ProviderIcon } from "@/renderer/components/providers/ProviderIcon" ;
33import { useAgentStatusesStore } from "@/renderer/state/agentStatusesStore" ;
4- import type { AgentStatus } from "@/shared/contracts" ;
4+ import type { AgentStatus , ProjectLocation } from "@/shared/contracts" ;
55
66function readyBadge ( status : AgentStatus ) : { label : string ; toneClass : string } | null {
77 if ( ! status . installed ) return null ;
@@ -11,10 +11,22 @@ function readyBadge(status: AgentStatus): { label: string; toneClass: string } |
1111 return { label : "Ready" , toneClass : "text-success" } ;
1212}
1313
14- export function AgentDiscoveryScreen ( ) {
14+ function statusLine ( scopedCount : number , installedCount : number , wslDistro : string | undefined ) {
15+ if ( scopedCount === 0 ) {
16+ return wslDistro ? "Warming up WSL shell environment…" : "Warming up shell environment…" ;
17+ }
18+ if ( installedCount === 0 ) return "No agents installed yet" ;
19+ if ( installedCount === 1 ) return "1 agent ready" ;
20+ return `${ installedCount } agents ready` ;
21+ }
22+
23+ export function AgentDiscoveryScreen ( props : { location ?: ProjectLocation } ) {
24+ // `discoveredAgents` is already scoped by `pushDiscoveredAgent` to the active
25+ // discovery scope, so no additional location filtering is needed here.
1526 const discovered = useAgentStatusesStore ( ( s ) => s . discoveredAgents ) ;
1627 const byKind = new Map ( discovered . map ( ( status ) => [ status . kind , status ] ) ) ;
1728 const installedCount = discovered . reduce ( ( n , s ) => n + ( s . installed ? 1 : 0 ) , 0 ) ;
29+ const wslDistro = props . location ?. kind === "wsl" ? props . location . distro : undefined ;
1830 // Provider plugins self-register at module-load time; reading the registry
1931 // each render keeps this screen in sync as new agent kinds are added.
2032 const providers = getRegisteredProviders ( ) ;
@@ -25,7 +37,9 @@ export function AgentDiscoveryScreen() {
2537 < PixelLoader size = "lg" className = "text-foreground" />
2638 < h1 className = "text-xl font-semibold tracking-tight" > Discovering coding agents…</ h1 >
2739 < p className = "max-w-sm text-sm text-muted" >
28- Scanning your system for installed CLIs. This usually takes a couple of seconds.
40+ { wslDistro
41+ ? `Scanning ${ wslDistro } for installed CLIs. This usually takes a couple of seconds.`
42+ : "Scanning your system for installed CLIs. This usually takes a couple of seconds." }
2943 </ p >
3044 </ div >
3145
@@ -59,13 +73,7 @@ export function AgentDiscoveryScreen() {
5973 </ div >
6074
6175 < div className = "text-xs text-muted/70" aria-live = "polite" >
62- { discovered . length === 0
63- ? "Warming up shell environment…"
64- : installedCount === 0
65- ? "No agents installed yet"
66- : installedCount === 1
67- ? "1 agent ready"
68- : `${ installedCount } agents ready` }
76+ { statusLine ( discovered . length , installedCount , wslDistro ) }
6977 </ div >
7078 </ div >
7179 ) ;
0 commit comments