diff --git a/frontend/src/lib/components/mcp/McpAccessPicker.svelte b/frontend/src/lib/components/mcp/McpAccessPicker.svelte index 28b7f0d12e..bf6aee8a9b 100644 --- a/frontend/src/lib/components/mcp/McpAccessPicker.svelte +++ b/frontend/src/lib/components/mcp/McpAccessPicker.svelte @@ -15,16 +15,6 @@ full: ['mcp:all', MCP_SESSION] } - /** What each access level lets the client do. */ - export const ACCESS_HINTS: Record = { - full: 'Everything you can do yourself: explore, write, test and deploy drafts, and run.', - read_run: - 'Explore, and run deployed scripts, flows and agents. The client changes nothing itself; what it runs can.', - read: 'Explore and read. Nothing is run or changed.', - selected: - 'The scripts and flows you pick, each as its own tool, and nothing else. To share a few automations.' - } - /** The access a token's MCP scopes give: `mcp:all` and how it is narrowed, or else a * selection of scripts, flows and endpoints. */ export function mcpAccessOf(scopes: string[]): McpAccess { @@ -42,17 +32,11 @@ import McpToolsModal from './McpToolsModal.svelte' import { Button } from '$lib/components/common' import type { Snippet } from 'svelte' - import { resource } from 'runed' - import Alert from '$lib/components/common/alert/Alert.svelte' - import { resolveSessionAccess } from '$lib/components/copilot/chat/global/sessionAccess' - import { accessNarrowing } from './accessNarrowing' - import { userWorkspaces } from '$lib/stores' + import { ACCESS_HINTS } from './workspaceAccess' interface Props { /** The workspace the selection picker browses. */ workspaceId: string - /** The workspaces the token reaches, to warn where one holds it to less than `access`. */ - workspaces?: string[] /** The token's MCP scopes, the workspace list aside. */ scopes?: string[] access?: McpAccess @@ -67,7 +51,6 @@ let { workspaceId, - workspaces = [], scopes = $bindable(), access = $bindable(), initialScopes = [], @@ -103,21 +86,6 @@ let toolsOpen = $state(false) const toolsetAccess = $derived(access === 'selected' ? undefined : access) - - // Each workspace's access, as the chat resolves it, to compare with the level picked. - const workspaceAccess = resource( - // Rerun once the workspace list loads: until then a role reads as its legacy defaults. - () => ({ ids: [...workspaces], roles: $userWorkspaces }), - ({ ids }) => Promise.all(ids.map(async (id) => ({ id, there: await resolveSessionAccess(id) }))) - ) - const narrowed = $derived( - access - ? (workspaceAccess.current ?? []).flatMap(({ id, there }) => { - const why = accessNarrowing(access!, there) - return why ? [{ id, why }] : [] - }) - : [] - )
@@ -135,15 +103,6 @@
{/if} - {#if narrowed.length > 0} - - - - {/if} {@render afterAccess?.()} {#if access === 'selected'} diff --git a/frontend/src/lib/components/mcp/McpWorkspaceAccessList.svelte b/frontend/src/lib/components/mcp/McpWorkspaceAccessList.svelte index 1443ea1852..a1aa333862 100644 --- a/frontend/src/lib/components/mcp/McpWorkspaceAccessList.svelte +++ b/frontend/src/lib/components/mcp/McpWorkspaceAccessList.svelte @@ -3,8 +3,15 @@ import type { McpWorkspaceAccess } from '$lib/gen' import type { McpAccess } from './McpAccessPicker.svelte' import Popover from '$lib/components/Popover.svelte' + import Tooltip from '$lib/components/Tooltip.svelte' import { Badge } from '$lib/components/common' - import { accessLabel, connectsSeparately, restriction, workspaceMcpUrl } from './workspaceAccess' + import { + accessHint, + accessLabel, + connectsSeparately, + restriction, + workspaceMcpUrl + } from './workspaceAccess' interface Props { workspaces: McpWorkspaceAccess[] @@ -12,24 +19,27 @@ covered: string[] all: boolean access: McpAccess + title?: string } - let { workspaces, covered, all, access }: Props = $props() + let { workspaces, covered, all, access, title }: Props = $props() const listed = $derived(workspaces.filter((w) => all || covered.includes(w.id))) {#if listed.length > 0}
-

What it gets

+ {#if title} +

{title}

+ {/if}