Skip to content

The agent that grows with you

refactor(desktop): put the bot dialogs' one-offs on the shared primitives

Brooklyn Nicholson99cae5b9f6f6
diff --git a/apps/desktop/src/plugins/hermes-bots/avatar-image.ts b/apps/desktop/src/plugins/hermes-bots/avatar-image.ts
index 3a1f1918124..1e16b035034 100644
--- a/apps/desktop/src/plugins/hermes-bots/avatar-image.ts
+++ b/apps/desktop/src/plugins/hermes-bots/avatar-image.ts
@@ -50,7 +50,7 @@ export function pickImageFromDevice(): Promise<null | string> {
if (file.size > 15_000_000) {
host.notify({
kind: 'error',
- message: getPluginCtx()?.i18n.t('avatar.imageTooLarge') ?? 'Image too large (max 15MB).'
+ message: getPluginCtx()?.i18n?.t('avatar.imageTooLarge') ?? 'Image too large (max 15MB).'
})
return resolve(null)
@@ -100,7 +100,11 @@ export interface GeneratedImage {
success?: boolean
}
-export async function generateAvatarImage(bot: string, title?: string, description?: string): Promise<string | undefined> {
+export async function generateAvatarImage(
+ bot: string,
+ title?: string,
+ description?: string
+): Promise<string | undefined> {
const who = [title || bot, description].filter(Boolean).join(' — ')
const res = await host.request<GeneratedImage>('image.generate', {
diff --git a/apps/desktop/src/plugins/hermes-bots/avatar.tsx b/apps/desktop/src/plugins/hermes-bots/avatar.tsx
index 96b95933757..b8aaae9c8e3 100644
--- a/apps/desktop/src/plugins/hermes-bots/avatar.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/avatar.tsx
@@ -125,7 +125,18 @@ export function defaultShapeFor(name: string): AvatarShape {
// appears inside a segment. Colors come from the library's own name-derived
// palette (contrast-guaranteed) — the classic color swatches don't apply.
-export const BLOB_KINDS = ['round', 'organic', 'boxy', 'capsule', 'nub', 'cloud', 'droplet', 'hexagon', 'sun', 'triangle']
+export const BLOB_KINDS = [
+ 'round',
+ 'organic',
+ 'boxy',
+ 'capsule',
+ 'nub',
+ 'cloud',
+ 'droplet',
+ 'hexagon',
+ 'sun',
+ 'triangle'
+]
// Trait positions at the center of each silhouette band. Band thresholds are
// frozen per blobatar major (gen2: 0.22 / 0.48 / 0.60 / 0.70 / 0.79 / 0.86 /
@@ -343,32 +354,6 @@ function shapeNode(shape: string, color: string, botName = 'agent') {
}
}
-const EYE_Y = {
- // solids: eyes sit on the upper face region, clear of the busiest edges
- tetrahedron: 26,
- cube: 22.5,
- octahedron: 14.5,
- dodecahedron: 20,
- icosahedron: 17.5,
- // legacy
- circle: 17,
- squircle: 17,
- pill: 20,
- triangle: 25,
- hexagon: 17,
- cloud: 22,
- drop: 24
-}
-
-// Solids draw eyes slightly tighter so they read as ON a face.
-const EYE_X = {
- tetrahedron: [16.5, 23.5],
- cube: [15, 25],
- octahedron: [16, 24],
- dodecahedron: [16.5, 23.5],
- icosahedron: [16.5, 23.5]
-}
-
/** One point in the 40x40 face box. */
type FacePoint = [number, number]
@@ -1048,15 +1033,12 @@ export function BotFace({ shape, color, image, size = 36, name = 'agent', mood =
return (
<svg
aria-hidden
+ className="block overflow-visible"
data-bot-face={name}
data-hb-math="1"
data-hb-mood={working ? 'work' : 'idle'}
data-hb-shape={shape || 'circle'}
height={size}
- style={{
- overflow: 'visible',
- display: 'block'
- }}
viewBox="0 0 40 44"
width={size}
>
diff --git a/apps/desktop/src/plugins/hermes-bots/create-dialog.tsx b/apps/desktop/src/plugins/hermes-bots/create-dialog.tsx
index f9cdaef2366..79c339d749b 100644
--- a/apps/desktop/src/plugins/hermes-bots/create-dialog.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/create-dialog.tsx
@@ -44,7 +44,7 @@ import { AvatarPicker } from './avatar-picker'
import { $selectedBot } from './bot-state'
import { createCanonicalChat } from './canonical-chat'
import { $botMeta, botHandle, botRosterKey, filterBots, ROSTER_KEY, saveBotMeta } from './data'
-import { labeled } from './dialog-parts'
+import { labeled, ResizableFrame } from './dialog-parts'
import { GROUP_CHAT_MAX_MEMBERS, mintGroupRoomId, uniqueGroupChatName, updateGroupChat } from './group-chat'
import type { GroupChatRoom } from './group-chat'
import { GroupImageControls } from './group-chat-parts'
@@ -602,7 +602,13 @@ export function CreateAgentDialog({ open, onClose, roster }: CreateAgentDialogPr
</DialogHeader>
<div className="grid gap-3.5">
<div className="flex justify-center py-1">
- <BotFace color={avatarColor(color, slug || 'agent')} image={image} name={slug || 'agent'} shape={shape} size={56} />
+ <BotFace
+ color={avatarColor(color, slug || 'agent')}
+ image={image}
+ name={slug || 'agent'}
+ shape={shape}
+ size={56}
+ />
</div>
<AvatarPicker
color={color}
@@ -804,15 +810,7 @@ export function CreateAgentDialog({ open, onClose, roster }: CreateAgentDialogPr
<GlyphSpinner className="text-(--ui-text-tertiary)" spinner="breathe" />
</div>
) : SkillsView ? (
- <div
- className="overflow-hidden rounded-md border border-(--ui-stroke-secondary)"
- style={{
- height: 440,
- minHeight: 280,
- resize: 'vertical',
- overflow: 'auto'
- }}
- >
+ <ResizableFrame height={440} minHeight={280}>
<SkillsView
embedded
fixedProfile={createdForCaps}
@@ -822,7 +820,7 @@ export function CreateAgentDialog({ open, onClose, roster }: CreateAgentDialogPr
}
: {})}
/>
- </div>
+ </ResizableFrame>
) : (
// The tab list is gated on the same export, so this is only
// reachable via persisted tab state on a build that lacks it
@@ -1054,7 +1052,7 @@ export function GroupDialog({ bot, onClose }: GroupDialogProps) {
<DialogContent className="max-w-sm">
<DialogHeader>
<DialogTitle>{b.group.manageTitle}</DialogTitle>
- <DialogDescription>{b.group.newDesc}</DialogDescription>
+ <DialogDescription>{b.group.manageDesc}</DialogDescription>
</DialogHeader>
{groups.length ? (
<div className="grid gap-1.5">
diff --git a/apps/desktop/src/plugins/hermes-bots/cron.tsx b/apps/desktop/src/plugins/hermes-bots/cron.tsx
index 0802c99bc26..f72f9225a46 100644
--- a/apps/desktop/src/plugins/hermes-bots/cron.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/cron.tsx
@@ -7,6 +7,7 @@
import {
atom,
Button,
+ Checkbox,
cn,
Codicon,
Dialog,
@@ -1092,12 +1093,7 @@ export function CreateRoutineDialog({ bot, open, onClose }: CreateRoutineDialogP
])
)}
<label className="flex items-center gap-2 text-xs text-(--ui-text-tertiary) cursor-pointer select-none">
- <input
- checked={continuity}
- className="accent-(--ui-accent)"
- onChange={event => setContinuity(event.target.checked)}
- type="checkbox"
- />
+ <Checkbox checked={continuity} onCheckedChange={value => setContinuity(Boolean(value))} />
Continuity: each run sees the previous run’s output (dedupe, continue where it left off)
</label>
{error ? (
diff --git a/apps/desktop/src/plugins/hermes-bots/dialog-parts.tsx b/apps/desktop/src/plugins/hermes-bots/dialog-parts.tsx
index 2bfc5815f3d..5c0655bdd2c 100644
--- a/apps/desktop/src/plugins/hermes-bots/dialog-parts.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/dialog-parts.tsx
@@ -1,7 +1,8 @@
/**
- * The one presentation leaf every Bot Mode dialog shares: a labelled control.
+ * The presentation leaves every Bot Mode dialog shares: a labelled control, and
+ * the frame the embedded Capabilities surface is rendered into.
*
- * It sits below the dialogs rather than inside any one of them — the model
+ * They sit below the dialogs rather than inside any one of them — the model
* picker, the advanced editor, Edit Profile, New Bot and the routines dialogs
* all render the same label-over-control pair, and none of them can own it
* without the others importing a sibling surface.
@@ -17,3 +18,26 @@ export function labeled(label: ReactNode, control: ReactNode) {
</div>
)
}
+
+interface ResizableFrameProps {
+ children: ReactNode
+ /** CSS `resize` has nothing to drag from without a concrete height, and the
+ * two surfaces that embed Capabilities budget it different room. */
+ height: number
+ minHeight: number
+}
+
+/** A fixed-height viewport with the native vertical resize handle. */
+export function ResizableFrame({ children, height, minHeight }: ResizableFrameProps) {
+ return (
+ <div
+ className="resize-y overflow-auto rounded-md border border-(--ui-stroke-secondary)"
+ style={{
+ height,
+ minHeight
+ }}
+ >
+ {children}
+ </div>
+ )
+}
diff --git a/apps/desktop/src/plugins/hermes-bots/model-picker.tsx b/apps/desktop/src/plugins/hermes-bots/model-picker.tsx
index 5004ecec763..b9645b81c1a 100644
--- a/apps/desktop/src/plugins/hermes-bots/model-picker.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/model-picker.tsx
@@ -169,13 +169,7 @@ export function ModelPicker({ bot = null, value, onChange, placeholderModel = 'g
if (useFreeText) {
return (
- <div
- style={{
- display: 'flex',
- flexDirection: 'column',
- gap: '8px'
- }}
- >
+ <div className="flex flex-col gap-2">
<div className="grid grid-cols-2 gap-2.5">
{labeled(
'Provider (Custom)',
diff --git a/apps/desktop/src/plugins/hermes-bots/profile-config.tsx b/apps/desktop/src/plugins/hermes-bots/profile-config.tsx
index a794cc573e8..eee01eccd5b 100644
--- a/apps/desktop/src/plugins/hermes-bots/profile-config.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/profile-config.tsx
@@ -21,7 +21,7 @@ import {
import { useState } from 'react'
import { $lastRoster, ROSTER_KEY } from './data'
-import { labeled } from './dialog-parts'
+import { labeled, ResizableFrame } from './dialog-parts'
import { useBots } from './i18n'
import { McpSetupButton } from './mcp-setup'
import { ModelPicker } from './model-picker'
@@ -247,7 +247,6 @@ export function AdvancedProfileConfig({ bot, state, setState }: AdvancedProfileC
const enabledSkills = state.skills.filter(s => s.enabled).length
const enabledToolsets = state.toolsets.filter(t => t.enabled).length
const mcpList = state.mcp || []
- const enabledMcp = mcpList.filter(m => m.enabled).length
// Newer desktop builds export the WHOLE core Capabilities surface
// (hermes-agent#87317): Skills (installed list + one-click hub installs +
@@ -275,15 +274,7 @@ export function AdvancedProfileConfig({ bot, state, setState }: AdvancedProfileC
/>
{labeled(
'Capabilities (applies immediately — skills, tools, MCP)',
- <div
- className="overflow-hidden rounded-md border border-(--ui-stroke-secondary)"
- style={{
- height: 460,
- minHeight: 300,
- resize: 'vertical',
- overflow: 'auto'
- }}
- >
+ <ResizableFrame height={460} minHeight={300}>
<SkillsView
embedded
fixedProfile={backendProfile}
@@ -293,7 +284,7 @@ export function AdvancedProfileConfig({ bot, state, setState }: AdvancedProfileC
}
: {})}
/>
- </div>
+ </ResizableFrame>
)}
{labeled(
'SOUL.md (persona + agent-messaging protocol)',
diff --git a/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx b/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx
index 5ad8cb1ecd9..a6819599715 100644
--- a/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/skills-hub.tsx
@@ -173,17 +173,12 @@ export function HubSkillsSection({ forProfile, onInstalled }: HubSkillsSectionPr
/* so the hub page starts zoomed out — we can't style the */
/* cross-origin page itself, but scaling the frame is ours. */}
<div
+ className="relative w-full max-w-full resize overflow-hidden border border-(--ui-stroke-secondary)"
style={{
- width: '100%',
height: 560,
minHeight: 240,
minWidth: 320,
- maxWidth: '100%',
- resize: 'both',
- overflow: 'hidden',
- border: '1px solid var(--ui-stroke-secondary)',
- borderRadius: 8,
- position: 'relative'
+ borderRadius: 8
}}
>
<iframe