The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(gateway): read a registered Windows Scheduled Task back as namespace-agnostic XML leaves
KoNit-K60b6435526e2
diff --git a/hermes_cli/gateway_windows.py b/hermes_cli/gateway_windows.pyindex fc6325dccb5..425f86ea2d9 100644--- a/hermes_cli/gateway_windows.py+++ b/hermes_cli/gateway_windows.py@@ -21,6 +21,7 @@ import timeimport uuidfrom datetime import datetime, timezonefrom pathlib import Path+from xml.etree import ElementTreefrom xml.sax.saxutils import escapefrom hermes_cli._subprocess_compat import (@@ -1203,6 +1204,37 @@ def is_startup_entry_installed() -> bool:return get_startup_entry_path().exists() or _legacy_startup_entry_path().exists()+def _query_scheduled_task_xml(task_name: str) -> str | None:+ """Return a registered task's XML, or ``None`` when it cannot be inspected (fail open: a+ localized ``schtasks`` failure is not evidence about an otherwise working task)."""+ code, out, err = _exec_schtasks(["/Query", "/TN", task_name, "/XML"])+ if code != 0 or not out.strip():+ logger.debug("Could not query Scheduled Task XML for %r: %s", task_name, (err or out).strip())+ return None+ return out+++def _task_xml_leaf_values(xml: str) -> dict[str, str] | None:+ """Namespace-agnostic ``Task/Settings/...`` leaf-path → text map, or ``None`` for invalid XML.+ The root ``version`` attribute is exposed as ``Task@version``."""+ try:+ root = ElementTree.fromstring(xml)+ except ElementTree.ParseError:+ return None+ values: dict[str, str] = {"Task@version": root.attrib.get("version", "")}++ def visit(element: ElementTree.Element, path: tuple[str, ...]) -> None:+ current_path = (*path, element.tag.rsplit("}", 1)[-1])+ children = list(element)+ if not children:+ values["/".join(current_path)] = " ".join((element.text or "").split())+ for child in children:+ visit(child, current_path)++ visit(root, ())+ return values++def is_installed() -> bool:"""True when either the schtasks entry or the Startup fallback is present."""return is_task_registered() or is_startup_entry_installed()