§
    ÚŽ’j¡  ã                   ó¢   — d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 dd	l
mZmZ dd
lmZ ddlmZmZ  G d„ de¦  «        Z G d„ de¦  «        ZdS )zThe creating task tool class.é    )ÚAny)Ú	BaseModelÚFieldé   )Ú_TaskToolBaseé   )Ú	ToolChunké   )Ú
AgentStateÚTask)ÚDeveloperOrientedException)Ú	TextBlockÚToolResultStatec                   ó’   — e Zd ZU dZ ed¬¦  «        Zeed<    ed¬¦  «        Zeed<    edd¬	¦  «        Z	e
eef         dz  ed
<   dS )Ú_TaskCreateParamsz%The params of the creating task tool.zA brief title for the task)ÚdescriptionÚsubjectzWhat needs to be doner   Nz(Arbitrary metadata to attach to the task)Údefaultr   Úmetadata)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚstrÚ__annotations__r   r   Údictr   © ó    úPC:\Projects\DSCons\.venv\Lib\site-packages\agentscope\tool\_task\_create_task.pyr   r      s’   € € € € € € Ø/Ð/à�5Ð%AÐBÑBÔB€GˆSÐBÐBÑBØ�uÐ)@ÐAÑAÔA€K�ÐAÐAÑAØ&+ eØØ>ð'ñ 'ô '€Hˆd�3˜�8Œn˜tÑ#ð ð ñ ð ð r   r   c                   ó˜   — e Zd ZU dZd Zeed<   dZeed<   e 	                    ¦   «         Z
eed<   	 ddededed	eeef         dz  d
ef
d„ZdS )Ú
TaskCreatez'Create a task for the agent to perform.Únamea¤  Use this tool to create a structured task list for your current session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
It also helps the user understand the progress of the task and overall progress of their requests.

## When to Use This Tool
Use this tool proactively in these scenarios:

- Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
- Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
- Plan mode - When using plan mode, create a task list to track the work
- User explicitly requests todo list - When the user directly asks you to use the todo list
- User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
- After receiving new instructions - Immediately capture user requirements as tasks
- When you start working on a task - Mark it as in_progress BEFORE beginning work
- After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation

## When NOT to Use This Tool

Skip using this tool when:
- There is only **one single, straightforward** task
- The task is trivial and tracking it provides no organizational benefit
- The task can be completed in less than 3 trivial steps
- The task is purely conversational or informational

NOTE that you should **NOT** use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.

## Task Fields

- **subject**: A brief, actionable title in imperative form (e.g., "Fix authentication bug in login flow")
- **description**: What needs to be done

All tasks are created with status `pending`.

## Tips

- Create tasks with clear, specific subjects that describe the outcome
- After creating tasks, use TaskUpdate to set up dependencies (blocks/blockedBy) if needed
- Check TaskList first to avoid creating duplicate tasksr   Úinput_schemaNÚ_agent_stater   r   Úreturnc              ƒ   óV  K  — t          |t          ¦  «        st          d|› d�¦  «        ‚	 d}|j        j        D ]<}	 t          |t          |j        ¦  «        ¦  «        }Œ&# t          t          f$ r Y Œ9w xY wt          |dz   ¦  «        }t          ||||pi ¬¦  «        }|j        j                             |¦  «         t          t          d|› d|j        › �¬¦  «        g¬	¦  «        S # t           $ r7}	t          t          d
|	› �¬¦  «        gt"          j        ¬¦  «        cY d}	~	S d}	~	ww xY w)z3Create the subtask and add it into the agent state.z:Error: TaskCreate requires AgentState to be provided, got z	 instead.r   r   )Úidr   r   r   z	Task (id=z) created successfully: )Útext)ÚcontentzCreateTaskError: )r)   ÚstateN)Ú
isinstancer   r   Útasks_contextÚtasksÚmaxÚintr'   Ú
ValueErrorÚ	TypeErrorr   r   Úappendr	   r   r   Ú	Exceptionr   ÚERROR)
Úselfr$   r   r   r   Úmax_numericÚtÚnext_idÚtaskÚes
             r   ÚcallzTaskCreate.callS   s»  è è € õ ˜,­
Ñ3Ô3ð 	å,ð+Øð+ð +ð +ñô ð ð
"	ð ˆKØ!Ô/Ô5ð ð �ðÝ"% kµ3°q´t±9´9Ñ"=Ô"=�K�KøÝ"¥IÐ.ð ð ð Ø�Dðøøøå˜+¨™/Ñ*Ô*ˆGåØØØ'Ø!˜ Rð	ñ ô ˆDð Ô&Ô,×3Ò3°DÑ9Ô9Ð9ååð*¨ð *ð *Øœ<ð*ð *ðñ ô ððñ ô ð øõ ð 	ð 	ð 	ÝåÐ#:°qÐ#:Ð#:Ð;Ñ;Ô;ðõ &Ô+ð	ñ ô ð ð ð ð ð ð øøøøð	øøøsA   ¬C' ½"A ÁC' Á A4Á1C' Á3A4Á4A2C' Ã'
D(Ã1,D#ÄD(Ä#D()N)r   r   r   r   r"   r   r   r   r   Úmodel_json_schemar#   r   r   r   r	   r;   r   r   r   r!   r!      s¾   € € € € € € Ø1Ð1à€Dˆ#ÐÐÑð1<€K�ð 1<ð 1<ñ 1<ðf +×<Ò<Ñ>Ô>€L�$Ð>Ð>Ñ>ð +/ð1ð 1à ð1ð ð1ð ð	1ð
 �s˜C�x”. 4Ñ'ð1ð 
ð1ð 1ð 1ð 1ð 1ð 1r   r!   N)r   Útypingr   Úpydanticr   r   Ú_task_tool_baser   Ú	_responser	   r*   r   r   Ú	exceptionr   Úmessager   r   r   r!   r   r   r   ú<module>rC      s  ðà #Ð #Ø Ð Ð Ð Ð Ð à %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à *Ð *Ð *Ð *Ð *Ð *Ø !Ð !Ð !Ð !Ð !Ð !Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1ðð ð ð ð ˜	ñ ô ð ðkð kð kð kð k�ñ kô kð kð kð kr   