@tangle-network/agent-app 0.46.35 → 0.46.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +6 -6
  2. package/dist/assets/index.js +18 -0
  3. package/dist/assets/index.js.map +1 -1
  4. package/dist/assets/schema.d.ts +657 -0
  5. package/dist/assistant/index.js +6 -6
  6. package/dist/chat-react/index.js +3 -3
  7. package/dist/chat-routes/index.js +1 -1
  8. package/dist/chat-store/index.js +1 -1
  9. package/dist/{chunk-MWEX2M6M.js → chunk-7ZPEJWDI.js} +27 -12
  10. package/dist/{chunk-MWEX2M6M.js.map → chunk-7ZPEJWDI.js.map} +1 -1
  11. package/dist/{chunk-YDOQE47G.js → chunk-PYDMEYWA.js} +20 -6
  12. package/dist/chunk-PYDMEYWA.js.map +1 -0
  13. package/dist/{chunk-EDTWGSQT.js → chunk-SJWIZT7B.js} +6 -2
  14. package/dist/{chunk-EDTWGSQT.js.map → chunk-SJWIZT7B.js.map} +1 -1
  15. package/dist/{chunk-JAYKCWW4.js → chunk-U2UAQTFY.js} +3 -3
  16. package/dist/chunk-U2UAQTFY.js.map +1 -0
  17. package/dist/{chunk-KKBTPZIE.js → chunk-Z4TPWP6A.js} +14 -4
  18. package/dist/chunk-Z4TPWP6A.js.map +1 -0
  19. package/dist/{chunk-4SGGSXI7.js → chunk-ZMMIQOFI.js} +6 -5
  20. package/dist/chunk-ZMMIQOFI.js.map +1 -0
  21. package/dist/{mention-editor-NDJAEMRP.js → mention-editor-CBLT6LE3.js} +2 -2
  22. package/dist/session-shell/index.js +1 -1
  23. package/dist/stream/index.js +1 -1
  24. package/dist/studio-react/index.js +3 -3
  25. package/dist/web-react/agent-session-controls.d.ts +11 -1
  26. package/dist/web-react/controls.d.ts +36 -2
  27. package/dist/web-react/index.d.ts +1 -1
  28. package/dist/web-react/index.js +6 -6
  29. package/dist/workspace-react/index.js +1 -1
  30. package/package.json +13 -13
  31. package/dist/chunk-4SGGSXI7.js.map +0 -1
  32. package/dist/chunk-JAYKCWW4.js.map +0 -1
  33. package/dist/chunk-KKBTPZIE.js.map +0 -1
  34. package/dist/chunk-YDOQE47G.js.map +0 -1
  35. /package/dist/{mention-editor-NDJAEMRP.js.map → mention-editor-CBLT6LE3.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/web-react/session-history.tsx"],"sourcesContent":["/**\n * The rendered half of the session shell: the history view behind the rail's\n * session list, and the rename/delete dialogs both surfaces drive.\n *\n * Storage is a seam, not a dependency. Every product keeps sessions somewhere\n * different (gtm threads, tax sessions, legal matters), so this takes a\n * `fetchPage` data port and injected mutations — the same shape\n * `AgentActivityPanel` (`fetchActivity`) and `ReviewQueuePanel` (`fetchQueue`)\n * already use, rather than a fifth pattern.\n *\n * sandbox-ui free on purpose: `/web-react` must not force the optional peer, so\n * these render on the shared design tokens like the rest of the subpath. The\n * pure logic (nav items, routing, cookies, merging) lives in `/session-shell`,\n * which a server loader can import without pulling React.\n */\n\nimport {\n type ReactNode,\n type RefObject,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport {\n type SessionPage,\n type SessionRailAction,\n type SessionSort,\n type SessionSummary,\n mergeSessionPages,\n sessionLabel,\n UNTITLED_SESSION_LABEL,\n} from '../session-shell/index'\nimport { OVERLAY_SHADOW, PopoverSurface, usePopover } from './controls'\n\n// ---------------------------------------------------------------------------\n// useInfiniteScroll\n// ---------------------------------------------------------------------------\n\nexport interface UseInfiniteScrollOptions {\n /** Only fire `onLoadMore` while true (a next page exists, none in flight). */\n enabled: boolean\n /** Scroll container the sentinel lives in. Defaults to the viewport. */\n root?: RefObject<HTMLElement | null>\n /** Prefetch distance before the sentinel is actually reached. */\n rootMargin?: string\n}\n\nfunction rethrowAsync(error: unknown) {\n queueMicrotask(() => {\n throw error\n })\n}\n\n/**\n * Fires `onLoadMore` when a sentinel element scrolls into view. Returns a ref\n * callback for that sentinel (typically the last element in a list).\n *\n * The observer is re-created whenever `enabled` flips, so a short first page\n * that leaves the sentinel on-screen keeps loading: when a load finishes and\n * `enabled` returns to true, the fresh observer re-reads the current\n * intersection state and fires again until the sentinel is pushed off-screen.\n */\nexport function useInfiniteScroll(\n onLoadMore: () => void,\n { enabled, root, rootMargin = '300px' }: UseInfiniteScrollOptions,\n): (node: HTMLElement | null) => void {\n const [sentinel, setSentinel] = useState<HTMLElement | null>(null)\n const sentinelRef = useCallback((node: HTMLElement | null) => setSentinel(node), [])\n const onLoadMoreRef = useRef(onLoadMore)\n\n useEffect(() => {\n onLoadMoreRef.current = onLoadMore\n }, [onLoadMore])\n\n useEffect(() => {\n if (!sentinel || !enabled) return\n if (typeof IntersectionObserver === 'undefined') return\n const observer = new IntersectionObserver(\n (entries) => {\n if (!entries.some((entry) => entry.isIntersecting)) return\n try {\n onLoadMoreRef.current()\n } catch (error) {\n rethrowAsync(error)\n }\n },\n { root: root?.current ?? null, rootMargin },\n )\n observer.observe(sentinel)\n return () => observer.disconnect()\n }, [sentinel, enabled, root, rootMargin])\n\n return sentinelRef\n}\n\n// ---------------------------------------------------------------------------\n// useSessionHistory — cursor-paged data over an injected port\n// ---------------------------------------------------------------------------\n\nexport interface SessionPageQuery {\n /** Trimmed search term; empty string means no filter. */\n q: string\n sort: SessionSort\n /** `null` for the first page. */\n cursor: string | null\n /** Aborted when the view changes or the component unmounts. */\n signal: AbortSignal\n}\n\n/** Data port — one page of sessions for the current view. */\nexport type FetchSessionPage = (query: SessionPageQuery) => Promise<SessionPage>\n\nexport interface UseSessionHistoryOptions {\n fetchPage: FetchSessionPage\n /** Trimmed search term driving the fetch. */\n q: string\n sort: SessionSort\n /** SSR page 1 of the default view, so the first paint costs no request. */\n initialPage: SessionPage\n /** The sort `initialPage` was rendered for. Default `'newest'`. */\n defaultSort?: SessionSort\n}\n\nexport interface SessionHistoryState {\n items: SessionSummary[]\n hasMore: boolean\n isLoadingFirst: boolean\n isLoadingMore: boolean\n isError: boolean\n loadMore: () => void\n /** Re-run whichever load failed. */\n retry: () => void\n /** Refetch page 1 — call after a client-side mutation (e.g. a delete). */\n reload: () => void\n}\n\n/** Cheap content signature so a consumer inlining `initialPage={{items}}` on\n * every render does not reseed (and re-render) forever. Identity alone — what\n * the per-product versions keyed on — makes that an infinite loop. */\nfunction seedSignature(page: SessionPage): string {\n return `${page.nextCursor ?? ''}|${page.items.map((item) => item.id).join(',')}`\n}\n\n/**\n * Infinite-scroll data source for the history view. Seeds from `initialPage`\n * for the default view (no fetch) and otherwise fetches page 1 for the current\n * search/sort; `loadMore` appends the next cursor page.\n *\n * Raw promises + `AbortController` rather than a router fetcher, so a filter\n * change cancels in-flight requests, pages accumulate, and a late response from\n * a superseded view is dropped by the monotonic `seq` guard.\n */\nexport function useSessionHistory({\n fetchPage,\n q,\n sort,\n initialPage,\n defaultSort = 'newest',\n}: UseSessionHistoryOptions): SessionHistoryState {\n const [items, setItems] = useState<SessionSummary[]>(initialPage.items)\n const [nextCursor, setNextCursor] = useState<string | null>(initialPage.nextCursor ?? null)\n const [phase, setPhase] = useState<'idle' | 'loadingFirst' | 'loadingMore' | 'error'>('idle')\n const [reloadKey, setReloadKey] = useState(0)\n\n const seqRef = useRef(0)\n const resetAbortRef = useRef<AbortController | null>(null)\n const loadMoreAbortRef = useRef<AbortController | null>(null)\n const loadingMoreRef = useRef(false)\n const lastOpRef = useRef<'first' | 'more'>('first')\n\n // Live values read inside the stable `loadMore` callback.\n const nextCursorRef = useRef(nextCursor)\n nextCursorRef.current = nextCursor\n const viewRef = useRef({ q, sort, fetchPage })\n viewRef.current = { q, sort, fetchPage }\n const seedRef = useRef(initialPage)\n seedRef.current = initialPage\n\n const isDefaultView = q === '' && sort === defaultSort\n const seedKey = useMemo(() => seedSignature(initialPage), [initialPage])\n\n // Reset on view change (q/sort), on a new SSR seed (loader revalidation), or\n // on an explicit retry/reload. The default view comes straight from SSR;\n // explicit reloads fetch page 1 so a client-only mutation refreshes this list\n // without waiting on a route loader.\n useEffect(() => {\n resetAbortRef.current?.abort()\n loadMoreAbortRef.current?.abort()\n loadingMoreRef.current = false\n const seq = ++seqRef.current\n\n if (isDefaultView && reloadKey === 0) {\n setItems(seedRef.current.items)\n setNextCursor(seedRef.current.nextCursor ?? null)\n setPhase('idle')\n return\n }\n\n const controller = new AbortController()\n resetAbortRef.current = controller\n lastOpRef.current = 'first'\n setItems([])\n setNextCursor(null)\n setPhase('loadingFirst')\n\n void (async () => {\n try {\n const page = await viewRef.current.fetchPage({ q, sort, cursor: null, signal: controller.signal })\n if (seq !== seqRef.current) return\n setItems(page.items)\n setNextCursor(page.nextCursor ?? null)\n setPhase('idle')\n } catch {\n if (controller.signal.aborted || seq !== seqRef.current) return\n setPhase('error')\n }\n })()\n\n return () => controller.abort()\n }, [q, sort, seedKey, isDefaultView, reloadKey])\n\n const loadMore = useCallback(() => {\n const cursor = nextCursorRef.current\n if (!cursor || loadingMoreRef.current) return\n\n const { q: currentQ, sort: currentSort, fetchPage: currentFetch } = viewRef.current\n const seq = seqRef.current\n loadingMoreRef.current = true\n lastOpRef.current = 'more'\n const controller = new AbortController()\n loadMoreAbortRef.current = controller\n setPhase('loadingMore')\n\n void (async () => {\n try {\n const page = await currentFetch({ q: currentQ, sort: currentSort, cursor, signal: controller.signal })\n if (seq !== seqRef.current) return\n setItems((prev) => mergeSessionPages(prev, page.items))\n setNextCursor(page.nextCursor ?? null)\n setPhase('idle')\n } catch {\n if (controller.signal.aborted || seq !== seqRef.current) return\n setPhase('error')\n } finally {\n if (seq === seqRef.current) loadingMoreRef.current = false\n }\n })()\n }, [])\n\n const retry = useCallback(() => {\n if (lastOpRef.current === 'more') loadMore()\n else setReloadKey((key) => key + 1)\n }, [loadMore])\n\n const reload = useCallback(() => {\n setReloadKey((key) => key + 1)\n }, [])\n\n useEffect(\n () => () => {\n resetAbortRef.current?.abort()\n loadMoreAbortRef.current?.abort()\n },\n [],\n )\n\n return {\n items,\n hasMore: nextCursor !== null,\n isLoadingFirst: phase === 'loadingFirst',\n isLoadingMore: phase === 'loadingMore',\n isError: phase === 'error',\n loadMore,\n retry,\n reload,\n }\n}\n\n// ---------------------------------------------------------------------------\n// useSessionActions — rename / delete over injected mutations\n// ---------------------------------------------------------------------------\n\nexport interface SessionActionsOptions {\n /** Persist a new title. Reject to surface the error in the dialog. */\n renameSession: (sessionId: string, title: string) => Promise<void>\n deleteSession: (sessionId: string) => Promise<void>\n /** Called after a successful rename/delete — revalidate the rail here. */\n onChanged?: () => void\n /** Called after deleting the session the user is currently viewing, so the\n * product can navigate away from a route that no longer resolves. */\n onDeletedCurrent?: () => void\n /** The open session, compared against the delete target. */\n currentSessionId?: string | null\n /** Product toast/log seam. Errors also render inside the dialog. */\n notify?: (level: 'success' | 'error', message: string) => void\n labels?: Partial<SessionActionLabels>\n}\n\nexport interface SessionActionLabels {\n renameTitle: string\n renameField: string\n renameSubmit: string\n deleteTitle: string\n deleteBody: (title: string) => string\n deleteSubmit: string\n cancel: string\n renamed: string\n deleted: string\n renameFailed: string\n deleteFailed: string\n}\n\nconst DEFAULT_LABELS: SessionActionLabels = {\n renameTitle: 'Rename session',\n renameField: 'Title',\n renameSubmit: 'Save',\n deleteTitle: 'Delete session?',\n deleteBody: (title) => `This will permanently delete “${title}” and its messages. This cannot be undone.`,\n deleteSubmit: 'Delete',\n cancel: 'Cancel',\n renamed: 'Session renamed',\n deleted: 'Session deleted',\n renameFailed: 'Failed to rename session',\n deleteFailed: 'Failed to delete session',\n}\n\nexport interface SessionActions {\n openRename: (session: SessionSummary) => void\n openDelete: (session: SessionSummary) => void\n /** Render once, anywhere that survives navigation (the layout). */\n dialogs: ReactNode\n busy: boolean\n}\n\n/**\n * Rename + delete for one session, shared by the rail kebab and the history\n * row menu so both drive the same dialogs and the same product mutations.\n *\n * Dialogs are owned here rather than returned as raw state: two surfaces\n * needing the same confirm step is exactly how a product ends up with two\n * subtly different delete confirmations.\n */\nexport function useSessionActions({\n renameSession,\n deleteSession,\n onChanged,\n onDeletedCurrent,\n currentSessionId,\n notify,\n labels,\n}: SessionActionsOptions): SessionActions {\n const text = { ...DEFAULT_LABELS, ...labels }\n const [renameTarget, setRenameTarget] = useState<SessionSummary | null>(null)\n const [renameValue, setRenameValue] = useState('')\n const [deleteTarget, setDeleteTarget] = useState<SessionSummary | null>(null)\n const [busy, setBusy] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n const openRename = useCallback((session: SessionSummary) => {\n setError(null)\n setRenameTarget(session)\n setRenameValue(session.title ?? '')\n }, [])\n\n const openDelete = useCallback((session: SessionSummary) => {\n setError(null)\n setDeleteTarget(session)\n }, [])\n\n const submitRename = useCallback(async () => {\n if (!renameTarget) return\n const title = renameValue.trim()\n // A no-op rename closes rather than writing — otherwise every accidental\n // open costs a request and a revalidation.\n if (!title || title === renameTarget.title) {\n setRenameTarget(null)\n return\n }\n setBusy(true)\n setError(null)\n try {\n await renameSession(renameTarget.id, title)\n setRenameTarget(null)\n notify?.('success', text.renamed)\n onChanged?.()\n } catch (e) {\n const message = e instanceof Error ? e.message : text.renameFailed\n setError(message)\n notify?.('error', message)\n } finally {\n setBusy(false)\n }\n }, [renameTarget, renameValue, renameSession, notify, onChanged, text.renamed, text.renameFailed])\n\n const confirmDelete = useCallback(async () => {\n if (!deleteTarget) return\n const deletingCurrent = currentSessionId != null && deleteTarget.id === currentSessionId\n setBusy(true)\n setError(null)\n try {\n await deleteSession(deleteTarget.id)\n setDeleteTarget(null)\n notify?.('success', text.deleted)\n onChanged?.()\n if (deletingCurrent) onDeletedCurrent?.()\n } catch (e) {\n const message = e instanceof Error ? e.message : text.deleteFailed\n setError(message)\n notify?.('error', message)\n } finally {\n setBusy(false)\n }\n }, [deleteTarget, currentSessionId, deleteSession, notify, onChanged, onDeletedCurrent, text.deleted, text.deleteFailed])\n\n const dialogs = (\n <>\n {renameTarget && (\n <SessionDialog\n title={text.renameTitle}\n onClose={() => setRenameTarget(null)}\n busy={busy}\n error={error}\n footer={\n <>\n <DialogButton onClick={() => setRenameTarget(null)} disabled={busy} variant=\"ghost\">\n {text.cancel}\n </DialogButton>\n <DialogButton onClick={() => void submitRename()} disabled={busy || !renameValue.trim()}>\n {text.renameSubmit}\n </DialogButton>\n </>\n }\n >\n <label htmlFor=\"agent-app-rename-session\" className=\"text-xs text-muted-foreground\">\n {text.renameField}\n </label>\n <input\n id=\"agent-app-rename-session\"\n value={renameValue}\n autoFocus\n onChange={(e) => setRenameValue(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !busy) {\n e.preventDefault()\n void submitRename()\n }\n }}\n className=\"mt-1.5 h-9 w-full rounded-md border border-strong bg-background px-3 text-sm text-foreground\"\n />\n </SessionDialog>\n )}\n\n {deleteTarget && (\n <SessionDialog\n title={text.deleteTitle}\n onClose={() => setDeleteTarget(null)}\n busy={busy}\n error={error}\n footer={\n <>\n <DialogButton onClick={() => setDeleteTarget(null)} disabled={busy} variant=\"ghost\">\n {text.cancel}\n </DialogButton>\n <DialogButton onClick={() => void confirmDelete()} disabled={busy} variant=\"destructive\">\n {text.deleteSubmit}\n </DialogButton>\n </>\n }\n >\n <p className=\"text-sm text-muted-foreground\">{text.deleteBody(sessionLabel(deleteTarget))}</p>\n </SessionDialog>\n )}\n </>\n )\n\n return { openRename, openDelete, dialogs, busy }\n}\n\nfunction DialogButton({\n children,\n onClick,\n disabled,\n variant = 'primary',\n}: {\n children: ReactNode\n onClick: () => void\n disabled?: boolean\n variant?: 'primary' | 'ghost' | 'destructive'\n}) {\n const tone =\n variant === 'ghost'\n ? 'text-muted-foreground hover:bg-accent hover:text-foreground'\n : variant === 'destructive'\n ? 'bg-destructive text-destructive-foreground hover:opacity-90'\n : 'bg-primary text-primary-foreground hover:opacity-90'\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={`h-9 rounded-md px-3 text-sm font-medium transition disabled:opacity-50 ${tone}`}\n >\n {children}\n </button>\n )\n}\n\nfunction SessionDialog({\n title,\n children,\n footer,\n onClose,\n busy,\n error,\n}: {\n title: string\n children: ReactNode\n footer: ReactNode\n onClose: () => void\n busy: boolean\n error: string | null\n}) {\n // Escape closes unless a mutation is in flight — closing mid-write would hide\n // the error the user needs to see.\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && !busy) onClose()\n }\n document.addEventListener('keydown', onKey)\n return () => document.removeEventListener('keydown', onKey)\n }, [busy, onClose])\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center p-4\">\n <div\n className=\"absolute inset-0 bg-black/50\"\n onClick={() => {\n if (!busy) onClose()\n }}\n aria-hidden\n />\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={title}\n className={`relative w-full max-w-sm rounded-xl border border-card-edge bg-popover p-5 ${OVERLAY_SHADOW}`}\n >\n <h2 className=\"text-sm font-semibold text-foreground\">{title}</h2>\n <div className=\"mt-3\">{children}</div>\n {error && (\n <p role=\"alert\" className=\"mt-3 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive\">\n {error}\n </p>\n )}\n <div className=\"mt-5 flex justify-end gap-2\">{footer}</div>\n </div>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// SessionHistoryPanel\n// ---------------------------------------------------------------------------\n\nexport interface SessionHistoryPanelProps {\n history: SessionHistoryState\n /** Whether the workspace has any sessions at all — decided by the SSR page,\n * independent of the active search, so filtering to zero shows \"no matches\"\n * rather than the first-run empty state. */\n hasAnySessions: boolean\n query: string\n onQueryChange: (value: string) => void\n sort: SessionSort\n onSortChange: (value: SessionSort) => void\n /** Product route for one session row. */\n hrefForSession: (sessionId: string) => string\n /** Rendered as the row link. Defaults to an `<a>`; pass a router Link to keep\n * client-side navigation. */\n linkComponent?: LinkLikeComponent\n /** Ids currently mid-turn — renders the responding treatment. */\n respondingSessionIds?: ReadonlySet<string>\n onRename?: (session: SessionSummary) => void\n onDelete?: (session: SessionSummary) => void\n /** Product-owned mutation for selected rows or a workspace-wide age range. */\n onBulkAction?: (action: SessionBulkAction) => Promise<void>\n /** Menu wording, so this surface and the rail name the same act the same way\n * — a product whose delete is really an archive says so in both places. */\n renameLabel?: string\n deleteLabel?: string\n /**\n * Row actions this shell has no opinion about — pin, categorise, share.\n * Same seam and same ordering as the rail's `SessionRowActions.extraActions`:\n * evaluated per session, placed between rename and delete. This menu is\n * text-only, so `icon` is ignored here and honoured on the rail.\n */\n extraActions?: (session: SessionSummary) => SessionRailAction[]\n /** New-session destination for the header action. Omitted ⇒ no button. */\n newSessionHref?: string\n title?: string\n untitledLabel?: string\n emptyTitle?: string\n emptyDescription?: string\n /** Absolute → relative timestamp. Defaults to a compact built-in. */\n formatTimestamp?: (isoDate: string | null) => string\n /** Max width of the reading column. `'full'` opts out for a product whose\n * surface really is a wide table. Default keeps title and timestamp inside\n * one scannable line rather than at opposite edges of a 1440px viewport. */\n contentWidth?: 'reading' | 'full'\n className?: string\n}\n\nexport type SessionBulkAction =\n | { kind: 'selected'; ids: string[] }\n | { kind: 'older-than'; days: number }\n | { kind: 'newer-than'; days: number }\n\nexport interface LinkLikeProps {\n to: string\n className?: string\n children?: ReactNode\n}\n\nexport type LinkLikeComponent = (props: LinkLikeProps) => ReactNode\n\nfunction AnchorLink({ to, className, children }: LinkLikeProps) {\n return (\n <a href={to} className={className}>\n {children}\n </a>\n )\n}\n\nconst MINUTE = 60_000\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\n\n/** Compact relative time. Overridable — a product with its own i18n passes\n * `formatTimestamp` rather than this being the only option. */\nexport function formatSessionTimestamp(isoDate: string | null): string {\n if (!isoDate) return ''\n const at = Date.parse(isoDate)\n if (Number.isNaN(at)) return ''\n const delta = Date.now() - at\n if (delta < MINUTE) return 'just now'\n if (delta < HOUR) return `${Math.floor(delta / MINUTE)}m ago`\n if (delta < DAY) return `${Math.floor(delta / HOUR)}h ago`\n if (delta < 7 * DAY) return `${Math.floor(delta / DAY)}d ago`\n return new Date(at).toLocaleDateString(undefined, { month: 'short', day: 'numeric' })\n}\n\nfunction SkeletonRows() {\n // The shimmer rows stay hidden from assistive tech — they say nothing a\n // reader can use — but the wait itself has to be announced, or the panel is\n // silent from the first paint until the rows arrive. The live region is a\n // sibling so the rows' own flex layout is untouched.\n return (\n <>\n <span role=\"status\" aria-live=\"polite\" aria-busy={true} className=\"sr-only\">\n Loading sessions…\n </span>\n <div className=\"flex flex-col gap-0.5\" aria-hidden>\n {Array.from({ length: 8 }).map((_, i) => (\n <div key={i} className=\"flex items-center gap-3 px-3 py-2.5\">\n <div className=\"h-4 w-4 animate-pulse rounded bg-muted\" />\n <div className=\"h-4 w-1/2 animate-pulse rounded bg-muted\" />\n <div className=\"ml-auto h-3 w-12 animate-pulse rounded bg-muted\" />\n </div>\n ))}\n </div>\n </>\n )\n}\n\nfunction MessageIcon({ className }: { className?: string }) {\n return (\n <svg viewBox=\"0 0 24 24\" className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\" />\n </svg>\n )\n}\n\n/**\n * The full session history: search, sort, cursor-paged rows with per-row\n * actions, and the states in between (first-run empty, loading, no matches,\n * error + retry).\n *\n * This is the surface the rail's capped list overflows into — the reason the\n * rail can stay short without hiding the user's work.\n */\nexport function SessionHistoryPanel({\n history,\n hasAnySessions,\n query,\n onQueryChange,\n sort,\n onSortChange,\n hrefForSession,\n linkComponent: Link = AnchorLink,\n respondingSessionIds,\n onRename,\n onDelete,\n onBulkAction,\n renameLabel = 'Rename',\n deleteLabel = 'Delete',\n extraActions,\n newSessionHref,\n title = 'History',\n untitledLabel = UNTITLED_SESSION_LABEL,\n emptyTitle = 'No sessions yet',\n emptyDescription = 'Your chat sessions will show up here once you start one.',\n formatTimestamp = formatSessionTimestamp,\n contentWidth = 'reading',\n className,\n}: SessionHistoryPanelProps) {\n const scrollRef = useRef<HTMLDivElement | null>(null)\n const sentinelRef = useInfiniteScroll(history.loadMore, {\n enabled: history.hasMore && !history.isLoadingMore && !history.isError,\n root: scrollRef,\n rootMargin: '300px',\n })\n const searchTerm = query.trim()\n const isSearching = searchTerm.length > 0\n const column = contentWidth === 'full' ? 'w-full' : 'mx-auto w-full max-w-4xl'\n const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set())\n const [ageDays, setAgeDays] = useState('30')\n const [bulkTarget, setBulkTarget] = useState<{\n action: SessionBulkAction\n title: string\n body: string\n } | null>(null)\n const [bulkBusy, setBulkBusy] = useState(false)\n const [bulkError, setBulkError] = useState<string | null>(null)\n\n useEffect(() => {\n setSelectedIds(new Set())\n }, [searchTerm, sort])\n\n useEffect(() => {\n const visible = new Set(history.items.map((item) => item.id))\n setSelectedIds((current) => {\n const next = new Set([...current].filter((id) => visible.has(id)))\n return next.size === current.size ? current : next\n })\n }, [history.items])\n\n const selectedCount = selectedIds.size\n const allVisibleSelected = history.items.length > 0 && history.items.every((item) => selectedIds.has(item.id))\n const parsedAgeDays = Number(ageDays)\n const validAgeDays = Number.isInteger(parsedAgeDays) && parsedAgeDays >= 1 && parsedAgeDays <= 36_500\n\n const openBulkAction = useCallback((action: SessionBulkAction) => {\n const verb = deleteLabel.toLowerCase()\n if (action.kind === 'selected') {\n setBulkTarget({\n action,\n title: `${deleteLabel} selected sessions?`,\n body: `${verb === 'delete' ? 'This permanently removes' : `This ${verb}s`} ${action.ids.length} selected session${action.ids.length === 1 ? '' : 's'} and its messages.`,\n })\n return\n }\n const range = action.kind === 'older-than' ? `older than ${action.days} days` : `from the last ${action.days} days`\n setBulkTarget({\n action,\n title: `${deleteLabel} sessions ${range}?`,\n body: 'This applies to every matching session in this workspace, including sessions not currently loaded in this list.',\n })\n }, [deleteLabel])\n\n const confirmBulkAction = useCallback(async () => {\n if (!bulkTarget || !onBulkAction) return\n setBulkBusy(true)\n setBulkError(null)\n try {\n await onBulkAction(bulkTarget.action)\n setBulkTarget(null)\n setSelectedIds(new Set())\n history.reload()\n } catch (error) {\n setBulkError(error instanceof Error ? error.message : `Could not ${deleteLabel.toLowerCase()} sessions`)\n } finally {\n setBulkBusy(false)\n }\n }, [bulkTarget, deleteLabel, history, onBulkAction])\n\n return (\n <div className={`flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ''}`}>\n {/* 56px, matching the rail header the fleet aligned on. */}\n <header className=\"flex h-14 shrink-0 items-center border-b border-border px-4 sm:px-6\">\n <div className={`flex items-center gap-3 px-3 ${column}`}>\n <h1 className=\"flex-1 truncate text-sm font-semibold text-foreground\">{title}</h1>\n {newSessionHref && (\n <Link\n to={newSessionHref}\n className=\"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition hover:opacity-90\"\n >\n <span aria-hidden className=\"text-sm leading-none\">+</span>\n New chat\n </Link>\n )}\n </div>\n </header>\n\n <div ref={scrollRef} className=\"min-h-0 flex-1 overflow-y-auto\">\n {hasAnySessions && (\n <div className=\"sticky top-0 z-10 bg-background px-4 sm:px-6\">\n <div className={`flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`}>\n <input\n type=\"search\"\n value={query}\n onChange={(e) => onQueryChange(e.target.value)}\n placeholder=\"Search your sessions…\"\n aria-label=\"Search sessions\"\n className=\"h-9 min-w-0 appearance-none rounded-md border border-strong bg-card px-3 text-sm text-foreground placeholder:text-muted-foreground sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none\"\n />\n <select\n value={sort}\n onChange={(e) => onSortChange(e.target.value as SessionSort)}\n aria-label=\"Sort sessions\"\n className=\"h-9 shrink-0 appearance-none rounded-md border border-strong bg-card px-2 text-sm text-foreground sm:w-[132px]\"\n >\n <option value=\"newest\">Newest</option>\n <option value=\"oldest\">Oldest</option>\n </select>\n </div>\n {onBulkAction && (\n <div className={`flex flex-col gap-2 border-t border-border px-3 py-3 ${column}`}>\n <div className=\"flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setSelectedIds(new Set(history.items.map((item) => item.id)))}\n disabled={allVisibleSelected || history.items.length === 0}\n className=\"h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent disabled:opacity-50\"\n >\n Select all\n </button>\n <button\n type=\"button\"\n onClick={() => setSelectedIds(new Set())}\n disabled={selectedCount === 0}\n className=\"h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent disabled:opacity-50\"\n >\n Deselect all\n </button>\n <span className=\"text-xs text-muted-foreground\" aria-live=\"polite\">\n {selectedCount} selected\n </span>\n {selectedCount > 0 && (\n <button\n type=\"button\"\n onClick={() => openBulkAction({ kind: 'selected', ids: [...selectedIds] })}\n className=\"h-8 rounded-md bg-destructive px-2.5 text-xs font-medium text-destructive-foreground transition hover:opacity-90\"\n >\n {deleteLabel} selected\n </button>\n )}\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <label htmlFor=\"agent-app-session-age\" className=\"text-xs text-muted-foreground\">\n Session age\n </label>\n <input\n id=\"agent-app-session-age\"\n type=\"number\"\n min={1}\n max={36_500}\n value={ageDays}\n onChange={(event) => setAgeDays(event.target.value)}\n aria-invalid={ageDays.length > 0 && !validAgeDays}\n className=\"h-8 w-20 rounded-md border border-strong bg-card px-2 text-xs tabular-nums text-foreground\"\n />\n <span className=\"text-xs text-muted-foreground\">days</span>\n <button\n type=\"button\"\n onClick={() => openBulkAction({ kind: 'older-than', days: parsedAgeDays })}\n disabled={!validAgeDays}\n className=\"h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent disabled:opacity-50\"\n >\n {deleteLabel} older\n </button>\n <button\n type=\"button\"\n onClick={() => openBulkAction({ kind: 'newer-than', days: parsedAgeDays })}\n disabled={!validAgeDays}\n className=\"h-8 rounded-md border border-border px-2.5 text-xs font-medium text-foreground transition hover:bg-accent disabled:opacity-50\"\n >\n {deleteLabel} recent\n </button>\n </div>\n </div>\n )}\n </div>\n )}\n\n <div className={`px-4 pb-8 pt-1 sm:px-6 ${column}`}>\n {!hasAnySessions ? (\n <div className=\"flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center\">\n <p className=\"text-sm font-medium text-foreground\">{emptyTitle}</p>\n <p className=\"max-w-xs text-xs text-muted-foreground\">{emptyDescription}</p>\n </div>\n ) : history.isLoadingFirst ? (\n <SkeletonRows />\n ) : history.items.length === 0 ? (\n history.isError ? (\n <ErrorBlock onRetry={history.retry} message=\"Couldn’t load your sessions.\" />\n ) : isSearching ? (\n <p className=\"py-16 text-center text-sm text-muted-foreground\">\n No sessions match “{searchTerm}”.\n </p>\n ) : (\n <p className=\"py-16 text-center text-sm text-muted-foreground\">No sessions remain.</p>\n )\n ) : (\n <div className=\"flex flex-col gap-0.5\">\n {history.items.map((session) => (\n <SessionRow\n key={session.id}\n session={session}\n href={hrefForSession(session.id)}\n Link={Link}\n responding={respondingSessionIds?.has(session.id) ?? false}\n untitledLabel={untitledLabel}\n timestamp={formatTimestamp(session.updatedAt)}\n onRename={onRename}\n onDelete={onDelete}\n selectable={Boolean(onBulkAction)}\n selected={selectedIds.has(session.id)}\n onSelectedChange={(selected) => {\n setSelectedIds((current) => {\n const next = new Set(current)\n if (selected) next.add(session.id)\n else next.delete(session.id)\n return next\n })\n }}\n renameLabel={renameLabel}\n deleteLabel={deleteLabel}\n extraActions={extraActions}\n />\n ))}\n\n {history.isError ? (\n <ErrorBlock onRetry={history.retry} message=\"Couldn’t load more sessions.\" inline />\n ) : history.hasMore ? (\n <div ref={sentinelRef} className=\"flex items-center justify-center py-6\">\n {history.isLoadingMore && (\n <span role=\"status\" aria-live=\"polite\" aria-busy={true} className=\"text-xs text-muted-foreground\">\n Loading…\n </span>\n )}\n </div>\n ) : null}\n </div>\n )}\n </div>\n </div>\n {bulkTarget && (\n <SessionDialog\n title={bulkTarget.title}\n onClose={() => {\n if (!bulkBusy) {\n setBulkTarget(null)\n setBulkError(null)\n }\n }}\n busy={bulkBusy}\n error={bulkError}\n footer={\n <>\n <DialogButton\n onClick={() => {\n setBulkTarget(null)\n setBulkError(null)\n }}\n disabled={bulkBusy}\n variant=\"ghost\"\n >\n Cancel\n </DialogButton>\n <DialogButton onClick={() => void confirmBulkAction()} disabled={bulkBusy} variant=\"destructive\">\n {bulkBusy ? 'Working…' : deleteLabel}\n </DialogButton>\n </>\n }\n >\n <p className=\"text-sm text-muted-foreground\">{bulkTarget.body}</p>\n </SessionDialog>\n )}\n </div>\n )\n}\n\nfunction ErrorBlock({ message, onRetry, inline }: { message: string; onRetry: () => void; inline?: boolean }) {\n return (\n <div\n className={\n inline\n ? 'flex items-center justify-center gap-3 py-6 text-sm text-muted-foreground'\n : 'flex min-h-[40vh] flex-col items-center justify-center gap-3 text-center'\n }\n >\n <span className=\"text-sm text-muted-foreground\">{message}</span>\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"h-8 rounded-md border border-border px-3 text-xs font-medium text-foreground transition hover:bg-accent\"\n >\n Retry\n </button>\n </div>\n )\n}\n\nfunction SessionRow({\n session,\n href,\n Link,\n responding,\n untitledLabel,\n timestamp,\n onRename,\n onDelete,\n renameLabel,\n deleteLabel,\n extraActions,\n selectable,\n selected,\n onSelectedChange,\n}: {\n session: SessionSummary\n href: string\n Link: LinkLikeComponent\n responding: boolean\n untitledLabel: string\n timestamp: string\n onRename?: (session: SessionSummary) => void\n onDelete?: (session: SessionSummary) => void\n renameLabel: string\n deleteLabel: string\n extraActions?: (session: SessionSummary) => SessionRailAction[]\n selectable: boolean\n selected: boolean\n onSelectedChange: (selected: boolean) => void\n}) {\n const [menuOpen, setMenuOpen] = useState(false)\n const panelId = useId()\n const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(menuOpen, setMenuOpen)\n const extras = extraActions?.(session) ?? []\n const hasMenu = Boolean(onRename) || Boolean(onDelete) || extras.length > 0\n // An unread dot next to a live responding indicator is two signals for one\n // state; the working indicator wins while the turn runs.\n const showUnread = Boolean(session.unread) && !responding\n\n return (\n <div className={`group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent ${selected ? 'bg-primary/10' : ''}`}>\n {selectable && (\n <input\n type=\"checkbox\"\n checked={selected}\n onChange={(event) => onSelectedChange(event.target.checked)}\n aria-label={`Select ${sessionLabel(session, untitledLabel)}`}\n className=\"h-4 w-4 shrink-0 rounded border-border accent-primary\"\n />\n )}\n <Link to={href} className=\"flex min-w-0 flex-1 items-center gap-3\">\n {showUnread && <span className=\"h-1.5 w-1.5 shrink-0 rounded-full bg-primary\" aria-hidden />}\n <MessageIcon className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <span\n className={`truncate text-sm ${responding ? 'text-muted-foreground' : 'text-foreground'} ${showUnread ? 'font-semibold' : ''}`}\n {...(responding ? { role: 'status', 'aria-label': 'Agent responding' } : {})}\n >\n {sessionLabel(session, untitledLabel)}\n </span>\n </Link>\n <span className=\"shrink-0 text-xs tabular-nums text-muted-foreground\">{timestamp}</span>\n {hasMenu && (\n <div ref={containerRef} className=\"relative shrink-0\">\n <button\n type=\"button\"\n {...triggerProps}\n aria-label=\"Session actions\"\n aria-controls={menuOpen ? panelId : undefined}\n onClick={() => setMenuOpen((open) => !open)}\n // Visible by default and hover-revealed only from `sm:` up: a\n // touch device has no hover, so an opacity-0 kebab is an action\n // the user can never reach.\n className=\"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 aria-expanded:opacity-100\"\n >\n <span aria-hidden className=\"text-base leading-none\">⋯</span>\n </button>\n <PopoverSurface\n open={menuOpen}\n id={panelId}\n role=\"menu\"\n triggerRef={triggerRef}\n panelRef={panelRef}\n className={`w-36 overflow-hidden rounded-md border border-card-edge bg-popover py-1 ${OVERLAY_SHADOW}`}\n >\n {onRename && (\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => {\n setMenuOpen(false)\n onRename(session)\n }}\n className=\"block w-full px-3 py-1.5 text-left text-xs text-foreground transition hover:bg-accent\"\n >\n {renameLabel}\n </button>\n )}\n {extras.map((action) => (\n <button\n key={action.id}\n type=\"button\"\n role=\"menuitem\"\n onClick={() => {\n setMenuOpen(false)\n action.onSelect()\n }}\n className={`block w-full px-3 py-1.5 text-left text-xs transition ${\n action.destructive\n ? 'text-destructive hover:bg-destructive/10'\n : 'text-foreground hover:bg-accent'\n }`}\n >\n {action.label}\n </button>\n ))}\n {onDelete && (\n <button\n type=\"button\"\n role=\"menuitem\"\n onClick={() => {\n setMenuOpen(false)\n onDelete(session)\n }}\n className=\"block w-full px-3 py-1.5 text-left text-xs text-destructive transition hover:bg-destructive/10\"\n >\n {deleteLabel}\n </button>\n )}\n </PopoverSurface>\n </div>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAgBA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAkZK,mBACE,KADF;AAxXZ,SAAS,aAAa,OAAgB;AACpC,iBAAe,MAAM;AACnB,UAAM;AAAA,EACR,CAAC;AACH;AAWO,SAAS,kBACd,YACA,EAAE,SAAS,MAAM,aAAa,QAAQ,GACF;AACpC,QAAM,CAAC,UAAU,WAAW,IAAI,SAA6B,IAAI;AACjE,QAAM,cAAc,YAAY,CAAC,SAA6B,YAAY,IAAI,GAAG,CAAC,CAAC;AACnF,QAAM,gBAAgB,OAAO,UAAU;AAEvC,YAAU,MAAM;AACd,kBAAc,UAAU;AAAA,EAC1B,GAAG,CAAC,UAAU,CAAC;AAEf,YAAU,MAAM;AACd,QAAI,CAAC,YAAY,CAAC,QAAS;AAC3B,QAAI,OAAO,yBAAyB,YAAa;AACjD,UAAM,WAAW,IAAI;AAAA,MACnB,CAAC,YAAY;AACX,YAAI,CAAC,QAAQ,KAAK,CAAC,UAAU,MAAM,cAAc,EAAG;AACpD,YAAI;AACF,wBAAc,QAAQ;AAAA,QACxB,SAAS,OAAO;AACd,uBAAa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cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,MAAK;AAAA,gBACL,SAAS,MAAM;AACb,8BAAY,KAAK;AACjB,2BAAS,OAAO;AAAA,gBAClB;AAAA,gBACA,WAAU;AAAA,gBAET;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEJ;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/web-react/provider-logo.tsx","../src/web-react/controls.tsx"],"sourcesContent":["/**\n * Provider brand marks — real logo path data (simple-icons / SVG Logos, both\n * CC0) inlined so the picker shows actual provider identity instead of\n * colored-initial monograms. Providers without a usable mark fall back to a\n * tinted monogram chip. Aliases (z-ai/zai, moonshot/moonshotai, deepseek_ai)\n * normalize to one entry.\n */\n\nimport type { ReactNode } from 'react'\n\ninterface LogoDef {\n viewBox: string\n fill: string\n paths: string[]\n}\n\nconst LOGOS: Record<string, LogoDef> = {\n anthropic: { viewBox: '0 0 24 24', fill: '#D97757', paths: [\"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z\"] },\n google: { viewBox: '0 0 24 24', fill: '#8E75B2', paths: [\"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81\"] },\n deepseek: { viewBox: '0 0 24 24', fill: '#4D6BFE', paths: [\"M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45\"] },\n mistral: { viewBox: '0 0 24 24', fill: '#FA520F', paths: [\"M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z\"] },\n xai: { viewBox: '0 0 24 24', fill: '#000000', paths: [\"M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z\"] },\n nvidia: { viewBox: '0 0 24 24', fill: '#76B900', paths: [\"M8.948 8.798v-1.43a6.7 6.7 0 0 1 .424-.018c3.922-.124 6.493 3.374 6.493 3.374s-2.774 3.851-5.75 3.851c-.398 0-.787-.062-1.158-.185v-4.346c1.528.185 1.837.857 2.747 2.385l2.04-1.714s-1.492-1.952-4-1.952a6.016 6.016 0 0 0-.796.035m0-4.735v2.138l.424-.027c5.45-.185 9.01 4.47 9.01 4.47s-4.08 4.964-8.33 4.964c-.37 0-.733-.035-1.095-.097v1.325c.3.035.61.062.91.062 3.957 0 6.82-2.023 9.593-4.408.459.371 2.34 1.263 2.73 1.652-2.633 2.208-8.772 3.984-12.253 3.984-.335 0-.653-.018-.971-.053v1.864H24V4.063zm0 10.326v1.131c-3.657-.654-4.673-4.46-4.673-4.46s1.758-1.944 4.673-2.262v1.237H8.94c-1.528-.186-2.73 1.245-2.73 1.245s.68 2.412 2.739 3.11M2.456 10.9s2.164-3.197 6.5-3.533V6.201C4.153 6.59 0 10.653 0 10.653s2.35 6.802 8.948 7.42v-1.237c-4.84-.6-6.492-5.936-6.492-5.936z\"] },\n meta: { viewBox: '0 0 24 24', fill: '#0467DF', paths: [\"M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973a6.624 6.624 0 0 0 .265.86 5.297 5.297 0 0 0 .371.761c.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.756-1.339.186-.325c.061.1.121.196.183.3l2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843a3.743 3.743 0 0 0 .81-.973c.542-.939.861-2.127.861-3.745 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c.07-.109.141-.224.211-.327 1.12-1.667 2.118-2.602 3.358-2.602zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-.524 0-1.038-.237-1.383-.794-.263-.426-.464-1.13-.464-2.046 0-2.221.63-4.535 1.66-6.088.454-.687.964-1.226 1.533-1.533a2.264 2.264 0 0 1 1.088-.285z\"] },\n moonshotai: { viewBox: '0 0 24 24', fill: '#16191E', paths: [\"m1.053 16.91 9.538 2.55a21 20.981 0 0 0 .06 2.031l5.956 1.592a12 11.99 0 0 1-15.554-6.172m-1.02-5.79 11.352 3.035a21 20.981 0 0 0-.469 2.01l10.817 2.89a12 11.99 0 0 1-1.845 2.004L.658 15.918a12 11.99 0 0 1-.625-4.796m1.593-5.146L13.573 9.17a21 20.981 0 0 0-1.01 1.874l11.297 3.02a21 20.981 0 0 1-.67 2.362l-11.55-3.087L.125 10.26a12 11.99 0 0 1 1.499-4.285ZM6.067 1.58l11.285 3.016a21 20.981 0 0 0-1.688 1.719l7.824 2.091a21 20.981 0 0 1 .513 2.664L2.107 5.218a12 11.99 0 0 1 3.96-3.638M21.68 4.866 7.222 1.003A12 11.99 0 0 1 21.68 4.866\"] },\n openai: { viewBox: '0 0 256 260', fill: '#10A37F', paths: [\"M239.184 106.203a64.72 64.72 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.72 64.72 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.67 64.67 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.77 64.77 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483m-97.56 136.338a48.4 48.4 0 0 1-31.105-11.255l1.535-.87l51.67-29.825a8.6 8.6 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601M37.158 197.93a48.35 48.35 0 0 1-5.781-32.589l1.534.921l51.722 29.826a8.34 8.34 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803M23.549 85.38a48.5 48.5 0 0 1 25.58-21.333v61.39a8.29 8.29 0 0 0 4.195 7.316l62.874 36.272l-21.845 12.636a.82.82 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405zm179.466 41.695l-63.08-36.63L161.73 77.86a.82.82 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.54 8.54 0 0 0-4.4-7.213m21.742-32.69l-1.535-.922l-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.72.72 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391zM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87l-51.67 29.825a8.6 8.6 0 0 0-4.246 7.367zm11.868-25.58L128.067 97.3l28.188 16.218v32.434l-28.086 16.218l-28.188-16.218z\"] },\n}\n\nconst ALIASES: Record<string, string> = {\n moonshot: 'moonshotai',\n deepseek_ai: 'deepseek',\n 'x-ai': 'xai',\n 'meta-llama': 'meta',\n}\n\nconst MONOGRAM: Record<string, { bg: string; fg: string }> = {\n cohere: { bg: '#fae8ff', fg: '#c026d3' },\n groq: { bg: '#fce7f3', fg: '#db2777' },\n cerebras: { bg: '#ccfbf1', fg: '#0d9488' },\n zai: { bg: '#ede9fe', fg: '#7c3aed' },\n 'z-ai': { bg: '#ede9fe', fg: '#7c3aed' },\n tuner: { bg: '#dbeafe', fg: '#2563eb' },\n}\n\nexport interface ProviderLogoProps {\n provider?: string\n size?: number\n}\n\n/** Real brand mark when we have one; tinted monogram otherwise. */\nexport function ProviderLogo({ provider, size = 16 }: ProviderLogoProps): ReactNode {\n const key = ALIASES[provider ?? ''] ?? provider ?? ''\n const logo = LOGOS[key]\n if (logo) {\n return (\n <svg width={size} height={size} viewBox={logo.viewBox} role=\"img\" aria-label={key}>\n {logo.paths.map((d, i) => (\n <path key={i} d={d} fill={logo.fill} />\n ))}\n </svg>\n )\n }\n // Unknown providers fall back to a neutral monogram drawn from theme tokens\n // (secondary tile, muted glyph) — the previous hardcoded grays (#f3f4f6 /\n // #6b7280) were tuned for light mode and read as a washed-out hole on dark.\n // `style` rather than the `fill` attribute so the var() references resolve.\n const mono = MONOGRAM[key]\n return (\n <svg width={size} height={size} viewBox=\"0 0 16 16\" role=\"img\" aria-label={key || 'model'}>\n <rect width=\"16\" height=\"16\" rx=\"4\" style={{ fill: mono ? mono.bg : 'hsl(var(--secondary))' }} />\n <text x=\"8\" y=\"11.6\" textAnchor=\"middle\" style={{ fill: mono ? mono.fg : 'hsl(var(--muted-foreground))' }} fontSize=\"9\" fontWeight=\"700\" fontFamily=\"system-ui, sans-serif\">\n {(key || '?').charAt(0).toUpperCase()}\n </text>\n </svg>\n )\n}\n","/**\n * Shared chat-shell control primitives — the LEAF that both the web-react barrel\n * (`./index`) and the composer children (`./agent-session-controls`,\n * `./seat-paywall`) import directly, so neither child has to reach back through\n * the barrel (which would re-create an import cycle). The barrel re-exports the\n * public names (`usePopover`, `usePending`, `ModelPicker`, `EffortPicker`, …)\n * unchanged, so the published export surface is identical.\n *\n * Styling contract matches the rest of `web-react`: Tailwind classes against the\n * shared design tokens; the glyphs are inline SVGs, no icon-library dependency.\n */\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n type RefObject,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { ProviderLogo } from './provider-logo'\nimport type { CatalogModel } from '../runtime/model-catalog'\n\n// ── shared glyphs (no icon-library dependency) ────────────────────────────\n\nexport function ChevronDown({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n )\n}\n\nfunction SearchGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" />\n </svg>\n )\n}\n\nfunction SparkleGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M12 3v3m0 12v3M3 12h3m12 0h3M5.6 5.6l2.1 2.1m8.6 8.6 2.1 2.1m0-12.8-2.1 2.1M7.7 16.3l-2.1 2.1\" />\n </svg>\n )\n}\n\n/** lucide `brain` (v1.27) inlined — `/web-react` ships no icon-library\n * dependency, so the thinking glyph follows the same pattern as the rest of\n * this set. */\nexport function BrainGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M12 18V5\" />\n <path d=\"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4\" />\n <path d=\"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5\" />\n <path d=\"M17.997 5.125a4 4 0 0 1 2.526 5.77\" />\n <path d=\"M18 18a4 4 0 0 0 2-7.464\" />\n <path d=\"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517\" />\n <path d=\"M6 18a4 4 0 0 1-2-7.464\" />\n <path d=\"M6.003 5.125a4 4 0 0 0-2.526 5.77\" />\n </svg>\n )\n}\n\n/** lucide `check` — the selected-row mark in the picker menus. */\nexport function CheckGlyph({ className }: { className?: string }) {\n return (\n <svg className={className} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n )\n}\n\n/**\n * Keyboard + pointer model for a trigger-and-popover pair, dependency-free.\n * Outside-mousedown and Escape both close; Escape also returns focus to the\n * trigger so keyboard users aren't dropped at the top of the document. The\n * returned `triggerProps` carry the ARIA contract (`aria-haspopup`/\n * `aria-expanded`); spread them onto the trigger button.\n *\n * `panelRef` belongs to the popover panel and MUST be wired when the panel is\n * rendered through {@link PopoverSurface}: a portaled panel is not inside\n * `containerRef`, so a container-only outside test reads every click on the\n * menu's own rows as an outside click and closes before the row's handler runs.\n */\nexport function usePopover(open: boolean, setOpen: (open: boolean) => void) {\n const containerRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const panelRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!open) return\n function onMouseDown(e: MouseEvent) {\n const target = e.target as Node\n if (containerRef.current?.contains(target)) return\n const panel = panelRef.current\n if (panel?.contains(target)) return\n // A popover opened FROM this one portals as a SIBLING at body level, so\n // `contains` cannot see it and a click on its rows would read as outside.\n // Surfaces stamp their ancestor chain, so descendancy survives the portal.\n const ownPath = panel?.getAttribute(POPOVER_SURFACE_ATTR)\n const hitPath =\n target instanceof Element\n ? target.closest(`[${POPOVER_SURFACE_ATTR}]`)?.getAttribute(POPOVER_SURFACE_ATTR)\n : null\n if (ownPath && hitPath && (hitPath === ownPath || hitPath.startsWith(`${ownPath}${POPOVER_PATH_SEPARATOR}`))) return\n setOpen(false)\n }\n function onKeyDown(e: KeyboardEvent) {\n if (e.key === 'Escape') {\n setOpen(false)\n triggerRef.current?.focus()\n }\n }\n document.addEventListener('mousedown', onMouseDown)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('mousedown', onMouseDown)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [open, setOpen])\n\n return {\n containerRef,\n triggerRef,\n panelRef,\n triggerProps: {\n ref: triggerRef,\n 'aria-haspopup': true as const,\n 'aria-expanded': open,\n },\n }\n}\n\n// ── PopoverSurface ────────────────────────────────────────────────────────\n\n/** Distance between the trigger and the panel it opens. */\nconst POPOVER_GAP = 8\n/** Minimum distance the panel keeps from every viewport edge. */\nconst POPOVER_VIEWPORT_MARGIN = 16\n/** Floor for the computed max-height, so a cramped side still shows rows\n * rather than collapsing to a sliver the user cannot read. */\nconst POPOVER_MIN_HEIGHT = 120\n\n/**\n * Marks the portaled panel in the DOM. Products and audits (see\n * `playground/scripts/popover-hit-test.mjs`) select on this rather than on a\n * Tailwind class, which is presentation and free to change.\n *\n * Its VALUE is the surface's ancestor path (`outer/inner`), which is what\n * restores \"is this click inside my popover\" after the portal flattens two\n * nested panels into two siblings of `<body>`.\n */\nexport const POPOVER_SURFACE_ATTR = 'data-agent-app-popover'\nconst POPOVER_PATH_SEPARATOR = '/'\n\n/**\n * `PopoverSurface` is now mounted (closed) inside every server-rendered\n * composer, so its hooks run on the server once per composer per request.\n * React 18 logs \"useLayoutEffect does nothing on the server\" for that; React 19\n * does not (measured silent on react-dom 19.2.8). The peer floor is `react >=18`,\n * so bind the synchronous hook only where there is a DOM and the effect hook\n * elsewhere — placement never runs on the server either way.\n */\nconst useBrowserLayoutEffect = typeof document !== 'undefined' ? useLayoutEffect : useEffect\n\nexport interface PopoverSurfaceProps {\n open: boolean\n /** The trigger the panel anchors to — `usePopover`'s `triggerRef`. */\n triggerRef: RefObject<HTMLElement | null>\n /** `usePopover`'s `panelRef`; also what the outside-click test consults. */\n panelRef: RefObject<HTMLDivElement | null>\n /** Presentation classes. Placement and elevation are owned here — a caller\n * must not pass `absolute`/`fixed`/`top-*`/`bottom-*`/`z-*`. */\n className?: string\n role?: string\n id?: string\n /** Make the panel at least as wide as its trigger. A portaled panel has no\n * `w-full` to inherit — the trigger is no longer its offset parent — so a\n * menu that used to stretch to a full-width trigger declares it here. */\n matchTriggerWidth?: boolean\n children: ReactNode\n}\n\n/**\n * The floating panel every canonical picker opens.\n *\n * It renders through a PORTAL to `document.body` and anchors itself to the\n * trigger in viewport coordinates, because an in-place `absolute` panel's\n * visibility is decided by markup this package does not own. Measured in\n * production: the shipped chat composer docks these controls inside a\n * horizontally scrolling rail (`overflow-x-auto`), and a scroll container\n * clips every positioned descendant whose containing block sits inside it —\n * so a correct 420x457 menu with correct coordinates painted zero pixels and\n * could not be clicked. An ancestor `transform`/`filter`/`contain` would trap\n * it the same way through the stacking context instead of the clip. Leaving\n * the DOM subtree is the only placement a host cannot re-break.\n *\n * Placement prefers ABOVE the trigger (these controls dock at the bottom of a\n * composer), flips below when there is more room there, clamps horizontally\n * into the viewport, and caps its own height to the space on the chosen side.\n * The panel is `visibility: hidden` for the measure pass so it never paints at\n * the pre-placement origin.\n */\nexport function PopoverSurface({\n open,\n triggerRef,\n panelRef,\n className,\n role,\n id,\n matchTriggerWidth,\n children,\n}: PopoverSurfaceProps) {\n const surfaceId = useId()\n const [style, setStyle] = useState<CSSProperties>(() => ({\n position: 'fixed',\n top: 0,\n left: 0,\n visibility: 'hidden',\n }))\n\n const place = useCallback(() => {\n const trigger = triggerRef.current\n const panel = panelRef.current\n if (!trigger || !panel) return\n const anchor = trigger.getBoundingClientRect()\n const viewportWidth = window.innerWidth\n const viewportHeight = window.innerHeight\n\n // `scrollHeight` is the panel's CONTENT height, so it does not feed back\n // on the `maxHeight` this function just applied — reading `offsetHeight`\n // here would measure the previous pass's clamp and ratchet the panel\n // smaller on every scroll event.\n const contentHeight = panel.scrollHeight\n const panelWidth = panel.offsetWidth\n\n const roomAbove = anchor.top - POPOVER_GAP - POPOVER_VIEWPORT_MARGIN\n const roomBelow = viewportHeight - anchor.bottom - POPOVER_GAP - POPOVER_VIEWPORT_MARGIN\n const above = contentHeight <= roomAbove || roomAbove >= roomBelow\n const maxHeight = Math.max(POPOVER_MIN_HEIGHT, above ? roomAbove : roomBelow)\n const height = Math.min(contentHeight, maxHeight)\n\n const top = above ? Math.max(POPOVER_VIEWPORT_MARGIN, anchor.top - POPOVER_GAP - height) : anchor.bottom + POPOVER_GAP\n const rightBound = Math.max(POPOVER_VIEWPORT_MARGIN, viewportWidth - panelWidth - POPOVER_VIEWPORT_MARGIN)\n const left = Math.min(Math.max(POPOVER_VIEWPORT_MARGIN, anchor.left), rightBound)\n\n setStyle({\n position: 'fixed',\n top,\n left,\n maxHeight,\n visibility: 'visible',\n ...(matchTriggerWidth ? { minWidth: anchor.width } : {}),\n })\n }, [matchTriggerWidth, panelRef, triggerRef])\n\n // Layout effect: placement is resolved before the browser paints, so the\n // panel is never seen at the origin it mounts at.\n useBrowserLayoutEffect(() => {\n if (!open) {\n setStyle({ position: 'fixed', top: 0, left: 0, visibility: 'hidden' })\n return\n }\n place()\n }, [open, place])\n\n useEffect(() => {\n if (!open) return\n const onViewportChange = () => place()\n // `capture` so the rail's OWN scroll re-anchors the panel — a scroll inside\n // an ancestor does not bubble to window.\n window.addEventListener('scroll', onViewportChange, true)\n window.addEventListener('resize', onViewportChange)\n return () => {\n window.removeEventListener('scroll', onViewportChange, true)\n window.removeEventListener('resize', onViewportChange)\n }\n }, [open, place])\n\n if (!open || typeof document === 'undefined') return null\n\n const ownerPath = triggerRef.current?.closest?.(`[${POPOVER_SURFACE_ATTR}]`)?.getAttribute(POPOVER_SURFACE_ATTR)\n const path = ownerPath ? `${ownerPath}${POPOVER_PATH_SEPARATOR}${surfaceId}` : surfaceId\n\n return createPortal(\n <div\n ref={panelRef}\n id={id}\n role={role}\n style={style}\n {...{ [POPOVER_SURFACE_ATTR]: path }}\n className={`z-[1000] ${className ?? ''}`}\n >\n {children}\n </div>,\n document.body,\n )\n}\n\n/**\n * Focus treatment for a row inside a popover panel.\n *\n * The ring itself now comes from the `:focus-visible` floor in tokens.css, so\n * this no longer restates a width or a colour. What it still has to say is\n * WHERE the ring is drawn: a popover option is a full-width row inside a panel\n * that clips its own corners (`overflow-hidden rounded-xl`), and an outward\n * ring on the first or last row is clipped away by that panel. Pulling the\n * offset negative draws the same ring just inside the row instead.\n */\nexport const POPOVER_OPTION_FOCUS = 'focus-visible:[outline-offset:-2px]'\n\n/**\n * The one overlay elevation for floating surfaces — picker menus, popovers,\n * drawers, modals. Reads the theme's `--shadow-overlay` token, so every overlay\n * lifts with the same shadow and re-themes from one source. The floating\n * composer uses the quieter `shadow-raised` rung instead.\n *\n * Written as an arbitrary value rather than the preset's `shadow-overlay`\n * utility, because that utility only exists where the preset is part of the\n * Tailwind build. A host that gets its tokens through a precompiled bundle —\n * `@tangle-network/sandbox-ui` ships brand's tokens inlined, with no `@theme`\n * block surviving the compile — receives `--shadow-overlay` as a plain custom\n * property, from which no `shadow-overlay` utility can be generated, and these\n * surfaces render flat. The arbitrary form emits from the class alone and works\n * either way.\n */\nexport const OVERLAY_SHADOW = 'shadow-[var(--shadow-overlay)]'\n\n/**\n * Root geometry for a picker — the box that holds the trigger — in one place\n * because every picker in this family has to agree on it.\n *\n * Shrink-wrapping (`inline-flex`) is the default: these controls dock on a\n * composer row where an expanding pill shoves its neighbours around. A STACKED\n * panel wants the opposite — the compact `AgentSessionControls` gear popover\n * lays its controls out in a column, and a shrink-wrapped root there makes a\n * trigger's own `w-full` a no-op, since it fills a box the trigger itself\n * sized. That is what left Agent backend short of the panel edge and Thinking\n * narrower still.\n *\n * The panel is portaled ({@link PopoverSurface}), so widening the root widens\n * the TRIGGER only. A menu that should follow it declares `matchTriggerWidth`.\n */\nexport function pickerRootClass(fullWidth: boolean): string {\n return `relative ${fullWidth ? 'flex w-full' : 'inline-flex'}`\n}\n\n/**\n * Guard an async action against double-submit. `run` ignores re-entrant calls\n * while a promise is in flight and flips `pending` so the caller can disable\n * the control — the fix for double-charge / double-approve on a slow network.\n * Settles (success or throw) before clearing, and no-ops state updates after\n * unmount.\n */\nexport function usePending(): { pending: boolean; run: (action: () => void | Promise<void>) => void } {\n const [pending, setPending] = useState(false)\n const inFlight = useRef(false)\n const mounted = useRef(true)\n useEffect(() => {\n mounted.current = true\n return () => {\n mounted.current = false\n }\n }, [])\n const run = (action: () => void | Promise<void>) => {\n if (inFlight.current) return\n let result: void | Promise<void>\n try {\n result = action()\n } catch {\n return\n }\n if (!(result instanceof Promise)) return\n inFlight.current = true\n setPending(true)\n void result.finally(() => {\n inFlight.current = false\n if (mounted.current) setPending(false)\n })\n }\n return { pending, run }\n}\n\n// ── ModelPicker ───────────────────────────────────────────────────────────\n\nexport interface ModelPickerProps {\n value: string\n onChange: (id: string) => void\n /** Catalogue models — from `GET`ing the app's catalogue route (see\n * `runtime/model-catalog`), plus any product-specific entries appended. */\n models: CatalogModel[]\n loading?: boolean\n /** Render a provider logo/badge; default is a generic sparkle. */\n renderProviderBadge?: (provider: string) => ReactNode\n /** Section label for `featured` models. */\n recommendedLabel?: string\n /** Pin a labeled section to the TOP of the list (above Recommended) for the\n * models a product wants surfaced first — e.g. a tuner app's own fine-tuned\n * models (`{ label: 'Your Fine-Tuned Models', match: (m) => m.provider === 'tuner' }`).\n * Matching models are shown only in this section, not duplicated below. */\n priorityGroup?: {\n label: string\n match: (model: CatalogModel) => boolean\n }\n}\n\nfunction formatPrice(p?: string): string | undefined {\n if (!p) return undefined\n const n = Number(p)\n if (isNaN(n) || n === 0) return undefined\n const perM = n * 1_000_000\n return perM >= 1 ? `$${perM.toFixed(0)}/M` : `$${perM.toFixed(2)}/M`\n}\n\nfunction formatContext(len?: number): string | undefined {\n if (!len) return undefined\n if (len >= 1_000_000) return `${(len / 1_000_000).toFixed(1)}M ctx`\n if (len >= 1_000) return `${Math.round(len / 1_000)}K ctx`\n return `${len} ctx`\n}\n\nfunction SectionHeader({ children }: { children: ReactNode }) {\n return (\n <div className=\"px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground\">\n {children}\n </div>\n )\n}\n\nfunction ModelRow({\n model,\n selected,\n onSelect,\n renderProviderBadge,\n}: {\n model: CatalogModel\n selected: boolean\n onSelect: () => void\n renderProviderBadge?: (provider: string) => ReactNode\n}) {\n const price = formatPrice(model.pricing?.prompt)\n const ctx = formatContext(model.contextLength)\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n className={`flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${\n selected ? 'bg-primary/10 font-medium' : 'hover:bg-accent'\n }`}\n >\n {renderProviderBadge ? renderProviderBadge(model.provider) : <ProviderLogo provider={model.provider} size={16} />}\n <span className=\"truncate\">{model.name}</span>\n {!model.supportsTools && (\n <span className=\"shrink-0 rounded bg-secondary px-1.5 py-0.5 text-xs font-medium text-muted-foreground\">\n no tools\n </span>\n )}\n <span className=\"ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground\">\n {ctx && <span>{ctx}</span>}\n {price && <span>{price}</span>}\n </span>\n </button>\n )\n}\n\n/**\n * Searchable model picker pill + popover: a featured/recommended section\n * first, then per-provider groups in catalogue order (the server already\n * sorts providers by tier).\n *\n * This is the CANONICAL ecosystem model picker (see \"UI chrome ownership\n * (picker canon)\" in AGENTS.md). sandbox-ui's `dashboard/ModelPicker` is\n * legacy — deprecated, frozen, removed at sandbox-ui's next major; new code\n * belongs here.\n */\nexport function ModelPicker({ value, onChange, models, loading, renderProviderBadge, recommendedLabel = 'Recommended', priorityGroup }: ModelPickerProps) {\n const [open, setOpen] = useState(false)\n const [query, setQuery] = useState('')\n const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen)\n const inputRef = useRef<HTMLInputElement>(null)\n const panelId = useId()\n\n useEffect(() => {\n if (open) inputRef.current?.focus()\n }, [open])\n\n const selected = models.find((m) => m.id === value)\n\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase()\n if (!q) return null\n return models.filter(\n (m) =>\n m.id.toLowerCase().includes(q) ||\n m.name.toLowerCase().includes(q) ||\n (m.description?.toLowerCase() ?? '').includes(q) ||\n m.provider.toLowerCase().includes(q),\n )\n }, [models, query])\n\n const sections = useMemo(() => {\n const isPriority = priorityGroup ? (m: CatalogModel) => priorityGroup.match(m) : () => false\n const priority = priorityGroup ? models.filter(isPriority) : []\n const recommended = models.filter((m) => m.featured && !isPriority(m))\n const byProvider: Array<{ provider: string; items: CatalogModel[] }> = []\n for (const m of models) {\n if (m.featured || isPriority(m)) continue\n const last = byProvider[byProvider.length - 1]\n if (last && last.provider === m.provider) last.items.push(m)\n else byProvider.push({ provider: m.provider, items: [m] })\n }\n return { priority, recommended, byProvider }\n }, [models, priorityGroup])\n\n const select = (id: string) => {\n onChange(id)\n setOpen(false)\n setQuery('')\n }\n\n return (\n <div ref={containerRef} className=\"relative inline-flex\">\n <button\n type=\"button\"\n {...triggerProps}\n aria-controls={open ? panelId : undefined}\n onClick={() => setOpen(!open)}\n className=\"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent\"\n >\n {selected ? (renderProviderBadge ? renderProviderBadge(selected.provider) : <ProviderLogo provider={selected.provider} size={16} />) : <SparkleGlyph className=\"h-3.5 w-3.5 text-muted-foreground\" />}\n <span className=\"max-w-[160px] truncate\">{selected?.name ?? value}</span>\n <ChevronDown className=\"h-3.5 w-3.5 text-muted-foreground\" />\n </button>\n\n <PopoverSurface\n open={open}\n id={panelId}\n triggerRef={triggerRef}\n panelRef={panelRef}\n className={`flex w-[420px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border border-card-edge bg-popover ${OVERLAY_SHADOW}`}\n >\n <div className=\"shrink-0 border-b border-border px-3 py-2\">\n <div className=\"flex items-center gap-2 rounded-lg border border-strong bg-background px-3 py-2\">\n <SearchGlyph className=\"h-3.5 w-3.5 text-muted-foreground\" />\n <input\n ref={inputRef}\n type=\"text\"\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search models...\"\n className=\"flex-1 bg-transparent text-sm placeholder:text-muted-foreground\"\n />\n </div>\n </div>\n {/* `min-h-0` is what lets the list absorb the surface's computed\n max-height on a short viewport instead of overflowing the panel. */}\n <div className=\"max-h-[400px] min-h-0 overflow-y-auto p-1 pb-2\">\n {loading && <div className=\"px-3 py-4 text-center text-sm text-muted-foreground\">Loading models...</div>}\n {!loading && filtered && (\n <>\n {filtered.length === 0 && (\n <div className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No models match your search</div>\n )}\n {filtered.map((m) => (\n <ModelRow key={m.id} model={m} selected={m.id === value} onSelect={() => select(m.id)} renderProviderBadge={renderProviderBadge} />\n ))}\n </>\n )}\n {!loading && !filtered && models.length === 0 && (\n <div className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No models available</div>\n )}\n {!loading && !filtered && models.length > 0 && (\n <>\n {priorityGroup && sections.priority.length > 0 && (\n <>\n <SectionHeader>{priorityGroup.label}</SectionHeader>\n {sections.priority.map((m) => (\n <ModelRow key={m.id} model={m} selected={m.id === value} onSelect={() => select(m.id)} renderProviderBadge={renderProviderBadge} />\n ))}\n </>\n )}\n {sections.recommended.length > 0 && (\n <>\n <SectionHeader>{recommendedLabel}</SectionHeader>\n {sections.recommended.map((m) => (\n <ModelRow key={m.id} model={m} selected={m.id === value} onSelect={() => select(m.id)} renderProviderBadge={renderProviderBadge} />\n ))}\n </>\n )}\n {sections.byProvider.map((g) => (\n <div key={g.provider}>\n <SectionHeader>{g.provider}</SectionHeader>\n {g.items.map((m) => (\n <ModelRow key={m.id} model={m} selected={m.id === value} onSelect={() => select(m.id)} renderProviderBadge={renderProviderBadge} />\n ))}\n </div>\n ))}\n </>\n )}\n </div>\n </PopoverSurface>\n </div>\n )\n}\n\n// ── EffortPicker ──────────────────────────────────────────────────────────\n\n/** One reasoning-budget level: the engine `id` is unchanged (the value the\n * product sends to the loop); only the user-facing `label` is renamed to the\n * plainer \"how hard should it think\" vocabulary from docs/product-surfaces.md.\n * `low`→Quick, `medium`→Standard, `high`→Extended. The mapping is overridable\n * via `EffortPickerProps.levels`, so a product can relabel without losing the\n * ids the runtime expects. */\nexport interface EffortLevel {\n id: string\n label: string\n}\n\n/**\n * The engine ids this package NAMES, and the word each one reads as.\n *\n * Deliberately WIDER than {@link DEFAULT_EFFORT_LEVELS}: the default list is\n * what a picker OFFERS when a product declares nothing, while this is the\n * vocabulary — the labels a named id keeps wherever it appears. The two are\n * different questions, and folding them together is what made a real engine\n * rung read as its own id: `xhigh` and `ultracode` are rungs claude-code\n * applies above `high`, so a product declaring them got \"Xhigh\" while every\n * neighbouring rung had a plain English word. Naming them here is what stops\n * each product inventing its own — the drift `effortLevelsFromIds` exists to\n * prevent. They stay OUT of the offered default because most backends do not\n * apply them, and offering a rung the backend ignores is the defect\n * `effortLevels` was added to close.\n */\nconst KNOWN_EFFORT_LABELS = {\n off: 'Off',\n low: 'Quick',\n medium: 'Standard',\n high: 'Extended',\n xhigh: 'Extra',\n ultracode: 'Ultra',\n} as const\n\nexport const DEFAULT_EFFORT_LEVELS: readonly EffortLevel[] = [\n { id: 'off', label: KNOWN_EFFORT_LABELS.off },\n { id: 'low', label: KNOWN_EFFORT_LABELS.low },\n { id: 'medium', label: KNOWN_EFFORT_LABELS.medium },\n { id: 'high', label: KNOWN_EFFORT_LABELS.high },\n]\n\n/**\n * The user-facing label for an engine level id: the canonical vocabulary when\n * the id is one this package names, otherwise the id itself made readable\n * (`auto` -> \"Auto\", `ultra-code` -> \"Ultra code\"). Never invents a depth word,\n * so an id nobody declared a label for still reads as ITSELF and never as some\n * other level.\n */\nexport function effortLevelLabel(id: string): string {\n const known = (KNOWN_EFFORT_LABELS as Record<string, string | undefined>)[id]\n if (known) return known\n const words = id.replace(/[-_]+/g, ' ').trim()\n return words ? words.charAt(0).toUpperCase() + words.slice(1) : id\n}\n\n/**\n * Build a levels list from the engine ids a backend applies — the shape the\n * removed `ComposerAgentControls` took as `reasoning.available`, so a product\n * migrating that list has one call to make instead of a hand-written label map\n * per product (which is how \"Quick\" and \"Low\" drift apart across surfaces).\n */\nexport function effortLevelsFromIds(ids: readonly string[]): readonly EffortLevel[] {\n return ids.map((id) => ({ id, label: effortLevelLabel(id) }))\n}\n\n/**\n * The list {@link EffortPicker} RENDERS for `value` — the declared levels, plus\n * `value` itself when the declaration omits it.\n *\n * A picker cannot honestly resolve a selected value it was not given, and the\n * failure it used to take instead — fall back to the middle entry — renders the\n * session's real depth as a DIFFERENT level's name. That is exactly the defect\n * `levels` was added to prevent: the legacy adapter's `available` list excluded\n * the `auto` sentinel because the old picker injected it, so a product mapping\n * that list straight across ships a session running on `auto` labelled\n * \"Extended\". Admitting the value is not offering a new choice — it is\n * reporting the state the session is already in, and it disappears from the\n * list as soon as the user picks a declared level.\n *\n * A blank value is not admitted (there is no honest label for it); the picker\n * renders no selection instead.\n */\nexport function reconcileEffortLevels(\n value: string,\n levels: readonly EffortLevel[] = DEFAULT_EFFORT_LEVELS,\n): readonly EffortLevel[] {\n if (!value || levels.some((l) => l.id === value)) return levels\n return [{ id: value, label: effortLevelLabel(value) }, ...levels]\n}\n\n// ── effort strength meter ─────────────────────────────────────────────────\n\n/** Segments the meter draws — fixed geometry so the ladder stays tabular\n * across levels (and across the trigger and its menu rows). */\nexport const EFFORT_METER_SEGMENTS = 4\n\n/** Filled-segment opacity ladder: translucent on the left, heavy on the\n * right — the ramp carries strength even at a glance, the count carries it\n * exactly. Unfilled segments sit at a fixed ghost opacity. */\nconst EFFORT_METER_FILL_OPACITY = [0.25, 0.5, 0.75, 1] as const\nconst EFFORT_METER_GHOST_OPACITY = 0.15\n\n/** Level ids that mean \"no reasoning\" — the meter renders all-ghost. */\nconst OFF_LEVEL_IDS: ReadonlySet<string> = new Set(['off', 'none'])\n\n/**\n * Ids that name a POLICY rather than a depth: `auto` means \"let the harness and\n * model decide\", so it has no position on a strength ladder.\n *\n * Without this it lands wherever the declaration puts it and draws a filled\n * meter — measured on a product that offers `auto` first: every harness read\n * `Auto` at a FULL four bars, including `cli-base`, which has no agent to think\n * at all. A meter is a claim about how hard the run will think, and a sentinel\n * cannot make that claim.\n */\nconst UNPLACEABLE_LEVEL_IDS: ReadonlySet<string> = new Set(['auto'])\n\n/**\n * Filled-segment count for a level: 0 for off/none (or an id the levels list\n * does not carry); otherwise the level's position among the non-off choices\n * scaled onto the meter, so the ladder reads low < medium < high and the top\n * level fills the whole scale. The canonical four levels land 0 / 1 / 2 / 4.\n */\nexport function effortMeterFill(\n levelId: string,\n levels: readonly EffortLevel[] = DEFAULT_EFFORT_LEVELS,\n): number {\n if (OFF_LEVEL_IDS.has(levelId) || UNPLACEABLE_LEVEL_IDS.has(levelId)) return 0\n const active = levels.filter((l) => !OFF_LEVEL_IDS.has(l.id) && !UNPLACEABLE_LEVEL_IDS.has(l.id))\n const index = active.findIndex((l) => l.id === levelId)\n if (index < 0 || active.length === 0) return 0\n return Math.max(1, Math.floor(((index + 1) * EFFORT_METER_SEGMENTS) / active.length))\n}\n\n/**\n * The thinking-strength meter: four 12px bars, filled count = level, filled\n * opacity ramping 25→100% left to right (unfilled at a faint ghost). Purely\n * decorative — the level name is always rendered as text beside it, so the\n * meter is `aria-hidden` and adds no second accessible name.\n */\nexport function EffortMeter({ fill, className }: { fill: number; className?: string }) {\n return (\n <span aria-hidden className={`inline-flex items-center gap-[2px] ${className ?? ''}`}>\n {Array.from({ length: EFFORT_METER_SEGMENTS }, (_, i) => (\n <span\n key={i}\n className=\"h-3 w-[3px] rounded-full bg-current\"\n style={{ opacity: i < fill ? EFFORT_METER_FILL_OPACITY[i] : EFFORT_METER_GHOST_OPACITY }}\n />\n ))}\n </span>\n )\n}\n\nexport interface EffortPickerProps {\n value: string\n onChange: (id: string) => void\n /** Selectable levels (engine id + user-facing label). Defaults to the plain\n * \"Thinking\" vocabulary; override to relabel without changing the ids the\n * runtime receives.\n *\n * A list that omits the current `value` is not a rendering error the picker\n * papers over: `value` is reconciled INTO the rendered list under its own\n * name (see {@link reconcileEffortLevels}), because a control must report\n * the depth the session is running at and never some other list entry. */\n levels?: readonly EffortLevel[]\n /** Prefix shown before the active level on the pill — the \"what is this\"\n * context the bare value lacked. Default \"Thinking\". Pass '' to hide it. */\n label?: string\n /** Fill the container instead of shrink-wrapping — opt-in, default `false`;\n * see {@link pickerRootClass} for when and why. */\n fullWidth?: boolean\n}\n\n/** Thinking-budget selector pill, styled to match {@link ModelPicker}. Show\n * it only when the selected model `supportsReasoning`. \"Thinking\" is the\n * plain-English name for what was internally called \"effort\".\n *\n * The CANONICAL ecosystem effort picker — sandbox-ui's reasoning menu (inside\n * its `chat/AgentSessionControls`) is legacy and frozen. */\nexport function EffortPicker({ value, onChange, levels = DEFAULT_EFFORT_LEVELS, label = 'Thinking', fullWidth = false }: EffortPickerProps) {\n const [open, setOpen] = useState(false)\n const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen)\n const panelId = useId()\n const rendered = reconcileEffortLevels(value, levels)\n // The strength ladder is computed over the DECLARED levels only, so admitting\n // the selected value cannot shift where the declared ones sit on the meter.\n // A level the declaration does not carry has no position on that ladder, so\n // it renders with NO meter — an all-ghost meter is what `off` looks like, and\n // \"we cannot place this\" is not \"no thinking\".\n const isDeclared = (id: string) => levels.some((l) => l.id === id) && !UNPLACEABLE_LEVEL_IDS.has(id)\n const selected = rendered.find((l) => l.id === value)\n\n return (\n <div ref={containerRef} className={pickerRootClass(fullWidth)}>\n <button\n type=\"button\"\n {...triggerProps}\n aria-controls={open ? panelId : undefined}\n onClick={() => setOpen(!open)}\n title={label ? `${label} — how hard the agent reasons before answering` : 'Reasoning effort'}\n className={`inline-flex min-h-[36px] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent ${fullWidth ? 'w-full' : ''}`}\n >\n <BrainGlyph className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n {/* Full width gives the label the slack, so the meter and chevron park\n on the trailing edge and the glyph stays against the text. */}\n <span className={fullWidth ? 'flex-1 truncate text-left' : undefined}>\n {label ? <span className=\"text-muted-foreground\">{label}: </span> : null}\n {selected ? selected.label : '—'}\n </span>\n {selected && isDeclared(selected.id) && (\n <EffortMeter fill={effortMeterFill(selected.id, levels)} className=\"shrink-0 text-foreground\" />\n )}\n <ChevronDown className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n </button>\n <PopoverSurface\n open={open}\n id={panelId}\n role=\"menu\"\n triggerRef={triggerRef}\n panelRef={panelRef}\n // A portaled panel has no `w-full` to inherit, so a full-width trigger\n // hands its measured width to the panel instead.\n matchTriggerWidth={fullWidth}\n className={`w-44 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 ${OVERLAY_SHADOW}`}\n >\n {rendered.map((l) => (\n <button\n key={l.id}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={l.id === value}\n onClick={() => {\n onChange(l.id)\n setOpen(false)\n }}\n className={`flex min-h-[40px] w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${\n l.id === value ? 'bg-primary/10 font-medium' : 'hover:bg-accent'\n }`}\n >\n <BrainGlyph className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"truncate\">{l.label}</span>\n {isDeclared(l.id) && (\n <EffortMeter fill={effortMeterFill(l.id, levels)} className=\"ml-auto text-foreground\" />\n )}\n {l.id === value && (\n <CheckGlyph className={`${isDeclared(l.id) ? '' : 'ml-auto '}h-3.5 w-3.5 shrink-0 text-primary`} />\n )}\n </button>\n ))}\n </PopoverSurface>\n </div>\n )\n}\n"],"mappings":";AAyDU,cAWN,YAXM;AAzCV,IAAM,QAAiC;AAAA,EACrC,WAAW,EAAE,SAAS,aAAa,MAAM,WAAW,OAAO,CAAC,0KAA0K,EAAE;AAAA,EACxO,QAAQ,EAAE,SAAS,aAAa,MAAM,WAAW,OAAO,CAAC,8RAA8R,EAAE;AAAA,EACzV,UAAU,EAAE,SAAS,aAAa,MAAM,WAAW,OAAO,CAAC,w7DAAw7D,EAAE;AAAA,EACr/D,SAAS,EAAE,SAAS,aAAa,MAAM,WAAW,OAAO,CAAC,kLAAkL,EAAE;AAAA,EAC9O,KAAK,EAAE,SAAS,aAAa,MAAM,WAAW,OAAO,CAAC,oMAAoM,EAAE;AAAA,EAC5P,QAAQ,EAAE,SAAS,aAAa,MAAM,WAAW,OAAO,CAAC,qwBAAqwB,EAAE;AAAA,EACh0B,MAAM,EAAE,SAAS,aAAa,MAAM,WAAW,OAAO,C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