mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-08-12 18:05:31 +00:00
Introduce a WebUI extension manifest and rewrite the asset bundler/server to support caller-supplied entry sets, extension-injected entries, and negotiated gzip. Key changes: add get_webui_extension_manifest() to helpers/extension, refactor Stop logic into stop_context() and reuse it from the connector `/stop` command, and add a new `/rename` slash command for chat naming. ui_bundler now accepts entry_urls, includes enabled extension entry files, raises the embedded text file size limit to 512 KiB, computes per-entry-set cache keys, and returns a bundle version based on the bundle signature. ui_server applies Starlette GZip middleware, adds routes (/, /index.html, /ui/index, /safe), serves splash/safe documents, injects the serialized webui_extension_manifest into the rendered index, and streamlines the /ui/asset-bundle endpoint with ETag and gzip handling. Also add multiple WebUI assets and fonts, new/updated plugin command YAML and Python command handlers, and corresponding tests covering bundling, commands, chat naming, and WebUI behaviors. Documentation (.dox.md) updated to reflect the new runtime contracts and guidance.
67 lines
2.4 KiB
HTML
67 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" data-safe-theme="dark">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
<title>Agent Zero — Safe mode</title>
|
|
<link rel="icon" href="data:,">
|
|
<script>
|
|
try {
|
|
if (localStorage.getItem("darkMode") === "false") document.documentElement.dataset.safeTheme = "light"
|
|
} catch (_) {}
|
|
</script>
|
|
<style>
|
|
html, body { width: 100%; height: 100%; margin: 0; }
|
|
html { background: #131313; color: #fff; }
|
|
html[data-safe-theme="light"] { background: #fafafa; color: #111; }
|
|
body { display: grid; place-items: center; font-family: system-ui, sans-serif; }
|
|
main { display: grid; justify-items: center; gap: .75rem; padding: 2rem; text-align: center; }
|
|
strong { font-size: 1.15rem; }
|
|
p { margin: 0; color: #aaa; }
|
|
html[data-safe-theme="light"] p { color: #666; }
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<main role="status" aria-live="polite">
|
|
<strong>Starting Agent Zero in safe mode</strong>
|
|
<p>Disabling the offline worker before loading the application…</p>
|
|
</main>
|
|
|
|
<script>
|
|
(() => {
|
|
const DIRECT_PARAMETER = "__direct"
|
|
const FALLBACK_TIMEOUT_MS = 3000
|
|
let navigationStarted = false
|
|
|
|
const navigateToApp = () => {
|
|
if (navigationStarted) return
|
|
navigationStarted = true
|
|
const target = new URL(location.href)
|
|
target.pathname = "/safe"
|
|
target.searchParams.set(DIRECT_PARAMETER, "1")
|
|
location.replace(target.href)
|
|
}
|
|
|
|
const fallbackTimer = setTimeout(navigateToApp, FALLBACK_TIMEOUT_MS)
|
|
|
|
const disableServiceWorkers = async () => {
|
|
if (!("serviceWorker" in navigator)) return
|
|
const registrations = await navigator.serviceWorker.getRegistrations()
|
|
await Promise.allSettled(
|
|
registrations.map((registration) => registration.unregister()),
|
|
)
|
|
}
|
|
|
|
disableServiceWorkers()
|
|
.catch((error) => console.warn("Unable to disable service workers.", error))
|
|
.finally(() => {
|
|
clearTimeout(fallbackTimer)
|
|
navigateToApp()
|
|
})
|
|
})()
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|