fix(frontend): improve "Customize agent" UX for marketplace agents

- Remove disabled state from "Customize agent" button
- Clicking "Customize agent" on a marketplace agent now shows the
  copy confirmation dialog directly
- After confirming copy, navigate directly to the builder instead
  of returning to the library
- Remove separate "Edit a copy" button (now redundant)
- Update dialog text to reflect the new streamlined flow

Fixes OPEN-2828
This commit is contained in:
Bently
2026-01-26 14:08:53 +00:00
parent f0c2503608
commit 3630df12e5

View File

@@ -407,7 +407,10 @@ export function OldAgentLibraryView() {
api
.forkLibraryAgent(agentID)
.then((newAgent) => {
router.push(`/library/agents/${newAgent.id}`);
// Navigate directly to the builder with the new agent's graph
router.push(
`/build?flowID=${newAgent.graph_id}&flowVersion=${newAgent.graph_version}`,
);
})
.catch((error) => {
console.error("Error copying agent:", error);
@@ -419,28 +422,31 @@ export function OldAgentLibraryView() {
});
}, [agentID, api, router, toast]);
const handleCustomizeAgent = useCallback(() => {
if (agent?.can_access_graph) {
// User owns this agent, navigate directly to builder
router.push(
`/build?flowID=${agent.graph_id}&flowVersion=${agent.graph_version}`,
);
} else {
// Marketplace agent - show copy confirmation dialog
setCopyAgentDialogOpen(true);
}
}, [agent, router]);
const agentActions: ButtonAction[] = useMemo(
() => [
{
label: "Customize agent",
href: `/build?flowID=${agent?.graph_id}&flowVersion=${agent?.graph_version}`,
disabled: !agent?.can_access_graph,
callback: handleCustomizeAgent,
},
{ label: "Export agent to file", callback: downloadGraph },
...(!agent?.can_access_graph
? [
{
label: "Edit a copy",
callback: () => setCopyAgentDialogOpen(true),
},
]
: []),
{
label: "Delete agent",
callback: () => setAgentDeleteDialogOpen(true),
},
],
[agent, downloadGraph],
[handleCustomizeAgent, downloadGraph],
);
const runGraph =
@@ -600,10 +606,9 @@ export function OldAgentLibraryView() {
<DialogTitle>You&apos;re making an editable copy</DialogTitle>
<DialogDescription className="pt-2">
The original Marketplace agent stays the same and cannot be
edited. We&apos;ll save a new version of this agent to your
Library. From there, you can customize it however you&apos;d
like by clicking &quot;Customize agent&quot; this will open
the builder where you can see and modify the inner workings.
edited. We&apos;ll create a copy of this agent in your Library
and open it in the builder where you can see and modify its
inner workings.
</DialogDescription>
</DialogHeader>
<DialogFooter className="justify-end">