⛅ Sync 2026-09-28 17:06:29

This commit is contained in:
github-actions[bot] committed 2026-09-28 17:06:29 +08:00
1 parent 86e1d0663a
commit 8e6f80e195
138 files changed
+975 -606

No files matched your search

@@ -1,9 +1,13 @@
import json
from pathlib import Path
import unittest
APP_DIR = Path(__file__).resolve().parents[1]
META_MAKEFILE = APP_DIR.parent / "app-meta-agentflow/Makefile"
AGENTFLOW_DIR = APP_DIR.parent
META_DIR = AGENTFLOW_DIR / "app-meta-agentflow"
META_MAKEFILE = META_DIR / "Makefile"
RUNTIME_DIR = AGENTFLOW_DIR / "agentflow"
class AgentFlowLuciOpenContractTest(unittest.TestCase):
@@ -18,7 +22,7 @@ class AgentFlowLuciOpenContractTest(unittest.TestCase):
self.assertIn("+luci-lib-linkeaseauth", makefile)
self.assertIn("+linkease-app-entry", makefile)
self.assertIn("PKG_RELEASE:=3", meta)
self.assertIn("PKG_RELEASE:=2", meta)
self.assertIn("META_LUCI_ENTRY:=/cgi-bin/luci/admin/services/agentflow", meta)
self.assertIn('entry({"admin", "services", "agentflow", "open"}', controller)
self.assertIn("open.sysauth = false", controller)
@@ -33,6 +37,50 @@ class AgentFlowLuciOpenContractTest(unittest.TestCase):
self.assertIn('url("admin/services/agentflow/open")', status)
self.assertNotIn('window.location.hostname + ":" + st.port', status)
def test_app_meta_autoconfigures_agentflow_and_exposes_management_entry(self):
meta = META_MAKEFILE.read_text(encoding="utf-8")
config = (META_DIR / "config.sh").read_text(encoding="utf-8")
entry = (META_DIR / "entry.sh").read_text(encoding="utf-8")
self.assertIn("META_AUTOCONF:=path enable", meta)
self.assertIn('[ -n "$ISTORE_CONF_DIR" ] || exit 1', config)
self.assertIn('data_dir="$ISTORE_CONF_DIR/AgentFlow"', config)
self.assertIn('set agentflow.@agentflow[0].enabled="$enabled"', config)
self.assertIn('set agentflow.@agentflow[0].data_dir="$data_dir"', config)
self.assertIn('ISTORE_DONT_START', config)
self.assertIn('if [ "$enabled" = "1" ]; then', config)
self.assertIn('/etc/init.d/agentflow restart', config)
self.assertIn('/etc/init.d/agentflow stop || true', config)
self.assertNotIn('/etc/init.d/agentflow restart || true', config)
self.assertIn('json_add_string "app" "agentflow"', entry)
self.assertIn('json_add_boolean "docker" "0"', entry)
self.assertIn('pidof agentflow', entry)
self.assertIn('json_add_string "web" ":${port}${base_path}"', entry)
self.assertIn(
'json_add_string "href" "/cgi-bin/luci/admin/services/agentflow"',
entry,
)
self.assertIn('/etc/init.d/agentflow start', entry)
self.assertIn('/etc/init.d/agentflow stop', entry)
self.assertNotIn("linkease_apps/open", entry)
def test_app_meta_and_desktop_icons_have_single_owners(self):
manifest = json.loads(
(RUNTIME_DIR / "files/agentflow-plugin.json").read_text(encoding="utf-8")
)
self.assertEqual(manifest["id"], "agentflow")
self.assertEqual(manifest["icon"], "logo.svg")
self.assertEqual(manifest["staticRoot"], "/usr/share/agentflow/www")
self.assertTrue((RUNTIME_DIR / "files/www/logo.svg").is_file())
meta_logo = META_DIR / "logo.png"
self.assertTrue(meta_logo.is_file())
self.assertTrue(meta_logo.read_bytes().startswith(b"\x89PNG\r\n\x1a\n"))
self.assertFalse(
(META_DIR / "root/usr/share/linkeasefull/desktop-apps.d").exists(),
"agentflow runtime already owns the desktop manifest",
)
if __name__ == "__main__":
unittest.main()