(agentUrl: string)
| 50 | const agentCardCache = new Map<string, { card: AgentCard; expiresAt: number }>() |
| 51 | |
| 52 | function getCachedCard(agentUrl: string): AgentCard | undefined { |
| 53 | const cached = agentCardCache.get(agentUrl) |
| 54 | if (!cached) return undefined |
| 55 | if (cached.expiresAt <= Date.now()) { |
| 56 | agentCardCache.delete(agentUrl) |
| 57 | return undefined |
| 58 | } |
| 59 | return cached.card |
| 60 | } |
| 61 | |
| 62 | function cacheCard(agentUrl: string, card: AgentCard): void { |
| 63 | if (agentCardCache.size >= CARD_CACHE_MAX_ENTRIES) { |
no test coverage detected