( opts: SessionChatStoreOptions, designId: string, )
| 525 | } |
| 526 | |
| 527 | export function readSessionDesignBrief( |
| 528 | opts: SessionChatStoreOptions, |
| 529 | designId: string, |
| 530 | ): DesignSessionBriefV1 | null { |
| 531 | const cwd = resolveSessionCwd(opts, designId); |
| 532 | const file = sessionFileForDesign(opts.sessionDir, designId); |
| 533 | if (!existsSync(file)) return null; |
| 534 | const manager = SessionManager.open(file, opts.sessionDir, cwd); |
| 535 | const entries = manager.getEntries(); |
| 536 | for (let index = entries.length - 1; index >= 0; index -= 1) { |
| 537 | const entry = entries[index] as CustomEntryLike | undefined; |
| 538 | if (entry?.type !== 'custom' || entry.customType !== CONTEXT_BRIEF_CUSTOM_TYPE) continue; |
| 539 | const stored = parseStoredBrief(entry.data); |
| 540 | if (stored !== null) return stored.brief; |
| 541 | } |
| 542 | return null; |
| 543 | } |
| 544 | |
| 545 | export function appendSessionDesignBrief( |
| 546 | opts: SessionChatStoreOptions, |
no test coverage detected