@@ -17,6 +17,7 @@ import {
1717} from 'tldraw'
1818import { F } from '../tla/utils/i18n'
1919import { FairyAgent } from './fairy-agent/agent/FairyAgent'
20+ import { $fairyDebugFlags } from './FairyDebugFlags'
2021import { $fairyProjects , addAgentToDummyProject } from './FairyProjects'
2122import { $fairyTasks } from './FairyTaskList'
2223
@@ -100,12 +101,11 @@ export function FairyDebugDialog({ agents, onClose }: { agents: FairyAgent[]; on
100101 } ) }
101102 </ div >
102103
103- { /* Debug Flags: always visible when viewing an agent */ }
104- { ! isHomeTab && selectedAgent && (
105- < div className = "fairy-debug-flags-section" >
106- < FlagsInspector agent = { selectedAgent } />
107- </ div >
108- ) }
104+ { /* Fairy Debug Options: always visible when viewing an agent */ }
105+ { ! isHomeTab && selectedAgent && < FairyDebugOptions agent = { selectedAgent } /> }
106+
107+ { /* Home debug options: always visible when viewing the home tab */ }
108+ { isHomeTab && < HomeDebugOptions /> }
109109
110110 { /* View Dropdown: choose between different inspectable views for the given tab */ }
111111 < div className = "fairy-debug-view-dropdown" >
@@ -203,17 +203,10 @@ function HomeDebugView({
203203 homeDebugInspectorType : HomeDebugInspectorType
204204} ) {
205205 return (
206- < >
207- < TldrawUiButton type = "low" onClick = { logPartDefinitionsByPriority } >
208- < TldrawUiButtonLabel >
209- < F defaultMessage = "Log Part Definitions by Priority" />
210- </ TldrawUiButtonLabel >
211- </ TldrawUiButton >
212- < div className = "fairy-debug-view-container" >
213- { homeDebugInspectorType === 'projects' && < ProjectsInspector /> }
214- { homeDebugInspectorType === 'sharedTodoList' && < SharedTodoListInspector /> }
215- </ div >
216- </ >
206+ < div className = "fairy-debug-view-container" >
207+ { homeDebugInspectorType === 'projects' && < ProjectsInspector /> }
208+ { homeDebugInspectorType === 'sharedTodoList' && < SharedTodoListInspector /> }
209+ </ div >
217210 )
218211}
219212
@@ -241,6 +234,7 @@ function ProjectsInspector() {
241234 < div className = "fairy-debug-project-details" >
242235 < KeyValuePair label = "id" value = { project . id } />
243236 < KeyValuePair label = "description" value = { project . description } />
237+ < KeyValuePair label = "plan" value = { project . plan } />
244238 < KeyValuePair
245239 label = "orchestrator"
246240 value = { project . members . find ( ( member ) => member . role === 'orchestrator' ) ?. id }
@@ -301,55 +295,101 @@ function SharedTodoListInspector() {
301295 )
302296}
303297
304- function FlagsInspector ( { agent } : { agent : FairyAgent } ) {
305- const debugFlags = useValue ( agent . $debugFlags )
298+ function HomeDebugOptions ( ) {
299+ const debugFlags = useValue ( $fairyDebugFlags )
306300
307301 return (
308- < div className = "fairy-debug-flags-container" >
309- < p >
310- < F defaultMessage = "Debug Flags" />
311- </ p >
312- < div className = "fairy-debug-flags-checkboxes" >
313- < label className = "fairy-debug-flags-checkbox" >
314- < input
315- type = "checkbox"
316- checked = { debugFlags . logSystemPrompt }
317- onChange = { ( e ) => {
318- agent . $debugFlags . set ( {
319- ...debugFlags ,
320- logSystemPrompt : e . target . checked ,
321- } )
322- } }
323- />
324- < span >
325- < F defaultMessage = "Log System Prompt" />
326- </ span >
327- </ label >
328- < label className = "fairy-debug-flags-checkbox" >
329- < input
330- type = "checkbox"
331- checked = { debugFlags . logMessages }
332- onChange = { ( e ) => {
333- agent . $debugFlags . set ( {
334- ...debugFlags ,
335- logMessages : e . target . checked ,
336- } )
337- } }
338- />
339- < span >
340- < F defaultMessage = "Log Messages" />
341- </ span >
342- </ label >
302+ < div className = "home-debug-options-container" >
303+ < div className = "fairy-debug-flags-container" >
304+ < p >
305+ < F defaultMessage = "Debug Flags" />
306+ </ p >
307+ < div className = "fairy-debug-flags-checkboxes" >
308+ < label className = "fairy-debug-flags-checkbox" >
309+ < input
310+ type = "checkbox"
311+ checked = { debugFlags . showTaskBounds }
312+ onChange = { ( e ) => {
313+ $fairyDebugFlags . set ( {
314+ ...debugFlags ,
315+ showTaskBounds : e . target . checked ,
316+ } )
317+ } }
318+ />
319+ < span >
320+ < F defaultMessage = "Show Task Bounds" />
321+ </ span >
322+ </ label >
323+ </ div >
343324 </ div >
344- < TldrawUiButton type = "low" onClick = { ( ) => addAgentToDummyProject ( agent . id ) } >
325+ < TldrawUiButton type = "low" onClick = { logPartDefinitionsByPriority } >
345326 < TldrawUiButtonLabel >
346- < F defaultMessage = "Add to Dummy Project " />
327+ < F defaultMessage = "Log Part Definitions by Priority " />
347328 </ TldrawUiButtonLabel >
348329 </ TldrawUiButton >
349330 </ div >
350331 )
351332}
352333
334+ function FairyDebugOptions ( { agent } : { agent : FairyAgent } ) {
335+ const debugFlags = useValue ( agent . $debugFlags )
336+
337+ return (
338+ < div className = "fairy-debug-options-container" >
339+ < div className = "fairy-debug-flags-container" >
340+ < p >
341+ < F defaultMessage = "Debug Flags" />
342+ </ p >
343+ < div className = "fairy-debug-flags-checkboxes" >
344+ < label className = "fairy-debug-flags-checkbox" >
345+ < input
346+ type = "checkbox"
347+ checked = { debugFlags . logSystemPrompt }
348+ onChange = { ( e ) => {
349+ agent . $debugFlags . set ( {
350+ ...debugFlags ,
351+ logSystemPrompt : e . target . checked ,
352+ } )
353+ } }
354+ />
355+ < span >
356+ < F defaultMessage = "Log System Prompt" />
357+ </ span >
358+ </ label >
359+ < label className = "fairy-debug-flags-checkbox" >
360+ < input
361+ type = "checkbox"
362+ checked = { debugFlags . logMessages }
363+ onChange = { ( e ) => {
364+ agent . $debugFlags . set ( {
365+ ...debugFlags ,
366+ logMessages : e . target . checked ,
367+ } )
368+ } }
369+ />
370+ < span >
371+ < F defaultMessage = "Log Messages" />
372+ </ span >
373+ </ label >
374+ </ div >
375+ </ div >
376+
377+ < div className = "fairy-debug-options-buttons" >
378+ < TldrawUiButton type = "low" onClick = { ( ) => addAgentToDummyProject ( agent . id ) } >
379+ < TldrawUiButtonLabel >
380+ < F defaultMessage = "Add to Dummy Project" />
381+ </ TldrawUiButtonLabel >
382+ </ TldrawUiButton >
383+ < TldrawUiButton type = "low" onClick = { ( ) => ( ( window as any ) . agent = agent ) } >
384+ < TldrawUiButtonLabel >
385+ < F defaultMessage = "Set window.agent" />
386+ </ TldrawUiButtonLabel >
387+ </ TldrawUiButton >
388+ </ div >
389+ </ div >
390+ )
391+ }
392+
353393// # Fairy Debug View
354394
355395function FairyDebugView ( {
0 commit comments