Enforce single instance Local Agent supervisor worker and dashboard

This commit is contained in:
A R R R Associates
2026-09-03 14:03:26 +05:30
parent 010d0969b4
commit 5dce7f16f9
7 changed files with 267 additions and 3 deletions
+12 -1
View File
@@ -4,7 +4,7 @@ import io
from pathlib import Path
import zipfile
ERP_LOCAL_AGENT_VERSION = "1.22.2"
ERP_LOCAL_AGENT_VERSION = "1.22.3"
ERP_LOCAL_AGENT_NAME = "ERP Local Agent"
RUNTIME_ROOT = Path(__file__).resolve().parent / "local_agent_runtime"
_DETERMINISTIC_ZIP_TIMESTAMP = (2026, 1, 1, 0, 0, 0)
@@ -48,6 +48,17 @@ def _build_zip(*, env_text: str | None, include_env: bool, include_admin_readme:
if not path.is_file() or "__pycache__" in path.parts:
continue
_write_zip_bytes(dst, path.relative_to(RUNTIME_ROOT).as_posix(), path.read_bytes())
# Self-healing desktop launchers. Older supervisors update only the
# erp_local_agent package, so place canonical copies inside the worker
# package as data. The updated worker promotes them to INSTALL_ROOT.
for helper_name in ("ERPAgentSupervisor.pyw", "ERPAgentDashboard.pyw"):
helper = RUNTIME_ROOT / helper_name
if helper.is_file():
_write_zip_bytes(
dst,
f"erp_local_agent/_desktop_runtime/{helper_name}",
helper.read_bytes(),
)
if include_env and env_text is not None:
_write_zip_bytes(dst, ".env", env_text.encode("utf-8"))
if include_admin_readme: