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:
@@ -29,7 +29,6 @@ import {
|
|||||||
GitBranch,
|
GitBranch,
|
||||||
Folder,
|
Folder,
|
||||||
RotateCcw,
|
RotateCcw,
|
||||||
Download,
|
|
||||||
Users,
|
Users,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
PlusIcon,
|
PlusIcon,
|
||||||
@@ -39,7 +38,6 @@ import { MenuHeader } from "@/components/headers/menu-header";
|
|||||||
import { BackHeader } from "@/components/headers/back-header";
|
import { BackHeader } from "@/components/headers/back-header";
|
||||||
import { AgentStreamView } from "@/components/agent-stream-view";
|
import { AgentStreamView } from "@/components/agent-stream-view";
|
||||||
import { AgentInputArea } from "@/components/agent-input-area";
|
import { AgentInputArea } from "@/components/agent-input-area";
|
||||||
import { ImportAgentModal } from "@/components/create-agent-modal";
|
|
||||||
import { ExplorerSidebar } from "@/components/explorer-sidebar";
|
import { ExplorerSidebar } from "@/components/explorer-sidebar";
|
||||||
import { FileDropZone } from "@/components/file-drop-zone";
|
import { FileDropZone } from "@/components/file-drop-zone";
|
||||||
import type { ImageAttachment } from "@/components/message-input";
|
import type { ImageAttachment } from "@/components/message-input";
|
||||||
@@ -184,7 +182,6 @@ function AgentScreenContent({
|
|||||||
const [menuPosition, setMenuPosition] = useState({ top: 0, left: 0 });
|
const [menuPosition, setMenuPosition] = useState({ top: 0, left: 0 });
|
||||||
const [menuContentHeight, setMenuContentHeight] = useState(0);
|
const [menuContentHeight, setMenuContentHeight] = useState(0);
|
||||||
const menuButtonRef = useRef<View>(null);
|
const menuButtonRef = useRef<View>(null);
|
||||||
const [showImportAgentModal, setShowImportAgentModal] = useState(false);
|
|
||||||
const addImagesRef = useRef<((images: ImageAttachment[]) => void) | null>(null);
|
const addImagesRef = useRef<((images: ImageAttachment[]) => void) | null>(null);
|
||||||
|
|
||||||
const handleFilesDropped = useCallback((files: ImageAttachment[]) => {
|
const handleFilesDropped = useCallback((files: ImageAttachment[]) => {
|
||||||
@@ -636,15 +633,6 @@ function AgentScreenContent({
|
|||||||
router.push({ pathname: "/", params });
|
router.push({ pathname: "/", params });
|
||||||
}, [agent, agentModel, handleCloseMenu, router, serverId]);
|
}, [agent, agentModel, handleCloseMenu, router, serverId]);
|
||||||
|
|
||||||
const handleImportAgent = useCallback(() => {
|
|
||||||
handleCloseMenu();
|
|
||||||
setShowImportAgentModal(true);
|
|
||||||
}, [handleCloseMenu]);
|
|
||||||
|
|
||||||
const handleCloseImportAgentModal = useCallback(() => {
|
|
||||||
setShowImportAgentModal(false);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleNavigateToChildAgent = useCallback(
|
const handleNavigateToChildAgent = useCallback(
|
||||||
(childAgentId: string) => {
|
(childAgentId: string) => {
|
||||||
handleCloseMenu();
|
handleCloseMenu();
|
||||||
@@ -659,25 +647,14 @@ function AgentScreenContent({
|
|||||||
[handleCloseMenu, router, serverId]
|
[handleCloseMenu, router, serverId]
|
||||||
);
|
);
|
||||||
|
|
||||||
const importAgentModal = (
|
|
||||||
<ImportAgentModal
|
|
||||||
isVisible={showImportAgentModal}
|
|
||||||
onClose={handleCloseImportAgentModal}
|
|
||||||
serverId={serverId}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!agent) {
|
if (!agent) {
|
||||||
return (
|
return (
|
||||||
<>
|
<View style={styles.container}>
|
||||||
<View style={styles.container}>
|
<MenuHeader title="Agent" />
|
||||||
<MenuHeader title="Agent" />
|
<View style={styles.errorContainer}>
|
||||||
<View style={styles.errorContainer}>
|
<Text style={styles.errorText}>Agent not found</Text>
|
||||||
<Text style={styles.errorText}>Agent not found</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
{importAgentModal}
|
</View>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,10 +856,6 @@ function AgentScreenContent({
|
|||||||
<Folder size={16} color={theme.colors.foreground} />
|
<Folder size={16} color={theme.colors.foreground} />
|
||||||
<Text style={styles.menuItemText}>Browse Files</Text>
|
<Text style={styles.menuItemText}>Browse Files</Text>
|
||||||
</Pressable>
|
</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}>
|
<Pressable onPress={handleCreateNewAgent} style={styles.menuItem}>
|
||||||
<PlusIcon size={16} color={theme.colors.foreground} />
|
<PlusIcon size={16} color={theme.colors.foreground} />
|
||||||
<Text style={styles.menuItemText}>New Agent</Text>
|
<Text style={styles.menuItemText}>New Agent</Text>
|
||||||
@@ -934,8 +907,6 @@ function AgentScreenContent({
|
|||||||
{isMobile && resolvedAgentId && (
|
{isMobile && resolvedAgentId && (
|
||||||
<ExplorerSidebar serverId={serverId} agentId={resolvedAgentId} />
|
<ExplorerSidebar serverId={serverId} agentId={resolvedAgentId} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{importAgentModal}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,11 @@ import { View, Pressable, Text, Platform, Modal, Alert } from "react-native";
|
|||||||
import { useRouter } from "expo-router";
|
import { useRouter } from "expo-router";
|
||||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
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 { useRealtime } from "@/contexts/realtime-context";
|
||||||
import { useDaemonConnections } from "@/contexts/daemon-connections-context";
|
import { useDaemonConnections } from "@/contexts/daemon-connections-context";
|
||||||
import { FOOTER_HEIGHT } from "@/constants/layout";
|
import { FOOTER_HEIGHT } from "@/constants/layout";
|
||||||
import { RealtimeControls } from "./realtime-controls";
|
import { RealtimeControls } from "./realtime-controls";
|
||||||
import { ImportAgentModal } from "./create-agent-modal";
|
|
||||||
import Animated, {
|
import Animated, {
|
||||||
FadeIn,
|
FadeIn,
|
||||||
FadeOut,
|
FadeOut,
|
||||||
@@ -22,7 +21,6 @@ export function HomeFooter() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { isRealtimeMode, startRealtime } = useRealtime();
|
const { isRealtimeMode, startRealtime } = useRealtime();
|
||||||
const { connectionStates } = useDaemonConnections();
|
const { connectionStates } = useDaemonConnections();
|
||||||
const [showImportModal, setShowImportModal] = useState(false);
|
|
||||||
const [showRealtimeHostPicker, setShowRealtimeHostPicker] = useState(false);
|
const [showRealtimeHostPicker, setShowRealtimeHostPicker] = useState(false);
|
||||||
// Guard Reanimated entry/exit transitions on Android to avoid ViewGroup.dispatchDraw crashes
|
// Guard Reanimated entry/exit transitions on Android to avoid ViewGroup.dispatchDraw crashes
|
||||||
// tracked in react-native-reanimated#8422.
|
// tracked in react-native-reanimated#8422.
|
||||||
@@ -141,25 +139,6 @@ export function HomeFooter() {
|
|||||||
<Text style={styles.footerButtonText}>Agents</Text>
|
<Text style={styles.footerButtonText}>Agents</Text>
|
||||||
</Pressable>
|
</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
|
<Pressable
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
console.log("[HomeFooter] New Agent button pressed");
|
console.log("[HomeFooter] New Agent button pressed");
|
||||||
@@ -202,10 +181,6 @@ export function HomeFooter() {
|
|||||||
</View>
|
</View>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
|
|
||||||
<ImportAgentModal
|
|
||||||
isVisible={showImportModal}
|
|
||||||
onClose={() => setShowImportModal(false)}
|
|
||||||
/>
|
|
||||||
<Modal
|
<Modal
|
||||||
visible={showRealtimeHostPicker}
|
visible={showRealtimeHostPicker}
|
||||||
transparent
|
transparent
|
||||||
|
|||||||
@@ -208,7 +208,6 @@ export interface SessionContextValue {
|
|||||||
worktreeName?: string;
|
worktreeName?: string;
|
||||||
requestId?: string;
|
requestId?: string;
|
||||||
}) => void;
|
}) => void;
|
||||||
resumeAgent: (options: { handle: any; overrides?: any; requestId?: string }) => void;
|
|
||||||
setAgentMode: (agentId: string, modeId: string) => void;
|
setAgentMode: (agentId: string, modeId: string) => void;
|
||||||
respondToPermission: (agentId: string, requestId: string, response: any) => void;
|
respondToPermission: (agentId: string, requestId: string, response: any) => void;
|
||||||
}
|
}
|
||||||
@@ -1573,19 +1572,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
|
|||||||
ws.send(msg);
|
ws.send(msg);
|
||||||
}, [encodeImages, ws]);
|
}, [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 setAgentMode = useCallback((agentId: string, modeId: string) => {
|
||||||
const msg: WSInboundMessage = {
|
const msg: WSInboundMessage = {
|
||||||
type: "session",
|
type: "session",
|
||||||
@@ -1816,7 +1802,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
|
|||||||
sendAgentMessage,
|
sendAgentMessage,
|
||||||
sendAgentAudio,
|
sendAgentAudio,
|
||||||
createAgent,
|
createAgent,
|
||||||
resumeAgent,
|
|
||||||
setAgentMode,
|
setAgentMode,
|
||||||
respondToPermission,
|
respondToPermission,
|
||||||
}),
|
}),
|
||||||
@@ -1840,7 +1825,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
|
|||||||
sendAgentMessage,
|
sendAgentMessage,
|
||||||
sendAgentAudio,
|
sendAgentAudio,
|
||||||
createAgent,
|
createAgent,
|
||||||
resumeAgent,
|
|
||||||
setAgentMode,
|
setAgentMode,
|
||||||
respondToPermission,
|
respondToPermission,
|
||||||
]
|
]
|
||||||
@@ -1866,7 +1850,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
|
|||||||
sendAgentAudio,
|
sendAgentAudio,
|
||||||
deleteAgent,
|
deleteAgent,
|
||||||
createAgent,
|
createAgent,
|
||||||
resumeAgent,
|
|
||||||
setAgentMode,
|
setAgentMode,
|
||||||
respondToPermission,
|
respondToPermission,
|
||||||
}), [
|
}), [
|
||||||
@@ -1886,7 +1869,6 @@ export function SessionProvider({ children, serverUrl, serverId }: SessionProvid
|
|||||||
sendAgentAudio,
|
sendAgentAudio,
|
||||||
deleteAgent,
|
deleteAgent,
|
||||||
createAgent,
|
createAgent,
|
||||||
resumeAgent,
|
|
||||||
setAgentMode,
|
setAgentMode,
|
||||||
respondToPermission,
|
respondToPermission,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ const RESPONSE_TYPE_MAP: Record<string, SessionOutboundMessage["type"]> = {
|
|||||||
git_repo_info_request: "git_repo_info_response",
|
git_repo_info_request: "git_repo_info_response",
|
||||||
list_provider_models_request: "list_provider_models_response",
|
list_provider_models_request: "list_provider_models_response",
|
||||||
list_conversations_request: "list_conversations_response",
|
list_conversations_request: "list_conversations_response",
|
||||||
list_persisted_agents_request: "list_persisted_agents_response",
|
|
||||||
create_agent_request: "agent_state",
|
create_agent_request: "agent_state",
|
||||||
refresh_agent_request: "agent_state",
|
refresh_agent_request: "agent_state",
|
||||||
initialize_agent_request: "initialize_agent_request",
|
initialize_agent_request: "initialize_agent_request",
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ export interface SessionState {
|
|||||||
worktreeName?: string;
|
worktreeName?: string;
|
||||||
requestId?: string;
|
requestId?: string;
|
||||||
}) => Promise<void>;
|
}) => Promise<void>;
|
||||||
resumeAgent: (options: { handle: any; overrides?: any; requestId?: string }) => void;
|
|
||||||
setAgentMode: (agentId: string, modeId: string) => void;
|
setAgentMode: (agentId: string, modeId: string) => void;
|
||||||
respondToPermission: (agentId: string, requestId: string, response: any) => void;
|
respondToPermission: (agentId: string, requestId: string, response: any) => void;
|
||||||
} | null;
|
} | null;
|
||||||
|
|||||||
@@ -407,12 +407,6 @@ export const RestartServerRequestMessageSchema = z.object({
|
|||||||
reason: z.string().optional(),
|
reason: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ListPersistedAgentsRequestMessageSchema = z.object({
|
|
||||||
type: z.literal("list_persisted_agents_request"),
|
|
||||||
provider: AgentProviderSchema.optional(),
|
|
||||||
limit: z.number().int().positive().optional(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const InitializeAgentRequestMessageSchema = z.object({
|
export const InitializeAgentRequestMessageSchema = z.object({
|
||||||
type: z.literal("initialize_agent_request"),
|
type: z.literal("initialize_agent_request"),
|
||||||
agentId: z.string(),
|
agentId: z.string(),
|
||||||
@@ -557,7 +551,6 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
|
|||||||
HighlightedDiffRequestSchema,
|
HighlightedDiffRequestSchema,
|
||||||
FileExplorerRequestSchema,
|
FileExplorerRequestSchema,
|
||||||
FileDownloadTokenRequestSchema,
|
FileDownloadTokenRequestSchema,
|
||||||
ListPersistedAgentsRequestMessageSchema,
|
|
||||||
GitRepoInfoRequestMessageSchema,
|
GitRepoInfoRequestMessageSchema,
|
||||||
ClearAgentAttentionMessageSchema,
|
ClearAgentAttentionMessageSchema,
|
||||||
]);
|
]);
|
||||||
@@ -750,25 +743,6 @@ export const AgentDeletedMessageSchema = z.object({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const PersistedAgentDescriptorPayloadSchema = z.object({
|
|
||||||
provider: AgentProviderSchema,
|
|
||||||
sessionId: z.string(),
|
|
||||||
cwd: z.string(),
|
|
||||||
title: z.string(),
|
|
||||||
lastActivityAt: z.string(),
|
|
||||||
persistence: AgentPersistenceHandleSchema,
|
|
||||||
timeline: z.array(AgentTimelineItemPayloadSchema),
|
|
||||||
});
|
|
||||||
|
|
||||||
export type PersistedAgentDescriptorPayload = z.infer<typeof PersistedAgentDescriptorPayloadSchema>;
|
|
||||||
|
|
||||||
export const ListPersistedAgentsResponseSchema = z.object({
|
|
||||||
type: z.literal("list_persisted_agents_response"),
|
|
||||||
payload: z.object({
|
|
||||||
items: z.array(PersistedAgentDescriptorPayloadSchema),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
export const GitDiffResponseSchema = z.object({
|
export const GitDiffResponseSchema = z.object({
|
||||||
type: z.literal("git_diff_response"),
|
type: z.literal("git_diff_response"),
|
||||||
payload: z.object({
|
payload: z.object({
|
||||||
@@ -863,7 +837,6 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
|
|||||||
AgentPermissionRequestMessageSchema,
|
AgentPermissionRequestMessageSchema,
|
||||||
AgentPermissionResolvedMessageSchema,
|
AgentPermissionResolvedMessageSchema,
|
||||||
AgentDeletedMessageSchema,
|
AgentDeletedMessageSchema,
|
||||||
ListPersistedAgentsResponseSchema,
|
|
||||||
GitDiffResponseSchema,
|
GitDiffResponseSchema,
|
||||||
HighlightedDiffResponseSchema,
|
HighlightedDiffResponseSchema,
|
||||||
FileExplorerResponseSchema,
|
FileExplorerResponseSchema,
|
||||||
@@ -896,7 +869,6 @@ export type DeleteConversationResponseMessage = z.infer<typeof DeleteConversatio
|
|||||||
export type AgentPermissionRequestMessage = z.infer<typeof AgentPermissionRequestMessageSchema>;
|
export type AgentPermissionRequestMessage = z.infer<typeof AgentPermissionRequestMessageSchema>;
|
||||||
export type AgentPermissionResolvedMessage = z.infer<typeof AgentPermissionResolvedMessageSchema>;
|
export type AgentPermissionResolvedMessage = z.infer<typeof AgentPermissionResolvedMessageSchema>;
|
||||||
export type AgentDeletedMessage = z.infer<typeof AgentDeletedMessageSchema>;
|
export type AgentDeletedMessage = z.infer<typeof AgentDeletedMessageSchema>;
|
||||||
export type ListPersistedAgentsResponseMessage = z.infer<typeof ListPersistedAgentsResponseSchema>;
|
|
||||||
export type ListProviderModelsResponseMessage = z.infer<
|
export type ListProviderModelsResponseMessage = z.infer<
|
||||||
typeof ListProviderModelsResponseMessageSchema
|
typeof ListProviderModelsResponseMessageSchema
|
||||||
>;
|
>;
|
||||||
@@ -916,7 +888,6 @@ export type ListProviderModelsRequestMessage = z.infer<
|
|||||||
>;
|
>;
|
||||||
export type ResumeAgentRequestMessage = z.infer<typeof ResumeAgentRequestMessageSchema>;
|
export type ResumeAgentRequestMessage = z.infer<typeof ResumeAgentRequestMessageSchema>;
|
||||||
export type DeleteAgentRequestMessage = z.infer<typeof DeleteAgentRequestMessageSchema>;
|
export type DeleteAgentRequestMessage = z.infer<typeof DeleteAgentRequestMessageSchema>;
|
||||||
export type ListPersistedAgentsRequestMessage = z.infer<typeof ListPersistedAgentsRequestMessageSchema>;
|
|
||||||
export type InitializeAgentRequestMessage = z.infer<typeof InitializeAgentRequestMessageSchema>;
|
export type InitializeAgentRequestMessage = z.infer<typeof InitializeAgentRequestMessageSchema>;
|
||||||
export type SetAgentModeMessage = z.infer<typeof SetAgentModeMessageSchema>;
|
export type SetAgentModeMessage = z.infer<typeof SetAgentModeMessageSchema>;
|
||||||
export type AgentPermissionResponseMessage = z.infer<typeof AgentPermissionResponseMessageSchema>;
|
export type AgentPermissionResponseMessage = z.infer<typeof AgentPermissionResponseMessageSchema>;
|
||||||
|
|||||||
@@ -856,10 +856,6 @@ export class Session {
|
|||||||
await this.handleFileDownloadTokenRequest(msg);
|
await this.handleFileDownloadTokenRequest(msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "list_persisted_agents_request":
|
|
||||||
await this.handleListPersistedAgentsRequest(msg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "git_repo_info_request":
|
case "git_repo_info_request":
|
||||||
await this.handleGitRepoInfoRequest(msg);
|
await this.handleGitRepoInfoRequest(msg);
|
||||||
break;
|
break;
|
||||||
@@ -1550,9 +1546,18 @@ export class Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (normalized.createWorktree) {
|
if (normalized.createWorktree) {
|
||||||
const targetBranch = normalized.createNewBranch
|
let targetBranch: string;
|
||||||
? normalized.newBranchName
|
|
||||||
: normalized.baseBranch;
|
if (normalized.createNewBranch) {
|
||||||
|
targetBranch = normalized.newBranchName!;
|
||||||
|
} else {
|
||||||
|
// Resolve current branch name from HEAD
|
||||||
|
const { stdout } = await execAsync("git rev-parse --abbrev-ref HEAD", {
|
||||||
|
cwd,
|
||||||
|
env: READ_ONLY_GIT_ENV,
|
||||||
|
});
|
||||||
|
targetBranch = stdout.trim();
|
||||||
|
}
|
||||||
|
|
||||||
if (!targetBranch) {
|
if (!targetBranch) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -1730,12 +1735,6 @@ export class Session {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createWorktree && !createNewBranch && !baseBranch) {
|
|
||||||
throw new Error(
|
|
||||||
"Base branch is required when creating a worktree without a new branch"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
baseBranch,
|
baseBranch,
|
||||||
createNewBranch,
|
createNewBranch,
|
||||||
@@ -1836,48 +1835,6 @@ export class Session {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleListPersistedAgentsRequest(
|
|
||||||
msg: Extract<SessionInboundMessage, { type: "list_persisted_agents_request" }>
|
|
||||||
): Promise<void> {
|
|
||||||
const { provider, limit } = msg;
|
|
||||||
try {
|
|
||||||
const entries = await this.agentManager.listPersistedAgents({
|
|
||||||
provider,
|
|
||||||
limit,
|
|
||||||
});
|
|
||||||
this.emit({
|
|
||||||
type: "list_persisted_agents_response",
|
|
||||||
payload: {
|
|
||||||
items: entries.map((entry) => ({
|
|
||||||
provider: entry.provider,
|
|
||||||
sessionId: entry.sessionId,
|
|
||||||
cwd: entry.cwd,
|
|
||||||
title: entry.title ?? `Session ${entry.sessionId.slice(0, 8)}`,
|
|
||||||
lastActivityAt: entry.lastActivityAt.toISOString(),
|
|
||||||
persistence: entry.persistence,
|
|
||||||
timeline: entry.timeline ?? [],
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error(
|
|
||||||
`[Session ${this.clientId}] Failed to list persisted agents:`,
|
|
||||||
error
|
|
||||||
);
|
|
||||||
this.emit({
|
|
||||||
type: "activity_log",
|
|
||||||
payload: {
|
|
||||||
id: uuidv4(),
|
|
||||||
timestamp: new Date(),
|
|
||||||
type: "error",
|
|
||||||
content: `Failed to list saved agents: ${
|
|
||||||
(error as Error)?.message ?? error
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle set agent mode request
|
* Handle set agent mode request
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import type {
|
|||||||
SessionOutboundMessage,
|
SessionOutboundMessage,
|
||||||
AgentSnapshotPayload,
|
AgentSnapshotPayload,
|
||||||
AgentStreamEventPayload,
|
AgentStreamEventPayload,
|
||||||
PersistedAgentDescriptorPayload,
|
|
||||||
} from "../messages.js";
|
} from "../messages.js";
|
||||||
import type {
|
import type {
|
||||||
AgentModelDefinition,
|
AgentModelDefinition,
|
||||||
@@ -296,16 +295,6 @@ export class DaemonClient {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async listPersistedAgents(): Promise<PersistedAgentDescriptorPayload[]> {
|
|
||||||
this.send({ type: "list_persisted_agents_request" });
|
|
||||||
return this.waitFor((msg) => {
|
|
||||||
if (msg.type === "list_persisted_agents_response") {
|
|
||||||
return msg.payload.items;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async resumeAgent(
|
async resumeAgent(
|
||||||
handle: AgentPersistenceHandle,
|
handle: AgentPersistenceHandle,
|
||||||
overrides?: Partial<CreateAgentOptions>
|
overrides?: Partial<CreateAgentOptions>
|
||||||
|
|||||||
Reference in New Issue
Block a user