MCPcopy Create free account
hub / github.com/ChinaSiro/claude-code-sourcemap / fsz

Function fsz

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

Source from the content-addressed store, hash-verified

3047`),numLines:p.length,...B!==void 0&&{appliedLimit:B},...M>0&&{appliedOffset:M}}}}if(Y==="count"){let{items:I,appliedLimit:B}=ms1(T,J,M),p=I.map((U)=>{let c=U.lastIndexOf(":");if(c>0){let K6=U.substring(0,c),t=U.substring(c);return dW6(K6)+t}return U}),C=0,g=0;for(let U of p){let c=U.lastIndexOf(":");if(c>0){let K6=U.substring(c+1),t=parseInt(K6,10);if(!isNaN(t))C+=t,g+=1}}return{data:{mode:"count",numFiles:g,filenames:[],content:p.join(`
3048`),numMatches:C,...B!==void 0&&{appliedLimit:B},...M>0&&{appliedOffset:M}}}}let v=await Promise.allSettled(T.map((I)=>X8().stat(I))),V=T.map((I,B)=>{let p=v[B];return[I,p.status==="fulfilled"?p.value.mtimeMs??0:0]}).sort((I,B)=>{let p=B[1]-I[1];if(p===0)return I[0].localeCompare(B[0]);return p}).map((I)=>I[0]),{items:E,appliedLimit:S}=ms1(V,J,M),R=E.map(dW6);return{data:{mode:"files_with_matches",filenames:R,numFiles:R.length,...S!==void 0&&{appliedLimit:S},...M>0&&{appliedOffset:M}}}}})});function MAK(){return"Search"}function XAK({pattern:q,path:K},{verbose:_}){if(!q)return null;if(!K)return`pattern: "${q}"`;return`pattern: "${q}", path: "${_?K:_3(K)}"`}function PAK(q,{verbose:K}){if(!K&&typeof q==="string"&&o4(q,"tool_use_error")){if(o4(q,"tool_use_error")?.includes(uZ))return sL6.default.createElement(s8,null,sL6.default.createElement(k,{color:"error"},"File not found"));return sL6.default.createElement(s8,null,sL6.default.createElement(k,{color:"error"},"Error searching files"))}return sL6.default.createElement(Y2,{result:q,verbose:K})}function Bs1(q){if(!q?.pattern)return null;return d5(q.pattern,PN)}var sL6,WAK;var DAK=y(()=>{gK();i1();bN();s6();bK();U7();lj6();sL6=O6(D6(),1);WAK=$R.renderToolResultMessage});var Psz,Wsz,kb;var tL6=y(()=>{x7();Bq();I7();y8();bK();e7();OAK();dz();Tz();br();DAK();Psz=B6(()=>L.strictObject({pattern:L.string().describe("The glob pattern to match files against"),path:L.string().optional().describe('The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.')})),Wsz=B6(()=>L.object({durationMs:L.number().describe("Time taken to execute the search in milliseconds"),numFiles:L.number().describe("Total number of files found"),filenames:L.array(L.string()).describe("Array of file paths that match the pattern"),truncated:L.boolean().describe("Whether results were truncated (limited to 100 files)")})),kb=sq({name:i9,searchHint:"find files by name pattern or wildcard",maxResultSizeChars:1e5,async description(){return WN1},userFacingName:MAK,getToolUseSummary:Bs1,getActivityDescription(q){let K=Bs1(q);return K?`Finding ${K}`:"Finding files"},get inputSchema(){return Psz()},get outputSchema(){return Wsz()},isConcurrencySafe(){return!0},isReadOnly(){return!0},toAutoClassifierInput(q){return q.pattern},isSearchOrReadCommand(){return{isSearch:!0,isRead:!1}},getPath({path:q}){return q?lq(q):Z8()},async preparePermissionMatcher({pattern:q}){return(K)=>lv(K,q)},async validateInput({path:q}){if(q){let K=X8(),_=lq(q);if(_.startsWith("\\\\")||_.startsWith("//"))return{result:!0};let z;try{z=await K.stat(_)}catch(Y){if(_7(Y)){let $=await pe(_),A=`Directory does not exist: ${q}. ${uZ} ${Z8()}.`;if($)A+=` Did you mean ${$}?`;return{result:!1,message:A,errorCode:1}}throw Y}if(!z.isDirectory())return{result:!1,message:`Path is not a directory: ${q}`,errorCode:2}}return{result:!0}},async checkPermissions(q,K){let _=K.getAppState();return RK6(kb,q,_.toolPermissionContext)},async prompt(){return WN1},renderToolUseMessage:XAK,renderToolUseErrorMessage:PAK,renderToolResultMessage:WAK,extractSearchText({filenames:q}){return q.join(`
3049`)},async call(q,{abortController:K,getAppState:_,globLimits:z}){let Y=Date.now(),$=_(),A=z?.maxResults??100,{files:O,truncated:w}=await AAK(q.pattern,kb.getPath(q),{limit:A,offset:0},K.signal,$.toolPermissionContext),j=O.map(dW6);return{data:{filenames:j,durationMs:Date.now()-Y,numFiles:j.length,truncated:w}}},mapToolResultToToolResultBlockParam(q,K){if(q.filenames.length===0)return{tool_use_id:K,type:"tool_result",content:"No files found"};return{tool_use_id:K,type:"tool_result",content:[...q.filenames,...q.truncated?["(Results are truncated. Consider using a more specific path or pattern.)"]:[]].join(`
3050`)}}})});function fsz(q){let K=0;for(let _ of q){if(!_)continue;if(K+=(_.text?.length??0)+(_.image?.image_data.length??0),K>Dsz)return!0}return!1}function gs1(q){if(!q)return"";let K=Array.isArray(q)?q.join(""):q,{truncatedContent:_}=xzK(K);return _}function Zsz(q){if(typeof q["image/png"]==="string")return{image_data:q["image/png"].replace(/\s/g,""),media_type:"image/png"};if(typeof q["image/jpeg"]==="string")return{image_data:q["image/jpeg"].replace(/\s/g,""),media_type:"image/jpeg"};return}function Gsz(q){switch(q.output_type){case"stream":return{output_type:q.output_type,text:gs1(q.text)};case"execute_result":case"display_data":return{output_type:q.output_type,text:gs1(q.data?.["text/plain"]),image:q.data&&Zsz(q.data)};case"error":return{output_type:q.output_type,text:gs1(`${q.ename}: ${q.evalue}
3051${q.traceback.join(`
3052`)}`)}}}function fAK(q,K,_,z){let Y=q.id??`cell-${K}`,$={cellType:q.cell_type,source:Array.isArray(q.source)?q.source.join(""):q.source,execution_count:q.cell_type==="code"?q.execution_count||void 0:void 0,cell_id:Y};if(q.cell_type==="code")$.language=_;if(q.cell_type==="code"&&q.outputs?.length){let A=q.outputs.map(Gsz);if(!z&&fsz(A))$.outputs=[{output_type:"stream",text:`Outputs are too large to include. Use ${_q} with: cat <notebook_path> | jq '.cells[${K}].outputs'`}];else $.outputs=A}return $}function Tsz(q){let K=[];if(q.cellType!=="code")K.push(`<cell_type>${q.cellType}</cell_type>`);if(q.language!=="python"&&q.cellType==="code")K.push(`<language>${q.language}</language>`);return{text:`<cell id="${q.cell_id}">${K.join("")}${q.source}</cell id="${q.cell_id}">`,type:"text"}}function vsz(q){let K=[];if(q.text)K.push({text:`

Callers 1

fAKFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected