From ef0eaa83f511d168766691b033ca96538b889c74 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Wed, 30 Sep 2026 12:49:52 +0200 Subject: [PATCH] fix: the unreachable model provider note offers editing the agent too Editing the agent to use a provider the reader can access is often the simpler way out; offered when the reader can write the agent, with Unlink and asking for access. Co-Authored-By: Claude Opus 5.5 (1M context) --- .../flows/content/AgentResourceBar.svelte | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/flows/content/AgentResourceBar.svelte b/frontend/src/lib/components/flows/content/AgentResourceBar.svelte index bea9ec6520..6acf910d37 100644 --- a/frontend/src/lib/components/flows/content/AgentResourceBar.svelte +++ b/frontend/src/lib/components/flows/content/AgentResourceBar.svelte @@ -8,6 +8,8 @@ import ResourcePathHint from '$lib/components/ResourcePathHint.svelte' import { ResourceService, type InputTransform, type Resource } from '$lib/gen' import { sendUserToast } from '$lib/toast' + import { userStore } from '$lib/stores' + import { canWrite } from '$lib/utils' import { Bot, ChevronDown, ChevronUp, Save, Unlink, Pencil } from 'lucide-svelte' import { AGENT_BRAIN_KEYS, @@ -116,6 +118,8 @@ fromDraft: boolean providerPath?: string providerOk: boolean + /** The agent's own sharing, to tell whether this user may edit it. */ + extraPerms?: Record /** The link cannot be read. `missing` (404): nothing exists at the path, the agent having been * renamed or deleted. `forbidden` (401/403): it exists and this user is refused it, a folder * they cannot read included, which says nothing about whether a run of the flow can read it. @@ -197,7 +201,8 @@ tools, fromDraft: draft != undefined, providerPath, - providerOk + providerOk, + extraPerms: (response.extra_perms ?? {}) as Record } } ) @@ -228,6 +233,11 @@ let providerPath = $derived(linkedInfo?.providerPath) let providerOk = $derived(linkedInfo?.providerOk ?? true) let unavailable = $derived(linkedInfo?.unavailable ?? false) + let canEditAgent = $derived( + !!agent && + !$userStore?.operator && + canWrite(agent, linkedInfo?.extraPerms ?? {}, $userStore ?? undefined) + ) // The hint flips on the first keystroke in the agent editor, so the badge does not wait for the // debounced autosave and the refetch behind it; the fetched answer covers a draft written // elsewhere, which no editor here has published an opinion about. @@ -679,15 +689,43 @@ {:else if !providerOk}
- {#if providerPath} You don't have access to {providerPath}, this agent's - model provider. Unlink to fork the agent, or gain access to the provider resource. + model provider. {:else} - You don't have access to this agent's model provider. Unlink to fork the agent, or gain - access to the provider resource. + You don't have access to this agent's model provider. {/if} +
    + {#if canEditAgent && !fromAgentEditor} +
  • Edit the agent to use a provider you can access. It changes everywhere it's used.
  • + {/if} +
  • Unlink it to fork an editable copy into just this step.
  • +
  • Or ask for access to the provider resource.
  • +
+
+ {#if canEditAgent && !fromAgentEditor} + + {/if} + +
{/if}