feat: update codex live runtime and restart flow

This commit is contained in:
2026-04-23 18:10:43 +09:00
parent b0b9980a6c
commit 6e863feafd
36 changed files with 1636 additions and 358 deletions

View File

@@ -2,7 +2,6 @@ import {
createContext,
useContext,
useMemo,
useRef,
useState,
type PropsWithChildren,
} from 'react';
@@ -18,14 +17,12 @@ type SearchLayerContextValue = SearchLayerSnapshot & {
};
const SearchLayerContext = createContext<SearchLayerContextValue | null>(null);
const WINDOW_SELECTION_DEDUP_MS = 500;
export function SearchLayerProvider({ children }: PropsWithChildren) {
const [open, setOpen] = useState(false);
const [options, setOptions] = useState<SearchKeywordOption[]>([]);
const [mode, setMode] = useState<SearchOpenMode>('navigate');
const [windowSelections, setWindowSelections] = useState<SearchWindowSelection[]>([]);
const lastWindowSelectionRef = useRef<{ id: string; at: number } | null>(null);
const value = useMemo<SearchLayerContextValue>(
() => ({
@@ -35,7 +32,6 @@ export function SearchLayerProvider({ children }: PropsWithChildren) {
windowSelections,
setOptions,
openSearch: (nextMode = 'navigate') => {
lastWindowSelectionRef.current = null;
setMode(nextMode);
setOpen(true);
},
@@ -72,22 +68,6 @@ export function SearchLayerProvider({ children }: PropsWithChildren) {
onClose={value.closeSearch}
onSelectOption={(option) => {
if (mode === 'window') {
const now = Date.now();
const previousSelection = lastWindowSelectionRef.current;
if (
previousSelection &&
previousSelection.id === option.id &&
now - previousSelection.at <= WINDOW_SELECTION_DEDUP_MS
) {
return;
}
lastWindowSelectionRef.current = {
id: option.id,
at: now,
};
setOpen(false);
setWindowSelections((previous) => [
...previous,