41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""Create an isolated single-stage task without starting its workflow."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from dataclasses import replace
|
|
import json
|
|
from pathlib import Path
|
|
import secrets
|
|
import sys
|
|
|
|
from app.cad_agent.composition import compose_cad_services
|
|
from app.settings import get_settings
|
|
|
|
|
|
def _arguments() -> argparse.Namespace:
|
|
parser = argparse.ArgumentParser(description="Create one isolated Authoring CDSL evaluation task.")
|
|
parser.add_argument("--report-root", required=True, type=Path)
|
|
parser.add_argument("--prompt", required=True)
|
|
parser.add_argument("--task-id")
|
|
return parser.parse_args()
|
|
|
|
|
|
def main() -> int:
|
|
arguments = _arguments()
|
|
root = arguments.report_root.resolve()
|
|
settings = get_settings()
|
|
services = compose_cad_services(replace(
|
|
settings,
|
|
task_root=root / "artifacts",
|
|
conversation_root=root / "conversations",
|
|
))
|
|
task_id = arguments.task_id or f"cad_{secrets.token_hex(6)}"
|
|
services.workflow.create_task(task_id, arguments.prompt)
|
|
print(json.dumps({"task_id": task_id, "report_root": str(root)}, ensure_ascii=False))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|