feat: remove import agent feature from UI

Remove the import agent functionality from the app while preserving
the underlying resume capability in the agent code.

Changes:
- Remove ImportAgentModal and import flow from create-agent-modal.tsx
- Remove "Import Agent" menu item from agent screen
- Remove "Import" button from home footer
- Remove resumeAgent from session context and store
- Remove list_persisted_agents WS messages from server
- Remove handleListPersistedAgentsRequest handler
- Clean up unused styles and types

The resumeAgent capability remains in the agent manager for potential
future use or internal tooling.
This commit is contained in:
Mohamed Boudra
2026-01-08 21:48:48 +07:00
parent f2e03c53c1
commit cc74d6d0d2
9 changed files with 80 additions and 1297 deletions
@@ -29,7 +29,6 @@ import {
GitBranch,
Folder,
RotateCcw,
Download,
Users,
ChevronRight,
PlusIcon,
@@ -39,7 +38,6 @@ import { MenuHeader } from "@/components/headers/menu-header";
import { BackHeader } from "@/components/headers/back-header";
import { AgentStreamView } from "@/components/agent-stream-view";
import { AgentInputArea } from "@/components/agent-input-area";
import { ImportAgentModal } from "@/components/create-agent-modal";
import { ExplorerSidebar } from "@/components/explorer-sidebar";
import { FileDropZone } from "@/components/file-drop-zone";
import type { ImageAttachment } from "@/components/message-input";
@@ -184,7 +182,6 @@ function AgentScreenContent({
const [menuPosition, setMenuPosition] = useState({ top: 0, left: 0 });
const [menuContentHeight, setMenuContentHeight] = useState(0);
const menuButtonRef = useRef<View>(null);
const [showImportAgentModal, setShowImportAgentModal] = useState(false);
const addImagesRef = useRef<((images: ImageAttachment[]) => void) | null>(null);
const handleFilesDropped = useCallback((files: ImageAttachment[]) => {
@@ -636,15 +633,6 @@ function AgentScreenContent({
router.push({ pathname: "/", params });
}, [agent, agentModel, handleCloseMenu, router, serverId]);
const handleImportAgent = useCallback(() => {
handleCloseMenu();
setShowImportAgentModal(true);
}, [handleCloseMenu]);
const handleCloseImportAgentModal = useCallback(() => {
setShowImportAgentModal(false);
}, []);
const handleNavigateToChildAgent = useCallback(
(childAgentId: string) => {
handleCloseMenu();
@@ -659,25 +647,14 @@ function AgentScreenContent({
[handleCloseMenu, router, serverId]
);
const importAgentModal = (
<ImportAgentModal
isVisible={showImportAgentModal}
onClose={handleCloseImportAgentModal}
serverId={serverId}
/>
);
if (!agent) {
return (
<>
<View style={styles.container}>
<MenuHeader title="Agent" />
<View style={styles.errorContainer}>
<Text style={styles.errorText}>Agent not found</Text>
</View>
<View style={styles.container}>
<MenuHeader title="Agent" />
<View style={styles.errorContainer}>
<Text style={styles.errorText}>Agent not found</Text>
</View>
{importAgentModal}
</>
</View>
);
}
@@ -879,10 +856,6 @@ function AgentScreenContent({
<Folder size={16} color={theme.colors.foreground} />
<Text style={styles.menuItemText}>Browse Files</Text>
</Pressable>
<Pressable onPress={handleImportAgent} style={styles.menuItem}>
<Download size={16} color={theme.colors.foreground} />
<Text style={styles.menuItemText}>Import Agent</Text>
</Pressable>
<Pressable onPress={handleCreateNewAgent} style={styles.menuItem}>
<PlusIcon size={16} color={theme.colors.foreground} />
<Text style={styles.menuItemText}>New Agent</Text>
@@ -934,8 +907,6 @@ function AgentScreenContent({
{isMobile && resolvedAgentId && (
<ExplorerSidebar serverId={serverId} agentId={resolvedAgentId} />
)}
{importAgentModal}
</>
);
}
File diff suppressed because it is too large Load Diff
+1 -26
View File
@@ -3,12 +3,11 @@ import { View, Pressable, Text, Platform, Modal, Alert } from "react-native";
import { useRouter } from "expo-router";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { StyleSheet, useUnistyles } from "react-native-unistyles";
import { AudioLines, Users, Plus, Download } from "lucide-react-native";
import { AudioLines, Users, Plus } from "lucide-react-native";
import { useRealtime } from "@/contexts/realtime-context";
import { useDaemonConnections } from "@/contexts/daemon-connections-context";
import { FOOTER_HEIGHT } from "@/constants/layout";
import { RealtimeControls } from "./realtime-controls";
import { ImportAgentModal } from "./create-agent-modal";
import Animated, {
FadeIn,
FadeOut,
@@ -22,7 +21,6 @@ export function HomeFooter() {
const router = useRouter();
const { isRealtimeMode, startRealtime } = useRealtime();
const { connectionStates } = useDaemonConnections();
const [showImportModal, setShowImportModal] = useState(false);
const [showRealtimeHostPicker, setShowRealtimeHostPicker] = useState(false);
// Guard Reanimated entry/exit transitions on Android to avoid ViewGroup.dispatchDraw crashes
// tracked in react-native-reanimated#8422.
@@ -141,25 +139,6 @@ export function HomeFooter() {
<Text style={styles.footerButtonText}>Agents</Text>
</Pressable>
<Pressable
onPress={() => {
setShowImportModal(true);
}}
style={({ pressed }) => [
styles.footerButton,
pressed && styles.buttonPressed,
]}
>
<View style={styles.footerIconWrapper}>
<Download
size={iconSize}
color={theme.colors.foreground}
style={iconStyle}
/>
</View>
<Text style={styles.footerButtonText}>Import</Text>
</Pressable>
<Pressable
onPress={() => {
console.log("[HomeFooter] New Agent button pressed");
@@ -202,10 +181,6 @@ export function HomeFooter() {
</View>
</Animated.View>
<ImportAgentModal
isVisible={showImportModal}
onClose={() => setShowImportModal(false)}
/>
<Modal
visible={showRealtimeHostPicker}
transparent
@@ -208,7 +208,6 @@ export interface SessionContextValue {
worktreeName?: string;
requestId?: string;
}) => void;
resumeAgent: (options: { handle: any; overrides?: any; requestId?: string }) => void;
setAgentMode: (agentId: string, modeId: string) => void;
respondToPermission: (agentId: string, requestId: string, response: any) => void;
}
@@ -1573,19 +1572,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
ws.send(msg);
}, [encodeImages, ws]);
const resumeAgent = useCallback(({ handle, overrides, requestId }: { handle: any; overrides?: any; requestId?: string }) => {
const msg: WSInboundMessage = {
type: "session",
message: {
type: "resume_agent_request",
handle,
...(overrides ? { overrides } : {}),
...(requestId ? { requestId } : {}),
},
};
ws.send(msg);
}, [ws]);
const setAgentMode = useCallback((agentId: string, modeId: string) => {
const msg: WSInboundMessage = {
type: "session",
@@ -1816,7 +1802,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
sendAgentMessage,
sendAgentAudio,
createAgent,
resumeAgent,
setAgentMode,
respondToPermission,
}),
@@ -1840,7 +1825,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
sendAgentMessage,
sendAgentAudio,
createAgent,
resumeAgent,
setAgentMode,
respondToPermission,
]
@@ -1866,7 +1850,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
sendAgentAudio,
deleteAgent,
createAgent,
resumeAgent,
setAgentMode,
respondToPermission,
}), [
@@ -1886,7 +1869,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
sendAgentAudio,
deleteAgent,
createAgent,
resumeAgent,
setAgentMode,
respondToPermission,
]);
-1
View File
@@ -105,7 +105,6 @@ const RESPONSE_TYPE_MAP: Record<string, SessionOutboundMessage["type"]> = {
git_repo_info_request: "git_repo_info_response",
list_provider_models_request: "list_provider_models_response",
list_conversations_request: "list_conversations_response",
list_persisted_agents_request: "list_persisted_agents_response",
create_agent_request: "agent_state",
refresh_agent_request: "agent_state",
initialize_agent_request: "initialize_agent_request",
-1
View File
@@ -204,7 +204,6 @@ export interface SessionState {
worktreeName?: string;
requestId?: string;
}) => Promise<void>;
resumeAgent: (options: { handle: any; overrides?: any; requestId?: string }) => void;
setAgentMode: (agentId: string, modeId: string) => void;
respondToPermission: (agentId: string, requestId: string, response: any) => void;
} | null;