Make Local Agent desktop dashboard single-instance

This commit is contained in:
A R R R Associates
2026-09-04 14:31:10 +05:30
parent 7bc97be1b1
commit c418dcb45a
6 changed files with 32 additions and 23 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ import io
from pathlib import Path from pathlib import Path
import zipfile import zipfile
ERP_LOCAL_AGENT_VERSION = "1.22.12" ERP_LOCAL_AGENT_VERSION = "1.22.13"
ERP_LOCAL_AGENT_NAME = "ERP Local Agent" ERP_LOCAL_AGENT_NAME = "ERP Local Agent"
RUNTIME_ROOT = Path(__file__).resolve().parent / "local_agent_runtime" RUNTIME_ROOT = Path(__file__).resolve().parent / "local_agent_runtime"
_DETERMINISTIC_ZIP_TIMESTAMP = (2026, 1, 1, 0, 0, 0) _DETERMINISTIC_ZIP_TIMESTAMP = (2026, 1, 1, 0, 0, 0)
@@ -66,7 +66,7 @@ def _build_zip(*, env_text: str | None, include_env: bool, include_admin_readme:
f"ERP Local Agent {ERP_LOCAL_AGENT_VERSION}\n" f"ERP Local Agent {ERP_LOCAL_AGENT_VERSION}\n"
"Existing storage, WebSocket tunnel, dashboard, Tally mapping and client .act functionality are preserved.\n" "Existing storage, WebSocket tunnel, dashboard, Tally mapping and client .act functionality are preserved.\n"
"Existing master/transaction sync and depreciation are preserved. Phase 5 adds neutral historical-ledger evidence read capability for server-side learning.\n" "Existing master/transaction sync and depreciation are preserved. Phase 5 adds neutral historical-ledger evidence read capability for server-side learning.\n"
"Dashboard: http://127.0.0.1:8788\nUpdate dashboard now shows check, download, install, restart and completion progress.\n" "Dashboard: http://127.0.0.1:8788\nDesktop dashboard is single-instance: repeated shortcut clicks focus the existing window without starting another Local Agent.\nUpdate dashboard shows check, download, install, restart and completion progress.\n"
) )
_write_zip_bytes(dst, "README_ERP_LOCAL_AGENT.txt", text.encode("utf-8")) _write_zip_bytes(dst, "README_ERP_LOCAL_AGENT.txt", text.encode("utf-8"))
return buffer.getvalue() return buffer.getvalue()
@@ -275,6 +275,7 @@ class Supervisor:
"check_config.py", "check_config.py",
"check_config.bat", "check_config.bat",
"open_dashboard.bat", "open_dashboard.bat",
"Open ERP Local Agent Dashboard.vbs",
"install_task_scheduler.bat", "install_task_scheduler.bat",
"start_task_scheduler.bat", "start_task_scheduler.bat",
"stop_task_scheduler.bat", "stop_task_scheduler.bat",
@@ -314,6 +315,7 @@ class Supervisor:
"check_config.py", "check_config.py",
"check_config.bat", "check_config.bat",
"open_dashboard.bat", "open_dashboard.bat",
"Open ERP Local Agent Dashboard.vbs",
"install_task_scheduler.bat", "install_task_scheduler.bat",
"start_task_scheduler.bat", "start_task_scheduler.bat",
"stop_task_scheduler.bat", "stop_task_scheduler.bat",
@@ -1,26 +1,22 @@
Option Explicit Option Explicit
Dim fso, shell, baseDir, launcher, pyw, py, cmd Dim shell, fso, root, pythonw, dashboard, command
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell") Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
baseDir = fso.GetParentFolderName(WScript.ScriptFullName) root = fso.GetParentFolderName(WScript.ScriptFullName)
launcher = baseDir & "\ERPAgentDashboard.pyw" pythonw = fso.BuildPath(root, ".venv\Scripts\pythonw.exe")
pyw = baseDir & "\.venv\Scripts\pythonw.exe" dashboard = fso.BuildPath(root, "ERPAgentDashboard.pyw")
py = baseDir & "\.venv\Scripts\python.exe"
If Not fso.FileExists(launcher) Then If Not fso.FileExists(pythonw) Then
MsgBox "ERPAgentDashboard.pyw was not found in " & baseDir, 16, "ERP Local Agent" MsgBox "ERP Local Agent Python environment was not found:" & vbCrLf & pythonw, vbCritical, "ERP Local Agent"
WScript.Quit WScript.Quit 1
End If End If
If fso.FileExists(pyw) Then If Not fso.FileExists(dashboard) Then
cmd = """" & pyw & """ """ & launcher & """" MsgBox "ERP Local Agent dashboard launcher was not found:" & vbCrLf & dashboard, vbCritical, "ERP Local Agent"
ElseIf fso.FileExists(py) Then WScript.Quit 1
cmd = """" & py & """ """ & launcher & """"
Else
MsgBox "ERP Local Agent Python environment was not found.", 16, "ERP Local Agent"
WScript.Quit
End If End If
shell.Run cmd, 0, False command = Chr(34) & pythonw & Chr(34) & " " & Chr(34) & dashboard & Chr(34)
shell.Run command, 0, False
@@ -1,2 +1,2 @@
__version__ = "1.22.12" __version__ = "1.22.13"
AGENT_NAME = "ERP Local Agent" AGENT_NAME = "ERP Local Agent"
@@ -18,10 +18,8 @@ if errorlevel 1 goto :failed
echo ERP Local Agent Supervisor installed and started successfully. echo ERP Local Agent Supervisor installed and started successfully.
echo Use the desktop shortcut "ERP Local Agent Dashboard" to open the local dashboard. echo Use the desktop shortcut "ERP Local Agent Dashboard" to open the local dashboard.
pause
exit /b 0 exit /b 0
:failed :failed
echo ERROR: ERP Local Agent installation failed. Run this file as Administrator. echo ERROR: ERP Local Agent installation failed. Run this file as Administrator.
pause
exit /b 1 exit /b 1
@@ -1,3 +1,16 @@
@echo off @echo off
setlocal
cd /d "%~dp0" cd /d "%~dp0"
wscript.exe "%~dp0Open ERP Local Agent Dashboard.vbs"
if not exist ".venv\Scripts\pythonw.exe" (
echo ERROR: ERP Local Agent Python environment was not found.
exit /b 1
)
if not exist "ERPAgentDashboard.pyw" (
echo ERROR: ERPAgentDashboard.pyw was not found.
exit /b 1
)
start "" ".venv\Scripts\pythonw.exe" "ERPAgentDashboard.pyw"
exit /b 0