Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(desktop): search bots from a command palette

leepokai7fbeea1b5641
diff --git a/apps/desktop/src/renderer/components/Overlay.tsx b/apps/desktop/src/renderer/components/Overlay.tsx
index e70f2b3e..1549d190 100644
--- a/apps/desktop/src/renderer/components/Overlay.tsx
+++ b/apps/desktop/src/renderer/components/Overlay.tsx
@@ -61,9 +61,11 @@ function useEscape(active: boolean, onEscape: () => void) {
}
/** The Mac modal (`.codyncSheet`): a centered card over a dim; the content sizes it. */
-export function Sheet({ open, onClose, width, height, children }: {
+export function Sheet({ open, onClose, width, height, dismissOnDim = false, children }: {
open: boolean
onClose: () => void
+ /** A click outside the card closes it (transient pickers, not forms). */
+ dismissOnDim?: boolean
width?: number | string
height?: number | string
children: ReactNode
@@ -76,7 +78,7 @@ export function Sheet({ open, onClose, width, height, children }: {
return createPortal(
<DismissContext.Provider value={onClose}>
<div className={`modal-card ${shown ? 'shown' : ''}`} role="dialog" aria-modal>
- <div className="modal-dim" />
+ <div className="modal-dim" onClick={dismissOnDim ? onClose : undefined} />
<div className="modal-content" style={{ width, height, maxWidth: 'calc(100vw - 48px)', maxHeight: 'calc(100vh - 48px)' }}>
{open ? children : last.current}
</div>
diff --git a/apps/desktop/src/renderer/views/ChatWindow.tsx b/apps/desktop/src/renderer/views/ChatWindow.tsx
index 2dde37a7..41dfe417 100644
--- a/apps/desktop/src/renderer/views/ChatWindow.tsx
+++ b/apps/desktop/src/renderer/views/ChatWindow.tsx
@@ -20,6 +20,7 @@ import { MarketplaceView } from './marketplace/MarketplaceView'
import { SettingsView, type SettingsPage } from './settings/SettingsView'
import { ApprovalSheet } from './settings/ApprovalSheet'
import { UpdateNeededCard } from './UpdateNeededCard'
+import { SearchPalette } from './SearchPalette'
import { AccountWelcomeView } from './AccountWelcomeView'
import { AnalyticsPrompt } from './AnalyticsPrompt'
import { OpenVoiceSettings } from './call/CallView'
@@ -147,7 +148,7 @@ function ChatSplitView() {
const [compact, setCompact] = usePref(prefs.sidebarCompact)
const [sidebarWidth, setSidebarWidth] = usePref(prefs.sidebarWidth)
const [hidden, setHidden] = usePref(prefs.hiddenComputers)
- const [search, setSearch] = useState('')
+ const [searching, setSearching] = useState(false)
const [composing, setComposing] = useState(false)
const [composingGroup, setComposingGroup] = useState(false)
const [composeComputer, setComposeComputer] = useState<string | null>(null)
@@ -164,7 +165,6 @@ function ChatSplitView() {
const openVoiceSettings = useCallback(() => setSettings('voice'), [])
const [showAccount, setShowAccount] = useState(false)
const [windowSize, setWindowSize] = useState({ width: window.innerWidth, height: window.innerHeight })
- const searchRef = useRef<HTMLInputElement>(null)
const newButton = useRef<HTMLButtonElement>(null)
const railNewButton = useRef<HTMLButtonElement>(null)
const listRef = useRef<HTMLDivElement>(null)
@@ -185,12 +185,7 @@ function ChatSplitView() {
const onlineStores = stores.filter((s) => shown.has(s.computer.id) && s.connection.kind === 'online' && !s.mismatch)
const selectedStore = app.selectedStore
const composeStore = composeComputer ? app.store(composeComputer) : null
- const query = search.trim().toLowerCase()
- const visibleRoster = app.roster.filter(
- (item) =>
- shown.has(item.ref.computerId) &&
- (compact || !query || item.bot.name.toLowerCase().includes(query) || (item.bot.lastMessage ?? '').toLowerCase().includes(query)),
- )
+ const visibleRoster = app.roster.filter((item) => shown.has(item.ref.computerId))
const compose = (group = false) => {
setComposingGroup(group)
@@ -211,10 +206,7 @@ function ChatSplitView() {
() =>
window.codync.app.onCommand((c) => {
if (c.kind === 'newChat' && onlineStores.length) compose()
- if (c.kind === 'search') {
- setCompact(false)
- setTimeout(() => searchRef.current?.focus(), 0)
- }
+ if (c.kind === 'search') setSearching(true)
if (c.kind === 'toggleSidebar') setCompact(!prefs.sidebarCompact.get())
}),
)
@@ -339,6 +331,7 @@ function ChatSplitView() {
<span style={{ flex: 1 }} />
<div className="no-drag" style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<ComputerFilterHeader hidden={hidden} setHidden={setHidden} manage={() => setSettings('computers')} />
+ <IconButton title="Search" icon="magnifyingglass" onClick={() => setSearching(true)} />
<IconButton title="New" icon="plus" buttonRef={newButton} onClick={() => setNewMenu((o) => !o)} disabled={!onlineStores.length} />
</div>
<AnchoredMenu open={newMenu} onClose={() => setNewMenu(false)} anchor={newButton} items={newItems} />
@@ -350,30 +343,6 @@ function ChatSplitView() {
</div>
</div>
) : null}
- {!compact ? (
- <div className="search">
- <Icon name="magnifyingglass" size={13} color="var(--secondary)" />
- <input
- ref={searchRef}
- value={search}
- placeholder="Search"
- aria-label="Search bots"
- spellCheck={false}
- onChange={(e) => setSearch(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === 'Escape') {
- setSearch('')
- searchRef.current?.blur()
- }
- }}
- />
- {search ? (
- <button className="search-clear" aria-label="Clear search" title="Clear search" onClick={() => setSearch('')}>
- <Icon name="xmark.circle.fill" size={13} color="var(--secondary)" />
- </button>
- ) : null}
- </div>
- ) : null}
<div className="roster" ref={listRef} tabIndex={0} onKeyDown={onListKey}>
{!compact
? mismatchStores.map((s) => (
@@ -412,13 +381,14 @@ function ChatSplitView() {
})}
{visibleRoster.length === 0 && !compact && mismatchStores.length === 0 ? (
<div className="roster-empty">
- <div style={font(13, 'medium')}>{search ? 'No matching bots' : 'No bots yet'}</div>
- <div style={{ ...font(12), color: 'var(--secondary)' }}>{search ? 'Try another name or message.' : 'Use + to start a new chat.'}</div>
+ <div style={font(13, 'medium')}>No bots yet</div>
+ <div style={{ ...font(12), color: 'var(--secondary)' }}>Use + to start a new chat.</div>
</div>
) : null}
</div>
{compact ? (
<div className="rail-actions">
+ <IconButton title="Search" icon="magnifyingglass" onClick={() => setSearching(true)} />
<IconButton title="New" icon="plus" size={36} buttonRef={railNewButton} disabled={!onlineStores.length} onClick={() => setRailNewMenu((o) => !o)} />
<AnchoredMenu open={railNewMenu} onClose={() => setRailNewMenu(false)} anchor={railNewButton} items={newItems} />
<IconButton title="Marketplace" icon="square.grid.2x2" size={36} onClick={openMarketplace} />
@@ -472,6 +442,7 @@ function ChatSplitView() {
</div>
) : null}
+ <SearchPalette open={searching} items={visibleRoster} onPick={(ref) => app.select(ref)} onClose={() => setSearching(false)} />
<Sheet open={editing !== null} onClose={() => setEditing(null)} width={520} height={Math.min(680, sheetHeight)}>
{editing ? (
<StoreContext.Provider value={editing.store}>
diff --git a/apps/desktop/src/renderer/views/SearchPalette.tsx b/apps/desktop/src/renderer/views/SearchPalette.tsx
new file mode 100644
index 00000000..789e1538
--- /dev/null
+++ b/apps/desktop/src/renderer/views/SearchPalette.tsx
@@ -0,0 +1,96 @@
+import { useEffect, useRef, useState } from 'react'
+import { isGroup, type Bot } from '@shared/models'
+import { AvatarWithStatus } from '../components/Avatar'
+import { Icon } from '../components/Icon'
+import { Sheet } from '../components/Overlay'
+import { font } from '../lib/fonts'
+import { refKey, type BotRef, type RosterItem } from '../store/app-model'
+import './search-palette.css'
+
+const isMac = window.codync.platform === 'darwin'
+const modifier = isMac ? '⌘' : 'Ctrl+'
+
+/** Bots matching the query by name, description or last message; all bots for an empty query. */
+export function matchBots(items: RosterItem[], query: string): RosterItem[] {
+ const q = query.trim().toLowerCase()
+ if (!q) return items
+ return items.filter(({ bot }) => [bot.name, bot.description, bot.lastMessage ?? ''].some((s) => s.toLowerCase().includes(q)))
+}
+
+/** Grok Bot's bot search: a floating list over the window, arrows/Enter or ⌘1-9 to open a bot. */
+export function SearchPalette({ open, items, onPick, onClose }: { open: boolean; items: RosterItem[]; onPick: (ref: BotRef) => void; onClose: () => void }) {
+ return (
+ <Sheet open={open} onClose={onClose} width={640} dismissOnDim>
+ {open ? <PaletteBody items={items} onPick={onPick} onClose={onClose} /> : null}
+ </Sheet>
+ )
+}
+
+function PaletteBody({ items, onPick, onClose }: { items: RosterItem[]; onPick: (ref: BotRef) => void; onClose: () => void }) {
+ const [query, setQuery] = useState('')
+ const [active, setActive] = useState(0)
+ const list = useRef<HTMLDivElement>(null)
+ const results = matchBots(items, query)
+ const pick = (item: RosterItem | undefined) => {
+ if (!item) return
+ onPick(item.ref)
+ onClose()
+ }
+
+ useEffect(() => setActive(0), [query])
+ useEffect(() => {
+ list.current?.children[active]?.scrollIntoView({ block: 'nearest' })
+ }, [active])
+
+ const onKey = (e: React.KeyboardEvent) => {
+ if (e.nativeEvent.isComposing) return
+ const digit = Number(e.key)
+ if ((isMac ? e.metaKey : e.ctrlKey) && digit >= 1 && digit <= 9) {
+ e.preventDefault()
+ pick(results[digit - 1])
+ } else if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
+ e.preventDefault()
+ const step = e.key === 'ArrowDown' ? 1 : -1
+ setActive((i) => (results.length ? (i + step + results.length) % results.length : 0))
+ } else if (e.key === 'Enter') {
+ e.preventDefault()
+ pick(results[active])
+ }
+ }
+
+ return (
+ <div className="palette" onKeyDown={onKey}>
+ <div className="palette-field">
+ <Icon name="magnifyingglass" size={15} color="var(--secondary)" />
+ <input autoFocus value={query} placeholder="Search" aria-label="Search bots" spellCheck={false} onChange={(e) => setQuery(e.target.value)} />
+ </div>
+ <div className="palette-list" ref={list} role="listbox">
+ {results.map((item, i) => (
+ <button
+ key={refKey(item.ref)}
+ role="option"
+ aria-selected={i === active}
+ className={`palette-row ${i === active ? 'active' : ''}`}
+ onMouseMove={() => setActive(i)}
+ onClick={() => pick(item)}
+ >
+ <AvatarWithStatus bot={item.bot} members={isGroup(item.bot) ? item.store.members(item.bot) : []} size={32} />
+ <span style={{ flex: 1, minWidth: 0, display: 'flex', flexDirection: 'column', gap: 2 }}>
+ <span className="palette-line" style={{ ...font('body'), color: 'var(--text)' }}>{item.bot.name}</span>
+ {subtitle(item) ? <span className="palette-line" style={{ ...font('subheadline'), color: 'var(--secondary)' }}>{subtitle(item)}</span> : null}
+ </span>
+ {i < 9 ? <span className="key-cap palette-key">{`${modifier}${i + 1}`}</span> : null}
+ </button>
+ ))}
+ {results.length === 0 ? <div className="palette-empty">No matching bots</div> : null}
+ </div>
+ </div>
+ )
+}
+
+/** What the bot is for; a group lists its members. */
+function subtitle({ bot, store }: { bot: Bot; store: RosterItem['store'] }) {
+ if (!isGroup(bot) || bot.description) return bot.description
+ const names = store.members(bot).map((m) => m.name).join(', ')
+ return names === bot.name ? '' : names
+}
diff --git a/apps/desktop/src/renderer/views/chat-window.css b/apps/desktop/src/renderer/views/chat-window.css
index e32d2af4..507272c7 100644
--- a/apps/desktop/src/renderer/views/chat-window.css
+++ b/apps/desktop/src/renderer/views/chat-window.css
@@ -40,26 +40,6 @@
transition: opacity var(--layout), padding var(--layout);
}
-.search {
- display: flex;
- align-items: center;
- gap: 6px;
- height: 28px;
- margin: 4px 12px 8px;
- padding: 0 9px;
- border-radius: 8px;
- background: var(--bubble-agent);
- font-size: calc(13px * var(--scale));
- flex: none;
-}
-.search input {
- flex: 1;
- min-width: 0;
-}
-.search-clear {
- display: flex;
-}
-
.roster {
flex: 1;
overflow-y: auto;
diff --git a/apps/desktop/src/renderer/views/search-palette.css b/apps/desktop/src/renderer/views/search-palette.css
new file mode 100644
index 00000000..21b94739
--- /dev/null
+++ b/apps/desktop/src/renderer/views/search-palette.css
@@ -0,0 +1,62 @@
+/* Bot search (Grok Bot's): a field over a list, the highlighted row filled. */
+.palette {
+ display: flex;
+ flex-direction: column;
+ max-height: min(560px, calc(100vh - 120px));
+ background: var(--surface);
+}
+.palette-field {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ height: 56px;
+ padding: 0 20px;
+ flex: none;
+ font-size: calc(15px * var(--scale));
+}
+.palette-field input {
+ flex: 1;
+ min-width: 0;
+}
+.palette-list {
+ flex: 1;
+ min-height: 0;
+ overflow-y: auto;
+ padding: 0 8px 8px;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+.palette-row {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ width: 100%;
+ min-height: 56px;
+ padding: 8px 12px;
+ border-radius: 12px;
+ text-align: left;
+ transition: background-color var(--hover);
+}
+.palette-row.active {
+ background: var(--bubble-user);
+}
+.palette-line {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.palette-key {
+ flex: none;
+ font-family: inherit;
+ font-size: calc(12px * var(--scale));
+ padding: 0 6px;
+ height: 22px;
+ border-radius: 6px;
+}
+.palette-empty {
+ padding: 28px 0;
+ text-align: center;
+ color: var(--secondary);
+ font-size: calc(13px * var(--scale));
+}