@@ -217,76 +217,88 @@ export function AcpRegistrySearchStep({
217217 ) : (
218218 < ScrollArea scrollFade className = "max-h-64" >
219219 < div className = "pr-2.5" >
220- { results . map ( ( agent ) => {
221- const alreadyAdded = isConfiguredAcpRegistryAgent ( providerInstances , agent . id ) ;
222- const isPreparing = preparingId === agent . id ;
223- const progressLabel = agent . distribution === "binary" ? "Downloading" : "Preparing" ;
224- return (
225- < article className = "min-w-0 py-2.5" key = { agent . id } >
226- < div className = "flex min-w-0 items-center justify-between gap-3" >
227- < div className = "flex min-w-0 flex-1 items-center gap-3" >
228- < ProviderInstanceIcon
229- driverKind = { ProviderDriverKind . make ( "acpRegistry" ) }
230- displayName = { agent . name }
231- acpRegistryAgentId = { agent . id }
232- acpRegistryIconUrl = { agent . icon ?? undefined }
233- iconClassName = "size-6 rounded-md text-muted-foreground"
234- />
235- < div className = "min-w-0 flex-1" >
236- < div className = "flex min-w-0 items-baseline gap-2" >
237- < h4 className = "min-w-0 truncate text-sm font-medium text-foreground" >
238- { agent . name }
239- </ h4 >
240- </ div >
241- { agent . description ? (
242- < p className = "mt-0.5 truncate text-xs text-muted-foreground" >
243- { agent . description }
244- </ p >
245- ) : null }
246- </ div >
247- </ div >
248- < div className = "flex shrink-0 items-center gap-1.5" >
249- { agent . website || agent . repository ? (
250- < Tooltip >
251- < TooltipTrigger
252- render = {
253- < Button
254- size = "icon-xs"
255- variant = "ghost-muted"
256- aria-label = { `About ${ agent . name } ` }
257- render = {
258- < a
259- href = { agent . website || agent . repository || undefined }
260- target = "_blank"
261- rel = "noreferrer"
262- />
263- }
264- >
265- < ExternalLinkIcon />
266- </ Button >
267- }
268- />
269- < TooltipPopup > About { agent . name } </ TooltipPopup >
270- </ Tooltip >
271- ) : null }
272- < Button
273- aria-label = { `${ alreadyAdded ? "Already added" : isPreparing ? progressLabel : "Add" } ${ agent . name } ` }
274- disabled = { ! canManageProviders || alreadyAdded || preparingId !== null }
275- onClick = { ( ) => void handlePrepare ( agent ) }
276- size = "xs"
277- variant = { isPreparing ? "secondary" : "outline" }
278- >
279- { alreadyAdded ? "Added" : isPreparing ? progressLabel : "Add" }
280- </ Button >
281- </ div >
282- </ div >
283- </ article >
284- ) ;
285- } ) }
220+ { results . map ( ( agent ) => (
221+ < AcpRegistryAgentRow
222+ agent = { agent }
223+ alreadyAdded = { isConfiguredAcpRegistryAgent ( providerInstances , agent . id ) }
224+ canAdd = { canManageProviders && preparingId === null }
225+ isPreparing = { preparingId === agent . id }
226+ key = { agent . id }
227+ onAdd = { handlePrepare }
228+ />
229+ ) ) }
286230 </ div >
287231 </ ScrollArea >
288232 )
289233 ) : null }
290234 </ section >
291235 ) ;
292236}
237+
238+ function AcpRegistryAgentRow ( {
239+ agent,
240+ alreadyAdded,
241+ canAdd,
242+ isPreparing,
243+ onAdd,
244+ } : {
245+ readonly agent : AcpRegistrySearchAgent ;
246+ readonly alreadyAdded : boolean ;
247+ readonly canAdd : boolean ;
248+ readonly isPreparing : boolean ;
249+ readonly onAdd : ( agent : AcpRegistrySearchAgent ) => void ;
250+ } ) {
251+ const progressLabel = agent . distribution === "binary" ? "Downloading" : "Preparing" ;
252+ const aboutUrl = agent . website || agent . repository ;
253+ return (
254+ < article className = "min-w-0 py-2.5" >
255+ < div className = "flex min-w-0 items-center justify-between gap-3" >
256+ < div className = "flex min-w-0 flex-1 items-center gap-3" >
257+ < ProviderInstanceIcon
258+ driverKind = { ProviderDriverKind . make ( "acpRegistry" ) }
259+ displayName = { agent . name }
260+ acpRegistryAgentId = { agent . id }
261+ acpRegistryIconUrl = { agent . icon ?? undefined }
262+ iconClassName = "size-6 rounded-md text-muted-foreground"
263+ />
264+ < div className = "min-w-0 flex-1" >
265+ < div className = "flex min-w-0 items-baseline gap-2" >
266+ < h4 className = "min-w-0 truncate text-sm font-medium text-foreground" > { agent . name } </ h4 >
267+ </ div >
268+ { agent . description ? (
269+ < p className = "mt-0.5 truncate text-xs text-muted-foreground" > { agent . description } </ p >
270+ ) : null }
271+ </ div >
272+ </ div >
273+ < div className = "flex shrink-0 items-center gap-1.5" >
274+ { aboutUrl ? (
275+ < Tooltip >
276+ < TooltipTrigger
277+ render = {
278+ < Button
279+ size = "icon-xs"
280+ variant = "ghost-muted"
281+ aria-label = { `About ${ agent . name } ` }
282+ render = { < a href = { aboutUrl } target = "_blank" rel = "noreferrer" /> }
283+ >
284+ < ExternalLinkIcon />
285+ </ Button >
286+ }
287+ />
288+ < TooltipPopup > About { agent . name } </ TooltipPopup >
289+ </ Tooltip >
290+ ) : null }
291+ < Button
292+ aria-label = { `${ alreadyAdded ? "Already added" : isPreparing ? progressLabel : "Add" } ${ agent . name } ` }
293+ disabled = { ! canAdd || alreadyAdded }
294+ onClick = { ( ) => onAdd ( agent ) }
295+ size = "xs"
296+ variant = { isPreparing ? "secondary" : "outline" }
297+ >
298+ { alreadyAdded ? "Added" : isPreparing ? progressLabel : "Add" }
299+ </ Button >
300+ </ div >
301+ </ div >
302+ </ article >
303+ ) ;
304+ }
0 commit comments