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

Function WLY

package/cli.js:6762–6762  ·  view source on GitHub ↗
({onTranscript:q,onError:K,enabled:_,focusMode:z})

Source from the content-addressed store, hash-verified

6760${z?`Brief mode is now enabled. Use the ${wD6} tool for all user-facing output — plain text outside it is hidden from the user's view.`:`Brief mode is now disabled. The ${wD6} tool is no longer available — reply with plain text.`}
6761</system-reminder>`];return q(z?"Brief-only mode enabled":"Brief-only mode disabled",{display:"system",metaMessages:Y}),null}})},UEY=FEY});var TpK={};T8(TpK,{shouldShowAppUpgradeMessage:()=>dEY,getEnvLessBridgeConfig:()=>Lq8,checkEnvLessBridgeMinVersion:()=>Rq8,DEFAULT_ENV_LESS_BRIDGE_CONFIG:()=>D97});async function Lq8(){let q=await Df8("tengu_bridge_repl_v2_config",D97),K=QEY().safeParse(q);return K.success?K.data:D97}async function Rq8(){let q=await Lq8();if(q.min_version&&bi({ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.88",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-30T21:59:52Z"}.VERSION,q.min_version))return`Your version of Claude Code (${{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.88",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-30T21:59:52Z"}.VERSION}) is too old for Remote Control.
6762Version ${q.min_version} or higher is required. Run \`claude update\` to update.`;return null}async function dEY(){if(!mH6())return!1;return(await Lq8()).should_show_app_upgrade_message}var D97,QEY;var hq8=y(()=>{x7();o1();Jd();D97={init_retry_max_attempts:3,init_retry_base_delay_ms:500,init_retry_jitter_fraction:0.25,init_retry_max_delay_ms:4000,http_timeout_ms:1e4,uuid_dedup_buffer_size:2000,heartbeat_interval_ms:20000,heartbeat_jitter_fraction:0.1,token_refresh_buffer_ms:300000,teardown_archive_timeout_ms:1500,connect_timeout_ms:15000,min_version:"0.0.0",should_show_app_upgrade_message:!1},QEY=B6(()=>L.object({init_retry_max_attempts:L.number().int().min(1).max(10).default(3),init_retry_base_delay_ms:L.number().int().min(100).default(500),init_retry_jitter_fraction:L.number().min(0).max(1).default(0.25),init_retry_max_delay_ms:L.number().int().min(500).default(4000),http_timeout_ms:L.number().int().min(2000).default(1e4),uuid_dedup_buffer_size:L.number().int().min(100).max(50000).default(2000),heartbeat_interval_ms:L.number().int().min(5000).max(30000).default(20000),heartbeat_jitter_fraction:L.number().min(0).max(0.5).default(0.1),token_refresh_buffer_ms:L.number().int().min(30000).max(1800000).default(300000),teardown_archive_timeout_ms:L.number().int().min(500).max(2000).default(1500),connect_timeout_ms:L.number().int().min(5000).max(60000).default(15000),min_version:L.string().refine((q)=>{try{return bi(q,"0.0.0"),!0}catch{return!1}}).default("0.0.0"),should_show_app_upgrade_message:L.boolean().default(!1)}))});function vpK({onDone:q}){let K=DT.useRef(q);K.current=q;let _=DT.useCallback(()=>{K.current("dismiss")},[]);DT.useEffect(()=>{b8(($)=>{if($.remoteDialogSeen)return $;return{...$,remoteDialogSeen:!0}})},[]);let z=DT.useCallback(($)=>{K.current($)},[]);return DT.default.createElement(HY,{title:"Remote Control"},DT.default.createElement(u,{flexDirection:"column",paddingX:2,paddingY:1},DT.default.createElement(u,{marginBottom:1,flexDirection:"column"},DT.default.createElement(k,null,"Remote Control lets you access this CLI session from the web (claude.ai/code) or the Claude app, so you can pick up where you left off on any device."),DT.default.createElement(k,null," "),DT.default.createElement(k,null,"You can disconnect remote access anytime by running /remote-control again.")),DT.default.createElement(u,null,DT.default.createElement(H1,{options:[{label:"Enable Remote Control for this session",description:"Opens a secure connection to claude.ai.",value:"enable"},{label:"Never mind",description:"You can always enable it later with /remote-control.",value:"dismiss"}],onChange:z,onCancel:_}))))}function kpK(){if(j8().remoteDialogSeen)return!1;if(!ta())return!1;if(!Kq()?.accessToken)return!1;return!0}var DT;var f97=y(()=>{Jd();s6();G7();V1();p3();GD();DT=O6(D6(),1)});var VpK={};T8(VpK,{call:()=>$LY});function cEY(q){let K=z6(10),{onDone:_,name:z}=q,Y=s7(),$=P8(iEY),A=P8(nEY),O=P8(lEY),[w,j]=c56.useState(!1),H;if(K[0]!==z||K[1]!==_||K[2]!==$||K[3]!==A||K[4]!==O||K[5]!==Y)H=()=>{if(($||A)&&!O){j(!0);return}let M=!1;return(async()=>{let X=await YLY();if(M)return;if(X){d("tengu_bridge_command",{action:"preflight_failed"}),_(X,{display:"system"});return}if(kpK()){Y((P)=>{if(P.showRemoteCallout)return P;return{...P,showRemoteCallout:!0,replBridgeInitialName:z}}),_("",{display:"system"});return}d("tengu_bridge_command",{action:"connect"}),Y((P)=>{if(P.replBridgeEnabled&&!P.replBridgeOutboundOnly)return P;return{...P,replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1,replBridgeInitialName:z}}),_("Remote Control connecting…",{display:"system"})})(),()=>{M=!0}},K[0]=z,K[1]=_,K[2]=$,K[3]=A,K[4]=O,K[5]=Y,K[6]=H;else H=K[6];let J;if(K[7]===Symbol.for("react.memo_cache_sentinel"))J=[],K[7]=J;else J=K[7];if(c56.useEffect(H,J),w){let M;if(K[8]!==_)M=$A.createElement(rEY,{onDone:_}),K[8]=_,K[9]=M;else M=K[9];return M}return null}function lEY(q){return q.replBridgeOutboundOnly}function nEY(q){return q.replBridgeEnabled}function iEY(q){return q.replBridgeConnected}function rEY(q){let K=z6(61),{onDone:_}=q;yJ("bridge-disconnect-dialog");let z=s7(),Y=P8(zLY),$=P8(_LY),A=P8(KLY),[O,w]=c56.useState(2),[j,H]=c56.useState(!1),[J,M]=c56.useState(""),X=A?Y:$,P,W;if(K[0]!==X||K[1]!==j)P=()=>{if(!j||!X){M("");return}Qb(X,{type:"utf8",errorCorrectionLevel:"L",small:!0}).then(M).catch(()=>M(""))},W=[j,X],K[0]=X,K[1]=j,K[2]=P,K[3]=W;else P=K[2],W=K[3];c56.useEffect(P,W);let D;if(K[4]!==_||K[5]!==z)D=function(){z(qLY),d("tengu_bridge_command",{action:"disconnect"}),_(Hq8,{display:"system"})},K[4]=_,K[5]=z,K[6]=D;else D=K[6];let f=D,G;if(K[7]===Symbol.for("react.memo_cache_sentinel"))G=function(){H(eEY)},K[7]=G;else G=K[7];let Z=G,T;if(K[8]!==_)T=function(){_(void 0,{display:"skip"})},K[8]=_,K[9]=T;else T=K[9];let v=T,V,E;if(K[10]===Symbol.for("react.memo_cache_sentinel"))V=()=>w(tEY),E=()=>w(sEY),K[10]=V,K[11]=E;else V=K[10],E=K[11];let S;if(K[12]!==O||K[13]!==v||K[14]!==f)S={"select:next":V,"select:previous":E,"select:accept":()=>{if(O===0)f();else if(O===1)Z();else v()}},K[12]=O,K[13]=v,K[14]=f,K[15]=S;else S=K[15];let R;if(K[16]===Symbol.for("react.memo_cache_sentinel"))R={context:"Select"},K[16]=R;else R=K[16];o7(S,R);let x,I,B,p,C,g,F,U,c;if(K[17]!==X||K[18]!==v||K[19]!==J||K[20]!==j){let l=J?J.split(`
6763`).filter(aEY):[];I=R1,F="Remote Control",U=v,c=!0,x=u,B="column",p=1;let A6=X?` at ${X}`:"";if(K[30]!==A6)C=$A.createElement(k,null,"This session is available via Remote Control",A6,"."),K[30]=A6,K[31]=C;else C=K[31];g=j&&l.length>0&&$A.createElement(u,{flexDirection:"column"},l.map(oEY)),K[17]=X,K[18]=v,K[19]=J,K[20]=j,K[21]=x,K[22]=I,K[23]=B,K[24]=p,K[25]=C,K[26]=g,K[27]=F,K[28]=U,K[29]=c}else x=K[21],I=K[22],B=K[23],p=K[24],C=K[25],g=K[26],F=K[27],U=K[28],c=K[29];let K6=O===0,t;if(K[32]===Symbol.for("react.memo_cache_sentinel"))t=$A.createElement(k,null,"Disconnect this session"),K[32]=t;else t=K[32];let q6;if(K[33]!==K6)q6=$A.createElement(mU,{isFocused:K6},t),K[33]=K6,K[34]=q6;else q6=K[34];let e=O===1,i=j?"Hide QR code":"Show QR code",$6;if(K[35]!==i)$6=$A.createElement(k,null,i),K[35]=i,K[36]=$6;else $6=K[36];let M6;if(K[37]!==e||K[38]!==$6)M6=$A.createElement(mU,{isFocused:e},$6),K[37]=e,K[38]=$6,K[39]=M6;else M6=K[39];let j6=O===2,G6;if(K[40]===Symbol.for("react.memo_cache_sentinel"))G6=$A.createElement(k,null,"Continue"),K[40]=G6;else G6=K[40];let w6;if(K[41]!==j6)w6=$A.createElement(mU,{isFocused:j6},G6),K[41]=j6,K[42]=w6;else w6=K[42];let o;if(K[43]!==q6||K[44]!==M6||K[45]!==w6)o=$A.createElement(u,{flexDirection:"column"},q6,M6,w6),K[43]=q6,K[44]=M6,K[45]=w6,K[46]=o;else o=K[46];let s;if(K[47]===Symbol.for("react.memo_cache_sentinel"))s=$A.createElement(k,{dimColor:!0},"Enter to select · Esc to continue"),K[47]=s;else s=K[47];let a;if(K[48]!==x||K[49]!==B||K[50]!==p||K[51]!==C||K[52]!==g||K[53]!==o)a=$A.createElement(x,{flexDirection:B,gap:p},C,g,o,s),K[48]=x,K[49]=B,K[50]=p,K[51]=C,K[52]=g,K[53]=o,K[54]=a;else a=K[54];let n;if(K[55]!==I||K[56]!==F||K[57]!==U||K[58]!==c||K[59]!==a)n=$A.createElement(I,{title:F,onCancel:U,hideInputGuide:c},a),K[55]=I,K[56]=F,K[57]=U,K[58]=c,K[59]=a,K[60]=n;else n=K[60];return n}function oEY(q,K){return $A.createElement(k,{key:K},q)}function aEY(q){return q.length>0}function sEY(q){return(q-1+3)%3}function tEY(q){return(q+1)%3}function eEY(q){return!q}function qLY(q){if(!q.replBridgeEnabled)return q;return{...q,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}}function KLY(q){return q.replBridgeSessionActive}function _LY(q){return q.replBridgeConnectUrl}function zLY(q){return q.replBridgeSessionUrl}async function YLY(){let{waitForPolicyLimitsToLoad:q,isPolicyAllowed:K}=await Promise.resolve().then(() => (ZD(),dF1));if(await q(),!K("allow_remote_control"))return"Remote Control is disabled by your organization's policy.";let _=await dq7();if(_)return _;let Y=mH6()?await Rq8():X78();if(Y)return Y;if(!Ay())return kS6;return N("[bridge] Prerequisites passed, enabling bridge"),null}async function $LY(q,K,_){let z=_.trim()||void 0;return $A.createElement(cEY,{onDone:q,name:z})}var $A,c56;var NpK=y(()=>{q8();MS6();Ea();Jd();hq8();e4();Ra6();f97();T0();s6();Oq();k8();C7();_8();$A=O6(D6(),1),c56=O6(D6(),1)});var EpK={};T8(EpK,{default:()=>OLY});function ypK(){return ta()}var ALY,OLY;var LpK=y(()=>{Jd();ALY={type:"local-jsx",name:"remote-control",aliases:["rc"],description:"Connect this terminal for remote-control sessions",argumentHint:"[name]",isEnabled:ypK,get isHidden(){return!ypK()},immediate:!0,load:()=>Promise.resolve().then(() => (NpK(),VpK))},OLY=ALY});import{basename as hpK}from"path";function SpK(q){return q.replace(/([a-z])([A-Z])/g,"$1 $2").split(/[-_./\s]+/).map((K)=>K.trim()).filter((K)=>K.length>2&&K.length<=20)}function jLY(q){let K=hpK(q).replace(/\.[^.]+$/,"");return SpK(K)}async function Z97(q){let K=new Set(wLY);try{let _=Fz();if(_){let z=hpK(_);if(z.length>2&&z.length<=50)K.add(z)}}catch{}try{let _=await oM();if(_)for(let z of SpK(_))K.add(z)}catch{}if(q)for(let _ of q){if(K.size>=RpK)break;for(let z of jLY(_))K.add(z)}return[...K].slice(0,RpK)}var wLY,RpK=50;var CpK=y(()=>{v8();E5();wLY=["MCP","symlink","grep","regex","localhost","codebase","TypeScript","JSON","OAuth","webhook","gRPC","dotfiles","subagent","worktree"]});var IpK={};T8(IpK,{useVoice:()=>WLY,normalizeLanguageForSTT:()=>Sq8,computeLevel:()=>xpK,FIRST_PRESS_FALLBACK_MS:()=>MLY});function Sq8(q){if(!q)return{code:G97};let K=q.toLowerCase().trim();if(!K)return{code:G97};if(bpK.has(K))return{code:K};let _=HLY[K];if(_)return{code:_};let z=K.split("-")[0];if(z&&bpK.has(z))return{code:z};return{code:G97,fellBackFrom:q}}function xpK(q){let K=q.length>>1;if(K===0)return 0;let _=0;for(let $=0;$<q.length-1;$+=2){let A=(q[$]|q[$+1]<<8)<<16>>16;_+=A*A}let z=Math.sqrt(_/K),Y=Math.min(z/2000,1);return Math.sqrt(Y)}function WLY({onTranscript:q,onError:K,enabled:_,focusMode:z}){let[Y,$]=I$.useState("idle"),A=I$.useRef("idle"),O=I$.useRef(null),w=I$.useRef(""),j=I$.useRef(q),H=I$.useRef(K),J=I$.useRef(null),M=I$.useRef(null),X=I$.useRef(!1),P=I$.useRef(null),W=I$.useRef(!1),D=I$.useRef(null),f=I$.useRef(!1),G=I$.useRef(0),Z=I$.useRef(0),T=I$.useRef(!1),v=I$.useRef([]),V=I$.useRef(!1),E=I$.useRef(0),S=I$.useRef(0),R=I$.useRef(!1),x=I$.useRef(!1),I=I$.useRef([]),B=CO(),p=gl6();j.current=q,H.current=K;function C(t){A.current=t,$(t),p((q6)=>{if(q6.voiceState===t)return q6;return{...q6,voiceState:t}})}let g=I$.useCallback(()=>{if(Z.current++,J.current)clearTimeout(J.current),J.current=null;if(M.current)clearTimeout(M.current),M.current=null;if(P.current)clearTimeout(P.current),P.current=null;if(D.current)clearTimeout(D.current),D.current=null;if(f.current=!1,ks?.stopRecording(),O.current)O.current.close(),O.current=null;w.current="",I.current=[],v.current=[],p((t)=>{if(t.voiceInterimTranscript===""&&!t.voiceAudioLevels.length)return t;return{...t,voiceInterimTranscript:"",voiceAudioLevels:[]}})},[p]);function F(){N("[voice] finishRecording: stopping recording, transitioning to processing"),E.current++;let t=W.current;W.current=!1,C("processing"),ks?.stopRecording();let q6=Date.now()-G.current,e=R.current,i=T.current,$6=S.current,M6=x.current,j6=Z.current,G6=()=>Z.current!==j6;N("[voice] Recording stopped"),(O.current?O.current.finalize():Promise.resolve(void 0)).then(async(o)=>{if(G6())return;if(o==="no_data_timeout"&&e&&M6&&!t&&$6===0&&w.current.trim()===""&&!V.current&&v.current.length>0){if(V.current=!0,N(`[voice] Silent-drop detected (no_data_timeout, ${String(v.current.length)} chunks); replaying on fresh connection`),d("tengu_voice_silent_drop_replay",{recordingDurationMs:q6,chunkCount:v.current.length}),O.current)O.current.close(),O.current=null;let a=v.current;if(await R7(250),G6())return;let n=Sq8(N7().language),l=await Z97();if(G6())return;if(await new Promise((A6)=>{Sm8({onTranscript:(J6,X6)=>{if(G6())return;if(X6&&J6.trim()){if(w.current)w.current+=" ";w.current+=J6.trim()}},onError:()=>A6(),onClose:()=>{},onReady:(J6)=>{if(G6()){J6.close(),A6();return}O.current=J6;let X6=32000,f6=[],N6=0;for(let Z6 of a){if(N6>0&&N6+Z6.length>X6)J6.send(Buffer.concat(f6)),f6=[],N6=0;f6.push(Z6),N6+=Z6.length}if(f6.length)J6.send(Buffer.concat(f6));J6.finalize().then(()=>{J6.close(),A6()})}},{language:n.code,keyterms:l}).then((J6)=>{if(!J6)A6()},()=>A6())}),G6())return}v.current=[];let s=w.current.trim();if(N(`[voice] Final transcript assembled (${String(s.length)} chars): "${s.slice(0,200)}"`),d("tengu_voice_recording_completed",{transcriptChars:s.length+$6,recordingDurationMs:q6,hadAudioSignal:e,retried:i,silentDropRetried:V.current,wsConnected:M6,focusTriggered:t}),O.current)O.current.close(),O.current=null;if(s)N(`[voice] Injecting transcript (${String(s.length)} chars)`),j.current(s);else if($6===0&&q6>2000)if(!M6)H.current?.("Voice connection failed. Check your network and try again.");else if(!e)H.current?.("No audio detected from microphone. Check that the correct input device is selected and that Claude Code has microphone access.");else H.current?.("No speech detected.");w.current="",p((a)=>{if(a.voiceInterimTranscript==="")return a;return{...a,voiceInterimTranscript:""}}),C("idle")}).catch((o)=>{if(H6(x1(o)),!G6())C("idle")})}I$.useEffect(()=>{if(_&&!ks)Promise.resolve().then(() => (CR6(),SR6)).then((t)=>{ks=t})},[_]);function U(){if(D.current)clearTimeout(D.current);D.current=setTimeout((t,q6,e,i,$6)=>{if(t.current=null,q6.current==="recording"&&e.current)N("[voice] Focus silence timeout — tearing down session"),i.current=!0,$6()},XLY,D,A,W,f,F)}I$.useEffect(()=>{if(!_||!z){if(W.current&&A.current==="recording")N("[voice] Focus mode disabled during recording, finishing"),F();return}let t=!1;if(B&&A.current==="idle"&&!f.current){let q6=()=>{if(t||A.current!=="idle"||f.current)return;N("[voice] Focus gained, starting recording session"),W.current=!0,c(),U()};if(ks)q6();else Promise.resolve().then(() => (CR6(),SR6)).then((e)=>{ks=e,q6()})}else if(!B){if(f.current=!1,A.current==="recording")N("[voice] Focus lost, finishing recording"),F()}return()=>{t=!0}},[_,z,B]);async function c(){if(!ks){H.current?.("Voice module not loaded yet. Try again in a moment.");return}C("recording"),G.current=Date.now(),w.current="",X.current=!1,R.current=!1,T.current=!1,V.current=!1,v.current=[],S.current=0,x.current=!1;let t=++Z.current,q6=await ks.checkRecordingAvailability();if(!q6.available){N(`[voice] Recording not available: ${q6.reason??"unknown"}`),H.current?.(q6.reason??"Audio recording is not available."),g(),C("idle");return}N("[voice] Starting recording session, connecting voice stream"),p((o)=>{if(!o.voiceError)return o;return{...o,voiceError:null}});let e=[];if(N("[voice] startRecording: buffering audio while WebSocket connects"),I.current=[],!await ks.startRecording((o)=>{let s=Buffer.from(o);if(!W.current)v.current.push(s);if(O.current)O.current.send(s);else e.push(s);let a=xpK(o);if(!R.current&&a>0.01)R.current=!0;let n=I.current;if(n.length>=PLY)n.shift();n.push(a);let l=[...n];I.current=l,p((A6)=>({...A6,voiceAudioLevels:l}))},()=>{if(A.current==="recording")F()},{silenceDetection:!1})){H6(Error("[voice] Recording failed — no audio tool found")),H.current?.("Failed to start audio capture. Check that your microphone is accessible."),g(),C("idle"),p((o)=>({...o,voiceError:"Recording failed — no audio tool found"}));return}let $6=N7().language,M6=Sq8($6);d("tengu_voice_recording_started",{focusTriggered:W.current,sttLanguage:M6.code,sttLanguageIsDefault:!$6?.trim(),sttLanguageFellBack:M6.fellBackFrom!==void 0,systemLocaleLanguage:rJ7()});let j6=!1,G6=()=>Z.current!==t,w6=(o)=>{let s=E.current;Sm8({onTranscript:(a,n)=>{if(G6())return;if(j6=!0,N(`[voice] onTranscript: isFinal=${String(n)} text="${a}"`),n&&a.trim())if(W.current)N(`[voice] Focus mode: flushing final transcript immediately: "${a.trim()}"`),j.current(a.trim()),S.current+=a.trim().length,p((l)=>{if(l.voiceInterimTranscript==="")return l;return{...l,voiceInterimTranscript:""}}),w.current="",U();else{if(w.current)w.current+=" ";w.current+=a.trim(),N(`[voice] Accumulated final transcript: "${w.current}"`),p((l)=>{let A6=w.current;if(l.voiceInterimTranscript===A6)return l;return{...l,voiceInterimTranscript:A6}})}else if(!n){if(W.current)U();let l=a.trim(),A6=w.current?w.current+(l?" "+l:""):l;p((J6)=>{if(J6.voiceInterimTranscript===A6)return J6;return{...J6,voiceInterimTranscript:A6}})}},onError:(a,n)=>{if(G6()){N(`[voice] ignoring onError from stale session: ${a}`);return}if(E.current!==s){N(`[voice] ignoring stale onError from superseded attempt: ${a}`);return}if(!n?.fatal&&!j6&&A.current==="recording"){if(!T.current){T.current=!0,N(`[voice] early voice_stream error (pre-transcript), retrying once: ${a}`),d("tengu_voice_stream_early_retry",{}),O.current=null,E.current++,setTimeout((l,A6,J6)=>{if(l.current==="recording")A6(J6)},250,A,w6,o);return}}E.current++,H6(Error(`[voice] voice_stream error: ${a}`)),H.current?.(`Voice stream error: ${a}`),e.length=0,W.current=!1,g(),C("idle")},onClose:()=>{},onReady:(a)=>{if(G6()||A.current!=="recording"){a.close();return}O.current=a,x.current=!0;let n=32000;if(e.length>0){let l=0;for(let X6 of e)l+=X6.length;let A6=[[]],J6=0;for(let X6 of e){if(J6>0&&J6+X6.length>n)A6.push([]),J6=0;A6[A6.length-1].push(X6),J6+=X6.length}N(`[voice] onReady: flushing ${String(e.length)} buffered chunks (${String(l)} bytes) as ${String(A6.length)} coalesced frame(s)`);for(let X6 of A6)a.send(Buffer.concat(X6))}if(e.length=0,M.current)clearTimeout(M.current);if(X.current)M.current=setTimeout((l,A6,J6)=>{if(l.current=null,A6.current==="recording")J6()},T97,M,A,F)}},{language:M6.code,keyterms:o}).then((a)=>{if(G6()){a?.close();return}if(!a){N("[voice] Failed to connect to voice_stream (no OAuth token?)"),H.current?.("Voice mode requires a Claude.ai account. Please run /login to sign in."),e.length=0,g(),C("idle");return}if(A.current!=="recording"){e.length=0,a.close();return}})};Z97().then(w6)}let K6=I$.useCallback((t=JLY)=>{if(!_||!ae1())return;if(W.current)return;if(z&&f.current){N("[voice] Re-arming focus recording after silence timeout"),f.current=!1,W.current=!0,c(),U();return}let q6=A.current;if(q6==="processing")return;if(q6==="idle")N("[voice] handleKeyEvent: idle, starting recording session immediately"),c(),P.current=setTimeout((e,i,$6,M6,j6)=>{if(e.current=null,i.current==="recording"&&!$6.current)N("[voice] No auto-repeat seen, arming release timer via fallback"),$6.current=!0,M6.current=setTimeout((G6,w6,o)=>{if(G6.current=null,w6.current==="recording")o()},T97,M6,i,j6)},t,P,A,X,M,F);else if(q6==="recording"){if(X.current=!0,P.current)clearTimeout(P.current),P.current=null}if(M.current)clearTimeout(M.current);if(A.current==="recording"&&X.current)M.current=setTimeout((e,i,$6)=>{if(e.current=null,i.current==="recording")$6()},T97,M,A,F)},[_,z,g]);return I$.useEffect(()=>{if(!_&&A.current!=="idle")g(),C("idle");return()=>{g()}},[_,g]),{state:Y,handleKeyEvent:K6}}var I$,G97="en",HLY,bpK,ks=null,T97=200,JLY=600,MLY=2000,XLY=5000,PLY=16;var v97=y(()=>{NA6();hl6();k8();CpK();Cm8();_8();y8();mk();E8();U1();I$=O6(D6(),1),HLY={english:"en",spanish:"es",español:"es",espanol:"es",french:"fr",français:"fr",francais:"fr",japanese:"ja",日本語:"ja",german:"de",deutsch:"de",portuguese:"pt",português:"pt",portugues:"pt",italian:"it",italiano:"it",korean:"ko",한국어:"ko",hindi:"hi",हिन्दी:"hi",हिंदी:"hi",indonesian:"id","bahasa indonesia":"id",bahasa:"id",russian:"ru",русский:"ru",polish:"pl",polski:"pl",turkish:"tr",türkçe:"tr",turkce:"tr",dutch:"nl",nederlands:"nl",ukrainian:"uk",українська:"uk",greek:"el",ελληνικά:"el",czech:"cs",čeština:"cs",cestina:"cs",danish:"da",dansk:"da",swedish:"sv",svenska:"sv",norwegian:"no",norsk:"no"},bpK=new Set(["en","es","fr","ja","de","pt","it","ko","hi","id","ru","pl","tr","nl","uk","el","cs","da","sv","no"])});var upK={};T8(upK,{call:()=>fLY});var DLY=2,fLY=async()=>{if(!KH6()){if(!WJ())return{type:"text",value:"Voice mode requires a Claude.ai account. Please run /login to sign in."};return{type:"text",value:"Voice mode is not available."}}let q=N7();if(q.voiceEnabled===!0){if(W7("userSettings",{voiceEnabled:!1}).error)return{type:"text",value:"Failed to update settings. Check your settings file for syntax errors."};return WX.notifyChange("userSettings"),d("tengu_voice_toggled",{enabled:!1}),{type:"text",value:"Voice mode disabled."}}let{isVoiceStreamAvailable:_}=await Promise.resolve().then(() => (Cm8(),se1)),{checkRecordingAvailability:z}=await Promise.resolve().then(() => (CR6(),SR6)),Y=await z();if(!Y.available)return{type:"text",value:Y.reason??"Voice mode is not available in this environment."};if(!_())return{type:"text",value:"Voice mode requires a Claude.ai account. Please run /login to sign in."};let{checkVoiceDependencies:$,requestMicrophonePermission:A}=await Promise.resolve().then(() => (CR6(),SR6)),O=await $();if(!O.available)return{type:"text",value:`No audio recording tool found.${O.installCommand?`
6764Install audio recording tools? Run: ${O.installCommand}`:`
6765Install SoX manually for audio recording.`}`};if(!await A()){let D;if(process.platform==="win32")D="Settings → Privacy → Microphone";else if(process.platform==="linux")D="your system's audio settings";else D="System Settings → Privacy & Security → Microphone";return{type:"text",value:`Microphone access is denied. To enable it, go to ${D}, then run /voice again.`}}if(W7("userSettings",{voiceEnabled:!0}).error)return{type:"text",value:"Failed to update settings. Check your settings file for syntax errors."};WX.notifyChange("userSettings"),d("tengu_voice_toggled",{enabled:!0});let j=RH("voice:pushToTalk","Chat","Space"),H=Sq8(q.language),J=j8(),M=J.voiceLangHintLastLanguage!==H.code,X=M?0:J.voiceLangHintShownCount??0,P=!H.fellBackFrom&&X<DLY,W="";if(H.fellBackFrom)W=` Note: "${H.fellBackFrom}" is not a supported dictation language; using English. Change it via /config.`;else if(P)W=` Dictation language: ${H.code} (/config to change).`;if(M||P)b8((D)=>({...D,voiceLangHintShownCount:X+(P?1:0),voiceLangHintLastLanguage:H.code}));return{type:"text",value:`Voice mode enabled. Hold ${j} to record.${W}`}};var mpK=y(()=>{v97();tu();k8();G7();V1();NF();U1();FK6()});var ppK={};T8(ppK,{default:()=>GLY});var ZLY,GLY;var BpK=y(()=>{FK6();ZLY={type:"local",name:"voice",description:"Toggle voice mode",availability:["claude-ai"],isEnabled:()=>gK6(),get isHidden(){return!KH6()},supportsNonInteractive:!1,load:()=>Promise.resolve().then(() => (mpK(),upK))},GLY=ZLY});async function qQ8(){if(!await TO("gh"))return"not_installed";let{exitCode:K}=await m_("gh",["auth","token"],{stdout:"ignore",stderr:"ignore",timeout:5000,reject:!1});return K===0?"authenticated":"not_authenticated"}var k97=y(()=>{Df();rk()});async function gpK(q){let K,_;try{({accessToken:K,orgUUID:_}=await pH())}catch{return{ok:!1,error:{kind:"not_signed_in"}}}let z=`${u7().BASE_API_URL}/v1/code/github/import-token`,Y={...UY(K),"anthropic-beta":TLY,"x-organization-uuid":_};try{let $=await $1.post(z,{token:q.reveal()},{headers:Y,timeout:15000,validateStatus:()=>!0});if($.status===200)return{ok:!0,result:$.data};if($.status===400)return{ok:!1,error:{kind:"invalid_token"}};if($.status===401)return{ok:!1,error:{kind:"not_signed_in"}};return N(`import-token returned ${$.status}`,{level:"error"}),{ok:!1,error:{kind:"server",status:$.status}}}catch($){if($1.isAxiosError($))N(`import-token network error: ${$.code??"unknown"}`,{level:"error"});return{ok:!1,error:{kind:"network"}}}}async function vLY(){try{return(await rm()).length>0}catch{return!1}}async function FpK(){let q,K;try{({accessToken:q,orgUUID:K}=await pH())}catch{return!1}if(await vLY())return!0;let _=`${u7().BASE_API_URL}/v1/environment_providers/cloud/create`,z={...UY(q),"x-organization-uuid":K};try{let Y=await $1.post(_,{name:"Default",kind:"anthropic_cloud",description:"Default - trusted network access",config:{environment_type:"anthropic",cwd:"/home/user",init_script:null,environment:{},languages:[{name:"python",version:"3.11"},{name:"node",version:"20"}],network_config:{allowed_hosts:[],allow_default_hosts:!0}}},{headers:z,timeout:15000,validateStatus:()=>!0});return Y.status>=200&&Y.status<300}catch{return!1}}async function UpK(){try{return await pH(),!0}catch{return!1}}function KQ8(){return`${u7().CLAUDE_AI_ORIGIN}/code`}var TLY="ccr-byoc-2025-07-29",V97;var QpK=y(()=>{CK();H3();_8();VM();oE6();V97=class V97{#q;constructor(q){this.#q=q}reveal(){return this.#q}toString(){return"[REDACTED:gh-token]"}toJSON(){return"[REDACTED:gh-token]"}[Symbol.for("nodejs.util.inspect.custom")](){return"[REDACTED:gh-token]"}}});var dpK={};T8(dpK,{call:()=>yLY});async function kLY(){if(!await UpK())return{status:"not_signed_in"};let q=await qQ8();if(q==="not_installed")return{status:"gh_not_installed"};if(q==="not_authenticated")return{status:"gh_not_authenticated"};let{stdout:K}=await m_("gh",["auth","token"],{stdout:"pipe",stderr:"ignore",timeout:5000,reject:!1}),_=K.trim();if(!_)return{status:"gh_not_authenticated"};return{status:"has_gh_token",token:new V97(_)}}function VLY(q,K){switch(q.kind){case"not_signed_in":return`Login failed. Please visit ${K} and login using the GitHub App`;case"invalid_token":return"GitHub rejected that token. Run `gh auth login` and try again.";case"server":return`Server error (${q.status}). Try again in a moment.`;case"network":return"Couldn't reach the server. Check your connection."}}function NLY({onDone:q}){let[K,_]=_Q8.useState({name:"checking"});_Q8.useEffect(()=>{d("tengu_remote_setup_started",{}),kLY().then(async(A)=>{switch(A.status){case"not_signed_in":d("tengu_remote_setup_result",{result:"not_signed_in"}),q("Not signed in to Claude. Run /login first.");return;case"gh_not_installed":case"gh_not_authenticated":{let O=`${KQ8()}/onboarding?step=alt-auth`;await m3(O),d("tengu_remote_setup_result",{result:A.status}),q(A.status==="gh_not_installed"?`GitHub CLI not found. Install it via https://cli.github.com/, then run \`gh auth login\`, or connect GitHub on the web: ${O}`:`GitHub CLI not authenticated. Run \`gh auth login\` and try again, or connect GitHub on the web: ${O}`);return}case"has_gh_token":_({name:"confirm",token:A.token})}})},[]);let z=()=>{d("tengu_remote_setup_result",{result:"cancelled"}),q()},Y=async(A)=>{_({name:"uploading"});let O=await gpK(A);if(!O.ok){d("tengu_remote_setup_result",{result:"import_failed",error_kind:O.error.kind}),q(VLY(O.error,KQ8()));return}await FpK();let w=KQ8();await m3(w),d("tengu_remote_setup_result",{result:"success"}),q(`Connected as ${O.result.github_username}. Opened ${w}`)};if(K.name==="checking")return wZ.createElement(pb,{message:"Checking login status…"});if(K.name==="uploading")return wZ.createElement(pb,{message:"Connecting GitHub to Claude…"});let $=K.token;return wZ.createElement(R1,{title:"Connect Claude on the web to GitHub?",onCancel:z,hideInputGuide:!0},wZ.createElement(u,{flexDirection:"column"},wZ.createElement(k,null,"Claude on the web requires connecting to your GitHub account to clone and push code on your behalf."),wZ.createElement(k,{dimColor:!0},"Your local credentials are used to authenticate with GitHub")),wZ.createElement(H1,{options:[{label:"Continue",value:"send"},{label:"Cancel",value:"cancel"}],onChange:(A)=>{if(A==="send")Y($);else z()},onCancel:z}))}async function yLY(q){return wZ.createElement(NLY,{onDone:q})}var wZ,_Q8;var cpK=y(()=>{Df();d_();e4();IH6();s6();k8();hH();k97();QpK();wZ=O6(D6(),1),_Q8=O6(D6(),1)});var lpK={};T8(lpK,{default:()=>LLY});var ELY,LLY;var npK=y(()=>{o1();ZD();ELY={type:"local-jsx",name:"web-setup",description:"Setup Claude Code on the web (requires connecting your GitHub account)",availability:["claude-ai"],isEnabled:()=>g8("tengu_cobalt_lantern",!1)&&OO("allow_remote_sessions"),get isHidden(){return!OO("allow_remote_sessions")},load:()=>Promise.resolve().then(() => (cpK(),dpK))},LLY=ELY});var epK={};T8(epK,{generateUsageReport:()=>spK,detectMultiClauding:()=>apK,default:()=>ORY,deduplicateSessionBranches:()=>BLY,buildExportData:()=>zRY});import{mkdir as y97,readdir as RLY,readFile as rpK,unlink as hLY,writeFile as E97}from"fs/promises";import{extname as SLY,join as Ns}from"path";function opK(){return NV()}function CLY(){return NV()}function YQ8(){return Ns(c1(),"usage-data")}function $Q8(){return Ns(YQ8(),"facets")}function N97(){return Ns(YQ8(),"session-meta")}function uLY(q){let K=SLY(q).toLowerCase();return bLY[K]||null}function mLY(q){let K={},_={},z=0,Y=0,$=0,A=0,O=0,w=[],j=0,H={},J=!1,M=0,X=0,P=new Set,W=[],D=[],f=!1,G=!1,Z=!1,T=null;for(let v of q.messages){let V=v.timestamp;if(v.type==="assistant"&&v.message){if(V)T=V;let E=v.message.usage;if(E)$+=E.input_tokens||0,A+=E.output_tokens||0;let S=v.message.content;if(Array.isArray(S)){for(let R of S)if(R.type==="tool_use"&&"name"in R){let x=R.name;if(K[x]=(K[x]||0)+1,x===v4||x===CB)J=!0;if(x.startsWith("mcp__"))f=!0;if(x==="WebSearch")G=!0;if(x==="WebFetch")Z=!0;let I=R.input;if(I){let B=I.file_path||"";if(B){let C=uLY(B);if(C)_[C]=(_[C]||0)+1;if(x==="Edit"||x==="Write")P.add(B)}if(x==="Edit"){let C=I.old_string||"",g=I.new_string||"";for(let F of U76(C,g)){if(F.added)M+=F.count||0;if(F.removed)X+=F.count||0}}if(x==="Write"){let C=I.content||"";if(C)M+=G$(C,`

Callers

nothing calls this directly

Calls 15

COFunction · 0.85
gl6Function · 0.85
clearTimeoutFunction · 0.85
pFunction · 0.85
NFunction · 0.85
FFunction · 0.85
q6Function · 0.85
ae1Function · 0.85
cFunction · 0.85
UFunction · 0.85
setTimeoutFunction · 0.85
oFunction · 0.85

Tested by

no test coverage detected