Custom Dashboards - Agent Driven Dashboards
CI / test (push) Successful in 2m42s
Release rolling / release (push) Canceled after 3m44s

This commit is contained in:
Raven Scott
2026-07-30 16:48:28 -04:00
parent 6119ba6e46
commit 0699c42c28
10 changed files with 1244 additions and 21 deletions
+180 -1
View File
@@ -291,7 +291,7 @@ export const TOOL_DEFS = [
name: 'open_view',
tier: 'core',
description:
'Navigate desktop to a view: overview|charts|processes|alerts|logs|fleet|settings|qvac',
'Navigate desktop to a view: overview|charts|dashboard|processes|alerts|logs|fleet|settings|qvac',
parameters: params(
{
view: {
@@ -300,6 +300,7 @@ export const TOOL_DEFS = [
enum: [
'overview',
'charts',
'dashboard',
'processes',
'alerts',
'logs',
@@ -313,6 +314,112 @@ export const TOOL_DEFS = [
),
},
// ── custom dashboards (user boards the agent can build/edit) ──────────
{
type: 'function',
name: 'list_dashboards',
tier: 'core',
description: 'List custom dashboards (id, name, chart tiles).',
parameters: params({}),
},
{
type: 'function',
name: 'create_dashboard',
tier: 'core',
description:
'Create a custom live dashboard and open it. Pass name + charts (comma ids). Use for "build a dashboard with CPU and RAM".',
parameters: params(
{
name: { type: 'string', description: 'Dashboard name' },
description: { type: 'string', description: 'Optional description' },
charts: {
type: 'string',
description: 'Comma/space chart ids e.g. system.cpu,system.ram,system.io',
},
mode: {
type: 'string',
description: 'Default tile mode line|area|bar|…',
enum: ['line', 'area', 'stacked', 'bar', 'multibar', 'pie'],
},
},
['name']
),
},
{
type: 'function',
name: 'update_dashboard',
tier: 'core',
description: 'Rename/update a dashboard (id optional = active). Can replace tiles via charts list.',
parameters: params({
id: { type: 'string', description: 'Dashboard id' },
name: { type: 'string', description: 'New name' },
description: { type: 'string', description: 'New description' },
charts: {
type: 'string',
description: 'If set, replace all tiles with these chart ids',
},
mode: { type: 'string', description: 'Mode when replacing tiles' },
}),
},
{
type: 'function',
name: 'delete_dashboard',
tier: 'core',
description: 'Delete a custom dashboard by id.',
parameters: params(
{
id: { type: 'string', description: 'Dashboard id' },
},
['id']
),
},
{
type: 'function',
name: 'add_dashboard_charts',
tier: 'core',
description: 'Add chart tiles to a dashboard (id optional = active board).',
parameters: params(
{
id: { type: 'string', description: 'Dashboard id (default active)' },
charts: {
type: 'string',
description: 'Comma/space chart ids to add',
},
mode: {
type: 'string',
description: 'Tile chart type',
enum: ['line', 'area', 'stacked', 'bar', 'multibar', 'pie'],
},
},
['charts']
),
},
{
type: 'function',
name: 'remove_dashboard_charts',
tier: 'core',
description: 'Remove chart tiles from a dashboard.',
parameters: params(
{
id: { type: 'string', description: 'Dashboard id (default active)' },
charts: {
type: 'string',
description: 'Comma/space chart ids to remove',
},
},
['charts']
),
},
{
type: 'function',
name: 'open_dashboard',
tier: 'core',
description: 'Open the Dashboard tab and select a board by id (or active).',
parameters: params({
id: { type: 'string', description: 'Dashboard id (optional)' },
}),
},
// ── deep: investigation, fleet, storage, catalog ───────────────────
{
type: 'function',
@@ -582,6 +689,13 @@ const LOCAL_TOOLS = new Set([
'filter_charts',
'show_related_ui',
'run_correlations',
'list_dashboards',
'create_dashboard',
'update_dashboard',
'delete_dashboard',
'add_dashboard_charts',
'remove_dashboard_charts',
'open_dashboard',
'local_knowledge',
])
@@ -646,6 +760,15 @@ function wireDefs(defs) {
* runMetricCorrelations?: (opts?: object) => Promise<any>,
* scrollToChart?: (id: string) => void,
* },
* dashboards?: {
* list?: () => object,
* create?: (a: object) => object,
* update?: (a: object) => object,
* remove?: (a: object) => object,
* addCharts?: (a: object) => object,
* removeCharts?: (a: object) => object,
* open?: (a: object) => object,
* },
* confirmAction?: (message: string) => boolean|Promise<boolean>,
* }} deps
*/
@@ -906,6 +1029,62 @@ export function createToolRunner(deps) {
deps.onOpenView?.(String(args.view || 'overview'))
return { ok: true, view: args.view }
}
case 'list_dashboards': {
if (!deps.dashboards?.list) return { error: 'dashboards API unavailable' }
return deps.dashboards.list()
}
case 'create_dashboard': {
if (!deps.dashboards?.create) return { error: 'dashboards API unavailable' }
const r = deps.dashboards.create({
name: args.name,
description: args.description,
charts: args.charts || args.chart,
mode: args.mode || 'area',
tiles: args.tiles,
})
deps.onOpenView?.('dashboard')
return r
}
case 'update_dashboard': {
if (!deps.dashboards?.update) return { error: 'dashboards API unavailable' }
return deps.dashboards.update({
id: args.id || args.dashboardId,
name: args.name,
description: args.description,
charts: args.charts,
mode: args.mode,
tiles: args.tiles,
})
}
case 'delete_dashboard': {
if (!deps.dashboards?.remove) return { error: 'dashboards API unavailable' }
return deps.dashboards.remove({ id: args.id || args.dashboardId })
}
case 'add_dashboard_charts': {
if (!deps.dashboards?.addCharts) return { error: 'dashboards API unavailable' }
const r = deps.dashboards.addCharts({
id: args.id || args.dashboardId,
charts: args.charts || args.chart,
mode: args.mode,
replace: args.replace,
})
deps.onOpenView?.('dashboard')
return r
}
case 'remove_dashboard_charts': {
if (!deps.dashboards?.removeCharts) return { error: 'dashboards API unavailable' }
return deps.dashboards.removeCharts({
id: args.id || args.dashboardId,
charts: args.charts || args.chart,
})
}
case 'open_dashboard': {
if (!deps.dashboards?.open) {
deps.onOpenView?.('dashboard')
return { ok: true, view: 'dashboard' }
}
return deps.dashboards.open({ id: args.id || args.dashboardId })
}
case 'silence_alert': {
if (!args.confirmed) {
return {