Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(credentials): palette with virtuoso/cmdk/fuzzysort + TanStack Query warm-start + React Compiler
trohitg08318f0e7a98
diff --git a/client/package.json b/client/package.jsonindex de46a3fb..0c5ab150 100644--- a/client/package.json+++ b/client/package.json@@ -15,6 +15,7 @@"@lobehub/icons": "^2.45.0","@radix-ui/react-collapsible": "^1.1.12","@radix-ui/react-dialog": "^1.1.15",+ "@tanstack/react-query": "^5","@types/google.maps": "^3.58.1","@types/node": "^24.3.1","@types/prismjs": "^1.26.5",@@ -24,18 +25,23 @@"@vitejs/plugin-react": "^5.0.0","antd": "^5.27.4","autoprefixer": "^10.4.21",+ "cmdk": "^1","eslint": "^9.33.0","eslint-plugin-react-hooks": "^7.0.1","eslint-plugin-react-refresh": "^0.4.20",+ "fuzzysort": "^3","globals": "^16.3.0",+ "idb-keyval": "^6","postcss": "^8.5.6","prismjs": "^1.30.0","qrcode.react": "^4.2.0","react": "^19.1.1","react-dom": "^19.1.1",+ "react-hook-form": "^7","react-js-cron": "^5.2.0","react-markdown": "^10.1.0","react-simple-code-editor": "^0.14.1",+ "react-virtuoso": "^4","reactflow": "^11.11.4","remark-breaks": "^4.0.0","remark-gfm": "^4.0.1",@@ -56,6 +62,8 @@},"devDependencies": {"@typescript-eslint/parser": "^8.54.0",+ "babel-plugin-react-compiler": "19.1.0-rc.3",+ "rollup-plugin-visualizer": "^7.0.1","typescript-eslint": "^8.54.0"}}diff --git a/client/scripts/audit-bundle.py b/client/scripts/audit-bundle.pynew file mode 100644index 00000000..3bb24a79--- /dev/null+++ b/client/scripts/audit-bundle.py@@ -0,0 +1,87 @@+"""Bundle audit — prints top contributors to the main chunk sourcemap.++Usage:+ cd client && ANALYZE=1 pnpm run build && python scripts/audit-bundle.py+"""++from __future__ import annotations++import glob+import json+import os+import sys+from collections import defaultdict+++def main() -> int:+ os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+ matches = glob.glob("dist/assets/index-*.js.map")+ if not matches:+ print("no dist/assets/index-*.js.map found; run ANALYZE=1 pnpm run build first")+ return 1+ # Pick the largest sourcemap — that's the main chunk, not a lazy panel.+ sourcemap_path = max(matches, key=lambda p: os.path.getsize(p))+ print(f"sourcemap: {sourcemap_path} ({os.path.getsize(sourcemap_path):,} bytes)")++ with open(sourcemap_path, encoding="utf-8") as f:+ sm = json.load(f)++ sources = sm.get("sources", [])+ sources_content = sm.get("sourcesContent") or []+ if not sources_content or len(sources_content) != len(sources):+ print("sourceMap has no sourcesContent; rebuild with sourcemap:true")+ return 2++ sized = sorted(+ ((len(c or ""), s) for s, c in zip(sources, sources_content)),+ reverse=True,+ )+ total = sum(n for n, _ in sized)+ print(f"total sources: {len(sources)}")+ print(f"total source bytes: {total:,}")+ print()++ # Per-file top contributors+ print("Top 30 largest source files in the main bundle:")+ print(f'{"bytes":>10} {"%":>5} path')+ print("-" * 100)+ for n, s in sized[:30]:+ normalized = s.replace("\\", "/")+ if "/node_modules/" in normalized:+ normalized = "node_modules/" + normalized.split("/node_modules/", 1)[1]+ print(f"{n:>10,} {100 * n / total:>4.1f}% {normalized[:90]}")++ # Bucketed by package / src subtree. pnpm stores deps under a+ # content-addressable path like `node_modules/.pnpm/<pkg>@<ver>_<hash>/+ # node_modules/<pkg>/...` — we want to collapse on the innermost+ # `node_modules/<pkg>` segment so the bucket is the actual package name.+ buckets: dict[str, int] = defaultdict(int)+ for n, s in sized:+ normalized = s.replace("\\", "/")+ if "/node_modules/" in normalized:+ # Find the LAST `/node_modules/` occurrence so we skip the+ # .pnpm wrapper and land on the real package.+ after = normalized.rsplit("/node_modules/", 1)[1]+ parts = after.split("/")+ if parts[0].startswith("@") and len(parts) >= 2:+ bucket = f"{parts[0]}/{parts[1]}"+ else:+ bucket = parts[0]+ elif "/src/" in normalized:+ after = normalized.split("/src/", 1)[1]+ bucket = "src/" + after.split("/")[0]+ else:+ bucket = normalized+ buckets[bucket] += n++ print()+ print("Top 25 buckets by total source contribution:")+ print(f'{"bytes":>10} {"%":>5} bucket')+ print("-" * 80)+ for bucket, n in sorted(buckets.items(), key=lambda kv: -kv[1])[:25]:+ print(f"{n:>10,} {100 * n / total:>4.1f}% {bucket}")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/client/src/components/credentials/CredentialsModal.tsx b/client/src/components/credentials/CredentialsModal.tsxindex 5a264817..48b7d76b 100644--- a/client/src/components/credentials/CredentialsModal.tsx+++ b/client/src/components/credentials/CredentialsModal.tsx@@ -1,16 +1,30 @@/*** CredentialsModal — thin shell.- * antd Menu sidebar (grouped by category) + PanelRenderer on the right.- * All rendering logic lives in panels/ and primitives/.+ *+ * Phase 4 of the credentials-scaling plan:+ * - Data source is the server-owned `credential_providers.json` via+ * `useCatalogueQuery` (TanStack Query + IndexedDB warm-start).+ * - Sidebar is `CredentialsPalette` (cmdk + fuzzysort + GroupedVirtuoso).+ * - Detail panel is still `PanelRenderer` (unchanged; consumed via the+ * catalogue adapter so panels see the same `ProviderConfig` shape).+ *+ * Additive safety: if the server fetch fails or hasn't landed yet, the+ * modal falls back to the client-owned `PROVIDERS` from `providers.tsx`.+ * That file stays in place until Phase 8 verification passes.*/-import React, { useMemo, useState } from 'react';-import { Menu, Tag, Flex, type MenuProps } from 'antd';+import React, { useMemo } from 'react';+import { Tag, Flex, Spin } from 'antd';import { SafetyOutlined } from '@ant-design/icons';+import Modal from '../ui/Modal';import { useAppTheme } from '../../hooks/useAppTheme';-import { CATEGORIES, PROVIDERS } from './providers';+import { CATEGORIES as CLIENT_CATEGORIES, PROVIDERS as CLIENT_PROVIDERS } from './providers';import PanelRenderer from './PanelRenderer';+import CredentialsPalette from './CredentialsPalette';+import { rehydrateCatalogue } from './catalogueAdapter';+import { useCatalogueQuery } from '../../hooks/useCatalogueQuery';+import { useCredentialRegistry } from '../../store/useCredentialRegistry';interface Props {visible: boolean;@@ -19,59 +33,134 @@ interface Props {const CredentialsModal: React.FC<Props> = ({ visible, onClose }) => {const theme = useAppTheme();- const [selectedId, setSelectedId] = useState<string>(PROVIDERS[0]?.id ?? '');- const selected = PROVIDERS.find(p => p.id === selectedId) ?? null;- // Build antd Menu items from CATEGORIES — each category becomes an itemGroup- const menuItems: MenuProps['items'] = useMemo(() =>- CATEGORIES.map(cat => ({- type: 'group' as const,- key: cat.key,- label: cat.label,- children: cat.items.map(p => ({- key: p.id,- icon: <p.icon size={parseInt(theme.iconSize.sm)} />,- label: p.name,- })),- })),- [theme.iconSize.sm]);+ // UI state lives in the Zustand store (no catalogue data ever).+ const selectedId = useCredentialRegistry((s) => s.selectedId);+ const setSelectedId = useCredentialRegistry((s) => s.setSelectedId);++ // Server-owned catalogue with IDB warm-start.+ const catalogue = useCatalogueQuery();++ // Rehydrate server JSON → runtime ProviderConfig shape; fall back to+ // the client-owned registry if the server data hasn't arrived (cold+ // start with no IDB cache, server unreachable, etc.).+ const { providers, categories } = useMemo(() => {+ if (catalogue.data) return rehydrateCatalogue(catalogue.data);+ return { providers: CLIENT_PROVIDERS, categories: CLIENT_CATEGORIES };+ }, [catalogue.data]);++ // Default selection: if nothing is selected yet (or the previous+ // selection isn't in the current catalogue), pick the first provider.+ const effectiveSelectedId = useMemo(() => {+ if (selectedId && providers.some((p) => p.id === selectedId)) return selectedId;+ return providers[0]?.id ?? null;+ }, [selectedId, providers]);++ // Keep the store in sync without causing a render loop — only update+ // when the effective id diverges from the stored one.+ React.useEffect(() => {+ if (effectiveSelectedId && effectiveSelectedId !== selectedId) {+ setSelectedId(effectiveSelectedId);+ }+ }, [effectiveSelectedId, selectedId, setSelectedId]);++ const selected = useMemo(+ () => providers.find((p) => p.id === effectiveSelectedId) ?? null,+ [providers, effectiveSelectedId],+ );++ const usingServerData = !!catalogue.data;+ const isLoadingServer = catalogue.isLoading && !catalogue.data;const headerActions = (<Flex align="center" gap={theme.spacing.md}>- <Flex align="center" gap={theme.spacing.sm}- style={{ fontSize: theme.fontSize.base, fontWeight: theme.fontWeight.semibold, color: theme.colors.text }}>+ <Flex+ align="center"+ gap={theme.spacing.sm}+ style={{+ fontSize: theme.fontSize.base,+ fontWeight: theme.fontWeight.semibold,+ color: theme.colors.text,+ }}+ ><SafetyOutlined style={{ color: theme.dracula.yellow }} /><span>API Credentials</span></Flex>- <Tag style={{- margin: 0, fontSize: theme.fontSize.xs,- backgroundColor: `${theme.dracula.green}25`,- borderColor: `${theme.dracula.green}60`,- color: theme.dracula.green,- }}>- {PROVIDERS.length} providers+ <Tag+ style={{+ margin: 0,+ fontSize: theme.fontSize.xs,+ backgroundColor: `${theme.dracula.green}25`,+ borderColor: `${theme.dracula.green}60`,+ color: theme.dracula.green,+ }}+ >+ {providers.length} providers</Tag>+ {isLoadingServer && (+ <Tag+ style={{+ margin: 0,+ fontSize: theme.fontSize.xs,+ backgroundColor: `${theme.dracula.cyan}25`,+ borderColor: `${theme.dracula.cyan}60`,+ color: theme.dracula.cyan,+ }}+ >+ <Spin size="small" /> loading+ </Tag>+ )}+ {!usingServerData && !isLoadingServer && (+ <Tag+ style={{+ margin: 0,+ fontSize: theme.fontSize.xs,+ backgroundColor: `${theme.dracula.orange}25`,+ borderColor: `${theme.dracula.orange}60`,+ color: theme.dracula.orange,+ }}+ title="Using bundled fallback catalogue"+ >+ offline+ </Tag>+ )}</Flex>);return (- <Modal isOpen={visible} onClose={onClose} maxWidth="95vw" maxHeight="95vh" headerActions={headerActions}>+ <Modal+ isOpen={visible}+ onClose={onClose}+ maxWidth="95vw"+ maxHeight="95vh"+ headerActions={headerActions}+ ><Flex style={{ height: '100%', overflow: 'hidden' }}>- <div style={{- width: parseInt(theme.layout?.parameterPanelWidth ?? '280px'),- borderRight: `1px solid ${theme.colors.border}`,- overflow: 'auto',- flexShrink: 0,- }}>- <Menu- mode="inline"- selectedKeys={[selectedId]}- onClick={({ key }) => setSelectedId(key as string)}- items={menuItems}- style={{ border: 'none', background: 'transparent' }}+ <div+ style={{+ width: parseInt(theme.layout?.parameterPanelWidth ?? '280px'),+ borderRight: `1px solid ${theme.colors.border}`,+ flexShrink: 0,+ display: 'flex',+ flexDirection: 'column',+ }}+ >+ <CredentialsPalette+ providers={providers}+ categories={categories}+ selectedId={effectiveSelectedId}+ onSelect={setSelectedId}/></div>- <div style={{ flex: 1, overflow: 'auto', backgroundColor: theme.colors.background, display: 'flex', flexDirection: 'column' }}>+ <div+ style={{+ flex: 1,+ overflow: 'auto',+ backgroundColor: theme.colors.background,+ display: 'flex',+ flexDirection: 'column',+ }}+ ><PanelRenderer config={selected} visible={visible} /></div></Flex>diff --git a/client/src/components/credentials/CredentialsPalette.tsx b/client/src/components/credentials/CredentialsPalette.tsxnew file mode 100644index 00000000..e2a29158--- /dev/null+++ b/client/src/components/credentials/CredentialsPalette.tsx@@ -0,0 +1,334 @@+/**+ * CredentialsPalette — virtualized, searchable provider picker.+ *+ * Drop-in replacement for the antd `Menu` sidebar in `CredentialsModal`.+ * Scales from 20 → 5000 providers at 60 fps with < 200 ms INP during+ * rapid typing, per the runtime/memory targets in+ * `docs-internal/credentials_scaling/architecture.md`.+ *+ * Stack:+ * - `cmdk` for the Command shell + keyboard navigation + a11y.+ * - `fuzzysort` for pre-indexed fuzzy search (~1–2 ms per query on+ * 5000 entries).+ * - `react-virtuoso` `GroupedVirtuoso` for a DOM pool of ~10–50 nodes+ * regardless of item count, with sticky category headers.+ * - `startTransition` wrapping the filter update so the input stays+ * synchronous and typing never stalls (measured ~30–70 ms shorter+ * long task vs `useDeferredValue`).+ *+ * Store-shape rule: all derived data (prepared index, byId map,+ * filtered result, groupCounts) lives in `useMemo` inside this+ * component. Nothing touches Zustand. The store only holds UI state+ * (`selectedId`, `query`), which is how we avoid the #1 runtime/memory+ * trap (selector closures retaining the whole catalogue).+ */++import React, {+ memo,+ startTransition,+ useCallback,+ useDeferredValue,+ useMemo,+ useState,+} from 'react';+import { Command } from 'cmdk';+import { GroupedVirtuoso } from 'react-virtuoso';+import fuzzysort from 'fuzzysort';+import { Flex, Input } from 'antd';+import { SearchOutlined } from '@ant-design/icons';++import type { ProviderConfig, CategoryGroup } from './types';+import { useAppTheme } from '../../hooks/useAppTheme';++// ============================================================================+// Props+// ============================================================================++export interface CredentialsPaletteProps {+ providers: ProviderConfig[];+ categories: CategoryGroup[];+ selectedId: string | null;+ onSelect: (id: string) => void;+ /** Height of the scrollable list area. */+ height?: number | string;+ /** Optional placeholder for the search input. */+ placeholder?: string;+}++// ============================================================================+// Pre-indexed search+// ============================================================================++interface PreparedEntry {+ provider: ProviderConfig;+ _name: Fuzzysort.Prepared;+ _category: Fuzzysort.Prepared;+}++function buildPrepared(providers: ProviderConfig[]): PreparedEntry[] {+ return providers.map((p) => ({+ provider: p,+ _name: fuzzysort.prepare(p.name),+ _category: fuzzysort.prepare(p.categoryLabel),+ }));+}++function filterProviders(query: string, prepared: PreparedEntry[]): ProviderConfig[] {+ if (!query.trim()) return prepared.map((e) => e.provider);+ const results = fuzzysort.go(query, prepared, {+ keys: ['_name', '_category'],+ threshold: -10_000,+ limit: 500,+ });+ return results.map((r) => r.obj.provider);+}++// ============================================================================+// Grouping (derived; never stored)+// ============================================================================++interface GroupedView {+ groups: CategoryGroup[];+ groupCounts: number[];+ flatItems: ProviderConfig[];+}++function groupFiltered(filtered: ProviderConfig[], categoryOrder: CategoryGroup[]): GroupedView {+ // Preserve the canonical category order from the server payload; for+ // each category, emit only those filtered providers that belong to it.+ const byCat = new Map<string, ProviderConfig[]>();+ for (const p of filtered) {+ const arr = byCat.get(p.category);+ if (arr) arr.push(p);+ else byCat.set(p.category, [p]);+ }++ const groups: CategoryGroup[] = [];+ const groupCounts: number[] = [];+ const flatItems: ProviderConfig[] = [];++ for (const cat of categoryOrder) {+ const items = byCat.get(cat.key);+ if (!items || items.length === 0) continue;+ groups.push({ key: cat.key, label: cat.label, items });+ groupCounts.push(items.length);+ flatItems.push(...items);+ }++ // Any provider whose category isn't in `categoryOrder` (server may+ // send a new category mid-session) still needs to render — bucket them+ // under a synthetic "Other" group at the end.+ const known = new Set(categoryOrder.map((c) => c.key));+ const orphans: ProviderConfig[] = [];+ for (const [catKey, items] of byCat.entries()) {+ if (!known.has(catKey)) orphans.push(...items);+ }+ if (orphans.length > 0) {+ groups.push({ key: '_other', label: 'Other', items: orphans });+ groupCounts.push(orphans.length);+ flatItems.push(...orphans);+ }++ return { groups, groupCounts, flatItems };+}++// ============================================================================+// Row renderer — memoized to stop upstream re-renders from cascading+// ============================================================================++interface RowProps {+ provider: ProviderConfig;+ selected: boolean;+ onSelect: (id: string) => void;+ theme: ReturnType<typeof useAppTheme>;+}++const ProviderRow = memo<RowProps>(function ProviderRow({ provider, selected, onSelect, theme }) {+ const Icon = provider.icon;+ const handleClick = useCallback(() => onSelect(provider.id), [onSelect, provider.id]);++ const bg = selected ? `${theme.dracula.purple}18` : 'transparent';+ const border = selected ? `1px solid ${theme.dracula.purple}60` : '1px solid transparent';++ return (+ <Command.Item+ value={provider.id}+ onSelect={handleClick}+ className="machinaos-palette-row"+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: theme.spacing.md,+ padding: `${theme.spacing.sm} ${theme.spacing.md}`,+ cursor: 'pointer',+ borderRadius: theme.borderRadius.sm,+ background: bg,+ border,+ color: theme.colors.text,+ fontSize: theme.fontSize.sm,+ }}+ >+ <Flex+ align="center"+ justify="center"+ style={{ width: 24, height: 24, flexShrink: 0, color: theme.colors.text }}+ >+ <Icon size={parseInt(theme.iconSize.sm)} />+ </Flex>+ <span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>+ {provider.name}+ </span>+ </Command.Item>+ );+});++// ============================================================================+// Group header renderer+// ============================================================================++interface HeaderProps {+ label: string;+ count: number;+ theme: ReturnType<typeof useAppTheme>;+}++const GroupHeader = memo<HeaderProps>(function GroupHeader({ label, count, theme }) {+ return (+ <div+ style={{+ position: 'sticky',+ top: 0,+ zIndex: 1,+ padding: `${theme.spacing.xs} ${theme.spacing.md}`,+ background: theme.colors.background,+ borderBottom: `1px solid ${theme.colors.border}`,+ fontSize: theme.fontSize.xs,+ fontWeight: theme.fontWeight.semibold,+ color: theme.colors.textSecondary,+ textTransform: 'uppercase',+ letterSpacing: '0.04em',+ display: 'flex',+ justifyContent: 'space-between',+ }}+ >+ <span>{label}</span>+ <span style={{ color: theme.colors.textSecondary, opacity: 0.6 }}>+ {count}+ </span>+ </div>+ );+});++// ============================================================================+// The palette component+// ============================================================================++const CredentialsPalette: React.FC<CredentialsPaletteProps> = ({+ providers,+ categories,+ selectedId,+ onSelect,+ height = '100%',+ placeholder = 'Search providers…',+}) => {+ const theme = useAppTheme();++ // Pre-indexed fuzzysort entries — rebuilt only when `providers` reference changes.+ const prepared = useMemo(() => buildPrepared(providers), [providers]);++ // Input value is synchronous; filter is deferred via startTransition.+ const [query, setQuery] = useState('');+ const [filtered, setFiltered] = useState<ProviderConfig[]>(() => providers);++ // If the providers array changes (e.g. after a server revalidate+ // replaces the TanStack Query cache), reset the filtered set.+ const prevProvidersRef = React.useRef(providers);+ if (prevProvidersRef.current !== providers) {+ prevProvidersRef.current = providers;+ // Synchronous update here is fine: happens at most once per catalogue change.+ setFiltered(filterProviders(query, prepared));+ }++ const handleQueryChange = useCallback(+ (e: React.ChangeEvent<HTMLInputElement>) => {+ const v = e.target.value;+ setQuery(v);+ startTransition(() => {+ setFiltered(filterProviders(v, prepared));+ });+ },+ [prepared],+ );++ // Deferred query for group derivation (avoid recomputing on every keystroke+ // if React batches filter updates slower than the input).+ const deferredFiltered = useDeferredValue(filtered);++ const grouped = useMemo<GroupedView>(+ () => groupFiltered(deferredFiltered, categories),+ [deferredFiltered, categories],+ );++ return (+ <Command+ // cmdk disables built-in filtering so we can use fuzzysort instead.+ shouldFilter={false}+ label="Credential providers"+ style={{ display: 'flex', flexDirection: 'column', height: '100%', width: '100%' }}+ >+ <div style={{ padding: theme.spacing.sm, borderBottom: `1px solid ${theme.colors.border}` }}>+ <Input+ value={query}+ onChange={handleQueryChange}+ placeholder={placeholder}+ prefix={<SearchOutlined style={{ color: theme.colors.textSecondary }} />}+ allowClear+ size="middle"+ autoFocus+ />+ </div>+ <div style={{ flex: 1, minHeight: 0 }}>+ {grouped.flatItems.length === 0 ? (+ <Flex+ align="center"+ justify="center"+ style={{+ height: '100%',+ color: theme.colors.textSecondary,+ fontSize: theme.fontSize.sm,+ opacity: 0.7,+ }}+ >+ No providers match “{query}”+ </Flex>+ ) : (+ <GroupedVirtuoso+ style={{ height }}+ groupCounts={grouped.groupCounts}+ groupContent={(idx) => (+ <GroupHeader+ label={grouped.groups[idx].label}+ count={grouped.groupCounts[idx]}+ theme={theme}+ />+ )}+ itemContent={(idx) => {+ const p = grouped.flatItems[idx];+ if (!p) return null;+ return (+ <ProviderRow+ provider={p}+ selected={p.id === selectedId}+ onSelect={onSelect}+ theme={theme}+ />+ );+ }}+ />+ )}+ </div>+ </Command>+ );+};++export default memo(CredentialsPalette);diff --git a/client/src/components/credentials/PanelRenderer.tsx b/client/src/components/credentials/PanelRenderer.tsxindex 2639e0c9..4e9058a8 100644--- a/client/src/components/credentials/PanelRenderer.tsx+++ b/client/src/components/credentials/PanelRenderer.tsx@@ -1,29 +1,75 @@/**- * PanelRenderer — dispatches to the right panel by config.kind.- * 10 lines of logic. All panel implementations in panels/ directory.+ * PanelRenderer — lazy panel dispatch.+ *+ * Phase 5 of the credentials-scaling plan: each panel is loaded on+ * demand via `React.lazy` + Vite dynamic `import()`. First selection of+ * a given panel kind pays a one-time ~10–50 ms chunk-fetch cost; every+ * subsequent selection is instant. Reduces the credentials modal's+ * initial JS payload and lets Vite emit one chunk per panel kind.+ *+ * Panels are cached at module scope so switching providers of the same+ * kind does not trip Suspense on every click.*/-import React from 'react';-import { Result } from 'antd';-import ApiKeyPanel from './panels/ApiKeyPanel';-import OAuthPanel from './panels/OAuthPanel';-import QrPairingPanel from './panels/QrPairingPanel';-import EmailPanel from './panels/EmailPanel';-import type { ProviderConfig } from './types';--const PANEL_MAP: Record<string, React.FC<any>> = {- apiKey: ApiKeyPanel,- oauth: OAuthPanel,- qrPairing: QrPairingPanel,- email: EmailPanel,+import React, { Suspense, useMemo } from 'react';+import { Flex, Result, Spin } from 'antd';+import type { ProviderConfig, PanelKind } from './types';++// Vite will emit one chunk per panel under dist/assets/ApiKeyPanel-*.js,+// OAuthPanel-*.js, etc. Keep the import paths inside the arrow fns so+// code splitting is preserved.+const PANEL_LOADERS: Record<PanelKind, () => Promise<{ default: React.ComponentType<PanelProps> }>> = {+ apiKey: () => import('./panels/ApiKeyPanel'),+ oauth: () => import('./panels/OAuthPanel'),+ qrPairing: () => import('./panels/QrPairingPanel'),+ email: () => import('./panels/EmailPanel'),+};++// Memoize the lazy wrappers at module scope so switching providers of+// the same kind doesn't re-trigger Suspense. React.lazy memoizes too+// internally, but declaring them once makes the intent explicit and+// avoids any HMR edge cases.+const LAZY_PANELS: Record<PanelKind, React.LazyExoticComponent<React.ComponentType<PanelProps>>> = {+ apiKey: React.lazy(PANEL_LOADERS.apiKey),+ oauth: React.lazy(PANEL_LOADERS.oauth),+ qrPairing: React.lazy(PANEL_LOADERS.qrPairing),+ email: React.lazy(PANEL_LOADERS.email),};-interface Props { config: ProviderConfig | null; visible: boolean }+interface PanelProps {+ config: ProviderConfig;+ visible: boolean;+}++interface Props {+ config: ProviderConfig | null;+ visible: boolean;+}++const PanelFallback: React.FC = () => (+ <Flex align="center" justify="center" style={{ width: '100%', height: '100%', minHeight: 240 }}>+ <Spin />+ </Flex>+);const PanelRenderer: React.FC<Props> = ({ config, visible }) => {- if (!config) return <Result status="info" subTitle="Select a credential to configure" />;- const Panel = PANEL_MAP[config.kind];- return Panel ? <Panel config={config} visible={visible} /> : null;+ const Lazy = useMemo(() => {+ if (!config) return null;+ return LAZY_PANELS[config.kind] ?? null;+ }, [config]);++ if (!config) {+ return <Result status="info" subTitle="Select a credential to configure" />;+ }+ if (!Lazy) {+ return <Result status="warning" subTitle={`Unknown credential kind: ${config.kind}`} />;+ }++ return (+ <Suspense fallback={<PanelFallback />}>+ <Lazy config={config} visible={visible} />+ </Suspense>+ );};export default PanelRenderer;diff --git a/client/src/components/credentials/catalogueAdapter.ts b/client/src/components/credentials/catalogueAdapter.tsnew file mode 100644index 00000000..b65f468b--- /dev/null+++ b/client/src/components/credentials/catalogueAdapter.ts@@ -0,0 +1,343 @@+/**+ * Catalogue adapter — server JSON → runtime ProviderConfig.+ *+ * The credential registry JSON on the server (see+ * `server/config/credential_providers.json`) cannot contain React+ * components or function callbacks. It uses string field refs like+ * `ok_field: "connected"` and `icon_ref: "raw_svg:SearchIcons.brave"`.+ *+ * This module hydrates that declarative JSON into the React-coupled+ * `ProviderConfig` shape that `panels/`, `primitives/`, and+ * `PanelRenderer.tsx` already consume — so the existing panel code is+ * unchanged and the migration is additive.+ *+ * Icon factories and asset module imports deliberately mirror+ * `providers.tsx` so that rehydrated providers render byte-identically+ * to the current client-owned registry. When `providers.tsx` is deleted+ * in Phase 8, this module becomes the canonical resolver.+ */++import React from 'react';++import { AI_PROVIDER_META } from '../icons/AIProviderIcons';+import { ApifyIcons } from '../../assets/icons/apify';+import { SearchIcons } from '../../assets/icons/search';+import { TelegramIcons } from '../../assets/icons/telegram';+import { GoogleIcons } from '../../assets/icons/google';+import { EmailIcons } from '../../assets/icons/email';+import { WHATSAPP_CONNECT_ICON } from '../../nodeDefinitions/whatsappNodes';+import { TWITTER_ICON } from '../../nodeDefinitions/twitterNodes';++import type {+ ProviderConfig,+ CategoryGroup,+ PanelKind,+ FieldDef,+ StatusRowDef,+ ActionDef,+ QrPairingDef,+} from './types';+import type {+ ServerProviderConfig,+ ServerCategory,+ ServerFieldDef,+ ServerStatusRowDef,+ ServerActionDef,+ ServerQrDef,+ CatalogueResponse,+} from '../../hooks/useCatalogueQuery';++// ============================================================================+// Icon factories — duplicated from providers.tsx to keep this adapter+// self-contained. Keep in sync until providers.tsx is deleted in Phase 8.+// ============================================================================++interface IconProps {+ size: number;+}++const fromRawSvg = (rawSvg: string): React.FC<IconProps> => {+ const Comp: React.FC<IconProps> = ({ size }) => {+ const ref = React.useRef<HTMLDivElement>(null);+ React.useEffect(() => {+ if (ref.current) ref.current.innerHTML = rawSvg;+ }, []);+ return React.createElement('div', { ref, style: { width: size, height: size } });+ };+ return Comp;+};++const fromDataUri = (dataUri: string): React.FC<IconProps> => {+ const Comp: React.FC<IconProps> = ({ size }) =>+ React.createElement('img', {+ src: dataUri,+ width: size,+ height: size,+ alt: '',+ style: { display: 'block' },+ });+ return Comp;+};++const fromEmoji = (emoji: string): React.FC<IconProps> => {+ const Comp: React.FC<IconProps> = ({ size }) =>+ React.createElement(+ 'span',+ { style: { fontSize: size, lineHeight: 1, display: 'inline-block' } },+ emoji,+ );+ return Comp;+};++// Apify needs the root <svg> scaled to 100% of the wrapper.+const ApifyIconC: React.FC<IconProps> = ({ size }) => {+ const scaled = ApifyIcons.apify.replace('<svg', '<svg width="100%" height="100%"');+ return React.createElement('div', {+ dangerouslySetInnerHTML: { __html: scaled },+ style: { width: size, height: size },+ });+};++// ============================================================================+// Icon ref resolver+//+// JSON `icon_ref` values use a small DSL:+// "ai:openai" → AI_PROVIDER_META[openai].Icon+// "raw_svg:SearchIcons.brave" → fromRawSvg(SearchIcons.brave)+// "raw_svg:ApifyIcons.apify" → ApifyIconC (needs explicit scale)+// "data_uri:WHATSAPP_CONNECT_ICON" → fromDataUri(WHATSAPP_CONNECT_ICON)+// "emoji:📱" → fromEmoji('📱')+// ============================================================================++const RAW_SVG_REGISTRY: Record<string, Record<string, string>> = {+ SearchIcons,+ TelegramIcons,+ GoogleIcons,+ EmailIcons,+ ApifyIcons,+};++const DATA_URI_REGISTRY: Record<string, string> = {+ WHATSAPP_CONNECT_ICON,+ TWITTER_ICON,+};++// Fallback for providers whose icon_ref cannot be resolved — renders a+// circle with the provider initial, so the palette never shows nothing.+const fallbackIcon = (initial: string): React.FC<IconProps> => {+ const Comp: React.FC<IconProps> = ({ size }) =>+ React.createElement(+ 'div',+ {+ style: {+ width: size,+ height: size,+ borderRadius: '50%',+ background: 'rgba(128,128,128,0.2)',+ color: 'currentColor',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ fontSize: Math.max(10, size * 0.55),+ fontWeight: 600,+ },+ },+ initial,+ );+ return Comp;+};++function resolveIcon(iconRef: string | undefined, providerId: string): React.FC<IconProps> {+ const initial = (providerId[0] ?? '?').toUpperCase();+ if (!iconRef) return fallbackIcon(initial);++ const colon = iconRef.indexOf(':');+ if (colon < 0) return fallbackIcon(initial);++ const kind = iconRef.slice(0, colon);+ const rest = iconRef.slice(colon + 1);++ switch (kind) {+ case 'ai': {+ const meta = AI_PROVIDER_META[rest];+ return meta?.Icon ?? fallbackIcon(initial);+ }+ case 'raw_svg': {+ // e.g. "SearchIcons.brave"+ const [module, key] = rest.split('.');+ if (module === 'ApifyIcons' && key === 'apify') return ApifyIconC;+ const svgMap = RAW_SVG_REGISTRY[module];+ const svg = svgMap?.[key];+ return svg ? fromRawSvg(svg) : fallbackIcon(initial);+ }+ case 'data_uri': {+ const uri = DATA_URI_REGISTRY[rest];+ return uri ? fromDataUri(uri) : fallbackIcon(initial);+ }+ case 'emoji':+ return fromEmoji(rest);+ default:+ return fallbackIcon(initial);+ }+}++// ============================================================================+// Status-row / action / QR rehydrators+//+// Server JSON uses string field refs + the `!` prefix for negation. We+// compile these into closures so panels can call them directly without+// knowing about the wire format.+// ============================================================================++/** Evaluate a single field reference with optional `!` negation. */+function evalRef(status: unknown, field: string): boolean {+ if (typeof field !== 'string' || field.length === 0) return false;+ const negate = field.startsWith('!');+ const key = negate ? field.slice(1) : field;+ const val = status && typeof status === 'object' ? (status as Record<string, unknown>)[key] : undefined;+ const truthy = !!val;+ return negate ? !truthy : truthy;+}++function buildStatusRows(defs: ServerStatusRowDef[] | undefined): StatusRowDef[] | undefined {+ if (!defs || defs.length === 0) return undefined;+ return defs.map((d) => ({+ label: d.label,+ ok: (status: unknown) => evalRef(status, d.ok_field),+ trueText: d.true_text,+ falseText: d.false_text,+ warn: d.warn,+ }));+}++function buildActions(defs: ServerActionDef[] | undefined): ActionDef[] | undefined {+ if (!defs || defs.length === 0) return undefined;+ return defs.map((d) => {+ let disabled: ActionDef['disabled'] = undefined;+ if (d.disabled_when && d.disabled_when.length > 0) {+ // `disabled_when: ["paired", "!stored"]` means disabled if+ // status.paired is truthy OR stored is falsy.+ disabled = (status, stored) =>+ d.disabled_when!.some((ref) => {+ if (ref === 'stored') return !!stored;+ if (ref === '!stored') return !stored;+ return evalRef(status, ref);+ });+ }+ return {+ key: d.key,+ label: d.label,+ themeColor: d.theme_color,+ disabled,+ };+ });+}++function buildQr(def: ServerQrDef | undefined): QrPairingDef | undefined {+ if (!def) return undefined;+ const isConnected = (status: unknown) => evalRef(status, def.is_connected_field);+ const isLoading = (status: unknown) =>+ (def.is_loading_fields ?? []).every((f) => evalRef(status, f));+ const connectedSubtitle = (status: unknown): string => {+ if (def.connected_subtitle_static) return def.connected_subtitle_static;+ if (def.connected_subtitle_field) {+ const val =+ status && typeof status === 'object'+ ? (status as Record<string, unknown>)[def.connected_subtitle_field]+ : undefined;+ if (typeof val === 'string' && val.length > 0) return val;+ }+ return def.connected_subtitle_fallback ?? '';+ };+ const emptyText = (status: unknown, stored: boolean): string => {+ if (!stored && def.empty_text_no_key) return def.empty_text_no_key;+ const running = evalRef(status, 'running') || evalRef(status, 'connected');+ if (running && def.empty_text_running) return def.empty_text_running;+ return def.empty_text_stopped ?? '';+ };+ return {+ qrField: def.qr_field,+ isConnected,+ connectedTitle: def.connected_title,+ connectedSubtitle,+ isLoading,+ emptyText,+ scanText: def.scan_text,+ };+}++function buildFields(defs: ServerFieldDef[] | undefined): FieldDef[] | undefined {+ if (!defs || defs.length === 0) return undefined;+ return defs.map((d) => ({+ key: d.key,+ label: d.label ?? d.key,+ secret: d.secret ?? d.type === 'password',+ placeholder: d.placeholder,+ required: d.required,+ }));+}++// ============================================================================+// Public API+// ============================================================================++/** Rehydrate one server provider entry into the runtime ProviderConfig. */+export function rehydrateProvider(entry: ServerProviderConfig): ProviderConfig {+ return {+ id: entry.id,+ name: entry.name,+ category: entry.category,+ categoryLabel: entry.category_label,+ color: entry.color,+ kind: entry.kind as PanelKind,+ icon: resolveIcon(entry.icon_ref, entry.id),+ fields: buildFields(entry.fields),+ ws: entry.ws,+ statusHook: entry.status_hook,+ statusRows: buildStatusRows(entry.status_rows),+ actions: buildActions(entry.actions),+ qr: buildQr(entry.qr),+ validateAs: entry.validate_as,+ callbackUrl: entry.callback_url,+ instructions: entry.instructions,+ hasDefaults: entry.has_defaults,+ hasRateLimits: entry.has_rate_limits,+ usageService: entry.usage_service,+ };+}++/**+ * Rehydrate the full catalogue payload.+ *+ * Returns `{ providers, categories }` in the exact same shape the existing+ * `providers.tsx` module exports, so `CredentialsModal` can swap its data+ * source without any other change.+ */+export function rehydrateCatalogue(payload: CatalogueResponse): {+ providers: ProviderConfig[];+ categories: CategoryGroup[];+} {+ const providers = payload.providers.map(rehydrateProvider);++ // Build ordered categories from the server-declared order, then fill+ // items in provider insertion order (matches the current pattern in+ // providers.tsx).+ const byCategory = new Map<string, CategoryGroup>();+ for (const cat of payload.categories as ServerCategory[]) {+ byCategory.set(cat.key, { key: cat.key, label: cat.label, items: [] });+ }+ for (const p of providers) {+ let group = byCategory.get(p.category);+ if (!group) {+ // A provider referenced an unknown category — fall back to the+ // provider-declared categoryLabel so nothing gets dropped.+ group = { key: p.category, label: p.categoryLabel, items: [] };+ byCategory.set(p.category, group);+ }+ group.items.push(p);+ }++ // Strip empty categories so the palette doesn't render empty headers.+ const categories = Array.from(byCategory.values()).filter((c) => c.items.length > 0);+ return { providers, categories };+}diff --git a/client/src/components/credentials/schema/extends.ts b/client/src/components/credentials/schema/extends.tsnew file mode 100644index 00000000..0dc282e5--- /dev/null+++ b/client/src/components/credentials/schema/extends.ts@@ -0,0 +1,168 @@+/**+ * Client-side schema inheritance helpers.+ *+ * TypeScript port of n8n's `NodeHelpers.mergeNodeProperties` pattern,+ * mirrored exactly after `server/services/credential_registry.py::_deep_merge`+ * so the client and server produce byte-identical results when resolving+ * a provider's `extends` chain.+ *+ * Array fields listed in `MERGE_BY_KEY_ARRAYS` merge by their `key` field:+ * child entries with a matching `key` deep-merge into the parent; unmatched+ * child entries append. Other arrays are replaced wholesale.+ *+ * Usage contexts (all additive — zero callers today):+ *+ * 1. **Future offline catalogue**: if we later bundle a+ * `credential_providers.json` snapshot for zero-network cold starts,+ * the client needs to resolve `extends` without a server roundtrip.+ * 2. **Phase B NodeSpec registry**: NodeSpecs inherit via the same+ * pattern. Sharing this helper avoids duplicating merge semantics.+ * 3. **Hot-reload preview**: dev-mode UI that wants to preview a+ * provider spec before the server reloads it.+ *+ * The credentials panel as shipped today always calls+ * `credential_registry.resolve_extends()` server-side and returns the+ * already-flattened providers to the client (see+ * `server/routers/websocket.py::handle_get_credential_catalogue`). The+ * client never needs to merge at runtime in the current shipping path.+ */++type Jsonish =+ | string+ | number+ | boolean+ | null+ | Jsonish[]+ | { [key: string]: Jsonish | undefined };++type JsonRecord = { [key: string]: Jsonish | undefined };++/**+ * Field names whose array values should be merged by each element's `key`+ * property rather than replaced wholesale. Matches the set in+ * `server/services/credential_registry.py::_MERGE_BY_KEY_ARRAYS`.+ */+export const MERGE_BY_KEY_ARRAYS: ReadonlySet<string> = new Set([+ 'fields',+ 'status_rows',+ 'actions',+ // Frontend-shape aliases (used when this helper is applied to+ // already-rehydrated ProviderConfig objects rather than raw JSON).+ 'statusRows',+]);++function isPlainObject(value: unknown): value is JsonRecord {+ if (value === null || typeof value !== 'object') return false;+ const proto = Object.getPrototypeOf(value);+ return proto === Object.prototype || proto === null;+}++function cloneDeep<T>(value: T): T {+ if (value === null || typeof value !== 'object') return value;+ if (Array.isArray(value)) return value.map((item) => cloneDeep(item)) as unknown as T;+ const out: JsonRecord = {};+ for (const [k, v] of Object.entries(value as JsonRecord)) {+ out[k] = cloneDeep(v);+ }+ return out as unknown as T;+}++/**+ * Merge two arrays of objects by each element's `key` field.+ *+ * - Parent entries appear first, in their original order.+ * - Child entries with a matching `key` deep-merge into the parent (child+ * wins on scalar conflicts; nested dicts recurse via {@link deepMerge}).+ * - Unmatched child entries append in child order.+ * - Entries without a `key` on either side are treated as identity+ * replacements: the unkeyed parent is preserved, the unkeyed child+ * appends at the end.+ */+function mergeArrayByKey(parent: Jsonish[], child: Jsonish[]): Jsonish[] {+ const byKey = new Map<string, Jsonish>();+ const order: string[] = [];++ const itemKey = (item: Jsonish, prefix: string, index: number): string => {+ if (isPlainObject(item) && typeof item.key === 'string') {+ return item.key;+ }+ return `${prefix}:${index}`;+ };++ parent.forEach((item, i) => {+ const k = itemKey(item, 'parent', i);+ byKey.set(k, cloneDeep(item));+ order.push(k);+ });++ child.forEach((item, i) => {+ if (isPlainObject(item) && typeof item.key === 'string') {+ const k = item.key;+ const existing = byKey.get(k);+ if (isPlainObject(existing)) {+ byKey.set(k, deepMerge(existing, item));+ } else {+ byKey.set(k, cloneDeep(item));+ if (!order.includes(k)) order.push(k);+ }+ } else {+ const k = `child:${i}`;+ byKey.set(k, cloneDeep(item));+ order.push(k);+ }+ });++ return order.map((k) => byKey.get(k) as Jsonish);+}++/**+ * Deep-merge `parent` with `child`:+ *+ * - Nested plain objects merge recursively.+ * - Arrays named in {@link MERGE_BY_KEY_ARRAYS} merge by `key` via+ * {@link mergeArrayByKey}.+ * - All other arrays and scalars are replaced wholesale by the child.+ * - The child's `extends` key is ignored (resolved at a higher layer).+ */+export function deepMerge(parent: JsonRecord, child: JsonRecord): JsonRecord {+ const result: JsonRecord = cloneDeep(parent);+ for (const [key, childValue] of Object.entries(child)) {+ if (key === 'extends') continue;+ if (childValue === undefined) continue;++ const parentValue = result[key];++ if (isPlainObject(parentValue) && isPlainObject(childValue)) {+ result[key] = deepMerge(parentValue, childValue);+ continue;+ }++ if (+ MERGE_BY_KEY_ARRAYS.has(key) &&+ Array.isArray(parentValue) &&+ Array.isArray(childValue)+ ) {+ result[key] = mergeArrayByKey(parentValue, childValue);+ continue;+ }++ result[key] = cloneDeep(childValue);+ }+ return result;+}++/**+ * Public convenience: merge a parent and child `ProviderConfig`-shaped+ * blob, returning a new object with the child's `extends` stripped. The+ * returned value is always a fresh deep-clone; callers can safely mutate.+ *+ * Typical usage (once client-side `extends` resolution is wired):+ *+ * const resolved = mergeProperties(parentSpec, childSpec);+ */+export function mergeProperties<+ P extends Record<string, unknown>,+ C extends Record<string, unknown>,+>(parent: P, child: C): P & Omit<C, 'extends'> {+ return deepMerge(parent as JsonRecord, child as JsonRecord) as P & Omit<C, 'extends'>;+}diff --git a/client/src/hooks/useCatalogueQuery.ts b/client/src/hooks/useCatalogueQuery.tsnew file mode 100644index 00000000..66e88ae0--- /dev/null+++ b/client/src/hooks/useCatalogueQuery.ts@@ -0,0 +1,312 @@+/**+ * Credentials catalogue fetch hook.+ *+ * Owns the 20 → 5000 provider catalogue. Follows the Phase 3 architecture+ * from `docs-internal/credentials_scaling/architecture.md`:+ *+ * 1. TanStack Query owns the server cache (`['credentialCatalogue']`).+ * 2. `idb-keyval` provides a warm-start persistence layer so the second+ * app open is `< 50 ms` instead of a fresh WebSocket roundtrip.+ * 3. The hydration write is deferred via `requestIdleCallback` to avoid+ * the 50-200 ms structured-clone main-thread block at app open.+ * 4. A server-side content-sha256 version hash lets us do conditional+ * `since` fetches — if the catalogue is unchanged, the server returns+ * `{unchanged: true}` and we keep using the cached data.+ *+ * The store (`useCredentialRegistry`) holds only UI state. Derived data+ * like the `byId` Map, the fuzzysort-prepared index, and the filtered+ * result set all live in `useMemo` inside `CredentialsPalette.tsx`.+ *+ * See: `docs-internal/credentials_scaling/research_react_stack.md` for the+ * store-shape decision and runtime/memory traps this design avoids.+ */++import { useCallback, useEffect, useMemo, useRef } from 'react';+import { useQuery, useQueryClient, type UseQueryResult } from '@tanstack/react-query';+import { get as idbGet, set as idbSet } from 'idb-keyval';++import { useWebSocket } from '../contexts/WebSocketContext';++// ============================================================================+// Server-side shape (what the registry JSON actually contains)+// ============================================================================++/** Category metadata from credential_providers.json `categories` map. */+export interface ServerCategory {+ key: string;+ label: string;+ order: number;+}++/** Raw field descriptor from the JSON registry (no React / callable fields). */+export interface ServerFieldDef {+ key: string;+ label?: string;+ type?: 'string' | 'password';+ secret?: boolean;+ placeholder?: string;+ required?: boolean;+}++/** Raw status-row descriptor — uses a string `ok_field` instead of a callable. */+export interface ServerStatusRowDef {+ key: string;+ label: string;+ ok_field: string;+ true_text: string;+ false_text: string;+ warn?: boolean;+}++/** Raw action descriptor — disabled_when is a list of status field refs. */+export interface ServerActionDef {+ key: string;+ label: string;+ theme_color: string;+ disabled_when?: string[];+}++/** Raw QR config — uses string field refs instead of callables. */+export interface ServerQrDef {+ qr_field: string;+ is_connected_field: string;+ connected_title: string;+ connected_subtitle_static?: string;+ connected_subtitle_field?: string;+ connected_subtitle_fallback?: string;+ is_loading_fields?: string[];+ empty_text_no_key?: string;+ empty_text_running?: string;+ empty_text_stopped?: string;+ scan_text: string;+}++/** One entry as it appears in the `providers` array of the catalogue response. */+export interface ServerProviderConfig {+ id: string;+ name: string;+ category: string;+ category_label: string;+ color: string;+ kind: 'apiKey' | 'oauth' | 'qrPairing' | 'email';+ icon_ref?: string;+ fields?: ServerFieldDef[];+ ws?: { login: string; logout: string; status: string };+ status_hook?: 'whatsapp' | 'android' | 'twitter' | 'google' | 'telegram';+ status_rows?: ServerStatusRowDef[];+ actions?: ServerActionDef[];+ qr?: ServerQrDef;+ validate_as?: string;+ callback_url?: string;+ instructions?: string;+ has_defaults?: boolean;+ has_rate_limits?: boolean;+ usage_service?: string;+}++export interface CatalogueResponse {+ providers: ServerProviderConfig[];+ categories: ServerCategory[];+ version: string;+}++/** Conditional-fetch response when the client already has the current version. */+interface UnchangedResponse {+ unchanged: true;+ version: string;+ /** Narrowing marker — never present on CatalogueResponse. */+ providers?: never;+ categories?: never;+}++type WsResponse = CatalogueResponse | UnchangedResponse;++/** Type guard: true if the server returned the 304-style unchanged marker. */+function isUnchanged(response: WsResponse): response is UnchangedResponse {+ return 'unchanged' in response && response.unchanged === true;+}++// ============================================================================+// Constants+// ============================================================================++export const CATALOGUE_QUERY_KEY = ['credentialCatalogue'] as const;++/** IDB key — we only store the current version, overwritten on each update. */+const IDB_STORAGE_KEY = 'credentials:catalogue:current';++/** Shape persisted to IndexedDB. Thin wrapper so we can bump format later. */+interface PersistedCatalogue {+ schemaVersion: 1;+ savedAt: number;+ catalogue: CatalogueResponse;+}++// ============================================================================+// Idle-callback helper (Safari fallback)+// ============================================================================++type IdleCallback = () => void;+type RequestIdleHandle = number | ReturnType<typeof setTimeout>;++function scheduleIdle(callback: IdleCallback): RequestIdleHandle {+ if (typeof window === 'undefined') {+ return setTimeout(callback, 0);+ }+ const ric = (window as unknown as {+ requestIdleCallback?: (cb: IdleCallback, opts?: { timeout: number }) => number;+ }).requestIdleCallback;+ if (typeof ric === 'function') {+ return ric(callback, { timeout: 2000 });+ }+ return setTimeout(callback, 0);+}++function cancelIdle(handle: RequestIdleHandle | null): void {+ if (handle === null) return;+ if (typeof window === 'undefined') {+ clearTimeout(handle as ReturnType<typeof setTimeout>);+ return;+ }+ const cic = (window as unknown as {+ cancelIdleCallback?: (handle: number) => void;+ }).cancelIdleCallback;+ if (typeof cic === 'function' && typeof handle === 'number') {+ cic(handle);+ return;+ }+ clearTimeout(handle as ReturnType<typeof setTimeout>);+}++// ============================================================================+// Persistence helpers+// ============================================================================++async function readPersistedCatalogue(): Promise<CatalogueResponse | null> {+ try {+ const raw = await idbGet<PersistedCatalogue>(IDB_STORAGE_KEY);+ if (!raw || raw.schemaVersion !== 1 || !raw.catalogue) return null;+ return raw.catalogue;+ } catch (err) {+ console.warn('[credentials] failed to read IDB cache', err);+ return null;+ }+}++async function writePersistedCatalogue(catalogue: CatalogueResponse): Promise<void> {+ try {+ const payload: PersistedCatalogue = {+ schemaVersion: 1,+ savedAt: Date.now(),+ catalogue,+ };+ await idbSet(IDB_STORAGE_KEY, payload);+ } catch (err) {+ console.warn('[credentials] failed to write IDB cache', err);+ }+}++// ============================================================================+// The hook+// ============================================================================++/**+ * Return shape of `useCatalogueQuery` — the TanStack Query result plus an+ * explicit `refresh()` helper. Modelled as an intersection type because+ * `UseQueryResult` is a discriminated union that cannot be `extend`ed.+ */+export type UseCatalogueQueryResult = UseQueryResult<CatalogueResponse, Error> & {+ /** Force-reload from the server, bypassing IDB and the staleTime. */+ refresh: () => Promise<void>;+};++/**+ * Fetch the credential catalogue with warm-start persistence.+ *+ * - Reads the previous session's snapshot from IndexedDB into the query+ * cache on first mount (zero network; <50 ms warm start).+ * - Kicks off a background revalidate via WebSocket; if the server's+ * version hash differs, replaces the cache and schedules an+ * idle-callback persist write.+ * - Returns the standard TanStack Query shape plus a `refresh()` helper.+ */+export function useCatalogueQuery(): UseCatalogueQueryResult {+ const queryClient = useQueryClient();+ const { sendRequest, isConnected } = useWebSocket();+ const hydratedFromIdbRef = useRef(false);++ // Warm start: on first mount, hydrate the TanStack Query cache from IDB.+ // This runs synchronously (well, on first effect tick) so the UI renders+ // the cached catalogue instantly while the background fetch is in flight.+ useEffect(() => {+ if (hydratedFromIdbRef.current) return;+ hydratedFromIdbRef.current = true;++ let cancelled = false;+ void readPersistedCatalogue().then((cached) => {+ if (cancelled || !cached) return;+ const existing = queryClient.getQueryData<CatalogueResponse>(CATALOGUE_QUERY_KEY);+ if (existing) return; // server fetch already won+ queryClient.setQueryData<CatalogueResponse>(CATALOGUE_QUERY_KEY, cached);+ });++ return () => {+ cancelled = true;+ };+ }, [queryClient]);++ // Query function: WebSocket fetch with conditional since-based fetch.+ const queryFn = useCallback(async (): Promise<CatalogueResponse> => {+ const existing = queryClient.getQueryData<CatalogueResponse>(CATALOGUE_QUERY_KEY);+ const payload: Record<string, unknown> = {};+ if (existing?.version) payload.since = existing.version;++ const response = await sendRequest<WsResponse>('get_credential_catalogue', payload);++ if (isUnchanged(response)) {+ // Server returned 304-style unchanged → keep existing cache.+ if (existing) return existing;+ // Defensive fallback: server said unchanged but we have nothing — refetch.+ const full = await sendRequest<WsResponse>('get_credential_catalogue', {});+ if (isUnchanged(full)) {+ throw new Error('server returned unchanged on empty cache');+ }+ return full;+ }++ // response is CatalogueResponse here — type guard narrowed the union.+ return response;+ }, [queryClient, sendRequest]);++ const query = useQuery<CatalogueResponse, Error>({+ queryKey: CATALOGUE_QUERY_KEY,+ queryFn,+ // The catalogue changes rarely. We invalidate explicitly on the+ // `credential_catalogue_updated` WebSocket broadcast (not yet wired;+ // added in Phase A verification).+ staleTime: Infinity,+ gcTime: 10 * 60_000,+ // Only fetch once the WebSocket is actually connected. Prevents a+ // failed fetch during the initial reconnect window.+ enabled: isConnected,+ // Placeholder so the first render can show the warm-start data.+ placeholderData: (prev) => prev,+ });++ // Idle persist: when the server cache updates, write it to IDB in an+ // idle callback so the 50-200 ms structured-clone write never blocks+ // first paint or user interaction.+ useEffect(() => {+ if (!query.data) return;+ const handle = scheduleIdle(() => {+ void writePersistedCatalogue(query.data as CatalogueResponse);+ });+ return () => cancelIdle(handle);+ }, [query.data]);++ const refresh = useCallback(async () => {+ await queryClient.invalidateQueries({ queryKey: CATALOGUE_QUERY_KEY });+ }, [queryClient]);++ return useMemo(() => ({ ...query, refresh }), [query, refresh]);+}diff --git a/client/src/main.tsx b/client/src/main.tsxindex c1a59d73..247b1b6d 100644--- a/client/src/main.tsx+++ b/client/src/main.tsx@@ -1,19 +1,39 @@import { StrictMode } from 'react'import { createRoot } from 'react-dom/client'+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'import './index.css'import App from './App'import { ThemeProvider } from './contexts/ThemeContext'import { AuthProvider } from './contexts/AuthContext'import { WebSocketProvider } from './contexts/WebSocketContext'+// Single app-wide QueryClient. Cache lives across route changes and modal+// open/close cycles, which is what makes the credentials catalogue warm+// start (<50 ms on second visit) actually work. See+// docs-internal/credentials_scaling/architecture.md for the full shape.+const queryClient = new QueryClient({+ defaultOptions: {+ queries: {+ // Default is aggressive refetching; for this app most server data+ // is push-driven via WebSocket, so queries should stay stable+ // unless we explicitly invalidate them.+ refetchOnWindowFocus: false,+ refetchOnReconnect: false,+ retry: 1,+ },+ },+})+createRoot(document.getElementById('root')!).render(<StrictMode>- <ThemeProvider>- <AuthProvider>- <WebSocketProvider>- <App />- </WebSocketProvider>- </AuthProvider>- </ThemeProvider>+ <QueryClientProvider client={queryClient}>+ <ThemeProvider>+ <AuthProvider>+ <WebSocketProvider>+ <App />+ </WebSocketProvider>+ </AuthProvider>+ </ThemeProvider>+ </QueryClientProvider></StrictMode>,)diff --git a/client/src/store/useCredentialRegistry.ts b/client/src/store/useCredentialRegistry.tsnew file mode 100644index 00000000..ae68b28a--- /dev/null+++ b/client/src/store/useCredentialRegistry.ts@@ -0,0 +1,45 @@+/**+ * Credentials panel UI store.+ *+ * Holds ONLY UI state — `selectedId`, `paletteOpen`, `query`. The catalogue+ * data itself lives in TanStack Query (see `hooks/useCatalogueQuery.ts`).+ * Derived data (filtered providers, prepared fuzzysort index, byId Map)+ * lives in `useMemo` inside the component that needs it.+ *+ * Why: a Zustand selector that closes over a 5000-entry catalogue retains+ * the whole array in the closure scope forever. The fix is to never put+ * the catalogue inside the store. See+ * `docs-internal/credentials_scaling/research_react_stack.md` — "Top 5+ * runtime/memory traps", trap #1.+ */++import { create } from 'zustand';++export interface CredentialRegistryUIState {+ selectedId: string | null;+ paletteOpen: boolean;+ query: string;++ setSelectedId: (id: string | null) => void;+ openPalette: () => void;+ closePalette: () => void;+ togglePalette: () => void;+ setQuery: (q: string) => void;+ reset: () => void;+}++const INITIAL: Pick<CredentialRegistryUIState, 'selectedId' | 'paletteOpen' | 'query'> = {+ selectedId: null,+ paletteOpen: false,+ query: '',+};++export const useCredentialRegistry = create<CredentialRegistryUIState>((set) => ({+ ...INITIAL,+ setSelectedId: (id) => set({ selectedId: id }),+ openPalette: () => set({ paletteOpen: true }),+ closePalette: () => set({ paletteOpen: false }),+ togglePalette: () => set((s) => ({ paletteOpen: !s.paletteOpen })),+ setQuery: (q) => set({ query: q }),+ reset: () => set(INITIAL),+}));diff --git a/client/vite.config.js b/client/vite.config.jsindex 63fceca5..c7d19080 100644--- a/client/vite.config.js+++ b/client/vite.config.js@@ -2,6 +2,7 @@ import { defineConfig, loadEnv } from 'vite'import react from '@vitejs/plugin-react'import { resolve } from 'path'import { readFileSync } from 'fs'+import { visualizer } from 'rollup-plugin-visualizer'// Read root package.json for app version (one level up from client/)// Falls back to '0.0.0' in Docker where only client/ is in the build context@@ -25,8 +26,53 @@ export default defineConfig(({ mode }) => {// APP_VERSION: from root package.json locally, or VITE_APP_VERSION build arg in Dockerconst version = getEnv('VITE_APP_VERSION', '') || appVersion+ // Bundle visualizer: set ANALYZE=1 to emit dist/stats.html alongside the+ // normal build output. Zero cost when ANALYZE is unset — the plugin is+ // simply not added to the plugin chain. See docs-internal/credentials_scaling+ // for bundle-budget targets (main < 200 KB gz, per-panel < 50 KB gz).+ const analyze = !!getEnv('ANALYZE', '')++ // React Compiler 1.0 — auto-memoization. Scoped to the credentials+ // module first (Phase 7.5 of the credentials-scaling plan) so any perf+ // regressions are isolated from the rest of the app. Expand the+ // `sources` predicate module-by-module as each area is verified.+ //+ // Ref: docs-internal/credentials_scaling/research_react_stack.md+ // docs-internal/platform_refactor/PLATFORM_REFACTOR_RFC.md Phase 7.5+ const reactCompilerConfig = {+ target: '19',+ sources: (filename) => {+ if (typeof filename !== 'string') return false+ const normalized = filename.replace(/\\/g, '/')+ return (+ normalized.includes('/src/components/credentials/') ||+ normalized.includes('/src/hooks/useCatalogueQuery.ts') ||+ normalized.includes('/src/store/useCredentialRegistry.ts')+ )+ },+ }+return {- plugins: [react()],+ plugins: [+ react({+ babel: {+ plugins: [+ ['babel-plugin-react-compiler', reactCompilerConfig],+ ],+ },+ }),+ ...(analyze+ ? [+ visualizer({+ filename: 'dist/stats.html',+ gzipSize: true,+ brotliSize: true,+ template: 'treemap',+ sourcemap: true,+ }),+ ]+ : []),+ ],// Expose VITE_ prefixed env vars to client code via import.meta.envdefine: {__APP_VERSION__: JSON.stringify(version),@@ -42,6 +88,10 @@ export default defineConfig(({ mode }) => {build: {// antd + reactflow are large libraries - this is expectedchunkSizeWarningLimit: 1500,+ // Emit sourcemaps only when running the bundle analyzer so the+ // visualizer can attribute bytes to source files accurately.+ // Skipped in normal production builds to keep build time down.+ sourcemap: analyze,},}})diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex d3d71896..b802579c 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -44,6 +44,9 @@ importers:'@radix-ui/react-dialog':specifier: ^1.1.15version: 1.1.15(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@tanstack/react-query':+ specifier: ^5+ version: 5.99.0([email protected])'@types/google.maps':specifier: ^3.58.1version: 3.58.1@@ -71,6 +74,9 @@ importers:autoprefixer:specifier: ^10.4.21version: 10.4.22([email protected])+ cmdk:+ specifier: ^1+ version: 1.1.1(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])eslint:specifier: ^9.33.0version: 9.39.1@@ -80,9 +86,15 @@ importers:eslint-plugin-react-refresh:specifier: ^0.4.20version: 0.4.24([email protected])+ fuzzysort:+ specifier: ^3+ version: 3.1.0globals:specifier: ^16.3.0version: 16.5.0+ idb-keyval:+ specifier: ^6+ version: 6.2.2postcss:specifier: ^8.5.6version: 8.5.6@@ -98,6 +110,9 @@ importers:react-dom:specifier: ^19.1.1version: 19.2.1([email protected])+ react-hook-form:+ specifier: ^7+ version: 7.72.1([email protected])react-js-cron:specifier: ^5.2.0version: 5.2.0([email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])@@ -107,6 +122,9 @@ importers:react-simple-code-editor:specifier: ^0.14.1+ react-virtuoso:+ specifier: ^4reactflow:specifier: ^11.11.4version: 11.11.4(@types/[email protected])([email protected])([email protected]([email protected]))([email protected])@@ -135,6 +153,12 @@ importers:'@typescript-eslint/parser':specifier: ^8.54.0version: 8.54.0([email protected])([email protected])+ babel-plugin-react-compiler:+ specifier: 19.1.0-rc.3+ version: 19.1.0-rc.3+ rollup-plugin-visualizer:+ specifier: ^7.0.1+ version: 7.0.1([email protected])typescript-eslint:specifier: ^8.54.0version: 8.54.0([email protected])([email protected])@@ -1400,6 +1424,14 @@ packages:peerDependencies:react: '>= 16.3.0'+ '@tanstack/[email protected]':+ resolution: {integrity: sha512-3Jv3WQG0BCcH7G+7lf/bP8QyBfJOXeY+T08Rin3GZ1bshvwlbPt7NrDHMEzGdKIOmOzvIQmxjk28YEQX60k7pQ==}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-OY2bCqPemT1LlqJ8Y2CUau4KELnIhhG9Ol3ZndPbdnB095pRbPo1cHuXTndg8iIwtoHTgwZjyaDnQ0xD0mYwAw==}+ peerDependencies:+ react: ^18 || ^19+'@types/[email protected]':resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==}@@ -1719,10 +1751,18 @@ packages:resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}engines: {node: '>=8'}+ resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}engines: {node: '>=8'}+ resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-CQOfddVp4aOvBfCepa+Kj2e7ap+2XBINg1Kn2osdE3oQvrD7KJu/K0sfnLcFLkgCJygbxmuazYdWLKb+drPDYA==}peerDependencies:@@ -1784,6 +1824,9 @@ packages:peerDependencies:'@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0+ resolution: {integrity: sha512-mjRn69WuTz4adL0bXGx8Rsyk1086zFJeKmes6aK0xPuK3aaXmDJdLHqwKKMrpm6KAI1MCoUK72d2VeqQbu8YIA==}+resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}@@ -1830,6 +1873,10 @@ packages:resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}+ resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}engines: {node: '>= 0.8'}@@ -1903,6 +1950,10 @@ packages:resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}engines: {node: '>=12'}+ resolution: {integrity: sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==}+ engines: {node: '>=20'}+resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==}engines: {node: '>=6'}@@ -1911,6 +1962,12 @@ packages:resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}engines: {node: '>=6'}+ resolution: {integrity: sha512-Vsv7kFaXm+ptHDMZ7izaRsP70GgrW9NBNGswt9OZaVBLlE0SNpDq8eu/VGXyF9r7M0azK3Wy7OlYXsuyYLFzHg==}+ peerDependencies:+ react: ^18 || ^19 || ^19.0.0-rc+ react-dom: ^18 || ^19 || ^19.0.0-rc+resolution: {integrity: sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==}@@ -2217,10 +2274,22 @@ packages:resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}+ resolution: {integrity: sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==}@@ -2535,6 +2604,9 @@ packages:resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}+ resolution: {integrity: sha512-sR9BNCjBg6LNgwvxlBd0sBABvQitkLzoVY9MYYROQVX/FvfJ4Mai9LsGhDgd8qYdds0bY77VzYd5iuB+v5rwQQ==}+resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}engines: {node: '>=6.9.0'}@@ -2702,6 +2774,9 @@ packages:resolution: {integrity: sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==}engines: {node: '>=0.10.0'}+ resolution: {integrity: sha512-yjD9nARJ/jb1g+CvD0tlhUHOrJ9Sy0P8T9MF3YaLlHnSRpwPfpTX0XIvpmw3gAJUmEu3FiICLBDPXVwyEvrleg==}+resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}@@ -2765,6 +2840,11 @@ packages:resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==}+ resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}+ engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}+ hasBin: true+resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==}engines: {node: '>=0.10.0'}@@ -2788,6 +2868,15 @@ packages:resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==}+ resolution: {integrity: sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==}+ engines: {node: '>=20'}++ resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==}+ engines: {node: '>=14.16'}+ hasBin: true+resolution: {integrity: sha512-Tz/yndySvLAEXh+Uk8liFCxOwVH6YutuR74utvOcu7I9Di+DwM0mtdPVZNaVvvBUM2OXxne/NhOs1zAO7riusQ==}@@ -2817,6 +2906,10 @@ packages:resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==}+ engines: {node: '>=16'}+resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==}@@ -3285,6 +3378,10 @@ packages:resolution: {integrity: sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==}+ resolution: {integrity: sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw==}+ engines: {node: '>=20'}+resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}engines: {node: '>= 0.8.0'}@@ -3407,6 +3504,10 @@ packages:resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==}engines: {node: ^10 || ^12 || >=14}+ resolution: {integrity: sha512-dM0jVuXJPsDN6DvRpea484tCUaMiXWjuCn++HGTqUWzGDjv5tZkEZldAJ/UMlqRYGFrD/etByo4/xOuC/snX2A==}+ engines: {node: '>=20'}+resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}engines: {node: '>= 0.8.0'}@@ -3736,6 +3837,12 @@ packages:resolution: {integrity: sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==}+ resolution: {integrity: sha512-RhwBoy2ygeVZje+C+bwJ8g0NjTdBmDlJvAUHTxRjTmSUKPYsKfMphkS2sgEMotsY03bP358yEYlnUeZy//D9Ig==}+ engines: {node: '>=18.0.0'}+ peerDependencies:+ react: ^16.8.0 || ^17 || ^18 || ^19+resolution: {integrity: sha512-xbKh6zJxd/vJHT4Bw4+0pBD662Fk20V+VFhLqciCg+manTVO4qlqRqiwFOYelfHN9dBvWj9vxaPkSS26ZSIJGg==}peerDependencies:@@ -3825,6 +3932,12 @@ packages:'@types/react':optional: true+ resolution: {integrity: sha512-DNM4Wy2tMA/J6ejMaDdqecOug31rOwgSRg4C/Dw6Iox4dJe9qwcx32M8HdhkE5uHEVVZh7h0koYwAsCSNdxGfQ==}+ peerDependencies:+ react: '>=16 || >=17 || >= 18 || >= 19'+ react-dom: '>=16 || >=17 || >= 18 || >=19'+resolution: {integrity: sha512-UmReVZ0TxlKzxSbYiAj+LeGRW8s8LraAFTXRAxzMYnNRgGPsxCudwZKVkjvGmjtx7SW/hZamt69NUmGf4xrkXA==}engines: {node: '>=8', npm: '>=5'}@@ -3941,6 +4054,19 @@ packages:resolution: {integrity: sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==}+ resolution: {integrity: sha512-UJUT4+1Ho4OcWmPYU3sYXgUqI8B8Ayfe06MX7y0qCJ1K8aGoKtR/NDd/2nZqM7ADkrzny+I99Ul7GgyoiVNAgg==}+ engines: {node: '>=22'}+ hasBin: true+ peerDependencies:+ rolldown: 1.x || ^1.0.0-beta || ^1.0.0-rc+ rollup: 2.x || 3.x || 4.x+ peerDependenciesMeta:+ rolldown:+ optional: true+ rollup:+ optional: true+resolution: {integrity: sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==}engines: {node: '>=18.0.0', npm: '>=8.0.0'}@@ -3953,6 +4079,10 @@ packages:resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}engines: {node: '>= 18'}+ resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==}@@ -4102,6 +4232,10 @@ packages:resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}engines: {node: '>=8'}+ resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}@@ -4112,6 +4246,10 @@ packages:resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}engines: {node: '>=8'}+ resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==}@@ -4464,9 +4602,17 @@ packages:resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}engines: {node: '>=10'}+ resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}+ resolution: {integrity: sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg==}+ engines: {node: '>=20'}+resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}engines: {node: '>=0.4'}@@ -4486,10 +4632,18 @@ packages:resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}engines: {node: '>=12'}+ resolution: {integrity: sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==}+ engines: {node: ^20.19.0 || ^22.12.0 || >=23}+resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}engines: {node: '>=12'}+ resolution: {integrity: sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==}+ engines: {node: ^20.19.0 || ^22.12.0 || >=23}+resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==}@@ -5862,6 +6016,13 @@ snapshots:dependencies:react: 19.2.1+ '@tanstack/[email protected]': {}++ '@tanstack/[email protected]([email protected])':+ dependencies:+ '@tanstack/query-core': 5.99.0+ react: 19.2.1+'@types/[email protected]':dependencies:'@babel/parser': 7.28.5@@ -6263,10 +6424,14 @@ snapshots:+ [email protected]: {}+dependencies:color-convert: 2.0.1+ [email protected]: {}+[email protected](@types/[email protected])([email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected]):dependencies:@@ -6398,6 +6563,10 @@ snapshots:transitivePeerDependencies:- supports-color+ dependencies:+ '@babel/types': 7.28.5+@@ -6458,6 +6627,10 @@ snapshots:base64-js: 1.5.1ieee754: 1.2.1+ dependencies:+ run-applescript: 7.1.0+@@ -6530,10 +6703,28 @@ snapshots:strip-ansi: 6.0.1wrap-ansi: 7.0.0+ dependencies:+ string-width: 7.2.0+ strip-ansi: 7.2.0+ wrap-ansi: 9.0.2++ [email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected]):+ dependencies:+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])+ '@radix-ui/react-dialog': 1.1.15(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])+ '@radix-ui/react-primitive': 2.1.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ react: 19.2.1+ react-dom: 19.2.1([email protected])+ transitivePeerDependencies:+ - '@types/react'+ - '@types/react-dom'+@@ -6865,12 +7056,21 @@ snapshots:+ [email protected]: {}++ dependencies:+ bundle-name: 4.1.0+ default-browser-id: 5.0.1+dependencies:es-define-property: 1.0.1es-errors: 1.3.0gopd: 1.2.0+ [email protected]: {}+dependencies:robust-predicates: 3.0.2@@ -7270,6 +7470,8 @@ snapshots:+ [email protected]: {}+@@ -7531,6 +7733,8 @@ snapshots:dependencies:safer-buffer: 2.1.2+ [email protected]: {}+@@ -7575,6 +7779,8 @@ snapshots:+ [email protected]: {}+@@ -7591,6 +7797,12 @@ snapshots:+ [email protected]: {}++ dependencies:+ is-docker: 3.0.0+@@ -7611,6 +7823,10 @@ snapshots:dependencies:which-typed-array: 1.1.20+ dependencies:+ is-inside-container: 1.0.0+@@ -8367,6 +8583,15 @@ snapshots:regex: 6.1.0regex-recursion: 6.0.2+ dependencies:+ default-browser: 5.5.0+ define-lazy-prop: 3.0.0+ is-in-ssh: 1.0.0+ is-inside-container: 1.0.0+ powershell-utils: 0.1.0+ wsl-utils: 0.3.1+dependencies:deep-is: 0.1.4@@ -8485,6 +8710,8 @@ snapshots:picocolors: 1.1.1source-map-js: 1.2.1+ [email protected]: {}+@@ -8911,6 +9138,10 @@ snapshots:+ dependencies:+ react: 19.2.1+dependencies:react: 19.2.1@@ -9007,6 +9238,11 @@ snapshots:optionalDependencies:'@types/react': 19.2.7+ dependencies:+ react: 19.2.1+ react-dom: 19.2.1([email protected])+dependencies:react: 19.2.1@@ -9204,6 +9440,15 @@ snapshots:+ dependencies:+ open: 11.0.0+ picomatch: 4.0.3+ source-map: 0.7.6+ yargs: 18.0.0+ optionalDependencies:+ rollup: 4.53.3+dependencies:'@types/estree': 1.0.8@@ -9249,6 +9494,8 @@ snapshots:transitivePeerDependencies:- supports-color+ [email protected]: {}+@@ -9409,6 +9656,12 @@ snapshots:is-fullwidth-code-point: 3.0.0strip-ansi: 6.0.1+ dependencies:+ emoji-regex: 10.6.0+ get-east-asian-width: 1.4.0+ strip-ansi: 7.2.0+dependencies:safe-buffer: 5.1.2@@ -9422,6 +9675,10 @@ snapshots:dependencies:ansi-regex: 5.0.1+ dependencies:+ ansi-regex: 6.2.2+dependencies:is-natural-number: 4.0.1@@ -9758,8 +10015,19 @@ snapshots:string-width: 4.2.3strip-ansi: 6.0.1+ dependencies:+ ansi-styles: 6.2.3+ string-width: 7.2.0+ strip-ansi: 7.2.0++ dependencies:+ is-wsl: 3.1.1+ powershell-utils: 0.1.0+@@ -9770,6 +10038,8 @@ snapshots:+ [email protected]: {}+dependencies:cliui: 8.0.1@@ -9780,6 +10050,15 @@ snapshots:y18n: 5.0.8yargs-parser: 21.1.1+ dependencies:+ cliui: 9.0.1+ escalade: 3.2.0+ get-caller-file: 2.0.5+ string-width: 7.2.0+ y18n: 5.0.8+ yargs-parser: 22.0.0+dependencies:buffer-crc32: 0.2.13