Agent Charts
CI / test (push) Successful in 2m37s
Release rolling / release (push) Successful in 11m32s

This commit is contained in:
Raven Scott
2026-07-30 16:28:06 -04:00
parent bcfec67368
commit 6119ba6e46
8 changed files with 734 additions and 20 deletions
+26 -1
View File
@@ -11,6 +11,7 @@ import {
runSubAgents,
synthesizeFromAgents,
} from './agents.js'
import { chartIdsFromToolLog, mountChartEmbeds } from './chart-embed.js'
/**
* @param {{
@@ -39,8 +40,9 @@ import {
* saveSettings: (patch: object) => void,
* getPeerLabel: () => string,
* getCatalog?: () => Record<string, object>,
* onOpenChart?: (id: string, ts?: number) => void,
* onOpenChart?: (id: string, ts?: number, opts?: object) => void,
* onOpenView?: (view: string) => void,
* charts?: object,
* log?: (msg: string) => void,
* }} opts
*/
@@ -60,6 +62,7 @@ export function createQvacView(opts) {
getCatalog: () => opts.getCatalog?.() || {},
onOpenChart: opts.onOpenChart,
onOpenView: opts.onOpenView,
charts: opts.charts,
confirmAction: (msg) => {
try {
return typeof confirm === 'function' ? confirm(msg) : true
@@ -892,6 +895,28 @@ export function createQvacView(opts) {
if (chips) chips.remove()
assistantUi.div.appendChild(renderToolChips(toolLog))
}
// Live sparklines under the answer for chart-related tools
const embedIds = chartIdsFromToolLog(toolLog)
if (embedIds.length && assistantUi?.div && opts.manager?.request) {
mountChartEmbeds(assistantUi.div, embedIds, {
request: (m, a) => opts.manager.request(m, a || {}),
catalog: opts.getCatalog?.() || {},
onOpen: (id) => {
opts.onOpenView?.('charts')
if (opts.charts?.showCharts) {
opts.charts.showCharts({
charts: [id],
pin: true,
boardOnly: true,
focus: id,
openFocus: true,
})
} else {
opts.onOpenChart?.(id)
}
},
}).catch(() => {})
}
setStatus(result.mode === 'fallback' ? 'Ready (tools-only)' : 'Ready', 'ok')
} catch (err) {
const msg = err?.message || String(err)