Skip to content

Commit e642f77

Browse files
authored
memory2 StreamModules, cleanup (#1682)
1 parent eb04e60 commit e642f77

83 files changed

Lines changed: 1580 additions & 523 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

data/.lfs/go2_bigoffice.db.tar.gz

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:2d48cb0b8250bb2878d1008093d45ea377406de00ad42f0f96d7b382e1a9617b
3-
size 191193336
2+
oid sha256:142f7a7d64d3b77c97acd0d15d53e9ea28c4f558776a6bb3919a4da32c2f4d37
3+
size 192241937

dimos/agents/agent_test_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def __init__(self, **kwargs: Any) -> None:
4848
@rpc
4949
def start(self) -> None:
5050
super().start()
51-
self._disposables.add(Disposable(self.agent.subscribe(self._on_agent_message)))
52-
self._disposables.add(Disposable(self.agent_idle.subscribe(self._on_agent_idle)))
51+
self.register_disposable(Disposable(self.agent.subscribe(self._on_agent_message)))
52+
self.register_disposable(Disposable(self.agent_idle.subscribe(self._on_agent_idle)))
5353
# Signal that subscription is ready
5454
self._subscription_ready.set()
5555

dimos/agents/mcp/mcp_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def start(self) -> None:
169169
def _on_human_input(string: str) -> None:
170170
self._message_queue.put(HumanMessage(content=string))
171171

172-
self._disposables.add(Disposable(self.human_input.subscribe(_on_human_input)))
172+
self.register_disposable(Disposable(self.human_input.subscribe(_on_human_input)))
173173

174174
@rpc
175175
def on_system_modules(self, _modules: list[RPCClient]) -> None:

dimos/agents/skills/demo_robot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DemoRobot(Module):
2525

2626
def start(self) -> None:
2727
super().start()
28-
self._disposables.add(interval(1.0).subscribe(lambda _: self._publish_gps_location()))
28+
self.register_disposable(interval(1.0).subscribe(lambda _: self._publish_gps_location()))
2929

3030
def stop(self) -> None:
3131
super().stop()

dimos/agents/skills/google_maps_skill_container.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import json
1616
from typing import Any
1717

18+
from reactivex.disposable import Disposable
19+
1820
from dimos.agents.annotation import skill
1921
from dimos.core.core import rpc
2022
from dimos.core.module import Module
@@ -49,7 +51,7 @@ def __init__(self, **kwargs: Any) -> None:
4951
@rpc
5052
def start(self) -> None:
5153
super().start()
52-
self._disposables.add(self.gps_location.subscribe(self._on_gps_location)) # type: ignore[arg-type]
54+
self.register_disposable(Disposable(self.gps_location.subscribe(self._on_gps_location)))
5355

5456
@rpc
5557
def stop(self) -> None:

dimos/agents/skills/gps_nav_skill.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
import json
1616

17+
from reactivex.disposable import Disposable
18+
1719
from dimos.agents.annotation import skill
1820
from dimos.core.core import rpc
1921
from dimos.core.module import Module
@@ -38,7 +40,7 @@ class GpsNavSkillContainer(Module):
3840
@rpc
3941
def start(self) -> None:
4042
super().start()
41-
self._disposables.add(self.gps_location.subscribe(self._on_gps_location)) # type: ignore[arg-type]
43+
self.register_disposable(Disposable(self.gps_location.subscribe(self._on_gps_location)))
4244

4345
@rpc
4446
def stop(self) -> None:

dimos/agents/skills/navigation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def __init__(self, **kwargs: Any) -> None:
6262
@rpc
6363
def start(self) -> None:
6464
super().start()
65-
self._disposables.add(Disposable(self.color_image.subscribe(self._on_color_image)))
66-
self._disposables.add(Disposable(self.odom.subscribe(self._on_odom)))
65+
self.register_disposable(Disposable(self.color_image.subscribe(self._on_color_image)))
66+
self.register_disposable(Disposable(self.odom.subscribe(self._on_odom)))
6767
self._skill_started = True
6868

6969
@rpc

dimos/agents/skills/osm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# limitations under the License.
1414

1515

16+
from reactivex.disposable import Disposable
17+
1618
from dimos.agents.annotation import skill
1719
from dimos.core.module import Module
1820
from dimos.core.stream import In
@@ -39,7 +41,7 @@ def __init__(self) -> None:
3941
def start(self) -> None:
4042
super().start()
4143
if hasattr(self.gps_location, "subscribe"):
42-
self._disposables.add(self.gps_location.subscribe(self._on_gps_location)) # type: ignore[arg-type]
44+
self.register_disposable(Disposable(self.gps_location.subscribe(self._on_gps_location)))
4345
else:
4446
logger.warning(
4547
"OsmSkill: gps_location stream does not support direct subscribe (RemoteIn)"

dimos/agents/skills/person_follow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ def __init__(self, **kwargs: Any) -> None:
9494
@rpc
9595
def start(self) -> None:
9696
super().start()
97-
self._disposables.add(Disposable(self.color_image.subscribe(self._on_color_image)))
97+
self.register_disposable(Disposable(self.color_image.subscribe(self._on_color_image)))
9898
if self.config.use_3d_navigation:
99-
self._disposables.add(Disposable(self.global_map.subscribe(self._on_pointcloud)))
99+
self.register_disposable(Disposable(self.global_map.subscribe(self._on_pointcloud)))
100100

101101
@rpc
102102
def stop(self) -> None:

dimos/agents/vlm_agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from langchain.chat_models import init_chat_model
1818
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
19+
from reactivex.disposable import Disposable
1920

2021
from dimos.agents.system_prompt import SYSTEM_PROMPT
2122
from dimos.core.core import rpc
@@ -60,8 +61,8 @@ def __init__(self, **kwargs: Any) -> None:
6061
@rpc
6162
def start(self) -> None:
6263
super().start()
63-
self._disposables.add(self.color_image.subscribe(self._on_image)) # type: ignore[arg-type]
64-
self._disposables.add(self.query_stream.subscribe(self._on_query)) # type: ignore[arg-type]
64+
self.register_disposable(Disposable(self.color_image.subscribe(self._on_image)))
65+
self.register_disposable(Disposable(self.query_stream.subscribe(self._on_query)))
6566

6667
@rpc
6768
def stop(self) -> None:

0 commit comments

Comments
 (0)