@bitseek/hermes-webui 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +213 -0
- package/bin/hermes-webui.mjs +588 -0
- package/package.json +25 -0
- package/scripts/sync-vendor.mjs +74 -0
- package/templates/launchd/com.bitseek.hermes-webui.plist +21 -0
- package/templates/systemd/hermes-webui.service +13 -0
- package/templates/windows/hermes-webui-task.ps1 +3 -0
- package/vendor/agent-frontend-shell/.bitseek-source.json +6 -0
- package/vendor/agent-frontend-shell/.dockerignore +7 -0
- package/vendor/agent-frontend-shell/.env.docker.example +89 -0
- package/vendor/agent-frontend-shell/.env.example +34 -0
- package/vendor/agent-frontend-shell/.github/FUNDING.yml +3 -0
- package/vendor/agent-frontend-shell/.github/workflows/browser-smoke.yml +42 -0
- package/vendor/agent-frontend-shell/.github/workflows/docker-smoke.yml +233 -0
- package/vendor/agent-frontend-shell/.github/workflows/native-windows-startup.yml +132 -0
- package/vendor/agent-frontend-shell/.github/workflows/release.yml +57 -0
- package/vendor/agent-frontend-shell/.github/workflows/tests.yml +88 -0
- package/vendor/agent-frontend-shell/.vscode/launch.json +59 -0
- package/vendor/agent-frontend-shell/.vscode/settings.json +13 -0
- package/vendor/agent-frontend-shell/AGENTS.md +80 -0
- package/vendor/agent-frontend-shell/ARCHITECTURE.md +1658 -0
- package/vendor/agent-frontend-shell/BUGS.md +52 -0
- package/vendor/agent-frontend-shell/CHANGELOG.md +7295 -0
- package/vendor/agent-frontend-shell/CONTRIBUTING.md +205 -0
- package/vendor/agent-frontend-shell/CONTRIBUTORS.md +107 -0
- package/vendor/agent-frontend-shell/DESIGN.md +173 -0
- package/vendor/agent-frontend-shell/Dockerfile +91 -0
- package/vendor/agent-frontend-shell/LICENSE +21 -0
- package/vendor/agent-frontend-shell/README-CUSTOM.md +76 -0
- package/vendor/agent-frontend-shell/README.md +705 -0
- package/vendor/agent-frontend-shell/ROADMAP.md +351 -0
- package/vendor/agent-frontend-shell/SPRINTS.md +147 -0
- package/vendor/agent-frontend-shell/TESTING.md +1932 -0
- package/vendor/agent-frontend-shell/THEMES.md +170 -0
- package/vendor/agent-frontend-shell/api/__init__.py +1 -0
- package/vendor/agent-frontend-shell/api/agent_health.py +392 -0
- package/vendor/agent-frontend-shell/api/agent_sessions.py +782 -0
- package/vendor/agent-frontend-shell/api/auth.py +592 -0
- package/vendor/agent-frontend-shell/api/background.py +87 -0
- package/vendor/agent-frontend-shell/api/clarify.py +238 -0
- package/vendor/agent-frontend-shell/api/commands.py +124 -0
- package/vendor/agent-frontend-shell/api/compression_anchor.py +134 -0
- package/vendor/agent-frontend-shell/api/config.py +5178 -0
- package/vendor/agent-frontend-shell/api/dashboard_probe.py +255 -0
- package/vendor/agent-frontend-shell/api/extensions.py +253 -0
- package/vendor/agent-frontend-shell/api/gateway_chat.py +435 -0
- package/vendor/agent-frontend-shell/api/gateway_watcher.py +230 -0
- package/vendor/agent-frontend-shell/api/goals.py +608 -0
- package/vendor/agent-frontend-shell/api/helpers.py +474 -0
- package/vendor/agent-frontend-shell/api/kanban_bridge.py +1255 -0
- package/vendor/agent-frontend-shell/api/metering.py +194 -0
- package/vendor/agent-frontend-shell/api/models.py +4210 -0
- package/vendor/agent-frontend-shell/api/oauth.py +770 -0
- package/vendor/agent-frontend-shell/api/onboarding.py +1046 -0
- package/vendor/agent-frontend-shell/api/passkeys.py +365 -0
- package/vendor/agent-frontend-shell/api/profiles.py +1499 -0
- package/vendor/agent-frontend-shell/api/providers.py +2175 -0
- package/vendor/agent-frontend-shell/api/request_diagnostics.py +160 -0
- package/vendor/agent-frontend-shell/api/rollback.py +320 -0
- package/vendor/agent-frontend-shell/api/routes.py +13990 -0
- package/vendor/agent-frontend-shell/api/run_journal.py +284 -0
- package/vendor/agent-frontend-shell/api/runner_client.py +156 -0
- package/vendor/agent-frontend-shell/api/runtime_adapter.py +431 -0
- package/vendor/agent-frontend-shell/api/session_discoverability.py +640 -0
- package/vendor/agent-frontend-shell/api/session_events.py +45 -0
- package/vendor/agent-frontend-shell/api/session_lifecycle.py +208 -0
- package/vendor/agent-frontend-shell/api/session_ops.py +207 -0
- package/vendor/agent-frontend-shell/api/session_recovery.py +655 -0
- package/vendor/agent-frontend-shell/api/skill_usage.py +32 -0
- package/vendor/agent-frontend-shell/api/startup.py +128 -0
- package/vendor/agent-frontend-shell/api/state_sync.py +187 -0
- package/vendor/agent-frontend-shell/api/streaming.py +7048 -0
- package/vendor/agent-frontend-shell/api/system_health.py +167 -0
- package/vendor/agent-frontend-shell/api/terminal.py +410 -0
- package/vendor/agent-frontend-shell/api/turn_journal.py +214 -0
- package/vendor/agent-frontend-shell/api/updates.py +1261 -0
- package/vendor/agent-frontend-shell/api/upload.py +322 -0
- package/vendor/agent-frontend-shell/api/usage.py +26 -0
- package/vendor/agent-frontend-shell/api/workspace.py +867 -0
- package/vendor/agent-frontend-shell/api/workspace_git.py +1261 -0
- package/vendor/agent-frontend-shell/api/worktrees.py +357 -0
- package/vendor/agent-frontend-shell/bootstrap.py +492 -0
- package/vendor/agent-frontend-shell/ctl.sh +427 -0
- package/vendor/agent-frontend-shell/docker-compose.custom.yml +26 -0
- package/vendor/agent-frontend-shell/docker-compose.three-container.yml +168 -0
- package/vendor/agent-frontend-shell/docker-compose.two-container.yml +147 -0
- package/vendor/agent-frontend-shell/docker-compose.yml +57 -0
- package/vendor/agent-frontend-shell/docker_init.bash +459 -0
- package/vendor/agent-frontend-shell/docs/CONTRACTS.md +207 -0
- package/vendor/agent-frontend-shell/docs/EXTENSIONS.md +212 -0
- package/vendor/agent-frontend-shell/docs/ISSUES.md +23 -0
- package/vendor/agent-frontend-shell/docs/UIUX-GUIDE.md +196 -0
- package/vendor/agent-frontend-shell/docs/advanced-chat-setup.md +83 -0
- package/vendor/agent-frontend-shell/docs/docker.md +337 -0
- package/vendor/agent-frontend-shell/docs/onboarding-agent-checklist.md +207 -0
- package/vendor/agent-frontend-shell/docs/onboarding.md +202 -0
- package/vendor/agent-frontend-shell/docs/remote-access.md +75 -0
- package/vendor/agent-frontend-shell/docs/rfcs/README.md +53 -0
- package/vendor/agent-frontend-shell/docs/rfcs/agent-source-boundary.md +70 -0
- package/vendor/agent-frontend-shell/docs/rfcs/canonical-session-resolution.md +124 -0
- package/vendor/agent-frontend-shell/docs/rfcs/hermes-run-adapter-contract.md +1079 -0
- package/vendor/agent-frontend-shell/docs/rfcs/turn-journal.md +195 -0
- package/vendor/agent-frontend-shell/docs/rfcs/webui-run-state-consistency-contract.md +157 -0
- package/vendor/agent-frontend-shell/docs/supervisor.md +280 -0
- package/vendor/agent-frontend-shell/docs/troubleshooting.md +132 -0
- package/vendor/agent-frontend-shell/docs/ui-ux/index.html +863 -0
- package/vendor/agent-frontend-shell/docs/ui-ux/two-stage-proposal.html +768 -0
- package/vendor/agent-frontend-shell/docs/why-hermes.md +489 -0
- package/vendor/agent-frontend-shell/docs/workspace-git.md +92 -0
- package/vendor/agent-frontend-shell/docs/wsl-autostart.md +126 -0
- package/vendor/agent-frontend-shell/eslint.runtime-guard.config.mjs +35 -0
- package/vendor/agent-frontend-shell/extensions/bitseek-design-system.md +330 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/apple-touch-icon.png +0 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/empty-logo.svg +739 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/favicon-192.png +0 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/favicon-32.png +0 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/favicon-512.png +0 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/favicon-512.svg +745 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/favicon.ico +0 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/favicon.svg +745 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/titlebar-icon-v2.svg +751 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/titlebar-icon-v3.svg +739 -0
- package/vendor/agent-frontend-shell/extensions/branding/assets/titlebar-icon.svg +745 -0
- package/vendor/agent-frontend-shell/extensions/branding/branding.js +112 -0
- package/vendor/agent-frontend-shell/extensions/branding/config.json +14 -0
- package/vendor/agent-frontend-shell/extensions/branding/manifest.json +53 -0
- package/vendor/agent-frontend-shell/extensions/index.js +67 -0
- package/vendor/agent-frontend-shell/extensions/loader/hermes-loader.js +77 -0
- package/vendor/agent-frontend-shell/extensions/manifest.json +16 -0
- package/vendor/agent-frontend-shell/extensions/pages/ai-teammates/page.css +333 -0
- package/vendor/agent-frontend-shell/extensions/pages/ai-teammates/page.js +487 -0
- package/vendor/agent-frontend-shell/extensions/pages/manifest.json +6 -0
- package/vendor/agent-frontend-shell/extensions/pages/registry.css +56 -0
- package/vendor/agent-frontend-shell/extensions/pages/registry.js +302 -0
- package/vendor/agent-frontend-shell/extensions/themes/bitseek/index.css +93 -0
- package/vendor/agent-frontend-shell/extensions/themes/bitseek/index.js +98 -0
- package/vendor/agent-frontend-shell/install.sh +63 -0
- package/vendor/agent-frontend-shell/mcp_server.py +567 -0
- package/vendor/agent-frontend-shell/package.json +12 -0
- package/vendor/agent-frontend-shell/pyproject.toml +56 -0
- package/vendor/agent-frontend-shell/pytest.ini +3 -0
- package/vendor/agent-frontend-shell/requirements.txt +5 -0
- package/vendor/agent-frontend-shell/server.py +624 -0
- package/vendor/agent-frontend-shell/start.ps1 +210 -0
- package/vendor/agent-frontend-shell/start.sh +65 -0
- package/vendor/agent-frontend-shell/static/apple-touch-icon.png +0 -0
- package/vendor/agent-frontend-shell/static/boot.js +1990 -0
- package/vendor/agent-frontend-shell/static/commands.js +1402 -0
- package/vendor/agent-frontend-shell/static/favicon-192.png +0 -0
- package/vendor/agent-frontend-shell/static/favicon-32.png +0 -0
- package/vendor/agent-frontend-shell/static/favicon-512.png +0 -0
- package/vendor/agent-frontend-shell/static/favicon-512.svg +18 -0
- package/vendor/agent-frontend-shell/static/favicon.ico +0 -0
- package/vendor/agent-frontend-shell/static/favicon.svg +20 -0
- package/vendor/agent-frontend-shell/static/i18n.js +15389 -0
- package/vendor/agent-frontend-shell/static/icons.js +92 -0
- package/vendor/agent-frontend-shell/static/index.html +1506 -0
- package/vendor/agent-frontend-shell/static/login.js +177 -0
- package/vendor/agent-frontend-shell/static/manifest.json +53 -0
- package/vendor/agent-frontend-shell/static/messages.js +3521 -0
- package/vendor/agent-frontend-shell/static/onboarding.js +800 -0
- package/vendor/agent-frontend-shell/static/panels.js +7995 -0
- package/vendor/agent-frontend-shell/static/pwa-startup.js +83 -0
- package/vendor/agent-frontend-shell/static/sessions.js +5165 -0
- package/vendor/agent-frontend-shell/static/style.css +4774 -0
- package/vendor/agent-frontend-shell/static/sw.js +173 -0
- package/vendor/agent-frontend-shell/static/terminal.js +632 -0
- package/vendor/agent-frontend-shell/static/ui.js +8997 -0
- package/vendor/agent-frontend-shell/static/vendor/js-yaml/4.1.0/js-yaml.min.js +2 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Bold.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Italic.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Math-Italic.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Script-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/katex.min.css +1 -0
- package/vendor/agent-frontend-shell/static/vendor/katex/0.16.22/katex.min.js +1 -0
- package/vendor/agent-frontend-shell/static/vendor/smd.min.js +29 -0
- package/vendor/agent-frontend-shell/static/workspace.js +680 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/* Login page — external script, no inline handlers.
|
|
2
|
+
* Loaded by the /login route. Reads data attributes from the form for
|
|
3
|
+
* i18n strings so the server does not need to inject JS literals.
|
|
4
|
+
*/
|
|
5
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
6
|
+
var form = document.getElementById('login-form');
|
|
7
|
+
var input = document.getElementById('pw');
|
|
8
|
+
var passkeyBtn = document.getElementById('passkey-login');
|
|
9
|
+
|
|
10
|
+
if (!form || !input) return;
|
|
11
|
+
|
|
12
|
+
var invalidPw = form.getAttribute('data-invalid-pw') || 'Invalid password';
|
|
13
|
+
var connFailed = form.getAttribute('data-conn-failed') || 'Connection failed';
|
|
14
|
+
|
|
15
|
+
function showErr(msg) {
|
|
16
|
+
var err = document.getElementById('err');
|
|
17
|
+
if (err) { err.textContent = msg; err.style.display = 'block'; }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function hideErr() {
|
|
21
|
+
var err = document.getElementById('err');
|
|
22
|
+
if (err) { err.style.display = 'none'; }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Return the ?next= redirect path if present and safe, otherwise './'
|
|
26
|
+
// Guards against open-redirect: rejects protocol-relative (//evil.com),
|
|
27
|
+
// absolute URLs, backslash variants, and control characters.
|
|
28
|
+
function _safeNextPath() {
|
|
29
|
+
try {
|
|
30
|
+
var raw = new URL(window.location.href).searchParams.get('next');
|
|
31
|
+
if (!raw) return './';
|
|
32
|
+
if (raw.charAt(0) !== '/') return './'; // must be path-absolute
|
|
33
|
+
if (raw.charAt(1) === '/' || raw.charAt(1) === '\\') return './'; // reject // and \\
|
|
34
|
+
if (/[\x00-\x1f\x7f\s]/.test(raw)) return './'; // reject control chars / whitespace
|
|
35
|
+
return raw;
|
|
36
|
+
} catch (_) { return './'; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function doLogin(e) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
var pw = input.value;
|
|
42
|
+
hideErr();
|
|
43
|
+
try {
|
|
44
|
+
var res = await fetch('api/auth/login', {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
headers: { 'Content-Type': 'application/json' },
|
|
47
|
+
body: JSON.stringify({ password: pw }),
|
|
48
|
+
credentials: 'include',
|
|
49
|
+
});
|
|
50
|
+
var data = {};
|
|
51
|
+
try { data = await res.json(); } catch (_) {}
|
|
52
|
+
if (res.ok && data.ok) {
|
|
53
|
+
window.location.href = _safeNextPath();
|
|
54
|
+
} else {
|
|
55
|
+
showErr(data.error || invalidPw);
|
|
56
|
+
}
|
|
57
|
+
} catch (ex) {
|
|
58
|
+
showErr(connFailed);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
form.addEventListener('submit', doLogin);
|
|
63
|
+
|
|
64
|
+
function b64uToBytes(s) {
|
|
65
|
+
s = String(s || '').replace(/-/g, '+').replace(/_/g, '/');
|
|
66
|
+
while (s.length % 4) s += '=';
|
|
67
|
+
var bin = atob(s);
|
|
68
|
+
var out = new Uint8Array(bin.length);
|
|
69
|
+
for (var i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function bytesToB64u(buf) {
|
|
74
|
+
var bytes = new Uint8Array(buf);
|
|
75
|
+
var bin = '';
|
|
76
|
+
for (var i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i]);
|
|
77
|
+
return btoa(bin).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function doPasskeyLogin() {
|
|
81
|
+
if (!window.PublicKeyCredential || !navigator.credentials) return;
|
|
82
|
+
hideErr();
|
|
83
|
+
try {
|
|
84
|
+
passkeyBtn.disabled = true;
|
|
85
|
+
var optRes = await fetch('api/auth/passkey/options', { method: 'POST', body: '{}', credentials: 'include' });
|
|
86
|
+
var optData = await optRes.json();
|
|
87
|
+
if (!optRes.ok || !optData.publicKey) throw new Error(optData.error || 'Passkey unavailable');
|
|
88
|
+
var pk = optData.publicKey;
|
|
89
|
+
pk.challenge = b64uToBytes(pk.challenge);
|
|
90
|
+
if (Array.isArray(pk.allowCredentials)) {
|
|
91
|
+
pk.allowCredentials = pk.allowCredentials.map(function (c) { return Object.assign({}, c, { id: b64uToBytes(c.id) }); });
|
|
92
|
+
}
|
|
93
|
+
var cred = await navigator.credentials.get({ publicKey: pk });
|
|
94
|
+
if (!cred) throw new Error('Passkey sign-in cancelled');
|
|
95
|
+
var payload = {
|
|
96
|
+
id: cred.id,
|
|
97
|
+
rawId: bytesToB64u(cred.rawId),
|
|
98
|
+
type: cred.type,
|
|
99
|
+
response: {
|
|
100
|
+
authenticatorData: bytesToB64u(cred.response.authenticatorData),
|
|
101
|
+
clientDataJSON: bytesToB64u(cred.response.clientDataJSON),
|
|
102
|
+
signature: bytesToB64u(cred.response.signature),
|
|
103
|
+
userHandle: cred.response.userHandle ? bytesToB64u(cred.response.userHandle) : null,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
var res = await fetch('api/auth/passkey/login', {
|
|
107
|
+
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
|
108
|
+
body: JSON.stringify(payload), credentials: 'include',
|
|
109
|
+
});
|
|
110
|
+
var data = {};
|
|
111
|
+
try { data = await res.json(); } catch (_) {}
|
|
112
|
+
if (res.ok && data.ok) window.location.href = _safeNextPath();
|
|
113
|
+
else showErr(data.error || invalidPw);
|
|
114
|
+
} catch (ex) {
|
|
115
|
+
showErr(ex && ex.message ? ex.message : connFailed);
|
|
116
|
+
} finally {
|
|
117
|
+
passkeyBtn.disabled = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (passkeyBtn && window.PublicKeyCredential && navigator.credentials) {
|
|
122
|
+
fetch('api/auth/status', { credentials: 'include' })
|
|
123
|
+
.then(function (r) { return r.ok ? r.json() : null; })
|
|
124
|
+
.then(function (s) { if (s && s.passkeys_enabled) passkeyBtn.style.display = 'block'; })
|
|
125
|
+
.catch(function () {});
|
|
126
|
+
passkeyBtn.addEventListener('click', doPasskeyLogin);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
input.addEventListener('keydown', function (e) {
|
|
130
|
+
if (e.key === 'Enter') {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
doLogin(e);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// On page load, probe the server so we can distinguish "can't reach server"
|
|
137
|
+
// (Tailscale off, wrong network) from "session expired / need to log in".
|
|
138
|
+
// Uses /health — public for WebUI auth, but deployment access proxies may
|
|
139
|
+
// require same-origin cookies before the request reaches WebUI.
|
|
140
|
+
// If unreachable, retries every 3 s and auto-reloads once the server is back.
|
|
141
|
+
(function checkConnectivity() {
|
|
142
|
+
var retryTimer = null;
|
|
143
|
+
|
|
144
|
+
function setFormDisabled(disabled) {
|
|
145
|
+
if (input) input.disabled = disabled;
|
|
146
|
+
var btn = form.querySelector('button');
|
|
147
|
+
if (btn) btn.disabled = disabled;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function probe() {
|
|
151
|
+
fetch('health', { method: 'GET', credentials: 'same-origin' })
|
|
152
|
+
.then(function (r) {
|
|
153
|
+
if (r.ok) {
|
|
154
|
+
// Server is reachable — if we were in retry mode, reload so the
|
|
155
|
+
// page reflects the correct auth state (expired session, etc.).
|
|
156
|
+
if (retryTimer !== null) {
|
|
157
|
+
clearTimeout(retryTimer);
|
|
158
|
+
retryTimer = null;
|
|
159
|
+
window.location.reload();
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
showErr(connFailed + ' (server error ' + r.status + ')');
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
.catch(function () {
|
|
166
|
+
showErr('Cannot reach server — check your VPN / Tailscale connection.');
|
|
167
|
+
setFormDisabled(true);
|
|
168
|
+
// Keep retrying so the page auto-recovers once the network is back.
|
|
169
|
+
if (retryTimer === null) {
|
|
170
|
+
retryTimer = setInterval(probe, 3000);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
probe();
|
|
176
|
+
})();
|
|
177
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "./",
|
|
3
|
+
"name": "Hermes",
|
|
4
|
+
"short_name": "Hermes",
|
|
5
|
+
"description": "Hermes AI Agent Web UI",
|
|
6
|
+
"start_url": "./?source=pwa",
|
|
7
|
+
"scope": "./",
|
|
8
|
+
"display": "standalone",
|
|
9
|
+
"display_override": ["window-controls-overlay", "standalone", "minimal-ui"],
|
|
10
|
+
"background_color": "#0D0D1A",
|
|
11
|
+
"theme_color": "#0D0D1A",
|
|
12
|
+
"orientation": "portrait-primary",
|
|
13
|
+
"categories": ["productivity", "utilities"],
|
|
14
|
+
"shortcuts": [
|
|
15
|
+
{
|
|
16
|
+
"name": "New conversation",
|
|
17
|
+
"short_name": "New chat",
|
|
18
|
+
"description": "Open Hermes ready for a new chat",
|
|
19
|
+
"url": "./?source=pwa&action=new-chat",
|
|
20
|
+
"icons": [
|
|
21
|
+
{
|
|
22
|
+
"src": "static/favicon-192.png",
|
|
23
|
+
"sizes": "192x192",
|
|
24
|
+
"type": "image/png"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"icons": [
|
|
30
|
+
{
|
|
31
|
+
"src": "static/favicon.svg",
|
|
32
|
+
"sizes": "any",
|
|
33
|
+
"type": "image/svg+xml",
|
|
34
|
+
"purpose": "any maskable"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"src": "static/favicon-32.png",
|
|
38
|
+
"sizes": "32x32",
|
|
39
|
+
"type": "image/png"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"src": "static/favicon-192.png",
|
|
43
|
+
"sizes": "192x192",
|
|
44
|
+
"type": "image/png"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"src": "static/favicon-512.png",
|
|
48
|
+
"sizes": "512x512",
|
|
49
|
+
"type": "image/png",
|
|
50
|
+
"purpose": "any maskable"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|