Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { useDraftStore } from "@features/message-editor/stores/draftStore";
import { CHAT_CONTENT_MAX_WIDTH } from "@features/sessions/constants";
import { useSessionForTask } from "@features/sessions/hooks/useSession";
import {
useAdapterForTask,
useModeConfigOptionForTask,
usePendingPermissionsForTask,
useThoughtLevelConfigOptionForTask,
} from "@features/sessions/stores/sessionStore";
import type { Plan } from "@features/sessions/types";
import { useSettingsStore } from "@features/settings/stores/settingsStore";
Expand All @@ -36,6 +38,7 @@ import { ConversationView } from "./ConversationView";
import { DropZoneOverlay } from "./DropZoneOverlay";
import { ModelSelector } from "./ModelSelector";
import { PlanStatusBar } from "./PlanStatusBar";
import { ReasoningLevelSelector } from "./ReasoningLevelSelector";
import { RawLogsView } from "./raw-logs/RawLogsView";

interface SessionViewProps {
Expand Down Expand Up @@ -122,6 +125,8 @@ export function SessionView({
const { setShowRawLogs } = useSessionViewActions();
const pendingPermissions = usePendingPermissionsForTask(taskId);
const modeOption = useModeConfigOptionForTask(taskId);
const thoughtOption = useThoughtLevelConfigOptionForTask(taskId);
const adapter = useAdapterForTask(taskId);
const { allowBypassPermissions } = useSettingsStore();
const currentModeId = modeOption?.currentValue;
const handoffInProgress =
Expand Down Expand Up @@ -157,6 +162,18 @@ export function SessionView({
[taskId],
);

const handleThoughtChange = useCallback(
(value: string) => {
if (!taskId || !thoughtOption) return;
getSessionService().setSessionConfigOption(
taskId,
thoughtOption.id,
value,
);
},
[taskId, thoughtOption],
);

const sessionId = taskId ?? "default";
const setContext = useDraftStore((s) => s.actions.setContext);
const requestFocus = useDraftStore((s) => s.actions.requestFocus);
Expand Down Expand Up @@ -616,6 +633,16 @@ export function SessionView({
disabled={!isRunning}
/>
}
reasoningSelector={
thoughtOption ? (
<ReasoningLevelSelector
thoughtOption={thoughtOption}
adapter={adapter}
onChange={handleThoughtChange}
disabled={!isRunning}
/>
) : null
}
onBeforeSubmit={onBeforeSubmit}
onSubmit={handleSubmit}
onBashCommand={onBashCommand}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ describe("buildExitPlanModePermissionOptions", () => {
expect(options[options.length - 1].optionId).toBe("reject_with_feedback");
});

it("promotes the previous mode to the first position with a continue label", () => {
const options = buildExitPlanModePermissionOptions("default");
expect(options[0]).toMatchObject({
optionId: "default",
name: "Yes, continue manually approving edits",
});
expect(options[options.length - 1].optionId).toBe("reject_with_feedback");
});

it("relabels the auto option when it is the previous mode", () => {
const options = buildExitPlanModePermissionOptions("auto");
expect(options[0]).toMatchObject({
optionId: "auto",
name: 'Yes, continue in "auto" mode',
});
});

it("relabels the acceptEdits option when it is the previous mode", () => {
const options = buildExitPlanModePermissionOptions("acceptEdits");
expect(options[0]).toMatchObject({
optionId: "acceptEdits",
name: "Yes, continue auto-accepting edits",
});
});
it.each([
{
previousMode: "default",
expectedName: "Yes, continue manually approving edits",
},
{
previousMode: "auto",
expectedName: 'Yes, continue in "auto" mode',
},
{
previousMode: "acceptEdits",
expectedName: "Yes, continue auto-accepting edits",
},
])(
"promotes the $previousMode mode to the first position with a continue label",
({ previousMode, expectedName }) => {
const options = buildExitPlanModePermissionOptions(previousMode);
expect(options[0]).toMatchObject({
optionId: previousMode,
name: expectedName,
});
expect(options[options.length - 1].optionId).toBe("reject_with_feedback");
},
);

it("ignores an unknown previous mode", () => {
const options = buildExitPlanModePermissionOptions("plan");
Expand Down
Loading