- Schedules web UI (/settings/crons): list, add, edit, pause/resume, delete jobs - cron task type: full orchestrator tool loop on a schedule, result → notification channel - parse_schedule: monthly/yearly formats (monthly:DD:HH:MM, yearly:MM:DD:HH:MM) - HA inbound webhook tools toggle: orchestrator loop vs. direct LLM, configurable in UI - ae_db_query/describe/show_view: SELECT-only Aether MariaDB access (admin, per-user creds) - /settings/integrations: admin-only page for Aether DB credentials - Schedules nav link added to all settings pages - pymysql added to requirements - Docs updated: HELP.md, MASTER.md, CLAUDE.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
225 lines
9.6 KiB
HTML
225 lines
9.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Tool Settings — Cortex</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">
|
|
<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>
|
|
/* ── Policy cards (bordered sections on tools page) ── */
|
|
.policy-card {
|
|
background: var(--pg-surface); border: 1px solid var(--pg-border);
|
|
border-radius: 0.75rem; padding: 1.25rem 1.5rem; margin-bottom: 1.75rem;
|
|
}
|
|
.policy-card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
|
|
.policy-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
|
|
.policy-label { font-size: 0.875rem; font-weight: 500; min-width: 6rem; }
|
|
.policy-note { font-size: 0.8rem; color: var(--pg-muted); margin-top: 0.35rem; line-height: 1.5; }
|
|
|
|
/* Compact selects and inputs inside policy cards */
|
|
.policy-card select, .policy-card input[type="text"] {
|
|
padding: 0.4rem 0.65rem; font-size: 0.875rem;
|
|
}
|
|
|
|
/* Two-column layout for allow/deny textareas */
|
|
.col-split { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; }
|
|
.col-half { flex: 1; min-width: 200px; }
|
|
.col-half label { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.35rem; }
|
|
.col-half textarea {
|
|
font-size: 0.82rem; border-radius: 0.375rem; padding: 0.45rem 0.65rem;
|
|
}
|
|
|
|
/* Save button (compact, not full-width) */
|
|
.save-btn {
|
|
background: var(--pg-action); color: #fff; border: none;
|
|
border-radius: 0.5rem; padding: 0.5rem 1.4rem;
|
|
font-size: 0.875rem; font-weight: 600; cursor: pointer;
|
|
margin-top: 0.5rem; transition: opacity 0.15s;
|
|
}
|
|
.save-btn:hover { opacity: 0.88; }
|
|
|
|
/* ── Tool table ── */
|
|
.table-section-label {
|
|
font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
|
|
text-transform: uppercase; color: var(--pg-dimmer);
|
|
margin: 1.75rem 0 0.6rem;
|
|
}
|
|
.tool-table {
|
|
width: 100%; border-collapse: collapse;
|
|
background: var(--pg-surface); border: 1px solid var(--pg-border);
|
|
border-radius: 0.75rem; overflow: hidden; margin-bottom: 0.5rem;
|
|
font-size: 0.85rem;
|
|
}
|
|
.tool-table th {
|
|
text-align: left; padding: 0.55rem 0.9rem;
|
|
border-bottom: 1px solid var(--pg-border);
|
|
color: var(--pg-muted); font-weight: 600; font-size: 0.78rem;
|
|
text-transform: uppercase; letter-spacing: 0.04em;
|
|
}
|
|
.tool-table td { padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--pg-border); vertical-align: middle; }
|
|
.tool-table tr:last-child td { border-bottom: none; }
|
|
.tool-table tr:hover td { background: rgba(124,58,237,0.04); }
|
|
.tool-name { font-family: monospace; font-size: 0.82rem; }
|
|
|
|
/* Risk badges */
|
|
.risk { display: inline-block; font-size: 0.7rem; font-weight: 700;
|
|
padding: 0.15rem 0.45rem; border-radius: 9999px; letter-spacing: 0.04em; }
|
|
.risk-low { background: rgba(34,197,94,0.12); color: #4ade80; }
|
|
.risk-medium { background: rgba(234,179,8,0.12); color: #fbbf24; }
|
|
.risk-high { background: rgba(239,68,68,0.12); color: #f87171; }
|
|
[data-theme="light"] .risk-low { background: rgba(34,197,94,0.15); color: #16a34a; }
|
|
[data-theme="light"] .risk-medium { background: rgba(234,179,8,0.15); color: #ca8a04; }
|
|
[data-theme="light"] .risk-high { background: rgba(239,68,68,0.15); color: #dc2626; }
|
|
|
|
/* Auto status pill */
|
|
.auto-pill {
|
|
display: inline-block; font-size: 0.68rem; font-weight: 600;
|
|
padding: 0.12rem 0.4rem; border-radius: 9999px;
|
|
}
|
|
.auto-on { background: rgba(124,58,237,0.12); color: #a78bfa; }
|
|
.auto-off { background: rgba(148,163,184,0.12); color: var(--pg-dimmer); }
|
|
[data-theme="light"] .auto-on { color: #7c3aed; }
|
|
|
|
/* Override select */
|
|
.override-sel {
|
|
font-size: 0.78rem; padding: 0.25rem 0.5rem;
|
|
border-radius: 0.3rem; min-width: 7rem; width: auto;
|
|
}
|
|
.override-sel.forced-on { border-color: #7c3aed; color: #7c3aed; }
|
|
.override-sel.forced-off { border-color: #dc2626; color: #dc2626; }
|
|
|
|
/* Legend */
|
|
.legend { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.25rem; font-size: 0.8rem; color: var(--pg-muted); }
|
|
.legend-dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.3rem; }
|
|
.legend-dot.on { background: #a78bfa; }
|
|
.legend-dot.off { background: var(--pg-dimmer); }
|
|
</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/notifications" class="nav-link">Notifications</a>
|
|
<a href="/settings/tools" class="nav-link active">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">Tool Settings</h1>
|
|
<p class="page-subtitle">
|
|
Control which orchestrator tools are available. The risk level sets an automatic threshold;
|
|
whitelist and blacklist let you fine-tune individual tools beyond that.
|
|
</p>
|
|
|
|
<!-- SUCCESS -->
|
|
<!-- ERROR -->
|
|
|
|
<form method="POST" action="/settings/tools" id="tools-form">
|
|
|
|
<!-- Risk policy -->
|
|
<div class="policy-card">
|
|
<h2>Risk Policy</h2>
|
|
<div class="policy-row">
|
|
<span class="policy-label">Max risk level</span>
|
|
<select name="max_risk" id="max-risk-sel">
|
|
<option value="" {{ sel_none }}>No filter — use all role-permitted tools</option>
|
|
<option value="low" {{ sel_low }}>Low — read-only and sandboxed tools only</option>
|
|
<option value="medium" {{ sel_medium }}>Medium — low + medium risk (recommended)</option>
|
|
<option value="high" {{ sel_high }}>High — all tools including destructive ones</option>
|
|
</select>
|
|
</div>
|
|
<p class="policy-note">
|
|
<strong>Low</strong> tools are read-only and sandboxed (web search, project file reads, HA status checks).<br>
|
|
<strong>Medium</strong> tools write to local data or send notifications to you (cron jobs, scratch, task management).<br>
|
|
<strong>High</strong> tools affect external systems or the host (shell exec, email, device control, service restart).
|
|
</p>
|
|
<p class="policy-note" style="margin-top:0.75rem;">
|
|
The <em>Auto</em> column below shows each tool's status at your current max risk level.
|
|
Use the override column to force-include or force-exclude individual tools.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Legend -->
|
|
<div class="legend">
|
|
<span><span class="legend-dot on"></span>Auto-included by risk level</span>
|
|
<span><span class="legend-dot off"></span>Auto-excluded by risk level</span>
|
|
</div>
|
|
|
|
<!-- Tool table -->
|
|
{{ tool_table_html }}
|
|
|
|
<!-- Confirmation gate -->
|
|
<div class="policy-card" style="margin-top:1.75rem;">
|
|
<h2>Confirmation Gate</h2>
|
|
<p class="policy-note">
|
|
Some tools require explicit confirmation before executing. Override the defaults here.<br>
|
|
Tools requiring confirmation by default: <code>{{ confirm_required_tools }}</code>
|
|
</p>
|
|
<div class="col-split" style="margin-top:0.85rem;">
|
|
<div class="col-half">
|
|
<label>Allow list — bypass confirmation</label>
|
|
<textarea name="allow_list" rows="4"
|
|
placeholder="reminders_clear cron_remove"
|
|
autocomplete="off" spellcheck="false">{{ tool_allow }}</textarea>
|
|
<p class="hint">One tool name per line. These tools skip the confirmation prompt.</p>
|
|
</div>
|
|
<div class="col-half">
|
|
<label>Deny list — always block</label>
|
|
<textarea name="deny_list" rows="4"
|
|
placeholder="shell_exec file_write"
|
|
autocomplete="off" spellcheck="false">{{ tool_deny }}</textarea>
|
|
<p class="hint">These tools are always blocked regardless of risk policy.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="margin-top:1.5rem;">
|
|
<button type="submit" class="save-btn">Save tool settings</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
const riskRank = { "": 99, "low": 0, "medium": 1, "high": 2 };
|
|
const toolRisk = {{ tool_risk_json }};
|
|
|
|
const sel = document.getElementById('max-risk-sel');
|
|
|
|
function updateAutoPills() {
|
|
const maxRank = riskRank[sel.value] ?? 99;
|
|
document.querySelectorAll('[data-tool-risk]').forEach(row => {
|
|
const risk = row.dataset.toolRisk;
|
|
const pill = row.querySelector('.auto-pill');
|
|
const isAuto = riskRank[risk] <= maxRank;
|
|
pill.textContent = isAuto ? 'auto ✓' : 'excluded';
|
|
pill.className = 'auto-pill ' + (isAuto ? 'auto-on' : 'auto-off');
|
|
});
|
|
}
|
|
|
|
sel.addEventListener('change', updateAutoPills);
|
|
updateAutoPills();
|
|
|
|
// Color the override selects
|
|
document.querySelectorAll('.override-sel').forEach(s => {
|
|
function refresh() {
|
|
s.className = 'override-sel';
|
|
if (s.value === 'whitelist') s.classList.add('forced-on');
|
|
if (s.value === 'blacklist') s.classList.add('forced-off');
|
|
}
|
|
s.addEventListener('change', refresh);
|
|
refresh();
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|