Add agent workbench terminal and live PostgreSQL/Trino SQL consoles.
Clicking agents opens a dedicated terminal panel; topology PostgreSQL/Trino nodes open SQL workbench with ten demo queries and Postgres vs Trino benchmark.
This commit is contained in:
@@ -35,6 +35,18 @@ function resolveProbeId(nodeId: string) {
|
||||
return infra?.id || aliased
|
||||
}
|
||||
|
||||
|
||||
const SQL_NODE_ENGINES: Record<string, 'postgres' | 'trino'> = {
|
||||
postgresql: 'postgres',
|
||||
'src-postgres': 'postgres',
|
||||
trino: 'trino',
|
||||
'query-trino': 'trino',
|
||||
}
|
||||
|
||||
function resolveSqlEngine(nodeId: string): 'postgres' | 'trino' | null {
|
||||
return SQL_NODE_ENGINES[nodeId] || SQL_NODE_ENGINES[resolveProbeId(nodeId)] || null
|
||||
}
|
||||
|
||||
export function useCommandCenter() {
|
||||
const [agents, setAgents] = useState<Agent[]>([])
|
||||
const [agentsLoading, setAgentsLoading] = useState(true)
|
||||
@@ -54,6 +66,7 @@ export function useCommandCenter() {
|
||||
const [nodeBusy, setNodeBusy] = useState(false)
|
||||
const [mainView, setMainView] = useState<'platform' | 'approvals' | 'presentation' | 'dataquality' | 'knowledge' | 'storage' | 'search'>('platform')
|
||||
const [approvalHighlight, setApprovalHighlight] = useState(false)
|
||||
const [workbenchMode, setWorkbenchMode] = useState<'agent' | 'sql-postgres' | 'sql-trino' | null>(null)
|
||||
const [chatExpanded, setChatExpanded] = useState(false)
|
||||
const promptTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const [terminalExpanded, setTerminalExpanded] = useState(true)
|
||||
@@ -206,10 +219,19 @@ export function useCommandCenter() {
|
||||
setSelectedNodeId(nodeId)
|
||||
}, [])
|
||||
|
||||
const selectNode = useCallback(async (nodeId: string) => {
|
||||
const selectNode = useCallback(async (nodeId: string, options?: { keepWorkbench?: 'agent' }) => {
|
||||
const stub = findNodeStub(nodeId)
|
||||
if (!stub) return
|
||||
const probeId = resolveProbeId(nodeId)
|
||||
const sqlEng = resolveSqlEngine(nodeId)
|
||||
if (sqlEng) {
|
||||
setWorkbenchMode(sqlEng === 'postgres' ? 'sql-postgres' : 'sql-trino')
|
||||
setSelectedAgentId(null)
|
||||
} else if (options?.keepWorkbench) {
|
||||
setWorkbenchMode(options.keepWorkbench)
|
||||
} else {
|
||||
setWorkbenchMode(null)
|
||||
}
|
||||
setSelectedNodeId(probeId)
|
||||
setSelectedNode({ ...stub, id: probeId })
|
||||
setNodeDetail(null)
|
||||
@@ -228,6 +250,7 @@ export function useCommandCenter() {
|
||||
|
||||
const selectAgent = useCallback((id: string) => {
|
||||
setSelectedAgentId(id)
|
||||
setWorkbenchMode('agent')
|
||||
setTerminalExpanded(true)
|
||||
const agent = agents.find((a) => a.id === id)
|
||||
if (!agent) return
|
||||
@@ -235,7 +258,7 @@ export function useCommandCenter() {
|
||||
if (nodeId) {
|
||||
const stub = findNodeStub(nodeId)
|
||||
if (stub) {
|
||||
selectNode(nodeId)
|
||||
void selectNode(nodeId, { keepWorkbench: 'agent' })
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -249,6 +272,7 @@ export function useCommandCenter() {
|
||||
setSelectedNode(null)
|
||||
setNodeDetail(null)
|
||||
setSelectedAgentId(null)
|
||||
setWorkbenchMode(null)
|
||||
}, [])
|
||||
|
||||
const probeNode = useCallback(() => {
|
||||
@@ -310,6 +334,7 @@ export function useCommandCenter() {
|
||||
setMainView,
|
||||
approvalHighlight,
|
||||
setApprovalHighlight,
|
||||
workbenchMode,
|
||||
inspectorLines,
|
||||
terminalSubjectId,
|
||||
terminalExpanded,
|
||||
|
||||
Reference in New Issue
Block a user