🔥 Sync 2026-09-05 21:18:46

This commit is contained in:
github-actions[bot] committed 2026-09-05 21:18:46 +08:00
1 parent e88d0b9fed
commit b05ff8a1b6
45 files changed
+506 -272

No files matched your search

@@ -0,0 +1,48 @@
import json
import pathlib
import unittest
APP_DIR = pathlib.Path(__file__).resolve().parents[1]
class DesktopManifestContractTest(unittest.TestCase):
def setUp(self):
self.manifest = json.loads(
(APP_DIR / "files" / "agentflow-plugin.json").read_text()
)
def test_manifest_uses_agentflow_app_base_proxy(self):
self.assertEqual(self.manifest["id"], "agentflow")
self.assertEqual(self.manifest["staticRoot"], "/usr/share/agentflow/www")
self.assertEqual(self.manifest["standalone"]["entry"], "index.html")
self.assertEqual(self.manifest["standalone"]["basePath"], "/apps/agentflow/")
self.assertEqual(
self.manifest["standalone"]["url"],
"/cgi-bin/luci/admin/services/agentflow/open",
)
self.assertEqual(
self.manifest["standalone"]["externalOpen"],
{"enabled": True, "label": "Open AgentFlow"},
)
self.assertEqual(self.manifest["auth"]["mode"], "passthrough")
backend = self.manifest["backend"]
self.assertEqual(backend["upstreamBasePath"], "/apps/agentflow/")
self.assertEqual(backend["pathMode"], "preserve")
self.assertEqual(backend["proxyMode"], "app-base")
def test_desktop_entry_matches_manifest_contract(self):
desktop = self.manifest["desktop"]
self.assertEqual(desktop["mode"], "module")
self.assertEqual(desktop["entry"], "desktop-entry.js")
self.assertEqual(desktop["isolation"], "shadow-dom")
self.assertFalse(
(APP_DIR / "files" / "www" / "desktop-entry.js").exists(),
"desktop-entry.js must be served by AgentFlow backend, not the static iframe wrapper",
)
if __name__ == "__main__":
unittest.main()
+18 -3
View File
@@ -2,12 +2,27 @@ from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parents[3]
APPLICATIONS = ROOT / "applications"
THIS_FILE = Path(__file__).resolve()
def read(relative):
return (APPLICATIONS / relative).read_text()
relative_path = Path(relative)
package = relative_path.parts[0]
app = package[9:] if package.startswith("luci-app-") else package
remainder = Path(*relative_path.parts[1:])
candidates = [
THIS_FILE.parents[index] / relative_path
for index in range(2, min(len(THIS_FILE.parents), 6))
]
candidates.append(THIS_FILE.parents[3] / app / package / remainder)
for candidate in candidates:
if candidate.exists():
return candidate.read_text()
searched = "\n".join(str(candidate) for candidate in candidates)
raise FileNotFoundError(f"{relative} not found; searched:\n{searched}")
class MiseRuntimeContractTest(unittest.TestCase):