(kv: StateKV)
| 170 | } |
| 171 | |
| 172 | export async function listPinnedSlots(kv: StateKV): Promise<MemorySlot[]> { |
| 173 | const [project, global] = await Promise.all([ |
| 174 | kv.list<MemorySlot>(KV.slots), |
| 175 | kv.list<MemorySlot>(KV.globalSlots), |
| 176 | ]); |
| 177 | const merged = new Map<string, MemorySlot>(); |
| 178 | for (const s of global) merged.set(s.label, s); |
| 179 | for (const s of project) merged.set(s.label, s); |
| 180 | return Array.from(merged.values()) |
| 181 | .filter((s) => s.pinned && s.content.trim().length > 0) |
| 182 | .sort((a, b) => a.label.localeCompare(b.label)); |
| 183 | } |
| 184 | |
| 185 | export function renderPinnedContext(slots: MemorySlot[]): string { |
| 186 | if (slots.length === 0) return ""; |
no test coverage detected