()
| 20 | |
| 21 | /** Cross-process catalog for New Session while an ACP lock blocks `agent --list-models`. */ |
| 22 | export function readSharedCursorModelsCache(): CursorModelsResponse | null { |
| 23 | const path = getSharedCachePath(); |
| 24 | if (!existsSync(path)) { |
| 25 | return null; |
| 26 | } |
| 27 | |
| 28 | try { |
| 29 | const parsed = JSON.parse(readFileSync(path, 'utf8')) as CursorModelsResponse; |
| 30 | return isUsableModelsResponse(parsed) ? parsed : null; |
| 31 | } catch { |
| 32 | return null; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | export function writeSharedCursorModelsCache(response: CursorModelsResponse): void { |
| 37 | if (!isUsableModelsResponse(response)) { |
no test coverage detected