( responseId: string, brief: string, outputPath: string, )
| 34 | * Create a new session after initial generation. |
| 35 | */ |
| 36 | export function createSession( |
| 37 | responseId: string, |
| 38 | brief: string, |
| 39 | outputPath: string, |
| 40 | ): DesignSession { |
| 41 | const id = createSessionId(); |
| 42 | const session: DesignSession = { |
| 43 | id, |
| 44 | lastResponseId: responseId, |
| 45 | originalBrief: brief, |
| 46 | feedbackHistory: [], |
| 47 | outputPaths: [outputPath], |
| 48 | createdAt: new Date().toISOString(), |
| 49 | updatedAt: new Date().toISOString(), |
| 50 | }; |
| 51 | |
| 52 | fs.writeFileSync(sessionPath(id), JSON.stringify(session, null, 2), { mode: 0o600 }); |
| 53 | return session; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Read an existing session from disk. |
no test coverage detected