From e133f6f8e8ee5adbf67b2192e8528d0292ecc30b Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:17:41 +0530 Subject: [PATCH] refactor(user-settings): remove Agent Status feature and related components - Deleted the Agent Status page and its associated content component from the user settings. - Updated UserSettingsLayoutShell to remove references to Agent Status, ensuring a cleaner user interface. - This change simplifies the user settings by focusing on more relevant features. --- .../user-settings/agent-status/page.tsx | 5 - .../components/AgentStatusContent.tsx | 321 ------------------ .../user-settings/layout-shell.tsx | 7 - 3 files changed, 333 deletions(-) delete mode 100644 surfsense_web/app/dashboard/[workspace_id]/user-settings/agent-status/page.tsx delete mode 100644 surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentStatusContent.tsx diff --git a/surfsense_web/app/dashboard/[workspace_id]/user-settings/agent-status/page.tsx b/surfsense_web/app/dashboard/[workspace_id]/user-settings/agent-status/page.tsx deleted file mode 100644 index dc5c61d2a..000000000 --- a/surfsense_web/app/dashboard/[workspace_id]/user-settings/agent-status/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { AgentStatusContent } from "../components/AgentStatusContent"; - -export default function Page() { - return ; -} diff --git a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentStatusContent.tsx b/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentStatusContent.tsx deleted file mode 100644 index bc31dffed..000000000 --- a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentStatusContent.tsx +++ /dev/null @@ -1,321 +0,0 @@ -"use client"; - -import { useAtomValue } from "jotai"; -import { AlertTriangle, CircleCheck, CircleSlash, Info } from "lucide-react"; -import { Fragment, useMemo } from "react"; -import { agentFlagsAtom } from "@/atoms/agent/agent-flags-query.atom"; -import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; -import { Badge } from "@/components/ui/badge"; -import { Separator } from "@/components/ui/separator"; -import { Skeleton } from "@/components/ui/skeleton"; -import type { AgentFeatureFlags } from "@/lib/apis/agent-flags-api.service"; -import { cn } from "@/lib/utils"; - -type FlagKey = keyof AgentFeatureFlags; - -interface FlagDef { - key: FlagKey; - label: string; - description: string; - envVar: string; -} - -interface FlagGroup { - id: string; - title: string; - subtitle: string; - flags: FlagDef[]; -} - -const FLAG_GROUPS: FlagGroup[] = [ - { - id: "tier1", - title: "Tier 1 — Agent quality", - subtitle: "Context editing, retries, fallbacks, doom-loop, tool-call repair.", - flags: [ - { - key: "enable_context_editing", - label: "Context editing", - description: "Trim tool outputs and spill old text into backend storage.", - envVar: "SURFSENSE_ENABLE_CONTEXT_EDITING", - }, - { - key: "enable_compaction_v2", - label: "Compaction v2", - description: "SurfSense-aware compaction replacing safe summarization.", - envVar: "SURFSENSE_ENABLE_COMPACTION_V2", - }, - { - key: "enable_retry_after", - label: "Retry-After", - description: "Honour rate-limit retry-after headers automatically.", - envVar: "SURFSENSE_ENABLE_RETRY_AFTER", - }, - { - key: "enable_model_fallback", - label: "Model fallback", - description: "Fail over to a backup model on persistent errors.", - envVar: "SURFSENSE_ENABLE_MODEL_FALLBACK", - }, - { - key: "enable_model_call_limit", - label: "Model call limit", - description: "Cap total model calls per turn to prevent budget run-aways.", - envVar: "SURFSENSE_ENABLE_MODEL_CALL_LIMIT", - }, - { - key: "enable_tool_call_limit", - label: "Tool call limit", - description: "Cap total tool calls per turn.", - envVar: "SURFSENSE_ENABLE_TOOL_CALL_LIMIT", - }, - { - key: "enable_tool_call_repair", - label: "Tool-call name repair", - description: "Recover from lower-cased / fuzzy tool names emitted by smaller models.", - envVar: "SURFSENSE_ENABLE_TOOL_CALL_REPAIR", - }, - { - key: "enable_doom_loop", - label: "Doom-loop detection", - description: "Detect repeated identical tool calls and ask the user to confirm.", - envVar: "SURFSENSE_ENABLE_DOOM_LOOP", - }, - ], - }, - { - id: "tier2", - title: "Tier 2 — Safety", - subtitle: "Permission rules, busy-mutex, smarter tool selection.", - flags: [ - { - key: "enable_permission", - label: "Permission middleware", - description: "Apply allow/deny/ask rules from the Agent Permissions tab.", - envVar: "SURFSENSE_ENABLE_PERMISSION", - }, - { - key: "enable_busy_mutex", - label: "Busy mutex", - description: "Prevent two concurrent runs from corrupting the same thread.", - envVar: "SURFSENSE_ENABLE_BUSY_MUTEX", - }, - { - key: "enable_llm_tool_selector", - label: "LLM tool selector", - description: "Use a smaller model to pre-filter the tool list per turn.", - envVar: "SURFSENSE_ENABLE_LLM_TOOL_SELECTOR", - }, - ], - }, - { - id: "tier4", - title: "Tier 4 — Skills + subagents", - subtitle: "Built-in skills, specialized subagents, KB planner runnable.", - flags: [ - { - key: "enable_skills", - label: "Skills", - description: "Load on-demand skill packs (kb-research, report-writing, …).", - envVar: "SURFSENSE_ENABLE_SKILLS", - }, - { - key: "enable_specialized_subagents", - label: "Specialized subagents", - description: "Spin up explore / report_writer / connector_negotiator subagents.", - envVar: "SURFSENSE_ENABLE_SPECIALIZED_SUBAGENTS", - }, - ], - }, - { - id: "tier5", - title: "Tier 5 — Audit + revert", - subtitle: "Action log + revert route used by the Agent Actions dialog.", - flags: [ - { - key: "enable_action_log", - label: "Action log", - description: "Persist every tool call to agent_action_log.", - envVar: "SURFSENSE_ENABLE_ACTION_LOG", - }, - { - key: "enable_revert_route", - label: "Revert route", - description: "Allow reverting reversible actions from the action log.", - envVar: "SURFSENSE_ENABLE_REVERT_ROUTE", - }, - ], - }, - { - id: "tier6", - title: "Tier 6 — Plugins", - subtitle: "Optional middleware loaded from entry points.", - flags: [ - { - key: "enable_plugin_loader", - label: "Plugin loader", - description: "Load surfsense.plugins entry-point middleware.", - envVar: "SURFSENSE_ENABLE_PLUGIN_LOADER", - }, - ], - }, - { - id: "obs", - title: "Observability", - subtitle: "Telemetry pipelines (orthogonal to feature gating).", - flags: [ - { - key: "enable_otel", - label: "OpenTelemetry", - description: "Emit OTel spans (also requires OTEL_EXPORTER_OTLP_ENDPOINT).", - envVar: "SURFSENSE_ENABLE_OTEL", - }, - ], - }, - { - id: "desktop", - title: "Desktop", - subtitle: "Desktop-only capabilities exposed by the backend deployment.", - flags: [ - { - key: "enable_desktop_local_filesystem", - label: "Local filesystem", - description: "Allow Desktop chat sessions to operate directly on selected local folders.", - envVar: "ENABLE_DESKTOP_LOCAL_FILESYSTEM", - }, - ], - }, -]; - -function FlagRow({ def, value }: { def: FlagDef; value: boolean }) { - return ( -
-
-
- {def.label} - - {def.envVar} - -
-

{def.description}

-
- - {value ? : } - {value ? "On" : "Off"} - -
- ); -} - -export function AgentStatusContent() { - const { data: flags, isLoading, isError, error } = useAtomValue(agentFlagsAtom); - - const enabledCount = useMemo(() => { - if (!flags) return 0; - return Object.entries(flags).filter(([k, v]) => k !== "disable_new_agent_stack" && v === true) - .length; - }, [flags]); - - if (isLoading) { - return ( -
- - - -
- ); - } - - if (isError || !flags) { - return ( - - - Failed to load agent status - - {error instanceof Error ? error.message : "Unknown error."} - - - ); - } - - const masterOff = flags.disable_new_agent_stack; - - return ( -
- {masterOff ? ( - - - Master kill-switch is on - -

- Showing that{" "} - - SURFSENSE_DISABLE_NEW_AGENT_STACK=true - - , which forces every new middleware off, regardless of the individual flags below. - Restart the backend after changing it. -

-
-
- ) : ( - - - - Agent stack - - {enabledCount} on - - - -

- Showing a read-only mirror of the backend's AgentFeatureFlags. Flip an - env var and restart the backend to change a value. -

-
-
- )} - - {FLAG_GROUPS.map((group, groupIdx) => { - const allOff = group.flags.every((f) => !flags[f.key]); - return ( -
- {groupIdx > 0 && } -
-
-
-

{group.title}

-

{group.subtitle}

-
- {allOff && ( - - all off - - )} -
- -
- {group.flags.map((def, flagIdx) => ( - - {flagIdx > 0 && } - - - ))} -
-
-
- ); - })} -
- ); -} diff --git a/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout-shell.tsx b/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout-shell.tsx index 0e33a5be5..5446c4167 100644 --- a/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout-shell.tsx +++ b/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout-shell.tsx @@ -10,7 +10,6 @@ import { ReceiptText, ShieldCheck, WandSparkles, - Workflow, } from "lucide-react"; import Link from "next/link"; import { useSelectedLayoutSegment } from "next/navigation"; @@ -27,7 +26,6 @@ export type UserSettingsTab = | "prompts" | "community-prompts" | "agent-permissions" - | "agent-status" | "purchases" | "desktop" | "hotkeys" @@ -80,11 +78,6 @@ export function UserSettingsLayoutShell({ workspaceId, children }: UserSettingsL label: "Agent Permissions", icon: , }, - { - value: "agent-status" as const, - label: "Agent Status", - icon: , - }, { value: "messaging-channels" as const, label: "Messaging Channels",