From f7f64ff341ded4cc64959d05b84fb3c8a1d7120b Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 27 Nov 2024 23:42:15 -0700 Subject: [PATCH 01/14] pause fix, cancelled status --- core/core.ts | 6 ++++-- core/index.d.ts | 11 +++++++++-- core/indexing/CodebaseIndexer.ts | 16 +++++++--------- .../IndexingProgressIndicator.tsx | 1 + .../IndexingProgress/IndexingProgressSubtext.tsx | 1 + .../IndexingProgressTitleText.tsx | 1 + gui/src/util/localStorage.ts | 2 -- 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/core/core.ts b/core/core.ts index a1d74f281..0742a3548 100644 --- a/core/core.ts +++ b/core/core.ts @@ -154,10 +154,10 @@ export class Core { // Index on initialization void this.ide.getWorkspaceDirs().then(async (dirs) => { // Respect pauseCodebaseIndexOnStart user settings - this.indexingPauseToken.paused = true; if (ideSettings.pauseCodebaseIndexOnStart) { + this.indexingPauseToken.paused = true; void this.messenger.request("indexProgress", { - progress: 1, + progress: 0, desc: "Initial Indexing Skipped", status: "paused", }); @@ -803,6 +803,8 @@ export class Core { this.indexingCancellationController.signal, )) { let updateToSend = { ...update }; + // TODO reconsider this status overwrite? + // original goal was to not concern users with edge noncritical errors if (update.status === "failed") { updateToSend.status = "done"; updateToSend.desc = "Indexing complete"; diff --git a/core/index.d.ts b/core/index.d.ts index efb7a18e9..b711b9319 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -42,11 +42,18 @@ export interface IndexingProgressUpdate { progress: number; desc: string; shouldClearIndexes?: boolean; - status: "loading" | "indexing" | "done" | "failed" | "paused" | "disabled"; + status: + | "loading" + | "indexing" + | "done" + | "failed" + | "paused" + | "disabled" + | "cancelled"; debugInfo?: string; } -// This is more or less a V2 of IndexingProgressUpdate +// This is more or less a V2 of IndexingProgressUpdate for docs etc. export interface IndexingStatus { id: string; type: "docs"; diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 5c70f8bad..af204a723 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -145,9 +145,7 @@ export class CodebaseIndexer { } } - async *refreshFiles( - files: string[], - ): AsyncGenerator { + async *refreshFiles(files: string[]): AsyncGenerator { let progress = 0; if (files.length === 0) { yield { @@ -192,9 +190,9 @@ export class CodebaseIndexer { if (dirs.length === 0) { yield { - progress, + progress: 1, desc: "Nothing to index", - status: "disabled", + status: "done", }; return; } @@ -238,9 +236,9 @@ export class CodebaseIndexer { directoryFiles.push(p); if (abortSignal.aborted) { yield { - progress: 1, + progress: 0, desc: "Indexing cancelled", - status: "disabled", + status: "cancelled", }; return; } @@ -263,9 +261,9 @@ export class CodebaseIndexer { // Handle pausing in this loop because it's the only one really taking time if (abortSignal.aborted) { yield { - progress: 1, + progress: 0, desc: "Indexing cancelled", - status: "disabled", + status: "cancelled", }; return; } diff --git a/gui/src/pages/More/IndexingProgress/IndexingProgressIndicator.tsx b/gui/src/pages/More/IndexingProgress/IndexingProgressIndicator.tsx index 944fdc917..83abeed11 100644 --- a/gui/src/pages/More/IndexingProgress/IndexingProgressIndicator.tsx +++ b/gui/src/pages/More/IndexingProgress/IndexingProgressIndicator.tsx @@ -17,6 +17,7 @@ const STATUS_TO_ICON: Record = { paused: PauseCircleIcon, done: CheckCircleIcon, failed: null, // Since we show an erorr message below + cancelled: null, }; function IndexingProgressIndicator({ update }: IndexingProgressIndicatorProps) { diff --git a/gui/src/pages/More/IndexingProgress/IndexingProgressSubtext.tsx b/gui/src/pages/More/IndexingProgress/IndexingProgressSubtext.tsx index 6c07babb0..a73148009 100644 --- a/gui/src/pages/More/IndexingProgress/IndexingProgressSubtext.tsx +++ b/gui/src/pages/More/IndexingProgress/IndexingProgressSubtext.tsx @@ -15,6 +15,7 @@ const STATUS_TO_SUBTITLE_TEXT: Record< paused: "Click to resume", failed: "Click to retry", disabled: "Click to open config.json and enable indexing (requires reload)", + cancelled: "Click to restart", }; function IndexingProgressSubtext({ diff --git a/gui/src/pages/More/IndexingProgress/IndexingProgressTitleText.tsx b/gui/src/pages/More/IndexingProgress/IndexingProgressTitleText.tsx index 61d4bbba6..e15ba5713 100644 --- a/gui/src/pages/More/IndexingProgress/IndexingProgressTitleText.tsx +++ b/gui/src/pages/More/IndexingProgress/IndexingProgressTitleText.tsx @@ -12,6 +12,7 @@ const STATUS_TO_TEXT: Record = { paused: "Indexing paused", failed: "Indexing failed", disabled: "Indexing disabled", + cancelled: "Indexing cancelled", }; function IndexingProgressTitleText({ update }: IndexingProgressTitleTextProps) { diff --git a/gui/src/util/localStorage.ts b/gui/src/util/localStorage.ts index a49f04660..1f3fa7a61 100644 --- a/gui/src/util/localStorage.ts +++ b/gui/src/util/localStorage.ts @@ -1,5 +1,4 @@ import { JSONContent } from "@tiptap/react"; -import { IndexingProgressUpdate } from "core"; import { OnboardingStatus } from "../components/OnboardingCard"; type LocalStorageTypes = { @@ -12,7 +11,6 @@ type LocalStorageTypes = { lastSessionId: string | undefined; [key: `inputHistory_${string}`]: JSONContent[]; extensionVersion: string; - indexingState: IndexingProgressUpdate; showTutorialCard: boolean; shownProfilesIntroduction: boolean; disableIndexing: boolean; From 731b54eb30bd7184e42c397db658020b4a70d5f7 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 10:13:20 -0600 Subject: [PATCH 02/14] feat: move Edit into Chat page --- extensions/vscode/src/commands.ts | 1 + gui/src/App.tsx | 5 - .../CodeToEditCard}/AddFileButton.tsx | 0 .../CodeToEditCard}/AddFileCombobox.tsx | 2 +- .../CodeToEditCard/CodeToEditCard.tsx} | 6 +- .../CodeToEditCard}/CodeToEditListItem.tsx | 8 +- gui/src/components/CodeToEditCard/index.ts | 1 + gui/src/components/Layout.tsx | 16 +- .../components/StepContainer/EditActions.tsx | 22 +- .../StepContainer/ResponseActions.tsx | 5 +- gui/src/components/dialogs/FeedbackDialog.tsx | 64 +++++ .../components/mainInput/ContinueInputBox.tsx | 70 ++++- gui/src/components/mainInput/TipTapEditor.tsx | 40 ++- .../StepContainerPreToolbar.tsx | 10 +- .../markdown/StyledMarkdownPreview.tsx | 2 + gui/src/pages/edit/Edit.tsx | 241 ------------------ gui/src/pages/edit/index.tsx | 1 - gui/src/pages/gui/Chat.tsx | 236 ++++++++++------- gui/src/redux/slices/sessionSlice.ts | 55 +++- gui/src/redux/thunks/completeEdit.ts | 26 ++ .../edit => util}/getMultifileEditPrompt.ts | 0 21 files changed, 409 insertions(+), 402 deletions(-) rename gui/src/{pages/edit => components/CodeToEditCard}/AddFileButton.tsx (100%) rename gui/src/{pages/edit => components/CodeToEditCard}/AddFileCombobox.tsx (98%) rename gui/src/{pages/edit/CodeToEdit.tsx => components/CodeToEditCard/CodeToEditCard.tsx} (94%) rename gui/src/{pages/edit => components/CodeToEditCard}/CodeToEditListItem.tsx (93%) create mode 100644 gui/src/components/CodeToEditCard/index.ts create mode 100644 gui/src/components/dialogs/FeedbackDialog.tsx delete mode 100644 gui/src/pages/edit/Edit.tsx delete mode 100644 gui/src/pages/edit/index.tsx create mode 100644 gui/src/redux/thunks/completeEdit.ts rename gui/src/{pages/edit => util}/getMultifileEditPrompt.ts (100%) diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 96426b88a..bd80fada6 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -581,6 +581,7 @@ const getCommandsMap: ( }, "continue.exitEditMode": async () => { captureCommandTelemetry("exitEditMode"); + editDecorationManager.clear(); await sidebar.webviewProtocol?.request("exitEditMode", undefined); }, // "continue.quickEdit": async (args: QuickEditShowParams) => { diff --git a/gui/src/App.tsx b/gui/src/App.tsx index 8b8d7fcd6..244d811b5 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -5,7 +5,6 @@ import { VscThemeProvider } from "./context/VscTheme"; import useSetup from "./hooks/useSetup"; import { AddNewModel, ConfigureProvider } from "./pages/AddNewModel"; import ConfigErrorPage from "./pages/config-error"; -import Edit from "./pages/edit"; import ErrorPage from "./pages/error"; import Chat from "./pages/gui"; import History from "./pages/history"; @@ -38,10 +37,6 @@ const router = createMemoryRouter([ path: "/stats", element: , }, - { - path: "/edit", - element: , - }, { path: "/addModel", element: , diff --git a/gui/src/pages/edit/AddFileButton.tsx b/gui/src/components/CodeToEditCard/AddFileButton.tsx similarity index 100% rename from gui/src/pages/edit/AddFileButton.tsx rename to gui/src/components/CodeToEditCard/AddFileButton.tsx diff --git a/gui/src/pages/edit/AddFileCombobox.tsx b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx similarity index 98% rename from gui/src/pages/edit/AddFileCombobox.tsx rename to gui/src/components/CodeToEditCard/AddFileCombobox.tsx index 9e36dbaeb..b79365fb1 100644 --- a/gui/src/pages/edit/AddFileCombobox.tsx +++ b/gui/src/components/CodeToEditCard/AddFileCombobox.tsx @@ -4,7 +4,7 @@ import { useSubmenuContextProviders, } from "../../context/SubmenuContextProviders"; import { Combobox } from "@headlessui/react"; -import FileIcon from "../../components/FileIcon"; +import FileIcon from "../FileIcon"; import { useAppSelector } from "../../redux/hooks"; export interface AddFileComboboxProps { diff --git a/gui/src/pages/edit/CodeToEdit.tsx b/gui/src/components/CodeToEditCard/CodeToEditCard.tsx similarity index 94% rename from gui/src/pages/edit/CodeToEdit.tsx rename to gui/src/components/CodeToEditCard/CodeToEditCard.tsx index dd15396fb..3f4ef372d 100644 --- a/gui/src/pages/edit/CodeToEdit.tsx +++ b/gui/src/components/CodeToEditCard/CodeToEditCard.tsx @@ -2,7 +2,7 @@ import { useContext, useState } from "react"; import { useDispatch } from "react-redux"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import CodeToEditListItem from "./CodeToEditListItem"; -import { CodeToEdit, RangeInFileWithContents } from "core"; +import type { CodeToEdit, RangeInFileWithContents } from "core"; import AddFileButton from "./AddFileButton"; import AddFileCombobox from "./AddFileCombobox"; import { XMarkIcon } from "@heroicons/react/24/outline"; @@ -12,7 +12,7 @@ import { removeCodeToEdit, } from "../../redux/slices/sessionSlice"; -export default function WorkingSet() { +export default function CodeToEditCard() { const dispatch = useDispatch(); const ideMessenger = useContext(IdeMessengerContext); const [showAddFileCombobox, setShowAddFileCombobox] = useState(false); @@ -55,7 +55,7 @@ export default function WorkingSet() { } return ( -
+
{title} setShowAddFileCombobox(true)} /> diff --git a/gui/src/pages/edit/CodeToEditListItem.tsx b/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx similarity index 93% rename from gui/src/pages/edit/CodeToEditListItem.tsx rename to gui/src/components/CodeToEditCard/CodeToEditListItem.tsx index cc4170f5a..7627ce5c7 100644 --- a/gui/src/pages/edit/CodeToEditListItem.tsx +++ b/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx @@ -1,11 +1,11 @@ -import FileIcon from "../../components/FileIcon"; +import FileIcon from "../FileIcon"; import { ChevronDownIcon, ChevronRightIcon, XMarkIcon, } from "@heroicons/react/24/outline"; import { useState } from "react"; -import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview"; +import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; import { getLastNPathParts, getMarkdownLanguageTagForFile } from "core/util"; import styled from "styled-components"; import { CodeToEdit } from "core"; @@ -86,8 +86,8 @@ export default function CodeToEditListItem({
-
-
+
+
{showCodeSnippet ? ( { diff --git a/gui/src/components/CodeToEditCard/index.ts b/gui/src/components/CodeToEditCard/index.ts new file mode 100644 index 000000000..2e7d342eb --- /dev/null +++ b/gui/src/components/CodeToEditCard/index.ts @@ -0,0 +1 @@ +export { default } from "./CodeToEditCard"; diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 7ef0315a3..ae264fef0 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -14,9 +14,9 @@ import { import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice"; import { addCodeToEdit, - clearCodeToEdit, updateApplyState, - updateCurCheckpoint, + setMode, + clearCodeToEdit, } from "../redux/slices/sessionSlice"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; @@ -27,6 +27,7 @@ import { isNewUserOnboarding, useOnboardingCard } from "./OnboardingCard"; import PostHogPageView from "./PosthogPageView"; import AccountDialog from "./AccountDialog"; import { AuthProvider } from "../context/Auth"; +import useHistory from "../hooks/useHistory"; const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; @@ -58,6 +59,7 @@ const Layout = () => { const dispatch = useDispatch(); const onboardingCard = useOnboardingCard(); const { pathname } = useLocation(); + const { saveSession } = useHistory(dispatch); const configError = useAppSelector((state) => state.config.configError); @@ -159,9 +161,9 @@ const Layout = () => { useWebviewListener( "focusEdit", async () => { + saveSession(); dispatch(focusEdit()); - dispatch(clearCodeToEdit()); - navigate("/edit"); + dispatch(setMode("edit")); }, [navigate], ); @@ -169,8 +171,9 @@ const Layout = () => { useWebviewListener( "focusEditWithoutClear", async () => { + saveSession(); dispatch(focusEdit()); - navigate("/edit"); + dispatch(setMode("edit")); }, [navigate], ); @@ -195,7 +198,8 @@ const Layout = () => { "exitEditMode", async () => { dispatch(setEditDone()); - navigate("/"); + dispatch(setMode("chat")); + dispatch(clearCodeToEdit()); }, [navigate], ); diff --git a/gui/src/components/StepContainer/EditActions.tsx b/gui/src/components/StepContainer/EditActions.tsx index 4fdecbe54..ebb796f2c 100644 --- a/gui/src/components/StepContainer/EditActions.tsx +++ b/gui/src/components/StepContainer/EditActions.tsx @@ -1,13 +1,14 @@ import { ChatHistoryItem } from "core"; -import { useSelector } from "react-redux"; -import { RootState } from "../../redux/store"; import AcceptRejectAllButtons from "./AcceptRejectAllButtons"; import FeedbackButtons from "./FeedbackButtons"; -import UndoAndRedoButtons from "./UndoAndRedoButtons"; import { renderChatMessage } from "core/util/messageContent"; import { CopyIconButton } from "../gui/CopyIconButton"; -import { useAppSelector } from "../../redux/hooks"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import useHistory from "../../hooks/useHistory"; +import { useContext } from "react"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { completeEdit } from "../../redux/thunks/completeEdit"; export interface EditActionsProps { index: number; @@ -18,6 +19,8 @@ export default function EditActions({ index, item }: EditActionsProps) { // const curCheckpointIndex = useSelector( // (store: RootState) => store.state.curCheckpointIndex, // ); + const dispatch = useAppDispatch(); + const { loadLastSession } = useHistory(dispatch); const isStreaming = useAppSelector((state) => state.session.isStreaming); @@ -55,7 +58,16 @@ export default function EditActions({ index, item }: EditActionsProps) {
{hasPendingApplies && ( - + { + loadLastSession().catch((e) => + console.error(`Failed to load last session: ${e}`), + ); + + dispatch(completeEdit()); + }} + /> )} {/* {hasClosedAllStreams && } */}
diff --git a/gui/src/components/StepContainer/ResponseActions.tsx b/gui/src/components/StepContainer/ResponseActions.tsx index cc5e0aae7..958595aee 100644 --- a/gui/src/components/StepContainer/ResponseActions.tsx +++ b/gui/src/components/StepContainer/ResponseActions.tsx @@ -6,6 +6,7 @@ import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip"; import EditActions from "./EditActions"; import FeedbackButtons from "./FeedbackButtons"; import { useAppSelector } from "../../redux/hooks"; +import { selectIsInEditMode } from "../../redux/slices/sessionSlice"; export interface ResponseActionsProps { isTruncated: boolean; @@ -24,9 +25,7 @@ export default function ResponseActions({ onDelete, shouldHideActions, }: ResponseActionsProps) { - const isInEditMode = useAppSelector( - (store) => store.editModeState.isInEditMode, - ); + const isInEditMode = useAppSelector(selectIsInEditMode); if (isInEditMode) { return ; diff --git a/gui/src/components/dialogs/FeedbackDialog.tsx b/gui/src/components/dialogs/FeedbackDialog.tsx new file mode 100644 index 000000000..d8da4e93b --- /dev/null +++ b/gui/src/components/dialogs/FeedbackDialog.tsx @@ -0,0 +1,64 @@ +import { usePostHog } from "posthog-js/react"; +import { setDialogMessage } from "../../redux/slices/uiSlice"; +import { useAppDispatch } from "../../redux/hooks"; + +export default function FeedbackDialog() { + const posthog = usePostHog(); + const dispatch = useAppDispatch(); + + return ( +
+ 👋 Thanks for using Continue. We are always trying to improve and love + hearing from users. If you're interested in speaking, enter your name and + email. We won't use this information for anything other than reaching out. +
+
+
{ + e.preventDefault(); + posthog?.capture("user_interest_form", { + name: e.target.elements[0].value, + email: e.target.elements[1].value, + }); + dispatch( + setDialogMessage( +
+ Thanks! We'll be in touch soon. +
, + ), + ); + }} + style={{ + display: "flex", + flexDirection: "column", + gap: "10px", + }} + > + + + +
+
+ ); +} diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 94eed2884..176c74dee 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -9,8 +9,11 @@ import ContextItemsPeek from "./ContextItemsPeek"; import TipTapEditor from "./TipTapEditor"; import { useAppSelector } from "../../redux/hooks"; import { newSession, setMessageAtIndex } from "../../redux/slices/sessionSlice"; +import { ToolbarOptions } from "./InputToolbar"; +import { useMemo } from "react"; interface ContinueInputBoxProps { + isEditMode?: boolean; isLastUserInput: boolean; isMainInput?: boolean; onEnter: ( @@ -23,6 +26,18 @@ interface ContinueInputBoxProps { hidden?: boolean; } +const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [ + "codebase", + "tree", + "open", + "web", + "diff", + "folder", + "search", + "debugger", + "repo-map", +]; + const gradient = keyframes` 0% { background-position: 0px 0; @@ -63,7 +78,7 @@ const GradientBorder = styled.div<{ function ContinueInputBox(props: ContinueInputBoxProps) { const dispatch = useDispatch(); - const active = useAppSelector((state) => state.session.isStreaming); + const isStreaming = useAppSelector((state) => state.session.isStreaming); const availableSlashCommands = useAppSelector( selectSlashCommandComboBoxInputs, ); @@ -73,6 +88,42 @@ function ContinueInputBox(props: ContinueInputBoxProps) { const useTools = useAppSelector( (state) => state.config.config.experimental?.useTools !== false, ); + const editModeState = useAppSelector((state) => state.editModeState); + + const filteredSlashCommands = props.isEditMode ? [] : availableSlashCommands; + const filteredContextProviders = useMemo(() => { + if (!props.isEditMode) { + availableContextProviders; + } + + return ( + availableContextProviders?.filter( + (provider) => + !EDIT_DISALLOWED_CONTEXT_PROVIDERS.includes(provider.title), + ) ?? [] + ); + }, [availableContextProviders]); + + const isStreamingEdit = + editModeState.editStatus === "streaming" || + editModeState.editStatus === "accepting"; + + const historyKey = props.isEditMode ? "edit" : "chat"; + const placeholder = props.isEditMode + ? "Describe how to modify the code - use '#' to add files" + : undefined; + const toolbarOptions: ToolbarOptions = props.isEditMode + ? { + hideAddContext: false, + hideImageUpload: false, + hideUseCodebase: true, + hideSelectModel: false, + hideTools: true, + enterText: isStreamingEdit ? "Retry" : "Edit", + } + : { + hideTools: !useTools, + }; useWebviewListener( "newSessionWithPrompt", @@ -92,11 +143,11 @@ function ContinueInputBox(props: ContinueInputBoxProps) { return (
-
+
@@ -108,13 +159,12 @@ function ContinueInputBox(props: ContinueInputBoxProps) { args[2].commands.clearContent(true); } }} + placeholder={placeholder} isMainInput={props.isMainInput ?? false} - availableContextProviders={availableContextProviders ?? []} - availableSlashCommands={availableSlashCommands} - historyKey="chat" - toolbarOptions={{ - hideTools: !useTools, - }} + availableContextProviders={filteredContextProviders} + availableSlashCommands={filteredSlashCommands} + historyKey={historyKey} + toolbarOptions={toolbarOptions} />
diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index e9b7ad433..3d54cb7e5 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -69,7 +69,10 @@ import { selectDefaultModel } from "../../redux/slices/configSlice"; import { addCodeToEdit, clearCodeToEdit, + selectIsInEditMode, + setMode, } from "../../redux/slices/sessionSlice"; +import { setEditDone } from "../../redux/slices/editModeState"; const InputBoxDiv = styled.div<{ border?: string }>` resize: none; @@ -193,10 +196,6 @@ function TipTapEditor(props: TipTapEditorProps) { const isOSREnabled = useIsOSREnabled(); - const isInEditMode = useAppSelector( - (state) => state.editModeState.isInEditMode, - ); - const enterSubmenu = async (editor: Editor, providerId: string) => { const contents = editor.getText(); const indexOfAt = contents.lastIndexOf("@"); @@ -251,8 +250,11 @@ function TipTapEditor(props: TipTapEditorProps) { props.availableSlashCommands, ); - const active = useAppSelector((state) => state.session.isStreaming); - const activeRef = useUpdatingRef(active); + const isStreaming = useAppSelector((state) => state.session.isStreaming); + const isStreamingRef = useUpdatingRef(isStreaming); + + const isInEditMode = useAppSelector(selectIsInEditMode); + const isInEditModeRef = useUpdatingRef(isInEditMode); async function handleImageFile( file: File, @@ -389,7 +391,7 @@ function TipTapEditor(props: TipTapEditorProps) { // If you press cmd+backspace wanting to cancel, // but are inside of a text box, it shouldn't // delete the text - if (activeRef.current) { + if (isStreamingRef.current) { return true; } }, @@ -418,6 +420,18 @@ function TipTapEditor(props: TipTapEditorProps) { return true; } }, + Escape: () => { + if (isInEditModeRef.current) { + dispatch(setMode("chat")); + dispatch(clearCodeToEdit()); + dispatch(setEditDone()); + ideMessenger.post("edit/escape", undefined); + + return true; + } + + return false; + }, ArrowDown: () => { if ( this.editor.state.selection.anchor < @@ -460,7 +474,7 @@ function TipTapEditor(props: TipTapEditorProps) { return `@${props.node.attrs.label || props.node.attrs.id}`; }, }), - isInEditMode + isInEditModeRef.current ? AddCodeToEdit.configure({ HTMLAttributes: { class: "add-code-to-edit", @@ -528,7 +542,7 @@ function TipTapEditor(props: TipTapEditorProps) { }, }, content: props.editorState || mainEditorContent || "", - editable: !active || props.isMainInput, + editable: !isStreaming || props.isMainInput, }); const [shouldHideToolbar, setShouldHideToolbar] = useState(false); @@ -588,7 +602,7 @@ function TipTapEditor(props: TipTapEditorProps) { const onEnterRef = useUpdatingRef( (modifiers: InputModifiers) => { - if (active) { + if (isStreaming) { return; } @@ -611,10 +625,10 @@ function TipTapEditor(props: TipTapEditorProps) { // Re-focus main input after done generating useEffect(() => { - if (editor && !active && props.isMainInput && document.hasFocus()) { + if (editor && !isStreaming && props.isMainInput && document.hasFocus()) { editor.commands.focus(undefined, { scrollIntoView: false }); } - }, [props.isMainInput, active, editor]); + }, [props.isMainInput, isStreaming, editor]); // IDE event listeners useWebviewListener( @@ -918,7 +932,7 @@ function TipTapEditor(props: TipTapEditorProps) { }); }); }} - disabled={active} + disabled={isStreaming} /> diff --git a/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx b/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx index 58707f5eb..61dcfbb3a 100644 --- a/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx +++ b/gui/src/components/markdown/StepContainerPreToolbar/StepContainerPreToolbar.tsx @@ -15,7 +15,10 @@ import GeneratingCodeLoader from "./GeneratingCodeLoader"; import RunInTerminalButton from "./RunInTerminalButton"; import { useAppSelector } from "../../../redux/hooks"; import { selectDefaultModel } from "../../../redux/slices/configSlice"; -import { selectApplyStateByStreamId } from "../../../redux/slices/sessionSlice"; +import { + selectApplyStateByStreamId, + selectIsInEditMode, +} from "../../../redux/slices/sessionSlice"; const TopDiv = styled.div` outline: 1px solid rgba(153, 153, 152); @@ -56,9 +59,7 @@ export default function StepContainerPreToolbar( const ideMessenger = useContext(IdeMessengerContext); const streamIdRef = useRef(uuidv4()); const wasGeneratingRef = useRef(props.isGeneratingCodeBlock); - const isInEditMode = useAppSelector( - (state) => state.editModeState.isInEditMode, - ); + const isInEditMode = useAppSelector(selectIsInEditMode); const [isExpanded, setIsExpanded] = useState( props.expanded ?? (isInEditMode ? false : true), ); @@ -126,6 +127,7 @@ export default function StepContainerPreToolbar( useEffect(() => { const hasCompletedGenerating = wasGeneratingRef.current && !isGeneratingCodeBlock; + const shouldAutoApply = hasCompletedGenerating && isInEditMode; if (shouldAutoApply) { diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 70be76bdc..38f2cebbc 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -222,6 +222,8 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( const language = getLanuageFromClassName(className); + console.log({ language }); + // If we don't have a filepath show the more basic toolbar // that is just action buttons on hover. // We also use this in JB since we haven't yet implemented diff --git a/gui/src/pages/edit/Edit.tsx b/gui/src/pages/edit/Edit.tsx deleted file mode 100644 index 5fcf2afde..000000000 --- a/gui/src/pages/edit/Edit.tsx +++ /dev/null @@ -1,241 +0,0 @@ -import { ArrowLeftIcon } from "@heroicons/react/24/outline"; -import { Editor, JSONContent } from "@tiptap/core"; -import { InputModifiers, RangeInFileWithContents } from "core"; -import { stripImages } from "core/util/messageContent"; -import { useCallback, useContext, useEffect, useMemo } from "react"; -import { useNavigate } from "react-router-dom"; -import ContinueInputBox from "../../components/mainInput/ContinueInputBox"; -import { ToolbarOptions } from "../../components/mainInput/InputToolbar"; -import { NewSessionButton } from "../../components/mainInput/NewSessionButton"; -import resolveEditorContent from "../../components/mainInput/resolveInput"; -import TipTapEditor from "../../components/mainInput/TipTapEditor"; -import StepContainer from "../../components/StepContainer"; -import AcceptRejectAllButtons from "../../components/StepContainer/AcceptRejectAllButtons"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { setEditDone, submitEdit } from "../../redux/slices/editModeState"; -import { streamResponseThunk } from "../../redux/thunks/streamResponse"; -import CodeToEdit from "./CodeToEdit"; -import getMultifileEditPrompt from "./getMultifileEditPrompt"; -import { useAppDispatch, useAppSelector } from "../../redux/hooks"; -import { - clearCodeToEdit, - selectApplyStateByStreamId, -} from "../../redux/slices/sessionSlice"; - -const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [ - "codebase", - "tree", - "open", - "web", - "diff", - "folder", - "search", - "debugger", - "repo-map", -]; - -export default function Edit() { - const dispatch = useAppDispatch(); - const navigate = useNavigate(); - const ideMessenger = useContext(IdeMessengerContext); - const editModeState = useAppSelector((state) => state.editModeState); - const codeToEdit = useAppSelector((state) => state.session.codeToEdit); - const availableContextProviders = useAppSelector( - (state) => state.config.config.contextProviders, - ); - - const filteredContextProviders = useMemo(() => { - return ( - availableContextProviders?.filter( - (provider) => - !EDIT_DISALLOWED_CONTEXT_PROVIDERS.includes(provider.title), - ) ?? [] - ); - }, [availableContextProviders]); - - const history = useAppSelector((state) => state.session.history); - - const applyStates = useAppSelector( - (state) => state.session.codeBlockApplyStates.states, - ); - - const applyState = useAppSelector( - (state) => selectApplyStateByStreamId(state, "edit")?.status ?? "closed", - ); - const isSingleRangeEdit = - codeToEdit.length === 0 || - (codeToEdit.length === 1 && "range" in codeToEdit[0]); - - useEffect(() => { - if (editModeState.editStatus === "done") { - ideMessenger.post("edit/escape", undefined); - navigate("/"); - } - }, [editModeState.editStatus]); - - useEffect(() => { - if (applyState === "closed" && editModeState.editStatus === "accepting") { - dispatch(setEditDone()); - } - }, [applyState, editModeState.editStatus]); - - const pendingApplyStates = applyStates.filter( - (state) => state.status === "done", - ); - - const isStreaming = - editModeState.editStatus === "streaming" || - editModeState.editStatus === "accepting"; - - const toolbarOptions: ToolbarOptions = { - hideAddContext: false, - hideImageUpload: false, - hideUseCodebase: true, - hideSelectModel: false, - hideTools: true, - enterText: isStreaming ? "Retry" : "Edit", - }; - - const hasPendingApplies = pendingApplyStates.length > 0; - - async function handleSingleRangeEdit( - editorState: JSONContent, - modifiers: InputModifiers, - editor: Editor, - ) { - const [contextItems, __, userInstructions] = await resolveEditorContent( - editorState, - { - noContext: true, - useCodebase: false, - }, - ideMessenger, - [], - dispatch, - ); - - const prompt = [ - ...contextItems.map((item) => item.content), - stripImages(userInstructions), - ].join("\n\n"); - - ideMessenger.post("edit/sendPrompt", { - prompt, - range: codeToEdit[0] as RangeInFileWithContents, - }); - - dispatch(submitEdit(prompt)); - editor.commands.selectTextblockEnd(); - } - - async function handleEditorEnter( - editorState: JSONContent, - modifiers: InputModifiers, - editor: Editor, - ) { - if (isSingleRangeEdit) { - handleSingleRangeEdit(editorState, modifiers, editor); - } else { - const promptPreamble = getMultifileEditPrompt(codeToEdit); - - dispatch( - streamResponseThunk({ - editorState, - modifiers, - promptPreamble, - }), - ); - } - } - - function handleBackClick() { - dispatch(setEditDone()); - } - - const isLastUserInput = useCallback( - (index: number): boolean => { - return !history - .slice(index + 1) - .some((entry) => entry.message.role === "user"); - }, - [history], - ); - - return ( -
-
-
- - -
- - {!isSingleRangeEdit && history.length > 1 && ( -
- {history.slice(1).map((item, index: number) => ( -
- {item.message.role === "user" ? ( - { - dispatch( - streamResponseThunk({ - editorState, - modifiers, - index, - }), - ); - }} - isLastUserInput={isLastUserInput(index)} - isMainInput={false} - editorState={item.editorState} - contextItems={item.contextItems} - /> - ) : ( - - )} -
- ))} - - {/* {!active && ( - - )} */} -
- )} - -
- {hasPendingApplies && isSingleRangeEdit && ( - dispatch(clearCodeToEdit())} - /> - )} - - {!hasPendingApplies && isSingleRangeEdit && ( - - - Back to Chat - - )} -
-
-
- ); -} diff --git a/gui/src/pages/edit/index.tsx b/gui/src/pages/edit/index.tsx deleted file mode 100644 index d1c8752c8..000000000 --- a/gui/src/pages/edit/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./Edit"; diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 298d3101d..7b871ec0e 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -4,8 +4,8 @@ import { CodeBracketSquareIcon, ExclamationTriangleIcon, } from "@heroicons/react/24/outline"; -import { JSONContent } from "@tiptap/react"; -import { InputModifiers, ToolCallState } from "core"; +import { Editor, JSONContent } from "@tiptap/react"; +import { InputModifiers, RangeInFileWithContents, ToolCallState } from "core"; import { streamResponse } from "core/llm/stream"; import { usePostHog } from "posthog-js/react"; import { useCallback, useContext, useEffect, useRef, useState } from "react"; @@ -36,9 +36,12 @@ import { useTutorialCard } from "../../hooks/useTutorialCard"; import { useWebviewListener } from "../../hooks/useWebviewListener"; import { selectCurrentToolCall } from "../../redux/selectors/selectCurrentToolCall"; import { + clearCodeToEdit, clearLastEmptyResponse, newSession, + selectIsInEditMode, setInactive, + setMode, } from "../../redux/slices/sessionSlice"; import { streamResponseThunk } from "../../redux/thunks/streamResponse"; import { @@ -60,6 +63,15 @@ import { setShowDialog, } from "../../redux/slices/uiSlice"; import { RootState } from "../../redux/store"; +import FeedbackDialog from "../../components/dialogs/FeedbackDialog"; +import getMultifileEditPrompt from "../../util/getMultifileEditPrompt"; +import { setEditDone, submitEdit } from "../../redux/slices/editModeState"; +import { stripImages } from "core/util/messageContent"; +import resolveEditorContent from "../../components/mainInput/resolveInput"; +import CodeToEdit from "../../components/CodeToEditCard/CodeToEditCard"; +import AcceptRejectAllButtons from "../../components/StepContainer/AcceptRejectAllButtons"; +import CodeToEditCard from "../../components/CodeToEditCard"; +import { completeEdit } from "../../redux/thunks/completeEdit"; const StopButton = styled.div` background-color: ${vscBackground}; @@ -130,16 +142,24 @@ export function Chat() { const mainTextInputRef = useRef(null); const stepsDivRef = useRef(null); const [isAtBottom, setIsAtBottom] = useState(false); - const messages = useAppSelector((state) => state.session.history); + const history = useAppSelector((state) => state.session.history); const showChatScrollbar = useAppSelector( (state) => state.config.config.ui?.showChatScrollbar, ); const { saveSession, getLastSessionId, loadLastSession } = useHistory(dispatch); - + const codeToEdit = useAppSelector((state) => state.session.codeToEdit); const toolCallState = useSelector( selectCurrentToolCall, ); + const applyStates = useAppSelector( + (state) => state.session.codeBlockApplyStates.states, + ); + const pendingApplyStates = applyStates.filter( + (state) => state.status === "done", + ); + const hasPendingApplies = pendingApplyStates.length > 0; + const isInEditMode = useAppSelector(selectIsInEditMode); const snapToBottom = useCallback(() => { if (!stepsDivRef.current) return; @@ -160,6 +180,14 @@ export function Chat() { setIsAtBottom(true); }, [stepsDivRef, setIsAtBottom]); + const returnToLastSessinButtonText = isInEditMode + ? "Back to Chat" + : "Last Session"; + + const isSingleRangeEdit = + codeToEdit.length === 0 || + (codeToEdit.length === 1 && "range" in codeToEdit[0]); + useEffect(() => { if (active) snapToBottom(); }, [active, snapToBottom]); @@ -202,7 +230,7 @@ export function Chat() { const { widget, highlights } = useFindWidget(stepsDivRef); - const sendInput = useCallback( + const sendChatInput = useCallback( (editorState: JSONContent, modifiers: InputModifiers) => { if (defaultModel?.provider === "free-trial") { const u = getLocalStorage("ftc"); @@ -230,64 +258,7 @@ export function Chat() { if (currentCount) { setLocalStorage("mainTextEntryCounter", currentCount + 1); if (currentCount === 300) { - dispatch( - setDialogMessage( -
- 👋 Thanks for using Continue. We are always trying to improve - and love hearing from users. If you're interested in speaking, - enter your name and email. We won't use this information for - anything other than reaching out. -
-
-
{ - e.preventDefault(); - posthog?.capture("user_interest_form", { - name: e.target.elements[0].value, - email: e.target.elements[1].value, - }); - dispatch( - setDialogMessage( -
- Thanks! We'll be in touch soon. -
, - ), - ); - }} - style={{ - display: "flex", - flexDirection: "column", - gap: "10px", - }} - > - - - -
-
, - ), - ); + dispatch(setDialogMessage()); dispatch(setDialogEntryOn(false)); dispatch(setShowDialog(true)); } @@ -295,9 +266,59 @@ export function Chat() { setLocalStorage("mainTextEntryCounter", 1); } }, - [messages, defaultModel, streamResponse], + [history, defaultModel, streamResponse], ); + async function handleSingleRangeEdit( + editorState: JSONContent, + modifiers: InputModifiers, + editor: Editor, + ) { + const [contextItems, __, userInstructions] = await resolveEditorContent( + editorState, + { + noContext: true, + useCodebase: false, + }, + ideMessenger, + [], + dispatch, + ); + + const prompt = [ + ...contextItems.map((item) => item.content), + stripImages(userInstructions), + ].join("\n\n"); + + ideMessenger.post("edit/sendPrompt", { + prompt, + range: codeToEdit[0] as RangeInFileWithContents, + }); + + dispatch(submitEdit(prompt)); + editor.commands.selectTextblockEnd(); + } + + async function sendEditInput( + editorState: JSONContent, + modifiers: InputModifiers, + editor: Editor, + ) { + if (isSingleRangeEdit) { + handleSingleRangeEdit(editorState, modifiers, editor); + } else { + const promptPreamble = getMultifileEditPrompt(codeToEdit); + + dispatch( + streamResponseThunk({ + editorState, + modifiers, + promptPreamble, + }), + ); + } + } + useWebviewListener( "newSession", async () => { @@ -309,11 +330,11 @@ export function Chat() { const isLastUserInput = useCallback( (index: number): boolean => { - return !messages + return !history .slice(index + 1) .some((entry) => entry.message.role === "user"); }, - [messages], + [history], ); const showScrollbar = showChatScrollbar || window.innerHeight > 5000; @@ -323,15 +344,15 @@ export function Chat() { {widget} 0 ? "flex-1" : ""}`} + className={`overflow-y-scroll pt-[8px] ${showScrollbar ? "thin-scrollbar" : "no-scrollbar"} ${history.length > 0 ? "flex-1" : ""}`} onScroll={handleScroll} > {highlights} - {messages.map((item, index: number) => ( + {history.map((item, index: number) => (
{item.message.role === "user" ? ( - { - dispatch( - streamResponseThunk({ editorState, modifiers, index }), - ); - }} - isLastUserInput={isLastUserInput(index)} - isMainInput={false} - editorState={item.editorState} - contextItems={item.contextItems} - /> + <> + {isInEditMode && } + { + dispatch( + streamResponseThunk({ editorState, modifiers, index }), + ); + }} + isLastUserInput={isLastUserInput(index)} + isMainInput={false} + editorState={item.editorState} + contextItems={item.contextItems} + /> + ) : item.message.role === "tool" ? ( @@ -442,13 +466,22 @@ export function Chat() {
{toolCallState?.status === "generated" && } - { - sendInput(editorContent, modifiers); - }} - /> + + {history.length === 0 && isInEditMode && } + + {isInEditMode && history.length > 0 ? null : ( + { + isInEditMode + ? sendEditInput(editorContent, modifiers, editor) + : sendChatInput(editorContent, modifiers); + }} + /> + )} +
- {messages.length === 0 && getLastSessionId() ? ( + {history.length === 0 && + getLastSessionId() && + !hasPendingApplies ? (
{ loadLastSession().catch((e) => console.error(`Failed to load last session: ${e}`), ); + + if (isInEditMode) { + dispatch(completeEdit()); + } }} className="flex items-center gap-2" > - Last Session + {returnToLastSessinButtonText}
) : null} @@ -475,7 +514,20 @@ export function Chat() {
- {messages.length === 0 && ( + {hasPendingApplies && isSingleRangeEdit && ( + { + dispatch(clearCodeToEdit()); + dispatch(setMode("chat")); + loadLastSession().catch((e) => + console.error(`Failed to load last session: ${e}`), + ); + }} + /> + )} + + {history.length === 0 && ( <> {onboardingCard.show && (
@@ -493,7 +545,7 @@ export function Chat() {
diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 5166648cb..592ad1232 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -17,6 +17,7 @@ import { CodeToEdit, ToolCall, ContextItem, + MessageModes, } from "core"; import { incrementalParseJson } from "core/util/incrementalParseJson"; import { renderChatMessage } from "core/util/messageContent"; @@ -42,6 +43,7 @@ type SessionState = { curCheckpointIndex: number; mainEditorContent?: JSONContent; symbols: FileSymbolMap; + mode: MessageModes; codeBlockApplyStates: { states: ApplyState[]; curIndex: number; @@ -52,7 +54,9 @@ function isCodeToEditEqual(a: CodeToEdit, b: CodeToEdit) { return a.filepath === b.filepath && a.contents === b.contents; } -function getDefaultMessage(): ChatHistoryItemWithMessageId { +function getBaseHistoryItem( + lastHistoryItem?: ChatHistoryItemWithMessageId, +): ChatHistoryItemWithMessageId { return { message: { id: uuidv4(), @@ -60,7 +64,7 @@ function getDefaultMessage(): ChatHistoryItemWithMessageId { content: "", }, contextItems: [], - mode: "chat", + mode: lastHistoryItem?.mode ?? "chat", isGatheringContext: false, checkpoint: {}, isBeforeCheckpoint: false, @@ -77,6 +81,7 @@ const initialState: SessionState = { streamAborter: new AbortController(), codeToEdit: [], symbols: {}, + mode: "chat", codeBlockApplyStates: { states: [], curIndex: 0, @@ -150,6 +155,7 @@ export const sessionSlice = createSlice({ }>, ) => { const historyItem = state.history[payload.index]; + const lastHistoryItem = state.history[payload.index - 1]; if (!historyItem) { return; @@ -161,7 +167,7 @@ export const sessionSlice = createSlice({ // Cut off history after the resubmitted message state.history = state.history .slice(0, payload.index + 1) - .concat(getDefaultMessage()); + .concat(getBaseHistoryItem(lastHistoryItem)); state.isStreaming = true; }, @@ -177,15 +183,22 @@ export const sessionSlice = createSlice({ editorState: JSONContent; }>, ) => { + const lastHistoryItem = state.history.at(-1); + const baseHistoryItem = getBaseHistoryItem(lastHistoryItem); + state.history.push({ - ...getDefaultMessage(), - message: { role: "user", ...getDefaultMessage().message }, + ...baseHistoryItem, + message: { ...baseHistoryItem.message, id: uuidv4(), role: "user" }, editorState: payload.editorState, }); state.history.push({ - ...getDefaultMessage(), - message: { role: "assistant", ...getDefaultMessage().message }, + ...baseHistoryItem, + message: { + ...baseHistoryItem.message, + id: uuidv4(), + role: "assistant", + }, editorState: payload.editorState, }); @@ -203,9 +216,12 @@ export const sessionSlice = createSlice({ }>, ) => { if (payload.index >= state.history.length) { + const lastHistoryItem = state.history.at(-1); + const baseHistoryItem = getBaseHistoryItem(lastHistoryItem); + state.history.push({ - ...getDefaultMessage(), - message: { ...getDefaultMessage().message, ...payload.message }, + ...baseHistoryItem, + message: { ...baseHistoryItem.message, ...payload.message }, editorState: { type: "doc", content: renderChatMessage(payload.message) @@ -270,10 +286,13 @@ export const sessionSlice = createSlice({ action.payload.role === "assistant" && action.payload.toolCalls?.length)) ) { + const lastHistoryItem = state.history.at(-1); + const baseHistoryItem = getBaseHistoryItem(lastHistoryItem); + // Create a new message const historyItem: ChatHistoryItemWithMessageId = { - contextItems: [], - message: { id: uuidv4(), ...action.payload }, + ...baseHistoryItem, + message: { ...baseHistoryItem.message, ...action.payload }, }; if (action.payload.role === "assistant" && action.payload.toolCalls) { @@ -475,11 +494,17 @@ export const sessionSlice = createSlice({ toolCallState.status = "calling"; }, + setMode: (state, action: PayloadAction) => { + state.mode = action.payload; + }, }, selectors: { selectIsGatheringContext: (state) => { - const curMessage = state.history.at(-1); - return curMessage?.isGatheringContext || false; + const curHistoryItem = state.history.at(-1); + return curHistoryItem?.isGatheringContext || false; + }, + selectIsInEditMode: (state) => { + return state.mode === "edit"; }, }, extraReducers: (builder) => { @@ -547,8 +572,10 @@ export const { acceptToolCall, setToolGenerated, setToolCallOutput, + setMode, } = sessionSlice.actions; -export const { selectIsGatheringContext } = sessionSlice.selectors; +export const { selectIsGatheringContext, selectIsInEditMode } = + sessionSlice.selectors; export default sessionSlice.reducer; diff --git a/gui/src/redux/thunks/completeEdit.ts b/gui/src/redux/thunks/completeEdit.ts new file mode 100644 index 000000000..57aee7c03 --- /dev/null +++ b/gui/src/redux/thunks/completeEdit.ts @@ -0,0 +1,26 @@ +import { createAsyncThunk } from "@reduxjs/toolkit"; +import { + clearCodeToEdit, + selectIsInEditMode, + setMode, +} from "../slices/sessionSlice"; +import { ThunkApiType } from "../store"; +import { setEditDone } from "../slices/editModeState"; + +export const completeEdit = createAsyncThunk( + "edit/complete", + async (_, { dispatch, extra, getState }) => { + const state = getState(); + const isInEditMode = selectIsInEditMode(state); + + if (!isInEditMode) { + return; + } + + dispatch(setMode("chat")); + dispatch(clearCodeToEdit()); + setEditDone(); + + extra.ideMessenger.post("edit/escape", undefined); + }, +); diff --git a/gui/src/pages/edit/getMultifileEditPrompt.ts b/gui/src/util/getMultifileEditPrompt.ts similarity index 100% rename from gui/src/pages/edit/getMultifileEditPrompt.ts rename to gui/src/util/getMultifileEditPrompt.ts From badeb1c88b7e1f8eb711a8a2cfc8f341ac22f67e Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 10:38:17 -0600 Subject: [PATCH 03/14] fix: selector for `isSingleRangeEdit` --- .../CodeToEditCard/CodeToEditListItem.tsx | 11 +++++--- gui/src/components/Layout.tsx | 25 ++++++------------- .../StepContainer/AcceptRejectAllButtons.tsx | 10 ++++---- gui/src/pages/gui/Chat.tsx | 10 +++----- gui/src/redux/slices/sessionSlice.ts | 14 +++++++++-- gui/src/redux/thunks/index.ts | 8 ++++++ 6 files changed, 43 insertions(+), 35 deletions(-) create mode 100644 gui/src/redux/thunks/index.ts diff --git a/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx b/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx index 7627ce5c7..59f630c9a 100644 --- a/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx +++ b/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx @@ -69,11 +69,11 @@ export default function CodeToEditListItem({
-
+
-
+
{ e.stopPropagation(); onClickFilename(code); @@ -81,11 +81,14 @@ export default function CodeToEditListItem({ > {title} - + + {" "} + {/* Added flex-grow */} {fileSubpath}
+
{showCodeSnippet ? ( diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index ae264fef0..35ddea331 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -1,22 +1,16 @@ import { useEffect, useMemo } from "react"; -import { useDispatch } from "react-redux"; import { Outlet, useLocation, useNavigate } from "react-router-dom"; import styled from "styled-components"; import { CustomScrollbarDiv, defaultBorderRadius } from "."; import { LastSessionProvider } from "../context/LastSessionContext"; import { useWebviewListener } from "../hooks/useWebviewListener"; -import { useAppSelector } from "../redux/hooks"; -import { - setEditDone, - setEditStatus, - focusEdit, -} from "../redux/slices/editModeState"; +import { useAppDispatch, useAppSelector } from "../redux/hooks"; +import { setEditStatus, focusEdit } from "../redux/slices/editModeState"; import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice"; import { addCodeToEdit, updateApplyState, setMode, - clearCodeToEdit, } from "../redux/slices/sessionSlice"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; @@ -28,6 +22,7 @@ import PostHogPageView from "./PosthogPageView"; import AccountDialog from "./AccountDialog"; import { AuthProvider } from "../context/Auth"; import useHistory from "../hooks/useHistory"; +import { completeEdit } from "../redux/thunks"; const LayoutTopDiv = styled(CustomScrollbarDiv)` height: 100%; @@ -56,7 +51,7 @@ const GridDiv = styled.div` const Layout = () => { const navigate = useNavigate(); const location = useLocation(); - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const onboardingCard = useOnboardingCard(); const { pathname } = useLocation(); const { saveSession } = useHistory(dispatch); @@ -194,15 +189,9 @@ const Layout = () => { [], ); - useWebviewListener( - "exitEditMode", - async () => { - dispatch(setEditDone()); - dispatch(setMode("chat")); - dispatch(clearCodeToEdit()); - }, - [navigate], - ); + useWebviewListener("exitEditMode", async () => { + dispatch(completeEdit()); + }); useEffect(() => { const handleKeyDown = (event: any) => { diff --git a/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx b/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx index 632468a65..bc287c5c2 100644 --- a/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx +++ b/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx @@ -3,6 +3,8 @@ import { IdeMessengerContext } from "../../context/IdeMessenger"; import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { ApplyState } from "core"; import { getMetaKeyLabel } from "../../util"; +import { useAppSelector } from "../../redux/hooks"; +import { selectIsSingleRangeEdit } from "../../redux/slices/sessionSlice"; export interface AcceptRejectAllButtonsProps { pendingApplyStates: ApplyState[]; @@ -14,9 +16,7 @@ export default function AcceptRejectAllButtons({ onAcceptOrReject, }: AcceptRejectAllButtonsProps) { const ideMessenger = useContext(IdeMessengerContext); - - // To handle the case of a single-range edit - const hasSinglePendingApplyStates = pendingApplyStates.length === 1; + const isSingleRangeEdit = useAppSelector(selectIsSingleRangeEdit); async function handleAcceptOrReject(status: "acceptDiff" | "rejectDiff") { for (const { filepath, streamId } of pendingApplyStates) { @@ -37,7 +37,7 @@ export default function AcceptRejectAllButtons({ onClick={() => handleAcceptOrReject("rejectDiff")} > - {hasSinglePendingApplyStates ? ( + {isSingleRangeEdit ? ( Reject ({getMetaKeyLabel()}⇧⌫) ) : ( <> @@ -52,7 +52,7 @@ export default function AcceptRejectAllButtons({ onClick={() => handleAcceptOrReject("acceptDiff")} > - {hasSinglePendingApplyStates ? ( + {isSingleRangeEdit ? ( Accept ({getMetaKeyLabel()}⇧⏎) ) : ( <> diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 7b871ec0e..aae4bd80a 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -40,6 +40,7 @@ import { clearLastEmptyResponse, newSession, selectIsInEditMode, + selectIsSingleRangeEdit, setInactive, setMode, } from "../../redux/slices/sessionSlice"; @@ -160,6 +161,7 @@ export function Chat() { ); const hasPendingApplies = pendingApplyStates.length > 0; const isInEditMode = useAppSelector(selectIsInEditMode); + const isSingleRangeEdit = useAppSelector(selectIsSingleRangeEdit); const snapToBottom = useCallback(() => { if (!stepsDivRef.current) return; @@ -184,10 +186,6 @@ export function Chat() { ? "Back to Chat" : "Last Session"; - const isSingleRangeEdit = - codeToEdit.length === 0 || - (codeToEdit.length === 1 && "range" in codeToEdit[0]); - useEffect(() => { if (active) snapToBottom(); }, [active, snapToBottom]); @@ -518,11 +516,11 @@ export function Chat() { { - dispatch(clearCodeToEdit()); - dispatch(setMode("chat")); loadLastSession().catch((e) => console.error(`Failed to load last session: ${e}`), ); + + dispatch(completeEdit()); }} /> )} diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 592ad1232..f11f58dcb 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -506,6 +506,13 @@ export const sessionSlice = createSlice({ selectIsInEditMode: (state) => { return state.mode === "edit"; }, + selectIsSingleRangeEdit: (state) => { + return ( + state.mode === "edit" && + (state.codeToEdit.length === 0 || + (state.codeToEdit.length === 1 && "range" in state.codeToEdit[0])) + ); + }, }, extraReducers: (builder) => { addPassthroughCases(builder, [streamResponseThunk]); @@ -575,7 +582,10 @@ export const { setMode, } = sessionSlice.actions; -export const { selectIsGatheringContext, selectIsInEditMode } = - sessionSlice.selectors; +export const { + selectIsGatheringContext, + selectIsInEditMode, + selectIsSingleRangeEdit, +} = sessionSlice.selectors; export default sessionSlice.reducer; diff --git a/gui/src/redux/thunks/index.ts b/gui/src/redux/thunks/index.ts new file mode 100644 index 000000000..fda8d375d --- /dev/null +++ b/gui/src/redux/thunks/index.ts @@ -0,0 +1,8 @@ +export { completeEdit } from "./completeEdit"; +export { gatherContext } from "./gatherContext"; +export { handleErrors } from "./handleErrors"; +export { resetStateForNewMessage } from "./resetStateForNewMessage"; +export { streamNormalInput } from "./streamNormalInput"; +export { streamResponseThunk } from "./streamResponse"; +export { streamResponseAfterToolCall } from "./streamResponseAfterToolCall"; +export { streamSlashCommand } from "./streamSlashCommand"; From 1e334008c08eb8796510ba6aaac434073c44b3b8 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 11:08:04 -0600 Subject: [PATCH 04/14] fix: load last session when completing edits --- gui/src/components/Layout.tsx | 18 ++++++++++++++--- gui/src/components/mainInput/TipTapEditor.tsx | 20 ++++++++----------- gui/src/redux/slices/editModeState.ts | 3 --- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 35ddea331..50be235f7 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -11,6 +11,7 @@ import { addCodeToEdit, updateApplyState, setMode, + newSession, } from "../redux/slices/sessionSlice"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; @@ -54,7 +55,7 @@ const Layout = () => { const dispatch = useAppDispatch(); const onboardingCard = useOnboardingCard(); const { pathname } = useLocation(); - const { saveSession } = useHistory(dispatch); + const { saveSession, loadLastSession } = useHistory(dispatch); const configError = useAppSelector((state) => state.config.configError); @@ -156,7 +157,7 @@ const Layout = () => { useWebviewListener( "focusEdit", async () => { - saveSession(); + await saveSession(true); dispatch(focusEdit()); dispatch(setMode("edit")); }, @@ -166,7 +167,7 @@ const Layout = () => { useWebviewListener( "focusEditWithoutClear", async () => { - saveSession(); + await saveSession(true); dispatch(focusEdit()); dispatch(setMode("edit")); }, @@ -185,11 +186,22 @@ const Layout = () => { "setEditStatus", async ({ status, fileAfterEdit }) => { dispatch(setEditStatus({ status, fileAfterEdit })); + + if (status === "done") { + loadLastSession().catch((e) => + console.error(`Failed to load last session: ${e}`), + ); + dispatch(completeEdit()); + } }, [], ); useWebviewListener("exitEditMode", async () => { + loadLastSession().catch((e) => + console.error(`Failed to load last session: ${e}`), + ); + dispatch(completeEdit()); }); diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 3d54cb7e5..3d20cc7e3 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -24,7 +24,6 @@ import { useRef, useState, } from "react"; -import { useDispatch } from "react-redux"; import styled from "styled-components"; import { v4 } from "uuid"; import { @@ -64,15 +63,14 @@ import { handleVSCMetaKeyIssues, } from "./handleMetaKeyIssues"; import { ComboBoxItem } from "./types"; -import { useAppSelector } from "../../redux/hooks"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { selectDefaultModel } from "../../redux/slices/configSlice"; import { addCodeToEdit, clearCodeToEdit, selectIsInEditMode, - setMode, } from "../../redux/slices/sessionSlice"; -import { setEditDone } from "../../redux/slices/editModeState"; +import { completeEdit } from "../../redux/thunks"; const InputBoxDiv = styled.div<{ border?: string }>` resize: none; @@ -178,7 +176,7 @@ interface TipTapEditorProps { } function TipTapEditor(props: TipTapEditorProps) { - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const ideMessenger = useContext(IdeMessengerContext); const { getSubmenuContextItems } = useSubmenuContextProviders(); @@ -187,7 +185,7 @@ function TipTapEditor(props: TipTapEditorProps) { const useActiveFile = useAppSelector(selectUseActiveFile); - const { saveSession, loadSession } = useHistory(dispatch); + const { saveSession, loadSession, loadLastSession } = useHistory(dispatch); const posthog = usePostHog(); @@ -422,14 +420,12 @@ function TipTapEditor(props: TipTapEditorProps) { }, Escape: () => { if (isInEditModeRef.current) { - dispatch(setMode("chat")); - dispatch(clearCodeToEdit()); - dispatch(setEditDone()); - ideMessenger.post("edit/escape", undefined); - + loadLastSession().catch((e) => + console.error(`Failed to load last session: ${e}`), + ); + dispatch(completeEdit()); return true; } - return false; }, ArrowDown: () => { diff --git a/gui/src/redux/slices/editModeState.ts b/gui/src/redux/slices/editModeState.ts index ade24ed1f..b0283a0ab 100644 --- a/gui/src/redux/slices/editModeState.ts +++ b/gui/src/redux/slices/editModeState.ts @@ -5,13 +5,11 @@ export interface EditModeState { editStatus: EditStatus; previousInputs: MessageContent[]; fileAfterEdit?: string; - isInEditMode: boolean; } const initialState: EditModeState = { editStatus: "not-started", previousInputs: [], - isInEditMode: false, }; export const editModeStateSlice = createSlice({ @@ -19,7 +17,6 @@ export const editModeStateSlice = createSlice({ initialState, reducers: { focusEdit: (state) => { - // state.isInEditMode = true; state.editStatus = "not-started"; state.previousInputs = []; state.fileAfterEdit = undefined; From ca06d669154be0abb1ff8303576cb575682c8e26 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 13:23:07 -0600 Subject: [PATCH 05/14] chore: update toolCall typos --- gui/src/components/Layout.tsx | 8 ++-- .../components/StepContainer/EditActions.tsx | 2 - gui/src/redux/thunks/cancelTool.ts | 44 +------------------ 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 50be235f7..20a61d8d9 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -157,21 +157,21 @@ const Layout = () => { useWebviewListener( "focusEdit", async () => { - await saveSession(true); + await saveSession(); dispatch(focusEdit()); dispatch(setMode("edit")); }, - [navigate], + [], ); useWebviewListener( "focusEditWithoutClear", async () => { - await saveSession(true); + await saveSession(); dispatch(focusEdit()); dispatch(setMode("edit")); }, - [navigate], + [], ); useWebviewListener( diff --git a/gui/src/components/StepContainer/EditActions.tsx b/gui/src/components/StepContainer/EditActions.tsx index ebb796f2c..55ebcab20 100644 --- a/gui/src/components/StepContainer/EditActions.tsx +++ b/gui/src/components/StepContainer/EditActions.tsx @@ -6,8 +6,6 @@ import { renderChatMessage } from "core/util/messageContent"; import { CopyIconButton } from "../gui/CopyIconButton"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import useHistory from "../../hooks/useHistory"; -import { useContext } from "react"; -import { IdeMessengerContext } from "../../context/IdeMessenger"; import { completeEdit } from "../../redux/thunks/completeEdit"; export interface EditActionsProps { diff --git a/gui/src/redux/thunks/cancelTool.ts b/gui/src/redux/thunks/cancelTool.ts index 03b0cc8ef..89c4e8e12 100644 --- a/gui/src/redux/thunks/cancelTool.ts +++ b/gui/src/redux/thunks/cancelTool.ts @@ -1,15 +1,11 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; -import { - cancelToolCall, - setCalling, - setToolCallOutput, -} from "../slices/sessionSlice"; +import { cancelToolCall } from "../slices/sessionSlice"; import { ThunkApiType } from "../store"; import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall"; export const cancelTool = createAsyncThunk( - "chat/callTool", + "chat/cancelTool", async (_, { dispatch, extra, getState }) => { const state = getState(); const toolCallState = selectCurrentToolCall(state); @@ -40,39 +36,3 @@ export const cancelTool = createAsyncThunk( ); }, ); - -export const callTool = createAsyncThunk( - "chat/callTool", - async (_, { dispatch, extra, getState }) => { - const state = getState(); - const toolCallState = selectCurrentToolCall(state); - - console.log("calling tool", toolCallState.toolCall); - if (!toolCallState) { - return; - } - - if (toolCallState.status !== "generated") { - return; - } - - dispatch(setCalling()); - - const result = await extra.ideMessenger.request("tools/call", { - toolCall: toolCallState.toolCall, - }); - - if (result.status === "success") { - const contextItems = result.content.contextItems; - dispatch(setToolCallOutput(contextItems)); - - // Send to the LLM to continue the conversation - dispatch( - streamResponseAfterToolCall({ - toolCallId: toolCallState.toolCall.id, - toolOutput: contextItems, - }), - ); - } - }, -); From 804283e6c7cec50f3f5ca12f068759ef11991077 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 13:24:33 -0600 Subject: [PATCH 06/14] chore: remove console.log --- gui/src/components/markdown/StyledMarkdownPreview.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 38f2cebbc..70be76bdc 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -222,8 +222,6 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( const language = getLanuageFromClassName(className); - console.log({ language }); - // If we don't have a filepath show the more basic toolbar // that is just action buttons on hover. // We also use this in JB since we haven't yet implemented From 83a20d7f8bfae923582e51caf76ab53c4eeeaaf3 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 13:29:59 -0600 Subject: [PATCH 07/14] Update CodeToEditListItem.tsx --- .../CodeToEditCard/CodeToEditListItem.tsx | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx b/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx index 59f630c9a..b457d3a69 100644 --- a/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx +++ b/gui/src/components/CodeToEditCard/CodeToEditListItem.tsx @@ -16,7 +16,6 @@ export interface CodeToEditListItemProps { onClickFilename: (codeToEdit: CodeToEdit) => void; } -// Easiest method to overwrite the top level styling of the markdown preview const NoPaddingWrapper = styled.div` > * { margin: 0 !important; @@ -67,7 +66,7 @@ export default function CodeToEditListItem({ onClick={() => setShowCodeSnippet((showCodeSnippet) => !showCodeSnippet)} >
@@ -82,22 +81,20 @@ export default function CodeToEditListItem({ {title} - {" "} - {/* Added flex-grow */} {fileSubpath}
-
-
+
+
{showCodeSnippet ? ( { e.stopPropagation(); setShowCodeSnippet(false); }} - className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-md rounded-sm p-0.5 hover:bg-opacity-20" + className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-sm p-0.5 hover:bg-opacity-20" /> ) : ( )}
- { - e.stopPropagation(); - onDelete(code); - }} - className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-md rounded-sm p-0.5 hover:bg-opacity-20" - /> +
+ { + e.stopPropagation(); + onDelete(code); + }} + className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-sm p-0.5 hover:bg-opacity-20" + /> +
From c78c092e1285f430a2898a44920a31517c91e2ee Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 13:43:23 -0600 Subject: [PATCH 08/14] chore: remove mode from msg type --- core/index.d.ts | 1 - gui/src/redux/slices/sessionSlice.ts | 16 +++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index 34212cfac..bd56170b2 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -414,7 +414,6 @@ export interface ChatHistoryItem { modifiers?: InputModifiers; promptLogs?: PromptLog[]; toolCallState?: ToolCallState; - mode?: MessageModes; isGatheringContext?: boolean; checkpoint?: Checkpoint; isBeforeCheckpoint?: boolean; diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index f11f58dcb..ef712b7bf 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -54,9 +54,7 @@ function isCodeToEditEqual(a: CodeToEdit, b: CodeToEdit) { return a.filepath === b.filepath && a.contents === b.contents; } -function getBaseHistoryItem( - lastHistoryItem?: ChatHistoryItemWithMessageId, -): ChatHistoryItemWithMessageId { +function getBaseHistoryItem(): ChatHistoryItemWithMessageId { return { message: { id: uuidv4(), @@ -64,7 +62,6 @@ function getBaseHistoryItem( content: "", }, contextItems: [], - mode: lastHistoryItem?.mode ?? "chat", isGatheringContext: false, checkpoint: {}, isBeforeCheckpoint: false, @@ -167,7 +164,7 @@ export const sessionSlice = createSlice({ // Cut off history after the resubmitted message state.history = state.history .slice(0, payload.index + 1) - .concat(getBaseHistoryItem(lastHistoryItem)); + .concat(getBaseHistoryItem()); state.isStreaming = true; }, @@ -183,8 +180,7 @@ export const sessionSlice = createSlice({ editorState: JSONContent; }>, ) => { - const lastHistoryItem = state.history.at(-1); - const baseHistoryItem = getBaseHistoryItem(lastHistoryItem); + const baseHistoryItem = getBaseHistoryItem(); state.history.push({ ...baseHistoryItem, @@ -216,8 +212,7 @@ export const sessionSlice = createSlice({ }>, ) => { if (payload.index >= state.history.length) { - const lastHistoryItem = state.history.at(-1); - const baseHistoryItem = getBaseHistoryItem(lastHistoryItem); + const baseHistoryItem = getBaseHistoryItem(); state.history.push({ ...baseHistoryItem, @@ -286,8 +281,7 @@ export const sessionSlice = createSlice({ action.payload.role === "assistant" && action.payload.toolCalls?.length)) ) { - const lastHistoryItem = state.history.at(-1); - const baseHistoryItem = getBaseHistoryItem(lastHistoryItem); + const baseHistoryItem = getBaseHistoryItem(); // Create a new message const historyItem: ChatHistoryItemWithMessageId = { From 7c45b5bda4dd8f6e5c6211a2e81a5e930d3b41b6 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 19:36:07 -0600 Subject: [PATCH 09/14] Update Chat.tsx --- gui/src/pages/gui/Chat.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index aae4bd80a..7783af72b 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -322,6 +322,7 @@ export function Chat() { async () => { saveSession(); mainTextInputRef.current?.focus?.(); + dispatch(setMode("chat")); }, [saveSession], ); From 6cd6d62a9599cff0025b86725369e80554aa0523 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Dec 2024 19:51:04 -0600 Subject: [PATCH 10/14] Update Chat.tsx --- gui/src/pages/gui/Chat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 7783af72b..8630c5427 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -322,7 +322,7 @@ export function Chat() { async () => { saveSession(); mainTextInputRef.current?.focus?.(); - dispatch(setMode("chat")); + dispatch(completeEdit()); }, [saveSession], ); From 78a0927b9c1771d683fa585aa7b31be53a3454f8 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 3 Dec 2024 00:45:30 -0500 Subject: [PATCH 11/14] eslint package version --- gui/package-lock.json | 694 +++++++----------------------------------- gui/package.json | 2 +- 2 files changed, 118 insertions(+), 578 deletions(-) diff --git a/gui/package-lock.json b/gui/package-lock.json index 0e6075e35..91410e6df 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -83,7 +83,7 @@ "@vitest/coverage-v8": "^2.1.3", "@vitest/ui": "^2.1.3", "autoprefixer": "^10.4.13", - "eslint": "^9.15.0", + "eslint": "^8", "eslint-plugin-react": "^7.37.2", "eslint-plugin-strict-null-checks": "^0.1.3", "jsdom": "^25.0.1", @@ -972,61 +972,16 @@ "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@eslint/config-array": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", - "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", - "dev": true, - "dependencies": { - "@eslint/object-schema": "^2.1.4", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/config-array/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@eslint/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@eslint/core": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", - "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, "node_modules/@eslint/eslintrc": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", - "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", + "espree": "^9.6.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -1034,7 +989,7 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -1067,12 +1022,15 @@ } }, "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, "engines": { - "node": ">=18" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -1097,33 +1055,12 @@ } }, "node_modules/@eslint/js": { - "version": "9.15.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.15.0.tgz", - "integrity": "sha512-tMTqrY+EzbXmKJR5ToI8lxu7jaN5EdmrBFJpQk5JmSlyLsx6o4t27r883K5xsLuCYCpfKBCGswMSWXsM+jB7lg==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/object-schema": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", - "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", - "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", - "dev": true, - "dependencies": { - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@floating-ui/core": { @@ -1172,48 +1109,12 @@ "react": ">= 16" } }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", - "dev": true, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", - "dev": true, - "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.3.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", - "dev": true, - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", "deprecated": "Use @eslint/config-array instead", "dev": true, - "peer": true, "dependencies": { "@humanwhocodes/object-schema": "^2.0.3", "debug": "^4.3.1", @@ -1228,7 +1129,6 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1239,7 +1139,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -1265,21 +1164,7 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "deprecated": "Use @eslint/object-schema instead", - "dev": true, - "peer": true - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", - "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", - "dev": true, - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } + "dev": true }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -5143,62 +5028,59 @@ } }, "node_modules/eslint": { - "version": "9.15.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.15.0.tgz", - "integrity": "sha512-7CrWySmIibCgT1Os28lUU6upBshZ+GxybLOrmRzi08kS8MBuO8QA7pXEgYgY5W8vK3e74xv0lpjo9DbaGU9Rkw==", + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.19.0", - "@eslint/core": "^0.9.0", - "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.15.0", - "@eslint/plugin-kit": "^0.2.3", - "@humanfs/node": "^0.16.6", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.1", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.5", + "cross-spawn": "^7.0.2", "debug": "^4.3.2", + "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.2.0", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", - "esquery": "^1.5.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", + "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3" + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-plugin-react": { @@ -5296,40 +5178,6 @@ "typescript": ">=3.9.4" } }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", - "dev": true, - "peer": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/@eslint/js": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", - "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", - "dev": true, - "peer": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, "node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", @@ -5537,172 +5385,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "peer": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "peer": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "peer": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "peer": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "peer": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "peer": true - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "peer": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "peer": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/eslint": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", - "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", - "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", - "dev": true, - "peer": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.1", - "@humanwhocodes/config-array": "^0.13.0", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint-plugin-strict-null-checks/node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -5737,12 +5419,11 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/eslint/node_modules/eslint-scope": { + "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, - "peer": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -5754,189 +5435,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", - "dev": true, - "peer": true, - "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "peer": true, - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/flat-cache": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", - "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", - "dev": true, - "peer": true, - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "peer": true, - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "peer": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "peer": true - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "peer": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "peer": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "peer": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "peer": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint-plugin-strict-null-checks/node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "peer": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/eslint-scope": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", - "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint-visitor-keys": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", @@ -6038,6 +5536,30 @@ "node": ">= 8" } }, + "node_modules/eslint/node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -6050,6 +5572,21 @@ "node": ">=10.13.0" } }, + "node_modules/eslint/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/eslint/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -6135,17 +5672,29 @@ } }, "node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "dependencies": { - "acorn": "^8.14.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -6336,15 +5885,15 @@ "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==" }, "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, "dependencies": { - "flat-cache": "^4.0.0" + "flat-cache": "^3.0.4" }, "engines": { - "node": ">=16.0.0" + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/file-type": { @@ -6437,16 +5986,17 @@ } }, "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, "dependencies": { "flatted": "^3.2.9", - "keyv": "^4.5.4" + "keyv": "^4.5.3", + "rimraf": "^3.0.2" }, "engines": { - "node": ">=16" + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/flatted": { @@ -6603,8 +6153,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, - "peer": true + "dev": true }, "node_modules/fsevents": { "version": "2.3.3", @@ -7585,7 +7134,6 @@ "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, - "peer": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -7918,7 +7466,6 @@ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true, - "peer": true, "engines": { "node": ">=8" } @@ -9761,7 +9308,6 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, - "peer": true, "engines": { "node": ">=0.10.0" } @@ -11421,7 +10967,6 @@ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, - "peer": true, "dependencies": { "glob": "^7.1.3" }, @@ -11437,7 +10982,6 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -11449,7 +10993,6 @@ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "peer": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -11470,7 +11013,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -12313,8 +11855,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "peer": true + "dev": true }, "node_modules/thenify": { "version": "3.3.1", @@ -12614,7 +12155,6 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, - "peer": true, "engines": { "node": ">=10" }, diff --git a/gui/package.json b/gui/package.json index 5d233766e..b5e16103d 100644 --- a/gui/package.json +++ b/gui/package.json @@ -91,7 +91,7 @@ "@vitest/coverage-v8": "^2.1.3", "@vitest/ui": "^2.1.3", "autoprefixer": "^10.4.13", - "eslint": "^9.15.0", + "eslint": "^8", "eslint-plugin-react": "^7.37.2", "eslint-plugin-strict-null-checks": "^0.1.3", "jsdom": "^25.0.1", From 4616f0ecd7c9ce42464a47f1668cf94fd1d2b6bf Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 3 Dec 2024 01:07:52 -0500 Subject: [PATCH 12/14] remove pre on error page --- gui/src/pages/error.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/src/pages/error.tsx b/gui/src/pages/error.tsx index 6e83f0c22..96171886a 100644 --- a/gui/src/pages/error.tsx +++ b/gui/src/pages/error.tsx @@ -31,12 +31,12 @@ const ErrorPage: React.FC = () => { }, 500); }, []); return ( -
+

Error in Continue UI

-
-        {error.statusText || error.message}
-      
+ + {error.statusText || error.message} +
- {hasPendingApplies && isSingleRangeEdit && ( + {hasPendingApplies && isSingleRangeEditOrInsertion && ( { @@ -521,7 +504,7 @@ export function Chat() { console.error(`Failed to load last session: ${e}`), ); - dispatch(completeEdit()); + dispatch(exitEditMode()); }} /> )} diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index ef712b7bf..d3d4f0da4 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -51,7 +51,22 @@ type SessionState = { }; function isCodeToEditEqual(a: CodeToEdit, b: CodeToEdit) { - return a.filepath === b.filepath && a.contents === b.contents; + if (a.filepath !== b.filepath || a.contents !== b.contents) { + return false; + } + + if ("range" in a && "range" in b) { + const rangeA = a.range; + const rangeB = b.range; + + return ( + rangeA.start.line === rangeB.start.line && + rangeA.end.line === rangeB.end.line + ); + } + + // If neither has a range, they are considered equal in this context + return !("range" in a) && !("range" in b); } function getBaseHistoryItem(): ChatHistoryItemWithMessageId { @@ -500,12 +515,16 @@ export const sessionSlice = createSlice({ selectIsInEditMode: (state) => { return state.mode === "edit"; }, - selectIsSingleRangeEdit: (state) => { - return ( - state.mode === "edit" && - (state.codeToEdit.length === 0 || - (state.codeToEdit.length === 1 && "range" in state.codeToEdit[0])) - ); + selectIsSingleRangeEditOrInsertion: (state) => { + if (state.mode !== "edit") { + return false; + } + + const isInsertion = state.codeToEdit.length === 0; + const selectIsSingleRangeEdit = + state.codeToEdit.length === 1 && "range" in state.codeToEdit[0]; + + return selectIsSingleRangeEdit || isInsertion; }, }, extraReducers: (builder) => { @@ -579,7 +598,7 @@ export const { export const { selectIsGatheringContext, selectIsInEditMode, - selectIsSingleRangeEdit, + selectIsSingleRangeEditOrInsertion, } = sessionSlice.selectors; export default sessionSlice.reducer; diff --git a/gui/src/redux/thunks/completeEdit.ts b/gui/src/redux/thunks/exitEditMode.ts similarity index 61% rename from gui/src/redux/thunks/completeEdit.ts rename to gui/src/redux/thunks/exitEditMode.ts index 57aee7c03..9faba123a 100644 --- a/gui/src/redux/thunks/completeEdit.ts +++ b/gui/src/redux/thunks/exitEditMode.ts @@ -2,16 +2,19 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; import { clearCodeToEdit, selectIsInEditMode, + selectIsSingleRangeEditOrInsertion, setMode, } from "../slices/sessionSlice"; import { ThunkApiType } from "../store"; import { setEditDone } from "../slices/editModeState"; -export const completeEdit = createAsyncThunk( +export const exitEditMode = createAsyncThunk( "edit/complete", async (_, { dispatch, extra, getState }) => { const state = getState(); const isInEditMode = selectIsInEditMode(state); + const isSingleRangeEditOrInsertion = + selectIsSingleRangeEditOrInsertion(state); if (!isInEditMode) { return; @@ -19,8 +22,10 @@ export const completeEdit = createAsyncThunk( dispatch(setMode("chat")); dispatch(clearCodeToEdit()); - setEditDone(); + dispatch(setEditDone()); - extra.ideMessenger.post("edit/escape", undefined); + extra.ideMessenger.post("edit/exit", { + shouldFocusEditor: isSingleRangeEditOrInsertion, + }); }, ); diff --git a/gui/src/redux/thunks/index.ts b/gui/src/redux/thunks/index.ts index fda8d375d..c35189de3 100644 --- a/gui/src/redux/thunks/index.ts +++ b/gui/src/redux/thunks/index.ts @@ -1,4 +1,4 @@ -export { completeEdit } from "./completeEdit"; +export { exitEditMode } from "./exitEditMode"; export { gatherContext } from "./gatherContext"; export { handleErrors } from "./handleErrors"; export { resetStateForNewMessage } from "./resetStateForNewMessage"; From 2e1107f0210a48b9f0a12fd8d65588b4129f2991 Mon Sep 17 00:00:00 2001 From: Test Date: Tue, 3 Dec 2024 14:31:14 -0800 Subject: [PATCH 14/14] Update VsCodeMessenger.ts --- extensions/vscode/src/extension/VsCodeMessenger.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 3460f5627..5133788ce 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -31,7 +31,6 @@ import { getFullyQualifiedPath } from "../util/util"; import { getExtensionUri } from "../util/vscode"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; -import { hideGUI } from "../commands"; /** * A shared messenger class between Core and Webview