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:
@@ -407,12 +407,6 @@ export const RestartServerRequestMessageSchema = z.object({
|
||||
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({
|
||||
type: z.literal("initialize_agent_request"),
|
||||
agentId: z.string(),
|
||||
@@ -557,7 +551,6 @@ export const SessionInboundMessageSchema = z.discriminatedUnion("type", [
|
||||
HighlightedDiffRequestSchema,
|
||||
FileExplorerRequestSchema,
|
||||
FileDownloadTokenRequestSchema,
|
||||
ListPersistedAgentsRequestMessageSchema,
|
||||
GitRepoInfoRequestMessageSchema,
|
||||
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({
|
||||
type: z.literal("git_diff_response"),
|
||||
payload: z.object({
|
||||
@@ -863,7 +837,6 @@ export const SessionOutboundMessageSchema = z.discriminatedUnion("type", [
|
||||
AgentPermissionRequestMessageSchema,
|
||||
AgentPermissionResolvedMessageSchema,
|
||||
AgentDeletedMessageSchema,
|
||||
ListPersistedAgentsResponseSchema,
|
||||
GitDiffResponseSchema,
|
||||
HighlightedDiffResponseSchema,
|
||||
FileExplorerResponseSchema,
|
||||
@@ -896,7 +869,6 @@ export type DeleteConversationResponseMessage = z.infer<typeof DeleteConversatio
|
||||
export type AgentPermissionRequestMessage = z.infer<typeof AgentPermissionRequestMessageSchema>;
|
||||
export type AgentPermissionResolvedMessage = z.infer<typeof AgentPermissionResolvedMessageSchema>;
|
||||
export type AgentDeletedMessage = z.infer<typeof AgentDeletedMessageSchema>;
|
||||
export type ListPersistedAgentsResponseMessage = z.infer<typeof ListPersistedAgentsResponseSchema>;
|
||||
export type ListProviderModelsResponseMessage = z.infer<
|
||||
typeof ListProviderModelsResponseMessageSchema
|
||||
>;
|
||||
@@ -916,7 +888,6 @@ export type ListProviderModelsRequestMessage = z.infer<
|
||||
>;
|
||||
export type ResumeAgentRequestMessage = z.infer<typeof ResumeAgentRequestMessageSchema>;
|
||||
export type DeleteAgentRequestMessage = z.infer<typeof DeleteAgentRequestMessageSchema>;
|
||||
export type ListPersistedAgentsRequestMessage = z.infer<typeof ListPersistedAgentsRequestMessageSchema>;
|
||||
export type InitializeAgentRequestMessage = z.infer<typeof InitializeAgentRequestMessageSchema>;
|
||||
export type SetAgentModeMessage = z.infer<typeof SetAgentModeMessageSchema>;
|
||||
export type AgentPermissionResponseMessage = z.infer<typeof AgentPermissionResponseMessageSchema>;
|
||||
|
||||
@@ -856,10 +856,6 @@ export class Session {
|
||||
await this.handleFileDownloadTokenRequest(msg);
|
||||
break;
|
||||
|
||||
case "list_persisted_agents_request":
|
||||
await this.handleListPersistedAgentsRequest(msg);
|
||||
break;
|
||||
|
||||
case "git_repo_info_request":
|
||||
await this.handleGitRepoInfoRequest(msg);
|
||||
break;
|
||||
@@ -1550,9 +1546,18 @@ export class Session {
|
||||
}
|
||||
|
||||
if (normalized.createWorktree) {
|
||||
const targetBranch = normalized.createNewBranch
|
||||
? normalized.newBranchName
|
||||
: normalized.baseBranch;
|
||||
let targetBranch: string;
|
||||
|
||||
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) {
|
||||
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 {
|
||||
baseBranch,
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -5,7 +5,6 @@ import type {
|
||||
SessionOutboundMessage,
|
||||
AgentSnapshotPayload,
|
||||
AgentStreamEventPayload,
|
||||
PersistedAgentDescriptorPayload,
|
||||
} from "../messages.js";
|
||||
import type {
|
||||
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(
|
||||
handle: AgentPersistenceHandle,
|
||||
overrides?: Partial<CreateAgentOptions>
|
||||
|
||||
Reference in New Issue
Block a user