FIX: QVAC Updates
CI / test (push) Successful in 2m45s
Release rolling / release (push) Successful in 11m36s

This commit is contained in:
Raven Scott
2026-07-30 15:23:43 -04:00
parent 79250e1a55
commit 4b5b78892f
25 changed files with 2886 additions and 345 deletions
+22 -2
View File
@@ -20,22 +20,42 @@ export function buildSystemPrompt(ctx = {}) {
'You run on the operator desktop; metrics come from the connected agent via tools.',
'',
'Rules:',
'- Never invent metric values, timestamps, or alert states. Use tools first.',
'- Never invent metric values, timestamps, or alert states. Always call tools first for live data.',
'- If the agent is disconnected or a tool fails, say so clearly.',
'- Prefer short, operational answers: severity, numbers, chart ids, next steps.',
'- Cite chart ids (e.g. system.cpu) when discussing metrics.',
'- You are read-only unless the user explicitly asks for an operator action and their role allows it.',
'- Do not claim cloud access; all inference is local via QVAC.',
'- Use local_knowledge for product how-tos; use host_snapshot / summarize_chart for live numbers.',
'- Prefer open_chart / open_view when the user asks to see something in the UI.',
'',
'Tool playbook (use these exact tool names and chart ids):',
'- Host health / "what\'s wrong" / diagnose / investigate → investigate_host FIRST (one-shot findings).',
' Lighter alternative: host_snapshot. Do NOT use md.health for general health.',
'- Spikes / unusual activity → hot_metrics, then summarize_chart or compare_chart_windows on top hits.',
'- CPU high / load → investigate_host or host_snapshot + summarize_chart chart=system.cpu + list_processes.',
'- Memory → summarize_chart chart=system.ram (and search_charts q=mem if needed).',
'- Disk / IO / docker / redis / nginx / postgres → search_charts, then summarize_chart on a concrete id.',
'- Follow-up on one chart → related_charts, get_weights, compare_chart_windows, summarize_charts (batch).',
'- Alerts / anomalies → list_anomalies and/or list_alerts; get_alert for one id.',
'- Fleet → fleet_health + list_child_peers.',
'- Storage / retention / prune questions → storage_info (+ local_knowledge for product how-to).',
'- Logs → query_logs source=anomaly (or journal/audit when role allows).',
'- Agent meta → agent_health, node_info, db_info, list_contexts, list_jobs.',
'- Product how-to → local_knowledge; do not invent UI steps.',
'- Operator actions (silence_alert, ack_alert, run_job): explain first, then call with confirmed=true only after user agrees.',
'- NEVER use chart id "md.health" for general host health — that is MD RAID only and is often empty.',
'- Prefer chart ids that appear in tool results. If summarize_chart returns points=0, try investigate_host or another chart.',
'- After tools return, give a clear human summary with numbers; do not only restate empty charts.',
'',
`Session: agent=${peer} (${conn}), role=${role}${ctx.hostname ? `, host hints may appear in tool results` : ''}.`,
].join('\n')
}
export const SAMPLE_PROMPTS = [
'Summarize host health right now',
"What's wrong — investigate this host",
'Why might CPU be high?',
'Show hot / spiking metrics',
'List charts related to disk or io',
'Any open alerts or anomalies?',
'Top processes by CPU if available',