Custom Dashboards - Agent Driven Dashboards
This commit is contained in:
+56
-18
@@ -132,32 +132,70 @@ export const AGENT_SPECS = [
|
||||
]
|
||||
|
||||
/**
|
||||
* Whether this turn should fan out sub-agents.
|
||||
* Dynamic multi-agent gate — **single-agent by default**.
|
||||
* Only fan out when the user clearly wants a broad investigation (or multi-domain).
|
||||
*
|
||||
* @param {string} userText
|
||||
* @param {{ subAgents?: boolean }} prefs
|
||||
* @param {{ subAgents?: boolean, subAgentMode?: 'auto'|'always'|'never' }} prefs
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function shouldUseSubAgents(userText, prefs = {}) {
|
||||
if (prefs.subAgents === false) return false
|
||||
const q = String(userText || '').toLowerCase()
|
||||
// Product how-tos: skip multi-agent (use local_knowledge only)
|
||||
if (prefs.subAgents === false || prefs.subAgentMode === 'never') return false
|
||||
if (prefs.subAgentMode === 'always' && prefs.subAgents !== false) {
|
||||
const q0 = String(userText || '').toLowerCase()
|
||||
// Still skip pure how-to / empty
|
||||
if (!q0.trim()) return false
|
||||
if (/how (do|to)|what is qvac|keyboard|time preset/.test(q0)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
const q = String(userText || '').toLowerCase().trim()
|
||||
if (!q || q.length < 10) return false
|
||||
|
||||
// Product / how-to / chart-only / single tool asks → always single
|
||||
if (
|
||||
q.includes('how do') ||
|
||||
q.includes('how to') ||
|
||||
q.includes('what is qvac') ||
|
||||
q.includes('keyboard') ||
|
||||
q.includes('time preset')
|
||||
/how (do|to)|what is qvac|keyboard|time preset|retention work/.test(q)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
// Default on for operational questions when feature enabled
|
||||
if (prefs.subAgents === true || prefs.subAgents == null) {
|
||||
return (
|
||||
/health|wrong|diagnos|investigat|summar|status|cpu|ram|memory|disk|alert|anomal|process|load|hot|spik|fleet|storage|retention|metric|chart|nginx|redis|docker|postgres|io\b/.test(
|
||||
q
|
||||
) || q.length < 4
|
||||
)
|
||||
// UI chart/dashboard building without investigation language
|
||||
if (
|
||||
/\b(show|plot|graph|open|pin|filter|dashboard)\b/.test(q) &&
|
||||
!/\b(investigat|diagnos|what'?s wrong|root cause|health check|full (scan|check))\b/.test(q)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
|
||||
// Explicit multi-agent / deep investigation
|
||||
if (
|
||||
/\b(multi[- ]?agent|investigat|investigation|diagnos(e|is|tic)?|what'?s wrong|whats wrong|what is wrong|root cause|deep dive|full (health|check|scan)|run (all|every) agent|spin up agent)\b/.test(
|
||||
q
|
||||
)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Broad host health summaries
|
||||
if (
|
||||
/\b(summarize host|host health|health (check|status|summary)|overall status|everything (wrong|ok)|whole (host|system))\b/.test(
|
||||
q
|
||||
)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Multi-domain operational question (3+ areas) → worth parallel specialists
|
||||
const domains = [
|
||||
/\b(cpu|load)\b/,
|
||||
/\b(ram|memory)\b/,
|
||||
/\b(disk|io|storage|iops)\b/,
|
||||
/\b(alert|anomal)/,
|
||||
/\b(process|pid|top)\b/,
|
||||
/\b(fleet|child peer)/,
|
||||
/\b(net|network)\b/,
|
||||
]
|
||||
const hits = domains.reduce((n, re) => n + (re.test(q) ? 1 : 0), 0)
|
||||
return hits >= 3
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user