()
| 123 | const tmpDirs: string[] = []; |
| 124 | |
| 125 | async function makeFixture(): Promise<Fixture> { |
| 126 | const homeDir = await mkdtemp(join(tmpdir(), 'kimi-snapshot-unit-')); |
| 127 | const workDir = await mkdtemp(join(tmpdir(), 'kimi-snapshot-workdir-')); |
| 128 | tmpDirs.push(homeDir, workDir); |
| 129 | |
| 130 | const store = new SessionStore(homeDir); |
| 131 | const bus = new EventService(); |
| 132 | const broadcast = new StubBroadcast(); |
| 133 | const approvals = new StubApprovals(); |
| 134 | const questions = new StubQuestions(); |
| 135 | const prompts = new StubPrompts(); |
| 136 | |
| 137 | const env = { |
| 138 | _serviceBrand: undefined as undefined, |
| 139 | homeDir, |
| 140 | configPath: join(homeDir, 'config.toml'), |
| 141 | }; |
| 142 | |
| 143 | const service = new SnapshotService( |
| 144 | env, |
| 145 | new NoopLog(), |
| 146 | bus, |
| 147 | broadcast as unknown as IWSBroadcastServiceT, |
| 148 | approvals as unknown as IApprovalService, |
| 149 | questions as unknown as IQuestionService, |
| 150 | prompts as unknown as IPromptService, |
| 151 | ); |
| 152 | |
| 153 | return { homeDir, workDir, store, bus, broadcast, approvals, questions, prompts, service }; |
| 154 | } |
| 155 | |
| 156 | async function writeWire(sessionDir: string, lines: ReadonlyArray<unknown>): Promise<void> { |
| 157 | const agentDir = join(sessionDir, 'agents', 'main'); |
no test coverage detected