Files
buzz/desktop/src/features/agents/ui/RequestedAgentCreateDialogs.tsx
klopez4212 c8743b2f20 Remove agent creation success modal (#5063)
## Summary
- remove the post-creation private-key modal
- return directly to the underlying page with one “Agent created” toast
- preserve failed channel-attachment retry through an actionable toast

## Validation
- desktop checks and E2E build
- 4,392 desktop unit tests
- focused Playwright coverage for standard, customized, and
attachment-retry creation flows

Signed-off-by: kenny lopez <klopez4212@gmail.com>
2026-08-07 17:03:16 +01:00

69 lines
2.0 KiB
TypeScript

import * as React from "react";
import {
consumePendingOpenCreateAgent,
subscribeOpenCreateAgent,
type OpenCreateAgentOptions,
} from "@/features/agents/openCreateAgentEvent";
import { AgentDialog } from "./AgentDialog";
import { usePersonaActions } from "./usePersonaActions";
/** App-level create flow so contextual entry points do not navigate away. */
export function RequestedAgentCreateDialogs() {
const personas = usePersonaActions();
const [targetChannel, setTargetChannel] = React.useState<{
id: string;
name: string;
} | null>(null);
const [isOpen, setIsOpen] = React.useState(false);
const openCreate = React.useEffectEvent((options: OpenCreateAgentOptions) => {
personas.prepareCreate();
setTargetChannel(
options.channelId && options.channelName
? { id: options.channelId, name: options.channelName }
: null,
);
setIsOpen(true);
});
React.useEffect(() => {
const pending = consumePendingOpenCreateAgent();
if (pending) openCreate(pending);
return subscribeOpenCreateAgent(openCreate);
}, []);
return (
<>
{isOpen ? (
<AgentDialog
definitionError={
personas.createPersonaMutation.error instanceof Error
? personas.createPersonaMutation.error
: null
}
isDefinitionPending={personas.isPending}
mode="definition"
onOpenChange={(open) => {
if (!open) {
setIsOpen(false);
setTargetChannel(null);
}
}}
onSubmitDefinition={(input, intent, backendIntent) =>
personas.handleSubmit(input, intent, backendIntent, targetChannel)
}
runtimes={personas.acpRuntimesQuery.data ?? []}
runtimeCatalogStatus={
personas.acpRuntimesQuery.isLoading
? "loading"
: personas.acpRuntimesQuery.isError
? "error"
: "ready"
}
/>
) : null}
</>
);
}