Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions loopx/capabilities/manager_context/inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion loopx/capabilities/manager_context/report_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion loopx/capabilities/native_chat/model_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion loopx/capabilities/periodic_report/private_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "本期来源覆盖",
Expand Down
14 changes: 7 additions & 7 deletions loopx/chat_completed_todos.py → loopx/chat/completed_todos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 = []
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
24 changes: 12 additions & 12 deletions loopx/chat_coordination.py → loopx/chat/coordination.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand All @@ -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:
Expand Down Expand Up @@ -146,21 +146,21 @@ 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 {},
)
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":
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions loopx/chat_manager_history.py → loopx/chat/manager_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions loopx/chat_manager_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions loopx/chat_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions loopx/chat_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion loopx/chat_status_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion loopx/control_plane/status/goal_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/architecture/top_level_module_budget.json
Original file line number Diff line number Diff line change
@@ -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"]
}
2 changes: 1 addition & 1 deletion tests/capabilities/test_codex_subagent_host_capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/control_plane/test_peer_source_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion tests/control_plane/test_subagent_model_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/control_plane/test_succession_provider_readback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/control_plane/test_todo_projection_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
Loading
Loading