Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions dimos/agents/mcp/mcp_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ def __init__(self, url: str | None = None, timeout: int = DEFAULT_TIMEOUT) -> No
self.url = url
self.timeout = timeout

# ------------------------------------------------------------------
# Low-level JSON-RPC
# ------------------------------------------------------------------

def call(self, method: str, params: dict[str, Any] | None = None) -> dict[str, Any]:
"""Send a JSON-RPC request and return the parsed response.
Expand All @@ -87,10 +83,6 @@ def call(self, method: str, params: dict[str, Any] | None = None) -> dict[str, A
raise McpError(f"HTTP {resp.status_code}: {e}") from e
return resp.json() # type: ignore[no-any-return]

# ------------------------------------------------------------------
# MCP standard methods
# ------------------------------------------------------------------

def initialize(self) -> dict[str, Any]:
"""Send ``initialize`` and return server info."""
return self.call("initialize")
Expand All @@ -112,10 +104,6 @@ def call_tool_text(self, name: str, arguments: dict[str, Any] | None = None) ->
return ""
return content[0].get("text", str(content[0])) # type: ignore[no-any-return]

# ------------------------------------------------------------------
# Readiness probes
# ------------------------------------------------------------------

def wait_for_ready(self, timeout: float = 10.0, interval: float = 0.5) -> bool:
"""Poll until the MCP server responds, or return False on timeout."""
deadline = time.monotonic() + timeout
Expand Down Expand Up @@ -148,10 +136,6 @@ def wait_for_down(self, timeout: float = 10.0, interval: float = 0.5) -> bool:
time.sleep(interval)
return False

# ------------------------------------------------------------------
# Class methods for discovery
# ------------------------------------------------------------------

@classmethod
def from_run_entry(cls, entry: Any | None = None, timeout: int = DEFAULT_TIMEOUT) -> McpAdapter:
"""Create an adapter from a RunEntry, or discover the latest one.
Expand All @@ -173,10 +157,6 @@ def from_run_entry(cls, entry: Any | None = None, timeout: int = DEFAULT_TIMEOUT
url = f"http://localhost:{global_config.mcp_port}/mcp"
return cls(url=url, timeout=timeout)

# ------------------------------------------------------------------
# Internals
# ------------------------------------------------------------------

@staticmethod
def _unwrap(response: dict[str, Any]) -> dict[str, Any]:
"""Extract the ``result`` from a JSON-RPC response, raising on error."""
Expand Down
19 changes: 0 additions & 19 deletions dimos/agents/mcp/mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
app.state.rpc_calls = {}


# ---------------------------------------------------------------------------
# JSON-RPC helpers
# ---------------------------------------------------------------------------


def _jsonrpc_result(req_id: Any, result: Any) -> dict[str, Any]:
return {"jsonrpc": "2.0", "id": req_id, "result": result}

Expand All @@ -67,11 +62,6 @@ def _jsonrpc_error(req_id: Any, code: int, message: str) -> dict[str, Any]:
return {"jsonrpc": "2.0", "id": req_id, "error": {"code": code, "message": message}}


# ---------------------------------------------------------------------------
# JSON-RPC handlers (standard MCP protocol only)
# ---------------------------------------------------------------------------


def _handle_initialize(req_id: Any) -> dict[str, Any]:
return _jsonrpc_result(
req_id,
Expand Down Expand Up @@ -177,11 +167,6 @@ async def mcp_endpoint(request: Request) -> Response:
return JSONResponse(result)


# ---------------------------------------------------------------------------
# McpServer Module
# ---------------------------------------------------------------------------


class McpServer(Module):
_uvicorn_server: uvicorn.Server | None = None
_serve_future: concurrent.futures.Future[None] | None = None
Expand Down Expand Up @@ -215,10 +200,6 @@ def on_system_modules(self, modules: list[RPCClient]) -> None:
for skill_info in app.state.skills
}

# ------------------------------------------------------------------
# Introspection skills (exposed as MCP tools via tools/list)
# ------------------------------------------------------------------

@skill
def server_status(self) -> str:
"""Get MCP server status: main process PID, deployed modules, and skill count."""
Expand Down
16 changes: 0 additions & 16 deletions dimos/agents_deprecated/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@
_MAX_SAVED_FRAMES = 100 # Maximum number of frames to save


# -----------------------------------------------------------------------------
# region Agent Base Class
# -----------------------------------------------------------------------------
class Agent:
"""Base agent that manages memory and subscriptions."""

Expand Down Expand Up @@ -105,12 +102,6 @@ def dispose_all(self) -> None:
logger.info("No disposables to dispose.")


# endregion Agent Base Class


# -----------------------------------------------------------------------------
# region LLMAgent Base Class (Generic LLM Agent)
# -----------------------------------------------------------------------------
class LLMAgent(Agent):
"""Generic LLM agent containing common logic for LLM-based agents.

Expand Down Expand Up @@ -689,12 +680,6 @@ def dispose_all(self) -> None:
self.response_subject.on_completed()


# endregion LLMAgent Base Class (Generic LLM Agent)


# -----------------------------------------------------------------------------
# region OpenAIAgent Subclass (OpenAI-Specific Implementation)
# -----------------------------------------------------------------------------
class OpenAIAgent(LLMAgent):
"""OpenAI agent implementation that uses OpenAI's API for processing.

Expand Down Expand Up @@ -914,4 +899,3 @@ def stream_query(self, query_text: str) -> Observable: # type: ignore[type-arg]
)


# endregion OpenAIAgent Subclass (OpenAI-Specific Implementation)
2 changes: 0 additions & 2 deletions dimos/agents_deprecated/prompt_builder/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def build( # type: ignore[no-untyped-def]
# print("system_prompt: ", system_prompt)
# print("rag_context: ", rag_context)

# region Token Counts
if not override_token_limit:
rag_token_cnt = self.tokenizer.token_count(rag_context)
system_prompt_token_cnt = self.tokenizer.token_count(system_prompt)
Expand All @@ -163,7 +162,6 @@ def build( # type: ignore[no-untyped-def]
system_prompt_token_cnt = 0
user_query_token_cnt = 0
image_token_cnt = 0
# endregion Token Counts

# Create a component dictionary for dynamic allocation
components = {
Expand Down
37 changes: 0 additions & 37 deletions dimos/control/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@
_XARM7_MODEL_PATH = LfsPath("xarm_description/urdf/xarm7/xarm7.urdf")


# =============================================================================
# Single Arm Blueprints
# =============================================================================

# Mock 7-DOF arm (for testing)
coordinator_mock = control_coordinator(
tick_rate=100.0,
Expand Down Expand Up @@ -168,10 +164,6 @@
)


# =============================================================================
# Dual Arm Blueprints
# =============================================================================

# Dual mock arms (7-DOF left, 6-DOF right)
coordinator_dual_mock = control_coordinator(
tick_rate=100.0,
Expand Down Expand Up @@ -298,10 +290,6 @@
)


# =============================================================================
# Streaming Control Blueprints
# =============================================================================

# XArm6 teleop - streaming position control
coordinator_teleop_xarm6 = control_coordinator(
tick_rate=100.0,
Expand Down Expand Up @@ -399,11 +387,6 @@
)


# =============================================================================
# Cartesian IK Blueprints (internal Pinocchio IK solver)
# =============================================================================


# Mock 6-DOF arm with CartesianIK
coordinator_cartesian_ik_mock = control_coordinator(
tick_rate=100.0,
Expand Down Expand Up @@ -471,10 +454,6 @@
)


# =============================================================================
# Teleop IK Blueprints (VR teleoperation with internal Pinocchio IK)
# =============================================================================

# Single XArm7 with TeleopIK
coordinator_teleop_xarm7 = control_coordinator(
tick_rate=100.0,
Expand Down Expand Up @@ -605,10 +584,6 @@
)


# =============================================================================
# Twist Base Blueprints (velocity-commanded platforms)
# =============================================================================

# Mock holonomic twist base (3-DOF: vx, vy, wz)
_base_joints = make_twist_base_joints("base")
coordinator_mock_twist_base = control_coordinator(
Expand Down Expand Up @@ -636,10 +611,6 @@
)


# =============================================================================
# Mobile Manipulation Blueprints (arm + twist base)
# =============================================================================

# Mock arm (7-DOF) + mock holonomic base (3-DOF)
_mm_base_joints = make_twist_base_joints("base")
coordinator_mobile_manip_mock = control_coordinator(
Expand Down Expand Up @@ -679,10 +650,6 @@
)


# =============================================================================
# Raw Blueprints (for programmatic setup)
# =============================================================================

coordinator_basic = control_coordinator(
tick_rate=100.0,
publish_joint_state=True,
Expand All @@ -694,10 +661,6 @@
)


# =============================================================================
# Exports
# =============================================================================

__all__ = [
# Raw
"coordinator_basic",
Expand Down
34 changes: 0 additions & 34 deletions dimos/control/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@
logger = setup_logger()


# =============================================================================
# Configuration
# =============================================================================


@dataclass
class TaskConfig:
"""Configuration for a control task.
Expand Down Expand Up @@ -124,11 +119,6 @@ class ControlCoordinatorConfig(ModuleConfig):
tasks: list[TaskConfig] = field(default_factory=lambda: [])


# =============================================================================
# ControlCoordinator Module
# =============================================================================


class ControlCoordinator(Module[ControlCoordinatorConfig]):
"""Centralized control coordinator with per-joint arbitration.
Expand Down Expand Up @@ -201,10 +191,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:

logger.info(f"ControlCoordinator initialized at {self.config.tick_rate}Hz")

# =========================================================================
# Config-based Setup
# =========================================================================

def _setup_from_config(self) -> None:
"""Create hardware and tasks from config (called on start)."""
hardware_added: list[str] = []
Expand Down Expand Up @@ -343,10 +329,6 @@ def _create_task_from_config(self, cfg: TaskConfig) -> ControlTask:
else:
raise ValueError(f"Unknown task type: {task_type}")

# =========================================================================
# Hardware Management (RPC)
# =========================================================================

@rpc
def add_hardware(
self,
Expand Down Expand Up @@ -446,10 +428,6 @@ def get_joint_positions(self) -> dict[str, float]:
positions[joint_name] = joint_state.position
return positions

# =========================================================================
# Task Management (RPC)
# =========================================================================

@rpc
def add_task(self, task: ControlTask) -> bool:
"""Register a task with the coordinator."""
Expand Down Expand Up @@ -492,10 +470,6 @@ def get_active_tasks(self) -> list[str]:
with self._task_lock:
return [name for name, task in self._tasks.items() if task.is_active()]

# =========================================================================
# Streaming Control
# =========================================================================

def _on_joint_command(self, msg: JointState) -> None:
"""Route incoming JointState to streaming tasks by joint name.
Expand Down Expand Up @@ -603,10 +577,6 @@ def task_invoke(

return getattr(task, method)(**kwargs)

# =========================================================================
# Gripper
# =========================================================================

@rpc
def set_gripper_position(self, hardware_id: str, position: float) -> bool:
"""Set gripper position on a specific hardware device.
Expand Down Expand Up @@ -640,10 +610,6 @@ def get_gripper_position(self, hardware_id: str) -> float | None:
return None
return hw.adapter.read_gripper_position()

# =========================================================================
# Lifecycle
# =========================================================================

@rpc
def start(self) -> None:
"""Start the coordinator control loop."""
Expand Down
9 changes: 0 additions & 9 deletions dimos/control/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
from dimos.msgs.geometry_msgs import Pose, PoseStamped
from dimos.teleop.quest.quest_types import Buttons

# =============================================================================
# Data Types
# =============================================================================


@dataclass(frozen=True)
class ResourceClaim:
Expand Down Expand Up @@ -168,11 +164,6 @@ def get_values(self) -> list[float] | None:
return None


# =============================================================================
# ControlTask Protocol
# =============================================================================


@runtime_checkable
class ControlTask(Protocol):
"""Protocol for passive tasks that run within the coordinator.
Expand Down
4 changes: 0 additions & 4 deletions dimos/control/tasks/cartesian_ik_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@ def on_preempted(self, by_task: str, joints: frozenset[str]) -> None:
f"CartesianIKTask {self._name} preempted by {by_task} on joints {joints}"
)

# =========================================================================
# Task-specific methods
# =========================================================================

def on_cartesian_command(self, pose: Pose | PoseStamped, t_now: float) -> bool:
"""Handle incoming cartesian command (target EE pose).
Expand Down
4 changes: 0 additions & 4 deletions dimos/control/tasks/servo_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ def on_preempted(self, by_task: str, joints: frozenset[str]) -> None:
if joints & self._joint_names:
logger.warning(f"JointServoTask {self._name} preempted by {by_task} on joints {joints}")

# =========================================================================
# Task-specific methods
# =========================================================================

def set_target(self, positions: list[float], t_now: float) -> bool:
"""Set target joint positions.
Expand Down
Loading
Loading