
    9oi(                        d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl	m
Z
 ddlmZmZmZmZ ddlmZmZ dddZddZedk    r e             dS dS )z&CLI tool to run a multi-agent meeting.    )annotationsN)Path)load_agents)create_client)run_meetingrun_meeting_interactivesave_reportsave_transcript)list_scenariosload_scenarioargvlist[str] | Nonereturnargparse.Namespacec                   t          j        d          }|                    ddd           |                                }|                    ddd           |                    d	dd
           |                    dddd           |                    dddd           |                    dddd           |                    dt          dd           |                    ddd           |                    ddd           |                    ddd           |                    dd d!           |                    d"t          d#d$           |                    d%ddd&           |                    |           S )'a*  Parse command-line arguments.

    Args:
        argv: Argument list to parse; defaults to sys.argv when None.

    Returns:
        Parsed argparse.Namespace with topic, agents, max_rounds,
        agents_dir, output_dir, context, scenario, auto_select,
        and list_scenarios attributes.
    z+Run a multi-agent meeting on a given topic.)descriptionz--topicNz%The discussion topic for the meeting.)defaulthelpz--agentsz3Comma-separated list of agent names to participate.z
--scenarioz<Use a preset scenario (e.g., product_review, startup_pitch).z--auto-select
store_trueFz6Let PM automatically select agents based on the topic.)actionr   r   z--list-scenariosz&List all available scenarios and exit.z--interactivez*Enable human-in-the-loop interactive mode.z--max-roundsz2Maximum number of discussion rounds (default: 10).)typer   r   z	--context z-Inline background context for the discussion.z--context-filez-Path to a file containing background context.z--agents-diragentsz;Directory containing agent config files (default: agents/).z--output-dirreportsz9Directory to save the meeting report (default: reports/).z--context-budgetip  z8Token budget for whiteboard compression (default: 6000).z--no-compactz7Disable context compression (debug mode, old behavior).)argparseArgumentParseradd_argumentadd_mutually_exclusive_groupint
parse_args)r   parseragent_groups      2/root/projects/multi-agents-meeting/run_meeting.pyr    r       s_    $A  F 4     5577KB    
 K    
 E	     5	     9	     A	     <    
 <    
 J    
 H    
 G	     F	     T"""    Nonec            	        t                      } | j        rt                      }t          ddddddd            t          d           |                                D ]=\  }}d                    |j                  }t          |dd|j        dd|            >d	S | j        s/t          d
t          j	                   t          j
        d           t          | j                  }t          | j                  }g }| j        r|                    | j                   | j        r=t          | j                  }|                    |                    d                     d                    |          }	| j        }
d	}| j        r&t)          | j                  }|j        }|
|j        }
n5| j        rddlm} t3          |                    d                    t3          |                    d                    z   t3          |                    d                    z   }d |D             }t7          ||          }t9                      } || j        |	||          }t          dd                    |                      n[| j        r%d | j                            d          D             }n/t          dt          j	                   t          j
        d           	 t7          ||          }nI# t<          $ r<}t          d| t          j	                   t          j
        d           Y d	}~nd	}~ww xY w|
d}
|t9                      }d	}| j        sddl m!}  || j"                  }| j#        rtI          | j        |	|||
||           }ntK          | j        |||
||	|!          }tM          |j'        | j        |"          }tQ          ||#          }t          d$|            t          d%|            d	S )&z CLI entry point for run_meeting.Namez<22 Descriptionz<40AgentszZ------------------------------------------------------------------------------------------z, NzError: --topic is required.)file   zutf-8)encodingz

r   )auto_select_agentsz*.jsonz*.yamlz*.ymlc                P    g | ]#}|j                             d           |j         $S )example_)stem
startswith).0fs     r#   
<listcomp>zmain.<locals>.<listcomp>   s0    ```a!&BSBST^B_B_`16```r$   )
agents_dir)topiccontext
all_agentsclientzAuto-selected agents: c                6    g | ]}|                                 S  )strip)r3   names     r#   r5   zmain.<locals>.<listcomp>   s     GGGtzz||GGGr$   ,zBError: Must provide one of --agents, --scenario, or --auto-select.zError: 
   )ContextManager)budget_tokens)r7   r8   agent_configsr:   
max_rounds
output_dircontext_manager)r7   rC   r:   rD   rE   r8   rF   )r7   rE   )rE   z
Report saved to: zTranscript saved to: ))r    r   printitemsjoinr   r   r7   sysstderrexitr   r6   rE   r8   appendcontext_file	read_textrD   scenarior   suggested_max_roundsauto_selectsrc.agent_selectorr.   listglobr   r   splitFileNotFoundError
no_compactsrc.context_managerrA   context_budgetinteractiver   r   r	   final_reportr
   )args	scenariosr>   rP   
agents_strr6   rE   context_partscontext_file_pathr8   rD   r:   agent_namesr.   all_agent_filesall_agent_namesall_configsrC   excrF   rA   resultreport_pathtranscript_paths                           r#   mainrj   l   s   <<D  "$$	<<<m<<<(<<===h'oo// 	I 	IND(8?33JTGGG 4GGG:GGHHHH : +#*====do&&Jdo&&J  "M| +T\*** L !233.88'8JJKKKkk-((GJ F}  //o!6J		 999999 zx8899DQYAZAZ<[<[[^bcmcrcrszc{c{^|^||``?```!/jIII((*"	
 
 
 	?tyy'='=??@@@@	 GG0A0A#0F0FGGGP	
 	
 	
 	
 	#KJGGG   oooCJ////
 
~ O? L666666(.t7JKKK 
(*'!!+
 
 
 *'!!+
 
 
 f1PZ[[[K%fDDDO	
-
-
-...	
3/
3
344444s   &K8 8
L>2L99L>__main__)N)r   r   r   r   )r   r%   )__doc__
__future__r   r   rJ   pathlibr   src.config_loaderr   src.llm_clientr   src.meetingr   r   r	   r
   src.scenariosr   r   r    rj   __name__r<   r$   r#   <module>rt      s    , , " " " " " "  



       ) ) ) ) ) ) ( ( ( ( ( ( Z Z Z Z Z Z Z Z Z Z Z Z 7 7 7 7 7 7 7 7Y# Y# Y# Y# Y#xk5 k5 k5 k5\ zDFFFFF r$   