(value: { endpoint: string; sessionId?: string; tools?: ListedTool[] })
| 72 | } |
| 73 | |
| 74 | async write(value: { endpoint: string; sessionId?: string; tools?: ListedTool[] }): Promise<LearnSessionCacheValue> { |
| 75 | const normalizedEndpoint = normalizeEndpoint(value.endpoint); |
| 76 | const cache = await this.readCacheFile(); |
| 77 | const storedValue: LearnSessionCacheValue = { |
| 78 | endpoint: normalizedEndpoint, |
| 79 | sessionId: value.sessionId, |
| 80 | tools: value.tools ? [...value.tools] : undefined, |
| 81 | updatedAt: new Date(this.now()).toISOString(), |
| 82 | expiresAt: new Date(this.now() + this.ttlMs).toISOString(), |
| 83 | }; |
| 84 | |
| 85 | cache.entries[normalizedEndpoint] = storedValue; |
| 86 | await this.writeCacheFile(cache); |
| 87 | return storedValue; |
| 88 | } |
| 89 | |
| 90 | async clear(endpoint: string): Promise<void> { |
| 91 | const normalizedEndpoint = normalizeEndpoint(endpoint); |
nothing calls this directly
no test coverage detected