Skip to content

The agent that grows with you

fix(gateway): recognize bundled launcher bootstrap

Yuan Li7e247c44a65b
diff --git a/gateway/status_inline_source.py b/gateway/status_inline_source.py
index 085c10b896e..64671584529 100644
--- a/gateway/status_inline_source.py
+++ b/gateway/status_inline_source.py
@@ -89,6 +89,11 @@ _BOOTSTRAPS = (
("exec", re.compile(r"import sys, runpy; sys\.path\.insert\(.*?;\s*exec\((?P<target>.+)\)", re.DOTALL)),
# hermes_cli._launchers._launcher_script (the published POSIX shell / Windows .cmd launcher)
("entry", re.compile(r"import os, re, sys\s.*\bfrom\s+(?P<target>[\w.]+)\s+import\s+(?P<func>\w+)\b.*\bsys\.exit\(\s*(?P=func)\(\)\s*\)", re.DOTALL)),
+ # scripts/build/launchers.py::posix_launcher (the bundled/Docker payload's bin/hermes)
+ ("entry", re.compile(
+ r"import os, site, sys;.*\bsite\.addsitedir\(os\.environ\[['\"]HERMES_SITE['\"]\]\);"
+ r"\s*from\s+(?P<target>[\w.]+)\s+import\s+(?P<func>\w+)\s*;\s*sys\.exit\(\s*(?P=func)\(\)\s*\)",
+ re.DOTALL)),
# hermes_cli._launchers._write_cmd_launcher: the launcher script, base64-encoded
("base64", re.compile(rf"import base64; exec\(base64\.b64decode\({_Q}(?P<target>[A-Za-z0-9+/=]+){_Q}\)\)")),
)