36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Run periodic draft and conversation-trash cleanup for one deployment."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from EvoScientist.config import load_config
|
|
from EvoScientist.langgraph_dev.sdk import get_langgraph_sync_client
|
|
from EvoScientist.workspace_maintenance import run_workspace_maintenance
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--workspace", required=True)
|
|
parser.add_argument("--api-url", default="http://127.0.0.1:6174")
|
|
parser.add_argument("--draft-ttl-hours", type=int)
|
|
parser.add_argument("--trash-retention-days", type=int)
|
|
args = parser.parse_args()
|
|
config = load_config()
|
|
report = run_workspace_maintenance(
|
|
workspace_root=Path(args.workspace),
|
|
client=get_langgraph_sync_client(url=args.api_url),
|
|
draft_ttl_hours=args.draft_ttl_hours or config.draft_workspace_ttl_hours,
|
|
trash_retention_days=args.trash_retention_days
|
|
or config.workspace_trash_retention_days,
|
|
)
|
|
print(json.dumps(report, indent=2, sort_keys=True))
|
|
return 0 if not report["errors"] else 2
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|