33import { useState , useCallback , useRef , useEffect , useMemo } from 'react'
44import { Icon } from '@iconify/react'
55import { motion , AnimatePresence } from 'framer-motion'
6- import { AgentBuilder , AgentSummary , BEHAVIOR_DEFS , type AgentBuilderState } from '@/components/agent-builder'
6+ import {
7+ AgentBuilder ,
8+ AgentSummary ,
9+ BEHAVIOR_DEFS ,
10+ type AgentBuilderState ,
11+ } from '@/components/agent-builder'
712import { getAgentConfig , clearAgentConfig , type AgentConfig } from '@/lib/agent-session'
813import { useView } from '@/context/view-context'
914
@@ -21,20 +26,19 @@ function AgentBuilderPreview({ state }: { state: AgentBuilderState | null }) {
2126 }
2227
2328 const tokenEstimate = Math . ceil ( state . systemPrompt . length / 4 )
24- const activeBehaviors = BEHAVIOR_DEFS . filter (
25- ( b ) => state . behaviors [ b . key ] ?? b . defaultValue ,
26- )
27- const inactiveBehaviors = BEHAVIOR_DEFS . filter (
28- ( b ) => ! ( state . behaviors [ b . key ] ?? b . defaultValue ) ,
29- )
29+ const activeBehaviors = BEHAVIOR_DEFS . filter ( ( b ) => state . behaviors [ b . key ] ?? b . defaultValue )
30+ const inactiveBehaviors = BEHAVIOR_DEFS . filter ( ( b ) => ! ( state . behaviors [ b . key ] ?? b . defaultValue ) )
3031
3132 return (
3233 < div className = "flex-1 flex flex-col min-h-0 overflow-y-auto" >
3334 < div className = "p-4 space-y-4" >
3435 { /* Agent identity card */ }
3536 < div className = "rounded-xl border border-[var(--border)] bg-[var(--bg)] p-4" >
3637 < div className = "flex items-center gap-3 mb-3" >
37- < span className = "text-2xl" > { state . presetEmoji } </ span >
38+ < span
39+ className = "w-3.5 h-3.5 rounded-full shrink-0"
40+ style = { { backgroundColor : state . presetColor } }
41+ />
3842 < div className = "min-w-0 flex-1" >
3943 < div className = "text-sm font-semibold text-[var(--text-primary)]" >
4044 { state . presetName }
@@ -81,14 +85,30 @@ function AgentBuilderPreview({ state }: { state: AgentBuilderState | null }) {
8185 </ div >
8286 < div className = "space-y-1 rounded-xl border border-[var(--border)] bg-[var(--bg)] p-3" >
8387 { activeBehaviors . map ( ( b ) => (
84- < div key = { b . key } className = "flex items-center gap-2 px-2 py-1.5 rounded-lg text-[11px]" >
85- < Icon icon = "lucide:check" width = { 10 } height = { 10 } className = "text-[var(--success)] shrink-0" />
88+ < div
89+ key = { b . key }
90+ className = "flex items-center gap-2 px-2 py-1.5 rounded-lg text-[11px]"
91+ >
92+ < Icon
93+ icon = "lucide:check"
94+ width = { 10 }
95+ height = { 10 }
96+ className = "text-[var(--success)] shrink-0"
97+ />
8698 < span className = "text-[var(--text-secondary)]" > { b . label . split ( '(' ) [ 0 ] . trim ( ) } </ span >
8799 </ div >
88100 ) ) }
89101 { inactiveBehaviors . map ( ( b ) => (
90- < div key = { b . key } className = "flex items-center gap-2 px-2 py-1.5 rounded-lg text-[11px] opacity-50" >
91- < Icon icon = "lucide:x" width = { 10 } height = { 10 } className = "text-[var(--text-disabled)] shrink-0" />
102+ < div
103+ key = { b . key }
104+ className = "flex items-center gap-2 px-2 py-1.5 rounded-lg text-[11px] opacity-50"
105+ >
106+ < Icon
107+ icon = "lucide:x"
108+ width = { 10 }
109+ height = { 10 }
110+ className = "text-[var(--text-disabled)] shrink-0"
111+ />
92112 < span className = "text-[var(--text-disabled)]" > { b . label . split ( '(' ) [ 0 ] . trim ( ) } </ span >
93113 </ div >
94114 ) ) }
@@ -124,9 +144,11 @@ function AgentBuilderPreview({ state }: { state: AgentBuilderState | null }) {
124144 : 'bg-[var(--border)]'
125145 } `}
126146 />
127- < span className = { `text-[10px] ${
128- i <= state . step ? 'text-[var(--text-secondary)]' : 'text-[var(--text-disabled)]'
129- } `} >
147+ < span
148+ className = { `text-[10px] ${
149+ i <= state . step ? 'text-[var(--text-secondary)]' : 'text-[var(--text-disabled)]'
150+ } `}
151+ >
130152 { label }
131153 </ span >
132154 { i < 3 && < div className = "w-3 h-px bg-[var(--border)]" /> }
@@ -218,16 +240,19 @@ export function AgentBuilderView() {
218240 }
219241 } , [ isDragging ] )
220242
221- const previewToggle = useMemo ( ( ) => (
222- < button
223- onClick = { ( ) => setPreviewOpen ( ( v ) => ! v ) }
224- className = "flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-medium text-[var(--text-tertiary)] hover:text-[var(--text-secondary)] hover:bg-[var(--bg-subtle)] transition-colors cursor-pointer"
225- title = { previewOpen ? 'Close preview' : 'Open preview' }
226- >
227- < Icon icon = "lucide:eye" width = { 13 } height = { 13 } />
228- Preview
229- </ button >
230- ) , [ previewOpen ] )
243+ const previewToggle = useMemo (
244+ ( ) => (
245+ < button
246+ onClick = { ( ) => setPreviewOpen ( ( v ) => ! v ) }
247+ className = "flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-medium text-[var(--text-tertiary)] hover:text-[var(--text-secondary)] hover:bg-[var(--bg-subtle)] transition-colors cursor-pointer"
248+ title = { previewOpen ? 'Close preview' : 'Open preview' }
249+ >
250+ < Icon icon = "lucide:eye" width = { 13 } height = { 13 } />
251+ Preview
252+ </ button >
253+ ) ,
254+ [ previewOpen ] ,
255+ )
231256
232257 return (
233258 < div ref = { containerRef } className = "flex-1 flex min-h-0 overflow-hidden bg-[var(--sidebar-bg)]" >
@@ -243,7 +268,9 @@ export function AgentBuilderView() {
243268 < Icon icon = "lucide:arrow-left" width = { 16 } height = { 16 } />
244269 </ button >
245270 < div >
246- < h2 className = "text-[15px] font-semibold text-[var(--text-primary)]" > Agent Builder</ h2 >
271+ < h2 className = "text-[15px] font-semibold text-[var(--text-primary)]" >
272+ Agent Builder
273+ </ h2 >
247274 < p className = "text-[11px] text-[var(--text-tertiary)]" >
248275 Configure your AI coding assistant
249276 </ p >
@@ -279,7 +306,11 @@ export function AgentBuilderView() {
279306 onStateChange = { handleBuilderStateChange }
280307 />
281308 ) : config ? (
282- < AgentSummary config = { config } onReconfigure = { handleReconfigure } onReset = { handleReset } />
309+ < AgentSummary
310+ config = { config }
311+ onReconfigure = { handleReconfigure }
312+ onReset = { handleReset }
313+ />
283314 ) : null }
284315 </ div >
285316 </ div >
@@ -298,7 +329,10 @@ export function AgentBuilderView() {
298329 title = "Open preview panel"
299330 >
300331 < Icon icon = "lucide:eye" width = { 18 } height = { 18 } />
301- < span className = "text-[10px] font-medium tracking-wide" style = { { writingMode : 'vertical-rl' } } >
332+ < span
333+ className = "text-[10px] font-medium tracking-wide"
334+ style = { { writingMode : 'vertical-rl' } }
335+ >
302336 Preview
303337 </ span >
304338 </ motion . button >
@@ -336,7 +370,9 @@ export function AgentBuilderView() {
336370 < div className = "shrink-0 flex items-center justify-between px-4 py-3 border-b border-[var(--border)]" >
337371 < div className = "flex items-center gap-2" >
338372 < Icon icon = "lucide:eye" width = { 16 } height = { 16 } className = "text-[var(--brand)]" />
339- < h3 className = "text-[13px] font-semibold text-[var(--text-primary)]" > Live Preview</ h3 >
373+ < h3 className = "text-[13px] font-semibold text-[var(--text-primary)]" >
374+ Live Preview
375+ </ h3 >
340376 </ div >
341377 < div className = "flex items-center gap-1" >
342378 < button
0 commit comments