(path: string, trigger?: HTMLElement)
| 52 | } |
| 53 | |
| 54 | function openAgentDetailsModal(path: string, trigger?: HTMLElement): void { |
| 55 | const item = agentByPath.get(path); |
| 56 | if (!item) { |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | const metaParts: string[] = []; |
| 61 | if (item.model) { |
| 62 | metaParts.push( |
| 63 | `<span class="resource-tag tag-model">${escapeHtml( |
| 64 | Array.isArray(item.model) ? item.model.join(', ') : item.model |
| 65 | )}</span>` |
| 66 | ); |
| 67 | } |
| 68 | |
| 69 | if (item.hasHandoffs) { |
| 70 | metaParts.push('<span class="resource-tag tag-handoffs">handoffs</span>'); |
| 71 | } |
| 72 | |
| 73 | if (item.lastUpdated) { |
| 74 | metaParts.push( |
| 75 | `<span class="last-updated">Updated ${escapeHtml( |
| 76 | formatRelativeTime(item.lastUpdated) |
| 77 | )}</span>` |
| 78 | ); |
| 79 | } |
| 80 | |
| 81 | const toolItems = item.tools || []; |
| 82 | const displayTools = toolItems.slice(0, 24); |
| 83 | const tagParts = displayTools.map( |
| 84 | (tool) => `<span class="resource-tag">${escapeHtml(tool)}</span>` |
| 85 | ); |
| 86 | if (toolItems.length > displayTools.length) { |
| 87 | tagParts.push( |
| 88 | `<span class="resource-tag">+${toolItems.length - displayTools.length} more</span>` |
| 89 | ); |
| 90 | } |
| 91 | |
| 92 | const vscodeUrl = getVSCodeInstallUrl('agent', path, false); |
| 93 | const insidersUrl = getVSCodeInstallUrl('agent', path, true); |
| 94 | const actions = [ |
| 95 | vscodeUrl |
| 96 | ? `<a class="btn btn-primary btn-small" href="${escapeHtml(vscodeUrl)}" target="_blank" rel="noopener noreferrer">Install (VS Code)</a>` |
| 97 | : '', |
| 98 | insidersUrl |
| 99 | ? `<a class="btn btn-secondary btn-small" href="${escapeHtml(insidersUrl)}" target="_blank" rel="noopener noreferrer">Install (Insiders)</a>` |
| 100 | : '', |
| 101 | `<button class="btn btn-secondary btn-small" type="button" data-open-file-path="${escapeHtml( |
| 102 | path |
| 103 | )}" data-open-file-type="agent">Source</button>`, |
| 104 | ].filter(Boolean); |
| 105 | |
| 106 | openCardDetailsModal({ |
| 107 | title: item.title, |
| 108 | description: item.description || 'No description', |
| 109 | previewIcon: '🤖', |
| 110 | previewText: 'Agent metadata and install options', |
| 111 | metaHtml: metaParts.join(''), |
no test coverage detected