refactor: isolate runtime contracts and enforce import boundaries (#6166)
* test: enforce Python import ownership boundaries * test: protect client import boundaries and rehome shared UI contracts * refactor: remove gateway and client dependency inversions * fix: detect dynamic imports in conditional expressions * refactor(tools): keep configuration contracts with their owners * docs: keep design guidance focused on ownership and checks * fix: preserve default threaded turn delivery
This commit is contained in:
1 parent
cd2a863710
commit
328e933d36
162 files changed
+3449
-1888
No files matched your search
@@ -2,7 +2,7 @@ import { CircleAlert, Loader2 } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type HostConnectionState = "open" | "closed" | "connecting" | "error";
|
||||
import type { HostConnectionState } from "./remote-context";
|
||||
|
||||
/** Connectivity is independent of which host the user is currently viewing. */
|
||||
export function HostConnectionStatus({ state, compact = false }: {
|
||||
|
||||
@@ -9,7 +9,8 @@ import { useClient } from "@/providers/ClientProvider";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { ConnectionStatus } from "@/lib/types";
|
||||
import type { HostAnchor, EmbeddedHost } from "./host-bridge";
|
||||
import { HostConnectionStatus, type HostConnectionState } from "./HostConnectionStatus";
|
||||
import { HostConnectionStatus } from "./HostConnectionStatus";
|
||||
import type { HostConnectionState } from "./remote-context";
|
||||
|
||||
export interface HostPicker {
|
||||
kind: "shell";
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { useClient } from "@/providers/ClientProvider";
|
||||
import { remoteAction } from "@/lib/remote-instances";
|
||||
import { useRemoteConnections } from "./RemoteInstances";
|
||||
import { useRemoteConnections } from "./remote-context";
|
||||
|
||||
/** An explicit escape hatch for a VPN/bound-interface route, not a new SSH form. */
|
||||
export function PairRouteSettings({ id, onSaved, showHint = true }: { id: string; onSaved?: () => void; showHint?: boolean }) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { CodeBlock } from "@/components/CodeBlock";
|
||||
import { remoteAction } from "@/lib/remote-instances";
|
||||
import { pairingReturnOrigin, type PairReturn } from "@/lib/remote-pair-return";
|
||||
import type { ConnectionStatus } from "@/lib/types";
|
||||
import { useRemoteConnections } from "./RemoteInstances";
|
||||
import { useRemoteConnections } from "./remote-context";
|
||||
import { PairRouteSettings } from "./PairRouteSettings";
|
||||
import "./remote-layout.css";
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { groupRemoteProfiles, isCompatibilityError, remoteAction, type RemoteIns
|
||||
import { cn } from "@/lib/utils";
|
||||
import { parseSSHAddress } from "@/lib/ssh-address";
|
||||
import { clearPairReturn, readPairReturn, subscribePairReturn } from "@/lib/remote-pair-return";
|
||||
import { useRemoteConnections } from "./RemoteInstances";
|
||||
import { useRemoteConnections } from "./remote-context";
|
||||
import { SSHHostPicker } from "./SSHHostPicker";
|
||||
import { QuickPairSetup } from "./QuickPairSetup";
|
||||
import { PairRouteSettings } from "./PairRouteSettings";
|
||||
|
||||
@@ -1,39 +1,16 @@
|
||||
import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
|
||||
import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
|
||||
import { Loader2, PlugZap } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { groupRemoteProfiles, isCompatibilityError, needsRemoteSetup, type RemoteDirectory } from "@/lib/remote-instances";
|
||||
import { groupRemoteProfiles, isCompatibilityError, needsRemoteSetup } from "@/lib/remote-instances";
|
||||
import { HostCompatibilityDialog } from "./HostCompatibilityDialog";
|
||||
import { RemoteConnectionsPage } from "./RemoteConnectionsPage";
|
||||
import type { HostAnchor } from "./host-bridge";
|
||||
import { ThemeProvider } from "@/hooks/useTheme";
|
||||
import { useHostSessions } from "./useHostSessions";
|
||||
import { HostNavigationContext, HostSwitcher, RemoteHostMenu, type HostPicker } from "./HostSwitcher";
|
||||
import { useSidebarHostBridge } from "./useSidebarHostBridge";
|
||||
import { readPairReturn, subscribePairReturn } from "@/lib/remote-pair-return";
|
||||
import type { HostConnectionState } from "./HostConnectionStatus";
|
||||
|
||||
const RemoteContext = createContext<{
|
||||
available: boolean;
|
||||
localActive: boolean;
|
||||
activeHostId: string | null;
|
||||
hostStates: Record<string, HostConnectionState>;
|
||||
managing: boolean;
|
||||
embeddedManagement?: boolean;
|
||||
reportManagementSurface?: (rect: HostAnchor, theme: "light" | "dark") => void;
|
||||
closeManagement: () => void;
|
||||
selectLocal: () => void;
|
||||
openHostIds: string[];
|
||||
directory: RemoteDirectory | null;
|
||||
directoryError: boolean;
|
||||
refresh: () => Promise<RemoteDirectory>;
|
||||
rename: (id: string, name: string) => Promise<void>;
|
||||
connect: (id: string, stillWanted?: () => boolean) => Promise<void>;
|
||||
disconnect: (id: string) => Promise<void>;
|
||||
remove: (id: string) => Promise<void>;
|
||||
cancel: () => void;
|
||||
} | null>(null);
|
||||
export function useRemoteConnections() { return useContext(RemoteContext); }
|
||||
import { RemoteContext, type HostConnectionState } from "./remote-context";
|
||||
|
||||
/** Keep host views alive; navigation belongs in each view's sidebar, not a second header. */
|
||||
export function RemoteInstances({ children }: { children: ReactNode }) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
import type { RemoteDirectory } from "@/lib/remote-instances";
|
||||
import type { HostAnchor } from "./host-bridge";
|
||||
|
||||
export type HostConnectionState = "open" | "closed" | "connecting" | "error";
|
||||
|
||||
export const RemoteContext = createContext<{
|
||||
available: boolean;
|
||||
localActive: boolean;
|
||||
activeHostId: string | null;
|
||||
hostStates: Record<string, HostConnectionState>;
|
||||
managing: boolean;
|
||||
embeddedManagement?: boolean;
|
||||
reportManagementSurface?: (rect: HostAnchor, theme: "light" | "dark") => void;
|
||||
closeManagement: () => void;
|
||||
selectLocal: () => void;
|
||||
openHostIds: string[];
|
||||
directory: RemoteDirectory | null;
|
||||
directoryError: boolean;
|
||||
refresh: () => Promise<RemoteDirectory>;
|
||||
rename: (id: string, name: string) => Promise<void>;
|
||||
connect: (id: string, stillWanted?: () => boolean) => Promise<void>;
|
||||
disconnect: (id: string) => Promise<void>;
|
||||
remove: (id: string) => Promise<void>;
|
||||
cancel: () => void;
|
||||
} | null>(null);
|
||||
export function useRemoteConnections() { return useContext(RemoteContext); }
|
||||
Reference in new issue
Block a user