chore(mma): Checkpoint progress on visual simulation and UI refresh before sub-agent delegation
This commit is contained in:
@@ -57,13 +57,15 @@ def generate_skeleton(code: str) -> str:
|
||||
except Exception as e:
|
||||
return f"# Error generating skeleton: {e}\n{code}"
|
||||
|
||||
def get_model_for_role(role: str) -> str:
|
||||
def get_model_for_role(role: str, failure_count: int = 0) -> str:
|
||||
"""Returns the specific model to use for a given tier role."""
|
||||
if role == 'tier1-orchestrator' or role == 'tier1':
|
||||
return 'gemini-3.1-pro-preview'
|
||||
elif role == 'tier2-tech-lead' or role == 'tier2':
|
||||
return 'gemini-3-flash-preview'
|
||||
elif role == 'tier3-worker' or role == 'tier3':
|
||||
if failure_count > 1:
|
||||
return 'gemini-3-flash'
|
||||
return 'gemini-2.5-flash-lite'
|
||||
elif role == 'tier4-qa' or role == 'tier4':
|
||||
return 'gemini-2.5-flash-lite'
|
||||
@@ -124,8 +126,8 @@ def get_dependencies(filepath: str) -> list[str]:
|
||||
print(f"Error getting dependencies for {filepath}: {e}")
|
||||
return []
|
||||
|
||||
def execute_agent(role: str, prompt: str, docs: list[str], debug: bool = False) -> str:
|
||||
model = get_model_for_role(role)
|
||||
def execute_agent(role: str, prompt: str, docs: list[str], debug: bool = False, failure_count: int = 0) -> str:
|
||||
model = get_model_for_role(role, failure_count)
|
||||
# Advanced Context: Dependency skeletons for Tier 3
|
||||
injected_context = ""
|
||||
# Whitelist of modules that sub-agents have "unfettered" (full) access to.
|
||||
@@ -249,6 +251,12 @@ def create_parser() -> argparse.ArgumentParser:
|
||||
action="store_true",
|
||||
help="Enable debug logging"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--failure-count",
|
||||
type=int,
|
||||
default=0,
|
||||
help="Number of times this task has failed previously"
|
||||
)
|
||||
parser.add_argument(
|
||||
"prompt",
|
||||
type=str,
|
||||
@@ -263,6 +271,7 @@ def main() -> None:
|
||||
role = args.role
|
||||
prompt = args.prompt
|
||||
debug = args.debug
|
||||
failure_count = args.failure_count
|
||||
docs = []
|
||||
if args.task_file and os.path.exists(args.task_file):
|
||||
with open(args.task_file, "rb") as f:
|
||||
@@ -272,6 +281,7 @@ def main() -> None:
|
||||
docs = task_data.get("docs", [])
|
||||
# Only override debug if it's explicitly set in the task file (optional)
|
||||
debug = task_data.get("debug", debug)
|
||||
failure_count = task_data.get("failure_count", failure_count)
|
||||
if not role or not prompt:
|
||||
parser.print_help()
|
||||
return
|
||||
@@ -283,8 +293,8 @@ def main() -> None:
|
||||
for ref in file_refs:
|
||||
if os.path.exists(ref) and ref not in docs:
|
||||
docs.append(ref)
|
||||
print(f"Executing role: {role} with docs: {docs} (debug={debug})")
|
||||
result = execute_agent(role, prompt, docs, debug=debug)
|
||||
print(f"Executing role: {role} with docs: {docs} (debug={debug}, failure_count={failure_count})")
|
||||
result = execute_agent(role, prompt, docs, debug=debug, failure_count=failure_count)
|
||||
print(result)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user