From 01bd56d3be528a2b50f8c901fe9407b0681af8c2 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Sat, 21 Nov 2026 15:11:43 +0800 Subject: [PATCH] refactor(chat): move leaf chat helpers under loopx.chat and ratchet module budget Implements the next monorepo-distribution-split-v0 (#5072) M1 internal leaf migration without permanent top-level compatibility shims: - Move loopx/chat_operator_provider_api.py -> loopx/chat/operator_provider_api.py - Move loopx/chat_attachments.py -> loopx/chat/attachments.py - Move loopx/chat_dsh.py -> loopx/chat/dsh.py - Update internal relative imports, callers, tests, smokes, layout guards, and symmetrical RFC references - Ratchet tests/architecture/top_level_module_budget.json from 122 to 119 at baseline db76a91f0cc1afb8b10505a94b0a44cf017aaa69 Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- docs/architecture/rfcs/harness-selection-dsh-pi-v0.md | 2 +- .../rfcs/harness-selection-dsh-pi-v0.zh-CN.md | 2 +- examples/loopx-managed-turn-operator-flow-smoke.py | 2 +- examples/loopx-steward-managed-chat-smoke.py | 2 +- loopx/capabilities/native_chat/antigravity_adapter.py | 2 +- loopx/capabilities/native_chat/codex_adapter.py | 2 +- loopx/capabilities/native_chat/external_conversations.py | 2 +- loopx/capabilities/native_chat/file_discovery.py | 6 +++--- loopx/capabilities/native_chat/queued_admission.py | 2 +- loopx/{chat_attachments.py => chat/attachments.py} | 0 loopx/{chat_dsh.py => chat/dsh.py} | 8 ++++---- loopx/chat/endpoint_catalog.py | 2 +- .../operator_provider_api.py} | 2 +- loopx/chat/result_files_api.py | 2 +- loopx/chat_agent.py | 2 +- loopx/chat_ingress.py | 2 +- loopx/chat_runtime.py | 4 ++-- loopx/chat_server.py | 2 +- loopx/extensions/lark/private_conversations.py | 2 +- loopx/extensions/lark/private_delivery_discovery.py | 2 +- loopx/extensions/lark/private_images.py | 2 +- loopx/extensions/lark/return_files.py | 2 +- loopx/presentation/codex_attached_api.py | 2 +- loopx/presentation/configuration_api.py | 2 +- tests/architecture/top_level_module_budget.json | 4 ++-- tests/test_audit_cli_and_runtime_fixes.py | 2 +- tests/test_chat_dsh_adapter.py | 4 ++-- tests/test_chat_image_attachments.py | 4 ++-- tests/test_chat_image_http.py | 2 +- tests/test_chat_internal_module_layout.py | 9 +++++++++ tests/test_lark_private_conversations.py | 2 +- tests/test_manager_context_roundtrip.py | 2 +- 32 files changed, 48 insertions(+), 39 deletions(-) rename loopx/{chat_attachments.py => chat/attachments.py} (100%) rename loopx/{chat_dsh.py => chat/dsh.py} (98%) rename loopx/{chat_operator_provider_api.py => chat/operator_provider_api.py} (98%) diff --git a/docs/architecture/rfcs/harness-selection-dsh-pi-v0.md b/docs/architecture/rfcs/harness-selection-dsh-pi-v0.md index 0305e23301..458533f602 100644 --- a/docs/architecture/rfcs/harness-selection-dsh-pi-v0.md +++ b/docs/architecture/rfcs/harness-selection-dsh-pi-v0.md @@ -531,7 +531,7 @@ explicitly does not promise cross-turn DSH session continuity. Option A shipped, so this section now records the transport rather than a plan. The steward channel holds the managed host through -`loopx/chat_dsh.py`: each Chat turn starts **one bounded dsh segment** on the +`loopx/chat/dsh.py`: each Chat turn starts **one bounded dsh segment** on the resolved execution profile, hands it the channel's bounded visible history plus the current message, and returns the final assistant message. The snapshot the segment sees is composed by LoopX and the segment's sandbox is pinned read-only diff --git a/docs/architecture/rfcs/harness-selection-dsh-pi-v0.zh-CN.md b/docs/architecture/rfcs/harness-selection-dsh-pi-v0.zh-CN.md index 073fc9d275..6d6412a49d 100644 --- a/docs/architecture/rfcs/harness-selection-dsh-pi-v0.zh-CN.md +++ b/docs/architecture/rfcs/harness-selection-dsh-pi-v0.zh-CN.md @@ -393,7 +393,7 @@ adapter 已支持;管家通道还需要一个能持有交互会话的传输, turn 的 DSH 会话连续性。 路线 A 已落地,因此本节现在记录传输本身,而不是一个计划。管家通道通过 -`loopx/chat_dsh.py` 持有托管宿主:每个 chat turn 在解析出的执行档位上启动**一次有界 +`loopx/chat/dsh.py` 持有托管宿主:每个 chat turn 在解析出的执行档位上启动**一次有界 dsh 片段**,把通道可见的有界历史与当前消息交给它,并返回最终的 assistant 消息。片段 看到的内容由 LoopX 组装,且片段的沙箱通过 `DSH_PERMISSION_MODE` 固定为只读,因此回答 不可能来自通道从未授予的环境写入或 shell 权威。 diff --git a/examples/loopx-managed-turn-operator-flow-smoke.py b/examples/loopx-managed-turn-operator-flow-smoke.py index c8760c294c..b0ec241c16 100644 --- a/examples/loopx-managed-turn-operator-flow-smoke.py +++ b/examples/loopx-managed-turn-operator-flow-smoke.py @@ -28,7 +28,7 @@ REPO_ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(REPO_ROOT)) -from loopx.chat_dsh import DshChatAdapter # noqa: E402 +from loopx.chat.dsh import DshChatAdapter # noqa: E402 from loopx.chat_manager import manager_channel_binding # noqa: E402 from loopx.control_plane.operator_provider import ( # noqa: E402 operator_provider_environ, diff --git a/examples/loopx-steward-managed-chat-smoke.py b/examples/loopx-steward-managed-chat-smoke.py index 0903dfb51c..93c0416f53 100644 --- a/examples/loopx-steward-managed-chat-smoke.py +++ b/examples/loopx-steward-managed-chat-smoke.py @@ -38,7 +38,7 @@ manager_workspace, open_manager_session, ) -from loopx.chat_dsh import STEWARD_SEGMENT_ENV # noqa: E402 +from loopx.chat.dsh import STEWARD_SEGMENT_ENV # noqa: E402 from loopx.chat_runtime import ChatRuntimeController # noqa: E402 from loopx.chat_store import ChatSessionStore # noqa: E402 diff --git a/loopx/capabilities/native_chat/antigravity_adapter.py b/loopx/capabilities/native_chat/antigravity_adapter.py index 3ea98d6b53..62f3b4b2fa 100644 --- a/loopx/capabilities/native_chat/antigravity_adapter.py +++ b/loopx/capabilities/native_chat/antigravity_adapter.py @@ -1130,7 +1130,7 @@ def start_turn_with_attachments( event_sink: Callable[[str, dict[str, Any]], None] | None = None, attachments: list[dict[str, Any]] | None = None, ) -> dict[str, Any]: - from ...chat_attachments import normalize_chat_image_attachments + from ...chat.attachments import normalize_chat_image_attachments normalized = normalize_chat_image_attachments(attachments or []) media = [ diff --git a/loopx/capabilities/native_chat/codex_adapter.py b/loopx/capabilities/native_chat/codex_adapter.py index 65a10d246b..b6bce16efa 100644 --- a/loopx/capabilities/native_chat/codex_adapter.py +++ b/loopx/capabilities/native_chat/codex_adapter.py @@ -1175,7 +1175,7 @@ def healthcheck(self) -> bool: def start_attachment_turn(adapter: Any, session: dict[str, Any], turn: dict[str, Any], message: str, event_sink: Callable[[str, dict[str, Any]], None], attachments: list[dict[str, Any]]) -> dict[str, Any]: """Keep attachment support and recovered source-route checks at the adapter.""" - from ...chat_attachments import require_text_document_route + from ...chat.attachments import require_text_document_route from .antigravity_adapter import AntigravityAdapter require_text_document_route(session, attachments, origin=str(turn.get("origin") or "web")) if not isinstance(adapter, (CodexAppServerAdapter, AntigravityAdapter)): diff --git a/loopx/capabilities/native_chat/external_conversations.py b/loopx/capabilities/native_chat/external_conversations.py index 6b2e27ba86..3a4e7924b4 100644 --- a/loopx/capabilities/native_chat/external_conversations.py +++ b/loopx/capabilities/native_chat/external_conversations.py @@ -17,7 +17,7 @@ from datetime import datetime as datetime, timezone as timezone from typing import Any -from ...chat_attachments import normalize_chat_image_attachments +from ...chat.attachments import normalize_chat_image_attachments from ...chat_ingress import ( STEWARD_BINDING_ADOPTION_PENDING as STEWARD_BINDING_ADOPTION_PENDING, diff --git a/loopx/capabilities/native_chat/file_discovery.py b/loopx/capabilities/native_chat/file_discovery.py index 84e0e79ffc..28d143bcb3 100644 --- a/loopx/capabilities/native_chat/file_discovery.py +++ b/loopx/capabilities/native_chat/file_discovery.py @@ -507,7 +507,7 @@ def reply_image_workspace(session: dict[str, Any], turn: dict[str, Any]) -> Path def _check_reply_image(data: bytes, mime: str) -> None: - from ...chat_attachments import CHAT_IMAGE_MAX_BYTES + from ...chat.attachments import CHAT_IMAGE_MAX_BYTES if not data or len(data) > CHAT_IMAGE_MAX_BYTES: raise ValueError("reply image is empty or exceeds its size bound") @@ -539,7 +539,7 @@ def read_reply_image(workspace: Path, turn_id: str, name: str) -> tuple[str, byt def capture_reply_image_plan(workspace: Path, turn_id: str, targets: list[str]) -> list[str | dict[str, Any] | None]: """Pin exact local bytes without keeping host paths in Chat responses.""" - from ...chat_attachments import CHAT_IMAGE_MAX_COUNT, CHAT_IMAGE_MAX_TOTAL_BYTES + from ...chat.attachments import CHAT_IMAGE_MAX_COUNT, CHAT_IMAGE_MAX_TOTAL_BYTES if all(target.startswith("https://") for target in targets): return [] # The original remote-image path remains authoritative. @@ -585,7 +585,7 @@ def __init__( def _preparation_image_identity(value: Any) -> dict[str, Any] | None: """Fingerprint already normalized Core images without exporting their bytes.""" - from ...chat_attachments import normalize_chat_image_attachments + from ...chat.attachments import normalize_chat_image_attachments if not isinstance(value, list) or not value: return None diff --git a/loopx/capabilities/native_chat/queued_admission.py b/loopx/capabilities/native_chat/queued_admission.py index 4426e509da..ef37a47d7e 100644 --- a/loopx/capabilities/native_chat/queued_admission.py +++ b/loopx/capabilities/native_chat/queued_admission.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import TYPE_CHECKING, Any -from ...chat_attachments import require_text_document_route +from ...chat.attachments import require_text_document_route from ...attached_session import enqueue_attached_agent_turn from ...chat_store import CHAT_SESSION_MODE_ATTACHED from ...control_plane.collaboration import conversation_scope diff --git a/loopx/chat_attachments.py b/loopx/chat/attachments.py similarity index 100% rename from loopx/chat_attachments.py rename to loopx/chat/attachments.py diff --git a/loopx/chat_dsh.py b/loopx/chat/dsh.py similarity index 98% rename from loopx/chat_dsh.py rename to loopx/chat/dsh.py index ef14af1b6b..3e53444752 100644 --- a/loopx/chat_dsh.py +++ b/loopx/chat/dsh.py @@ -32,10 +32,10 @@ from typing import Any import uuid -from .chat import _turn_prompt, parse_agent_response -from .chat_agent import CodexChatAgentError, CodexChatTimeoutError -from .control_plane.turn_driver.host_binding import dsh_output_token_budget -from .dsh_goal_mode.turn_host_adapter import ( +from ..chat import _turn_prompt, parse_agent_response +from ..chat_agent import CodexChatAgentError, CodexChatTimeoutError +from ..control_plane.turn_driver.host_binding import dsh_output_token_budget +from ..dsh_goal_mode.turn_host_adapter import ( normalize_runner_outcome, resolve_dsh_home, run_dsh_turn, diff --git a/loopx/chat/endpoint_catalog.py b/loopx/chat/endpoint_catalog.py index bc0f13d975..85a60f0151 100644 --- a/loopx/chat/endpoint_catalog.py +++ b/loopx/chat/endpoint_catalog.py @@ -17,7 +17,7 @@ from pathlib import Path from typing import Any -from ..chat_dsh import STEWARD_SEGMENT_ENV +from .dsh import STEWARD_SEGMENT_ENV from ..control_plane.operator_provider import operator_provider_environ from ..control_plane.turn_driver.host_binding import ( MANAGED_TURN_HOST, diff --git a/loopx/chat_operator_provider_api.py b/loopx/chat/operator_provider_api.py similarity index 98% rename from loopx/chat_operator_provider_api.py rename to loopx/chat/operator_provider_api.py index f862c4d957..55a0f0d814 100644 --- a/loopx/chat_operator_provider_api.py +++ b/loopx/chat/operator_provider_api.py @@ -18,7 +18,7 @@ from pathlib import Path from typing import Protocol -from .control_plane.operator_provider import ( +from ..control_plane.operator_provider import ( PROVIDER_KEY_FIELD, BASE_URL_FIELD, operator_provider_projection, diff --git a/loopx/chat/result_files_api.py b/loopx/chat/result_files_api.py index b06060a1b8..df4802f8a3 100644 --- a/loopx/chat/result_files_api.py +++ b/loopx/chat/result_files_api.py @@ -6,7 +6,7 @@ from urllib.parse import quote, unquote from ..capabilities.manager_context.roundtrip import read_chat_return_file -from ..chat_attachments import CHAT_IMAGE_MAX_BYTES, CHAT_IMAGE_TYPES +from .attachments import CHAT_IMAGE_MAX_BYTES, CHAT_IMAGE_TYPES from ..control_plane.content_digest import BARE_SHA256_PATTERN from ..control_plane.effect_runtime import effect_runtime_request_scope diff --git a/loopx/chat_agent.py b/loopx/chat_agent.py index 6ef0d676b3..e92c1afaf2 100644 --- a/loopx/chat_agent.py +++ b/loopx/chat_agent.py @@ -1542,7 +1542,7 @@ def send( reply_image_directory=image_dir, ) turn_input: list[dict[str, Any]] = [{"type": "text", "text": text}] - from .chat_attachments import native_attachment_inputs + from .chat.attachments import native_attachment_inputs turn_input.extend(native_attachment_inputs(attachments)) # A running app-server is not permission for a new native Turn. Hold # the caller's fence through its write, then release before waiting for diff --git a/loopx/chat_ingress.py b/loopx/chat_ingress.py index aab5d05922..33956f1bae 100644 --- a/loopx/chat_ingress.py +++ b/loopx/chat_ingress.py @@ -452,7 +452,7 @@ def create_queued_turn( from .chat_store import _opaque_id, _atomic_write_json, utc_now, CHAT_TURN_SCHEMA_VERSION client_id = _opaque_id(client_turn_id, field="client_turn_id") - from .chat_attachments import normalize_chat_attachments, validate_chat_turn_envelope + from .chat.attachments import normalize_chat_attachments, validate_chat_turn_envelope normalized_attachments = normalize_chat_attachments(attachments) or None if normalized_attachments: validate_chat_turn_envelope({"message": message, "attachments": normalized_attachments}) diff --git a/loopx/chat_runtime.py b/loopx/chat_runtime.py index 38f79259ee..4b1abd24d3 100644 --- a/loopx/chat_runtime.py +++ b/loopx/chat_runtime.py @@ -44,7 +44,7 @@ parse_native_goal_command, validate_goal_chat, ) -from .chat_dsh import DshChatAdapter as DshChatAdapter +from .chat.dsh import DshChatAdapter as DshChatAdapter from .chat.endpoint_catalog import builtin_chat_endpoints from .chat_endpoints import AgentEndpointRegistry from .control_plane.chat_turn_acceptance import managed_turn_recovery_allowed @@ -420,7 +420,7 @@ def submit_turn( session = self.store.load_session(session_id) if session is None: raise KeyError("chat session was not found") - from .chat_attachments import require_text_document_route + from .chat.attachments import require_text_document_route require_text_document_route(session, attachments) if session.get("steward_context") is not None: raise ValueError("bound steward Chat requires its external source admission") diff --git a/loopx/chat_server.py b/loopx/chat_server.py index fb54d161a8..d3d5de5695 100644 --- a/loopx/chat_server.py +++ b/loopx/chat_server.py @@ -24,7 +24,7 @@ from .chat import TodoReviewPreviewConflict, redact_local_paths from .chat_agent import CodexChatAgentError from .capabilities.native_chat.project_context import ChatProjectContexts -from .chat_attachments import ( +from .chat.attachments import ( CHAT_JSON_MAX_BYTES, CHAT_TURN_MAX_BODY_BYTES, normalize_local_chat_attachments, diff --git a/loopx/extensions/lark/private_conversations.py b/loopx/extensions/lark/private_conversations.py index 7b7d4a90cc..3e735b5e35 100644 --- a/loopx/extensions/lark/private_conversations.py +++ b/loopx/extensions/lark/private_conversations.py @@ -29,7 +29,7 @@ from ...capabilities.native_chat.file_discovery import ( FileChatDiscovery, optional_file_fingerprint, reply_image_workspace, ) -from ...chat_attachments import CHAT_IMAGE_MAX_COUNT +from ...chat.attachments import CHAT_IMAGE_MAX_COUNT from ...chat_store import TERMINAL_TURN_STATES, _atomic_write_json, _read_json from ...control_plane.collaboration import conversation_reply_context from ...control_plane.effect_runtime import effect_runtime_request_scope diff --git a/loopx/extensions/lark/private_delivery_discovery.py b/loopx/extensions/lark/private_delivery_discovery.py index 0e94714222..a6c6de0292 100644 --- a/loopx/extensions/lark/private_delivery_discovery.py +++ b/loopx/extensions/lark/private_delivery_discovery.py @@ -9,7 +9,7 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, cast -from ...chat_attachments import CHAT_IMAGE_MAX_COUNT +from ...chat.attachments import CHAT_IMAGE_MAX_COUNT from ...chat_store import RESUMABLE_SESSION_STATES, ChatSessionStore, _read_json from ...control_plane.content_digest import BARE_SHA256_PATTERN from ...capabilities.native_chat.file_discovery import ( diff --git a/loopx/extensions/lark/private_images.py b/loopx/extensions/lark/private_images.py index 1589c9598d..a82b6dd3c7 100644 --- a/loopx/extensions/lark/private_images.py +++ b/loopx/extensions/lark/private_images.py @@ -12,7 +12,7 @@ from tempfile import TemporaryDirectory from typing import Any -from ...chat_attachments import ( +from ...chat.attachments import ( CHAT_IMAGE_MAX_BYTES, CHAT_IMAGE_MAX_COUNT, CHAT_IMAGE_MAX_TOTAL_BYTES, normalize_chat_image_attachments, ) from .goal_channel_transport import call, json_payload, lark_args diff --git a/loopx/extensions/lark/return_files.py b/loopx/extensions/lark/return_files.py index c9303e6737..b3bd6d2140 100644 --- a/loopx/extensions/lark/return_files.py +++ b/loopx/extensions/lark/return_files.py @@ -21,7 +21,7 @@ from .outbound import normalize_lark_outbound_text from .presentation.markdown_post import lark_markdown_readback_attachment_keys, lark_markdown_readback_matches from ...capabilities.native_chat.file_discovery import read_reply_image, reply_image_attachment -from ...chat_attachments import normalize_chat_image_attachments +from ...chat.attachments import normalize_chat_image_attachments from ...control_plane.collaboration.inbox import _hash, _read, _root, _write from ...control_plane.collaboration.result_files import read_result_file from ...file_lock import exclusive_file_lock diff --git a/loopx/presentation/codex_attached_api.py b/loopx/presentation/codex_attached_api.py index 7b8f5d44da..66e1e3ee33 100644 --- a/loopx/presentation/codex_attached_api.py +++ b/loopx/presentation/codex_attached_api.py @@ -12,7 +12,7 @@ from ..agent_registry import registered_agent_ids_for_goal from ..attached_session import load_attached_session_registry -from ..chat_attachments import CHAT_JSON_MAX_BYTES +from ..chat.attachments import CHAT_JSON_MAX_BYTES from ..capabilities.native_chat.codex_attached import ( DesktopProtocolError, DesktopClient, diff --git a/loopx/presentation/configuration_api.py b/loopx/presentation/configuration_api.py index 7faaf63c6e..2f92a1ce40 100644 --- a/loopx/presentation/configuration_api.py +++ b/loopx/presentation/configuration_api.py @@ -17,7 +17,7 @@ from . import decision_context_api as context_api from . import content_media_api as media_api from ..chat import machine_configuration_api as machine_api -from .. import chat_operator_provider_api as operator_api +from ..chat import operator_provider_api as operator_api from ..chat import automation_cadence_api as cadence_api diff --git a/tests/architecture/top_level_module_budget.json b/tests/architecture/top_level_module_budget.json index 7a507492e8..5b3f0f9944 100644 --- a/tests/architecture/top_level_module_budget.json +++ b/tests/architecture/top_level_module_budget.json @@ -1,6 +1,6 @@ { "schema": "loopx_top_level_module_budget_v0", - "baseline_commit": "41ea75e89892ed88d0ae543e97e31aad0a181c47", - "max_top_level_modules": 122, + "baseline_commit": "db76a91f0cc1afb8b10505a94b0a44cf017aaa69", + "max_top_level_modules": 119, "allowlist": ["__init__.py", "entrypoint.py", "cli.py"] } diff --git a/tests/test_audit_cli_and_runtime_fixes.py b/tests/test_audit_cli_and_runtime_fixes.py index aa08921c4c..488a9eaa5f 100644 --- a/tests/test_audit_cli_and_runtime_fixes.py +++ b/tests/test_audit_cli_and_runtime_fixes.py @@ -374,7 +374,7 @@ def _send_error(self, message: str, status: int = 400) -> None: def test_chat_attachments_rejects_bool_and_list_sizes() -> None: - from loopx.chat_attachments import normalize_chat_image_attachments + from loopx.chat.attachments import normalize_chat_image_attachments data = base64.b64encode(b"img").decode("ascii") for bad_size in (True, False, [3], "3"): diff --git a/tests/test_chat_dsh_adapter.py b/tests/test_chat_dsh_adapter.py index 51866f6c86..bde63c9dd6 100644 --- a/tests/test_chat_dsh_adapter.py +++ b/tests/test_chat_dsh_adapter.py @@ -9,10 +9,10 @@ import pytest -from loopx import chat_dsh +from loopx.chat import dsh as chat_dsh from loopx.chat import CHAT_REVIEW_CLOSE_TAG, CHAT_REVIEW_OPEN_TAG from loopx.chat_agent import CodexChatAgentError -from loopx.chat_dsh import ( +from loopx.chat.dsh import ( HISTORY_LIMIT, MANAGED_HOST_CHAT_FAILED, MANAGED_HOST_CHAT_SEGMENT_IN_FLIGHT, diff --git a/tests/test_chat_image_attachments.py b/tests/test_chat_image_attachments.py index 7af83573a7..9659dd090e 100644 --- a/tests/test_chat_image_attachments.py +++ b/tests/test_chat_image_attachments.py @@ -5,8 +5,8 @@ import pytest -from loopx.chat_attachments import normalize_chat_image_attachments -from loopx.chat_attachments import CHAT_TURN_MAX_BODY_BYTES, validate_chat_turn_envelope +from loopx.chat.attachments import normalize_chat_image_attachments +from loopx.chat.attachments import CHAT_TURN_MAX_BODY_BYTES, validate_chat_turn_envelope PNG_BYTES = base64.b64decode( diff --git a/tests/test_chat_image_http.py b/tests/test_chat_image_http.py index c5d4a0bcec..03acaaa707 100644 --- a/tests/test_chat_image_http.py +++ b/tests/test_chat_image_http.py @@ -17,7 +17,7 @@ import pytest from loopx.chat_runtime import ChatRuntimeController -from loopx.chat_attachments import CHAT_TURN_MAX_BODY_BYTES +from loopx.chat.attachments import CHAT_TURN_MAX_BODY_BYTES from loopx.chat_server import ChatHTTPServer, ChatRequestHandler from loopx.chat_store import ChatSessionStore diff --git a/tests/test_chat_internal_module_layout.py b/tests/test_chat_internal_module_layout.py index 967aa71221..b0bf38e7a7 100644 --- a/tests/test_chat_internal_module_layout.py +++ b/tests/test_chat_internal_module_layout.py @@ -6,11 +6,14 @@ from pathlib import Path import loopx.chat as public_chat +from loopx.chat.attachments import normalize_chat_attachments from loopx.chat.automation_cadence_api import AutomationCadenceRequestMixin +from loopx.chat.dsh import DshChatAdapter from loopx.chat.event_cache import ChatEventCache from loopx.chat.goal_configuration_api import GoalConfigurationRequestMixin from loopx.chat.machine_configuration_api import MachineConfigurationRequestMixin from loopx.chat.monitor_actions import ChatMonitorActionMixin +from loopx.chat.operator_provider_api import OperatorProviderRequestMixin from loopx.chat.session_open import open_chat_session from loopx.chat.ssh_source_api import SshSourceRequestMixin from loopx.chat.status_api import ChatStatusRequestMixin, goal_read_runtime_root @@ -23,10 +26,12 @@ def test_chat_internal_helpers_load_below_the_public_chat_namespace() -> None: namespace_root = Path(public_chat.__file__).with_suffix("").resolve() assert [Path(entry).resolve() for entry in public_chat.__path__] == [namespace_root] + assert normalize_chat_attachments.__module__ == "loopx.chat.attachments" assert ( AutomationCadenceRequestMixin.__module__ == "loopx.chat.automation_cadence_api" ) + assert DshChatAdapter.__module__ == "loopx.chat.dsh" assert ChatEventCache.__module__ == "loopx.chat.event_cache" assert GoalConfigurationRequestMixin.__module__ == "loopx.chat.goal_configuration_api" assert ( @@ -34,6 +39,7 @@ def test_chat_internal_helpers_load_below_the_public_chat_namespace() -> None: == "loopx.chat.machine_configuration_api" ) assert ChatMonitorActionMixin.__module__ == "loopx.chat.monitor_actions" + assert OperatorProviderRequestMixin.__module__ == "loopx.chat.operator_provider_api" assert open_chat_session.__module__ == "loopx.chat.session_open" assert SshSourceRequestMixin.__module__ == "loopx.chat.ssh_source_api" assert ChatTodoActionMixin.__module__ == "loopx.chat.todo_actions" @@ -44,6 +50,9 @@ def test_chat_internal_helpers_load_below_the_public_chat_namespace() -> None: def test_chat_internal_helpers_have_no_top_level_compatibility_shims() -> None: for old_module in ( + "loopx.chat_attachments", + "loopx.chat_dsh", + "loopx.chat_operator_provider_api", "loopx.chat_status_api", "loopx.chat_event_cache", "loopx.chat_automation_cadence_api", diff --git a/tests/test_lark_private_conversations.py b/tests/test_lark_private_conversations.py index cdb603ebc3..a26fdde4d9 100644 --- a/tests/test_lark_private_conversations.py +++ b/tests/test_lark_private_conversations.py @@ -1590,7 +1590,7 @@ def close_during_control_read(): _atomic_write_json(manifest, plan) if fault == "unlisted_cached_redirect": import base64 - from loopx.chat_attachments import normalize_chat_image_attachments + from loopx.chat.attachments import normalize_chat_image_attachments legacy_attachments = normalize_chat_image_attachments([ {"id": f"reply-image-{index}", "name": f"original-{index}.png", "mime_type": "image/png", diff --git a/tests/test_manager_context_roundtrip.py b/tests/test_manager_context_roundtrip.py index b51fe0d151..9ecbea3930 100644 --- a/tests/test_manager_context_roundtrip.py +++ b/tests/test_manager_context_roundtrip.py @@ -1486,7 +1486,7 @@ def message(payload): def test_download_attachment_does_not_expand_chat_input_admission(returned_file_history): - from loopx.chat_attachments import normalize_chat_attachments + from loopx.chat.attachments import normalize_chat_attachments root, registry, store, session, _, _, message, _, _ = returned_file_history visible = project_chat_return_deliveries(root, session["session_id"], [message], source_store=store, registry=registry)[0]