Skip to content

Commit 77ebc81

Browse files
authored
refactor(chat): move server entry helpers (#7896)
1 parent 5343587 commit 77ebc81

7 files changed

Lines changed: 18 additions & 12 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from pathlib import Path
2323
from typing import Any
2424

25-
from .chat_manager import open_manager_session
25+
from ..chat_manager import open_manager_session
2626

2727
# The executor a Goal-scoped session runs on when the caller makes no explicit
2828
# pick. The steward channel does not use this: it resolves its own default.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from collections.abc import Callable
66
from typing import Any
77

8-
from .control_plane.goals.ssh_lifecycle_transport import (
8+
from ..control_plane.goals.ssh_lifecycle_transport import (
99
apply_ssh_goal_lifecycle,
1010
)
11-
from .control_plane.status.ssh_tunnel import ensure_ssh_source
12-
from .status_server import is_loopback_host
11+
from ..control_plane.status.ssh_tunnel import ensure_ssh_source
12+
from ..status_server import is_loopback_host
1313

1414

1515
SSH_SOURCE_ENSURE_PATH = "/api/ssh-source/ensure"

‎loopx/chat_server.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
MANAGER_AGENT_GOAL_ID, MANAGER_AGENT_OBJECTIVE, is_manager_channel,
5454
manager_capabilities_projection, manager_workspace,
5555
)
56-
from .chat_session_open import open_chat_session
57-
from .chat_ssh_source_api import SshSourceRequestMixin
56+
from .chat.session_open import open_chat_session
57+
from .chat.ssh_source_api import SshSourceRequestMixin
5858
from .chat_store import ChatSessionStore, TERMINAL_TURN_STATES
5959
from .capabilities.native_chat.model_settings import normalize_agent_reasoning_effort, normalize_agent_model_id
6060
from .extensions.lark.private_conversation_api import PrivateConversationRequestMixin, PRIVATE_CONVERSATIONS_PATH
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"schema": "loopx_top_level_module_budget_v0",
33
"baseline_commit": "a4483aaece5bc74ec3f969fd067229487022401b",
4-
"max_top_level_modules": 136,
4+
"max_top_level_modules": 134,
55
"allowlist": ["__init__.py", "entrypoint.py", "cli.py"]
66
}

‎tests/test_chat_internal_module_layout.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from loopx.chat.goal_configuration_api import GoalConfigurationRequestMixin
1212
from loopx.chat.machine_configuration_api import MachineConfigurationRequestMixin
1313
from loopx.chat.monitor_actions import ChatMonitorActionMixin
14+
from loopx.chat.session_open import open_chat_session
15+
from loopx.chat.ssh_source_api import SshSourceRequestMixin
1416
from loopx.chat.todo_actions import ChatTodoActionMixin
1517
from loopx.chat.todo_detail import TodoDetailRequestMixin
1618
from loopx.chat.usage_statistics_api import UsageStatisticsRequestMixin
@@ -31,6 +33,8 @@ def test_chat_internal_helpers_load_below_the_public_chat_namespace() -> None:
3133
== "loopx.chat.machine_configuration_api"
3234
)
3335
assert ChatMonitorActionMixin.__module__ == "loopx.chat.monitor_actions"
36+
assert open_chat_session.__module__ == "loopx.chat.session_open"
37+
assert SshSourceRequestMixin.__module__ == "loopx.chat.ssh_source_api"
3438
assert ChatTodoActionMixin.__module__ == "loopx.chat.todo_actions"
3539
assert TodoDetailRequestMixin.__module__ == "loopx.chat.todo_detail"
3640
assert UsageStatisticsRequestMixin.__module__ == "loopx.chat.usage_statistics_api"
@@ -44,6 +48,8 @@ def test_chat_internal_helpers_have_no_top_level_compatibility_shims() -> None:
4448
"loopx.chat_goal_configuration_api",
4549
"loopx.chat_machine_configuration_api",
4650
"loopx.chat_monitor_actions",
51+
"loopx.chat_session_open",
52+
"loopx.chat_ssh_source_api",
4753
"loopx.chat_todo_actions",
4854
"loopx.chat_todo_detail",
4955
"loopx.chat_usage_statistics_api",

‎tests/test_native_steward_turn_host.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def managed_fixture(steward, tmp_path, monkeypatch, provider="file", *, validato
5959
def test_registered_agents_have_distinct_durable_sessions_without_adopting_legacy_history(steward, tmp_path, monkeypatch, provider):
6060
service, first, actor, _, _, capture = managed_fixture(steward, tmp_path, monkeypatch, provider)
6161
store, runtime, *_ = steward
62-
from loopx.chat_session_open import open_chat_session
62+
from loopx.chat.session_open import open_chat_session
6363
from loopx.agent_registry import load_goal_from_registry
6464
cli(runtime, "configure-goal", "--goal-id", actor["goal_id"], "--registered-agent", actor["agent_id"],
6565
"--registered-agent", "peer", "--execute")

‎tests/test_ssh_tunnel_source.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import pytest
1313

14-
from loopx.chat_ssh_source_api import SshSourceRequestMixin
14+
from loopx.chat.ssh_source_api import SshSourceRequestMixin
1515
from loopx.control_plane.goals.ssh_lifecycle_transport import (
1616
apply_ssh_goal_lifecycle,
1717
)
@@ -135,7 +135,7 @@ def test_ssh_source_request_mixin_delegates_validated_loopback_request() -> None
135135
receipt = {"ok": True, "status_url": "http://127.0.0.1:8877/status.json"}
136136

137137
with mock.patch(
138-
"loopx.chat_ssh_source_api.ensure_ssh_source", return_value=receipt
138+
"loopx.chat.ssh_source_api.ensure_ssh_source", return_value=receipt
139139
) as ensure:
140140
handler._ssh_source_ensure()
141141

@@ -149,7 +149,7 @@ def test_ssh_source_request_mixin_delegates_validated_loopback_request() -> None
149149
def test_ssh_source_request_mixin_rejects_non_loopback_server() -> None:
150150
handler = _SshSourceHandler(host="0.0.0.0")
151151

152-
with mock.patch("loopx.chat_ssh_source_api.ensure_ssh_source") as ensure:
152+
with mock.patch("loopx.chat.ssh_source_api.ensure_ssh_source") as ensure:
153153
handler._ssh_source_ensure()
154154

155155
ensure.assert_not_called()
@@ -337,7 +337,7 @@ def test_ssh_goal_lifecycle_handler_returns_verified_remote_receipt() -> None:
337337
"projection_verified": True,
338338
}
339339
with mock.patch(
340-
"loopx.chat_ssh_source_api.apply_ssh_goal_lifecycle",
340+
"loopx.chat.ssh_source_api.apply_ssh_goal_lifecycle",
341341
return_value=receipt,
342342
) as apply:
343343
handler._ssh_goal_lifecycle()

0 commit comments

Comments
 (0)