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

Function Ma_

package/cli.js:1544–1544  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1542- Ran failing tests`;var eX4=y(()=>{y8();E8();l8();ew()});function qP4(q,K){let _=Object.create(null),z=0;for(let Y of q){let $=K(Y,z++);if(_[$]===void 0)_[$]=[];_[$].push(Y)}return _}function FO6(q,K){let _=N8(),z={type:"queue-operation",operation:q,timestamp:new Date().toISOString(),sessionId:_,...K!==void 0&&{content:K}};tI1(z)}function Kq6(){KP4=Object.freeze([...E$]),_P4.emit()}function XV8(){return KP4}function zP4(){return[...E$]}function sI1(){return E$.length}function br6(){return E$.length>0}function jM(q){E$.push({...q,priority:q.priority??"next"}),Kq6(),FO6("enqueue",typeof q.value==="string"?q.value:void 0)}function IO(q){E$.push({...q,priority:q.priority??"later"}),Kq6(),FO6("enqueue",typeof q.value==="string"?q.value:void 0)}function xr6(q){if(E$.length===0)return;let K=-1,_=1/0;for(let Y=0;Y<E$.length;Y++){let $=E$[Y];if(q&&!q($))continue;let A=MV8[$.priority??"next"];if(A<_)K=Y,_=A}if(K===-1)return;let[z]=E$.splice(K,1);return Kq6(),FO6("dequeue"),z}function YV6(q){if(E$.length===0)return;let K=-1,_=1/0;for(let z=0;z<E$.length;z++){let Y=E$[z];if(q&&!q(Y))continue;let $=MV8[Y.priority??"next"];if($<_)K=z,_=$}if(K===-1)return;return E$[K]}function $V6(q){let K=[],_=[];for(let z of E$)if(q(z))K.push(z);else _.push(z);if(K.length===0)return[];E$.length=0,E$.push(..._),Kq6();for(let z of K)FO6("dequeue");return K}function YP4(q){if(q.length===0)return;let K=E$.length;for(let _=E$.length-1;_>=0;_--)if(q.includes(E$[_]))E$.splice(_,1);if(E$.length!==K)Kq6();for(let _ of q)FO6("remove")}function $P4(q){let K=[];for(let _=E$.length-1;_>=0;_--)if(q(E$[_]))K.unshift(E$.splice(_,1)[0]);if(K.length>0){Kq6();for(let _ of K)FO6("remove")}return K}function AP4(){if(E$.length===0)return;E$.length=0,Kq6()}function wa_(q){return!Oa_.has(q)}function UO6(q){return wa_(q.mode)&&!q.isMeta}function OP4(q){if(q.origin?.kind==="channel")return!0;return UO6(q)}function ja_(q){return typeof q==="string"?q:L3(q,`
1543`)}function Ha_(q,K){if(typeof q==="string")return[];let _=[],z=0;for(let Y of q)if(Y.type==="image"&&Y.source.type==="base64")_.push({id:K+z,type:"image",content:Y.source.data,mediaType:Y.source.media_type,filename:`image${z+1}`}),z++;return _}function PV8(q,K){if(E$.length===0)return;let{editable:_=[],nonEditable:z=[]}=qP4([...E$],(j)=>UO6(j)?"editable":"nonEditable");if(_.length===0)return;let Y=_.map((j)=>ja_(j.value)),$=[...Y,q].filter(Boolean).join(`
1544`),A=Y.join(`
1545`).length+1+K,O=[],w=Date.now();for(let j of _){if(j.pastedContents){for(let J of Object.values(j.pastedContents))if(J.type==="image")O.push(J)}let H=Ha_(j.value,w);O.push(...H),w+=H.length}for(let j of _)FO6("popAll",typeof j.value==="string"?j.value:void 0);return E$.length=0,E$.push(...z),Kq6(),{text:$,cursorOffset:A,images:O}}function WV8(q){let K=MV8[q];return E$.filter((_)=>MV8[_.priority??"next"]<=K)}function wP4(q){return typeof q.value==="string"&&q.value.trim().startsWith("/")&&!q.skipSlashCommands}var E$,KP4,_P4,zV6,MV8,Oa_;var p2=y(()=>{v8();i1();_K();E$=[],KP4=Object.freeze([]),_P4=Dz();zV6=_P4.subscribe;MV8={now:0,next:1,later:2};Oa_=new Set(["task-notification"])});function HP4(q){jP4=q}function jU(q,K){jP4?.(q,K)}var jP4=null;function Ma_(){let q=wE(),K=q.getEntriesByType("mark");for(let _ of K)if(_.name.startsWith(ur6))q.clearMarks(_.name)}function qu1(){if(!i7())return;if(!eI1)return;if(Ir6++,Ma_(),wE().mark(`${ur6}turn_start`),DV8)N(`[headlessProfiler] Started turn ${Ir6}`)}function HM(q){if(!i7())return;if(!eI1)return;let K=wE();if(K.mark(`${ur6}${q}`),DV8)N(`[headlessProfiler] Checkpoint: ${q} at ${K.now().toFixed(1)}ms`)}function Ku1(){if(!i7())return;if(!eI1)return;let _=wE().getEntriesByType("mark").filter((H)=>H.name.startsWith(ur6));if(_.length===0)return;let z=new Map;for(let H of _){let J=H.name.slice(ur6.length);z.set(J,H.startTime)}let Y=z.get("turn_start");if(Y===void 0)return;let $={turn_number:Ir6},A=z.get("system_message_yielded");if(A!==void 0&&Ir6===0)$.time_to_system_message_ms=Math.round(A);let O=z.get("query_started");if(O!==void 0)$.time_to_query_start_ms=Math.round(O-Y);let w=z.get("first_chunk");if(w!==void 0)$.time_to_first_response_ms=Math.round(w-Y);let j=z.get("api_request_sent");if(O!==void 0&&j!==void 0)$.query_overhead_ms=Math.round(j-O);if($.checkpoint_count=_.length,process.env.CLAUDE_CODE_ENTRYPOINT)$.entrypoint=process.env.CLAUDE_CODE_ENTRYPOINT;if(JP4)d("tengu_headless_latency",$);if(DV8)N(`[headlessProfiler] Turn ${Ir6} metrics: ${g6($)}`)}var DV8,Ja_=0.05,JP4,eI1,ur6="headless_",Ir6=-1;var mr6=y(()=>{v8();k8();_8();m8();Z98();l8();DV8=i6(process.env.CLAUDE_CODE_PROFILE_STARTUP),JP4=Math.random()<Ja_,eI1=DV8||JP4});var QO6="Sleep",W8O;var pr6=y(()=>{RY();W8O=`Wait for a specified duration. The user can interrupt the sleep at any time.
1546
1547Use this when the user tells you to sleep or rest, when you have nothing to do, or when you're waiting for something.

Callers 1

qu1Function · 0.85

Calls 2

wEFunction · 0.85
startsWithMethod · 0.45

Tested by

no test coverage detected