( sections: SystemPromptSection[], )
| 41 | * Resolve all system prompt sections, returning prompt strings. |
| 42 | */ |
| 43 | export async function resolveSystemPromptSections( |
| 44 | sections: SystemPromptSection[], |
| 45 | ): Promise<(string | null)[]> { |
| 46 | const cache = getSystemPromptSectionCache() |
| 47 | |
| 48 | return Promise.all( |
| 49 | sections.map(async s => { |
| 50 | if (!s.cacheBreak && cache.has(s.name)) { |
| 51 | return cache.get(s.name) ?? null |
| 52 | } |
| 53 | const value = await s.compute() |
| 54 | setSystemPromptSectionCacheEntry(s.name, value) |
| 55 | return value |
| 56 | }), |
| 57 | ) |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Clear all system prompt section state. Called on /clear and /compact. |
no test coverage detected