Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: shorter permission menu, Learn more, calmer Full access (#12630)
Michael Hanc2fe72ac1edd
diff --git a/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsx b/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsxindex 4d1004a2860..aac688ae9a4 100644--- a/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsx+++ b/studio/frontend/src/features/chat/bypass-permissions-menu-item.tsx@@ -4,16 +4,7 @@import { ShieldBanIcon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";-import {- AlertDialog,- AlertDialogAction,- AlertDialogCancel,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogHeader,- AlertDialogTitle,-} from "@/components/ui/alert-dialog";+import { AlertDialog } from "@/components/ui/alert-dialog";import {DropdownMenuSub,DropdownMenuSubContent,@@ -21,29 +12,26 @@ import {} from "@/components/ui/dropdown-menu";import { useChatRuntimeStore } from "@/features/chat/stores/chat-runtime-store";import {- FULL_ACCESS_WARNING,+ FullAccessConfirmContent,+ PermissionMenuLabel,PermissionModeMenuItems,} from "./permission-mode-select";// Dictation-only "+" menu fallback: the composer pill is the normal control, but it is hidden// while recording, so this is the sole way to reach permission mode then.export function BypassPermissionsMenuItem() {- const permissionMode = useChatRuntimeStore((s) => s.permissionMode);const setBypassConfirmOpen = useChatRuntimeStore((s) => s.setBypassConfirmOpen,);return (<DropdownMenuSub>- <DropdownMenuSubTrigger- className={- permissionMode === "full" ? "text-bypass font-medium" : undefined- }- >+ <DropdownMenuSubTrigger><HugeiconsIcon icon={ShieldBanIcon} strokeWidth={2} />Tool permissions</DropdownMenuSubTrigger>- <DropdownMenuSubContent className="unsloth-plus-menu w-[calc(300px*var(--ui-space-scale,1))]">+ <DropdownMenuSubContent className="unsloth-plus-menu w-[calc(330px*var(--ui-space-scale,1))]">+ <PermissionMenuLabel learnMore /><PermissionModeMenuItems// Defer past Radix's menu-close focus restoration, or the dropdown grabs focus back// and breaks the dialog's focus trap.@@ -66,27 +54,13 @@ export function BypassPermissionsConfirmDialog() {return (<AlertDialog open={open} onOpenChange={setOpen}>- <AlertDialogContent size="sm">- <AlertDialogHeader>- <AlertDialogTitle>Enable Full access?</AlertDialogTitle>- <AlertDialogDescription>- {FULL_ACCESS_WARNING}- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction- variant="destructive"- className="!bg-destructive !text-destructive-foreground hover:!bg-destructive/90"- onClick={() => {- setPermissionMode("full");- setOpen(false);- }}- >- I understand- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>+ <FullAccessConfirmContent+ onConfirm={() => {+ setPermissionMode("full");+ setOpen(false);+ }}+ onClose={() => setOpen(false)}+ /></AlertDialog>);}diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsxindex face8123c68..5ab4d6d876e 100644--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx@@ -2071,7 +2071,7 @@ function BypassPermissionsToggle() {{/* Full width, styled like the panel selects/preset input. */}<PermissionModeDropdown triggerClassName="h-9 w-full justify-between rounded-full border-0 bg-[var(--panel-input-surface)] px-3.5 text-ui-13 font-medium text-nav-fg shadow-none hover:bg-[var(--panel-input-surface)]" />{permissionMode === "full" ? (- <span className="text-ui-11 text-bypass">+ <span className="text-ui-11 text-muted-foreground">Tool calls run with no confirmation and no sandbox.</span>) : null}diff --git a/studio/frontend/src/features/chat/index.ts b/studio/frontend/src/features/chat/index.tsindex f81bc57314b..0223d26aada 100644--- a/studio/frontend/src/features/chat/index.ts+++ b/studio/frontend/src/features/chat/index.ts@@ -89,7 +89,7 @@ export {useToolPaneScope,} from "./tool-output-scope";export { useToolAwaitingApproval } from "./tool-approval";-export { PermissionModeDropdown } from "./permission-mode-select";+export { PermissionModeDropdown, useActivePermissionMode } from "./permission-mode-select";export { useChatSearchStore } from "./stores/chat-search-store";export type { ChatNavigationState } from "./stores/chat-navigation-store";export {diff --git a/studio/frontend/src/features/chat/permission-mode-select.tsx b/studio/frontend/src/features/chat/permission-mode-select.tsxindex c35281cff8d..ef6db8c078f 100644--- a/studio/frontend/src/features/chat/permission-mode-select.tsx+++ b/studio/frontend/src/features/chat/permission-mode-select.tsx@@ -1,10 +1,12 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-import { ChevronDown, CircleAlert, Hand, ShieldCheck } from "lucide-react";+import { ChevronDown, Hand, ShieldCheck } from "lucide-react";+import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";import type { ComponentType } from "react";-import { useEffect, useState } from "react";+import { useEffect, useRef, useState } from "react";import { useFullAccessAllowed } from "@/features/auth/account-session";+import { useSettingsDialogStore } from "@/features/settings";import {AlertDialog,@@ -25,9 +27,15 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { ChevronDownStandardIcon } from "@/lib/chevron-icons";+import { ShieldAlertGlyph } from "@/lib/shield-alert-icon";import { SparklesGlyph } from "@/lib/sparkles-icon";import { MenuTickIcon } from "@/lib/tick-icon";import { cn } from "@/lib/utils";+import {+ ComputerTerminal01Icon,+ Folder01Icon,+ InternetIcon,+} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import {type PermissionMode,@@ -45,34 +53,48 @@ export const PERMISSION_MODE_OPTIONS: readonly {{value: "ask",label: "Ask for approval",- description:- "Always ask before tool calls, editing files or using the internet",+ description: "Ask before using tools or the internet",icon: Hand,},{value: "auto",label: "Approve for me",- description:- "Run tool calls, but ask before high-risk actions like credential access, privilege escalation, or destructive commands",+ description: "Only ask for actions that look risky",icon: ShieldCheck,},{value: "off",label: "Run automatically",- description: "Run tool calls without approval prompts inside the sandbox",+ description: "Never ask, but keep code in the sandbox",icon: SparklesGlyph,},{value: "full",label: "Full access",- description:- "Unrestricted: no approval prompts and the code sandbox is disabled",- icon: CircleAlert,+ description: "Full access to your computer",+ icon: ShieldAlertGlyph,},] as const;-export const FULL_ACCESS_WARNING =- "Full access lets tool calls run without approval prompts or the code sandbox. They can modify or delete files, run commands, and make network requests. Enable it only when you trust the current task.";+/** What Full access opens up, listed in its confirmation. */+const FULL_ACCESS_SCOPES = [+ {+ icon: Folder01Icon,+ title: "Files",+ description: "Read, change or delete any file you can access",+ },+ {+ icon: ComputerTerminal01Icon,+ title: "Commands",+ description: "Run terminal and Python code, install packages",+ },+ {+ // The app's own internet glyph, as on Web search.+ icon: InternetIcon,+ title: "Internet",+ description: "Browse, send data and use MCP tools",+ },+] as const;export function permissionModeOption(mode: PermissionMode) {return (@@ -83,6 +105,31 @@ export function permissionModeOption(mode: PermissionMode) {);}+/** Menu heading. `learnMore` links to the fuller explanation in Settings. */+export function PermissionMenuLabel({ learnMore }: { learnMore: boolean }) {+ const openSettings = useSettingsDialogStore((s) => s.openDialog);+ return (+ <DropdownMenuLabel className="flex items-center justify-between gap-3">+ <span>Tool call permissions</span>+ {learnMore ? (+ // A menu item, so arrow keys reach it and selecting closes the menu.+ <DropdownMenuPrimitive.Item+ className="shrink-0 cursor-pointer rounded-sm underline underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground data-[highlighted]:text-foreground"+ // Deferred past the menu's focus restore.+ onSelect={() =>+ setTimeout(+ () => openSettings("general", { scrollTarget: "general-permissions" }),+ 0,+ )+ }+ >+ Learn more+ </DropdownMenuPrimitive.Item>+ ) : null}+ </DropdownMenuLabel>+ );+}+/** The option rows shared by every permission dropdown or submenu. Non-full levels apply* directly; picking Full access must go through the caller's danger confirmation. */function useAccountPermissionMode() {@@ -124,9 +171,6 @@ export function PermissionModeMenuItems({className={cn("items-start gap-2 py-2",permissionMode === option.value && "font-medium",- option.value === "full" &&- permissionMode === "full" &&- "text-bypass",)}><option.icon className="mt-0.5 size-4 shrink-0" strokeWidth={2} />@@ -140,7 +184,8 @@ export function PermissionModeMenuItems({<HugeiconsIconicon={MenuTickIcon}strokeWidth={2}- className="ml-auto mt-0.5 size-4 shrink-0"+ // Centred on both lines; sized in index.css.+ className="permission-mode-tick ml-auto size-4 shrink-0 self-center"/>) : null}</DropdownMenuItem>@@ -149,6 +194,103 @@ export function PermissionModeMenuItems({);}+/** The level in effect, for Settings to spell out. */+export function useActivePermissionMode() {+ return permissionModeOption(useAccountPermissionMode().permissionMode);+}++/** The focused element, or for a closing menu its trigger (menus label themselves by it). */+function lastFocusOutsideMenus(): HTMLElement | null {+ let element = document.activeElement;+ for (+ let menu = element?.closest('[role="menu"]');+ menu;+ menu = element?.closest('[role="menu"]')+ ) {+ const triggerId = menu.getAttribute("aria-labelledby");+ element = triggerId ? document.getElementById(triggerId) : null;+ }+ return element instanceof HTMLElement && element !== document.body ? element : null;+}++/** Full access confirmation body, shared by both dialogs that ask for it. */+export function FullAccessConfirmContent({+ onConfirm,+ onClose,+}: {+ onConfirm: () => void;+ onClose: () => void;+}) {+ const openSettings = useSettingsDialogStore((s) => s.openDialog);+ // Focus before the dialog opened, so Settings can return there and not to a removed button.+ const returnFocusRef = useRef<HTMLElement | null>(null);+ return (+ // Backdrop click cancels; no ring.+ <AlertDialogContent+ className="gap-5 p-7 ring-0 data-[size=default]:sm:max-w-[calc(500px*var(--ui-space-scale,1))]"+ onOverlayClick={onClose}+ // Focus the card, not Cancel, so Cancel shows no focus border until tabbed to.+ onOpenAutoFocus={(event) => {+ event.preventDefault();+ returnFocusRef.current = lastFocusOutsideMenus();+ (event.currentTarget as HTMLElement).focus();+ }}+ >+ <AlertDialogHeader className="gap-2">+ <AlertDialogTitle className="flex items-center gap-2.5">+ <ShieldAlertGlyph className="size-5 shrink-0" strokeWidth={2} />+ Turn on Full access?+ </AlertDialogTitle>+ {/* text-pretty: balance splits this sentence into two short lines. */}+ <AlertDialogDescription className="text-pretty leading-relaxed">+ Tools will run without asking and outside the sandbox, including:+ </AlertDialogDescription>+ </AlertDialogHeader>+ <ul className="flex flex-col rounded-2xl bg-muted/50 px-5 py-1.5">+ {FULL_ACCESS_SCOPES.map((scope) => (+ <li key={scope.title} className="flex items-center gap-4 py-3">+ <HugeiconsIcon+ icon={scope.icon}+ strokeWidth={1.75}+ className="size-5 shrink-0 text-muted-foreground"+ />+ <span className="flex min-w-0 flex-col gap-0.5">+ <span className="text-sm font-medium">{scope.title}</span>+ <span className="text-xs leading-relaxed text-muted-foreground">+ {scope.description}+ </span>+ </span>+ </li>+ ))}+ </ul>+ <p className="text-pretty text-xs leading-relaxed text-muted-foreground">+ Risks include data loss or exposure and prompt injection. You can turn this off+ anytime.{" "}+ <button+ type="button"+ className="cursor-pointer text-foreground underline underline-offset-2"+ onClick={() => {+ onClose();+ openSettings("general", {+ scrollTarget: "general-permissions",+ opener: returnFocusRef.current,+ });+ }}+ >+ Learn more+ </button>+ </p>+ <AlertDialogFooter className="mt-1">+ {/* Muted, not outline: outline keeps a border in light mode. */}+ <AlertDialogCancel variant="muted">Cancel</AlertDialogCancel>+ <AlertDialogAction variant="destructive" onClick={onConfirm}>+ Turn on+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ );+}+/** Danger confirmation shown before Full access turns on. Self-contained so the dropdown works* outside the chat page (e.g. the Settings dialog). */export function FullAccessConfirmDialog({@@ -164,27 +306,13 @@ export function FullAccessConfirmDialog({return (<AlertDialog open={open} onOpenChange={onOpenChange}>- <AlertDialogContent size="sm">- <AlertDialogHeader>- <AlertDialogTitle>Enable Full access?</AlertDialogTitle>- <AlertDialogDescription>- {FULL_ACCESS_WARNING}- </AlertDialogDescription>- </AlertDialogHeader>- <AlertDialogFooter>- <AlertDialogCancel>Cancel</AlertDialogCancel>- <AlertDialogAction- variant="destructive"- className="!bg-destructive !text-destructive-foreground hover:!bg-destructive/90"- onClick={() => {- setPermissionMode("full");- onOpenChange(false);- }}- >- I understand- </AlertDialogAction>- </AlertDialogFooter>- </AlertDialogContent>+ <FullAccessConfirmContent+ onConfirm={() => {+ setPermissionMode("full");+ onOpenChange(false);+ }}+ onClose={() => onOpenChange(false)}+ /></AlertDialog>);}@@ -195,10 +323,13 @@ export function PermissionModeDropdown({side = "bottom",align = "end",triggerClassName,+ learnMore = true,}: {side?: "top" | "bottom";align?: "start" | "end";triggerClassName?: string;+ /** Off in Settings, which already shows the full explanation. */+ learnMore?: boolean;} = {}) {const { permissionMode, fullAccessAllowed } = useAccountPermissionMode();const [confirmOpen, setConfirmOpen] = useState(false);@@ -212,13 +343,7 @@ export function PermissionModeDropdown({<Buttonvariant="outline"size="sm"- className={cn(- "gap-1.5",- triggerClassName,- // Last so a text color in triggerClassName cannot override it.- permissionMode === "full" &&- "text-bypass hover:text-bypass border-bypass/50",- )}+ className={cn("gap-1.5", triggerClassName)}aria-label="Permission level for tool calls"><ActiveIcon className="size-3.5 shrink-0" strokeWidth={2} />@@ -231,12 +356,10 @@ export function PermissionModeDropdown({<DropdownMenuContentside={side}align={align}- className="w-[calc(300px*var(--ui-space-scale,1))]"+ className="w-[calc(330px*var(--ui-space-scale,1))]"avoidCollisions={true}>- <DropdownMenuLabel>- How should tool calls be approved?- </DropdownMenuLabel>+ <PermissionMenuLabel learnMore={learnMore} /><PermissionModeMenuItems// Defer past the menu-close focus restoration so the dialog's focus trap is not broken by the// dropdown grabbing focus back.@@ -255,9 +378,8 @@ export function PermissionModeDropdown({}/** Composer pill showing the current permission level in the chat box; clicking opens the level- * dropdown. Danger-styled while Full access is on. The Full access pick routes through the- * store-driven confirm dialog mounted at the chat-page root, so the warning survives this- * menu unmounting. */+ * dropdown. The Full access pick routes through the store-driven confirm dialog mounted at the+ * chat-page root, so the warning survives this menu unmounting. */export function PermissionModeComposerPill({side = "bottom",}: {@@ -269,7 +391,6 @@ export function PermissionModeComposerPill({);const active = permissionModeOption(permissionMode);const ActiveIcon = active.icon;- const fullAccess = permissionMode === "full";return (<DropdownMenu>@@ -278,8 +399,6 @@ export function PermissionModeComposerPill({type="button"className="composer-pill-btn composer-pill-permissions"data-pill-label={active.label}- data-active={fullAccess ? "true" : "false"}- data-variant={fullAccess ? "danger" : undefined}aria-label="Permission level for tool calls"title={`${active.label}: ${active.description}`}>@@ -299,11 +418,9 @@ export function PermissionModeComposerPill({align="start"sideOffset={0}avoidCollisions={true}- className="unsloth-plus-menu w-[calc(300px*var(--ui-space-scale,1))]"+ className="unsloth-plus-menu w-[calc(330px*var(--ui-space-scale,1))]">- <DropdownMenuLabel>- How should tool calls be approved?- </DropdownMenuLabel>+ <PermissionMenuLabel learnMore={true} /><PermissionModeMenuItems// Defer past the menu-close focus restoration (see PermissionModeDropdown).onRequestFullAccess={() =>diff --git a/studio/frontend/src/features/settings/stores/settings-dialog-store.ts b/studio/frontend/src/features/settings/stores/settings-dialog-store.tsindex 57ba09a0f5f..c200ab5f8ac 100644--- a/studio/frontend/src/features/settings/stores/settings-dialog-store.ts+++ b/studio/frontend/src/features/settings/stores/settings-dialog-store.ts@@ -35,6 +35,7 @@ export type SettingsScrollTarget =| "chat-composer"| "chat-canvas-network"| "general-hub"+ | "general-permissions"| "library-storage"| "resources-caches";@@ -137,6 +138,7 @@ const SCROLL_TARGET_TAB: Record<SettingsScrollTarget, SettingsTab> = {"appearance-sidebar-nav": "appearance","chat-canvas-network": "chat","general-hub": "general",+ "general-permissions": "general","library-storage": "library","resources-caches": "resources",};diff --git a/studio/frontend/src/features/settings/tabs/general-tab.tsx b/studio/frontend/src/features/settings/tabs/general-tab.tsxindex 278fab1a75f..a6a18b3af2a 100644--- a/studio/frontend/src/features/settings/tabs/general-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/general-tab.tsx@@ -12,7 +12,11 @@ import {} from "@/components/ui/dialog";import { Input } from "@/components/ui/input";import { Switch } from "@/components/ui/switch";-import { PermissionModeDropdown, useChatRuntimeStore } from "@/features/chat";+import {+ PermissionModeDropdown,+ useActivePermissionMode,+ useChatRuntimeStore,+} from "@/features/chat";// From the keys module, not the barrel or the store: both are in an import cycle with this file,// so the key was still in its temporal dead zone when the module-scope list below read it, killing// the module graph. The keys module imports nothing, so it is always evaluated first.@@ -84,6 +88,7 @@ import { useDesktopBooleanSetting } from "../hooks/use-desktop-boolean-setting";import { KEYBOARD_SHORTCUTS_STORAGE_KEY } from "../stores/keyboard-shortcuts-store";import { INTERFACE_SCALE_STORAGE_KEY } from "../stores/interface-scale-store";import { SETTINGS_PANEL_PREFS_STORAGE_KEY } from "../stores/settings-panel-prefs-store";+import { useSettingsDialogStore } from "../stores/settings-dialog-store";import { CHAT_PROJECT_ATTACHMENT_TARGET_KEY } from "@/features/chat/utils/project-attachment-target";// Keys cleared by "Reset all local preferences". NEVER include auth/session keys here -- that@@ -192,6 +197,20 @@ function resetAllPrefs() {export function GeneralTab() {const isOwner = useIsAccountOwner();const t = useT();+ const permissionsRef = useRef<HTMLElement | null>(null);+ const activePermission = useActivePermissionMode();+ const scrollTarget = useSettingsDialogStore((s) => s.scrollTarget);+ const consumeScrollTarget = useSettingsDialogStore((s) => s.consumeScrollTarget);++ // Learn more in the permission menus.+ useEffect(() => {+ if (scrollTarget !== "general-permissions") return;+ const frame = window.requestAnimationFrame(() => {+ permissionsRef.current?.scrollIntoView({ block: "start", behavior: "smooth" });+ consumeScrollTarget("general-permissions");+ });+ return () => window.cancelAnimationFrame(frame);+ }, [consumeScrollTarget, scrollTarget]);const hfToken = useChatRuntimeStore((s) => s.hfToken);const setHfToken = useChatRuntimeStore((s) => s.setHfToken);@@ -545,12 +564,16 @@ export function GeneralTab() {</SettingsRow></SettingsSection>- <SettingsSection title={t("settings.general.permissions.sectionTitle")}>+ <SettingsSection+ ref={permissionsRef}+ title={t("settings.general.permissions.sectionTitle")}+ >+ {/* The selected level, explained in full. */}<SettingsRow- label={t("settings.general.permissions.bypassLabel")}- description={t("settings.general.permissions.bypassDescription")}+ label={t(`settings.general.permissions.names.${activePermission.value}`)}+ description={t(`settings.general.permissions.details.${activePermission.value}`)}>- <PermissionModeDropdown />+ <PermissionModeDropdown learnMore={false} /></SettingsRow></SettingsSection>diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex eb91cd9b44a..2a9982b3198 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -1251,9 +1251,22 @@ export const ar = {},permissions: {sectionTitle: "الأذونات",- bypassLabel: "أذونات الأدوات",- bypassDescription:- "كيفية موافقة Unsloth على استدعاءات أدوات المحادثة (الطرفية، python، الويب، MCP) قبل تشغيلها. وضع «Full access» يعطّل الموافقات وصندوق عزل الشيفرة.",+ names: {+ ask: "طلب الموافقة",+ auto: "الموافقة نيابةً عني",+ off: "التشغيل تلقائيًا",+ full: "وصول كامل",+ },+ details: {+ ask:+ "يطلب الموافقة قبل كل استدعاء أداة، بما في ذلك شيفرة الطرفية وPython وعمليات البحث في الويب وتعديل الملفات وأدوات MCP. الأدوات التي يشغّلها مزوّد خارجي لا تتوقف لطلب الموافقة. الأنسب عندما تريد مراجعة كل خطوة.",+ auto:+ "يشغّل استدعاءات الأدوات المعتادة تلقائيًا ولا يطلب الموافقة إلا عندما يبدو الإجراء خطرًا، مثل قراءة بيانات الاعتماد أو رفع الصلاحيات أو تشغيل أوامر مدمّرة.",+ off:+ "يشغّل كل استدعاءات الأدوات دون سؤال. تظل شيفرة Python والطرفية تعمل داخل صندوق العزل، الذي يحدّ من الملفات التي يمكنها الوصول إليها على جهازك.",+ full:+ "يشغّل كل استدعاءات الأدوات دون سؤال ويوقف صندوق عزل الشيفرة، فيمكن لشيفرة Python والطرفية قراءة أي ملف يصل إليه حسابك وتغييره. الأنسب للمهام الموثوقة التي تحتاج إلى العمل خارج صندوق العزل.",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 2c01edb1379..7b3a9468e07 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -1277,9 +1277,22 @@ export const de = {},permissions: {sectionTitle: "Berechtigungen",- bypassLabel: "Tool-Berechtigungen",- bypassDescription:- "Wie Unsloth Tool-Aufrufe im Chat (Terminal, Python, Web, MCP) vor der Ausführung freigibt. „Full access“ deaktiviert die Freigaben und die Code-Sandbox.",+ names: {+ ask: "Zustimmung einholen",+ auto: "Für mich freigeben",+ off: "Automatisch ausführen",+ full: "Vollzugriff",+ },+ details: {+ ask:+ "Fragt vor jedem Tool-Aufruf nach, auch bei Terminal- und Python-Code, Websuchen, Dateiänderungen und MCP-Tools. Tools, die ein externer Anbieter ausführt, werden nicht angehalten. Ideal, wenn du jeden Schritt prüfen möchtest.",+ auto:+ "Führt gewöhnliche Tool-Aufrufe selbst aus und fragt nur nach, wenn eine Aktion riskant wirkt, etwa beim Lesen von Zugangsdaten, beim Erhöhen von Rechten oder bei zerstörerischen Befehlen.",+ off:+ "Führt jeden Tool-Aufruf ohne Nachfrage aus. Python- und Terminal-Code läuft weiterhin in der Sandbox, die begrenzt, auf welche Dateien deines Computers er zugreifen kann.",+ full:+ "Führt jeden Tool-Aufruf ohne Nachfrage aus und schaltet die Code-Sandbox ab, sodass Python- und Terminal-Code jede Datei lesen und ändern kann, auf die dein Konto zugreifen kann. Ideal für vertrauenswürdige Aufgaben, die außerhalb der Sandbox arbeiten müssen.",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex c2f9922bb08..14df2fb56fe 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -1159,9 +1159,22 @@ export const en = {},permissions: {sectionTitle: "Permissions",- bypassLabel: "Tool permissions",- bypassDescription:- "How Unsloth approves chat tool calls (terminal, python, web, MCP) before they run. Full access disables approvals and the code sandbox.",+ names: {+ ask: "Ask for approval",+ auto: "Approve for me",+ off: "Run automatically",+ full: "Full access",+ },+ details: {+ ask:+ "Asks before every tool call, including terminal and Python code, web searches, file edits and MCP tools. Tools run by an external provider are not paused. Best when you want to review each step.",+ auto:+ "Runs routine tool calls on its own and only asks when an action looks risky, such as reading credentials, escalating privileges or running destructive commands.",+ off:+ "Runs every tool call without asking. Python and terminal code still run in the sandbox, which limits which files they can reach on your computer.",+ full:+ "Runs every tool call without asking and turns off the code sandbox, so Python and terminal code can read and change any file your account can access. Best for trusted tasks that need to work outside the sandbox.",+ },},notifications: {sectionTitle: "Notifications",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex f495e541a1f..d8acb17c0a7 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -1272,9 +1272,22 @@ export const es = {},permissions: {sectionTitle: "Permisos",- bypassLabel: "Permisos de herramientas",- bypassDescription:- "Cómo aprueba Unsloth las llamadas a herramientas del chat (terminal, python, web, MCP) antes de ejecutarlas. El modo «Full access» desactiva las aprobaciones y el sandbox de código.",+ names: {+ ask: "Pedir aprobación",+ auto: "Aprobar por mí",+ off: "Ejecutar automáticamente",+ full: "Acceso total",+ },+ details: {+ ask:+ "Pide aprobación antes de cada llamada a herramientas, incluido el código de terminal y Python, las búsquedas web, la edición de archivos y las herramientas MCP. Las herramientas que ejecuta un proveedor externo no se detienen. Ideal si quieres revisar cada paso.",+ auto:+ "Ejecuta por sí solo las llamadas habituales y solo pregunta cuando una acción parece arriesgada, como leer credenciales, elevar privilegios o ejecutar comandos destructivos.",+ off:+ "Ejecuta todas las llamadas a herramientas sin preguntar. El código de Python y terminal sigue ejecutándose en el sandbox, que limita a qué archivos de tu equipo puede acceder.",+ full:+ "Ejecuta todas las llamadas a herramientas sin preguntar y desactiva el sandbox de código, así el código de Python y terminal puede leer y cambiar cualquier archivo al que tenga acceso tu cuenta. Ideal para tareas de confianza que necesitan trabajar fuera del sandbox.",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex 6bfd3e91f0e..3fd07e3e558 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -1275,9 +1275,22 @@ export const fr = {},permissions: {sectionTitle: "Autorisations",- bypassLabel: "Autorisations des outils",- bypassDescription:- "Comment Unsloth approuve les appels d'outils de la discussion (terminal, python, web, MCP) avant leur exécution. Le mode « Full access » désactive les demandes d'approbation et le bac à sable d'exécution du code.",+ names: {+ ask: "Demander l'accord",+ auto: "Approuver pour moi",+ off: "Exécuter automatiquement",+ full: "Accès complet",+ },+ details: {+ ask:+ "Demande votre accord avant chaque appel d'outil, y compris le code terminal et Python, les recherches web, les modifications de fichiers et les outils MCP. Les outils exécutés par un fournisseur externe ne sont pas mis en pause. Idéal pour vérifier chaque étape.",+ auto:+ "Exécute seul les appels d'outils courants et ne demande votre accord que lorsqu'une action semble risquée, comme lire des identifiants, élever des privilèges ou lancer des commandes destructrices.",+ off:+ "Exécute chaque appel d'outil sans demander. Le code Python et terminal reste exécuté dans le bac à sable, qui limite les fichiers auxquels il peut accéder sur votre ordinateur.",+ full:+ "Exécute chaque appel d'outil sans demander et désactive le bac à sable du code : le code Python et terminal peut lire et modifier tout fichier accessible à votre compte. Idéal pour les tâches de confiance qui doivent travailler hors du bac à sable.",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex c196bb64902..c0f97102c3b 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -1254,9 +1254,22 @@ export const hi = {},permissions: {sectionTitle: "अनुमतियां",- bypassLabel: "टूल अनुमतियां",- bypassDescription:- "चैट के टूल कॉल (टर्मिनल, python, वेब, MCP) चलाने से पहले Unsloth उन्हें कैसे मंज़ूरी देता है। “Full access” मोड से मंज़ूरी और कोड सैंडबॉक्स बंद हो जाते हैं।",+ names: {+ ask: "अनुमति मांगें",+ auto: "मेरी ओर से स्वीकृत करें",+ off: "अपने आप चलाएं",+ full: "पूरी पहुंच",+ },+ details: {+ ask:+ "हर टूल कॉल से पहले पूछता है, जिसमें टर्मिनल और Python कोड, वेब सर्च, फ़ाइल बदलाव और MCP टूल शामिल हैं। बाहरी प्रोवाइडर द्वारा चलाए गए टूल नहीं रुकते। तब सबसे अच्छा, जब आप हर कदम की समीक्षा करना चाहें।",+ auto:+ "सामान्य टूल कॉल अपने आप चलाता है और सिर्फ़ तब पूछता है जब कोई काम जोखिम भरा लगे, जैसे क्रेडेंशियल पढ़ना, अधिकार बढ़ाना या विनाशकारी कमांड चलाना।",+ off:+ "हर टूल कॉल बिना पूछे चलाता है। Python और टर्मिनल कोड फिर भी सैंडबॉक्स में चलता है, जो सीमित करता है कि वह आपके कंप्यूटर की किन फ़ाइलों तक पहुंच सकता है।",+ full:+ "हर टूल कॉल बिना पूछे चलाता है और कोड सैंडबॉक्स बंद कर देता है, ताकि Python और टर्मिनल कोड आपके खाते की पहुंच वाली कोई भी फ़ाइल पढ़ और बदल सके। उन भरोसेमंद कामों के लिए सबसे अच्छा, जिन्हें सैंडबॉक्स के बाहर काम करना हो।",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex b8b6068edfa..5a7e429ec35 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -1102,9 +1102,22 @@ export const it = {},permissions: {sectionTitle: "Autorizzazioni",- bypassLabel: "Autorizzazioni degli strumenti",- bypassDescription:- "Come Unsloth approva le chiamate agli strumenti della chat (terminale, python, web, MCP) prima che vengano eseguite. La modalità «Full access» disattiva le approvazioni e la sandbox del codice.",+ names: {+ ask: "Chiedi conferma",+ auto: "Approva per me",+ off: "Esegui automaticamente",+ full: "Accesso completo",+ },+ details: {+ ask:+ "Chiede conferma prima di ogni chiamata agli strumenti, compresi codice da terminale e Python, ricerche web, modifiche ai file e strumenti MCP. Gli strumenti eseguiti da un provider esterno non vengono messi in pausa. Ideale se vuoi controllare ogni passaggio.",+ auto:+ "Esegue da solo le chiamate abituali e chiede conferma solo quando un'azione sembra rischiosa, come leggere credenziali, aumentare i privilegi o eseguire comandi distruttivi.",+ off:+ "Esegue ogni chiamata agli strumenti senza chiedere. Il codice Python e da terminale viene comunque eseguito nella sandbox, che limita i file del tuo computer a cui può accedere.",+ full:+ "Esegue ogni chiamata agli strumenti senza chiedere e disattiva la sandbox del codice, così il codice Python e da terminale può leggere e modificare qualsiasi file accessibile al tuo account. Ideale per attività affidabili che devono lavorare fuori dalla sandbox.",+ },},notifications: {sectionTitle: "Notifiche",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex 6b01ae47325..fa6f478bccd 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -1235,9 +1235,22 @@ export const ja = {},permissions: {sectionTitle: "権限",- bypassLabel: "ツールの権限",- bypassDescription:- "チャットのツール呼び出し (ターミナル、python、ウェブ、MCP) を実行する前に、Unsloth がどのように承認するかを決めます。「Full access」にすると承認とコードサンドボックスが無効になります。",+ names: {+ ask: "承認を求める",+ auto: "代わりに承認",+ off: "自動で実行",+ full: "フルアクセス",+ },+ details: {+ ask:+ "ターミナルや Python のコード、ウェブ検索、ファイル編集、MCP ツールを含め、すべてのツール呼び出しの前に確認します。外部プロバイダーが実行するツールは一時停止されません。各ステップを確認したいときに最適です。",+ auto:+ "通常のツール呼び出しは自動で実行し、認証情報の読み取り、権限昇格、破壊的なコマンドなど、危険そうな操作のときだけ確認します。",+ off:+ "すべてのツール呼び出しを確認なしで実行します。Python とターミナルのコードは引き続きサンドボックス内で実行され、コンピューター上でアクセスできるファイルが制限されます。",+ full:+ "すべてのツール呼び出しを確認なしで実行し、コードサンドボックスをオフにします。Python とターミナルのコードは、アカウントがアクセスできる任意のファイルを読み取り、変更できます。サンドボックスの外で作業する必要がある、信頼できるタスクに最適です。",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex b2775dc673e..b4f9d60400a 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -1247,9 +1247,22 @@ export const ko = {},permissions: {sectionTitle: "권한",- bypassLabel: "도구 권한",- bypassDescription:- "채팅의 도구 호출(터미널, python, 웹, MCP)을 실행하기 전에 Unsloth가 승인하는 방식입니다. “Full access”를 선택하면 승인과 코드 샌드박스가 꺼집니다.",+ names: {+ ask: "승인 요청",+ auto: "대신 승인",+ off: "자동 실행",+ full: "전체 액세스",+ },+ details: {+ ask:+ "터미널 및 Python 코드, 웹 검색, 파일 편집, MCP 도구를 포함해 모든 도구 호출 전에 묻습니다. 외부 제공업체가 실행하는 도구는 멈추지 않습니다. 각 단계를 직접 확인하고 싶을 때 적합합니다.",+ auto:+ "일반적인 도구 호출은 알아서 실행하고, 자격 증명 읽기, 권한 상승, 파괴적인 명령 실행처럼 위험해 보이는 작업일 때만 묻습니다.",+ off:+ "모든 도구 호출을 묻지 않고 실행합니다. Python과 터미널 코드는 여전히 샌드박스 안에서 실행되어 컴퓨터에서 접근할 수 있는 파일이 제한됩니다.",+ full:+ "모든 도구 호출을 묻지 않고 실행하며 코드 샌드박스를 꺼서, Python과 터미널 코드가 계정이 접근할 수 있는 모든 파일을 읽고 변경할 수 있습니다. 샌드박스 밖에서 작업해야 하는 신뢰할 수 있는 작업에 적합합니다.",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 8f117635011..8a5df4b17e7 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -1264,9 +1264,22 @@ export const ptBR = {},permissions: {sectionTitle: "Permissões",- bypassLabel: "Permissões de ferramentas",- bypassDescription:- "Como o Unsloth aprova as chamadas de ferramentas do chat (terminal, python, web, MCP) antes de executá-las. O modo “Full access” desativa as aprovações e o sandbox de código.",+ names: {+ ask: "Pedir aprovação",+ auto: "Aprovar por mim",+ off: "Executar automaticamente",+ full: "Acesso total",+ },+ details: {+ ask:+ "Pede aprovação antes de cada chamada de ferramenta, incluindo código de terminal e Python, buscas na web, edição de arquivos e ferramentas MCP. Ferramentas executadas por um provedor externo não são pausadas. Ideal quando você quer revisar cada etapa.",+ auto:+ "Executa sozinho as chamadas comuns e só pergunta quando uma ação parece arriscada, como ler credenciais, elevar privilégios ou executar comandos destrutivos.",+ off:+ "Executa todas as chamadas de ferramentas sem perguntar. O código de Python e terminal continua rodando no sandbox, que limita quais arquivos do seu computador ele pode acessar.",+ full:+ "Executa todas as chamadas de ferramentas sem perguntar e desativa o sandbox de código, assim o código de Python e terminal pode ler e alterar qualquer arquivo que sua conta acessa. Ideal para tarefas confiáveis que precisam trabalhar fora do sandbox.",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex 1cbfcc31e4c..1aff59f13cb 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -1256,9 +1256,22 @@ export const ru = {},permissions: {sectionTitle: "Разрешения",- bypassLabel: "Разрешения инструментов",- bypassDescription:- "Как Unsloth подтверждает вызовы инструментов в чате (терминал, python, веб, MCP) перед запуском. Режим «Full access» отключает подтверждения и песочницу для кода.",+ names: {+ ask: "Запрашивать одобрение",+ auto: "Одобрять за меня",+ off: "Выполнять автоматически",+ full: "Полный доступ",+ },+ details: {+ ask:+ "Спрашивает перед каждым вызовом инструмента, включая код в терминале и Python, веб-поиск, правку файлов и инструменты MCP. Инструменты, которые выполняет внешний провайдер, не приостанавливаются. Подходит, если вы хотите проверять каждый шаг.",+ auto:+ "Сам выполняет обычные вызовы инструментов и спрашивает, только когда действие выглядит рискованным, например чтение учётных данных, повышение привилегий или разрушительные команды.",+ off:+ "Выполняет все вызовы инструментов без вопросов. Код Python и терминала по-прежнему запускается в песочнице, которая ограничивает доступ к файлам на вашем компьютере.",+ full:+ "Выполняет все вызовы инструментов без вопросов и отключает песочницу для кода, поэтому код Python и терминала может читать и изменять любые файлы, доступные вашей учётной записи. Подходит для надёжных задач, которым нужно работать вне песочницы.",+ },},},profile: {diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex 32fcaf1869d..5908d314773 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -1229,9 +1229,22 @@ export const zhCN = {},permissions: {sectionTitle: "权限",- bypassLabel: "工具权限",- bypassDescription:- "设置 Unsloth 执行聊天中的工具调用(终端、python、网页、MCP)前的审批方式。“Full access”会关闭审批和代码沙箱。",+ names: {+ ask: "请求批准",+ auto: "替我批准",+ off: "自动运行",+ full: "完全访问",+ },+ details: {+ ask:+ "每次调用工具前都会询问,包括终端和 Python 代码、网页搜索、编辑文件以及 MCP 工具。由外部提供商运行的工具不会暂停。适合需要逐步检查的场景。",+ auto:+ "常规工具调用会自动执行,只有在操作看起来有风险时才会询问,例如读取凭据、提升权限或执行破坏性命令。",+ off:+ "所有工具调用都不再询问。Python 和终端代码仍在沙箱中运行,沙箱会限制它们能访问你电脑上的哪些文件。",+ full:+ "所有工具调用都不再询问,并关闭代码沙箱,Python 和终端代码可以读取和修改你的账户能访问的任何文件。适合需要在沙箱外工作的可信任务。",+ },},},profile: {diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 8b0a76fbe94..518a457d991 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -3121,7 +3121,7 @@ html[data-chat-font] .aui-root {}.composer-pill-btn {- @apply flex cursor-pointer items-center gap-1.5 rounded-full py-1.5 pl-2 pr-2.5 text-ui-14 font-medium text-muted-foreground/70 dark:text-foreground transition-colors hover:bg-primary/10 dark:hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40;+ @apply flex cursor-pointer select-none items-center gap-1.5 rounded-full py-1.5 pl-2 pr-2.5 text-ui-14 font-medium text-muted-foreground/70 dark:text-foreground transition-colors hover:bg-primary/10 dark:hover:bg-accent disabled:cursor-not-allowed disabled:opacity-40;}/* Caret pills (RAG, MCP): the chevron carries its own whitespace, so the@@ -3182,29 +3182,20 @@ html[data-chat-font] .aui-root {.composer-pill-btn[data-active="true"] {color: var(--primary);}+ /* A pill keeps its hover fill while its menu is open. */+ .composer-pill-btn[data-state="open"] {+ @apply bg-primary/10 dark:bg-accent;+ }/* Permission-level pill: higher-contrast grey than the resting pills sothe active level stays legible (darker in light mode, lighter in dark).- Full access keeps the danger yellow below. */- .composer-pill-btn.composer-pill-permissions:not([data-variant="danger"]) {+ Full access looks like every other level. */+ .composer-pill-btn.composer-pill-permissions {color: color-mix(in oklab, var(--foreground) 60%, transparent);}- .dark .composer-pill-btn.composer-pill-permissions:not([data-variant="danger"]) {+ .dark .composer-pill-btn.composer-pill-permissions {/* Full ink, like the rest of the composer's controls. */color: var(--foreground);}- /* Bypass permissions badge: bright yellow text, no resting fill; the- rounded hover pill picks up the yellow accent like other toggles. */- .composer-pill-btn[data-variant="danger"] {- background-color: transparent;- color: var(--bypass);- }- .composer-pill-btn[data-variant="danger"]:hover {- background-color: color-mix(in oklab, var(--bypass) 7%, transparent);- }- /* Match the hover-X circle to the yellow accent instead of the green primary. */- .composer-pill-btn[data-variant="danger"] .composer-pill-x {- background-color: color-mix(in oklab, var(--bypass) 13%, transparent);- }/* Fixed-width icon slot so every pill's icon occupies the same space andthe labels line up on an even rhythm, regardless of icon size. */@@ -3572,6 +3563,11 @@ html[data-chat-font] .aui-root {outline: none;box-shadow: 0 0 0 1px var(--ring-soft);}+ /* A menu refocusing its pill after a click is not keyboard focus. */+ html[data-input-modality="pointer"]+ :is(.composer-pill-btn, .unsloth-thinking-pill, .unsloth-composer-plus):focus-visible {+ box-shadow: none;+ }/* Clickable controls never show the browser's blue outline (Radix re-focusestriggers on menu close, which lights them up). Mouse focus also drops the@@ -3979,6 +3975,14 @@ html[data-chat-font] .aui-root {height: var(--ui-icon-size) !important;}+ /* Permission menu tick, 2px above the icons. Outranks the rule above. */+ :is([data-slot="dropdown-menu-content"], .unsloth-plus-menu)+ [data-slot="dropdown-menu-item"]+ svg.permission-mode-tick:not(.unsloth-tick) {+ width: calc(var(--ui-icon-size) + 2px) !important;+ height: calc(var(--ui-icon-size) + 2px) !important;+ }+/* The rule above pins svg size with !important, straight off --ui-icon-size, so a glyphnever sees the --icon-size the row menu retunes. Same rule, one class deeper. */.unsloth-plus-menu.sidebar-row-menu :is(diff --git a/studio/frontend/src/lib/input-modality.ts b/studio/frontend/src/lib/input-modality.tsnew file mode 100644index 00000000000..a5e8cd58892--- /dev/null+++ b/studio/frontend/src/lib/input-modality.ts@@ -0,0 +1,23 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++/**+ * Marks <html data-input-modality> as "pointer" or "keyboard" from the last input.+ * Radix refocuses a menu's trigger on close and Chrome counts that as+ * :focus-visible, so CSS uses this to keep keyboard rings off after a click.+ */+export function watchInputModality(win: Window): void {+ const root = win.document.documentElement;+ const set = (modality: "pointer" | "keyboard") => {+ if (root.dataset.inputModality !== modality) root.dataset.inputModality = modality;+ };+ win.addEventListener("pointerdown", () => set("pointer"), { capture: true, passive: true });+ win.addEventListener(+ "keydown",+ (event) => {+ // A bare modifier is not navigation.+ if (!["Shift", "Control", "Alt", "Meta"].includes(event.key)) set("keyboard");+ },+ { capture: true },+ );+}diff --git a/studio/frontend/src/lib/shield-alert-icon.tsx b/studio/frontend/src/lib/shield-alert-icon.tsxnew file mode 100644index 00000000000..954f101cb73--- /dev/null+++ b/studio/frontend/src/lib/shield-alert-icon.tsx@@ -0,0 +1,58 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";++// Hugeicons "Shield Alert" (stroke-rounded), newer than the pinned free-icons package.+// https://hugeicons.com/icon/shield-alert+export const ShieldAlertIcon: IconSvgElement = [+ [+ "path",+ {+ d: "M11.9922 8L11.9922 12",+ stroke: "currentColor",+ strokeLinecap: "round",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "0",+ },+ ],+ [+ "path",+ {+ d: "M12.1172 15.75L11.9922 15.75M12.2422 15.75C12.2422 15.8881 12.1303 16 11.9922 16C11.8541 16 11.7422 15.8881 11.7422 15.75C11.7422 15.6119 11.8541 15.5 11.9922 15.5C12.1303 15.5 12.2422 15.6119 12.2422 15.75Z",+ stroke: "currentColor",+ strokeLinecap: "round",+ strokeLinejoin: "round",+ strokeWidth: "1.5",+ key: "1",+ },+ ],+ [+ "path",+ {+ d: "M20.9922 11.1835V8.28041C20.9922 6.64041 20.9922 5.82041 20.5881 5.28541C20.184 4.75042 19.2703 4.49068 17.4429 3.97122C16.1944 3.61632 15.0938 3.18875 14.2145 2.79841C13.0156 2.26622 12.4161 2.00012 11.9922 2.00012C11.5682 2.00012 10.9688 2.26622 9.7699 2.79841C8.89057 3.18875 7.79002 3.61632 6.54152 3.97122C4.71411 4.49068 3.80041 4.75042 3.3963 5.28541C2.99219 5.82041 2.99219 6.64041 2.99219 8.28041V11.1835C2.99219 16.8086 8.05496 20.1836 10.5861 21.5195C11.1932 21.8399 11.4968 22.0001 11.9922 22.0001C12.4876 22.0001 12.7911 21.8399 13.3982 21.5195C15.9294 20.1836 20.9922 16.8086 20.9922 11.1835Z",+ stroke: "currentColor",+ strokeLinecap: "round",+ strokeWidth: "1.5",+ key: "2",+ },+ ],+];++/** Lucide-compatible wrapper, for the permission-mode option list. */+export function ShieldAlertGlyph({+ className,+ strokeWidth,+}: {+ className?: string;+ strokeWidth?: number;+}) {+ return (+ <HugeiconsIcon+ icon={ShieldAlertIcon}+ className={className}+ strokeWidth={strokeWidth}+ />+ );+}diff --git a/studio/frontend/src/main.tsx b/studio/frontend/src/main.tsxindex 1fdfa7ba6b6..af0249b8ac6 100644--- a/studio/frontend/src/main.tsx+++ b/studio/frontend/src/main.tsx@@ -19,6 +19,7 @@ import {import { initializeLocale } from "./i18n";import { isTauri } from "./lib/api-base";import { setHubSessionRefresh } from "./lib/hf-endpoint";+import { watchInputModality } from "./lib/input-modality";import { watchOverlayScrollbarGutter } from "./lib/overlay-scrollbar";setHubSessionRefresh(refreshSession);@@ -57,6 +58,7 @@ watchMathBlockContainmentOverride();// Keep right-edge controls clear of overlay scrollbars.watchOverlayScrollbarGutter(window);+watchInputModality(window);function renderApp(): void {root.render(diff --git a/studio/frontend/tests/account-permissions.test.ts b/studio/frontend/tests/account-permissions.test.tsindex c34285ff44a..50e0b33e9e8 100644--- a/studio/frontend/tests/account-permissions.test.ts+++ b/studio/frontend/tests/account-permissions.test.ts@@ -35,10 +35,15 @@ function permissionUi(loginMode: string, permissionMode: string) {},"lucide-react": {ChevronDown: "ChevronDown",- CircleAlert: "CircleAlert",Hand: "Hand",ShieldCheck: "ShieldCheck",},+ "radix-ui": { DropdownMenu: { Item: "DropdownMenuPrimitive.Item" } },+ "@/features/settings": {+ useSettingsDialogStore: (selector: (state: unknown) => unknown) =>+ selector({ openDialog: () => {} }),+ },+ "@/i18n": { useT: () => (key: string) => key },"@/features/auth/account-session": {useFullAccessAllowed: () => loginMode !== "multi",},@@ -47,6 +52,8 @@ function permissionUi(loginMode: string, permissionMode: string) {"@/components/ui/dropdown-menu": { DropdownMenuItem: "DropdownMenuItem" },"@/lib/chevron-icons": {},"@/lib/sparkles-icon": { SparklesGlyph: "SparklesGlyph" },+ "@/lib/shield-alert-icon": { ShieldAlertGlyph: "ShieldAlertGlyph" },+ "@hugeicons/core-free-icons": {},"@/lib/tick-icon": {},"@/lib/utils": { cn: () => "" },"@hugeicons/react": {},diff --git a/studio/frontend/tests/composer-pill-pointer-focus.test.ts b/studio/frontend/tests/composer-pill-pointer-focus.test.tsnew file mode 100644index 00000000000..15df0c51493--- /dev/null+++ b/studio/frontend/tests/composer-pill-pointer-focus.test.ts@@ -0,0 +1,44 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import { readFile } from "node:fs/promises";+import test from "node:test";+import { watchInputModality } from "../src/lib/input-modality.ts";++const CSS = await readFile(new URL("../src/index.css", import.meta.url), "utf8");+const MAIN = await readFile(new URL("../src/main.tsx", import.meta.url), "utf8");++function fakeWindow() {+ const listeners = new Map<string, (event: { key?: string }) => void>();+ const root = { dataset: {} as Record<string, string> };+ const win = {+ document: { documentElement: root },+ addEventListener: (type: string, fn: (event: { key?: string }) => void) => listeners.set(type, fn),+ } as unknown as Window;+ return { win, root, fire: (type: string, event = {}) => listeners.get(type)?.(event) };+}++test("tracks whether the last input was a pointer or the keyboard", () => {+ const { win, root, fire } = fakeWindow();+ watchInputModality(win);+ fire("pointerdown");+ assert.equal(root.dataset.inputModality, "pointer");+ fire("keydown", { key: "Shift" });+ assert.equal(root.dataset.inputModality, "pointer");+ fire("keydown", { key: "Tab" });+ assert.equal(root.dataset.inputModality, "keyboard");+ assert.match(MAIN, /watchInputModality\(window\);/);+});++test("composer pills drop the focus ring after a click but keep it for the keyboard", () => {+ assert.match(CSS, /\.composer-pill-btn:focus-visible,[\s\S]*?box-shadow: 0 0 0 1px var\(--ring-soft\);/);+ assert.match(+ CSS,+ /html\[data-input-modality="pointer"\]\s*:is\(\.composer-pill-btn, \.unsloth-thinking-pill, \.unsloth-composer-plus\):focus-visible \{\s*box-shadow: none;/,+ );+});++test("pill labels are not selectable", () => {+ assert.match(CSS, /\.composer-pill-btn \{\s*@apply [^;]*\bselect-none\b/);+});diff --git a/studio/frontend/tests/permission-mode-learn-more.test.ts b/studio/frontend/tests/permission-mode-learn-more.test.tsnew file mode 100644index 00000000000..8c4396786ab--- /dev/null+++ b/studio/frontend/tests/permission-mode-learn-more.test.ts@@ -0,0 +1,70 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import { readFile } from "node:fs/promises";+import test from "node:test";++const MENU = await readFile(+ new URL("../src/features/chat/permission-mode-select.tsx", import.meta.url),+ "utf8",+);+const GENERAL = await readFile(+ new URL("../src/features/settings/tabs/general-tab.tsx", import.meta.url),+ "utf8",+);++test("Learn more opens the Permissions section of Settings", () => {+ assert.match(MENU, /openSettings\("general", \{ scrollTarget: "general-permissions" \}\)/);+ assert.match(GENERAL, /if \(scrollTarget !== "general-permissions"\) return;/);+ assert.match(GENERAL, /ref=\{permissionsRef\}/);+});++test("Settings explains only the selected level and drops its own Learn more", () => {+ assert.match(GENERAL, /label=\{t\(`settings\.general\.permissions\.names\.\$\{activePermission\.value\}`\)\}/);+ assert.match(GENERAL, /t\(`settings\.general\.permissions\.details\.\$\{activePermission\.value\}`\)/);+ assert.match(GENERAL, /<PermissionModeDropdown learnMore=\{false\} \/>/);+ assert.doesNotMatch(GENERAL, /permissions\.bypass(Label|Description)/);+});++test("menu descriptions stay to one short line", () => {+ const options = MENU.slice(MENU.indexOf("export const PERMISSION_MODE_OPTIONS"), MENU.indexOf("] as const;"));+ const descriptions = [...options.matchAll(/description: "([^"]+)",/g)].map((m) => m[1]);+ assert.equal(descriptions.length, 4);+ for (const text of descriptions) assert.ok(text.length <= 60, text);+});++test("Full access looks like every other level and asks in a short, neutral confirmation", () => {+ for (const source of [MENU, GENERAL]) assert.doesNotMatch(source, /text-bypass|data-variant=\{fullAccess/);+ assert.match(MENU, /icon: ShieldAlertGlyph,/);+ assert.match(MENU, /Turn on Full access\?/);+ assert.doesNotMatch(MENU, /text-sky-/);+ assert.match(MENU, /className="gap-5 p-7 ring-0 [^"]*"\s+onOverlayClick=\{onClose\}/);+ assert.match(MENU, /icon: InternetIcon,/);+ assert.match(MENU, /outside the sandbox, including:/);+ assert.match(MENU, /<AlertDialogCancel variant="muted">Cancel<\/AlertDialogCancel>/);+ assert.match(MENU, /onOpenAutoFocus=\{\(event\) => \{\s*event\.preventDefault\(\);/);+ assert.match(MENU, /<AlertDialogDescription className="text-pretty leading-relaxed">/);+ assert.equal([...MENU.matchAll(/title: "/g)].length, 3);+});++const DICTATION = await readFile(+ new URL("../src/features/chat/bypass-permissions-menu-item.tsx", import.meta.url),+ "utf8",+);+const EN = await readFile(new URL("../src/i18n/locales/en.ts", import.meta.url), "utf8");++test("the dictation submenu has the heading and Learn more too", () => {+ assert.match(DICTATION, /<PermissionMenuLabel learnMore \/>\s*<PermissionModeMenuItems/);+});++test("confirmation Learn more hands Settings the focus from before the dialog", () => {+ assert.match(MENU, /returnFocusRef\.current = lastFocusOutsideMenus\(\);/);+ // A closing menu resolves to its trigger, which outlives it.+ assert.match(MENU, /menu\.getAttribute\("aria-labelledby"\)/);+ assert.match(MENU, /scrollTarget: "general-permissions",\s*opener: returnFocusRef\.current,/);+});++test("Ask says provider-hosted tools are not paused", () => {+ assert.match(EN, /Tools run by an external provider are not paused\./);+});