From 06e8cee92fc1d36d04a704237cc9f51e12c00bb8 Mon Sep 17 00:00:00 2001 From: stash Date: Sun, 14 Jun 2026 03:53:52 -0700 Subject: [PATCH] feat(webrtc): robot_id as a per-transport label on CloudflareTransport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit robot_id rides the pickled BrokerConfig to the provider, so multiple robots under one key — even two transports in one process — stay distinct: CloudflareTransport("cmd_unreliable", TwistStamped, robot_id="go2-a"). A process/env-global id can't distinguish them, so no GlobalConfig field or env bridge; BrokerProvider reads config.robot_id only (TELEOP_ROBOT_ID dropped). --- dimos/protocol/pubsub/impl/webrtc/providers/broker.py | 8 +++++--- dimos/teleop/quest_hosted/blueprints.py | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dimos/protocol/pubsub/impl/webrtc/providers/broker.py b/dimos/protocol/pubsub/impl/webrtc/providers/broker.py index 873352f5a9..9ad609d14a 100644 --- a/dimos/protocol/pubsub/impl/webrtc/providers/broker.py +++ b/dimos/protocol/pubsub/impl/webrtc/providers/broker.py @@ -31,12 +31,14 @@ The aiortc/CF quirks this inherits (MAX_BUNDLE, the id=0 throwaway channel) are documented in ``dimos/teleop/quest_hosted/README.md``. +``robot_id`` is a per-transport label (set on ``CloudflareTransport`` / +``BrokerConfig``) distinguishing multiple robots under one key — it lives on +the transport, not the process, so two robots on one machine stay distinct. + Env vars (fallback when config fields are unset): TELEOP_BROKER_URL — default https://teleop.dimensionalos.com TELEOP_API_KEY — robot API key (dtk_live_*); the broker derives the robot identity from it - TELEOP_ROBOT_ID — optional robot identifier override (must match the - key's namespaced robot id when set) TELEOP_ROBOT_NAME — human-readable robot name """ @@ -109,7 +111,7 @@ def __init__(self, config: BrokerConfig | None = None) -> None: or os.environ.get("TELEOP_BROKER_URL", "https://teleop.dimensionalos.com") ).rstrip("/") self._api_key = config.api_key or os.environ.get("TELEOP_API_KEY", "") - self._robot_id = config.robot_id or os.environ.get("TELEOP_ROBOT_ID", "") + self._robot_id = config.robot_id or "" self._robot_name = config.robot_name or os.environ.get("TELEOP_ROBOT_NAME", "robot") if not self._api_key: raise RuntimeError( diff --git a/dimos/teleop/quest_hosted/blueprints.py b/dimos/teleop/quest_hosted/blueprints.py index 9efd7da001..1c3ce8140a 100644 --- a/dimos/teleop/quest_hosted/blueprints.py +++ b/dimos/teleop/quest_hosted/blueprints.py @@ -68,8 +68,12 @@ # CloudflareTransport("state_reliable_back", ...) the same way. # # Run: TELEOP_API_KEY=dtk_live_... dimos run teleop-hosted-go2-transport -# (robot identity is derived from the key; TELEOP_ROBOT_ID optional) # then connect from https://teleop.dimensionalos.com (keyboard view). +# +# robot_id is a per-transport kwarg (rides the pickled config to the provider), +# so running several robots off one key just means a distinct id per blueprint — +# e.g. CloudflareTransport("cmd_unreliable", TwistStamped, robot_id="go2-a"). +# Omitted here → empty; the broker still keeps sessions distinct by session id. teleop_hosted_go2_transport = unitree_go2_basic.transports( { ("cmd_vel", Twist): CloudflareTransport("cmd_unreliable", TwistStamped),