Wenchao An 6d5d7bb1d5
feat(subagents): add opt-in parent context snapshots (#5367)
* feat(subagents): add opt-in parent context snapshots

* test(subagents): package synthetic snapshot evaluation

* fix(subagents): preserve output text and defer snapshot capture

* docs(subagents): keep snapshot guidance within chain budget

* fix(subagents): omit unpaired tool calls from snapshots

* fix(subagents): safely omit unserializable snapshot media
2026-09-12 16:20:31 +08:00

36 lines
1.4 KiB
Python

"""Manual CLI: imports the live runtime only for the explicit run-live command."""
import argparse
import asyncio
import json
from pathlib import Path
from .cases import CASES
from .report import summarize
def main():
parser = argparse.ArgumentParser(description=__doc__)
commands = parser.add_subparsers(dest="command", required=True)
live = commands.add_parser("run-live", help="Call an explicitly configured external model; never run by pytest")
live.add_argument("--output-dir", type=Path, required=True, help="New directory for local artifacts and metadata")
live.add_argument("--config", type=Path, default=Path(__file__).with_name("config.json"))
live.add_argument("--case", choices=[case.name for case in CASES], action="append", dest="cases")
live.add_argument("--repetitions", type=int, default=1)
report = commands.add_parser("summarize", help="Recompute statistics offline from metadata-only rows")
report.add_argument("rows", type=Path)
args = parser.parse_args()
if args.command == "summarize":
rows = [json.loads(line) for line in args.rows.read_text(encoding="utf-8").splitlines() if line.strip()]
print(json.dumps(summarize(rows), indent=2))
return
if args.repetitions < 1:
parser.error("--repetitions must be positive")
from .runner import run_live
asyncio.run(run_live(args))
if __name__ == "__main__":
main()