reducer.ts ×31

Frontier kind: Code frontier

unlabeled · c_66910a85f228

198 tests · 11418 LOC · 50 files · introduces 0 tests · 78 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
31 ranges78 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
697 ranges11418 lines · 50 files · Browse complete extent
All tests (intent)
198 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 78 introduced LOC across 31 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.ts 78 introduced LOC · 31 ranges

Open complete file

300 */
301 export function chatReducer(state: ChatState, action: ChatAction, log?: (msg: string) => void): ChatState {
302 > switch (action.type) { reducer.ts
303 > // ── Turn Lifecycle ────────────────────────────────────────────────────
304 >
305 > case ActionType.ChatTurnStarted: {
306 let next: ChatState = {
307 ...state,
333 return next;
334 }
335 > reducer.ts
336 > case ActionType.ChatDelta:
337 return updateResponsePart(state, action.turnId, action.partId, part => {
338 if (part.kind === ResponsePartKind.Markdown) {
341 return part;
342 });
343 > reducer.ts
344 > case ActionType.ChatResponsePart:
345 if (!state.activeTurn || state.activeTurn.id !== action.turnId) {
346 return state;
353 },
354 };
355 > reducer.ts
356 > case ActionType.ChatTurnComplete:
357 return endTurn(state, action.turnId, TurnState.Complete, action.duration);
358 > reducer.ts
359 > case ActionType.ChatTurnCancelled:
360 return endTurn(state, action.turnId, TurnState.Cancelled, action.duration);
361 > reducer.ts
362 > case ActionType.ChatError:
363 return endTurn(state, action.turnId, TurnState.Error, action.duration, SessionStatus.Error, action.error);
364 > reducer.ts
365 > case ActionType.ChatActivityChanged:
366 return { ...state, activity: action.activity };
367 > reducer.ts
368 > // ── Working Directories ───────────────────────────────────────────────
369 >
370 > case ActionType.ChatWorkingDirectorySet: {
371 const list = state.workingDirectories ?? [];
372 if (list.includes(action.directory)) {
375 return { ...state, workingDirectories: [...list, action.directory] };
376 }
377 > reducer.ts
378 > case ActionType.ChatWorkingDirectoryRemoved: {
379 const list = state.workingDirectories;
380 if (!list) {
389 return { ...state, workingDirectories: updated };
390 }
391 > reducer.ts
392 > // ── Tool Call State Machine ───────────────────────────────────────────
393 >
394 > case ActionType.ChatToolCallStart:
395 if (!state.activeTurn || state.activeTurn.id !== action.turnId) {
396 return state;
417 },
418 };
419 > reducer.ts
420 > case ActionType.ChatToolCallDelta:
421 return updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
422 if (tc.status !== ToolCallStatus.Streaming) {
430 };
431 });
432 > reducer.ts
433 > case ActionType.ChatToolCallReady:
434 return refreshSummaryStatus(updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
435 if (
464 };
465 }));
466 > reducer.ts
467 > case ActionType.ChatToolCallConfirmed:
468 return refreshSummaryStatus(updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
469 if (tc.status !== ToolCallStatus.PendingConfirmation) {
493 };
494 }));
495 > reducer.ts
496 > case ActionType.ChatToolCallComplete:
497 return refreshSummaryStatus(updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
498 if (tc.status !== ToolCallStatus.Running && tc.status !== ToolCallStatus.PendingConfirmation && tc.status !== ToolCallStatus.AuthRequired) {
550 };
551 }));
552 > reducer.ts
553 > case ActionType.ChatToolCallResultConfirmed:
554 return refreshSummaryStatus(updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
555 if (tc.status !== ToolCallStatus.PendingResultConfirmation) {
581 };
582 }));
583 > reducer.ts
584 > case ActionType.ChatToolCallContentChanged:
585 return updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
586 if (tc.status !== ToolCallStatus.Running) {
593 };
594 });
595 > reducer.ts
596 > case ActionType.ChatToolCallAuthRequired:
597 return refreshSummaryStatus(updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
598 if (tc.status !== ToolCallStatus.Running) {
616 };
617 }));
618 > reducer.ts
619 > case ActionType.ChatToolCallAuthResolved:
620 return refreshSummaryStatus(updateToolCallInParts(state, action.turnId, action.toolCallId, tc => {
621 if (tc.status !== ToolCallStatus.AuthRequired) {
633 };
634 }));
635 > reducer.ts
636 >
637 > case ActionType.ChatUsage:
638 if (!state.activeTurn || state.activeTurn.id !== action.turnId) {
639 return state;
643 activeTurn: { ...state.activeTurn, usage: action.usage },
644 };
645 > reducer.ts
646 > case ActionType.ChatReasoning:
647 return updateResponsePart(state, action.turnId, action.partId, part => {
648 if (part.kind === ResponsePartKind.Reasoning) {
651 return part;
652 });
653 > reducer.ts
654 >
655 > // ── Truncation ────────────────────────────────────────────────────────
656 >
657 > case ActionType.ChatTruncated: {
658 let turns: typeof state.turns;
659 if (action.turnId === undefined) {
680 };
681 }
682 > reducer.ts
683 > case ActionType.ChatTurnsLoaded: {
684 const existingIds = new Set(state.turns.map(turn => turn.id));
685 const olderTurns = action.turns.filter(turn => !existingIds.has(turn.id));
690 };
691 }
692 > reducer.ts
693 > // ── Session Input Requests ─────────────────────────────────────────────
694 >
695 > case ActionType.ChatInputRequested:
696 return upsertInputRequestPart(state, action.request);
697 > reducer.ts
698 > case ActionType.ChatInputAnswerChanged: {
699 const activeTurn = state.activeTurn;
700 const existing = activeTurn
729 };
730 }
731 > reducer.ts
732 > case ActionType.ChatInputCompleted: {
733 const activeTurn = state.activeTurn;
734 const existing = activeTurn
762 };
763 }
764 > reducer.ts
765 > // ── Pending Messages ──────────────────────────────────────────────────
766 >
767 > case ActionType.ChatPendingMessageSet: {
768 const entry: PendingMessage = { id: action.id, message: action.message };
769 if (action.kind === PendingMessageKind.Steering) {
779 return { ...state, queuedMessages: [...existing, entry] };
780 }
781 > reducer.ts
782 > case ActionType.ChatPendingMessageRemoved: {
783 if (action.kind === PendingMessageKind.Steering) {
784 if (!state.steeringMessage || state.steeringMessage.id !== action.id) {
796 : { ...state, queuedMessages: filtered.length > 0 ? filtered : undefined };
797 }
798 > reducer.ts
799 > case ActionType.ChatQueuedMessagesReordered: {
800 const existing = state.queuedMessages;
801 if (!existing) {
821 return { ...state, queuedMessages: reordered };
822 }
823 > reducer.ts
824 > // ── Draft ─────────────────────────────────────────────────────────────
825 >
826 > case ActionType.ChatDraftChanged:
827 return { ...state, draft: action.draft };
828 > reducer.ts
829 > default:
830 softAssertNever(action, log);
831 return state;
832 > } reducer.ts
833 > }