mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-24 13:38:43 +02:00
Wire message-reclassified sidecar events through the main process to the renderer, where reclassified messages are filtered out of the main transcript and collected into a collapsible ThinkingProcess component. Main process changes: - Route message-reclassified via dedicated onMessageReclassified callback - Add applyMessageReclassified handler that sets messageKind and emits the session event for the renderer - Forward assistant-intent and reasoning-delta as turn-scoped events Renderer changes: - Split session.messages into visibleMessages and thinkingMessages - Render ThinkingProcess above the last assistant message - ThinkingProcess auto-expands during active turns, collapses on finish - Update messagePhase to skip thinking-kind messages for final detection Tests: - 3 new sessionWorkspace tests for reclassification apply/dedup/ignore - 2 new messagePhase tests for thinking-kind handling - Updated runTurnPending test fixtures for new callback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
|
|
import {
|
|
markRunTurnPendingErrored,
|
|
shouldHandleRunTurnEvent,
|
|
type RunTurnPendingCommand,
|
|
} from '@main/sidecar/runTurnPending';
|
|
|
|
describe('run turn pending helpers', () => {
|
|
test('marks a run-turn pending command as errored and rejects it once', () => {
|
|
const rejected: Error[] = [];
|
|
const pending: RunTurnPendingCommand = {
|
|
kind: 'run-turn',
|
|
resolve: () => undefined,
|
|
reject: (error) => rejected.push(error),
|
|
onDelta: () => undefined,
|
|
onActivity: () => undefined,
|
|
onApproval: () => undefined,
|
|
onUserInput: () => undefined,
|
|
onExitPlanMode: () => undefined,
|
|
onMcpOAuthRequired: () => undefined,
|
|
onMessageReclassified: () => undefined,
|
|
onTurnScopedEvent: () => undefined,
|
|
errored: false,
|
|
};
|
|
|
|
const first = markRunTurnPendingErrored(pending, 'boom');
|
|
const second = markRunTurnPendingErrored(pending, new Error('later'));
|
|
|
|
expect(first).toBeInstanceOf(Error);
|
|
expect(first.message).toBe('boom');
|
|
expect(second.message).toBe('later');
|
|
expect(pending.errored).toBe(true);
|
|
expect(rejected).toHaveLength(1);
|
|
expect(rejected[0].message).toBe('boom');
|
|
});
|
|
|
|
test('stops handling turn events after the pending command has errored', () => {
|
|
const pending: RunTurnPendingCommand = {
|
|
kind: 'run-turn',
|
|
resolve: () => undefined,
|
|
reject: () => undefined,
|
|
onDelta: () => undefined,
|
|
onActivity: () => undefined,
|
|
onApproval: () => undefined,
|
|
onUserInput: () => undefined,
|
|
onExitPlanMode: () => undefined,
|
|
onMcpOAuthRequired: () => undefined,
|
|
onMessageReclassified: () => undefined,
|
|
onTurnScopedEvent: () => undefined,
|
|
errored: false,
|
|
};
|
|
|
|
expect(shouldHandleRunTurnEvent(pending)).toBe(true);
|
|
|
|
markRunTurnPendingErrored(pending, new Error('boom'));
|
|
|
|
expect(shouldHandleRunTurnEvent(pending)).toBe(false);
|
|
});
|
|
});
|