2025-06-01 18:30:29 -07:00
|
|
|
import React, {
|
|
|
|
|
createContext,
|
|
|
|
|
useContext,
|
|
|
|
|
ReactNode,
|
|
|
|
|
useState,
|
|
|
|
|
useEffect,
|
|
|
|
|
} from "react";
|
2025-05-28 12:26:47 -07:00
|
|
|
import { useStream } from "@langchain/langgraph-sdk/react";
|
|
|
|
|
import {
|
|
|
|
|
uiMessageReducer,
|
|
|
|
|
isUIMessage,
|
|
|
|
|
isRemoveUIMessage,
|
|
|
|
|
type UIMessage,
|
|
|
|
|
type RemoveUIMessage,
|
|
|
|
|
} from "@langchain/langgraph-sdk/react-ui";
|
|
|
|
|
import { useQueryState } from "nuqs";
|
|
|
|
|
import { LangGraphLogoSVG } from "@/components/icons/langgraph";
|
2025-06-18 11:03:39 -07:00
|
|
|
import { useThreadsContext } from "./Thread";
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
import { TooltipIconButton } from "@/components/ui/tooltip-icon-button";
|
2025-06-01 18:30:29 -07:00
|
|
|
import { Copy, CopyCheck, ArrowRight } from "lucide-react";
|
2025-05-28 13:25:30 -07:00
|
|
|
import { motion } from "framer-motion";
|
2025-06-01 18:30:29 -07:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { GitHubSVG } from "@/components/icons/github";
|
|
|
|
|
import { useGitHubToken } from "@/hooks/useGitHubToken";
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
import { GraphState, GraphUpdate } from "@open-swe/shared/open-swe/types";
|
2025-06-19 11:53:56 -07:00
|
|
|
import {
|
|
|
|
|
CustomNodeEvent,
|
|
|
|
|
isCustomNodeEvent,
|
|
|
|
|
} from "@open-swe/shared/open-swe/custom-node-events";
|
2025-05-28 12:26:47 -07:00
|
|
|
|
|
|
|
|
const useTypedStream = useStream<
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
GraphState,
|
2025-05-28 12:26:47 -07:00
|
|
|
{
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
UpdateType: GraphUpdate;
|
2025-05-28 12:26:47 -07:00
|
|
|
CustomEventType: UIMessage | RemoveUIMessage;
|
|
|
|
|
}
|
|
|
|
|
>;
|
|
|
|
|
|
2025-06-19 11:53:56 -07:00
|
|
|
type StreamContextType = ReturnType<typeof useTypedStream> & {
|
|
|
|
|
customEvents: CustomNodeEvent[];
|
|
|
|
|
};
|
2025-05-28 12:26:47 -07:00
|
|
|
const StreamContext = createContext<StreamContextType | undefined>(undefined);
|
|
|
|
|
|
|
|
|
|
async function sleep(ms = 4000) {
|
|
|
|
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const StreamSession = ({
|
|
|
|
|
children,
|
|
|
|
|
apiUrl,
|
|
|
|
|
assistantId,
|
2025-06-01 18:30:29 -07:00
|
|
|
githubToken,
|
2025-05-28 12:26:47 -07:00
|
|
|
}: {
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
apiUrl: string;
|
|
|
|
|
assistantId: string;
|
2025-06-01 18:30:29 -07:00
|
|
|
githubToken: string;
|
2025-05-28 12:26:47 -07:00
|
|
|
}) => {
|
|
|
|
|
const [threadId, setThreadId] = useQueryState("threadId");
|
2025-06-19 11:53:56 -07:00
|
|
|
const [customEvents, setCustomEvents] = useState<CustomNodeEvent[]>([]);
|
|
|
|
|
const { refreshThreads } = useThreadsContext();
|
2025-05-28 12:26:47 -07:00
|
|
|
const streamValue = useTypedStream({
|
|
|
|
|
apiUrl,
|
|
|
|
|
assistantId,
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
reconnectOnMount: true,
|
2025-05-28 12:26:47 -07:00
|
|
|
threadId: threadId ?? null,
|
|
|
|
|
onCustomEvent: (event, options) => {
|
2025-06-19 11:53:56 -07:00
|
|
|
if (isCustomNodeEvent(event)) {
|
|
|
|
|
setCustomEvents((prev) => [...prev, event]);
|
|
|
|
|
}
|
2025-05-28 12:26:47 -07:00
|
|
|
if (isUIMessage(event) || isRemoveUIMessage(event)) {
|
|
|
|
|
options.mutate((prev) => {
|
|
|
|
|
const ui = uiMessageReducer(prev.ui ?? [], event);
|
|
|
|
|
return { ...prev, ui };
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onThreadId: (id) => {
|
|
|
|
|
setThreadId(id);
|
2025-06-11 16:40:11 -07:00
|
|
|
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
sleep().then(() => {
|
|
|
|
|
refreshThreads().catch(console.error);
|
|
|
|
|
});
|
2025-05-28 12:26:47 -07:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return (
|
2025-06-19 11:53:56 -07:00
|
|
|
<StreamContext.Provider
|
|
|
|
|
value={{
|
|
|
|
|
...streamValue,
|
|
|
|
|
customEvents,
|
|
|
|
|
}}
|
|
|
|
|
>
|
2025-05-28 12:26:47 -07:00
|
|
|
{children}
|
|
|
|
|
</StreamContext.Provider>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const StreamProvider: React.FC<{ children: ReactNode }> = ({
|
|
|
|
|
children,
|
|
|
|
|
}) => {
|
2025-05-28 13:25:30 -07:00
|
|
|
const baseCopyTooltipText = "Copy environment variables";
|
|
|
|
|
const [copyTooltipText, setCopyTooltipText] = useState(baseCopyTooltipText);
|
2025-05-28 12:26:47 -07:00
|
|
|
|
2025-05-28 13:25:30 -07:00
|
|
|
const apiUrl: string | undefined = process.env.NEXT_PUBLIC_API_URL ?? "";
|
|
|
|
|
const assistantId: string | undefined =
|
|
|
|
|
process.env.NEXT_PUBLIC_ASSISTANT_ID ?? "";
|
2025-05-28 12:26:47 -07:00
|
|
|
|
2025-06-01 18:30:29 -07:00
|
|
|
const [isAuth, setIsAuth] = useState<boolean | null>(null);
|
|
|
|
|
const [isLoading, setIsLoading] = useState(false);
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
|
2025-06-01 18:30:29 -07:00
|
|
|
const [hasGitHubAppInstalled, setHasGitHubAppInstalled] = useState<
|
|
|
|
|
boolean | null
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
>(() => {
|
|
|
|
|
if (typeof window === "undefined") return null;
|
|
|
|
|
const cached = localStorage.getItem("github_app_installed");
|
|
|
|
|
return cached === "true" ? true : cached === "false" ? false : null;
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-01 18:30:29 -07:00
|
|
|
const [isCheckingAppInstallation, setIsCheckingAppInstallation] =
|
|
|
|
|
useState(false);
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
const {
|
|
|
|
|
token: githubToken,
|
|
|
|
|
fetchToken: fetchGitHubToken,
|
|
|
|
|
isLoading: isTokenLoading,
|
|
|
|
|
} = useGitHubToken();
|
2025-06-01 18:30:29 -07:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
checkAuthStatus();
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (isAuth) {
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
const cachedInstallationStatus = localStorage.getItem(
|
|
|
|
|
"github_app_installed",
|
|
|
|
|
);
|
|
|
|
|
if (cachedInstallationStatus === "true") {
|
|
|
|
|
setHasGitHubAppInstalled(true);
|
|
|
|
|
// Fetch token if we don't have one yet
|
|
|
|
|
if (!githubToken && !isTokenLoading) {
|
|
|
|
|
fetchGitHubToken();
|
|
|
|
|
}
|
|
|
|
|
} else if (cachedInstallationStatus === "false") {
|
|
|
|
|
setHasGitHubAppInstalled(false);
|
|
|
|
|
} else {
|
|
|
|
|
checkGitHubAppInstallation();
|
|
|
|
|
}
|
2025-06-01 18:30:29 -07:00
|
|
|
}
|
2025-06-11 14:00:08 -07:00
|
|
|
}, [isAuth, githubToken]);
|
2025-06-01 18:30:29 -07:00
|
|
|
|
|
|
|
|
const checkAuthStatus = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch("/api/auth/status");
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
setIsAuth(data.authenticated);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error checking auth status:", error);
|
|
|
|
|
setIsAuth(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const checkGitHubAppInstallation = async () => {
|
|
|
|
|
setIsCheckingAppInstallation(true);
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch("/api/github/repositories");
|
|
|
|
|
if (response.ok) {
|
|
|
|
|
setHasGitHubAppInstalled(true);
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
localStorage.setItem("github_app_installed", "true");
|
2025-06-11 16:40:11 -07:00
|
|
|
|
2025-06-01 18:30:29 -07:00
|
|
|
await fetchGitHubToken();
|
|
|
|
|
} else {
|
|
|
|
|
const errorData = await response.json();
|
|
|
|
|
if (errorData.error.includes("installation")) {
|
|
|
|
|
setHasGitHubAppInstalled(false);
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
localStorage.setItem("github_app_installed", "false");
|
2025-06-01 18:30:29 -07:00
|
|
|
} else {
|
|
|
|
|
setHasGitHubAppInstalled(false);
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
localStorage.setItem("github_app_installed", "false");
|
2025-06-01 18:30:29 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error checking GitHub App installation:", error);
|
|
|
|
|
setHasGitHubAppInstalled(false);
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
localStorage.setItem("github_app_installed", "false");
|
2025-06-01 18:30:29 -07:00
|
|
|
} finally {
|
|
|
|
|
setIsCheckingAppInstallation(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleLogin = () => {
|
|
|
|
|
setIsLoading(true);
|
|
|
|
|
window.location.href = "/api/auth/github/login";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleInstallGitHubApp = () => {
|
|
|
|
|
setIsLoading(true);
|
2025-06-11 16:40:11 -07:00
|
|
|
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
localStorage.removeItem("github_app_installed");
|
2025-06-01 18:30:29 -07:00
|
|
|
window.location.href = "/api/github/installation";
|
|
|
|
|
};
|
|
|
|
|
|
2025-05-28 13:25:30 -07:00
|
|
|
if (!apiUrl || !assistantId) {
|
2025-05-28 12:26:47 -07:00
|
|
|
return (
|
|
|
|
|
<div className="flex min-h-screen w-full items-center justify-center p-4">
|
2025-05-28 13:25:30 -07:00
|
|
|
<div className="animate-in fade-in-0 zoom-in-95 flex max-w-3xl flex-col rounded-lg border bg-red-50 shadow-lg">
|
|
|
|
|
<div className="flex flex-col gap-4 border-b p-6">
|
2025-05-28 12:26:47 -07:00
|
|
|
<div className="flex flex-col items-start gap-2">
|
|
|
|
|
<LangGraphLogoSVG className="h-7" />
|
|
|
|
|
<h1 className="text-xl font-semibold tracking-tight">
|
2025-05-28 13:25:30 -07:00
|
|
|
Environment Variables Missing
|
2025-05-28 12:26:47 -07:00
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-muted-foreground">
|
2025-05-28 13:25:30 -07:00
|
|
|
Whoops, looks like you don't have an API URL or assistant ID
|
|
|
|
|
set in your environment variables. Please make sure you have both
|
|
|
|
|
of these set before continuing.
|
2025-05-28 12:26:47 -07:00
|
|
|
</p>
|
2025-05-28 13:25:30 -07:00
|
|
|
<div className="relative">
|
|
|
|
|
<TooltipIconButton
|
|
|
|
|
onClick={() => {
|
|
|
|
|
const textToCopy = `NEXT_PUBLIC_API_URL=${apiUrl}\nNEXT_PUBLIC_ASSISTANT_ID=${assistantId}`;
|
|
|
|
|
navigator.clipboard.writeText(textToCopy).then(() => {
|
|
|
|
|
setCopyTooltipText("Copied!");
|
|
|
|
|
setTimeout(
|
|
|
|
|
() => setCopyTooltipText(baseCopyTooltipText),
|
|
|
|
|
2000,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
className="absolute top-2 right-2 cursor-pointer"
|
|
|
|
|
tooltip={copyTooltipText}
|
2025-05-28 12:26:47 -07:00
|
|
|
>
|
2025-05-28 13:25:30 -07:00
|
|
|
{copyTooltipText === baseCopyTooltipText ? (
|
|
|
|
|
<motion.div
|
|
|
|
|
key="check"
|
|
|
|
|
initial={{ opacity: 0, scale: 0.8 }}
|
|
|
|
|
animate={{ opacity: 1, scale: 1 }}
|
|
|
|
|
exit={{ opacity: 0, scale: 0.8 }}
|
|
|
|
|
transition={{ duration: 0.15 }}
|
|
|
|
|
>
|
|
|
|
|
<Copy />
|
|
|
|
|
</motion.div>
|
|
|
|
|
) : (
|
|
|
|
|
<motion.div
|
|
|
|
|
key="copy"
|
|
|
|
|
initial={{ opacity: 0, scale: 0.8 }}
|
|
|
|
|
animate={{ opacity: 1, scale: 1 }}
|
|
|
|
|
exit={{ opacity: 0, scale: 0.8 }}
|
|
|
|
|
transition={{ duration: 0.15 }}
|
|
|
|
|
>
|
|
|
|
|
<CopyCheck className="text-green-500" />
|
|
|
|
|
</motion.div>
|
|
|
|
|
)}
|
|
|
|
|
</TooltipIconButton>
|
|
|
|
|
<code className="bg-muted flex flex-col gap-2 rounded-md border border-red-200 px-4 py-3 text-sm">
|
|
|
|
|
<span>NEXT_PUBLIC_API_URL={apiUrl}</span>
|
|
|
|
|
<span>NEXT_PUBLIC_ASSISTANT_ID={assistantId}</span>
|
|
|
|
|
</code>
|
2025-05-28 12:26:47 -07:00
|
|
|
</div>
|
2025-05-28 13:25:30 -07:00
|
|
|
</div>
|
2025-05-28 12:26:47 -07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-01 18:30:29 -07:00
|
|
|
if (!isAuth) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex min-h-screen w-full items-center justify-center p-4">
|
|
|
|
|
<div className="animate-in fade-in-0 zoom-in-95 flex w-full max-w-3xl flex-col rounded-lg border shadow-lg">
|
|
|
|
|
<div className="flex flex-col gap-4 border-b p-6">
|
|
|
|
|
<div className="flex flex-col items-start gap-2">
|
|
|
|
|
<LangGraphLogoSVG className="h-7" />
|
|
|
|
|
<h1 className="text-xl font-semibold tracking-tight">
|
|
|
|
|
Get started
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-muted-foreground">
|
|
|
|
|
Connect your GitHub account to get started with Open SWE.
|
|
|
|
|
</p>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handleLogin}
|
|
|
|
|
disabled={isLoading}
|
|
|
|
|
>
|
|
|
|
|
<GitHubSVG
|
|
|
|
|
width="16"
|
|
|
|
|
height="16"
|
|
|
|
|
/>
|
|
|
|
|
{isLoading ? "Connecting..." : "Connect GitHub"}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Step 2: GitHub App Installation (only show if authenticated but app not installed)
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
// Only show modal if we've definitively determined the app is not installed
|
|
|
|
|
// Don't show while we're still loading or have cached positive status
|
|
|
|
|
if (isAuth && hasGitHubAppInstalled === false && !isTokenLoading) {
|
2025-06-01 18:30:29 -07:00
|
|
|
return (
|
|
|
|
|
<div className="flex min-h-screen w-full items-center justify-center p-4">
|
|
|
|
|
<div className="animate-in fade-in-0 zoom-in-95 flex w-full max-w-3xl flex-col rounded-lg border shadow-lg">
|
|
|
|
|
<div className="flex flex-col gap-4 border-b p-6">
|
|
|
|
|
<div className="flex flex-col items-start gap-2">
|
|
|
|
|
<LangGraphLogoSVG className="h-7" />
|
|
|
|
|
<h1 className="text-xl font-semibold tracking-tight">
|
|
|
|
|
One more step
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="text-muted-foreground flex items-center gap-2 text-sm">
|
|
|
|
|
<span className="rounded-full bg-green-100 px-2 py-1 text-xs font-medium text-green-800">
|
|
|
|
|
1. GitHub Login ✓
|
|
|
|
|
</span>
|
|
|
|
|
<ArrowRight className="h-3 w-3" />
|
|
|
|
|
<span className="rounded-full bg-blue-100 px-2 py-1 text-xs font-medium text-blue-800">
|
|
|
|
|
2. Repository Access
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-muted-foreground">
|
|
|
|
|
Great! Now we need access to your GitHub repositories. Install our
|
|
|
|
|
GitHub App to grant access to specific repositories.
|
|
|
|
|
</p>
|
|
|
|
|
<div className="rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800">
|
|
|
|
|
<p>
|
|
|
|
|
You'll be redirected to GitHub where you can select which
|
|
|
|
|
repositories to grant access to.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handleInstallGitHubApp}
|
|
|
|
|
disabled={isLoading || isCheckingAppInstallation}
|
|
|
|
|
className="bg-black hover:bg-gray-800"
|
|
|
|
|
>
|
|
|
|
|
<GitHubSVG
|
|
|
|
|
width="16"
|
|
|
|
|
height="16"
|
|
|
|
|
/>
|
|
|
|
|
{isLoading || isCheckingAppInstallation
|
|
|
|
|
? "Loading..."
|
|
|
|
|
: "Install GitHub App"}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
feat: Update chat UI to be Open SWE specific (#76) (#91)
* init repo-selector
* add branch selector UI, extend GH hook w branch info
* add reconnectOnMount: true resumeStream, remove repo description from selector, fix styling
* styling repo + branch
* udpate getBranch calls to include targetRepo arg
* format
* add search to repo + branch selectors
* add settings icon link to /github for dev convenience
* add default branch selection
* format
* minor cleanup
* init task list UI demo
* individual task component
* tasks real data
* task visual improvement
* persisting tasks, navigate to thread onClick
* task UI
* TaskSidebar, Navigate to tasks
* org tasks by thread
* group by thread
* improve sidebar, task-list, rm github modal on refresh
* collapse sidebar works when viewing a thread
* remove micro-tasks expansion from threads component, change taskId to taskIndex for persistence + simplicity
* init config sidebar ui
* open and close config sidebar
* add ref for getAllTasks + add graph_id metadata
* format
* create threadItem component
* format
* add threadUtils
* centralize + refactor types
* format
* improve thread status, realtime updates
* fix scroll issue
* remove temperature from config-sidebar
* Change model via sidebar
* fix flashing on updates
* init plan UI
* centralize types
* self CR: refactoring, cleanup, remove comments, add todos
* CR: clean comments + logs, fix repo selector bug
* fix: Update example env file in web (#77)
* disable auto scroll on pageload
* reposelector: use default branch not main master
* remove archived tab temp, default branch listed first in branchSelector dropdown
* auto select first repo
* improve status indicator
* refactor status indicator
* simplify status implementation to use Langgraph
* util moved from provider to thread-utils
* linting, improve task completion logic
* feat: Support followup requests (#60)
* feat: Support followup requests
* cr
* cr
* fix
* account for pr already exists
* remove task provider
* fix: Better prompting and context provided for codebase structure awareness (#85)
* fix: Better prompting and context provided for codebase structure awareness
* cr
* linting + skeleton loader
* fix: branch selector, add github api pagination
* small branch update
* update task completion status realtime
* threadItem stream remove flashing/polling
* feat: Create a shared package (#89)
* feat: Create a shared package
* formatting
* fix: drop passing target repo to getBranchName
* drop docs
* use shared package for config fields in config sidebar
* fix: styling and structure for repo/branch selectors
* fix: use shared types/objects for config fields
* default key for configs
* fix: improved styling for threads
* fix renering num tasks
* disable repo branch selector when chat started
* cr
* cr
* bump deps
* fix: rendering plan in interrupt
* cr
* cr
---------
Co-authored-by: Dylan Boudro <121908331+starmorph@users.noreply.github.com>
2025-06-08 17:29:40 -07:00
|
|
|
// Only render StreamSession when we have a valid token
|
|
|
|
|
if (!githubToken) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex min-h-screen w-full items-center justify-center p-4">
|
|
|
|
|
<div className="animate-in fade-in-0 zoom-in-95 flex w-full max-w-3xl flex-col rounded-lg border shadow-lg">
|
|
|
|
|
<div className="flex flex-col gap-4 border-b p-6">
|
|
|
|
|
<div className="flex flex-col items-start gap-2">
|
|
|
|
|
<LangGraphLogoSVG className="h-7" />
|
|
|
|
|
<h1 className="text-xl font-semibold tracking-tight">
|
|
|
|
|
Loading...
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="text-muted-foreground">
|
|
|
|
|
Setting up your GitHub integration...
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-28 12:26:47 -07:00
|
|
|
return (
|
|
|
|
|
<StreamSession
|
|
|
|
|
apiUrl={apiUrl}
|
|
|
|
|
assistantId={assistantId}
|
2025-06-01 18:30:29 -07:00
|
|
|
githubToken={githubToken}
|
2025-05-28 12:26:47 -07:00
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</StreamSession>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const useStreamContext = (): StreamContextType => {
|
|
|
|
|
const context = useContext(StreamContext);
|
|
|
|
|
if (context === undefined) {
|
|
|
|
|
throw new Error("useStreamContext must be used within a StreamProvider");
|
|
|
|
|
}
|
|
|
|
|
return context;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default StreamContext;
|