feat(mma): Phase 1 — source_tier tagging at emission

- ai_client: add current_tier module var; stamp source_tier on every _append_comms entry
- multi_agent_conductor: set current_tier='Tier 3' around send(), clear in finally
- conductor_tech_lead: set current_tier='Tier 2' around send(), clear in finally
- gui_2: _on_tool_log captures current_tier; _append_tool_log stores dict with source_tier
- tests: 8 new tests covering current_tier, source_tier in comms, tool log dict format
This commit is contained in:
2026-03-02 16:18:00 -05:00
parent 264b04f060
commit 8d9f25d0ce
5 changed files with 152 additions and 14 deletions

View File

@@ -89,6 +89,9 @@ comms_log_callback: Callable[[dict[str, Any]], None] | None = None
# Signature: (script: str, result: str) -> None
tool_log_callback: Callable[[str, str], None] | None = None
# Set by caller tiers before ai_client.send(); cleared in finally.
# Safe — ai_client.send() calls are serialized by the MMA engine executor.
current_tier: str | None = None
# Increased to allow thorough code exploration before forcing a summary
MAX_TOOL_ROUNDS: int = 10
@@ -134,12 +137,13 @@ COMMS_CLAMP_CHARS: int = 300
def _append_comms(direction: str, kind: str, payload: dict[str, Any]) -> None:
entry = {
"ts": datetime.datetime.now().strftime("%H:%M:%S"),
"direction": direction,
"kind": kind,
"provider": _provider,
"model": _model,
"payload": payload,
"ts": datetime.datetime.now().strftime("%H:%M:%S"),
"direction": direction,
"kind": kind,
"provider": _provider,
"model": _model,
"payload": payload,
"source_tier": current_tier, # set/cleared by caller tiers; None for main-session calls
}
_comms_log.append(entry)
if comms_log_callback is not None: