Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
feat(providers): batch delete provider connections via checkbox multi-select (#2094)
Paijocdd71ab2115d
diff --git a/.issues/feat-batch-delete-provider-accounts.md b/.issues/feat-batch-delete-provider-accounts.mdnew file mode 100644index 0000000000..fe84a123c8--- /dev/null+++ b/.issues/feat-batch-delete-provider-accounts.md@@ -0,0 +1,328 @@+# Feature Proposal: Batch Delete Provider Accounts++## Summary++Add **batch delete** functionality for provider accounts (connections) in the provider detail page (`/dashboard/providers/[id]`). Users select multiple accounts via checkboxes and delete them in a single action, replacing the current one-by-one delete workflow.++## Problem Statement++Users managing multiple provider accounts (e.g., 20+ API keys or OAuth connections) have to delete accounts individually. Each deletion requires:++1. Finding the account+2. Clicking the delete button+3. Confirming via browser `confirm()` dialog+4. Waiting for the API call+5. Repeating for every account++This is:+- **Time-consuming**: O(n) confirm dialogs and API calls for n accounts+- **Error-prone**: Easy to accidentally click the wrong account+- **Tedious**: No way to quickly clean up stale or duplicate accounts++## Solution++Add a checkbox-based selection UI to the provider connections list:++```+┌────────────────────────────────────────────────────────────────┐+│ [x] Account #1 (kiro-prod) [Delete Selected (3)] │+│ [x] Account #2 (kiro-staging) │+│ [ ] Account #3 (kiro-backup) │+└────────────────────────────────────────────────────────────────┘+```++## Detailed PR Specification++### Files to Modify++| File | Change |+|------|--------|+| `src/app/(dashboard)/dashboard/providers/[id]/page.tsx` | Add batch delete state, select-all + per-row checkboxes, batch delete handler |+| `src/app/api/providers/route.ts` | Add `DELETE /api/providers` with `POST` body `ids: string[]` for batch delete |+| `src/lib/db/providers.ts` | Add `deleteProviderConnections(ids: string[])` batch DB function |+| `src/i18n/messages/en.json` | Add i18n keys: `batchDeleteSelected`, `batchDeleteConfirm`, `batchDeleteSuccess` |+| `src/i18n/messages/*.json` | Add i18n keys to all locale files |+| `tests/unit/db-providers-crud.test.ts` | Add unit tests for batch delete DB function |+| `tests/integration/api-routes-critical.test.ts` | Add integration test for batch delete API endpoint |++### 1. DB Layer (`src/lib/db/providers.ts`)++```typescript+export async function deleteProviderConnections(ids: string[]): Promise<number> {+ const db = getDbInstance() as unknown as DbLike;+ if (ids.length === 0) return 0;++ // Delete quota snapshots for each connection first+ const deleteSnapshots = db.prepare("DELETE FROM quota_snapshots WHERE connection_id = ?");+ for (const id of ids) {+ deleteSnapshots.run(id);+ }++ // Batch delete connections+ const placeholders = ids.map(() => "?").join(",");+ const result = db.prepare(+ `DELETE FROM provider_connections WHERE id IN (${placeholders})`+ ).run(...ids);++ backupDbFile("pre-write");+ invalidateDbCache("connections");+ return result.changes ?? 0;+}+```++### 2. API Route (`src/app/api/providers/route.ts`)++Add a new route handler for batch delete. The existing `/api/providers/[id]` only handles single-id operations. The main providers route file (`/api/providers/route.ts`) should be extended:++```typescript+// DELETE /api/providers — Batch delete connections+// Body: { ids: string[] }+export async function DELETE(request: Request) {+ const authError = await requireManagementAuth(request);+ if (authError) return authError;++ let body: { ids?: string[] };+ try {+ body = await request.json();+ } catch {+ return NextResponse.json({ error: "Invalid JSON body" }, { status: 400 });+ }++ if (!Array.isArray(body.ids) || body.ids.length === 0) {+ return NextResponse.json(+ { error: "ids must be a non-empty array of connection IDs" },+ { status: 400 }+ );+ }++ if (body.ids.length > 100) {+ return NextResponse.json(+ { error: "Cannot delete more than 100 connections at once" },+ { status: 400 }+ );+ }++ try {+ const deleted = await deleteProviderConnections(body.ids);+ await syncToCloudIfEnabled();++ logAuditEvent({+ action: "provider.credentials.batch_revoked",+ actor: "admin",+ resourceType: "provider_credentials",+ status: "success",+ metadata: { count: deleted, ids: body.ids },+ });++ return NextResponse.json({ message: `Deleted ${deleted} connection(s)`, deleted });+ } catch (error) {+ console.log("Error batch deleting connections:", error);+ return NextResponse.json({ error: "Failed to batch delete connections" }, { status: 500 });+ }+}+```++### 3. UI Layer (`src/app/(dashboard)/dashboard/providers/[id]/page.tsx`)++#### New State Variables++```typescript+// Batch selection state+const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set());+const [batchDeleting, setBatchDeleting] = useState(false);+```++#### New Functions++```typescript+const handleToggleSelectAll = useCallback(() => {+ setSelectedIds((prev) =>+ prev.size === connections.length ? new Set() : new Set(connections.map((c) => c.id))+ );+}, [connections]);++const handleToggleSelectOne = useCallback((id: string) => {+ setSelectedIds((prev) => {+ const next = new Set(prev);+ if (next.has(id)) next.delete(id);+ else next.add(id);+ return next;+ });+}, []);++const handleBatchDelete = async () => {+ if (selectedIds.size === 0) return;+ if (!confirm(t("batchDeleteConfirm", { count: selectedIds.size }))) return;++ setBatchDeleting(true);+ try {+ const res = await fetch("/api/providers", {+ method: "DELETE",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ ids: Array.from(selectedIds) }),+ });++ if (res.ok) {+ setSelectedIds(new Set());+ await fetchConnections();+ notify.success(t("batchDeleteSuccess", { count: selectedIds.size }));+ } else {+ const data = await res.json();+ notify.error(data.error || "Batch delete failed");+ }+ } catch (error) {+ notify.error("Network error during batch delete");+ } finally {+ setBatchDeleting(false);+ }+};+```++#### Per-Row Checkbox (inside `ConnectionRow`)++Add a checkbox as the first element of each row:++```tsx+// In ConnectionRow interface, add:+interface ConnectionRowProps {+ isSelected?: boolean;+ onToggleSelect?: () => void;+ // ... existing props+}++// In ConnectionRow render, before priority arrows:+<div className="flex items-center gap-3 flex-1 min-w-0">+ <input+ type="checkbox"+ checked={isSelected}+ onChange={onToggleSelect}+ className="w-4 h-4 rounded border-border text-primary focus:ring-primary/30 cursor-pointer"+ />+ {/* Priority arrows */}+ ...+```++#### Header Row (above connections list)++```tsx+<div className="flex items-center justify-between px-3 py-2 bg-muted/50 rounded-t-lg border border-b-0 border-border">+ <label className="flex items-center gap-2 cursor-pointer select-none">+ <input+ type="checkbox"+ checked={selectedIds.size === connections.length && connections.length > 0}+ ref={(el) => { if (el) el.indeterminate = selectedIds.size > 0 && selectedIds.size < connections.length; }}+ onChange={handleToggleSelectAll}+ className="w-4 h-4 rounded border-border text-primary focus:ring-primary/30"+ />+ <span className="text-sm font-medium text-text-muted">+ {selectedIds.size > 0+ ? `${selectedIds.size} selected`+ : `${connections.length} accounts`}+ </span>+ </label>++ {selectedIds.size > 0 && (+ <Button+ variant="destructive"+ size="sm"+ icon="delete"+ loading={batchDeleting}+ onClick={handleBatchDelete}+ >+ {t("batchDeleteSelected", { count: selectedIds.size })}+ </Button>+ )}+</div>+```++### 4. i18n Keys (to add to all locale files)++```json+{+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)"+}+```++### 5. Testing++#### Unit Test (`tests/unit/db-providers-crud.test.ts`)++```typescript+test("deleteProviderConnections deletes multiple connections", async () => {+ const ids = [+ (await createProviderConnection({ provider: "openai", name: "test-1", authType: "apikey" })).id!,+ (await createProviderConnection({ provider: "openai", name: "test-2", authType: "apikey" })).id!,+ ];++ const deleted = await deleteProviderConnections(ids);+ expect(deleted).toBe(2);++ for (const id of ids) {+ const conn = await getProviderConnectionById(id);+ expect(conn).toBeNull();+ }+});++test("deleteProviderConnections with empty array returns 0", async () => {+ const deleted = await deleteProviderConnections([]);+ expect(deleted).toBe(0);+});+```++#### Integration Test (`tests/integration/api-routes-critical.test.ts`)++```typescript+test("DELETE /api/providers — batch delete", async () => {+ const ids = [conn1.id, conn2.id];+ const res = await fetch("http://localhost:20128/api/providers", {+ method: "DELETE",+ headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` },+ body: JSON.stringify({ ids }),+ });++ expect(res.status).toBe(200);+ const data = await res.json();+ expect(data.deleted).toBe(2);+});+```++### UX Details++1. **Indeterminate select-all**: When some (but not all) rows are selected, the select-all checkbox shows as indeterminate (dash)+2. **Confirmation**: Shows `confirm()` with count ("Delete 3 connections?")+3. **Optimistic update**: Immediately clears selected IDs and removes deleted connections from list on success+4. **Error handling**: Shows error notification; connections remain in list if delete fails+5. **Loading state**: Button shows spinner during delete; row checkboxes disabled+6. **Empty state**: No "Delete Selected" button when nothing selected+7. **Audit logging**: Each batch delete logged as `provider.credentials.batch_revoked`++### Non-Goals++- Bulk enable/disable (separate feature)+- Moving selected accounts (separate feature)+- Batch rename/edit (separate feature)+- Deleting across different providers (each provider page operates independently)++### Risks & Mitigations++| Risk | Mitigation |+|------|------------|+| User accidentally deletes wrong accounts | Require confirmation dialog with count |+| Too many connections selected | Cap at 100 per batch; show error if exceeded |+| Partial failure on batch delete | DB runs in transaction; all-or-nothing semantics |+| Performance with large selections | Batch SQL with `IN (...)` clause is efficient up to 100 |++### Coverage++Per repository rules, this change affects production code in `src/` → automated tests required:+- Unit test for `deleteProviderConnections()` in `tests/unit/db-providers-crud.test.ts`+- Integration test for `DELETE /api/providers` batch endpoint in `tests/integration/api-routes-critical.test.ts`+- Run `npm run test:coverage` — all 4 metrics must meet 60% minimum++---++## Related Issues++- Closes this issue on mergediff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsxindex 12da148089..c09341dba0 100644--- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx@@ -519,6 +519,8 @@ interface ConnectionRowProps {codexFastGlobalEnabled?: boolean;isFirst: boolean;isLast: boolean;+ isSelected?: boolean;+ onToggleSelect?: () => void;onMoveUp: () => void;onMoveDown: () => void;onToggleActive: (isActive?: boolean) => void | Promise<void>;@@ -1022,6 +1024,8 @@ export default function ProviderDetailPage() {const [exportingCodexAuthId, setExportingCodexAuthId] = useState<string | null>(null);const [codexGlobalFastServiceTier, setCodexGlobalFastServiceTier] = useState(false);const [savingCodexGlobalFastServiceTier, setSavingCodexGlobalFastServiceTier] = useState(false);+ const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set());+ const [batchDeleting, setBatchDeleting] = useState(false);const isOpenAICompatible = isOpenAICompatibleProvider(providerId);const isCcCompatible = isClaudeCodeCompatibleProvider(providerId);const isAnthropicCompatible =@@ -1364,7 +1368,6 @@ export default function ProviderDetailPage() {const res = await fetch(`/api/providers/${id}`, { method: "DELETE" });if (res.ok) {setConnections(connections.filter((c) => c.id !== id));- // Refresh model list after connection deletion (synced models may change)if (providerId === "gemini") {await fetchProviderModelMeta();}@@ -1374,6 +1377,51 @@ export default function ProviderDetailPage() {}};+ const handleToggleSelectAll = useCallback(() => {+ setSelectedIds((prev) =>+ prev.size === connections.length ? new Set() : new Set(connections.map((c) => c.id))+ );+ }, [connections]);++ const handleToggleSelectOne = useCallback((id: string) => {+ setSelectedIds((prev) => {+ const next = new Set(prev);+ if (next.has(id)) next.delete(id);+ else next.add(id);+ return next;+ });+ }, []);++ const handleBatchDelete = async () => {+ if (selectedIds.size === 0) return;+ if (!confirm(t("batchDeleteConfirm", { count: selectedIds.size }))) return;++ setBatchDeleting(true);+ try {+ const res = await fetch("/api/providers", {+ method: "DELETE",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ ids: Array.from(selectedIds) }),+ });++ if (res.ok) {+ setSelectedIds(new Set());+ await fetchConnections();+ notify.success(t("batchDeleteSuccess", { count: selectedIds.size }));+ if (providerId === "gemini") {+ await fetchProviderModelMeta();+ }+ } else {+ const data = await res.json();+ notify.error(data.error || "Batch delete failed");+ }+ } catch {+ notify.error("Network error during batch delete");+ } finally {+ setBatchDeleting(false);+ }+ };+const handleOAuthSuccess = useCallback(() => {fetchConnections();setShowOAuthModal(false);@@ -2946,96 +2994,130 @@ export default function ProviderDetailPage() {</div>) : ((() => {- // Group connections by tag (providerSpecificData.tag)const sorted = [...connections].sort((a, b) => (a.priority || 0) - (b.priority || 0));const hasAnyTag = sorted.some((c) => c.providerSpecificData?.tag as string | undefined);+ const allSelected = selectedIds.size === connections.length && connections.length > 0;+ const someSelected = selectedIds.size > 0 && selectedIds.size < connections.length;if (!hasAnyTag) {- // No tags — render flat list as beforereturn (- <div className="flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]">- {sorted.map((conn, index) => (- <ConnectionRow- key={conn.id}- connection={conn}- isOAuth={conn.authType === "oauth"}- isClaude={providerId === "claude"}- codexFastGlobalEnabled={codexGlobalFastServiceTier}- isFirst={index === 0}- isLast={index === sorted.length - 1}- onMoveUp={() => handleSwapPriority(conn, sorted[index - 1])}- onMoveDown={() => handleSwapPriority(conn, sorted[index + 1])}- onToggleActive={(isActive) =>- handleUpdateConnectionStatus(conn.id, isActive)- }- onToggleRateLimit={(enabled) => handleToggleRateLimit(conn.id, enabled)}- onToggleClaudeExtraUsage={(enabled) =>- handleToggleClaudeExtraUsage(conn.id, enabled)- }- isCodex={providerId === "codex"}- isCcCompatible={isCcCompatible}- cliproxyapiEnabled={cpaProviderEnabled}- onToggleCliproxyapiMode={(enabled) =>- handleToggleCliproxyapiMode(conn.id, enabled)- }- onToggleCodex5h={(enabled) =>- handleToggleCodexLimit(conn.id, "use5h", enabled)- }- onToggleCodexWeekly={(enabled) =>- handleToggleCodexLimit(conn.id, "useWeekly", enabled)- }- onRetest={() => handleRetestConnection(conn.id)}- isRetesting={retestingId === conn.id}- onEdit={() => {- setSelectedConnection(conn);- setShowEditModal(true);- }}- onDelete={() => handleDelete(conn.id)}- onReauth={- conn.authType === "oauth"- ? () => setShowOAuthModal(true, conn)- : undefined- }- onRefreshToken={- conn.authType === "oauth" ? () => handleRefreshToken(conn.id) : undefined- }- isRefreshing={refreshingId === conn.id}- onApplyCodexAuthLocal={- providerId === "codex"- ? () => handleApplyCodexAuthLocal(conn.id)- : undefined- }- isApplyingCodexAuthLocal={applyingCodexAuthId === conn.id}- onExportCodexAuthFile={- providerId === "codex"- ? () => handleExportCodexAuthFile(conn.id)- : undefined- }- isExportingCodexAuthFile={exportingCodexAuthId === conn.id}- onProxy={() =>- setProxyTarget({- level: "key",- id: conn.id,- label: pickDisplayValue(- [conn.name, conn.email],- emailsVisible,- conn.id- ),- })- }- hasProxy={!!connProxyMap[conn.id]?.proxy}- proxySource={connProxyMap[conn.id]?.level || null}- proxyHost={connProxyMap[conn.id]?.proxy?.host || null}- />- ))}- </div>+ <>+ <div className="flex items-center justify-between px-3 py-2 bg-muted/50 rounded-t-lg border border-b-0 border-border">+ <label className="flex items-center gap-2 cursor-pointer select-none">+ <input+ type="checkbox"+ checked={allSelected}+ ref={(el) => {+ if (el) el.indeterminate = someSelected;+ }}+ onChange={handleToggleSelectAll}+ className="w-4 h-4 rounded border-border text-primary focus:ring-primary/30 cursor-pointer"+ />+ <span className="text-sm font-medium text-text-muted">+ {selectedIds.size > 0+ ? `${selectedIds.size} selected`+ : `${connections.length} accounts`}+ </span>+ </label>++ {selectedIds.size > 0 && (+ <Button+ variant="destructive"+ size="sm"+ icon="delete"+ loading={batchDeleting}+ onClick={handleBatchDelete}+ >+ {t("batchDeleteSelected", { count: selectedIds.size })}+ </Button>+ )}+ </div>+ <div className="flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]">+ {sorted.map((conn, index) => (+ <ConnectionRow+ key={conn.id}+ connection={conn}+ isOAuth={conn.authType === "oauth"}+ isClaude={providerId === "claude"}+ codexFastGlobalEnabled={codexGlobalFastServiceTier}+ isFirst={index === 0}+ isLast={index === sorted.length - 1}+ isSelected={selectedIds.has(conn.id)}+ onToggleSelect={() => handleToggleSelectOne(conn.id)}+ onMoveUp={() => handleSwapPriority(conn, sorted[index - 1])}+ onMoveDown={() => handleSwapPriority(conn, sorted[index + 1])}+ onToggleActive={(isActive) =>+ handleUpdateConnectionStatus(conn.id, isActive)+ }+ onToggleRateLimit={(enabled) => handleToggleRateLimit(conn.id, enabled)}+ onToggleClaudeExtraUsage={(enabled) =>+ handleToggleClaudeExtraUsage(conn.id, enabled)+ }+ isCodex={providerId === "codex"}+ isCcCompatible={isCcCompatible}+ cliproxyapiEnabled={cpaProviderEnabled}+ onToggleCliproxyapiMode={(enabled) =>+ handleToggleCliproxyapiMode(conn.id, enabled)+ }+ onToggleCodex5h={(enabled) =>+ handleToggleCodexLimit(conn.id, "use5h", enabled)+ }+ onToggleCodexWeekly={(enabled) =>+ handleToggleCodexLimit(conn.id, "useWeekly", enabled)+ }+ onRetest={() => handleRetestConnection(conn.id)}+ isRetesting={retestingId === conn.id}+ onEdit={() => {+ setSelectedConnection(conn);+ setShowEditModal(true);+ }}+ onDelete={() => handleDelete(conn.id)}+ onReauth={+ conn.authType === "oauth"+ ? () => setShowOAuthModal(true, conn)+ : undefined+ }+ onRefreshToken={+ conn.authType === "oauth" ? () => handleRefreshToken(conn.id) : undefined+ }+ isRefreshing={refreshingId === conn.id}+ onApplyCodexAuthLocal={+ providerId === "codex"+ ? () => handleApplyCodexAuthLocal(conn.id)+ : undefined+ }+ isApplyingCodexAuthLocal={applyingCodexAuthId === conn.id}+ onExportCodexAuthFile={+ providerId === "codex"+ ? () => handleExportCodexAuthFile(conn.id)+ : undefined+ }+ isExportingCodexAuthFile={exportingCodexAuthId === conn.id}+ onProxy={() =>+ setProxyTarget({+ level: "key",+ id: conn.id,+ label: pickDisplayValue(+ [conn.name, conn.email],+ emailsVisible,+ conn.id+ ),+ })+ }+ hasProxy={!!connProxyMap[conn.id]?.proxy}+ proxySource={connProxyMap[conn.id]?.level || null}+ proxyHost={connProxyMap[conn.id]?.proxy?.host || null}+ />+ ))}+ </div>+ </>);}// Build ordered tag groups: untagged first, then alphabetically- const groupMap = new Map<string, typeof sorted>();+ const groupMap = new Map<string, ConnectionRowConnection[]>();for (const conn of sorted) {const tag = (conn.providerSpecificData?.tag as string | undefined)?.trim() || "";if (!groupMap.has(tag)) groupMap.set(tag, []);@@ -3048,7 +3130,40 @@ export default function ProviderDetailPage() {});return (- <div className="flex flex-col gap-0">+ <>+ {selectedIds.size > 0 || connections.length > 0 ? (+ <div className="flex items-center justify-between px-3 py-2 bg-muted/50 rounded-t-lg border border-b-0 border-border">+ <label className="flex items-center gap-2 cursor-pointer select-none">+ <input+ type="checkbox"+ checked={allSelected}+ ref={(el) => {+ if (el) el.indeterminate = someSelected;+ }}+ onChange={handleToggleSelectAll}+ className="w-4 h-4 rounded border-border text-primary focus:ring-primary/30 cursor-pointer"+ />+ <span className="text-sm font-medium text-text-muted">+ {selectedIds.size > 0+ ? `${selectedIds.size} selected`+ : `${connections.length} accounts`}+ </span>+ </label>++ {selectedIds.size > 0 && (+ <Button+ variant="destructive"+ size="sm"+ icon="delete"+ loading={batchDeleting}+ onClick={handleBatchDelete}+ >+ {t("batchDeleteSelected", { count: selectedIds.size })}+ </Button>+ )}+ </div>+ ) : null}+ <div className="flex flex-col gap-0">{groupKeys.map((tag, gi) => {const groupConns = groupMap.get(tag)!;return (@@ -3086,6 +3201,8 @@ export default function ProviderDetailPage() {isLast={gi === groupKeys.length - 1 && index === groupConns.length - 1}+ isSelected={selectedIds.has(conn.id)}+ onToggleSelect={() => handleToggleSelectOne(conn.id)}onMoveUp={() =>handleSwapPriority(conn, sorted[sorted.indexOf(conn) - 1])}@@ -3102,6 +3219,8 @@ export default function ProviderDetailPage() {handleToggleClaudeExtraUsage(conn.id, enabled)}isCodex={providerId === "codex"}+ isCcCompatible={isCcCompatible}+ cliproxyapiEnabled={cpaProviderEnabled}onToggleCodex5h={(enabled) =>handleToggleCodexLimit(conn.id, "use5h", enabled)}@@ -3156,12 +3275,11 @@ export default function ProviderDetailPage() {))}</div></div>- );- })}- </div>- );- })()- )}+ </>+ );+ }+ })()}+ </div></Card>)}@@ -5031,6 +5149,8 @@ function ConnectionRow({cliproxyapiEnabled,isFirst,isLast,+ isSelected,+ onToggleSelect,onMoveUp,onMoveDown,onToggleActive,@@ -5146,6 +5266,14 @@ function ConnectionRow({className={`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${connection.isActive === false ? "opacity-60" : ""}`}><div className="flex items-center gap-3 flex-1 min-w-0">+ {onToggleSelect && (+ <input+ type="checkbox"+ checked={isSelected}+ onChange={onToggleSelect}+ className="w-4 h-4 shrink-0 rounded border-border text-primary focus:ring-primary/30 cursor-pointer"+ />+ )}{/* Priority arrows */}<div className="flex flex-col"><buttondiff --git a/src/app/api/providers/route.ts b/src/app/api/providers/route.tsindex 5f381f3355..802947bec7 100644--- a/src/app/api/providers/route.ts+++ b/src/app/api/providers/route.ts@@ -7,6 +7,7 @@ import {import {getProviderConnections,createProviderConnection,+ deleteProviderConnections,getProviderNodeById,isCloudEnabled,} from "@/models";@@ -192,6 +193,58 @@ export async function POST(request: Request) {}}+export async function DELETE(request: Request) {+ const authError = await requireManagementAuth(request);+ if (authError) return authError;++ const auditContext = getAuditRequestContext(request);++ let body: { ids?: string[] };+ try {+ body = await request.json();+ } catch {+ return NextResponse.json({ error: "Invalid JSON body" }, { status: 400 });+ }++ if (!Array.isArray(body.ids) || body.ids.length === 0) {+ return NextResponse.json(+ { error: "ids must be a non-empty array of connection IDs" },+ { status: 400 }+ );+ }++ if (body.ids.length > 100) {+ return NextResponse.json(+ { error: "Cannot delete more than 100 connections at once" },+ { status: 400 }+ );+ }++ try {+ const deleted = await deleteProviderConnections(body.ids);++ await syncToCloudIfEnabled();++ logAuditEvent({+ action: "provider.credentials.batch_revoked",+ actor: "admin",+ resourceType: "provider_credentials",+ status: "success",+ ipAddress: auditContext.ipAddress || undefined,+ requestId: auditContext.requestId,+ metadata: { count: deleted, ids: body.ids },+ });++ return NextResponse.json(+ { message: `Deleted ${deleted} connection(s)`, deleted },+ { status: 200 }+ );+ } catch (error) {+ console.log("Error batch deleting connections:", error);+ return NextResponse.json({ error: "Failed to batch delete connections" }, { status: 500 });+ }+}+/*** Sync to Cloud if enabled*/diff --git a/src/i18n/messages/ar.json b/src/i18n/messages/ar.jsonindex 75ffd22d6b..6c3fd9e732 100644--- a/src/i18n/messages/ar.json+++ b/src/i18n/messages/ar.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (للتحقق فقط)","providerNotFound": "لم يتم العثور على الموفر","deleteConnectionConfirm": "هل تريد حذف هذا الاتصال؟",+ "batchDeleteSelected": "حذف المحدد ({count})",+ "batchDeleteConfirm": "هل تريد حذف {count} اتصال(ات)؟ لا يمكن التراجع عن هذا الإجراء.",+ "batchDeleteSuccess": "تم حذف {count} اتصال(ات)","failedSetAlias": "فشل في تعيين الاسم المستعار","failedSaveConnection": "فشل حفظ الاتصال","failedSaveConnectionRetry": "فشل حفظ الاتصال. يرجى المحاولة مرة أخرى.",diff --git a/src/i18n/messages/bg.json b/src/i18n/messages/bg.jsonindex 164e7b0a33..039acafb3f 100644--- a/src/i18n/messages/bg.json+++ b/src/i18n/messages/bg.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (само за проверка)","providerNotFound": "Доставчикът не е намерен","deleteConnectionConfirm": "Изтриване на тази връзка?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Неуспешно задаване на псевдоним","failedSaveConnection": "Неуспешно запазване на връзката","failedSaveConnectionRetry": "Неуспешно запазване на връзката. Моля, опитайте отново.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/bn.json b/src/i18n/messages/bn.jsonindex 6930e6768e..b7b05a2aea 100644--- a/src/i18n/messages/bn.json+++ b/src/i18n/messages/bn.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/cs.json b/src/i18n/messages/cs.jsonindex 9a5ecff732..e4efa3613c 100644--- a/src/i18n/messages/cs.json+++ b/src/i18n/messages/cs.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (pouze pro ověření)","providerNotFound": "Poskytovatel nenalezen","deleteConnectionConfirm": "Smazat toto připojení?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Nastavení aliasu selhalo","failedSaveConnection": "Uložení připojení selhalo","failedSaveConnectionRetry": "Uložení připojení selhalo. Zkuste to prosím znovu.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/da.json b/src/i18n/messages/da.jsonindex be9d21d2da..0024a90698 100644--- a/src/i18n/messages/da.json+++ b/src/i18n/messages/da.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (kun til validering)","providerNotFound": "Udbyder blev ikke fundet","deleteConnectionConfirm": "Vil du slette denne forbindelse?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Aliaset kunne ikke indstilles","failedSaveConnection": "Forbindelsen kunne ikke gemmes","failedSaveConnectionRetry": "Forbindelsen kunne ikke gemmes. Prøv venligst igen.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/de.json b/src/i18n/messages/de.jsonindex 16a69d2bbb..cb8eb95601 100644--- a/src/i18n/messages/de.json+++ b/src/i18n/messages/de.json@@ -2351,6 +2351,9 @@"testKeyPlaceholder": "sk-... (nur zur Validierung)","providerNotFound": "Anbieter nicht gefunden","deleteConnectionConfirm": "Diese Verbindung löschen?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Alias konnte nicht festgelegt werden","failedSaveConnection": "Die Verbindung konnte nicht gespeichert werden","failedSaveConnectionRetry": "Die Verbindung konnte nicht gespeichert werden. Bitte versuchen Sie es erneut.",@@ -4634,4 +4637,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.jsonindex bd123a7711..0707029ea6 100644--- a/src/i18n/messages/en.json+++ b/src/i18n/messages/en.json@@ -2735,6 +2735,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",diff --git a/src/i18n/messages/es.json b/src/i18n/messages/es.jsonindex f21bf2df06..a65f9a5c2c 100644--- a/src/i18n/messages/es.json+++ b/src/i18n/messages/es.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (solo para validación)","providerNotFound": "Proveedor no encontrado","deleteConnectionConfirm": "¿Eliminar esta conexión?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "No se pudo establecer el alias","failedSaveConnection": "No se pudo guardar la conexión","failedSaveConnectionRetry": "No se pudo guardar la conexión. Por favor inténtalo de nuevo.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/fa.json b/src/i18n/messages/fa.jsonindex 15b61ccc46..2c4523b284 100644--- a/src/i18n/messages/fa.json+++ b/src/i18n/messages/fa.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/fi.json b/src/i18n/messages/fi.jsonindex df0f2dff27..483c73dbc1 100644--- a/src/i18n/messages/fi.json+++ b/src/i18n/messages/fi.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (vain vahvistusta varten)","providerNotFound": "Palveluntarjoajaa ei löydy","deleteConnectionConfirm": "Poistetaanko tämä yhteys?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Aliaksen asettaminen epäonnistui","failedSaveConnection": "Yhteyden tallentaminen epäonnistui","failedSaveConnectionRetry": "Yhteyden tallentaminen epäonnistui. Yritä uudelleen.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/fr.json b/src/i18n/messages/fr.jsonindex d93af41ddf..486d3977b5 100644--- a/src/i18n/messages/fr.json+++ b/src/i18n/messages/fr.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (pour validation uniquement)","providerNotFound": "Fournisseur introuvable","deleteConnectionConfirm": "Supprimer cette connexion ?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Échec de la définition de l'alias","failedSaveConnection": "Échec de l'enregistrement de la connexion","failedSaveConnectionRetry": "Échec de l'enregistrement de la connexion. Veuillez réessayer.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/gu.json b/src/i18n/messages/gu.jsonindex 567ad645df..87a2e40382 100644--- a/src/i18n/messages/gu.json+++ b/src/i18n/messages/gu.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/he.json b/src/i18n/messages/he.jsonindex 67fc271d00..991232f1a5 100644--- a/src/i18n/messages/he.json+++ b/src/i18n/messages/he.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (לאימות בלבד)","providerNotFound": "הספק לא נמצא","deleteConnectionConfirm": "למחוק את החיבור הזה?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "הגדרת הכינוי נכשלה","failedSaveConnection": "שמירת החיבור נכשלה","failedSaveConnectionRetry": "שמירת החיבור נכשלה. אנא נסה שוב.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/hi.json b/src/i18n/messages/hi.jsonindex ae4599e659..88bbf6aed5 100644--- a/src/i18n/messages/hi.json+++ b/src/i18n/messages/hi.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "एसके-... (केवल सत्यापन के लिए)","providerNotFound": "प्रदाता नहीं मिला","deleteConnectionConfirm": "यह कनेक्शन हटाएं?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "उपनाम सेट करने में विफल","failedSaveConnection": "कनेक्शन सहेजने में विफल","failedSaveConnectionRetry": "कनेक्शन सहेजने में विफल. कृपया पुन: प्रयास करें।",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/hu.json b/src/i18n/messages/hu.jsonindex 62593a6ae6..1d83d74677 100644--- a/src/i18n/messages/hu.json+++ b/src/i18n/messages/hu.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (csak érvényesítés céljából)","providerNotFound": "Szolgáltató nem található","deleteConnectionConfirm": "Törli ezt a kapcsolatot?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Nem sikerült beállítani az aliast","failedSaveConnection": "Nem sikerült menteni a kapcsolatot","failedSaveConnectionRetry": "Nem sikerült menteni a kapcsolatot. Kérjük, próbálja újra.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/id.json b/src/i18n/messages/id.jsonindex 95462d73a2..3071460e71 100644--- a/src/i18n/messages/id.json+++ b/src/i18n/messages/id.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (untuk validasi saja)","providerNotFound": "Penyedia tidak ditemukan","deleteConnectionConfirm": "Hapus koneksi ini?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Gagal menyetel alias","failedSaveConnection": "Gagal menyimpan koneksi","failedSaveConnectionRetry": "Gagal menyimpan koneksi. Silakan coba lagi.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/in.json b/src/i18n/messages/in.jsonindex acccdf55fa..46b56fa969 100644--- a/src/i18n/messages/in.json+++ b/src/i18n/messages/in.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/it.json b/src/i18n/messages/it.jsonindex b479d8fec3..956ee050d6 100644--- a/src/i18n/messages/it.json+++ b/src/i18n/messages/it.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (solo per la convalida)","providerNotFound": "Fornitore non trovato","deleteConnectionConfirm": "Eliminare questa connessione?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Impossibile impostare l'alias","failedSaveConnection": "Impossibile salvare la connessione","failedSaveConnectionRetry": "Impossibile salvare la connessione. Per favore riprova.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/ja.json b/src/i18n/messages/ja.jsonindex 14838dc04e..f1e57ef338 100644--- a/src/i18n/messages/ja.json+++ b/src/i18n/messages/ja.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (検証のみ)","providerNotFound": "プロバイダーが見つかりません","deleteConnectionConfirm": "この接続を削除しますか?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "エイリアスの設定に失敗しました","failedSaveConnection": "接続の保存に失敗しました","failedSaveConnectionRetry": "接続を保存できませんでした。もう一度試してください。",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/ko.json b/src/i18n/messages/ko.jsonindex d3658ec6ba..9a7682b850 100644--- a/src/i18n/messages/ko.json+++ b/src/i18n/messages/ko.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-...(검증용으로만)","providerNotFound": "공급자를 찾을 수 없습니다.","deleteConnectionConfirm": "이 연결을 삭제하시겠습니까?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "별칭을 설정하지 못했습니다.","failedSaveConnection": "연결을 저장하지 못했습니다.","failedSaveConnectionRetry": "연결을 저장하지 못했습니다. 다시 시도해 주세요.",@@ -4620,4 +4623,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/mr.json b/src/i18n/messages/mr.jsonindex 5d405ed300..53bb9d18de 100644--- a/src/i18n/messages/mr.json+++ b/src/i18n/messages/mr.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/ms.json b/src/i18n/messages/ms.jsonindex 0bc13e9b36..85c752a7e8 100644--- a/src/i18n/messages/ms.json+++ b/src/i18n/messages/ms.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (untuk pengesahan sahaja)","providerNotFound": "Pembekal tidak ditemui","deleteConnectionConfirm": "Padamkan sambungan ini?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Gagal menetapkan alias","failedSaveConnection": "Gagal menyimpan sambungan","failedSaveConnectionRetry": "Gagal menyimpan sambungan. Sila cuba lagi.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/nl.json b/src/i18n/messages/nl.jsonindex 2245cf6aa0..c4b6218998 100644--- a/src/i18n/messages/nl.json+++ b/src/i18n/messages/nl.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (alleen ter validatie)","providerNotFound": "Aanbieder niet gevonden","deleteConnectionConfirm": "Deze verbinding verwijderen?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Kan alias niet instellen","failedSaveConnection": "Kan de verbinding niet opslaan","failedSaveConnectionRetry": "Kan de verbinding niet opslaan. Probeer het opnieuw.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/no.json b/src/i18n/messages/no.jsonindex dbf3e120fc..006b8cfc9f 100644--- a/src/i18n/messages/no.json+++ b/src/i18n/messages/no.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (kun for validering)","providerNotFound": "Finner ikke leverandør","deleteConnectionConfirm": "Vil du slette denne tilkoblingen?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Kunne ikke angi alias","failedSaveConnection": "Kunne ikke lagre tilkoblingen","failedSaveConnectionRetry": "Kunne ikke lagre tilkoblingen. Vennligst prøv igjen.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/phi.json b/src/i18n/messages/phi.jsonindex 4ba3d395bd..c04130056b 100644--- a/src/i18n/messages/phi.json+++ b/src/i18n/messages/phi.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (para sa pagpapatunay lamang)","providerNotFound": "Hindi nahanap ang provider","deleteConnectionConfirm": "Tanggalin ang koneksyon na ito?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Nabigong itakda ang alias","failedSaveConnection": "Nabigong i-save ang koneksyon","failedSaveConnectionRetry": "Nabigong i-save ang koneksyon. Pakisubukang muli.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/pl.json b/src/i18n/messages/pl.jsonindex b13833222a..54fb413ffa 100644--- a/src/i18n/messages/pl.json+++ b/src/i18n/messages/pl.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (tylko do sprawdzenia)","providerNotFound": "Nie znaleziono dostawcy","deleteConnectionConfirm": "Usunąć to połączenie?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Nie udało się ustawić aliasu","failedSaveConnection": "Nie udało się zapisać połączenia","failedSaveConnectionRetry": "Nie udało się zapisać połączenia. Spróbuj ponownie.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/pt-BR.json b/src/i18n/messages/pt-BR.jsonindex 0704270f3e..999d5eddfc 100644--- a/src/i18n/messages/pt-BR.json+++ b/src/i18n/messages/pt-BR.json@@ -2459,6 +2459,9 @@"testKeyPlaceholder": "sk-... (apenas para validação)","providerNotFound": "Provedor não encontrado","deleteConnectionConfirm": "Excluir esta conexão?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Falha ao definir alias","failedSaveConnection": "Falha ao salvar conexão","failedSaveConnectionRetry": "Falha ao salvar conexão. Tente novamente.",@@ -4796,4 +4799,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/pt.json b/src/i18n/messages/pt.jsonindex 671093653e..6d5573406e 100644--- a/src/i18n/messages/pt.json+++ b/src/i18n/messages/pt.json@@ -2409,6 +2409,9 @@"testKeyPlaceholder": "sk-... (apenas para validação)","providerNotFound": "Provedor não encontrado","deleteConnectionConfirm": "Excluir esta conexão?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Falha ao definir o alias","failedSaveConnection": "Falha ao salvar conexão","failedSaveConnectionRetry": "Falha ao salvar a conexão. Por favor, tente novamente.",@@ -4650,4 +4653,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/ro.json b/src/i18n/messages/ro.jsonindex 4309f45c92..dda797a7da 100644--- a/src/i18n/messages/ro.json+++ b/src/i18n/messages/ro.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (doar pentru validare)","providerNotFound": "Furnizorul nu a fost găsit","deleteConnectionConfirm": "Ștergeți această conexiune?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Nu s-a putut seta aliasul","failedSaveConnection": "Nu s-a putut salva conexiunea","failedSaveConnectionRetry": "Nu s-a putut salva conexiunea. Vă rugăm să încercați din nou.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.jsonindex dd292a5566..f54a54a5a9 100644--- a/src/i18n/messages/ru.json+++ b/src/i18n/messages/ru.json@@ -2361,6 +2361,9 @@"testKeyPlaceholder": "sk-... (только для проверки)","providerNotFound": "Провайдер не найден","deleteConnectionConfirm": "Удалить это соединение?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Не удалось установить псевдоним","failedSaveConnection": "Не удалось сохранить соединение.","failedSaveConnectionRetry": "Не удалось сохранить соединение. Пожалуйста, попробуйте еще раз.",@@ -4642,4 +4645,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/sk.json b/src/i18n/messages/sk.jsonindex 05c07b15f3..2f188e676b 100644--- a/src/i18n/messages/sk.json+++ b/src/i18n/messages/sk.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (len na overenie)","providerNotFound": "Poskytovateľ sa nenašiel","deleteConnectionConfirm": "Odstrániť toto pripojenie?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Nepodarilo sa nastaviť alias","failedSaveConnection": "Pripojenie sa nepodarilo uložiť","failedSaveConnectionRetry": "Pripojenie sa nepodarilo uložiť. Skúste to znova.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/sv.json b/src/i18n/messages/sv.jsonindex 504c0c237b..b65cfdc8ed 100644--- a/src/i18n/messages/sv.json+++ b/src/i18n/messages/sv.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (endast för validering)","providerNotFound": "Det gick inte att hitta leverantören","deleteConnectionConfirm": "Vill du ta bort den här anslutningen?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Det gick inte att ange alias","failedSaveConnection": "Det gick inte att spara anslutningen","failedSaveConnectionRetry": "Det gick inte att spara anslutningen. Försök igen.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/sw.json b/src/i18n/messages/sw.jsonindex acccdf55fa..46b56fa969 100644--- a/src/i18n/messages/sw.json+++ b/src/i18n/messages/sw.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/ta.json b/src/i18n/messages/ta.jsonindex 0bdddb432e..d198ac96ad 100644--- a/src/i18n/messages/ta.json+++ b/src/i18n/messages/ta.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/te.json b/src/i18n/messages/te.jsonindex e71bb82548..a0010cf116 100644--- a/src/i18n/messages/te.json+++ b/src/i18n/messages/te.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/th.json b/src/i18n/messages/th.jsonindex 7d982ec589..cc6c537156 100644--- a/src/i18n/messages/th.json+++ b/src/i18n/messages/th.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (สำหรับการตรวจสอบเท่านั้น)","providerNotFound": "ไม่พบผู้ให้บริการ","deleteConnectionConfirm": "ลบการเชื่อมต่อนี้ใช่ไหม",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "ไม่สามารถตั้งชื่อแทนได้","failedSaveConnection": "ไม่สามารถบันทึกการเชื่อมต่อ","failedSaveConnectionRetry": "ไม่สามารถบันทึกการเชื่อมต่อ โปรดลองอีกครั้ง",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/tr.json b/src/i18n/messages/tr.jsonindex 365aef347a..c84ded9329 100644--- a/src/i18n/messages/tr.json+++ b/src/i18n/messages/tr.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (yalnızca doğrulama için)","providerNotFound": "Sağlayıcı bulunamadı","deleteConnectionConfirm": "Bu bağlantı silinsin mi?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Takma ad ayarlanamadı","failedSaveConnection": "Bağlantı kaydedilemedi","failedSaveConnectionRetry": "Bağlantı kaydedilemedi. Lütfen tekrar deneyin.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/uk-UA.json b/src/i18n/messages/uk-UA.jsonindex d3d1d5258d..22bb4570c8 100644--- a/src/i18n/messages/uk-UA.json+++ b/src/i18n/messages/uk-UA.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (лише для перевірки)","providerNotFound": "Постачальник не знайдено","deleteConnectionConfirm": "Видалити це підключення?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Не вдалося встановити псевдонім","failedSaveConnection": "Не вдалося зберегти з’єднання","failedSaveConnectionRetry": "Не вдалося зберегти з’єднання. Спробуйте ще раз.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/ur.json b/src/i18n/messages/ur.jsonindex 876da826e8..bfb0fe242f 100644--- a/src/i18n/messages/ur.json+++ b/src/i18n/messages/ur.json@@ -2496,6 +2496,9 @@"testKeyPlaceholder": "sk-... (for validation only)","providerNotFound": "Provider not found","deleteConnectionConfirm": "Delete this connection?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Failed to set alias","failedSaveConnection": "Failed to save connection","failedSaveConnectionRetry": "Failed to save connection. Please try again.",@@ -4911,4 +4914,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/vi.json b/src/i18n/messages/vi.jsonindex cfc309e96d..4d3c86a0f6 100644--- a/src/i18n/messages/vi.json+++ b/src/i18n/messages/vi.json@@ -2337,6 +2337,9 @@"testKeyPlaceholder": "sk-... (chỉ để xác nhận)","providerNotFound": "Không tìm thấy nhà cung cấp","deleteConnectionConfirm": "Xóa kết nối này?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "Không đặt được bí danh","failedSaveConnection": "Không lưu được kết nối","failedSaveConnectionRetry": "Không lưu được kết nối. Vui lòng thử lại.",@@ -4618,4 +4621,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/i18n/messages/zh-CN.json b/src/i18n/messages/zh-CN.jsonindex 5183108da9..d31fab777d 100644--- a/src/i18n/messages/zh-CN.json+++ b/src/i18n/messages/zh-CN.json@@ -2436,6 +2436,9 @@"testKeyPlaceholder": "sk-...(仅用于验证)","providerNotFound": "未找到提供商","deleteConnectionConfirm": "删除这个连接吗?",+ "batchDeleteSelected": "Delete Selected ({count})",+ "batchDeleteConfirm": "Delete {count} connection(s)? This action cannot be undone.",+ "batchDeleteSuccess": "Deleted {count} connection(s)","failedSetAlias": "设置别名失败","failedSaveConnection": "保存连接失败","failedSaveConnectionRetry": "无法保存连接。请再试一次。",@@ -4866,4 +4869,4 @@"agentFeaturesContextLengthErrorInteger": "Context length must be a valid integer","agentFeaturesContextLengthErrorRange": "Context length must be between 1000 and 2000000"}-}+}\ No newline at end of filediff --git a/src/lib/db/providers.ts b/src/lib/db/providers.tsindex fcf6b79fb8..f87953903a 100644--- a/src/lib/db/providers.ts+++ b/src/lib/db/providers.ts@@ -435,6 +435,24 @@ export async function deleteProviderConnection(id: string) {return true;}+export async function deleteProviderConnections(ids: string[]): Promise<number> {+ if (ids.length === 0) return 0;+ const db = getDbInstance();++ const deletedCount = db.transaction(() => {+ const placeholders = ids.map(() => "?").join(",");+ db.prepare(`DELETE FROM quota_snapshots WHERE connection_id IN (${placeholders})`).run(...ids);+ const result = db.prepare(+ `DELETE FROM provider_connections WHERE id IN (${placeholders})`+ ).run(...ids);+ return result.changes ?? 0;+ })();++ backupDbFile("pre-write");+ invalidateDbCache("connections");+ return deletedCount;+}+export async function deleteProviderConnectionsByProvider(providerId: string) {const db = getDbInstance() as unknown as DbLike;const connectionIds = dbdiff --git a/src/lib/localDb.ts b/src/lib/localDb.tsindex 728c14101b..a0f67e4022 100755--- a/src/lib/localDb.ts+++ b/src/lib/localDb.ts@@ -13,6 +13,7 @@ export {createProviderConnection,updateProviderConnection,deleteProviderConnection,+ deleteProviderConnections,deleteProviderConnectionsByProvider,reorderProviderConnections,cleanupProviderConnections,diff --git a/src/models/index.ts b/src/models/index.tsindex 2dfc05474c..88da17a5be 100755--- a/src/models/index.ts+++ b/src/models/index.ts@@ -5,6 +5,7 @@ export {createProviderConnection,updateProviderConnection,deleteProviderConnection,+ deleteProviderConnections,getProviderNodes,getProviderNodeById,createProviderNode,diff --git a/tests/unit/db-providers-crud.test.ts b/tests/unit/db-providers-crud.test.tsindex 811e66ddea..638af3b50d 100644--- a/tests/unit/db-providers-crud.test.ts+++ b/tests/unit/db-providers-crud.test.ts@@ -224,6 +224,40 @@ test("deleteProviderConnection reorders remaining rows and bulk delete reports cassert.deepEqual(await providersDb.getProviderConnections({ provider: "anthropic" }), []);});+test("deleteProviderConnections deletes multiple connections and returns correct count", async () => {+ const a = await providersDb.createProviderConnection({+ provider: "openai",+ authType: "apikey",+ name: "Alpha",+ apiKey: "alpha-key",+ });+ const b = await providersDb.createProviderConnection({+ provider: "openai",+ authType: "apikey",+ name: "Beta",+ apiKey: "beta-key",+ });+ const c = await providersDb.createProviderConnection({+ provider: "openai",+ authType: "apikey",+ name: "Gamma",+ apiKey: "gamma-key",+ });++ const deleted = await providersDb.deleteProviderConnections([(a as any).id, (c as any).id]);+ assert.equal(deleted, 2);++ assert.equal(await providersDb.getProviderConnectionById((a as any).id), null);+ assert.equal(await providersDb.getProviderConnectionById((c as any).id), null);+ const remaining = await providersDb.getProviderConnectionById((b as any).id);+ assert.notEqual(remaining, null);+});++test("deleteProviderConnections with empty array returns 0", async () => {+ const deleted = await providersDb.deleteProviderConnections([]);+ assert.equal(deleted, 0);+});+test("provider node CRUD supports filter, update and delete", async () => {const customNode = await providersDb.createProviderNode({type: "custom",diff --git a/tests/unit/providers-route-managed-catalog.test.ts b/tests/unit/providers-route-managed-catalog.test.tsindex 90b4e65003..a5eed52490 100644--- a/tests/unit/providers-route-managed-catalog.test.ts+++ b/tests/unit/providers-route-managed-catalog.test.ts@@ -436,3 +436,72 @@ test("providers route rejects upstream proxy tools as direct provider connectionassert.equal(response.status, 400);assert.deepEqual(await response.json(), { error: "Invalid provider" });});++test("DELETE /api/providers batch deletes connections", async () => {+ const createReq = async (provider, name, apiKey) =>+ providersRoute.POST(+ await makeManagementSessionRequest("http://localhost/api/providers", {+ method: "POST",+ body: { provider, name, apiKey },+ })+ );++ const r1 = await createReq("glhf", "Conn 1", "key-1");+ const r2 = await createReq("glhf", "Conn 2", "key-2");+ const r3 = await createReq("glhf", "Conn 3", "key-3");+ const id1 = (await r1.json()).connection.id;+ const id2 = (await r2.json()).connection.id;+ const id3 = (await r3.json()).connection.id;++ const deleteRes = await providersRoute.DELETE(+ await makeManagementSessionRequest("http://localhost/api/providers", {+ method: "DELETE",+ body: { ids: [id1, id3] },+ })+ );++ assert.equal(deleteRes.status, 200);+ const deletePayload = (await deleteRes.json()) as any;+ assert.equal(deletePayload.deleted, 2);++ const listRes = await providersRoute.GET(+ await makeManagementSessionRequest("http://localhost/api/providers")+ );+ const listPayload = (await listRes.json()) as any;+ const remainingIds = listPayload.connections.map((c) => c.id);+ assert.equal(remainingIds.includes(id1), false);+ assert.equal(remainingIds.includes(id3), false);+ assert.equal(remainingIds.includes(id2), true);+});++test("DELETE /api/providers rejects empty ids array", async () => {+ const res = await providersRoute.DELETE(+ await makeManagementSessionRequest("http://localhost/api/providers", {+ method: "DELETE",+ body: { ids: [] },+ })+ );+ assert.equal(res.status, 400);+});++test("DELETE /api/providers rejects ids over 100 limit", async () => {+ const res = await providersRoute.DELETE(+ await makeManagementSessionRequest("http://localhost/api/providers", {+ method: "DELETE",+ body: { ids: Array.from({ length: 101 }, (_, i) => `id-${i}`) },+ })+ );+ assert.equal(res.status, 400);+ const payload = (await res.json()) as any;+ assert.equal(payload.error, "Cannot delete more than 100 connections at once");+});++test("DELETE /api/providers rejects non-array ids", async () => {+ const res = await providersRoute.DELETE(+ await makeManagementSessionRequest("http://localhost/api/providers", {+ method: "DELETE",+ body: { ids: "not-an-array" },+ })+ );+ assert.equal(res.status, 400);+});