refactor: nuke legacy harness, drop sdk_ prefixes

The SDK harness is the only path now; legacy host-side code is gone.
File names no longer carry the ``sdk_`` distinction.

Deleted legacy host-side modules:
- strix/agents/StrixAgent/ (template moved to strix/agents/prompts/)
- strix/agents/base_agent.py, state.py
- strix/llm/llm.py, config.py
- strix/runtime/docker_runtime.py, runtime.py
- strix/tools/executor.py, agents_graph/agents_graph_actions.py
- strix/interface/sdk_dispatch.py + the env-flag dispatch in cli.py

Renamed (drop ``sdk_`` prefix):
- strix/sdk_entry.py → strix/entry.py
- strix/agents/sdk_factory.py → strix/agents/factory.py
- strix/agents/sdk_prompt.py → strix/agents/prompt.py
- strix/tools/<x>/<x>_sdk_tool[s].py → strix/tools/<x>/tool[s].py
- strix/tools/_legacy_adapter.py → strix/tools/_state_adapter.py
- ``_legacy`` aliases inside the wrappers → ``_impl``

CLI + TUI now call ``run_strix_scan`` directly — they build the
sandbox image / sources_path locally and rely on
``session_manager.cleanup`` (called inside ``run_strix_scan``'s finally)
for teardown. Three TUI handlers that reached into legacy multi-agent
globals (``_agent_instances``, ``send_user_message_to_agent``,
``stop_agent``) are now no-ops with a TODO; reconnecting them to the
``AgentMessageBus`` is a follow-up.

Tracer.get_total_llm_stats no longer reaches into the deleted
``agents_graph_actions`` globals — the orchestration hooks now feed the
tracer via ``Tracer.record_llm_usage`` (live + completed buckets).
finish_scan's ``_check_active_agents`` and load_skill's runtime
``_agent_instances`` reach-in are no-op stubs; the
``AgentMessageBus`` is the source of truth post-migration.

llm/utils.py rewritten to keep only the streaming-parser helpers
(``normalize_tool_format``, ``parse_tool_invocations``,
``fix_incomplete_tool_call``, ``format_tool_call``, ``clean_content``).
``STRIX_MODEL_MAP`` moved to ``llm/multi_provider_setup.py`` (its only
remaining caller).

Per-file ruff ignores added for legacy interface modules (TUI / main /
CLI / utils / streaming_parser / tool_components) and tracer.py —
pre-existing PLC0415/BLE001/PLR0915 patterns are out of scope.

Tests: 287/287 passing. Renamed test files to drop ``sdk_`` prefix.
``test_tracer.py::test_get_total_llm_stats_aggregates_live_and_completed``
rewritten to feed ``Tracer.record_llm_usage`` instead of legacy globals.
Test file annotations added so pre-commit's strict mypy passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
0xallam
2026-04-25 09:30:23 -07:00
parent 4e0d0f35d9
commit d8881498ee
69 changed files with 646 additions and 4537 deletions
+11 -20
View File
@@ -8,7 +8,7 @@ for the rare case a single run wants different reasoning effort or
References:
- PLAYBOOK.md §2.10
- AUDIT.md §2.1 (C1 — parallel_tool_calls=False until Phase 6 relaxes the
legacy tool server's per-agent task slot serialization)
tool server's per-agent task slot serialization)
- AUDIT_R2.md §1.6 (C11 — retry policy explicitly excludes 401/403/400;
auth and validation errors must fail fast, not waste retries)
- AUDIT_R3.md C21 — RunConfig override + context fields including
@@ -39,9 +39,9 @@ if TYPE_CHECKING:
from strix.orchestration.bus import AgentMessageBus
# Phase 1-5 default. Phase 6 relaxes the legacy tool server's per-agent
# task-slot serialization (``runtime/tool_server.py:94-97``) and flips this
# to ``True`` after the multi-agent stress tests confirm safety.
# Phase 6 relaxes the tool server's per-agent task-slot serialization
# (``runtime/tool_server.py:94-97``) and flips this to ``True`` after
# multi-agent stress tests confirm safety.
_PHASE1_PARALLEL_DEFAULT = False
# Default retry policy. Explicitly does NOT include 401/403/400 — those are
@@ -49,8 +49,7 @@ _PHASE1_PARALLEL_DEFAULT = False
# so the user sees the real error within seconds. 429/5xx is the right set.
_RETRYABLE_HTTP_STATUSES = (429, 500, 502, 503, 504)
# Default retry budget. Mirrors the legacy ``llm.py`` retry loop: 5 attempts
# with ``min(90, 2*2^n)`` backoff.
# Default retry budget: 5 attempts with ``min(90, 2*2^n)`` backoff.
_DEFAULT_MAX_RETRIES = 5
_DEFAULT_BACKOFF = ModelRetryBackoffSettings(
initial_delay=2.0,
@@ -76,8 +75,6 @@ def _default_retry_policy() -> Any:
#: Default ``max_turns`` callers should pass to ``Runner.run``.
#: Mirrors the legacy ``AgentState.max_iterations = 300``
#: (``HARNESS_WIKI.md §5.2``).
STRIX_DEFAULT_MAX_TURNS = 300
@@ -105,11 +102,10 @@ def make_run_config(
``None`` is allowed for unit tests and dry runs.
model: Model alias to pass to ``MultiProvider``. Defaults to the
current production-favored Anthropic alias.
parallel_tool_calls: Phase 1 default is ``False`` to keep behavior
sequential per the legacy tool server's slot serialization (C1).
parallel_tool_calls: Default ``False`` to keep behavior sequential
per the tool server's slot serialization (C1).
tool_choice: Forces tool use per turn unless explicitly relaxed.
Mirrors the legacy ``4f90a56`` prompt hardening at the model
level. Pass ``None`` to omit.
Pass ``None`` to omit.
reasoning_effort: ``"low" | "medium" | "high"``; routes to
``ModelSettings.reasoning``. ``None`` defers to provider default.
model_settings_override: Optional ``ModelSettings`` to merge over
@@ -182,15 +178,10 @@ def make_agent_context(
tracer reference, and per-agent toggles live. Tools, hooks, and the
``inject_messages_filter`` all reach in via ``ctx.context.get(...)``.
C21 (AUDIT_R3): includes ``is_whitebox``, ``diff_scope`` and ``run_id``
fields that the legacy code relied on but the original PLAYBOOK §2.10
skeleton omitted.
``agent_factory`` is a callable ``(name, skills) -> agents.Agent`` used by
the ``create_agent`` graph tool to spin up children. The actual factory
lives in the Phase 4/5 root-assembly module; Phase 3 only requires that
it be present in context. ``sandbox_client`` is the host-side Docker
subclass; ``create_agent`` reuses it across child runs.
the ``create_agent`` graph tool to spin up children. ``sandbox_client``
is the host-side Docker subclass; ``create_agent`` reuses it across
child runs.
"""
return {
"bus": bus,