MCPcopy Index your code
hub / github.com/ChinaSiro/claude-code-sourcemap / rYY

Function rYY

package/cli.js:4821–4882  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

4819`).trim()||null;return null}function iw6(q){if(q.type!=="user")return null;let K=q.message.content;return EQ(K)}function w77(q){let K=iw6(q);if(K===null)return null;let _=o4(K,"bash-input");if(_)return{text:_,mode:"bash"};let z=o4(K,CZ);if(z){let Y=o4(K,P$8)??"";return{text:`${z} ${Y}`,mode:"prompt"}}return{text:WL7(K),mode:"prompt"}}function L3(q,K=""){return q.filter((_)=>_.type==="text").map((_)=>_.text).join(K)}function EQ(q){if(typeof q==="string")return q;if(Array.isArray(q))return L3(q,`
4820`).trim()||null;return null}function fh6(q,K,_,z,Y,$,A,O,w){if(q.type!=="stream_event"&&q.type!=="stream_request_start"){if(q.type==="tombstone"){$?.(q.message);return}if(q.type==="tool_use_summary")return;if(q.type==="assistant"){let j=q.message.content.find((H)=>H.type==="thinking");if(j&&j.type==="thinking")A?.(()=>({thinking:j.thinking,isStreaming:!1,streamingEndedAt:Date.now()}))}w?.(()=>null),K(q);return}if(q.type==="stream_request_start"){z("requesting");return}if(q.event.type==="message_start"){if(q.ttftMs!=null)O?.({ttftMs:q.ttftMs})}if(q.event.type==="message_stop"){z("tool-use"),Y(()=>[]);return}switch(q.event.type){case"content_block_start":switch(w?.(()=>null),q.event.content_block.type){case"thinking":case"redacted_thinking":z("thinking");return;case"text":z("responding");return;case"tool_use":{z("tool-input");let j=q.event.content_block,H=q.event.index;Y((J)=>[...J,{index:H,contentBlock:j,unparsedToolInput:""}]);return}case"server_tool_use":case"web_search_tool_result":case"code_execution_tool_result":case"mcp_tool_use":case"mcp_tool_result":case"container_upload":case"web_fetch_tool_result":case"bash_code_execution_tool_result":case"text_editor_code_execution_tool_result":case"tool_search_tool_result":case"compaction":z("tool-input");return}return;case"content_block_delta":switch(q.event.delta.type){case"text_delta":{let j=q.event.delta.text;_(j),w?.((H)=>(H??"")+j);return}case"input_json_delta":{let j=q.event.delta.partial_json,H=q.event.index;_(j),Y((J)=>{let M=J.find((X)=>X.index===H);if(!M)return J;return[...J.filter((X)=>X!==M),{...M,unparsedToolInput:M.unparsedToolInput+j}]});return}case"thinking_delta":_(q.event.delta.thinking);return;case"signature_delta":return;default:return}case"content_block_stop":return;case"message_delta":z("responding");return;default:z("responding");return}}function KT(q){return`<system-reminder>
4821${q}
4822</system-reminder>`}function V9(q){return q.map((K)=>{if(typeof K.message.content==="string")return{...K,message:{...K.message,content:KT(K.message.content)}};else if(Array.isArray(K.message.content)){let _=K.message.content.map((z)=>{if(z.type==="text")return{...z,text:KT(z.text)};return z});return{...K,message:{...K.message,content:_}}}return K})}function dYY(q){if(q.isSubAgent)return tYY(q);if(q.reminderType==="sparse")return sYY(q);return rYY(q)}function iYY(){let q=ym8();switch(q){case"trim":return cYY;case"cut":return lYY;case"cap":return nYY;case null:return C0K;default:return C0K}}function rYY(q){if(q.isSubAgent)return[];if(l2())return aYY(q);let K=SHK(),_=CHK(),Y=`Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits (with the exception of the plan file mentioned below), run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received.
4823
4824## Plan File Info:
4825${q.planExists?`A plan file already exists at ${q.planFilePath}. You can read it and make incremental edits using the ${UX.name} tool.`:`No plan file exists yet. You should create your plan at ${q.planFilePath} using the ${QX.name} tool.`}
4826You should build your plan incrementally by writing to or editing this file. NOTE that this is the only file you are allowed to edit - other than this you are only allowed to take READ-ONLY actions.
4827
4828## Plan Workflow
4829
4830### Phase 1: Initial Understanding
4831Goal: Gain a comprehensive understanding of the user's request by reading through code and asking them questions. Critical: In this phase you should only use the ${cF.agentType} subagent type.
4832
48331. Focus on understanding the user's request and the code associated with their request. Actively search for existing functions, utilities, and patterns that can be reused — avoid proposing new code when suitable implementations already exist.
4834
48352. **Launch up to ${_} ${cF.agentType} agents IN PARALLEL** (single message, multiple tool calls) to efficiently explore the codebase.
4836 - Use 1 agent when the task is isolated to known files, the user provided specific file paths, or you're making a small targeted change.
4837 - Use multiple agents when: the scope is uncertain, multiple areas of the codebase are involved, or you need to understand existing patterns before planning.
4838 - Quality over quantity - ${_} agents maximum, but you should try to use the minimum number of agents necessary (usually just 1)
4839 - If using multiple agents: Provide each agent with a specific search focus or area to explore. Example: One agent searches for existing implementations, another explores related components, a third investigating testing patterns
4840
4841### Phase 2: Design
4842Goal: Design an implementation approach.
4843
4844Launch ${Mk8.agentType} agent(s) to design the implementation based on the user's intent and your exploration results from Phase 1.
4845
4846You can launch up to ${K} agent(s) in parallel.
4847
4848**Guidelines:**
4849- **Default**: Launch at least 1 Plan agent for most tasks - it helps validate your understanding and consider alternatives
4850- **Skip agents**: Only for truly trivial tasks (typo fixes, single-line changes, simple renames)
4851${K>1?`- **Multiple agents**: Use up to ${K} agents for complex tasks that benefit from different perspectives
4852
4853Examples of when to use multiple agents:
4854- The task touches multiple parts of the codebase
4855- It's a large refactor or architectural change
4856- There are many edge cases to consider
4857- You'd benefit from exploring different approaches
4858
4859Example perspectives by task type:
4860- New feature: simplicity vs performance vs maintainability
4861- Bug fix: root cause vs workaround vs prevention
4862- Refactoring: minimal change vs clean architecture
4863`:""}
4864In the agent prompt:
4865- Provide comprehensive background context from Phase 1 exploration including filenames and code path traces
4866- Describe requirements and constraints
4867- Request a detailed implementation plan
4868
4869### Phase 3: Review
4870Goal: Review the plan(s) from Phase 2 and ensure alignment with the user's intentions.
48711. Read the critical files identified by agents to deepen your understanding
48722. Ensure that the plans align with the user's original request
48733. Use ${a$} to clarify any remaining questions with the user
4874
4875${iYY()}
4876
4877### Phase 5: Call ${pD.name}
4878At the very end of your turn, once you have asked the user questions and are happy with your final plan file - you should always call ${pD.name} to indicate to the user that you are done planning.

Callers 1

dYYFunction · 0.85

Calls 7

l2Function · 0.85
aYYFunction · 0.85
SHKFunction · 0.85
CHKFunction · 0.85
iYYFunction · 0.85
V9Function · 0.85
U8Function · 0.85

Tested by

no test coverage detected