diff --git a/frontend/src/lib/components/flows/content/AgentEditorHost.svelte b/frontend/src/lib/components/flows/content/AgentEditorHost.svelte index 63a247ccf7..9c2a57b43f 100644 --- a/frontend/src/lib/components/flows/content/AgentEditorHost.svelte +++ b/frontend/src/lib/components/flows/content/AgentEditorHost.svelte @@ -447,14 +447,17 @@ /** The path field's own verdict (a taken path, an invalid name), which the server would otherwise * only report after the request. The field lives with whoever shows it, which reports here. */ - let pathError = $state('') + let pathErrorValue = $state('') + export function pathError() { + return pathErrorValue + } export function setPathError(error: string | undefined) { - pathError = error ?? '' + pathErrorValue = error ?? '' } export function deploy(): Promise { - if (pathError) { - sendUserToast(`Cannot deploy the agent: ${pathError}`, true) + if (pathErrorValue) { + sendUserToast(`Cannot deploy the agent: ${pathErrorValue}`, true) return Promise.resolve(false) } return draft.deploy().then(async (written) => { diff --git a/frontend/src/lib/components/flows/content/AgentEditorModal.svelte b/frontend/src/lib/components/flows/content/AgentEditorModal.svelte index 642a2fa002..618c31dbaf 100644 --- a/frontend/src/lib/components/flows/content/AgentEditorModal.svelte +++ b/frontend/src/lib/components/flows/content/AgentEditorModal.svelte @@ -130,6 +130,12 @@ let inSettings = $derived(target?.view === 'settings' && !refused) let readOnly = $derived(draft ? !draft.canWrite : false) let draftOnly = $derived(draft?.noDeployed ?? false) + // Evals run against the deployed agent, and a draft-only one has none: the backend's + // `require_agent` would reject every run. Evaluating is authoring, so it is for those who can + // edit the agent. Unknown until the load answers, and warming the pane loads it. + let canEvaluate = $derived( + draft != undefined && !draft.loading && !draftOnly && !readOnly && !refused + ) // A never-deployed agent is stored at a minted `draft_` path, so it is named by the path // its first deploy will create, as the home list names it. let shownPath = $derived((draftOnly && draft?.state?.path) || target?.path) @@ -410,10 +416,7 @@ on:click={openSettings} /> {/if} - - {#if !draftOnly && !readOnly} + {#if canEvaluate}