feat: update codex live runtime and restart flow

This commit is contained in:
2026-04-23 18:10:43 +09:00
parent b0b9980a6c
commit 6e863feafd
36 changed files with 1636 additions and 358 deletions

View File

@@ -155,6 +155,53 @@ test('rewriteCodexOutputWithChatResources stages diff blocks as chat resources',
assert.equal(await readFile(savedDiffPath, 'utf8'), 'diff --git a/src/a.ts b/src/a.ts\n+hello\n');
});
test('rewriteCodexOutputWithChatResources keeps diff paths intact while rewriting prose file paths', async () => {
const repoPath = await mkdtemp(path.join(tmpdir(), 'chat-service-test-'));
const sourcePath = path.join(repoPath, 'src', 'a.ts');
await mkdir(path.dirname(sourcePath), { recursive: true });
await writeFile(sourcePath, 'export const value = 1;\n', 'utf8');
const output = [
'변경 파일: src/a.ts',
'',
'```diff',
'diff --git a/src/a.ts b/src/a.ts',
'--- a/src/a.ts',
'+++ b/src/a.ts',
'@@',
'-export const value = 1;',
'+export const value = 2;',
'```',
].join('\n');
const rewritten = await rewriteCodexOutputWithChatResources(output, repoPath, 'chat-room');
const savedDiffPath = path.join(
repoPath,
'public',
'.codex_chat',
'chat-room',
'resource',
'_generated',
'response.diff',
);
assert.match(rewritten, /변경 파일: \/api\/chat\/resources\/\.codex_chat\/chat-room\/resource\/src\/a\.ts/);
assert.match(rewritten, /diff --git a\/src\/a\.ts b\/src\/a\.ts/);
assert.doesNotMatch(rewritten, /diff --git a\/api\/chat\/resources\//);
assert.equal(
await readFile(savedDiffPath, 'utf8'),
[
'diff --git a/src/a.ts b/src/a.ts',
'--- a/src/a.ts',
'+++ b/src/a.ts',
'@@',
'-export const value = 1;',
'+export const value = 2;',
'',
].join('\n'),
);
});
test('rewriteCodexOutputWithChatResources keeps existing public chat resource paths stable', async () => {
const repoPath = await mkdtemp(path.join(tmpdir(), 'chat-service-test-'));
const originalPath = path.join(repoPath, 'src', 'app', 'main', 'MainChatPanel.tsx');