feat(app): features screen with tool switches and MCP servers; v2 drops host file and screen tools
- Settings `features` (weather, webSearch, meals) and `mcpServers` (name, command, args, env names, enabled), edited on the new 기능 screen. The tools of a feature that is off go into the brain's `disabled_tools`; only enabled MCP servers go into its `mcps`. - MCP environment values (API keys) live only in the encrypted secrets (`mcp:<server>:<NAME>`), shown as stored or not, masked in logs, removed with their server, and reach the worker only in `JARVIS_MCP_ENV`, which the brain takes out of its environment before giving each server its own. - `enabled_builtin_tools(cfg)` is the one list the router, toolSearchTool and the executor use, so a turned-off tool is neither offered nor run, also when the model names it. - The v2 brain never offers v1's `localFiles` (home folder read/write/delete) and `screenshot`: anyone in the voice or chat channels could ask for them. Screen viewing comes in M7. - The brain connects MCP servers on its own thread and logs each outcome without debug logging. - Stored secrets are masked in the log hub as soon as the data folder is found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,23 @@ BUILTIN_TOOLS = {
|
||||
"chatChannels": ChatChannelsTool(),
|
||||
}
|
||||
|
||||
# The on-screen browser tools work only in screen-share mode (cfg.stream_browser); without it they
|
||||
# only refuse, and offered anyway the router picked them for unrelated asks (field run 2026-11-12,
|
||||
# v2: "피곤하다" routed to browseAndPlay).
|
||||
_SCREEN_SHARE_TOOLS = ("controlBrowser", "browseAndPlay", "setBroadcast")
|
||||
|
||||
|
||||
def enabled_builtin_tools(cfg) -> Dict[str, Any]:
|
||||
"""The built-in tools this configuration allows: none in ``cfg.disabled_tools``, and the
|
||||
screen-share tools only in screen-share mode. The router, toolSearchTool and the executor all
|
||||
use this, so a turned-off tool is neither offered nor run."""
|
||||
disabled = getattr(cfg, "disabled_tools", ())
|
||||
disabled = set(disabled) if isinstance(disabled, (list, tuple, set, frozenset)) else set()
|
||||
stream = getattr(cfg, "stream_browser", True)
|
||||
return {k: v for k, v in BUILTIN_TOOLS.items()
|
||||
if k not in disabled and (stream or k not in _SCREEN_SHARE_TOOLS)}
|
||||
|
||||
|
||||
# Global MCP tools cache
|
||||
_mcp_tools_cache: Dict[str, "ToolSpec"] = {}
|
||||
_mcp_tools_cache_lock = threading.Lock()
|
||||
@@ -356,6 +373,10 @@ def run_tool_with_retries(
|
||||
pass
|
||||
|
||||
# Check builtin tools first
|
||||
if name in BUILTIN_TOOLS and name not in enabled_builtin_tools(cfg):
|
||||
debug_log(f"turned-off tool requested: {name}", "tools")
|
||||
return ToolExecutionResult(success=False, reply_text=None,
|
||||
error_message=f"The {name} tool is turned off.")
|
||||
if name in BUILTIN_TOOLS:
|
||||
tool = BUILTIN_TOOLS[name]
|
||||
return tool.execute(
|
||||
|
||||
Reference in New Issue
Block a user