feat: add subagent details

This commit is contained in:
Brooklyn Nicholson 2026-04-15 14:35:42 -05:00
parent 4b4b4d47bc
commit cb7b740e32
8 changed files with 92 additions and 866 deletions

View file

@ -1,40 +0,0 @@
import { atom } from 'nanostores'
import { WIDGET_CATALOG } from '../widgets.js'
export interface WidgetState {
enabled: Record<string, boolean>
params: Record<string, Record<string, string>>
}
function defaults(): WidgetState {
const enabled: Record<string, boolean> = {}
for (const w of WIDGET_CATALOG) {
enabled[w.id] = w.defaultOn
}
return { enabled, params: {} }
}
export const $widgetState = atom<WidgetState>(defaults())
export function toggleWidget(id: string, force?: boolean) {
const s = $widgetState.get()
const next = force ?? !s.enabled[id]
$widgetState.set({ ...s, enabled: { ...s.enabled, [id]: next } })
return next
}
export function setWidgetParam(id: string, key: string, value: string) {
const s = $widgetState.get()
const prev = s.params[id] ?? {}
$widgetState.set({ ...s, params: { ...s.params, [id]: { ...prev, [key]: value } } })
}
export function getWidgetEnabled(id: string): boolean {
return $widgetState.get().enabled[id] ?? false
}