(params: {
sessionName: string;
getSession: () => SessionState | undefined;
recordOptions?: RuntimeSessionRecordOptions;
setRecord: (record: CommandSessionRecord) => void;
})
| 26 | } |
| 27 | |
| 28 | export function createDaemonRuntimeSessionStore(params: { |
| 29 | sessionName: string; |
| 30 | getSession: () => SessionState | undefined; |
| 31 | recordOptions?: RuntimeSessionRecordOptions; |
| 32 | setRecord: (record: CommandSessionRecord) => void; |
| 33 | }): CommandSessionStore { |
| 34 | return { |
| 35 | get: (name) => |
| 36 | name === params.sessionName |
| 37 | ? toRuntimeSessionRecord(params.getSession(), params.sessionName, params.recordOptions) |
| 38 | : undefined, |
| 39 | set: (record) => { |
| 40 | if (record.name !== params.sessionName) { |
| 41 | emitDiagnostic({ |
| 42 | level: 'warn', |
| 43 | phase: 'runtime_session_write_skipped', |
| 44 | data: { expected: params.sessionName, received: record.name }, |
| 45 | }); |
| 46 | return; |
| 47 | } |
| 48 | params.setRecord(record); |
| 49 | }, |
| 50 | }; |
| 51 | } |
no test coverage detected