Elffuss BraidHub

kikocis/continue public

35c0ed0a3308 · 778 BRawPermalink
1import { createSelector } from "@reduxjs/toolkit";
2import { RootState } from "../store";
3import { findCurrentToolCall } from "../util";
4
5export const selectCurrentToolCall = createSelector(
6 (store: RootState) => store.session.history,
7 (history) => {
8 return findCurrentToolCall(history);
9 },
10);
11
12export const selectCurrentToolCallApplyState = createSelector(
13 [
14 (store: RootState) => store.session.history,
15 (store: RootState) => store.session.codeBlockApplyStates,
16 ],
17 (history, applyStates) => {
18 const currentToolCall = findCurrentToolCall(history);
19 if (!currentToolCall) {
20 return undefined;
21 }
22 return applyStates.states.find(
23 (state) =>
24 state.toolCallId && state.toolCallId === currentToolCall.toolCallId,
25 );
26 },
27);