()
| 310 | } |
| 311 | |
| 312 | private async loadPersistentCache(): Promise<void> { |
| 313 | if (this.hasLoadedPersistentCache) { |
| 314 | return; |
| 315 | } |
| 316 | |
| 317 | const cachedValue = await this.cacheStore.read(this.endpoint.toString()); |
| 318 | this.hasLoadedPersistentCache = true; |
| 319 | |
| 320 | if (!cachedValue) { |
| 321 | return; |
| 322 | } |
| 323 | |
| 324 | this.cachedSessionId = cachedValue.sessionId; |
| 325 | |
| 326 | if (!cachedValue.tools || cachedValue.tools.length === 0) { |
| 327 | return; |
| 328 | } |
| 329 | |
| 330 | this.cachedTools = [...cachedValue.tools]; |
| 331 | |
| 332 | try { |
| 333 | this.discoveredTools = discoverLearnTools(this.cachedTools); |
| 334 | } catch { |
| 335 | this.discoveredTools = undefined; |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | private async persistCache(): Promise<void> { |
| 340 | const sessionId = this.transport?.sessionId ?? this.cachedSessionId; |
no test coverage detected