Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions web-app/src/containers/dialogs/ToolApproval.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {

Check warning on line 1 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

1 line is not covered with tests
Dialog,
DialogContent,
DialogDescription,
Expand All @@ -6,57 +6,60 @@
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
import { useToolApproval } from '@/hooks/useToolApproval'
import { AlertTriangle } from 'lucide-react'
import { useTranslation } from '@/i18n/react-i18next-compat'

Check warning on line 12 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

9-12 lines are not covered with tests

export default function ToolApproval() {
const { t } = useTranslation()
const { isModalOpen, modalProps, setModalOpen } = useToolApproval()

Check warning on line 16 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

14-16 lines are not covered with tests

if (!modalProps) {
return null
}

Check warning on line 20 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

18-20 lines are not covered with tests

const { toolName, toolParameters, onApprove, onDeny } = modalProps

Check warning on line 22 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

22 line is not covered with tests

const handleAllowOnce = () => {
onApprove(true) // true = allow once only
}

Check warning on line 26 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

24-26 lines are not covered with tests

const handleAllow = () => {
onApprove(false) // false = remember for this thread
}

Check warning on line 30 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

28-30 lines are not covered with tests

const handleDeny = () => {
onDeny()
}

Check warning on line 34 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

32-34 lines are not covered with tests

const handleDialogOpen = (open: boolean) => {
setModalOpen(open)
if (!open) {
onDeny()
}
}

Check warning on line 41 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

36-41 lines are not covered with tests

return (
<Dialog open={isModalOpen} onOpenChange={handleDialogOpen}>
<DialogContent showCloseButton={false}>
<DialogHeader>
<div className="flex items-start gap-3">
<div className="shrink-0">
<AlertTriangle className="size-4" />
</div>
<div>
<DialogTitle>{t('tools:toolApproval.title')}</DialogTitle>
<DialogDescription className="mt-1 text-main-view-fg/70">
{t('tools:toolApproval.description')}{' '}
<span className="font-semibold">{toolName}</span>
<span className="font-semibold">{toolName}</span>.&nbsp;
<span className="text-sm">
{t('tools:toolApproval.permissionScope')}
</span>
</DialogDescription>
</div>
</div>
</DialogHeader>

Check warning on line 62 in web-app/src/containers/dialogs/ToolApproval.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

43-62 lines are not covered with tests

{toolParameters && Object.keys(toolParameters).length > 0 && (
<div className="bg-main-view-fg/4 p-2 border border-main-view-fg/5 rounded-lg overflow-x-scroll">
Expand Down Expand Up @@ -85,15 +88,20 @@
>
{t('tools:toolApproval.deny')}
</Button>
<div className="flex flex-col sm:flex-row sm:gap-2 sm:items-center">
<div className="flex flex-col sm:flex-row gap-2 items-center">
<Button
variant="link"
onClick={handleAllowOnce}
className="border border-main-view-fg/20"
>
{t('tools:toolApproval.allowOnce')}
</Button>
<Button variant="default" onClick={handleAllow} autoFocus>
<Button
variant="default"
onClick={handleAllow}
autoFocus
className="capitalize"
>
{t('tools:toolApproval.alwaysAllow')}
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/locales/de-DE/mcp-servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"editAllJson": "JSON aller Server bearbeiten",
"findMore": "Finde mehr MCP Server bei",
"allowPermissions": "Erlaube allen MCP Werkzeugen den Zugriff",
"allowPermissionsDesc": "Wenn aktiviert, werden alle MCP-Werkzeug-Aufrufe automatisch genehmigt, ohne dass Berechtigungsdialoge angezeigt werden.",
"allowPermissionsDesc": "Wenn aktiviert, werden alle MCP-Werkzeug-Aufrufe automatisch genehmigt, ohne dass Berechtigungsdialoge angezeigt werden. Diese Einstellung gilt global für alle Gespräche, einschließlich neuer Chats.",
"noServers": "Keine MCP Server gefunden",
"args": "Argumente",
"env": "Umgebung",
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/locales/de-DE/tool-approval.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"securityNotice": "<strong>Sicherheitshinweis:</strong> Schädliche Werkzeuge oder Konversationsinhalte könnten den Assistenten möglicherweise zu schädlichen Aktionen verleiten. Überprüfe jeden Werkzeug-Aufruf sorgfältig, bevor Du ihn genehmigst.",
"deny": "Verweigern",
"allowOnce": "Einmal erlauben",
"alwaysAllow": "Immer erlauben",
"alwaysAllow": "Im Thread erlauben",
"permissions": "Berechtigungen",
"approve": "Genehmigen",
"reject": "Ablehnen",
Expand Down
5 changes: 3 additions & 2 deletions web-app/src/locales/de-DE/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"securityNotice": "Dieses Werkzeug möchte eine Aktion ausführen. Bitte überprüfen und genehmigen oder Ablehnen.",
"deny": "Ablehnen",
"allowOnce": "Einmal erlauben",
"alwaysAllow": "Immer erlauben",
"parameters": "Werkzeug-Parameter"
"alwaysAllow": "Im Thread erlauben",
"parameters": "Werkzeug-Parameter",
"permissionScope": "Erteilte Berechtigungen gelten nur für dieses Gespräch."
}
}
2 changes: 1 addition & 1 deletion web-app/src/locales/en/mcp-servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"editAllJson": "Edit All Servers JSON",
"findMore": "Find more MCP servers at",
"allowPermissions": "Allow All MCP Tool Permissions",
"allowPermissionsDesc": "When enabled, all MCP tool calls will be automatically approved without showing permission dialogs.",
"allowPermissionsDesc": "When enabled, all MCP tool calls will be automatically approved without showing permission dialogs. This setting applies globally to all conversations, including new chats.",
"noServers": "No MCP servers found",
"args": "Args",
"env": "Env",
Expand Down
4 changes: 2 additions & 2 deletions web-app/src/locales/en/tool-approval.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"securityNotice": "<strong>Security Notice:</strong> Malicious tools or conversation content could potentially trick the assistant into attempting harmful actions. Review each tool call carefully before approving.",
"deny": "Deny",
"allowOnce": "Allow Once",
"alwaysAllow": "Always Allow",
"alwaysAllow": "Allow in thread",
"permissions": "Permissions",
"approve": "Approve",
"reject": "Reject",
"parameters": "Tool Parameters"
}
}
5 changes: 3 additions & 2 deletions web-app/src/locales/en/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"securityNotice": "Malicious tools or conversation content could potentially trick the assistant into attempting harmful actions. Review each tool call carefully before approving.",
"deny": "Deny",
"allowOnce": "Allow Once",
"alwaysAllow": "Always Allow",
"parameters": "Tool Parameters"
"alwaysAllow": "Allow in thread",
"parameters": "Tool Parameters",
"permissionScope": "Permissions granted apply only to this conversation."
}
}
2 changes: 1 addition & 1 deletion web-app/src/locales/id/mcp-servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"editAllJson": "Edit Semua JSON Server",
"findMore": "Temukan lebih banyak server MCP di",
"allowPermissions": "Izinkan Semua Izin Alat MCP",
"allowPermissionsDesc": "Jika diaktifkan, semua panggilan alat MCP akan disetujui secara otomatis tanpa menampilkan dialog izin.",
"allowPermissionsDesc": "Jika diaktifkan, semua panggilan alat MCP akan disetujui secara otomatis tanpa menampilkan dialog izin. Pengaturan ini berlaku secara global untuk semua percakapan, termasuk chat baru.",
"noServers": "Tidak ada server MCP yang ditemukan",
"args": "Argumen",
"env": "Lingkungan",
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/locales/id/tool-approval.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"securityNotice": "<strong>Pemberitahuan Keamanan:</strong> Alat berbahaya atau konten percakapan dapat menipu asisten untuk mencoba melakukan tindakan yang merugikan. Tinjau setiap permintaan penggunaan alat dengan cermat sebelum menyetujui.",
"deny": "Tolak",
"allowOnce": "Izinkan Sekali",
"alwaysAllow": "Selalu Izinkan",
"alwaysAllow": "Izinkan di thread",
"permissions": "Izin",
"approve": "Setujui",
"reject": "Tolak",
Expand Down
5 changes: 3 additions & 2 deletions web-app/src/locales/id/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"securityNotice": "Alat ini ingin melakukan suatu tindakan. Harap tinjau dan setujui.",
"deny": "Tolak",
"allowOnce": "Izinkan Sekali",
"alwaysAllow": "Selalu Izinkan",
"alwaysAllow": "Izinkan di thread",
"description": "Asisten ingin menggunakan <strong>{{toolName}}</strong>",
"parameters": "Parameter Alat"
"parameters": "Parameter Alat",
"permissionScope": "Izin yang diberikan hanya berlaku untuk percakapan ini."
}
}
2 changes: 1 addition & 1 deletion web-app/src/locales/pl/mcp-servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"editAllJson": "Edytuj JSON Wszystkich Serwerów",
"findMore": "Znajdź więcej serwerów MCP na",
"allowPermissions": "Pozwalaj na Wszystkie Użycia Narzędzi MCP",
"allowPermissionsDesc": "Po włączeniu będzie automatycznie zezwalać na wszystkie użycia narzędzi MCP bez wyświetlania próśb o zgodę.",
"allowPermissionsDesc": "Po włączeniu będzie automatycznie zezwalać na wszystkie użycia narzędzi MCP bez wyświetlania próśb o zgodę. To ustawienie obowiązuje globalnie dla wszystkich rozmów, w tym nowych czatów.",
"noServers": "Nie znaleziono serwerów MCP",
"args": "Argumenty",
"env": "Zmienne Środowiskowe",
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/locales/pl/tool-approval.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"securityNotice": "<strong>Ostrzeżenie Bezpieczeństwa:</strong> Złośliwe narzędzia lub treści rozmowy mają potencjał nakłonić agenta do szkodliwych działań. Dokładnie przejrzyj każdą prośbę o użycie narzędzia przed wyrażeniem zgody.",
"deny": "Odmów",
"allowOnce": "Pozwól Raz",
"alwaysAllow": "Zawsze Pozwalaj",
"alwaysAllow": "Pozwól w wątku",
"permissions": "Pozwolenia",
"approve": "Zaakceptuj",
"reject": "Odrzuć",
Expand Down
5 changes: 3 additions & 2 deletions web-app/src/locales/pl/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"securityNotice": "Złośliwe narzędzia lub treści rozmowy mają potencjał nakłonić agenta do szkodliwych działań. Dokładnie przejrzyj każdą prośbę o użycie narzędzia przed wyrażeniem zgody.",
"deny": "Odmów",
"allowOnce": "Pozwól Raz",
"alwaysAllow": "Zawsze Pozwalaj",
"parameters": "Parametry Narzędzia"
"alwaysAllow": "Pozwól w wątku",
"parameters": "Parametry Narzędzia",
"permissionScope": "Udzielone pozwolenia dotyczą tylko tej rozmowy."
}
}
2 changes: 1 addition & 1 deletion web-app/src/locales/vn/tool-approval.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"securityNotice": "<strong>Thông báo bảo mật:</strong> Các công cụ độc hại hoặc nội dung cuộc trò chuyện có khả năng lừa trợ lý thực hiện các hành động có hại. Hãy xem xét kỹ từng lệnh gọi công cụ trước khi phê duyệt.",
"deny": "Từ chối",
"allowOnce": "Cho phép một lần",
"alwaysAllow": "Luôn cho phép",
"alwaysAllow": "Cho phép trong chuỗi",
"permissions": "Quyền",
"approve": "Phê duyệt",
"reject": "Từ chối",
Expand Down
5 changes: 3 additions & 2 deletions web-app/src/locales/vn/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"securityNotice": "Công cụ này muốn thực hiện một hành động. Vui lòng xem xét và phê duyệt.",
"deny": "Từ chối",
"allowOnce": "Cho phép một lần",
"alwaysAllow": "Luôn cho phép",
"alwaysAllow": "Cho phép trong chuỗi",
"description": "Trợ lý muốn sử dụng <strong>{{toolName}}</strong>",
"parameters": "Tham số công cụ"
"parameters": "Tham số công cụ",
"permissionScope": "Quyền được cấp chỉ áp dụng cho cuộc trò chuyện này."
}
}
2 changes: 1 addition & 1 deletion web-app/src/locales/zh-CN/mcp-servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"editAllJson": "编辑所有服务器的 JSON",
"findMore": "在以下位置查找更多 MCP 服务器",
"allowPermissions": "允许所有 MCP 工具权限",
"allowPermissionsDesc": "启用后,所有 MCP 工具调用都将自动批准,而不会显示权限对话框。",
"allowPermissionsDesc": "启用后,所有 MCP 工具调用都将自动批准,而不会显示权限对话框。此设置全局适用于所有对话,包括新聊天。",
"noServers": "未找到 MCP 服务器",
"args": "参数",
"env": "环境",
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/locales/zh-CN/tool-approval.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"securityNotice": "<strong>安全警告:</strong>恶意的工具或对话内容可能会诱使助手尝试有害操作。在批准之前,请仔细审查每个工具调用。",
"deny": "拒绝",
"allowOnce": "允许一次",
"alwaysAllow": "始终允许",
"alwaysAllow": "在线程中允许",
"permissions": "权限",
"approve": "批准",
"reject": "拒绝",
Expand Down
5 changes: 3 additions & 2 deletions web-app/src/locales/zh-CN/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"securityNotice": "此工具想要执行一个操作。请审查并批准。",
"deny": "拒绝",
"allowOnce": "允许一次",
"alwaysAllow": "始终允许",
"alwaysAllow": "在线程中允许",
"description": "助手想要使用 <strong>{{toolName}}</strong>",
"parameters": "工具参数"
"parameters": "工具参数",
"permissionScope": "授予的权限仅适用于此对话。"
}
}
2 changes: 1 addition & 1 deletion web-app/src/locales/zh-TW/mcp-servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"editAllJson": "編輯所有伺服器的 JSON",
"findMore": "在以下位置尋找更多 MCP 伺服器",
"allowPermissions": "允許所有 MCP 工具權限",
"allowPermissionsDesc": "啟用後,所有 MCP 工具呼叫將自動核准,而不會顯示權限對話方塊。",
"allowPermissionsDesc": "啟用後,所有 MCP 工具呼叫將自動核准,而不會顯示權限對話方塊。此設定全域適用於所有對話,包括新聊天。",
"noServers": "找不到 MCP 伺服器",
"args": "參數",
"env": "環境",
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/locales/zh-TW/tool-approval.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"securityNotice": "<strong>安全性通知:</strong>惡意的工具或對話內容可能會誘騙助理嘗試有害的操作。在核准之前,請仔細檢閱每個工具呼叫。",
"deny": "拒絕",
"allowOnce": "允許一次",
"alwaysAllow": "一律允許",
"alwaysAllow": "在討論串中允許",
"permissions": "權限",
"approve": "核准",
"reject": "拒絕",
Expand Down
5 changes: 3 additions & 2 deletions web-app/src/locales/zh-TW/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"securityNotice": "此工具想要執行一個動作。請檢閱並核准。",
"deny": "拒絕",
"allowOnce": "允許一次",
"alwaysAllow": "一律允許",
"alwaysAllow": "在討論串中允許",
"description": "助理想要使用 <strong>{{toolName}}</strong>",
"parameters": "工具參數"
"parameters": "工具參數",
"permissionScope": "授予的權限僅適用於此對話。"
}
}
Loading