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:
javis-bot
2026-11-13 09:56:17 +09:00
parent d4bd4acfe9
commit 3ef4281180
23 changed files with 717 additions and 39 deletions

View File

@@ -17,7 +17,7 @@ from ..system_prompt import (
reply_language_directive,
tool_honesty_reminder,
)
from ..tools.registry import run_tool_with_retries, generate_tools_description, generate_tools_json_schema, BUILTIN_TOOLS
from ..tools.registry import run_tool_with_retries, generate_tools_description, generate_tools_json_schema, BUILTIN_TOOLS, enabled_builtin_tools
from ..tools.builtin.stop import STOP_SIGNAL
from ..debug import debug_log
from ..llm import chat_with_messages, extract_text_from_response, ToolsNotSupportedError
@@ -1051,18 +1051,10 @@ def _recent_messages(cfg, dialogue_memory) -> list:
return dialogue_memory.get_recent_messages()
# 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 _offered_builtins(cfg, chat_available: bool) -> dict:
"""The built-in tools this turn can offer: chatChannels only with a chat backend
(chat_channels.spec.md), the screen-share tools only in screen-share mode."""
stream = getattr(cfg, "stream_browser", True)
return {k: v for k, v in BUILTIN_TOOLS.items()
if (k != "chatChannels" or chat_available) and (stream or k not in _SCREEN_SHARE_TOOLS)}
"""The built-in tools this turn can offer: the enabled ones (``enabled_builtin_tools``), and
chatChannels only with a chat backend (chat_channels.spec.md)."""
return {k: v for k, v in enabled_builtin_tools(cfg).items() if k != "chatChannels" or chat_available}
def _route_tools(cfg, redacted: str, builtin_tools: dict, mcp_tools: dict, recent_messages: list):