Skip to content

Self-improving AI Employees for everyone

feat(shell): route shell node through nushell + tools/registry fixes

trohitg16602b0075b5
diff --git a/server/config/model_registry.json b/server/config/model_registry.json
index 9772d524..b7a2289f 100644
--- a/server/config/model_registry.json
+++ b/server/config/model_registry.json
@@ -1,8 +1,106 @@
{
- "_generated": "2026-04-30T05:49:05.631262+00:00",
+ "_generated": "2026-05-01T06:06:55.585247+00:00",
"_source": "openrouter",
- "_model_count": 368,
+ "_model_count": 371,
"models": {
+ "xai/grok-4.3": {
+ "id": "x-ai/grok-4.3",
+ "name": "xAI: Grok 4.3",
+ "provider": "xai",
+ "local_id": "grok-4.3",
+ "context_length": 1000000,
+ "max_output_tokens": 0,
+ "input_price_per_mtok": 1.25,
+ "output_price_per_mtok": 2.5,
+ "supports_thinking": false,
+ "thinking_type": "none",
+ "temperature_range": [
+ 0.0,
+ 2.0
+ ],
+ "is_reasoning_model": false,
+ "supported_parameters": [
+ "frequency_penalty",
+ "include_reasoning",
+ "logprobs",
+ "max_tokens",
+ "presence_penalty",
+ "reasoning",
+ "response_format",
+ "seed",
+ "stop",
+ "structured_outputs",
+ "temperature",
+ "tool_choice",
+ "tools",
+ "top_logprobs",
+ "top_p"
+ ]
+ },
+ "ibm-granite/granite-4.1-8b": {
+ "id": "ibm-granite/granite-4.1-8b",
+ "name": "IBM: Granite 4.1 8B",
+ "provider": "ibm-granite",
+ "local_id": "granite-4.1-8b",
+ "context_length": 131072,
+ "max_output_tokens": 131072,
+ "input_price_per_mtok": 0.05,
+ "output_price_per_mtok": 0.1,
+ "supports_thinking": false,
+ "thinking_type": "none",
+ "temperature_range": [
+ 0.0,
+ 2.0
+ ],
+ "is_reasoning_model": false,
+ "supported_parameters": [
+ "frequency_penalty",
+ "max_tokens",
+ "presence_penalty",
+ "repetition_penalty",
+ "response_format",
+ "seed",
+ "stop",
+ "structured_outputs",
+ "temperature",
+ "tool_choice",
+ "tools",
+ "top_k",
+ "top_p"
+ ]
+ },
+ "openrouter/owl-alpha": {
+ "id": "openrouter/owl-alpha",
+ "name": "Owl Alpha",
+ "provider": "openrouter",
+ "local_id": "owl-alpha",
+ "context_length": 1048756,
+ "max_output_tokens": 262144,
+ "input_price_per_mtok": 0.0,
+ "output_price_per_mtok": 0.0,
+ "supports_thinking": false,
+ "thinking_type": "none",
+ "temperature_range": [
+ 0.0,
+ 2.0
+ ],
+ "is_reasoning_model": false,
+ "supported_parameters": [
+ "frequency_penalty",
+ "logit_bias",
+ "max_tokens",
+ "presence_penalty",
+ "repetition_penalty",
+ "response_format",
+ "seed",
+ "stop",
+ "structured_outputs",
+ "temperature",
+ "tools",
+ "top_k",
+ "top_p"
+ ]
+ },
"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free": {
"id": "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free",
"name": "NVIDIA: Nemotron 3 Nano Omni (free)",
@@ -173,10 +271,10 @@
"name": "MoonshotAI Kimi Latest",
"provider": "~moonshotai",
"local_id": "kimi-latest",
- "context_length": 262144,
- "max_output_tokens": 16384,
- "input_price_per_mtok": 0.75,
- "output_price_per_mtok": 3.5,
+ "context_length": 262142,
+ "max_output_tokens": 262142,
+ "input_price_per_mtok": 0.74,
+ "output_price_per_mtok": 3.49,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -858,10 +956,10 @@
"name": "MoonshotAI: Kimi K2.6",
"provider": "moonshotai",
"local_id": "kimi-k2.6",
- "context_length": 262144,
- "max_output_tokens": 16384,
- "input_price_per_mtok": 0.75,
- "output_price_per_mtok": 3.5,
+ "context_length": 262142,
+ "max_output_tokens": 262142,
+ "input_price_per_mtok": 0.74,
+ "output_price_per_mtok": 3.49,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -1251,8 +1349,8 @@
"local_id": "grok-4.20",
"context_length": 2000000,
"max_output_tokens": 0,
- "input_price_per_mtok": 2.0,
- "output_price_per_mtok": 6.0,
+ "input_price_per_mtok": 1.25,
+ "output_price_per_mtok": 2.5,
"supports_thinking": false,
"thinking_type": "none",
"temperature_range": [
@@ -2496,7 +2594,7 @@
"local_id": "qwen3-coder-next",
"context_length": 262144,
"max_output_tokens": 262144,
- "input_price_per_mtok": 0.14,
+ "input_price_per_mtok": 0.12,
"output_price_per_mtok": 0.8,
"supports_thinking": false,
"thinking_type": "none",
@@ -5965,9 +6063,9 @@
"provider": "openai",
"local_id": "gpt-oss-120b",
"context_length": 131072,
- "max_output_tokens": 131072,
+ "max_output_tokens": 0,
"input_price_per_mtok": 0.039,
- "output_price_per_mtok": 0.19,
+ "output_price_per_mtok": 0.18,
"supports_thinking": true,
"thinking_type": "effort",
"temperature_range": [
@@ -6049,7 +6147,6 @@
"min_p",
"presence_penalty",
"reasoning",
- "reasoning_effort",
"repetition_penalty",
"response_format",
"seed",
@@ -8608,7 +8705,7 @@
"name": "Google: Gemini 2.0 Flash",
"provider": "gemini",
"local_id": "gemini-2.0-flash-001",
- "context_length": 1048576,
+ "context_length": 1000000,
"max_output_tokens": 8192,
"input_price_per_mtok": 0.1,
"output_price_per_mtok": 0.4,
diff --git a/server/nodes/filesystem/_backend.py b/server/nodes/filesystem/_backend.py
index 79e540fb..e8c0dcdb 100644
--- a/server/nodes/filesystem/_backend.py
+++ b/server/nodes/filesystem/_backend.py
@@ -4,14 +4,24 @@ All four filesystem plugins (file_read / file_modify / shell /
fs_search) open a :class:`deepagents.backends.LocalShellBackend`
rooted at the per-workflow workspace. This helper centralises that
setup so each plugin file stays small.
+
+Shell execution is dispatched through Nushell when available so the
+agent sees identical command semantics on Windows, macOS, and Linux
+(no cmd.exe vs sh divergence). Falls back to the upstream
+``LocalShellBackend`` (which uses ``shell=True``) when ``nu`` isn't
+installed.
"""
from __future__ import annotations
import os
+import shutil
+import subprocess
from pathlib import PureWindowsPath
from typing import Any, Dict, Optional
+from deepagents.backends import LocalShellBackend
+from deepagents.backends.protocol import ExecuteResponse
from deepagents.backends.utils import validate_path
@@ -42,11 +52,117 @@ def normalize_virtual_path(path: str) -> str:
return validate_path(rel)
+def _find_nu() -> Optional[str]:
+ """Resolve the nushell binary via the parent process's PATH.
+
+ Cached on the module so we only pay the lookup cost once. Returns
+ ``None`` if nu isn't installed; callers should fall back to the
+ upstream shell.
+
+ Resolution uses the live host PATH (not the sandbox's stripped
+ ``self._env``) deliberately: nu must be reachable from somewhere,
+ and pinning to an absolute path means the eventual subprocess can
+ still launch even when env={} is passed for sandboxing.
+ """
+ if not hasattr(_find_nu, "_cached"):
+ _find_nu._cached = shutil.which("nu")
+ return _find_nu._cached
+
+
+class NushellBackend(LocalShellBackend):
+ """LocalShellBackend that routes ``execute()`` through Nushell.
+
+ Why nu: cross-platform command parity. cmd.exe (Windows) and POSIX
+ sh have wildly different builtin sets, quoting rules, and pipeline
+ semantics, which forces LLM agents to special-case the host OS.
+ Nushell parses the command itself with identical grammar on every
+ platform, and many common file ops (``ls``, ``cp``, ``mv``,
+ ``mkdir``, ``rm``, ``open``) are nu builtins, so they don't depend
+ on external binaries being on PATH.
+
+ Falls back to the parent's ``execute()`` when nu isn't installed.
+ """
+
+ def execute(self, command, *, timeout=None) -> ExecuteResponse: # type: ignore[override]
+ nu = _find_nu()
+ if nu is None:
+ return super().execute(command, timeout=timeout)
+
+ if not command or not isinstance(command, str):
+ return ExecuteResponse(
+ output="Error: Command must be a non-empty string.",
+ exit_code=1,
+ truncated=False,
+ )
+
+ effective_timeout = timeout if timeout is not None else self._default_timeout
+ if effective_timeout <= 0:
+ msg = f"timeout must be positive, got {effective_timeout}"
+ raise ValueError(msg)
+
+ # Flags per nushell/src/command.rs (long forms):
+ # -n / --no-config-file Skip user/global config (deterministic).
+ # --no-std-lib Don't load the std library (faster, fewer
+ # surprises in a one-shot invocation).
+ # --no-history Don't read or write shell history.
+ # -c / --commands Run the next argument as a single command.
+ argv = [nu, "-n", "--no-history", "--no-std-lib", "-c", command]
+
+ try:
+ result = subprocess.run(
+ argv,
+ check=False,
+ shell=False, # nu parses argv[-1] itself; no host shell needed.
+ capture_output=True,
+ text=True,
+ timeout=effective_timeout,
+ env=self._env,
+ cwd=str(self.cwd),
+ )
+
+ # Same output-shaping convention as upstream LocalShellBackend.
+ output_parts = []
+ if result.stdout:
+ output_parts.append(result.stdout)
+ if result.stderr:
+ stderr_lines = result.stderr.strip().split("\n")
+ output_parts.extend(f"[stderr] {line}" for line in stderr_lines)
+ output = "\n".join(output_parts) if output_parts else "<no output>"
+
+ truncated = False
+ if len(output) > self._max_output_bytes:
+ output = output[: self._max_output_bytes]
+ output += f"\n\n... Output truncated at {self._max_output_bytes} bytes."
+ truncated = True
+
+ if result.returncode != 0:
+ output = f"{output.rstrip()}\n\nExit code: {result.returncode}"
+
+ return ExecuteResponse(
+ output=output,
+ exit_code=result.returncode,
+ truncated=truncated,
+ )
+
+ except subprocess.TimeoutExpired:
+ if timeout is not None:
+ msg = f"Error: Command timed out after {effective_timeout} seconds (custom timeout). The command may be stuck or require more time."
+ else:
+ msg = f"Error: Command timed out after {effective_timeout} seconds. For long-running commands, re-run using the timeout parameter."
+ return ExecuteResponse(output=msg, exit_code=124, truncated=False)
+ except Exception as e: # noqa: BLE001
+ return ExecuteResponse(
+ output=f"Error executing command via nu ({type(e).__name__}): {e}",
+ exit_code=1,
+ truncated=False,
+ )
+
+
def get_backend(
parameters: Dict[str, Any],
context: Optional[Dict[str, Any]] = None,
):
- """Return a LocalShellBackend rooted at the per-workflow workspace.
+ """Return a sandboxed shell backend rooted at the per-workflow workspace.
Resolution order: explicit ``working_directory`` param >
``context.workspace_dir`` > ``Settings().workspace_base_resolved/default``.
@@ -55,7 +171,6 @@ def get_backend(
"""
from core.config import Settings
from core.logging import get_logger
- from deepagents.backends import LocalShellBackend
param_dir = parameters.get("working_directory")
ctx_dir = context.get("workspace_dir") if context else None
@@ -66,4 +181,4 @@ def get_backend(
)
os.makedirs(root, exist_ok=True)
get_logger(__name__).info("[Filesystem] root=%s", root)
- return LocalShellBackend(root_dir=root, virtual_mode=True)
+ return NushellBackend(root_dir=root, virtual_mode=True)
diff --git a/server/services/handlers/tools.py b/server/services/handlers/tools.py
index 1cbeb3fd..f63322d8 100644
--- a/server/services/handlers/tools.py
+++ b/server/services/handlers/tools.py
@@ -13,7 +13,7 @@ import hashlib
from typing import Dict, Any, Optional, List, Tuple, TYPE_CHECKING
from core.logging import get_logger
-from constants import ANDROID_SERVICE_NODE_TYPES
+from constants import AI_AGENT_TYPES, ANDROID_SERVICE_NODE_TYPES
if TYPE_CHECKING:
pass
@@ -84,9 +84,20 @@ async def execute_tool(tool_name: str, tool_args: Dict[str, Any],
# plugin is the single source of truth for both workflow-node
# execution and AI-tool invocation. Legacy branches below only
# fire for node types not yet migrated to the plugin pattern.
+ #
+ # Exception: AI agent types must fall through to the delegation
+ # branch below. ``execute_as_tool`` runs the plugin synchronously
+ # without resolving the child's api_key from the credentials DB,
+ # whereas ``_execute_delegated_agent`` injects credentials, applies
+ # duplicate-call de-dupe, and spawns the child as a fire-and-forget
+ # background task — the contract callers (and the agent system
+ # prompt) expect for delegation tools.
# ----------------------------------------------------------------
from services.node_registry import get_node_class
- plugin_cls = get_node_class(node_type)
+ plugin_cls = (
+ None if node_type in AI_AGENT_TYPES
+ else get_node_class(node_type)
+ )
if plugin_cls is not None:
from services.plugin import NodeContext
instance = plugin_cls()