diff --git a/loopx/capabilities/manager_context/inspection.py b/loopx/capabilities/manager_context/inspection.py index 2da3341132..f6ba3de450 100644 --- a/loopx/capabilities/manager_context/inspection.py +++ b/loopx/capabilities/manager_context/inspection.py @@ -9,8 +9,8 @@ from pathlib import Path from typing import Any -from ...chat_manager_details import read_manager_goal_details -from ...chat_manager_history import delivery_history_window, read_manager_delivery_history +from ...chat.manager_details import read_manager_goal_details +from ...chat.manager_history import delivery_history_window, read_manager_delivery_history from ...control_plane.effect_runtime import effect_runtime_result diff --git a/loopx/capabilities/manager_context/report_source.py b/loopx/capabilities/manager_context/report_source.py index 3c08ad8dca..737c0c0ad5 100644 --- a/loopx/capabilities/manager_context/report_source.py +++ b/loopx/capabilities/manager_context/report_source.py @@ -11,7 +11,7 @@ import json from typing import Any -from ...chat_manager_history import delivery_history_window +from ...chat.manager_history import delivery_history_window from ..periodic_report.adapters import PeriodicReportSourceAdapter, build_periodic_report_source_result SOURCE_ID = "manager_portfolio" diff --git a/loopx/capabilities/native_chat/model_settings.py b/loopx/capabilities/native_chat/model_settings.py index b8133ca7f4..7d0f27946e 100644 --- a/loopx/capabilities/native_chat/model_settings.py +++ b/loopx/capabilities/native_chat/model_settings.py @@ -40,7 +40,7 @@ def session_model_settings_supported(session: dict[str, Any]) -> bool: configuration owner. A model choice must never trigger their thread replay. Imports are local because the Session store also uses these normalizers. """ - from ...chat_coordination import PROJECT_CONTEXT_VERSION + from ...chat.coordination import PROJECT_CONTEXT_VERSION from ...chat_manager import is_manager_channel from ...chat_store import CHAT_SESSION_MODE_MANAGED diff --git a/loopx/capabilities/periodic_report/private_generation.py b/loopx/capabilities/periodic_report/private_generation.py index 3af9db1853..9098fe6b55 100644 --- a/loopx/capabilities/periodic_report/private_generation.py +++ b/loopx/capabilities/periodic_report/private_generation.py @@ -40,7 +40,7 @@ def _read(path: Path) -> dict[str, Any]: def _source_facts(source: dict[str, Any], *, local: bool) -> list[dict[str, Any]]: """Derive editorial references from the same frozen source on every read.""" - from ...chat_manager_history import _recorded_web_references + from ...chat.manager_history import _recorded_web_references facts = [{"fact_id": "local_coverage" if local else "portfolio_coverage", "title": "本期来源范围" if local else "本期来源覆盖", diff --git a/loopx/chat_completed_todos.py b/loopx/chat/completed_todos.py similarity index 95% rename from loopx/chat_completed_todos.py rename to loopx/chat/completed_todos.py index 25cf787297..bdba52074e 100644 --- a/loopx/chat_completed_todos.py +++ b/loopx/chat/completed_todos.py @@ -10,14 +10,14 @@ from time import monotonic from urllib.parse import parse_qs, urlparse -from .paths import resolve_runtime_root -from .capabilities.native_chat.project_context import coordination_runtime_root -from .status_server import is_loopback_host +from ..paths import resolve_runtime_root +from ..capabilities.native_chat.project_context import coordination_runtime_root +from ..status_server import is_loopback_host def _goal_result_candidates(*, runtime_root, goal_id): """Snapshot bounded metadata; exact acceptance is checked per requested page.""" - from .control_plane.coordination.local_authority import read_canonical_todos_if_promoted + from ..control_plane.coordination.local_authority import read_canonical_todos_if_promoted payload = read_canonical_todos_if_promoted(runtime_root=runtime_root, goal_id=goal_id) if payload is None: @@ -42,7 +42,7 @@ def _goal_result_candidates(*, runtime_root, goal_id): def _verify_goal_result_page(*, page, registry_path, runtime_root, goal_id): - from .control_plane.todos.completion_result import read_completion_result + from ..control_plane.todos.completion_result import read_completion_result rows = [] unavailable_todo_ids = [] @@ -159,7 +159,7 @@ def _goal_results(self) -> None: self._send_error("Goal results could not be loaded.", status=503) def _goal_result(self, todo_id: str) -> None: - from .control_plane.todos.completion_result import read_completion_result + from ..control_plane.todos.completion_result import read_completion_result goal_id = parse_qs(urlparse(self.path).query).get("goal_id", [""])[0] try: @@ -182,7 +182,7 @@ def _goal_result(self, todo_id: str) -> None: def _completed_todos(self) -> None: # This loopback-only workspace read preserves task text and evidence. # Select display fields without returning the authority's internal metadata. - from .control_plane.todos.list_readback import list_goal_todos + from ..control_plane.todos.list_readback import list_goal_todos if not self._require_loopback_origin(): return diff --git a/loopx/chat_coordination.py b/loopx/chat/coordination.py similarity index 92% rename from loopx/chat_coordination.py rename to loopx/chat/coordination.py index 62df8f68c6..3bb992fb0b 100644 --- a/loopx/chat_coordination.py +++ b/loopx/chat/coordination.py @@ -40,8 +40,8 @@ def apply_context_handoff( return response if scope["kind"] == "unavailable": raise ValueError("context handoff requires a scoped conversation") - from .capabilities.manager_context.execution import handoff_response - from .chat_manager_context import manager_authorization_scope_is_current + from ..capabilities.manager_context.execution import handoff_response + from ..chat_manager_context import manager_authorization_scope_is_current expected_scope_id = context.get("authorization_scope_id") if scope["kind"] == "external_audience" and expected_scope_id is None: @@ -70,14 +70,14 @@ def apply_context_handoff( def prepare_turn_context(controller, adapter, session, turn_id, event_sink, *, scope, preserve_original_thread=False): """Prepare the same evidence/handoff path for each supported conversation.""" - from .chat_runtime import CodexAppServerAdapter, CodexChatAgentError - from .chat_manager import (MANAGER_AGENT_GOAL_ID, MANAGER_AGENT_OBJECTIVE, + from ..chat_runtime import CodexAppServerAdapter, CodexChatAgentError + from ..chat_manager import (MANAGER_AGENT_GOAL_ID, MANAGER_AGENT_OBJECTIVE, manager_workspace) - from .capabilities.manager_runtime import manager_runtime_session_fields + from ..capabilities.manager_runtime import manager_runtime_session_fields session_id = session["session_id"] runtime_root = getattr(controller, "coordination_runtime_root", controller.store.root.parent) - from .chat_manager_context import collect_manager_turn_context + from ..chat_manager_context import collect_manager_turn_context observation_only = getattr(adapter, "observation_only", False) is True event_sink("agent.phase", {"phase": "manager_context", "label": "正在读取当前 Goal 的工作与协作" if scope["kind"] == "owner_goal" else "正在读取授权范围内的 Goal 状态"}) context = collect_manager_turn_context( @@ -90,7 +90,7 @@ def prepare_turn_context(controller, adapter, session, turn_id, event_sink, *, s remote_evidence=not isinstance(adapter, CodexAppServerAdapter) and not observation_only, ) if scope.get("bound_steward") is True and isinstance(context.get("bound_steward"), dict): - from .capabilities.native_chat.external_conversations import ChatExternalConversations + from ..capabilities.native_chat.external_conversations import ChatExternalConversations context["bound_steward"]["executions"] = ChatExternalConversations(controller).commission_evidence(session) controller.store.append_event(session_id, turn_id, kind="manager.context", payload=context) if observation_only: @@ -146,12 +146,12 @@ def prepare_turn_context(controller, adapter, session, turn_id, event_sink, *, s ) with controller.lock: controller.adapters[session_id] = adapter - from .capabilities.manager_context import authority + from ..capabilities.manager_context import authority context["context_delegation"] = authority( runtime_root, controller.registry_path, session, controller.store.load_turn(session_id, turn_id) or {}, ) - from .capabilities.manager_context.execution import catalog + from ..capabilities.manager_context.execution import catalog execution_catalog = catalog( runtime_root, controller.registry_path, session, controller.store.load_turn(session_id, turn_id) or {}, @@ -159,8 +159,8 @@ def prepare_turn_context(controller, adapter, session, turn_id, event_sink, *, s if execution_catalog["bindings"] or not execution_catalog["available"]: context["context_execution"] = execution_catalog if isinstance(adapter, CodexAppServerAdapter): - from .capabilities.manager_context.inspection import ManagerInspection, manager_index - from .chat_manager_context import manager_authorization_scope_is_current + from ..capabilities.manager_context.inspection import ManagerInspection, manager_index + from ..chat_manager_context import manager_authorization_scope_is_current expected_scope_id = context.get("authorization_scope_id") def scope_valid() -> bool: if scope["kind"] == "owner_portfolio": @@ -199,7 +199,7 @@ def scope_valid() -> bool: adapter.session.read_tool_handler = inspection.read context["evidence_sources"] = inspection.sources() context = manager_index(context) - from .capabilities.native_chat.external_conversations import ChatExternalConversations + from ..capabilities.native_chat.external_conversations import ChatExternalConversations recovery = ChatExternalConversations(controller).recovery_context( session, controller.store.load_turn(session_id, turn_id) or {}) if scope.get("bound_steward") else None if recovery is not None: diff --git a/loopx/chat_endpoint_catalog.py b/loopx/chat/endpoint_catalog.py similarity index 96% rename from loopx/chat_endpoint_catalog.py rename to loopx/chat/endpoint_catalog.py index ef52c1fd03..bc0f13d975 100644 --- a/loopx/chat_endpoint_catalog.py +++ b/loopx/chat/endpoint_catalog.py @@ -17,13 +17,13 @@ from pathlib import Path from typing import Any -from .chat_dsh import STEWARD_SEGMENT_ENV -from .control_plane.operator_provider import operator_provider_environ -from .control_plane.turn_driver.host_binding import ( +from ..chat_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, managed_executor_binding, ) -from .kiro_cli_goal_mode import ( +from ..kiro_cli_goal_mode import ( KIRO_CLI_CHAT_ADAPTER_KIND, KIRO_CLI_CHAT_AGENT_ID, KIRO_CLI_CHAT_DISPLAY_NAME, @@ -88,7 +88,7 @@ def _environment_readiness(variable: str) -> dict[str, Any]: def _antigravity_readiness() -> dict[str, Any]: """Live local probe for Antigravity's LanguageServerService.""" - from .capabilities.native_chat.antigravity_adapter import probe_antigravity_endpoint + from ..capabilities.native_chat.antigravity_adapter import probe_antigravity_endpoint available, executable, detail = probe_antigravity_endpoint() if available: diff --git a/loopx/chat_goal_subagent_api.py b/loopx/chat/goal_subagent_api.py similarity index 97% rename from loopx/chat_goal_subagent_api.py rename to loopx/chat/goal_subagent_api.py index e8d01aeb65..1e380eee22 100644 --- a/loopx/chat_goal_subagent_api.py +++ b/loopx/chat/goal_subagent_api.py @@ -4,15 +4,15 @@ from typing import Any -from .control_plane.goals.configure_goal_service import configure_goal_with_global_sync -from .capabilities.multi_subagent import ( +from ..control_plane.goals.configure_goal_service import configure_goal_with_global_sync +from ..capabilities.multi_subagent import ( apply_codex_subagent_capacity, plan_codex_subagent_capacity, public_codex_host_capacity, ) -from .control_plane.todos.contract import normalize_todo_task_domain -from .status_server import configure_goal_preview_id -from .orchestration import subagent_model_configuration_options +from ..control_plane.todos.contract import normalize_todo_task_domain +from ..status_server import configure_goal_preview_id +from ..orchestration import subagent_model_configuration_options CHAT_GOAL_SUBAGENT_DRY_RUN_PATH = "/api/chat/goal-subagents/dry-run" diff --git a/loopx/chat_manager_details.py b/loopx/chat/manager_details.py similarity index 92% rename from loopx/chat_manager_details.py rename to loopx/chat/manager_details.py index f43881f18a..f14d119a40 100644 --- a/loopx/chat_manager_details.py +++ b/loopx/chat/manager_details.py @@ -8,10 +8,10 @@ from pathlib import Path from typing import Any -from .presentation.public_safety import redact_public_text, scan_public_boundary_text -from .control_plane.todos.list_readback import list_goal_todos -from .control_plane.effect_runtime import effect_runtime_result -from .control_plane.runtime.runtime_projection_route import resolve_goal_source_runtime_route +from ..presentation.public_safety import redact_public_text, scan_public_boundary_text +from ..control_plane.todos.list_readback import list_goal_todos +from ..control_plane.effect_runtime import effect_runtime_result +from ..control_plane.runtime.runtime_projection_route import resolve_goal_source_runtime_route def _text(value: object, limit: int = 420) -> str: diff --git a/loopx/chat_manager_history.py b/loopx/chat/manager_history.py similarity index 96% rename from loopx/chat_manager_history.py rename to loopx/chat/manager_history.py index 65005ed366..b6ee800a22 100644 --- a/loopx/chat_manager_history.py +++ b/loopx/chat/manager_history.py @@ -8,12 +8,12 @@ from pathlib import Path from urllib.parse import urlsplit -from .chat_manager_details import _text -from .control_plane.runtime.run_context_retention import goal_semantic_history_from_runs -from .control_plane.work_items.delivery_outcome import MATERIAL_DELIVERY_OUTCOMES, PROGRESS_DELIVERY_OUTCOMES -from .history import STATUS_NEUTRAL_CLASSIFICATIONS, load_index_snapshot -from .public_safe_text import PUBLIC_SAFE_REFERENCE_PATTERN, find_private_text_match -from .control_plane.runtime.public_safety import validate_public_safe_value +from .manager_details import _text +from ..control_plane.runtime.run_context_retention import goal_semantic_history_from_runs +from ..control_plane.work_items.delivery_outcome import MATERIAL_DELIVERY_OUTCOMES, PROGRESS_DELIVERY_OUTCOMES +from ..history import STATUS_NEUTRAL_CLASSIFICATIONS, load_index_snapshot +from ..public_safe_text import PUBLIC_SAFE_REFERENCE_PATTERN, find_private_text_match +from ..control_plane.runtime.public_safety import validate_public_safe_value def delivery_history_window(window_start=None, window_end=None): diff --git a/loopx/chat_manager_context.py b/loopx/chat_manager_context.py index 8018c623cf..12b0dc59c0 100644 --- a/loopx/chat_manager_context.py +++ b/loopx/chat_manager_context.py @@ -12,8 +12,8 @@ from .chat_manager import manager_model_config from .capabilities.steward_executor import load_effective_steward_executor_defaults -from .chat_manager_details import read_manager_goal_details -from .chat_manager_history import read_manager_delivery_history +from .chat.manager_details import read_manager_goal_details +from .chat.manager_history import read_manager_delivery_history from .capabilities.manager_context.inspection import agent_work_summary from .history import decode_registry_snapshot from .goal_portfolio import build_goal_portfolio, lifecycle_readback_unavailable diff --git a/loopx/chat_runtime.py b/loopx/chat_runtime.py index bc3db995f4..cec57507e3 100644 --- a/loopx/chat_runtime.py +++ b/loopx/chat_runtime.py @@ -20,7 +20,7 @@ manager_answer_readback, manager_session_model_allocation, ) -from .chat_coordination import PROJECT_COORDINATION_GUIDANCE, PROJECT_CONTEXT_VERSION, apply_context_handoff +from .chat.coordination import PROJECT_COORDINATION_GUIDANCE, PROJECT_CONTEXT_VERSION, apply_context_handoff from .capabilities.native_chat import codex_context, project_context as project_context_policy from .capabilities.native_chat.codex_adapter import CodexAppServerAdapter, start_attachment_turn from .capabilities.native_chat.machine_defaults import codex_profile_home, load_codex_chat_defaults @@ -46,7 +46,7 @@ validate_goal_chat, ) from .chat_dsh import DshChatAdapter -from .chat_endpoint_catalog import builtin_chat_endpoints +from .chat.endpoint_catalog import builtin_chat_endpoints from .chat_endpoints import AgentEndpointRegistry from .control_plane.turn_driver.host_binding import MANAGED_TURN_HOST from .control_plane.turn_driver.execution_profile import managed_execution_profile @@ -1744,7 +1744,7 @@ def event_sink(kind: str, payload: dict[str, Any]) -> None: if session.get("project_context") is not None: self.project_contexts.session_context(session) project_context_policy.validate_project_executor_scope(str(session["agent_id"]), session["project_context"], self.capabilities) - from .chat_coordination import prepare_turn_context + from .chat.coordination import prepare_turn_context current_turn = self.store.load_turn(session_id, turn_id) or {} if current_turn.get("origin") == "peer" or "collaboration_request" in current_turn: from .capabilities.native_chat.conversation_bindings import OriginalConversationRequests diff --git a/loopx/chat_server.py b/loopx/chat_server.py index 97ef446c53..12e1e4544b 100644 --- a/loopx/chat_server.py +++ b/loopx/chat_server.py @@ -36,7 +36,7 @@ ) from .chat_actions import ChatActionService, ProtectedActionGate, goal_workspace_labels, goal_workspace_ref from .chat_action_store import ACTION_KINDS, ActionConflictError, ChatActionStore -from .chat_goal_subagent_api import ( +from .chat.goal_subagent_api import ( GoalSubagentConfigurationRequestMixin, add_goal_subagent_capability, add_goal_subagent_routes, @@ -101,7 +101,7 @@ default_extension_state_file, resolve_extension_activation, ) -from .chat_completed_todos import CompletedTodoPages, CompletedTodoRequestMixin +from .chat.completed_todos import CompletedTodoPages, CompletedTodoRequestMixin from .presentation.explore_results_api import ExploreResultsRequestMixin from .presentation.research_analysis_api import RESEARCH_ANALYSIS_PATH, ResearchAnalysisRequestMixin from .presentation.goal_source_routing import GOAL_SOURCE_LINKS_PATH, GoalSourceRequestMixin diff --git a/loopx/chat_status_api.py b/loopx/chat_status_api.py index f0e978462c..0e1bbb96bc 100644 --- a/loopx/chat_status_api.py +++ b/loopx/chat_status_api.py @@ -10,7 +10,7 @@ from urllib.parse import parse_qs, urlparse from .chat import redact_local_paths -from .chat_goal_subagent_api import goal_subagent_configuration_enabled +from .chat.goal_subagent_api import goal_subagent_configuration_enabled from .chat.workspace_directory import workspace_goal_directory from .codex_app_thread_activity import ( codex_delivery_expectations, diff --git a/loopx/control_plane/status/goal_source.py b/loopx/control_plane/status/goal_source.py index f133ea243a..10bc3ceed5 100644 --- a/loopx/control_plane/status/goal_source.py +++ b/loopx/control_plane/status/goal_source.py @@ -24,7 +24,7 @@ from urllib.request import HTTPRedirectHandler, Request, build_opener from ..content_digest import BARE_SHA256_PATTERN -from ...chat_completed_todos import CompletedTodoPages +from ...chat.completed_todos import CompletedTodoPages from ...status_server import is_loopback_host from .ssh_host_catalog import configured_ssh_host_aliases diff --git a/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/after/inspection.py.txt b/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/after/inspection.py.txt index f45de7f129..16703d523e 100644 --- a/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/after/inspection.py.txt +++ b/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/after/inspection.py.txt @@ -8,8 +8,8 @@ from collections.abc import Callable from pathlib import Path from typing import Any -from ...chat_manager_details import read_manager_goal_details -from ...chat_manager_history import read_manager_delivery_history +from ...chat.manager_details import read_manager_goal_details +from ...chat.manager_history import read_manager_delivery_history TOOL_NAME = "loopx_manager_read" diff --git a/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/before/inspection.py.txt b/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/before/inspection.py.txt index 157ebca3f5..6663a6f10a 100644 --- a/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/before/inspection.py.txt +++ b/packages/loopx-jev/tests/fixtures/sentinel/real/fix_manager_refused_read_argument/before/inspection.py.txt @@ -8,8 +8,8 @@ from collections.abc import Callable from pathlib import Path from typing import Any -from ...chat_manager_details import read_manager_goal_details -from ...chat_manager_history import read_manager_delivery_history +from ...chat.manager_details import read_manager_goal_details +from ...chat.manager_history import read_manager_delivery_history TOOL_NAME = "loopx_manager_read" diff --git a/tests/architecture/top_level_module_budget.json b/tests/architecture/top_level_module_budget.json index c5ee836e21..342ba84390 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": "a4483aaece5bc74ec3f969fd067229487022401b", - "max_top_level_modules": 134, + "max_top_level_modules": 128, "allowlist": ["__init__.py", "entrypoint.py", "cli.py"] } diff --git a/tests/capabilities/test_codex_subagent_host_capacity.py b/tests/capabilities/test_codex_subagent_host_capacity.py index cd77e79287..652a1ce9f6 100644 --- a/tests/capabilities/test_codex_subagent_host_capacity.py +++ b/tests/capabilities/test_codex_subagent_host_capacity.py @@ -11,7 +11,7 @@ from loopx.control_plane.goals.configure_goal_service import ( configure_goal_with_global_sync, ) -from loopx.chat_goal_subagent_api import GoalSubagentConfigurationRequestMixin +from loopx.chat.goal_subagent_api import GoalSubagentConfigurationRequestMixin from loopx.file_lock import exclusive_cross_runtime_file_lock from loopx.paths import global_registry_path diff --git a/tests/capabilities/test_periodic_report_private_generation.py b/tests/capabilities/test_periodic_report_private_generation.py index 5b602fd461..f427b53c40 100644 --- a/tests/capabilities/test_periodic_report_private_generation.py +++ b/tests/capabilities/test_periodic_report_private_generation.py @@ -263,7 +263,7 @@ def test_source_bound_report_keeps_complete_facts_and_original_artifacts(tmp_pat def test_recorded_citation_reaches_frozen_facts_and_both_artifacts_without_public_access_claim( tmp_path, legacy): from loopx.capabilities.manager_context.report_source import collect_manager_report_source - from loopx.chat_manager_history import _recorded_details + from loopx.chat.manager_history import _recorded_details root, window, response = _prepared_report(tmp_path / "template") root = tmp_path / "citation-runtime" diff --git a/tests/control_plane/test_peer_source_store.py b/tests/control_plane/test_peer_source_store.py index 11582f8a26..f9571130f8 100644 --- a/tests/control_plane/test_peer_source_store.py +++ b/tests/control_plane/test_peer_source_store.py @@ -13,7 +13,7 @@ from canonical_authority_fixture import isolate_sqlite_runtime, promoted_create_fixture from loopx.capabilities.manager_context import POLICY_SCHEMA, _hash, _root, _write, register_ingress -from loopx.chat_coordination import apply_context_handoff +from loopx.chat.coordination import apply_context_handoff from loopx.chat_store import ChatSessionStore from loopx.control_plane.collaboration.peers import read_inbox, request from loopx.capabilities.manager_context.roundtrip import ( diff --git a/tests/control_plane/test_subagent_model_configuration.py b/tests/control_plane/test_subagent_model_configuration.py index 69f6045f07..c7606bdccf 100644 --- a/tests/control_plane/test_subagent_model_configuration.py +++ b/tests/control_plane/test_subagent_model_configuration.py @@ -274,7 +274,7 @@ def test_capability_model_rejects_non_string_inputs(config: dict) -> None: def test_goal_drawer_preview_binding_and_model_roundtrip(registry: Path) -> None: from types import SimpleNamespace - from loopx.chat_goal_subagent_api import GoalSubagentConfigurationRequestMixin + from loopx.chat.goal_subagent_api import GoalSubagentConfigurationRequestMixin class Handler(GoalSubagentConfigurationRequestMixin): def __init__(self) -> None: diff --git a/tests/control_plane/test_succession_provider_readback.py b/tests/control_plane/test_succession_provider_readback.py index b12bbdb2d5..a75bdf4801 100644 --- a/tests/control_plane/test_succession_provider_readback.py +++ b/tests/control_plane/test_succession_provider_readback.py @@ -9,7 +9,7 @@ import pytest from canonical_authority_fixture import initialize_canonical_authority, isolate_sqlite_runtime -from loopx.chat_manager_details import read_manager_goal_details +from loopx.chat.manager_details import read_manager_goal_details from loopx.control_plane.coordination.local_authority import ( canonical_todo_summary_fields, read_canonical_todos_if_promoted, ) diff --git a/tests/control_plane/test_todo_projection_recovery.py b/tests/control_plane/test_todo_projection_recovery.py index 91f96c1e18..1c77943984 100644 --- a/tests/control_plane/test_todo_projection_recovery.py +++ b/tests/control_plane/test_todo_projection_recovery.py @@ -11,7 +11,7 @@ import pytest -from loopx.chat_manager_details import read_manager_goal_details +from loopx.chat.manager_details import read_manager_goal_details from canonical_authority_fixture import ( initialize_canonical_authority, isolate_sqlite_runtime, promoted_create_fixture, ) diff --git a/tests/control_plane/test_todo_source_runtime_route.py b/tests/control_plane/test_todo_source_runtime_route.py index a4da9b975c..b4faa4d78f 100644 --- a/tests/control_plane/test_todo_source_runtime_route.py +++ b/tests/control_plane/test_todo_source_runtime_route.py @@ -10,7 +10,7 @@ initialize_canonical_authority, isolate_sqlite_runtime, ) -from loopx.chat_manager_details import read_manager_goal_details +from loopx.chat.manager_details import read_manager_goal_details from loopx.contract import check_contract from loopx.control_plane.coordination.local_authority import read_canonical_todos_if_promoted from loopx.control_plane.coordination.runtime_shadow import build_todo_runtime_shadow_projection diff --git a/tests/test_chat_agent_model_http.py b/tests/test_chat_agent_model_http.py index b92ffe8da7..fe28206b79 100644 --- a/tests/test_chat_agent_model_http.py +++ b/tests/test_chat_agent_model_http.py @@ -30,7 +30,7 @@ def current_session_settings(tmp_path, monkeypatch): session = store.create_session(goal_id="fixture", agent_id="codex", adapter_kind="codex_app_server", upstream_thread_id="original-thread", agent_model_id="first", agent_reasoning_effort="low", requested_agent_model_id="first", requested_agent_reasoning_effort="low", upstream_mode="chat") - from loopx.chat_coordination import PROJECT_CONTEXT_VERSION + from loopx.chat.coordination import PROJECT_CONTEXT_VERSION session = store.update_session(session["session_id"], coordination_context_version=PROJECT_CONTEXT_VERSION) server = chat_server.ChatHTTPServer(("127.0.0.1", 0), chat_server.ChatRequestHandler) server.verbose = False diff --git a/tests/test_chat_completed_todos.py b/tests/test_chat_completed_todos.py index feee0dda13..a55e477995 100644 --- a/tests/test_chat_completed_todos.py +++ b/tests/test_chat_completed_todos.py @@ -7,7 +7,7 @@ import pytest -from loopx.chat_completed_todos import CompletedTodoPages, _verify_goal_result_page +from loopx.chat.completed_todos import CompletedTodoPages, _verify_goal_result_page from loopx.chat_server import ChatHTTPServer, ChatRequestHandler from loopx.control_plane.todos.contract import encode_metadata_value @@ -127,7 +127,7 @@ def test_snapshot_expiry_starts_when_loading_finishes(monkeypatch): pages = CompletedTodoPages() pages.ttl_seconds = 1 clock = [0] - monkeypatch.setattr("loopx.chat_completed_todos.monotonic", lambda: clock[0]) + monkeypatch.setattr("loopx.chat.completed_todos.monotonic", lambda: clock[0]) rows = [{"todo_id": f"todo_{index}"} for index in range(41)] def load(): diff --git a/tests/test_chat_conversation_bindings.py b/tests/test_chat_conversation_bindings.py index c43667324f..318d7f51b4 100644 --- a/tests/test_chat_conversation_bindings.py +++ b/tests/test_chat_conversation_bindings.py @@ -1434,7 +1434,7 @@ def test_read_only_bound_project_rejects_write_scoped_executor_before_session_cr project_grant="workspace_read", ) monkeypatch.setattr( - "loopx.chat_endpoint_catalog.shutil.which", + "loopx.chat.endpoint_catalog.shutil.which", lambda executable: executable if executable == "kiro-cli" else None, ) starts = [] @@ -1478,7 +1478,7 @@ def close_session(self): project_grant="workspace_read", ) monkeypatch.setattr( - "loopx.chat_endpoint_catalog.shutil.which", + "loopx.chat.endpoint_catalog.shutil.which", lambda executable: executable if executable in {"kiro-cli", runtime.codex_bin} else None, diff --git a/tests/test_chat_endpoint_readiness.py b/tests/test_chat_endpoint_readiness.py index 5e24d4d50f..a7fd83302b 100644 --- a/tests/test_chat_endpoint_readiness.py +++ b/tests/test_chat_endpoint_readiness.py @@ -5,7 +5,7 @@ import sys from pathlib import Path -from loopx.chat_endpoint_catalog import builtin_chat_endpoints +from loopx.chat.endpoint_catalog import builtin_chat_endpoints def _rows(monkeypatch, tmp_path: Path, **bins: str) -> dict[str, dict]: diff --git a/tests/test_chat_manager_context.py b/tests/test_chat_manager_context.py index 03964ca5c9..ea23a225c5 100644 --- a/tests/test_chat_manager_context.py +++ b/tests/test_chat_manager_context.py @@ -798,7 +798,7 @@ def collect(*args, **kwargs): def test_unread_window_keeps_its_bounds_and_unchanged_seam_default( monkeypatch, tmp_path ): - from loopx.chat_manager_history import read_manager_delivery_history + from loopx.chat.manager_history import read_manager_delivery_history now = datetime.now(timezone.utc) _write_delivery_index( diff --git a/tests/test_chat_manager_details.py b/tests/test_chat_manager_details.py index e738a618ad..4427d19037 100644 --- a/tests/test_chat_manager_details.py +++ b/tests/test_chat_manager_details.py @@ -1,6 +1,6 @@ import pytest -import loopx.chat_manager_details as details +import loopx.chat.manager_details as details from loopx.chat_manager import manager_workspace diff --git a/tests/test_chat_manager_inspection.py b/tests/test_chat_manager_inspection.py index f13553573c..93876765c4 100644 --- a/tests/test_chat_manager_inspection.py +++ b/tests/test_chat_manager_inspection.py @@ -18,8 +18,8 @@ manager_index, ) from loopx.chat_agent import CodexChatAgentSession, CodexChatAgentError -from loopx.chat_manager_history import read_manager_delivery_history -import loopx.chat_manager_details as details +from loopx.chat.manager_history import read_manager_delivery_history +import loopx.chat.manager_details as details from tests.control_plane.host_process_fixture import write_python_host_fixture diff --git a/tests/test_chat_manager_report.py b/tests/test_chat_manager_report.py index 4cf90c834c..c31d3122a3 100644 --- a/tests/test_chat_manager_report.py +++ b/tests/test_chat_manager_report.py @@ -1,7 +1,7 @@ import json from datetime import datetime, timezone -from loopx.chat_manager_history import read_manager_delivery_history +from loopx.chat.manager_history import read_manager_delivery_history from loopx.capabilities.manager_context import evidence_goal_scope, POLICY_SCHEMA @@ -141,7 +141,7 @@ def test_report_retains_concrete_findings_without_fetching_artifacts(tmp_path): def test_detail_missing_invalid_truncated_and_redacted_are_explicit(): - from loopx.chat_manager_history import _recorded_details + from loopx.chat.manager_history import _recorded_details detail = _recorded_details({ "vision_checkpoint": {"unchanged_reason": "x" * 1000}, diff --git a/tests/test_chat_ordinary_project.py b/tests/test_chat_ordinary_project.py index 316102f0e8..6b8fe7dd2f 100644 --- a/tests/test_chat_ordinary_project.py +++ b/tests/test_chat_ordinary_project.py @@ -208,7 +208,7 @@ def test_writable_project_turns_use_project_skills_without_manager_work_selectio def test_workspace_only_rejects_other_executor_before_session_creation(ordinary, monkeypatch, grant): store, runtime, contexts, request, _, _, _ = ordinary contexts.filesystem_scope, contexts.workspace_grant = "workspace_only", grant - monkeypatch.setattr("loopx.chat_endpoint_catalog.shutil.which", + monkeypatch.setattr("loopx.chat.endpoint_catalog.shutil.which", lambda executable: executable if executable == "kiro-cli" else None) monkeypatch.setattr(runtime, "_start_adapter", lambda **_: pytest.fail("must reject before starting a host")) status, result = request("/api/chat/sessions", { @@ -228,7 +228,7 @@ def close_session(self): pass monkeypatch.setattr( - "loopx.chat_endpoint_catalog.shutil.which", + "loopx.chat.endpoint_catalog.shutil.which", lambda executable: executable if executable == "kiro-cli" else None, ) kiro_capability = next(row for row in runtime.capabilities() if row["agent_id"] == "kiro-cli") diff --git a/tests/test_chat_project_coordination.py b/tests/test_chat_project_coordination.py index 7033112f8a..e642c5e69d 100644 --- a/tests/test_chat_project_coordination.py +++ b/tests/test_chat_project_coordination.py @@ -9,7 +9,7 @@ import pytest -from loopx.chat_coordination import PROJECT_CONTEXT_VERSION +from loopx.chat.coordination import PROJECT_CONTEXT_VERSION from loopx.chat_agent import CodexChatAgentSession, CodexChatAgentError from loopx.chat_manager_context import collect_manager_turn_context from loopx.chat_runtime import ChatRuntimeController, CodexAppServerAdapter diff --git a/tests/test_chat_queue_preparation.py b/tests/test_chat_queue_preparation.py index 3b4e5f7ef1..2e5977ef15 100644 --- a/tests/test_chat_queue_preparation.py +++ b/tests/test_chat_queue_preparation.py @@ -13,7 +13,7 @@ import pytest from loopx.chat_agent import CodexChatAgentError -from loopx.chat_coordination import PROJECT_CONTEXT_VERSION +from loopx.chat.coordination import PROJECT_CONTEXT_VERSION from loopx.chat_runtime import ChatRuntimeController, CodexAppServerAdapter from loopx.chat_server import ChatHTTPServer, ChatRequestHandler from loopx.chat_store import ChatSessionStore @@ -555,7 +555,7 @@ def preparation(*args, **kwargs): @pytest.mark.parametrize("delay_stage", ["context", "provider"]) def test_http_stop_retains_fence_until_late_worker_acknowledges(tmp_path, monkeypatch, delay_stage): """A failed stop retains authority; retry settles only after the worker exits.""" - import loopx.chat_coordination as coordination + import loopx.chat.coordination as coordination from loopx.capabilities import manager_context store, sid, runtime = session_runtime(tmp_path) diff --git a/tests/test_managed_research_team.py b/tests/test_managed_research_team.py index 3df964c134..4d78f925bf 100644 --- a/tests/test_managed_research_team.py +++ b/tests/test_managed_research_team.py @@ -19,7 +19,7 @@ from loopx.control_plane.goals.acceptance import ( # noqa: E402 configure_goal_acceptance, inspect_goal_acceptance, verify_goal_acceptance, ) -from loopx.chat_completed_todos import ( # noqa: E402 +from loopx.chat.completed_todos import ( # noqa: E402 CompletedTodoPages, _goal_result_candidates, _verify_goal_result_page, ) from loopx.chat_server import ChatHTTPServer, ChatRequestHandler # noqa: E402 diff --git a/tests/test_manager_report_source.py b/tests/test_manager_report_source.py index c39bce42bc..3c529585a4 100644 --- a/tests/test_manager_report_source.py +++ b/tests/test_manager_report_source.py @@ -236,7 +236,7 @@ def test_actual_canonical_sources_join_a_completed_task_and_fixed_boundaries(tmp "https://example.org:invalid/file", "https://#missing-host", ]) def test_exact_delivery_reference_disclosure_does_not_promote_private_or_unsafe_values(reference): - from loopx.chat_manager_history import _recorded_details + from loopx.chat.manager_history import _recorded_details run = {"agent_vision": {"path_delta": {"evidence_refs": [reference]}}, "progress_observation": {"evidence_ids": ["evidence:original"]}} diff --git a/tests/test_manager_ssh_evidence.py b/tests/test_manager_ssh_evidence.py index 4c83e969ed..eea20b2829 100644 --- a/tests/test_manager_ssh_evidence.py +++ b/tests/test_manager_ssh_evidence.py @@ -19,7 +19,7 @@ from loopx.capabilities.manager_context.inspection import ManagerInspection, TOOL_NAME from loopx.capabilities.manager_context.evidence_export import export_page from loopx.chat_manager_context import manager_authorization_scope_id -from loopx.chat_manager_history import read_manager_delivery_history +from loopx.chat.manager_history import read_manager_delivery_history @pytest.fixture @@ -266,7 +266,7 @@ def unavailable(*_, **__): def test_export_uses_canonical_todos_and_never_returns_owner_private_continuation( tmp_path, monkeypatch, todo_id ): - import loopx.chat_manager_details as details + import loopx.chat.manager_details as details registry = tmp_path / "registry.json" registry.write_text( diff --git a/tests/test_native_steward_turn_host.py b/tests/test_native_steward_turn_host.py index c69b3c8f54..56c9e675af 100644 --- a/tests/test_native_steward_turn_host.py +++ b/tests/test_native_steward_turn_host.py @@ -585,7 +585,7 @@ def gated(adapter, message, sink): def test_inventory_replacement_during_context_read_never_forks_the_original_native_thread(steward, tmp_path, monkeypatch): sid, actor, _ = prepare(steward, "file", tmp_path, monkeypatch) store, runtime, _, _, binding, capture, _ = steward - import loopx.chat_coordination as coordination + import loopx.chat.coordination as coordination prepare_context = coordination.prepare_turn_context def changed(*args, **kwargs):