The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): extract the route-request intent effect from ContribWiring
Teknium170c6c46bc30
diff --git a/apps/desktop/src/app/contrib/wiring.tsx b/apps/desktop/src/app/contrib/wiring.tsxindex e4ae14512bb..693404dd987 100644--- a/apps/desktop/src/app/contrib/wiring.tsx+++ b/apps/desktop/src/app/contrib/wiring.tsx@@ -196,6 +196,23 @@ export { WiredPane } from './context'// Only the RPCs issued by session creation follow the handoff's profile pin.const HANDOFF_CREATE_LEG_METHODS = new Set(['config.set', 'session.close', 'session.create'])+// Generic in-app route intents raised by toast recovery buttons (Open Keys,+// Open Gateways, Maintenance …) fired from stores with no router context.+function useRouteRequestNavigation(navigate: ReturnType<typeof useNavigate>): void {+ const routeRequest = useStore($routeRequest)+ const routeRequestSeenRef = useRef(0)++ // eslint-disable-next-line no-restricted-syntax -- one-shot request-seen sentinel, not an atom mirror+ useEffect(() => {+ if (!routeRequest || routeRequest.seq === routeRequestSeenRef.current) {+ return+ }++ routeRequestSeenRef.current = routeRequest.seq+ navigate(routeRequest.path)+ }, [navigate, routeRequest])+}+export function ContribWiring({ children }: { children: ReactNode }) {const queryClient = useQueryClient()const location = useLocation()@@ -208,7 +225,6 @@ export function ContribWiring({ children }: { children: ReactNode }) {// intent counter here; the ref skips the initial mount value.const billingSettingsSeenRef = useRef(0)const poolLimitsSettingsSeenRef = useRef(0)- const routeRequestSeenRef = useRef(0)const backendRestartSeenRef = useRef(0)const cronReviewSeenRef = useRef(0)const activeTranscriptSignatureRef = useRef(new Map<string, string>())@@ -221,22 +237,11 @@ export function ContribWiring({ children }: { children: ReactNode }) {const activeSessionId = useStore($activeSessionId)const billingSettingsRequest = useStore($billingSettingsRequest)const poolLimitsSettingsRequest = useStore($poolLimitsSettingsRequest)- const routeRequest = useStore($routeRequest)const backendRestartRequest = useStore($backendRestartRequest)const cronReviewRequest = useStore($cronReviewRequest)const currentCwd = useStore($currentCwd)- // Generic in-app route intents raised by toast recovery buttons (Open Keys,- // Open Gateways, Maintenance …) fired from stores with no router context.- // eslint-disable-next-line no-restricted-syntax -- one-shot request-seen sentinel, not an atom mirror- useEffect(() => {- if (!routeRequest || routeRequest.seq === routeRequestSeenRef.current) {- return- }-- routeRequestSeenRef.current = routeRequest.seq- navigate(routeRequest.path)- }, [navigate, routeRequest])+ useRouteRequestNavigation(navigate)// "Restart Hermes" from a toast: recycle the local backend the user is// looking at (same IPC the Models page uses), then let the boot hook re-dial.