50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Run the durable conversation-workspace migration against a local backend."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
from EvoScientist.langgraph_dev.sdk import get_langgraph_sync_client
|
|
from EvoScientist.workspace_cutover import run_workspace_cutover
|
|
|
|
|
|
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("--assistant-id", default="EvoScientist")
|
|
parser.add_argument(
|
|
"--webui-root",
|
|
default=str(Path(__file__).resolve().parents[2] / "EvoScientist-WebUI"),
|
|
)
|
|
args = parser.parse_args()
|
|
try:
|
|
gate = subprocess.run(
|
|
["npm", "run", "verify:workspace-isolation"],
|
|
cwd=args.webui_root,
|
|
check=False,
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT,
|
|
text=True,
|
|
timeout=120,
|
|
)
|
|
browser_sdk_gate = gate.returncode == 0
|
|
except (OSError, subprocess.TimeoutExpired):
|
|
browser_sdk_gate = False
|
|
report = run_workspace_cutover(
|
|
workspace_root=Path(args.workspace),
|
|
client=get_langgraph_sync_client(url=args.api_url),
|
|
assistant_id=args.assistant_id,
|
|
browser_sdk_gate=browser_sdk_gate,
|
|
)
|
|
print(json.dumps(report, indent=2, sort_keys=True))
|
|
return 0 if report["status"] == "passed" else 2
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|