refactor: centralize visible phase mapping

This commit is contained in:
Eyejoker
2026-03-25 12:04:29 +09:00
parent 1ad23269fa
commit cc7cfbbc5f
4 changed files with 208 additions and 94 deletions

17
src/types.test.ts Normal file
View File

@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest';
import { normalizeAgentOutputPhase, toVisiblePhase } from './types.js';
describe('phase helpers', () => {
it('maps agent output phases to visible phases', () => {
expect(toVisiblePhase('intermediate')).toBe('silent');
expect(toVisiblePhase('tool-activity')).toBe('silent');
expect(toVisiblePhase('progress')).toBe('progress');
expect(toVisiblePhase('final')).toBe('final');
});
it('normalizes missing agent output phases to final', () => {
expect(normalizeAgentOutputPhase(undefined)).toBe('final');
expect(normalizeAgentOutputPhase('progress')).toBe('progress');
});
});