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

Function h88

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

Source from the content-addressed store, hash-verified

3210
3211## ${Y?"Approved Plan (edited by user)":"Approved Plan"}:
3212${K}`,tool_use_id:O}}})});var qHK="TestingPermission",B1Y,YPw;var KHK=y(()=>{x7();Bq();B1Y=B6(()=>L.strictObject({})),YPw=sq({name:qHK,maxResultSizeChars:1e5,async description(){return"Test tool that always asks for permission"},async prompt(){return"Test tool that always asks for permission before executing. Used for end-to-end testing."},get inputSchema(){return B1Y()},userFacingName(){return"TestingPermission"},isEnabled(){return!1},isConcurrencySafe(){return!0},isReadOnly(){return!0},async checkPermissions(){return{behavior:"ask",message:"Run test?"}},renderToolUseMessage(){return null},renderToolUseProgressMessage(){return null},renderToolUseQueuedMessage(){return null},renderToolUseRejectedMessage(){return null},renderToolResultMessage(){return null},renderToolUseErrorMessage(){return null},async call(){return{data:`${qHK} executed successfully`}},mapToolResultToToolResultBlockParam(q,K){return{type:"tool_result",content:String(q),tool_use_id:K}}})});function c1Y(q){let K=z6(3),{answers:_}=q,z;if(K[0]===Symbol.for("react.memo_cache_sentinel"))z=QH.createElement(u,{flexDirection:"row"},QH.createElement(k,{color:lT("default")},A_," "),QH.createElement(k,null,"User answered Claude's questions:")),K[0]=z;else z=K[0];let Y;if(K[1]!==_)Y=QH.createElement(u,{flexDirection:"column",marginTop:1},z,QH.createElement(s8,null,QH.createElement(u,{flexDirection:"column"},Object.entries(_).map(l1Y)))),K[1]=_,K[2]=Y;else Y=K[2];return Y}function l1Y(q){let[K,_]=q;return QH.createElement(k,{key:K,color:"inactive"},"· ",K," → ",_)}function n1Y(q){if(q===void 0)return null;if(/<\s*(html|body|!doctype)\b/i.test(q))return"preview must be an HTML fragment, not a full document (no <html>, <body>, or <!DOCTYPE>)";if(/<\s*(script|style)\b/i.test(q))return"preview must not contain <script> or <style> tags. Use inline styles via the style attribute if needed.";if(!/<[a-z][^>]*>/i.test(q))return'preview must contain HTML (previewFormat is set to "html"). Wrap content in a tag like <div> or <pre>.';return null}var QH,F1Y,zHK,YHK,_HK,U1Y,Q1Y,d1Y,GR6;var vm8=y(()=>{q8();v8();gK();zz();yW();x7();s6();Bq();vU();QH=O6(D6(),1),F1Y=B6(()=>L.object({label:L.string().describe("The display text for this option that the user will see and select. Should be concise (1-5 words) and clearly describe the choice."),description:L.string().describe("Explanation of what this option means or what will happen if chosen. Useful for providing context about trade-offs or implications."),preview:L.string().optional().describe("Optional preview content rendered when this option is focused. Use for mockups, code snippets, or visual comparisons that help users compare options. See the tool description for the expected content format.")})),zHK=B6(()=>L.object({question:L.string().describe('The complete question to ask the user. Should be clear, specific, and end with a question mark. Example: "Which library should we use for date formatting?" If multiSelect is true, phrase it accordingly, e.g. "Which features do you want to enable?"'),header:L.string().describe(`Very short label displayed as a chip/tag (max ${By4} chars). Examples: "Auth method", "Library", "Approach".`),options:L.array(F1Y()).min(2).max(4).describe("The available choices for this question. Must have 2-4 options. Each option should be a distinct, mutually exclusive choice (unless multiSelect is enabled). There should be no 'Other' option, that will be provided automatically."),multiSelect:L.boolean().default(!1).describe("Set to true to allow the user to select multiple options instead of just one. Use when choices are not mutually exclusive.")})),YHK=B6(()=>{let q=L.object({preview:L.string().optional().describe("The preview content of the selected option, if the question used previews."),notes:L.string().optional().describe("Free-text notes the user added to their selection.")});return L.record(L.string(),q).optional().describe("Optional per-question annotations from the user (e.g., notes on preview selections). Keyed by question text.")}),_HK={check:(q)=>{let K=q.questions.map((_)=>_.question);if(K.length!==new Set(K).size)return!1;for(let _ of q.questions){let z=_.options.map((Y)=>Y.label);if(z.length!==new Set(z).size)return!1}return!0},message:"Question texts must be unique, option labels must be unique within each question"},U1Y=B6(()=>({answers:L.record(L.string(),L.string()).optional().describe("User answers collected by the permission component"),annotations:YHK(),metadata:L.object({source:L.string().optional().describe('Optional identifier for the source of this question (e.g., "remember" for /remember command). Used for analytics tracking.')}).optional().describe("Optional metadata for tracking and analytics purposes. Not displayed to user.")})),Q1Y=B6(()=>L.strictObject({questions:L.array(zHK()).min(1).max(4).describe("Questions to ask the user (1-4 questions)"),...U1Y()}).refine(_HK.check,{message:_HK.message})),d1Y=B6(()=>L.object({questions:L.array(zHK()).describe("The questions that were asked"),answers:L.record(L.string(),L.string()).describe("The answers provided by the user (question text -> answer string; multi-select answers are comma-separated)"),annotations:YHK()}));GR6=sq({name:a$,searchHint:"prompt the user with a multiple-choice question",maxResultSizeChars:1e5,shouldDefer:!0,async description(){return gy4},async prompt(){let q=A38();if(q===void 0)return Ap1;return Ap1+Fy4[q]},get inputSchema(){return Q1Y()},get outputSchema(){return d1Y()},userFacingName(){return""},isEnabled(){if(eH().length>0)return!1;return!0},isConcurrencySafe(){return!0},isReadOnly(){return!0},toAutoClassifierInput(q){return q.questions.map((K)=>K.question).join(" | ")},requiresUserInteraction(){return!0},async validateInput({questions:q}){if(A38()!=="html")return{result:!0};for(let K of q)for(let _ of K.options){let z=n1Y(_.preview);if(z)return{result:!1,message:`Option "${_.label}" in question "${K.question}": ${z}`,errorCode:1}}return{result:!0}},async checkPermissions(q){return{behavior:"ask",message:"Answer questions?",updatedInput:q}},renderToolUseMessage(){return null},renderToolUseProgressMessage(){return null},renderToolResultMessage({answers:q},K){return QH.createElement(c1Y,{answers:q})},renderToolUseRejectedMessage(){return QH.createElement(u,{flexDirection:"row",marginTop:1},QH.createElement(k,{color:lT("default")},A_," "),QH.createElement(k,null,"User declined to answer questions"))},renderToolUseErrorMessage(){return null},async call({questions:q,answers:K={},annotations:_},z){return{data:{questions:q,answers:K,..._&&{annotations:_}}}},mapToolResultToToolResultBlockParam({answers:q,annotations:K},_){return{type:"tool_result",content:`User has answered your questions: ${Object.entries(q).map(([Y,$])=>{let A=K?.[Y],O=[`"${Y}"="${$}"`];if(A?.preview)O.push(`selected preview:
3213${A.preview}`);if(A?.notes)O.push(`user notes: ${A.notes}`);return O.join(" ")}).join(", ")}. You can now continue with the user's answers in mind.`,tool_use_id:_}}})});import{relative as i1Y}from"path";function h88(q,K){if(!q)return N("formatUri called with undefined URI - indicates malformed LSP server response",{level:"warn"}),"<unknown location>";let _=q.replace(/^file:\/\//,"");if(/^\/[A-Za-z]:/.test(_))_=_.slice(1);try{_=decodeURIComponent(_)}catch(z){let Y=d6(z);N(`Failed to decode LSP URI '${q}': ${Y}. Using un-decoded path: ${_}`,{level:"warn"})}if(K){let z=i1Y(K,_).replaceAll("\\","/");if(z.length<_.length&&!z.startsWith("../../"))return z}return _.replaceAll("\\","/")}function wHK(q,K){let _=new Map;for(let z of q){let Y="uri"in z?z.uri:z.location.uri,$=h88(Y,K),A=_.get($);if(A)A.push(z);else _.set($,[z])}return _}function km8(q,K){let _=h88(q.uri,K),z=q.range.start.line+1,Y=q.range.start.character+1;return`${_}:${z}:${Y}`}function $HK(q){return{uri:q.targetUri,range:q.targetSelectionRange||q.targetRange}}function AHK(q){return"targetUri"in q}function Fe1(q,K){if(!q)return"No definition found. This may occur if the cursor is not on a symbol, or if the definition is in an external library not indexed by the LSP server.";if(Array.isArray(q)){let z=q.map((O)=>AHK(O)?$HK(O):O),Y=z.filter((O)=>!O||!O.uri);if(Y.length>0)N(`formatGoToDefinitionResult: Filtering out ${Y.length} invalid location(s) - this should have been caught earlier`,{level:"warn"});let $=z.filter((O)=>O&&O.uri);if($.length===0)return"No definition found. This may occur if the cursor is not on a symbol, or if the definition is in an external library not indexed by the LSP server.";if($.length===1)return`Defined in ${km8($[0],K)}`;let A=$.map((O)=>` ${km8(O,K)}`).join(`
3214`);return`Found ${$.length} definitions:
3215${A}`}let _=AHK(q)?$HK(q):q;return`Defined in ${km8(_,K)}`}function jHK(q,K){if(!q||q.length===0)return"No references found. This may occur if the symbol has no usages, or if the LSP server has not fully indexed the workspace.";let _=q.filter((A)=>!A||!A.uri);if(_.length>0)N(`formatFindReferencesResult: Filtering out ${_.length} invalid location(s) - this should have been caught earlier`,{level:"warn"});let z=q.filter((A)=>A&&A.uri);if(z.length===0)return"No references found. This may occur if the symbol has no usages, or if the LSP server has not fully indexed the workspace.";if(z.length===1)return`Found 1 reference:

Callers 5

wHKFunction · 0.85
km8Function · 0.85
OHKFunction · 0.85
PHKFunction · 0.85
WHKFunction · 0.85

Calls 6

NFunction · 0.85
d6Function · 0.85
replaceMethod · 0.45
testMethod · 0.45
sliceMethod · 0.45
startsWithMethod · 0.45

Tested by

no test coverage detected