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
6 changes: 4 additions & 2 deletions loopx/cli_commands/quota_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
from ..control_plane.quota.error_codes import QuotaCommandValidationError, QuotaDecisionTransportError
from ..control_plane.turn_driver.decision_capture import (
validate_handoff_socket, CONTEXT_CAPTURE_READ_GUIDANCE, CONTEXT_CAPTURE_PAGE_GUIDANCE, context_capture_read_command,
NATIVE_CONTEXT_PAGE_BYTES, NATIVE_CONTEXT_PAGE_OUTPUT_BYTES, CONTEXT_CAPTURE_NAVIGATION_GUIDANCE,
native_context_page_budget,
CONTEXT_CAPTURE_NAVIGATION_GUIDANCE,
read_context_capture_file as _read_capture,
read_context_read_reference, write_context_read_reference, private_capture_uid,
)
from ..control_plane.turn_driver.native_context_profile import (
NATIVE_CONTEXT_PAGE_BYTES, NATIVE_CONTEXT_PAGE_OUTPUT_BYTES, native_context_page_budget,
)


def native_context_activation(args: argparse.Namespace) -> dict[str, Any]:
Expand Down
2 changes: 1 addition & 1 deletion loopx/control_plane/quota/effect_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
)
from ..goals.goal_ref_validation import exact_goal_ref
from ..work_items.delivery_batch_scale import DELIVERY_BATCH_SCALE_INPUT_CHOICES
from ..turn_driver.decision_capture import NATIVE_CONTEXT_PAGE_OUTPUT_BYTES
from ..turn_driver.native_context_profile import NATIVE_CONTEXT_PAGE_OUTPUT_BYTES

__all__ = [
"SETTLEMENT_IDENTITY_SCHEMA_VERSION",
Expand Down
5 changes: 4 additions & 1 deletion loopx/control_plane/turn_driver/codex_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
write_decision_capture, capture_context_projection, CONTEXT_CAPTURE_PAGE_GUIDANCE,
capture_page_range, read_context_capture_file, CONTEXT_CAPTURE_NAVIGATION_GUIDANCE,
CONTEXT_CAPTURE_SELECTION_GUIDANCE,
context_capture_read_command, NATIVE_CONTEXT_PAGE_BYTES, NATIVE_CONTEXT_PAGE_OUTPUT_BYTES,
context_capture_read_command,
)
from .native_context_profile import (
NATIVE_CONTEXT_PAGE_BYTES, NATIVE_CONTEXT_PAGE_OUTPUT_BYTES,
NATIVE_CONTEXT_LARGE_OUTPUT_BYTES, NATIVE_CONTEXT_HISTORY_TOKENS, NATIVE_CONTEXT_OUTPUT_ENV,
native_context_page_budget,
)
Expand Down
23 changes: 8 additions & 15 deletions loopx/control_plane/turn_driver/decision_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
from ..quota.turn_envelope import bind_turn_decision_capture
from ..quota.error_codes import QuotaCommandValidationError
from ..content_digest import BARE_SHA256_PATTERN
from .native_context_profile import (
NATIVE_CONTEXT_PAGE_BYTES as NATIVE_CONTEXT_PAGE_BYTES,
NATIVE_CONTEXT_PAGE_OUTPUT_BYTES as NATIVE_CONTEXT_PAGE_OUTPUT_BYTES,
NATIVE_CONTEXT_LARGE_OUTPUT_BYTES as NATIVE_CONTEXT_LARGE_OUTPUT_BYTES,
NATIVE_CONTEXT_HISTORY_TOKENS as NATIVE_CONTEXT_HISTORY_TOKENS,
NATIVE_CONTEXT_OUTPUT_ENV as NATIVE_CONTEXT_OUTPUT_ENV,
native_context_page_budget as native_context_page_budget,
)


def private_capture_uid() -> int:
Expand Down Expand Up @@ -203,21 +211,6 @@ def validate_handoff_socket(value: str) -> Path:
)


# Use the existing configured native output profile for every native caller,
# including App shells that do not inherit the generated environment override.
# Smaller explicit reader budgets remain available for same-capture recovery.
NATIVE_CONTEXT_PAGE_BYTES = 64000
NATIVE_CONTEXT_PAGE_OUTPUT_BYTES = 64000
# Keep the configuration declaration usable by older installed readers too.
NATIVE_CONTEXT_LARGE_OUTPUT_BYTES = 64000
NATIVE_CONTEXT_HISTORY_TOKENS = 20000
NATIVE_CONTEXT_OUTPUT_ENV = "LOOPX_CONTEXT_PAGE_OUTPUT_BYTES"


def native_context_page_budget() -> tuple[int, int]:
return NATIVE_CONTEXT_PAGE_BYTES, NATIVE_CONTEXT_PAGE_OUTPUT_BYTES


def context_capture_read_command(path: Path, digest: str, *, offset: int = 0,
page_bytes: int | None = None,
max_page_output_bytes: int | None = None,
Expand Down
17 changes: 17 additions & 0 deletions loopx/control_plane/turn_driver/native_context_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Native context transport defaults, independent of capture and quota IO."""
from __future__ import annotations


# Use the configured output profile for every native caller, including App
# shells that do not inherit the generated environment override. Smaller
# explicit reader budgets remain available for same-capture recovery.
NATIVE_CONTEXT_PAGE_BYTES = 64000
NATIVE_CONTEXT_PAGE_OUTPUT_BYTES = 64000
# Keep the configuration declaration usable by older installed readers too.
NATIVE_CONTEXT_LARGE_OUTPUT_BYTES = 64000
NATIVE_CONTEXT_HISTORY_TOKENS = 20000
NATIVE_CONTEXT_OUTPUT_ENV = "LOOPX_CONTEXT_PAGE_OUTPUT_BYTES"


def native_context_page_budget() -> tuple[int, int]:
return NATIVE_CONTEXT_PAGE_BYTES, NATIVE_CONTEXT_PAGE_OUTPUT_BYTES
14 changes: 14 additions & 0 deletions tests/architecture/test_control_plane_import_boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,20 @@ def test_read_adapters_do_not_load_writeback_facades_for_leaf_helpers() -> None:
assert completed.returncode == 0, completed.stderr


def test_settlement_plan_import_does_not_load_native_capture_io() -> None:
# A command template needs the native output profile, not capture binding
# or the complete quota/Goal routing graph. Keep the typed kernel usable
# independently of those orchestration owners.
completed = subprocess.run(
[sys.executable, "-c", (
"import sys; import loopx.control_plane.quota.effect_program; "
"assert 'loopx.control_plane.turn_driver.decision_capture' not in sys.modules"
)],
cwd=REPOSITORY_ROOT, capture_output=True, check=False, text=True,
)
assert completed.returncode == 0, completed.stderr


def test_turn_preview_import_does_not_select_report_delivery_or_lark_hosts() -> None:
# A fresh process detects eager package facades and command-only imports;
# the in-process test suite may already have selected these real owners.
Expand Down
Loading