Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(allowlist): disable Android + Email surfaces from palette + credentials (Wave 34)
trohitgabf8f857c8d3
diff --git a/client/src/components/credentials/CredentialsModal.tsx b/client/src/components/credentials/CredentialsModal.tsxindex ac43c33d..d8bcff04 100644--- a/client/src/components/credentials/CredentialsModal.tsx+++ b/client/src/components/credentials/CredentialsModal.tsx@@ -28,6 +28,7 @@ import CredentialsPalette from './CredentialsPalette';import { rehydrateCatalogue } from './catalogueAdapter';import { useCatalogueQuery } from '../../hooks/useCatalogueQuery';import { useCredentialRegistry } from '../../store/useCredentialRegistry';+import { useNodeAllowlist } from '../../hooks/useNodeAllowlist';interface Props {visible: boolean;@@ -50,8 +51,26 @@ const CredentialsModal: React.FC<Props> = ({ visible, onClose }) => {return rehydrateCatalogue(catalogue.data);}, [catalogue.data]);- const providers = rehydrated?.providers ?? [];- const categories = rehydrated?.categories ?? [];+ // Apply the absolute blocklist from server/config/node_allowlist.json+ // (`disabled_credential_categories`). Hides the entire category ++ // every provider belonging to it. Mode-independent; complements the+ // node-side `disabled_groups` so disabling Android removes both the+ // canvas nodes AND the credentials panel in one config edit.+ const { isCredentialCategoryDisabled } = useNodeAllowlist();+ const providers = useMemo(+ () =>+ (rehydrated?.providers ?? []).filter(+ (p) => !isCredentialCategoryDisabled(p.category),+ ),+ [rehydrated?.providers, isCredentialCategoryDisabled],+ );+ const categories = useMemo(+ () =>+ (rehydrated?.categories ?? []).filter(+ (c) => !isCredentialCategoryDisabled(c.key),+ ),+ [rehydrated?.categories, isCredentialCategoryDisabled],+ );// Default selection: if nothing is selected yet (or the previous// selection isn't in the current catalogue), pick the first provider.diff --git a/client/src/components/ui/ComponentPalette.tsx b/client/src/components/ui/ComponentPalette.tsxindex 96802c4f..1a899a0f 100644--- a/client/src/components/ui/ComponentPalette.tsx+++ b/client/src/components/ui/ComponentPalette.tsx@@ -27,7 +27,7 @@ const ComponentPalette: React.FC<ComponentPaletteProps> = ({specsReady = false,}) => {const theme = useAppTheme();- const { isVisible } = useNodeAllowlist();+ const { isBlocked, isAllowed } = useNodeAllowlist();// Backend-driven group metadata via the shared WS-in-queryFn hook.// `useNodeGroups` returns the full query result so we can render a@@ -55,9 +55,16 @@ const ComponentPalette: React.FC<ComponentPaletteProps> = ({const definitions = listCachedNodeSpecs().map(nodeSpecToDescription);const filteredDefinitions = definitions.filter((definition) => {- // Filter by backend allowlist (server/config/node_allowlist.json).- // Applied only in normal mode; dev mode shows every node.- if (!proMode && !isVisible(definition.name)) return false;+ // Backend allowlist (server/config/node_allowlist.json). Two-tier:+ // 1. `disabled_groups` + `disabled_nodes` — absolute blocklist+ // enforced in BOTH normal and dev mode. The node's group+ // array is passed so `disabled_groups` fires on every plugin+ // in the group (e.g. all 16 android service nodes hidden by+ // one entry).+ // 2. `enabled_nodes` — positive allowlist applied only in+ // normal mode; dev/pro mode bypasses it.+ if (isBlocked(definition.name, definition.group)) return false;+ if (!proMode && !isAllowed(definition.name)) return false;// Filter by search queryif (searchQuery.trim()) {@@ -99,7 +106,7 @@ const ComponentPalette: React.FC<ComponentPaletteProps> = ({});return categories;- }, [searchQuery, proMode, groupIndex, isVisible, specsReady]);+ }, [searchQuery, proMode, groupIndex, isBlocked, isAllowed, specsReady]);const totalComponents = Object.values(categorizedComponents).reduce((acc, components) => acc + components.length,diff --git a/client/src/hooks/useNodeAllowlist.ts b/client/src/hooks/useNodeAllowlist.tsindex 0cfb8194..00422a4e 100644--- a/client/src/hooks/useNodeAllowlist.ts+++ b/client/src/hooks/useNodeAllowlist.ts@@ -4,15 +4,47 @@ import { useWebSocket } from '../contexts/WebSocketContext';interface NodeAllowlistResponse {show_all: boolean;enabled_nodes: string[];+ /** Mode-independent blocklist by backend group (e.g. 'android' hides+ * every plugin in the android group + androidTool). Empty array if+ * the backend doesn't ship the field (older deployments). */+ disabled_groups: string[];+ /** Mode-independent blocklist by exact node type. Use for one-off+ * types whose group label doesn't match (e.g. 'android_agent' is in+ * the 'agent' group, not 'android'). */+ disabled_nodes: string[];+ /** Mode-independent blocklist for the Credentials Modal by category+ * key (matches `category` in server/config/credential_providers.json,+ * e.g. 'android' / 'ai' / 'social'). Empty array on older+ * deployments. */+ disabled_credential_categories: string[];}/**- * Fetches the node allowlist from the backend and exposes a membership check- * for the Component Palette.+ * Fetches the node allowlist from the backend and exposes the membership+ * checks every UI surface that lists nodes uses (Component Palette,+ * dropdowns, AI tool selectors, master skill folder, etc.).*- * The backend decides whether to filter (show_all flag); the frontend only- * checks list membership. While the response is loading, all nodes are shown- * to avoid a palette flash.+ * Two independent checks:+ *+ * `isBlocked(nodeType, groups?)` — absolute blocklist. Mode-independent.+ * Driven by `disabled_groups` + `disabled_nodes` from the JSON+ * config. Use to turn off entire groups (e.g. android) or specific+ * types (e.g. android_agent) so they're hidden in BOTH normal and+ * dev mode. Pass the node's group array so disabled_groups can+ * fire — without groups, only exact-type matches catch.+ *+ * `isAllowed(nodeType)` — positive allowlist. Driven by `enabled_nodes`.+ * `show_all=true` (empty list) returns true for everything. Call+ * sites typically gate this on `!proMode` so dev mode bypasses+ * the allowlist.+ *+ * `isVisible(nodeType, groups?)` — convenience: `!isBlocked && isAllowed`.+ * Use when proMode doesn't matter (every surface SHOULD respect+ * both layers).+ *+ * While the response is loading, all checks return permissively (no+ * palette flash). Both blocklists default to empty when the backend+ * doesn't ship the fields (older deployments).*/export const useNodeAllowlist = () => {const { sendRequest, isConnected } = useWebSocket();@@ -28,15 +60,42 @@ export const useNodeAllowlist = () => {setConfig({show_all: response?.show_all ?? true,enabled_nodes: response?.enabled_nodes ?? [],+ disabled_groups: response?.disabled_groups ?? [],+ disabled_nodes: response?.disabled_nodes ?? [],+ disabled_credential_categories: response?.disabled_credential_categories ?? [],});}).catch((error) => {console.error('[NodeAllowlist] Failed to fetch:', error);- setConfig({ show_all: true, enabled_nodes: [] });+ setConfig({+ show_all: true,+ enabled_nodes: [],+ disabled_groups: [],+ disabled_nodes: [],+ disabled_credential_categories: [],+ });});}, [isConnected, sendRequest]);- const isVisible = useCallback(+ /** Absolute blocklist check (mode-independent). False while loading+ * so UI doesn't pre-hide nodes during the fetch round-trip. */+ const isBlocked = useCallback(+ (nodeType: string, groups?: string[] | readonly string[]): boolean => {+ if (!config) return false;+ if (config.disabled_nodes.includes(nodeType)) return true;+ if (groups && groups.length > 0) {+ for (const g of groups) {+ if (config.disabled_groups.includes(g)) return true;+ }+ }+ return false;+ },+ [config]+ );++ /** Positive allowlist check. True while loading so UI doesn't hide+ * during the fetch. show_all=true returns true for every node. */+ const isAllowed = useCallback((nodeType: string): boolean => {if (!config) return true;if (config.show_all) return true;@@ -45,5 +104,29 @@ export const useNodeAllowlist = () => {[config]);- return { isVisible };+ /** Convenience: hidden if blocked OR not allowed. Honors both layers+ * unconditionally — call sites that want to bypass the allowlist+ * in dev mode should call isBlocked directly and short-circuit+ * the allowlist when proMode is true. */+ const isVisible = useCallback(+ (nodeType: string, groups?: string[] | readonly string[]): boolean => {+ if (isBlocked(nodeType, groups)) return false;+ return isAllowed(nodeType);+ },+ [isBlocked, isAllowed]+ );++ /** True if the credential category is in the absolute blocklist —+ * use to filter the Credentials Modal's category list (e.g. hide+ * the entire 'android' panel without removing it from the backend+ * catalogue). False while loading so the modal doesn't pre-hide. */+ const isCredentialCategoryDisabled = useCallback(+ (categoryKey: string): boolean => {+ if (!config) return false;+ return config.disabled_credential_categories.includes(categoryKey);+ },+ [config]+ );++ return { isVisible, isBlocked, isAllowed, isCredentialCategoryDisabled };};diff --git a/server/config/node_allowlist.json b/server/config/node_allowlist.jsonindex 43e77a61..e7b67ebd 100644--- a/server/config/node_allowlist.json+++ b/server/config/node_allowlist.json@@ -1,5 +1,5 @@{- "_comment": "List node types to show in the Component Palette. Empty list or missing file = all nodes shown (default-on). Node type identifiers must match the 'type' class attribute on the plugin in server/nodes/<category>/<file>.py verbatim.",+ "_comment": "Node visibility config. `enabled_nodes`: positive list shown in normal mode (empty = show all). `disabled_groups` / `disabled_nodes`: ABSOLUTE blocklist enforced in BOTH normal and dev mode — wins over enabled_nodes and over the show_all default. Use disabled_groups to hide every plugin in a backend group (e.g. 'android' hides all 16 Android service nodes + androidTool); use disabled_nodes for one-off type names like 'android_agent' that don't share the group label. Node type identifiers must match the 'type' class attribute on the plugin in server/nodes/<category>/<file>.py verbatim.","enabled_nodes": ["start","chatTrigger",@@ -25,5 +25,17 @@"telegramSend","telegramReceive"+ ],+ "disabled_groups": [+ "android",+ "email"+ ],+ "disabled_nodes": [+ "android_agent",+ "androidTool"+ ],+ "disabled_credential_categories": [+ "android",+ "email"]}diff --git a/server/services/node_allowlist.py b/server/services/node_allowlist.pyindex ec1d7bc8..743cea41 100644--- a/server/services/node_allowlist.py+++ b/server/services/node_allowlist.py@@ -29,32 +29,75 @@ class NodeAllowlistService:Response shape:show_all: bool- true -> do not filter the palette; every node is visible.+ true -> do not filter the palette; every node is visible+ (still subject to disabled_groups + disabled_nodes).false -> show only node types listed in enabled_nodes.enabled_nodes: list[str]Only meaningful when show_all is false.+ disabled_groups: list[str]+ Absolute blocklist. A node whose first group matches any+ entry here is hidden in BOTH normal and dev mode, even+ if listed in enabled_nodes. Use to disable an entire+ backend group (e.g. 'android' hides all 16 Android+ service nodes + androidTool).+ disabled_nodes: list[str]+ Absolute blocklist by exact node-type identifier. Same+ mode-independent enforcement as disabled_groups; use+ for one-off types whose group label doesn't match+ (e.g. 'android_agent' belongs to the 'agent' group).+ disabled_credential_categories: list[str]+ Absolute blocklist for the Credentials Modal — every+ provider whose `category` matches an entry here is+ hidden from the modal AND its category header is+ stripped. Use to disable an entire credential category+ (e.g. 'android' hides the Android relay panel + the+ Android category header). Mirrors disabled_groups+ semantically — the same conceptual entity (android+ feature surface) but the credential catalogue uses its+ own category taxonomy independent of node groups."""+ defaults = {+ "show_all": True,+ "enabled_nodes": [],+ "disabled_groups": [],+ "disabled_nodes": [],+ "disabled_credential_categories": [],+ }+if not self._config_path.exists():- return {"show_all": True, "enabled_nodes": []}+ return defaultstry:with self._config_path.open("r", encoding="utf-8") as f:raw = json.load(f)except Exception as e:logger.warning("Failed to parse node_allowlist.json, falling back to show_all: %s", e)- return {"show_all": True, "enabled_nodes": []}-- enabled_nodes = raw.get("enabled_nodes", [])- if not isinstance(enabled_nodes, list):- logger.warning("node_allowlist.json 'enabled_nodes' is not a list, falling back to show_all")- return {"show_all": True, "enabled_nodes": []}-- enabled_nodes = [n for n in enabled_nodes if isinstance(n, str)]-- if len(enabled_nodes) == 0:- return {"show_all": True, "enabled_nodes": []}-- return {"show_all": False, "enabled_nodes": enabled_nodes}+ return defaults++ def _str_list(key: str) -> List[str]:+ value = raw.get(key, [])+ if not isinstance(value, list):+ logger.warning(+ "node_allowlist.json '%s' is not a list, treating as empty",+ key,+ )+ return []+ return [n for n in value if isinstance(n, str)]++ enabled_nodes = _str_list("enabled_nodes")+ disabled_groups = _str_list("disabled_groups")+ disabled_nodes = _str_list("disabled_nodes")+ disabled_credential_categories = _str_list("disabled_credential_categories")++ show_all = len(enabled_nodes) == 0++ return {+ "show_all": show_all,+ "enabled_nodes": enabled_nodes,+ "disabled_groups": disabled_groups,+ "disabled_nodes": disabled_nodes,+ "disabled_credential_categories": disabled_credential_categories,+ }_instance: NodeAllowlistService | None = None