Model Registry: - Add per-user custom roles (add/remove via UI); required roles chat/orchestrator/distill are always present and cannot be removed - Auto-migrate legacy .env-defined roles to custom_roles on first access - Role config panel (gear): Remove role button moved inside panel; required badge below name - Role select: Primary + Backup slots only (was three) Settings pages — Tailwind CSS migration (CDN, preflight: false): - local_llm.html, settings.html, help.html, notifications.html, tools_settings.html, crons.html, integrations.html all migrated; pg-* color tokens; dark/light via data-theme pg.css fixes: - input[type=checkbox/radio]: width: auto — prevents pg.css width:100% from stretching checkboxes - btn-submit: responsive sizing via Tailwind w-full md:w-96 on each button (no longer full-width on desktop) Documentation: - MASTER.md, TODO__Agents.md: remove "/ Inara" from titles; description updated to "per-user AI personas" - HELP.md: persona-agnostic language throughout (NC Talk, Google Chat, push, schedules, HA sections); roles section restructured to show required vs. custom roles with examples - notifications.html: subtitle and HA description use "your persona" not "Inara" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
349 lines
16 KiB
HTML
349 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Cortex — Notifications</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script>
|
|
tailwind.config = {
|
|
corePlugins: { preflight: false },
|
|
darkMode: ['selector', '[data-theme="dark"]'],
|
|
theme: {
|
|
extend: {
|
|
colors: {
|
|
pg: {
|
|
bg: 'var(--pg-bg)',
|
|
surface: 'var(--pg-surface)',
|
|
border: 'var(--pg-border)',
|
|
text: 'var(--pg-text)',
|
|
muted: 'var(--pg-muted)',
|
|
dim: 'var(--pg-dim)',
|
|
dimmer: 'var(--pg-dimmer)',
|
|
bright: 'var(--pg-bright)',
|
|
accent: 'var(--pg-accent)',
|
|
action: 'var(--pg-action)',
|
|
}
|
|
},
|
|
fontFamily: { sans: ['Inter', 'system-ui', 'sans-serif'] }
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<link rel="stylesheet" href="/static/pg.css">
|
|
<script>(function(){var t=localStorage.getItem('theme')||(window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light');document.documentElement.setAttribute('data-theme',t);})();</script>
|
|
<style>
|
|
/* ── Channel collapsible arrow ── */
|
|
details.channel-block summary::-webkit-details-marker { display: none; }
|
|
details.channel-block summary::before {
|
|
content: '▶'; font-size: 0.65rem; color: var(--pg-dimmer);
|
|
transition: transform 0.15s; flex-shrink: 0;
|
|
}
|
|
details.channel-block[open] summary::before { transform: rotate(90deg); }
|
|
details.channel-block[open] summary { border-bottom: 1px solid var(--pg-border); }
|
|
|
|
/* ── Test result feedback (JS-toggled display) ── */
|
|
#test-result { display: none; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<nav class="page-nav">
|
|
<a href="{{ back_href }}" class="nav-link">← Chat</a>
|
|
<a href="{{ help_href }}" class="nav-link">Help</a>
|
|
<a href="/settings" class="nav-link">Settings</a>
|
|
<a href="/settings/models" class="nav-link">Models</a>
|
|
<a href="/settings/notifications" class="nav-link active">Notifications</a>
|
|
<a href="/settings/tools" class="nav-link">Tools</a>
|
|
<a href="/settings/crons" class="nav-link">Schedules</a>
|
|
{{ integrations_nav }}
|
|
<span class="nav-spacer"></span>
|
|
<a href="/logout" class="nav-link nav-logout">Sign out</a>
|
|
</nav>
|
|
<div class="page-wrap">
|
|
<h1 class="page-title">Notifications</h1>
|
|
<p class="page-subtitle">How your persona reaches out proactively — reminders, cron jobs, and memory digests.</p>
|
|
|
|
<!-- SUCCESS -->
|
|
<!-- ERROR -->
|
|
|
|
<form method="POST" action="/settings/notifications">
|
|
|
|
<!-- Channel selector -->
|
|
<div class="section">
|
|
<h2>Channel</h2>
|
|
<div class="field">
|
|
<label for="notification_channel">Default outbound channel</label>
|
|
<select id="notification_channel" name="notification_channel"
|
|
data-value="{{ notify_channel }}">
|
|
<option value="">None (disabled)</option>
|
|
<option value="web_push">Browser Push Notification</option>
|
|
<option value="email">Email</option>
|
|
<option value="nextcloud">Nextcloud Talk</option>
|
|
<option value="google_chat">Google Chat</option>
|
|
</select>
|
|
<p class="hint">Used for reminder alerts, distillation summaries, and cron job notifications.</p>
|
|
</div>
|
|
<div class="field">
|
|
<label for="notification_email">
|
|
Email address override
|
|
<span class="font-normal text-pg-dim">(optional)</span>
|
|
</label>
|
|
<input type="email" id="notification_email" name="notification_email"
|
|
value="{{ notify_email_override }}"
|
|
placeholder="Leave blank to use your login email"
|
|
autocomplete="off">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Nextcloud Talk -->
|
|
<div class="section">
|
|
<h2>Nextcloud Talk</h2>
|
|
<p class="section-note">
|
|
Configure to send and receive messages via your Nextcloud Talk bot.
|
|
<strong>Sending</strong> requires the bot URL, secret, and notification room.
|
|
<strong>Reading history</strong> (<code>nc_talk_history</code> tool) additionally
|
|
requires a Nextcloud username and app password.
|
|
</p>
|
|
|
|
<details class="channel-block border border-pg-border rounded-lg overflow-hidden mb-3"
|
|
{{ nc_url and 'open' or '' }}>
|
|
<summary class="flex items-center gap-2 px-4 py-3 text-sm font-semibold text-pg-muted cursor-pointer select-none bg-pg-bg">
|
|
Bot credentials (sending)
|
|
</summary>
|
|
<div class="px-4 pt-4 pb-2">
|
|
<p class="text-xs text-pg-dimmer -mt-1 mb-4 leading-relaxed">
|
|
Set these up in your Nextcloud Talk room → Bot settings.
|
|
See the <a href="/help" class="text-pg-accent">setup guide</a> for step-by-step instructions.
|
|
</p>
|
|
<div class="field">
|
|
<label for="nc_url">Nextcloud URL</label>
|
|
<input type="url" id="nc_url" name="nc_url"
|
|
value="{{ nc_url }}"
|
|
placeholder="https://cloud.example.com"
|
|
autocomplete="off" spellcheck="false">
|
|
</div>
|
|
<div class="field">
|
|
<label for="nc_bot_secret">Bot secret</label>
|
|
<input type="password" id="nc_bot_secret" name="nc_bot_secret"
|
|
value="{{ nc_bot_secret }}"
|
|
placeholder="Leave blank to keep existing value"
|
|
autocomplete="new-password" spellcheck="false">
|
|
<p class="hint">Generated when you registered the bot in Nextcloud Talk.</p>
|
|
</div>
|
|
<div class="field">
|
|
<label for="nc_notification_room">Notification room token</label>
|
|
<input type="text" id="nc_notification_room" name="nc_notification_room"
|
|
value="{{ nc_notify_room }}"
|
|
placeholder="Token from the Talk room URL"
|
|
autocomplete="off" spellcheck="false">
|
|
<p class="hint">The token at the end of the Talk room URL — e.g. <code>abc123def</code>.</p>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
|
|
<details class="channel-block border border-pg-border rounded-lg overflow-hidden mb-3"
|
|
{{ nc_username and 'open' or '' }}>
|
|
<summary class="flex items-center gap-2 px-4 py-3 text-sm font-semibold text-pg-muted cursor-pointer select-none bg-pg-bg">
|
|
API credentials (reading history)
|
|
</summary>
|
|
<div class="px-4 pt-4 pb-2">
|
|
<p class="text-xs text-pg-dimmer -mt-1 mb-4 leading-relaxed">
|
|
Required for the <code>nc_talk_history</code> orchestrator tool.
|
|
Generate an app password in Nextcloud → Settings → Security → App passwords.
|
|
</p>
|
|
<div class="field">
|
|
<label for="nc_username">Nextcloud username</label>
|
|
<input type="text" id="nc_username" name="nc_username"
|
|
value="{{ nc_username }}"
|
|
placeholder="Your Nextcloud login username"
|
|
autocomplete="off" spellcheck="false">
|
|
</div>
|
|
<div class="field">
|
|
<label for="nc_app_password">App password</label>
|
|
<input type="password" id="nc_app_password" name="nc_app_password"
|
|
value="{{ nc_app_password }}"
|
|
placeholder="Leave blank to keep existing value"
|
|
autocomplete="new-password" spellcheck="false">
|
|
</div>
|
|
</div>
|
|
</details>
|
|
</div>
|
|
|
|
<!-- Home Assistant -->
|
|
<div class="section">
|
|
<h2>Home Assistant</h2>
|
|
<p class="section-note">
|
|
Receive events from HA automations and let your persona call the HA REST API
|
|
(read states, control devices). Webhook ID is the shared secret used in your
|
|
HA <code>rest_command</code> URL.
|
|
</p>
|
|
|
|
<details class="channel-block border border-pg-border rounded-lg overflow-hidden mb-3"
|
|
{{ ha_url and 'open' or '' }}>
|
|
<summary class="flex items-center gap-2 px-4 py-3 text-sm font-semibold text-pg-muted cursor-pointer select-none bg-pg-bg">
|
|
Connection
|
|
</summary>
|
|
<div class="px-4 pt-4 pb-2">
|
|
<p class="text-xs text-pg-dimmer -mt-1 mb-4 leading-relaxed">
|
|
HA URL and a Long-Lived Access Token (Profile → scroll to bottom →
|
|
Long-Lived Access Tokens → Create Token).
|
|
</p>
|
|
<div class="field">
|
|
<label for="ha_url">Home Assistant URL</label>
|
|
<input type="url" id="ha_url" name="ha_url"
|
|
value="{{ ha_url }}"
|
|
placeholder="https://ha.yourdomain.com"
|
|
autocomplete="off" spellcheck="false">
|
|
</div>
|
|
<div class="field">
|
|
<label for="ha_token">Long-Lived Access Token</label>
|
|
<input type="password" id="ha_token" name="ha_token"
|
|
value=""
|
|
placeholder="Leave blank to keep existing token"
|
|
autocomplete="new-password" spellcheck="false">
|
|
</div>
|
|
</div>
|
|
</details>
|
|
|
|
<details class="channel-block border border-pg-border rounded-lg overflow-hidden mb-3"
|
|
{{ ha_webhook_id and 'open' or '' }}>
|
|
<summary class="flex items-center gap-2 px-4 py-3 text-sm font-semibold text-pg-muted cursor-pointer select-none bg-pg-bg">
|
|
Inbound webhook (HA → Cortex)
|
|
</summary>
|
|
<div class="px-4 pt-4 pb-2">
|
|
<p class="text-xs text-pg-dimmer -mt-1 mb-4 leading-relaxed">
|
|
The webhook ID is the shared secret in your HA <code>rest_command</code> URL.
|
|
Your endpoint: <code>https://cortex.dgrzone.com/webhook/ha/{{ ha_username }}/<webhook_id></code>
|
|
</p>
|
|
<div class="field">
|
|
<label for="ha_webhook_id">Webhook ID</label>
|
|
<input type="text" id="ha_webhook_id" name="ha_webhook_id"
|
|
value="{{ ha_webhook_id }}"
|
|
placeholder="Paste or generate a random secret"
|
|
autocomplete="off" spellcheck="false">
|
|
<p class="hint">Treat this like a password — use a long, random string.</p>
|
|
</div>
|
|
<div class="field">
|
|
<label class="checkbox-label">
|
|
<input type="checkbox" name="ha_tools" value="1" {{ ha_tools_checked }}>
|
|
Enable orchestrator tools
|
|
</label>
|
|
<p class="hint">When checked, HA events trigger the full tool loop (research, home control, tasks). When unchecked, events get a direct LLM response — faster but no tools.</p>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
</div>
|
|
|
|
<!-- Google Chat -->
|
|
<div class="section">
|
|
<h2>Google Chat</h2>
|
|
<p class="section-note">
|
|
Outbound webhook for proactive messages to a Google Chat space.
|
|
Incoming messages are handled separately via the Google Chat Add-on.
|
|
</p>
|
|
|
|
<details class="channel-block border border-pg-border rounded-lg overflow-hidden mb-3"
|
|
{{ gc_webhook and 'open' or '' }}>
|
|
<summary class="flex items-center gap-2 px-4 py-3 text-sm font-semibold text-pg-muted cursor-pointer select-none bg-pg-bg">
|
|
Outbound webhook
|
|
</summary>
|
|
<div class="px-4 pt-4 pb-2">
|
|
<p class="text-xs text-pg-dimmer -mt-1 mb-4 leading-relaxed">
|
|
Create a webhook in your Google Chat space → Manage webhooks. Paste the full URL here.
|
|
</p>
|
|
<div class="field">
|
|
<label for="gc_outbound_webhook">Webhook URL</label>
|
|
<input type="url" id="gc_outbound_webhook" name="gc_outbound_webhook"
|
|
value="{{ gc_webhook }}"
|
|
placeholder="https://chat.googleapis.com/v1/spaces/…"
|
|
autocomplete="off" spellcheck="false">
|
|
</div>
|
|
</div>
|
|
</details>
|
|
</div>
|
|
|
|
<button type="submit" class="btn-submit w-full md:w-96">Save notification settings</button>
|
|
</form>
|
|
|
|
<!-- Test -->
|
|
<div class="section" style="margin-top:2rem;">
|
|
<h2>Test</h2>
|
|
<p class="section-note">
|
|
Fire a notification via your configured channel or run the reminder check
|
|
immediately — no need to wait for the daily 09:00 scheduler job.
|
|
</p>
|
|
<div class="flex gap-3 mt-2">
|
|
<button class="flex-1 px-3 py-2.5 text-sm font-medium border border-pg-border rounded-md bg-pg-bg text-pg-text hover:border-pg-action hover:text-pg-accent transition-colors cursor-pointer disabled:opacity-50"
|
|
id="btn-test-notify">Send Test Notification</button>
|
|
<button class="flex-1 px-3 py-2.5 text-sm font-medium border border-pg-border rounded-md bg-pg-bg text-pg-text hover:border-pg-action hover:text-pg-accent transition-colors cursor-pointer disabled:opacity-50"
|
|
id="btn-check-reminders">Check Reminders Now</button>
|
|
</div>
|
|
<div id="test-result"
|
|
class="mt-3 px-3 py-2.5 rounded-md text-sm leading-relaxed"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Set channel select to saved value
|
|
const sel = document.getElementById('notification_channel');
|
|
if (sel) {
|
|
const saved = sel.dataset.value;
|
|
if (saved) {
|
|
for (const opt of sel.options) {
|
|
if (opt.value === saved) { opt.selected = true; break; }
|
|
}
|
|
}
|
|
}
|
|
|
|
// Test buttons
|
|
const resultEl = document.getElementById('test-result');
|
|
|
|
function showResult(ok, msg) {
|
|
resultEl.textContent = msg;
|
|
resultEl.className = ok
|
|
? 'mt-3 px-3 py-2.5 rounded-md text-sm leading-relaxed bg-green-950 text-green-400 border border-green-800'
|
|
: 'mt-3 px-3 py-2.5 rounded-md text-sm leading-relaxed bg-red-950 text-red-400 border border-red-800';
|
|
resultEl.style.display = 'block';
|
|
}
|
|
|
|
async function apiPost(url, btnEl, label) {
|
|
btnEl.disabled = true;
|
|
btnEl.textContent = label + '…';
|
|
resultEl.style.display = 'none';
|
|
try {
|
|
const r = await fetch(url, { method: 'POST' });
|
|
const data = await r.json();
|
|
if (r.ok && data.ok) {
|
|
if (url.includes('reminders')) {
|
|
const n = data.reminders_found ?? 0;
|
|
showResult(true, n > 0
|
|
? `Found ${n} due reminder${n !== 1 ? 's' : ''} — notification sent.`
|
|
: 'No due reminders found — nothing sent.');
|
|
} else {
|
|
showResult(true, 'Notification sent. Check your configured channel.');
|
|
}
|
|
} else {
|
|
showResult(false, data.detail || 'Request failed.');
|
|
}
|
|
} catch (e) {
|
|
showResult(false, 'Network error: ' + e.message);
|
|
} finally {
|
|
btnEl.disabled = false;
|
|
btnEl.textContent = label;
|
|
}
|
|
}
|
|
|
|
document.getElementById('btn-test-notify').addEventListener('click', function() {
|
|
apiPost('/api/push/test', this, 'Send Test Notification');
|
|
});
|
|
|
|
document.getElementById('btn-check-reminders').addEventListener('click', function() {
|
|
apiPost('/api/push/reminders/check', this, 'Check Reminders Now');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|