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

Function KqY

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

Source from the content-addressed store, hash-verified

3440WSL2 with WSLg (Windows 11) provides audio via PulseAudio — if you are on Windows 10 or WSL1, run Claude Code in native Windows instead.`;if(process.platform==="linux"&&Sa("arecord")){let _=await EJK();if(_.ok)return{available:!0,reason:null};if(Z1()==="wsl")return{available:!1,reason:K};N(`[voice] arecord probe failed: ${_.stderr}`)}if(!Sa("rec")){if(Z1()==="wsl")return{available:!1,reason:K};let _=LJK();return{available:!1,reason:_?`Voice mode requires SoX for audio recording. Install it with: ${_.displayCommand}`:`Voice mode requires SoX for audio recording. Install SoX manually:
3441 macOS: brew install sox
3442 Ubuntu/Debian: sudo apt-get install sox
3443 Fedora: sudo dnf install sox`}}return{available:!0,reason:null}}async function RJK(q,K,_){N(`[voice] startRecording called, platform=${process.platform}`);let z=await bm8(),Y=z.isNativeAudioAvailable()&&(process.platform!=="linux"||await o7Y()),$=_?.silenceDetection!==!1;if(Y){if(hR6||z.isNativeRecordingActive())z.stopNativeRecording(),hR6=!1;if(z.startNativeRecording((O)=>{q(O)},()=>{if($)hR6=!1,K()}))return hR6=!0,!0}if(process.platform==="win32")return N("[voice] Windows native recording unavailable, no fallback"),!1;if(process.platform==="linux"&&Sa("arecord")&&(await EJK()).ok)return KqY(q,K);return qqY(q,K,_)}function qqY(q,K,_){let z=_?.silenceDetection!==!1,Y=["-q","--buffer","1024","-t","raw","-r",String(_67),"-e","signed","-b","16","-c",String(z67),"-"];if(z)Y.push("silence","1","0.1",yJK,"1",i7Y,yJK);let $=K67("rec",Y,{stdio:["pipe","pipe","pipe"]});return Ca=$,$.stdout?.on("data",(A)=>{q(A)}),$.stderr?.on("data",()=>{}),$.on("close",()=>{Ca=null,K()}),$.on("error",(A)=>{H6(A),Ca=null,K()}),!0}function KqY(q,K){let _=["-f","S16_LE","-r",String(_67),"-c",String(z67),"-t","raw","-q","-"],z=K67("arecord",_,{stdio:["pipe","pipe","pipe"]});return Ca=z,z.stdout?.on("data",(Y)=>{q(Y)}),z.stderr?.on("data",()=>{}),z.on("close",()=>{Ca=null,K()}),z.on("error",(Y)=>{H6(Y),Ca=null,K()}),!0}function hJK(){if(hR6&&te1){te1.stopNativeRecording(),hR6=!1;return}if(Ca)Ca.kill("SIGTERM"),Ca=null}var te1=null,NJK=null,_67=16000,z67=1,i7Y="2.0",yJK="3%",ee1=null,q67=null,Ca=null,hR6=!1;var CR6=y(()=>{_8();m8();E8();vK()});function CJK(q,K){if(q==="global"){let Y=j8(),$=K[0];if(!$)return;return Y[$]}let z=N7();for(let Y of K)if(z&&typeof z==="object"&&Y in z)z=z[Y];else return;return z}function bJK(q,K){if(q.length===0)return{};let _=q[0];if(q.length===1)return{[_]:K};return{[_]:bJK(q.slice(1),K)}}var _qY,zqY,xfw;var xJK=y(()=>{x7();k8();Bq();V1();y8();E8();U1();l8();WJK();re1();GJK();_qY=B6(()=>L.strictObject({setting:L.string().describe('The setting key (e.g., "theme", "model", "permissions.defaultMode")'),value:L.union([L.string(),L.boolean(),L.number()]).optional().describe("The new value. Omit to get current value.")})),zqY=B6(()=>L.object({success:L.boolean(),operation:L.enum(["get","set"]).optional(),setting:L.string().optional(),value:L.unknown().optional(),previousValue:L.unknown().optional(),newValue:L.unknown().optional(),error:L.string().optional()})),xfw=sq({name:qJK,searchHint:"get or set Claude Code settings (theme, model)",maxResultSizeChars:1e5,async description(){return XJK},async prompt(){return PJK()},get inputSchema(){return _qY()},get outputSchema(){return zqY()},userFacingName(){return"Config"},shouldDefer:!0,isConcurrencySafe(){return!0},isReadOnly(q){return q.value===void 0},toAutoClassifierInput(q){return q.value===void 0?q.setting:`${q.setting} = ${q.value}`},async checkPermissions(q){if(q.value===void 0)return{behavior:"allow",updatedInput:q};return{behavior:"ask",message:`Set ${q.setting} to ${g6(q.value)}`}},renderToolUseMessage:DJK,renderToolResultMessage:fJK,renderToolUseRejectedMessage:ZJK,async call({setting:q,value:K},_){if(q==="voiceEnabled"){let{isVoiceGrowthBookEnabled:w}=await Promise.resolve().then(() => (FK6(),ie1));if(!w())return{data:{success:!1,error:`Unknown setting: "${q}"`}}}if(!HJK(q))return{data:{success:!1,error:`Unknown setting: "${q}"`}};let z=JJK(q),Y=MJK(q);if(K===void 0){let w=CJK(z.source,Y),j=z.formatOnRead?z.formatOnRead(w):w;return{data:{success:!0,operation:"get",setting:q,value:j}}}if(q==="remoteControlAtStartup"&&typeof K==="string"&&K.toLowerCase().trim()==="default"){b8((j)=>{if(j.remoteControlAtStartup===void 0)return j;let H={...j};return delete H.remoteControlAtStartup,H});let w=$F();return _.setAppState((j)=>{if(j.replBridgeEnabled===w&&!j.replBridgeOutboundOnly)return j;return{...j,replBridgeEnabled:w,replBridgeOutboundOnly:!1}}),{data:{success:!0,operation:"set",setting:q,value:w}}}let $=K;if(z.type==="boolean"){if(typeof K==="string"){let w=K.toLowerCase().trim();if(w==="true")$=!0;else if(w==="false")$=!1}if(typeof $!=="boolean")return{data:{success:!1,operation:"set",setting:q,error:`${q} requires true or false.`}}}let A=hm8(q);if(A&&!A.includes(String($)))return{data:{success:!1,operation:"set",setting:q,error:`Invalid value "${K}". Options: ${A.join(", ")}`}};if(z.validateOnWrite){let w=await z.validateOnWrite($);if(!w.valid)return{data:{success:!1,operation:"set",setting:q,error:w.error}}}if(q==="voiceEnabled"&&$===!0){let{isVoiceModeEnabled:w}=await Promise.resolve().then(() => (FK6(),ie1));if(!w()){let{isAnthropicAuthEnabled:W}=await Promise.resolve().then(() => (G7(),_L));return{data:{success:!1,error:!W()?"Voice mode requires a Claude.ai account. Please run /login to sign in.":"Voice mode is not available."}}}let{isVoiceStreamAvailable:j}=await Promise.resolve().then(() => (Cm8(),se1)),{checkRecordingAvailability:H,checkVoiceDependencies:J,requestMicrophonePermission:M}=await Promise.resolve().then(() => (CR6(),SR6)),X=await H();if(!X.available)return{data:{success:!1,error:X.reason??"Voice mode is not available in this environment."}};if(!j())return{data:{success:!1,error:"Voice mode requires a Claude.ai account. Please run /login to sign in."}};let P=await J();if(!P.available)return{data:{success:!1,error:"No audio recording tool found."+(P.installCommand?` Run: ${P.installCommand}`:"")}};if(!await M()){let W;if(process.platform==="win32")W="Settings → Privacy → Microphone";else if(process.platform==="linux")W="your system's audio settings";else W="System Settings → Privacy & Security → Microphone";return{data:{success:!1,error:`Microphone access is denied. To enable it, go to ${W}, then try again.`}}}}let O=CJK(z.source,Y);try{if(z.source==="global"){let w=Y[0];if(!w)return{data:{success:!1,operation:"set",setting:q,error:"Invalid setting path"}};b8((j)=>{if(j[w]===$)return j;return{...j,[w]:$}})}else{let w=bJK(Y,$),j=W7("userSettings",w);if(j.error)return{data:{success:!1,operation:"set",setting:q,error:j.error.message}}}if(q==="voiceEnabled"){let{settingsChangeDetector:w}=await Promise.resolve().then(() => (NF(),m74));w.notifyChange("userSettings")}if(z.appStateKey){let w=z.appStateKey;_.setAppState((j)=>{if(j[w]===$)return j;return{...j,[w]:$}})}if(q==="remoteControlAtStartup"){let w=$F();_.setAppState((j)=>{if(j.replBridgeEnabled===w&&!j.replBridgeOutboundOnly)return j;return{...j,replBridgeEnabled:w,replBridgeOutboundOnly:!1}})}return d("tengu_config_tool_changed",{setting:q,value:String($)}),{data:{success:!0,operation:"set",setting:q,previousValue:O,newValue:$}}}catch(w){return H6(w),{data:{success:!1,operation:"set",setting:q,error:d6(w)}}}},mapToolResultToToolResultBlockParam(q,K){if(q.success){if(q.operation==="get")return{tool_use_id:K,type:"tool_result",content:`${q.setting} = ${g6(q.value)}`};return{tool_use_id:K,type:"tool_result",content:`Set ${q.setting} to ${g6(q.newValue)}`}}return{tool_use_id:K,type:"tool_result",content:`Error: ${q.error}`,is_error:!0}}})});function uJK(){let q=nq()?" and potentially assigned to teammates":"",K=nq()?"- Include enough detail in the description for another agent to understand and complete the task\n- New tasks are created with status 'pending' and no owner - use TaskUpdate with the `owner` parameter to assign them\n":"";return`Use this tool to create a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
3444It also helps the user understand the progress of the task and overall progress of their requests.
3445

Callers 1

RJKFunction · 0.85

Calls 4

H6Function · 0.85
qFunction · 0.70
KFunction · 0.70
onMethod · 0.45

Tested by

no test coverage detected