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

Function qC4

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

Source from the content-addressed store, hash-verified

1828`)+xw6}function Wg1(q){let K=q.map((z)=>`"${z.displayName}"`).join(", "),_=q.length===1;return`${K} ${_?"is":"are"} in the user's auto-deny list `+"(Settings → Desktop app (General) → Computer Use → Denied apps). "+`Requests for ${_?"this app":"these apps"} are automatically denied. If you need access for this task, ask the user to remove ${_?"it":"them"} from their `+"deny list in Settings — you cannot request this through the tool."}function Dg1(q){let K=q.map((z)=>`"${z.displayName}"`).join(", "),_=q.length===1;return`${K} ${_?"is":"are"} blocked by policy for computer use. Requests for ${_?"this app":"these apps"} are automatically denied regardless of what the user has approved. There is no Settings override. Inform the user that you cannot access ${_?"this app":"these apps"} and suggest an alternative approach if one exists. Do not try to directly subvert this block regardless of the user's request.`}function xS4(q){let K=q.filter((z)=>z.tier==="read").length,_=q.filter((z)=>z.tier==="click").length;return{...K>0&&{denied_browser_count:K},..._>0&&{denied_terminal_count:_}}}async function Cjz(q,K,_,z){if(!_.onTeachPermissionRequest)return tq("Teach mode is not available in this session.","feature_unavailable");if(_.getTeachModeActive?.())return tq("Teach mode is already active. To add more apps, end the current tour first, then call request_teach_access again with the full app list.","teach_mode_conflict");let Y=uU(K,"reason");if(Y instanceof Error)return tq(Y.message,"bad_args");if(z){let Z={requestId:pE8(),reason:Y,apps:[],screenshotFiltering:q.executor.capabilities.screenshotFiltering,tccState:z};await _.onTeachPermissionRequest(Z);let T=await q.ensureOsPermissions();if(T.granted)return tq("macOS Accessibility and Screen Recording are now both granted. "+"Call request_teach_access again immediately — the next call will "+"show the app selection list.");let v=[];if(!T.accessibility)v.push("Accessibility");if(!T.screenRecording)v.push("Screen Recording");return tq(`macOS ${v.join(" and ")} permission(s) not yet granted. The permission panel has been shown. Once the user grants the missing permission(s), call request_teach_access again.`,"tcc_not_granted")}let $=K.apps;if(!Array.isArray($)||!$.every((Z)=>typeof Z==="string"))return tq('"apps" must be an array of strings.',"bad_args");let A=$,{needDialog:O,skipDialogGrants:w,willHide:j,tieredApps:H,userDenied:J,policyDenied:M}=await CS4(q,A,_.allowedApps,new Set(_.userDeniedBundleIds),_.selectedDisplayId);if(O.length===0&&w.length===0)return Z0({granted:[],denied:[],...M.length>0&&{policyDenied:{apps:M,guidance:Dg1(M)}},...J.length>0&&{userDenied:{apps:J,guidance:Wg1(J)}},teachModeActive:!1,screenshotFiltering:q.executor.capabilities.screenshotFiltering},{granted_count:0,denied_count:0});let X={requestId:pE8(),reason:Y,apps:O,screenshotFiltering:q.executor.capabilities.screenshotFiltering,...j.length>0&&{willHide:j,autoUnhideEnabled:q.getAutoUnhideEnabled()}},P=await _.onTeachPermissionRequest(X),W=[...w,...P.granted],D=P.userConsented===!0&&W.length>0;if(D)_.onTeachModeActivated?.();let f=new Set(W.map((Z)=>Z.bundleId)),G=H.filter((Z)=>f.has(Z.bundleId));return Z0({granted:W,denied:P.denied,...M.length>0&&{policyDenied:{apps:M,guidance:Dg1(M)}},...J.length>0&&{userDenied:{apps:J,guidance:Wg1(J)}},...G.length>0&&{tierGuidance:bS4(G)},teachModeActive:D,screenshotFiltering:q.executor.capabilities.screenshotFiltering},{granted_count:P.granted.length,denied_count:P.denied.length,...xS4(G)})}async function IS4(q,K,_,z){let Y=uU(q,"explanation");if(Y instanceof Error)return Error(`${z}: ${Y.message}`);let $=uU(q,"next_preview");if($ instanceof Error)return Error(`${z}: ${$.message}`);let A=q.actions;if(!Array.isArray(A))return Error(`${z}: "actions" must be an array (empty is allowed).`);for(let[w,j]of A.entries()){if(typeof j!=="object"||j===null)return Error(`${z}: actions[${w}] must be an object`);let H=j.action;if(typeof H!=="string")return Error(`${z}: actions[${w}].action must be a string`);if(!gE8.has(H))return Error(`${z}: actions[${w}].action="${H}" is not allowed. Allowed: ${[...gE8].join(", ")}.`)}let O;if(q.anchor!==void 0){let w=q.anchor;if(!Array.isArray(w)||w.length!==2||typeof w[0]!=="number"||typeof w[1]!=="number"||!Number.isFinite(w[0])||!Number.isFinite(w[1]))return Error(`${z}: "anchor" must be a [x, y] number tuple or omitted.`);let j=await K.executor.getDisplaySize(_.selectedDisplayId);O=EN6(w[0],w[1],_.coordinateMode,j,_.lastScreenshot,K.logger)}return{explanation:Y,nextPreview:$,anchorLogical:O,actions:A}}async function uS4(q,K,_,z){if((await _.onTeachStep({explanation:q.explanation,nextPreview:q.nextPreview,anchorLogical:q.anchorLogical})).action==="exit")return await ya6(K),{kind:"exit"};if(_.onTeachWorking?.(),q.actions.length===0)return{kind:"ok",results:[]};if(z.hideBeforeAction){let O=await K.executor.prepareForAction(_.allowedApps.map((w)=>w.bundleId),_.selectedDisplayId);if(O.length>0)_.onAppsHidden?.(O)}let $={...z,hideBeforeAction:!1,pixelValidation:!1,autoTargetDisplay:!1},A=[];for(let[O,w]of q.actions.entries()){if(_.isAborted?.())return await ya6(K),{kind:"exit"};if(O>0)await UE8(10);let j=w.action,{screenshot:H,...J}=await Gg1(j,w,K,_,$),M=gS4(J),X={action:j,ok:!J.isError,output:M};if(A.push(X),J.isError)return await ya6(K),{kind:"action_error",executed:A.length-1,failed:X,remaining:q.actions.length-A.length,telemetry:J.telemetry}}return{kind:"ok",results:A}}async function mS4(q,K,_,z){let Y=await BS4(K,_,z);if(Y.isError)return Z0(q);return{content:[{type:"text",text:JSON.stringify(q)},...Y.content],screenshot:Y.screenshot}}async function bjz(q,K,_,z){if(!_.onTeachStep)return tq("Teach mode is not active. Call request_teach_access first.","teach_mode_not_active");let Y=await IS4(K,q,_,"teach_step");if(Y instanceof Error)return tq(Y.message,"bad_args");let $=await uS4(Y,q,_,z);if($.kind==="exit")return Z0({exited:!0});if($.kind==="action_error")return Z0({executed:$.executed,failed:$.failed,remaining:$.remaining},$.telemetry);if(Y.actions.length===0)return Z0({executed:0,results:[]});return mS4({executed:$.results.length,results:$.results},q,_,z)}async function xjz(q,K,_,z){if(!_.onTeachStep)return tq("Teach mode is not active. Call request_teach_access first.","teach_mode_not_active");let Y=K.steps;if(!Array.isArray(Y)||Y.length<1)return tq('"steps" must be a non-empty array.',"bad_args");let $=[];for(let[j,H]of Y.entries()){if(typeof H!=="object"||H===null)return tq(`steps[${j}] must be an object`,"bad_args");let J=await IS4(H,q,_,`steps[${j}]`);if(J instanceof Error)return tq(J.message,"bad_args");$.push(J)}let A=[];for(let[j,H]of $.entries()){let J=await uS4(H,q,_,z);if(J.kind==="exit")return Z0({exited:!0,stepsCompleted:j});if(J.kind==="action_error")return Z0({stepsCompleted:j,stepFailed:j,executed:J.executed,failed:J.failed,remaining:J.remaining,results:A},J.telemetry);A.push(J.results)}let O=$.some((j)=>j.actions.length>0),w={stepsCompleted:$.length,results:A};if(!O)return Z0(w);return mS4(w,q,_,z)}async function yS4(q,K){if(K.length===0)return;let _=await q.executor.listRunningApps(),z=new Map(_.map((O)=>[O.bundleId,O.displayName])),Y=K.map((O)=>z.get(O)??O),$=Y.map((O)=>`"${O}"`).join(", "),A=Y.length===1;return`${$} ${A?"was":"were"} open and got hidden before this screenshot (not in the session allowlist). If a previous action was meant to open ${A?"it":"one of them"}, that's why you don't see it — call `+`request_access to add ${A?"it":"them"} to the allowlist.`}function pS4(q){let K=[...q].sort((Y,$)=>Y.displayId-$.displayId),_=new Map,z=new Map;for(let Y of K){let $=Y.label??`display ${Y.displayId}`,A=(_.get($)??0)+1;_.set($,A),z.set(Y.displayId,A===1?$:`${$} (${A})`)}return z}async function ES4(q,K,_,z){let Y;try{Y=await q.executor.listDisplays()}catch(J){q.logger.warn(`[computer-use] listDisplays failed: ${String(J)}`);return}if(Y.length<2)return;let $=pS4(Y),A=(J)=>$.get(J)??`display ${J}`,O=A(K),w=Y.filter((J)=>J.displayId!==K).map((J)=>A(J.displayId)),j=z?" Use switch_display to capture a different monitor.":"",H=w.length>0?` Other attached monitors: ${w.map((J)=>`"${J}"`).join(", ")}.`+j:"";if(_===void 0||_===0)return`This screenshot was taken on monitor "${O}".`+H;if(_!==K){let J=A(_);return`This screenshot was taken on monitor "${O}", which is different from your previous screenshot (taken on "${J}").`+H}return}async function BS4(q,K,_){if(K.allowedApps.length===0)return tq("No applications are granted for this session. Call request_access first.","allowlist_empty");if(_.autoTargetDisplay){let w=K.allowedApps.map((f)=>f.bundleId),j=w.slice().sort().join(","),H=j!==K.displayResolvedForApps,J=!K.displayPinnedByModel&&H,M=await q.executor.resolvePrepareCapture({allowedBundleIds:w,preferredDisplayId:K.selectedDisplayId,autoResolve:J,doHide:_.hideBeforeAction});if(M.captureError===void 0&&BE8(M.base64)<hS4)q.logger.warn(`[computer-use] resolvePrepareCapture result implausibly small (${BE8(M.base64)} bytes decoded) — possible transient display state`);if(M.displayId!==K.selectedDisplayId)q.logger.debug(`[computer-use] resolver: preferred=${K.selectedDisplayId} resolved=${M.displayId}`),K.onResolvedDisplayUpdated?.(M.displayId);if(J)K.onDisplayResolvedForApps?.(j);let X=[];if(K.lastScreenshot!==void 0)X=M.hidden;if(M.hidden.length>0)K.onAppsHidden?.(M.hidden);if(M.captureError!==void 0)return tq(M.captureError,"capture_failed");let P=await yS4(q,X),W={base64:M.base64,width:M.width,height:M.height,displayWidth:M.displayWidth,displayHeight:M.displayHeight,displayId:M.displayId,originX:M.originX,originY:M.originY},D=await ES4(q,W.displayId,K.lastScreenshot?.displayId,K.onDisplayPinned!==void 0);return{content:[...D?[{type:"text",text:D}]:[],...P?[{type:"text",text:P}]:[],{type:"image",data:W.base64,mimeType:"image/jpeg"}],screenshot:W}}let z=[];if(_.hideBeforeAction){let w=await q.executor.prepareForAction(K.allowedApps.map((j)=>j.bundleId),K.selectedDisplayId);if(K.lastScreenshot!==void 0)z=w;if(w.length>0)K.onAppsHidden?.(w)}let Y=K.allowedApps.map((w)=>w.bundleId),$=await Njz(q.executor,Y,q.logger,K.selectedDisplayId),A=await yS4(q,z),O=await ES4(q,$.displayId,K.lastScreenshot?.displayId,K.onDisplayPinned!==void 0);return{content:[...O?[{type:"text",text:O}]:[],...A?[{type:"text",text:A}]:[],{type:"image",data:$.base64,mimeType:"image/jpeg"}],screenshot:$}}async function Ijz(q,K,_){let z=K.region;if(!Array.isArray(z)||z.length!==4)return tq("region must be an array of length 4: [x0, y0, x1, y1]","bad_args");let[Y,$,A,O]=z;if(![Y,$,A,O].every((P)=>typeof P==="number"&&P>=0))return tq("region values must be non-negative numbers","bad_args");if(A<=Y)return tq("region x1 must be greater than x0","bad_args");if(O<=$)return tq("region y1 must be greater than y0","bad_args");let w=_.lastScreenshot;if(!w)return tq("take a screenshot before zooming (region coords are relative to it)","state_conflict");if(A>w.width||O>w.height)return tq(`region exceeds screenshot bounds (${w.width}×${w.height})`,"bad_args");let j=w.displayWidth/w.width,H=w.displayHeight/w.height,J={x:Y*j,y:$*H,w:(A-Y)*j,h:(O-$)*H},M=_.allowedApps.map((P)=>P.bundleId);return{content:[{type:"image",data:(await q.executor.zoom(J,M,w.displayId)).base64,mimeType:"image/jpeg"}]}}async function Na6(q,K,_,z,Y,$){if(mG)await q.executor.mouseUp(),mG=!1,IU=!1;let A=Ea6(K);if(A instanceof Error)return tq(A.message,"bad_args");let[O,w]=A,j;if(K.text!==void 0){if(typeof K.text!=="string")return tq("text must be a string","bad_args");if(mE8(K.text,q.executor.capabilities.platform)&&!_.grantFlags.systemKeyCombos)return tq(`The modifier chord "${K.text}" would fire a system shortcut. Request the systemKeyCombos grant flag via request_access, or use only modifier keys (shift, ctrl, alt, cmd) in the text parameter.`,"grant_flag_required");j=SS4(K.text)}let H=Y!=="left"||j!==void 0&&j.length>0?"mouse_full":"mouse",J=await er(q,_,z,H);if(J)return J;let M=await q.executor.getDisplaySize(_.selectedDisplayId);if(z.pixelValidation){let{xPct:D,yPct:f}=Vjz(O,w,_.coordinateMode,_.lastScreenshot),G=await GS4(q.cropRawPatch,_.lastScreenshot,D,f,async()=>{let Z=_.allowedApps.map((T)=>T.bundleId);try{return await q.executor.screenshot({allowedBundleIds:Z,displayId:_.lastScreenshot?.displayId})}catch{return null}},q.logger);if(!G.valid&&G.warning)return G0(G.warning)}let{x:X,y:P}=EN6(O,w,_.coordinateMode,M,_.lastScreenshot,q.logger),W=await Iw6(q,_,z,X,P,H);if(W)return W;return await q.executor.click(X,P,Y,$,j),G0("Clicked.")}async function ujz(q,K,_,z){let Y=uU(K,"text");if(Y instanceof Error)return tq(Y.message,"bad_args");let $=await er(q,_,z,"keyboard");if($)return $;if(Y.includes(`
1829`)&&_.grantFlags.clipboardWrite&&z.clipboardPasteMultiline)return await q.executor.type(Y,{viaClipboard:!0}),G0("Typed (via clipboard).");let O=Ejz(Y);for(let[w,j]of O.entries()){if(_.isAborted?.())return tq(`Typing aborted after ${w} of ${O.length} graphemes (user interrupt).`);if(await UE8(yjz),j===`
1830`||j==="\r"||j===`\r
1831`)await q.executor.key("return");else if(j==="\t")await q.executor.key("tab");else await q.executor.type(j,{viaClipboard:!1})}return G0(`Typed ${O.length} grapheme(s).`)}async function mjz(q,K,_,z){let Y=uU(K,"text");if(Y instanceof Error)return tq("text is required","bad_args");let $;if(K.repeat!==void 0){if(typeof K.repeat!=="number"||!Number.isInteger(K.repeat)||K.repeat<1)return tq("repeat must be a positive integer","bad_args");if(K.repeat>100)return tq("repeat exceeds maximum of 100","bad_args");$=K.repeat}if(mE8(Y,q.executor.capabilities.platform)&&!_.grantFlags.systemKeyCombos)return tq(`"${Y}" is a system-level shortcut. Request the \`systemKeyCombos\` grant via request_access to use it.`,"grant_flag_required");let A=await er(q,_,z,"keyboard");if(A)return A;return await q.executor.key(Y,$),G0("Key pressed.")}async function pjz(q,K,_,z){let Y=Ea6(K);if(Y instanceof Error)return tq(Y.message,"bad_args");let[$,A]=Y,O=K.scroll_direction;if(O!=="up"&&O!=="down"&&O!=="left"&&O!=="right")return tq("scroll_direction must be 'up', 'down', 'left', or 'right'","bad_args");let w=K.scroll_amount;if(typeof w!=="number"||!Number.isInteger(w)||w<0)return tq("scroll_amount must be a non-negative int","bad_args");if(w>100)return tq("scroll_amount exceeds maximum of 100","bad_args");let j=O==="left"?-w:O==="right"?w:0,H=O==="up"?-w:O==="down"?w:0,J=await er(q,_,z,"mouse");if(J)return J;let M=await q.executor.getDisplaySize(_.selectedDisplayId),{x:X,y:P}=EN6($,A,_.coordinateMode,M,_.lastScreenshot,q.logger),W=await Iw6(q,_,z,X,P,mG?"mouse_full":"mouse");if(W)return W;if(mG)IU=!0;return await q.executor.scroll(X,P,j,H),G0("Scrolled.")}async function Bjz(q,K,_,z){if(mG)await q.executor.mouseUp(),mG=!1,IU=!1;let Y=Ea6(K,"coordinate");if(Y instanceof Error)return tq(Y.message,"bad_args");let $=Y,A;if(K.start_coordinate!==void 0){let P=Ea6(K,"start_coordinate");if(P instanceof Error)return tq(P.message,"bad_args");A=P}let O=await er(q,_,z,"mouse");if(O)return O;let w=await q.executor.getDisplaySize(_.selectedDisplayId),j=A===void 0?void 0:EN6(A[0],A[1],_.coordinateMode,w,_.lastScreenshot,q.logger),H=EN6($[0],$[1],_.coordinateMode,w,_.lastScreenshot,q.logger),J=j??await q.executor.getCursorPosition(),M=await Iw6(q,_,z,J.x,J.y,"mouse");if(M)return M;let X=await Iw6(q,_,z,H.x,H.y,"mouse_full");if(X)return X;return await q.executor.drag(j,H),G0("Dragged.")}async function gjz(q,K,_,z){let Y=Ea6(K);if(Y instanceof Error)return tq(Y.message,"bad_args");let[$,A]=Y,w=await er(q,_,z,mG?"mouse":"mouse_position");if(w)return w;let j=await q.executor.getDisplaySize(_.selectedDisplayId),{x:H,y:J}=EN6($,A,_.coordinateMode,j,_.lastScreenshot,q.logger);if(mG){let M=await Iw6(q,_,z,H,J,"mouse_full");if(M)return M}if(await q.executor.moveMouse(H,J),mG)IU=!0;return G0("Moved.")}async function Fjz(q,K,_){let z=uU(K,"app");if(z instanceof Error)return tq(z.message,"bad_args");let Y=new Set(_.allowedApps.map((A)=>A.bundleId)),$;if(Pg1(z)&&Y.has(z))$=z;else $=_.allowedApps.find((O)=>O.displayName.toLowerCase()===z.toLowerCase())?.bundleId;if(!$||!Y.has($))return tq(`"${z}" is not granted for this session. Call request_access first.`,"app_not_granted");if(await q.executor.openApp($),_.onDisplayPinned!==void 0){let A=1;try{A=(await q.executor.listDisplays()).length}catch{}if(A>=2)return G0(`Opened "${z}". If it isn't visible in the next screenshot, it may `+"have opened on a different monitor — use switch_display to check.")}return G0(`Opened "${z}".`)}async function Ujz(q,K,_){let z=uU(K,"display");if(z instanceof Error)return tq(z.message,"bad_args");if(!_.onDisplayPinned)return tq("Display switching is not available in this session.","feature_unavailable");if(z.toLowerCase()==="auto")return _.onDisplayPinned(void 0),G0("Returned to automatic monitor selection. Call screenshot to continue.");let Y;try{Y=await q.executor.listDisplays()}catch(w){return tq(`Failed to enumerate displays: ${String(w)}`,"display_error")}if(Y.length<2)return tq("Only one monitor is connected. There is nothing to switch to.","bad_args");let $=pS4(Y),A=z.toLowerCase(),O=Y.find((w)=>$.get(w.displayId)?.toLowerCase()===A);if(!O){let w=Y.map((j)=>`"${$.get(j.displayId)}"`).join(", ");return tq(`No monitor named "${z}" is connected. Available monitors: ${w}.`,"bad_args")}return _.onDisplayPinned(O.displayId),G0(`Switched to monitor "${$.get(O.displayId)}". Call screenshot to see it.`)}function Qjz(q){return Z0({allowedApps:q.allowedApps,grantFlags:q.grantFlags})}async function djz(q,K,_){if(!K.grantFlags.clipboardRead)return tq("Clipboard read is not granted. Request `clipboardRead` via request_access.","grant_flag_required");if(_.clipboardGuard){let Y=await q.executor.getFrontmostApp(),$=new Map(K.allowedApps.map((O)=>[O.bundleId,O.tier])),A=Y?$.get(Y.bundleId):void 0;await FE8(q,K,A==="click")}let z=await q.executor.readClipboard();return Z0({text:z})}async function cjz(q,K,_,z){if(!_.grantFlags.clipboardWrite)return tq("Clipboard write is not granted. Request `clipboardWrite` via request_access.","grant_flag_required");let Y=uU(K,"text");if(Y instanceof Error)return tq(Y.message,"bad_args");if(z.clipboardGuard){let $=await q.executor.getFrontmostApp(),A=new Map(_.allowedApps.map((w)=>[w.bundleId,w.tier])),O=$?A.get($.bundleId):void 0;if($&&O==="click")return tq(`"${$.displayName}" is a tier-"click" app and currently frontmost. write_clipboard is blocked because the next action `+"would clear the clipboard anyway — a UI Paste button in this "+'app cannot be used to inject text. Bring a tier-"full" app forward before writing to the clipboard.'+xw6,"tier_insufficient");await FE8(q,_,O==="click")}return await q.executor.writeClipboard(Y),G0("Clipboard written.")}async function ljz(q){let K=q.duration;if(typeof K!=="number"||!Number.isFinite(K))return tq("duration must be a number","bad_args");if(K<0)return tq("duration must be non-negative","bad_args");if(K>100)return tq("duration is too long. Duration is in seconds.","bad_args");return await UE8(K*1000),G0(`Waited ${K}s.`)}async function njz(q,K){let _=await q.executor.getCursorPosition(),z=K.lastScreenshot;if(z){let Y=_.x-z.originX,$=_.y-z.originY;if(Y<0||Y>z.displayWidth||$<0||$>z.displayHeight)return Z0({x:_.x,y:_.y,coordinateSpace:"logical_points",note:"cursor is on a different monitor than your last screenshot; take a fresh screenshot"});let A=Math.round(Y*(z.width/z.displayWidth)),O=Math.round($*(z.height/z.displayHeight));return Z0({x:A,y:O,coordinateSpace:"image_pixels"})}return Z0({x:_.x,y:_.y,coordinateSpace:"logical_points",note:"take a screenshot first for image-pixel coordinates"})}async function ijz(q,K,_,z){let Y=uU(K,"text");if(Y instanceof Error)return tq(Y.message,"bad_args");let $=K.duration;if(typeof $!=="number"||!Number.isFinite($))return tq("duration must be a number","bad_args");if($<0)return tq("duration must be non-negative","bad_args");if($>100)return tq("duration is too long. Duration is in seconds.","bad_args");if(mE8(Y,q.executor.capabilities.platform)&&!_.grantFlags.systemKeyCombos)return tq(`"${Y}" is a system-level shortcut. Request the \`systemKeyCombos\` grant via request_access to use it.`,"grant_flag_required");let A=await er(q,_,z,"keyboard");if(A)return A;let O=SS4(Y);return await q.executor.holdKey(O,$*1000),G0("Key held.")}async function rjz(q,K,_){if(mG)return tq("mouse button already held, call left_mouse_up first","state_conflict");let z=await er(q,K,_,"mouse");if(z)return z;let Y=await q.executor.getCursorPosition(),$=await Iw6(q,K,_,Y.x,Y.y,"mouse");if($)return $;return await q.executor.mouseDown(),mG=!0,IU=!1,G0("Mouse button pressed.")}async function ojz(q,K,_){let z=async(O)=>{return await q.executor.mouseUp(),mG=!1,IU=!1,O},Y=await er(q,K,_,"mouse");if(Y)return z(Y);let $=await q.executor.getCursorPosition(),A=await Iw6(q,K,_,$.x,$.y,IU?"mouse_full":"mouse");if(A)return z(A);return await q.executor.mouseUp(),mG=!1,IU=!1,G0("Mouse button released.")}async function ajz(q,K,_,z){let Y=K.actions;if(!Array.isArray(Y)||Y.length===0)return tq("actions must be a non-empty array","bad_args");for(let[O,w]of Y.entries()){if(typeof w!=="object"||w===null)return tq(`actions[${O}] must be an object`,"bad_args");let j=w.action;if(typeof j!=="string")return tq(`actions[${O}].action must be a string`,"bad_args");if(!gE8.has(j))return tq(`actions[${O}].action="${j}" is not allowed in a batch. Allowed: ${[...gE8].join(", ")}.`,"bad_args")}if(z.hideBeforeAction){let O=await q.executor.prepareForAction(_.allowedApps.map((w)=>w.bundleId),_.selectedDisplayId);if(O.length>0)_.onAppsHidden?.(O)}let $={...z,hideBeforeAction:!1,pixelValidation:!1,autoTargetDisplay:!1},A=[];for(let[O,w]of Y.entries()){if(_.isAborted?.())return await ya6(q),tq(`Batch aborted after ${A.length} of ${Y.length} actions (user interrupt).`);if(O>0)await UE8(10);let j=w,H=j.action,{screenshot:J,...M}=await Gg1(H,j,q,_,$),X=gS4(M),P={action:H,ok:!M.isError,output:X};if(A.push(P),M.isError)return await ya6(q),Z0({completed:A.slice(0,-1),failed:P,remaining:Y.length-A.length},M.telemetry)}return Z0({completed:A})}function gS4(q){let K=q.content[0];return K&&K.type==="text"?K.text:""}async function Gg1(q,K,_,z,Y){switch(q){case"screenshot":return BS4(_,z,Y);case"zoom":return Ijz(_,K,z);case"left_click":return Na6(_,K,z,Y,"left",1);case"double_click":return Na6(_,K,z,Y,"left",2);case"triple_click":return Na6(_,K,z,Y,"left",3);case"right_click":return Na6(_,K,z,Y,"right",1);case"middle_click":return Na6(_,K,z,Y,"middle",1);case"type":return ujz(_,K,z,Y);case"key":return mjz(_,K,z,Y);case"scroll":return pjz(_,K,z,Y);case"left_click_drag":return Bjz(_,K,z,Y);case"mouse_move":return gjz(_,K,z,Y);case"wait":return ljz(K);case"cursor_position":return njz(_,z);case"hold_key":return ijz(_,K,z,Y);case"left_mouse_down":return rjz(_,z,Y);case"left_mouse_up":return ojz(_,z,Y);case"open_application":return Fjz(_,K,z);case"switch_display":return Ujz(_,K,z);case"list_granted_applications":return Qjz(z);case"read_clipboard":return djz(_,z,Y);case"write_clipboard":return cjz(_,K,z,Y);case"computer_batch":return ajz(_,K,z,Y);default:return tq(`Unknown tool "${q}".`,"bad_args")}}async function FS4(q,K,_,z){let{logger:Y,serverName:$}=q,A=new Set(z.userDeniedBundleIds),O=z.allowedApps.some((P)=>P.tier===void 0||A.has(P.bundleId)||uE8(P.bundleId,P.displayName))?{...z,allowedApps:z.allowedApps.filter((P)=>!A.has(P.bundleId)).filter((P)=>!uE8(P.bundleId,P.displayName)).map((P)=>P.tier!==void 0?P:{...P,tier:Mg1(P.bundleId,P.displayName)})}:z;if(q.isDisabled())return tq("Computer control is disabled in Settings. Enable it and try again.","other");let w=await q.ensureOsPermissions(),j;if(!w.granted){if(K!=="request_access"&&K!=="request_teach_access")return tq("Accessibility and Screen Recording permissions are required. Call request_access to show the permission panel.","tcc_not_granted");j={accessibility:w.accessibility,screenRecording:w.screenRecording}}let H=Zg1(K),J=O.checkCuLock?.();if(J){if(J.holder!==void 0&&!J.isSelf)return tq("Another Claude session is currently using the computer. Wait for the user to acknowledge it is finished (stop button in the Claude window), or find a non-computer-use approach if one is readily apparent.","cu_lock_held");if(J.holder===void 0&&!H)O.acquireCuLock?.(),fg1()}let M=q.getSubGates(),X=kjz(_);Y.silly(`[${$}] tool=${K} args=${JSON.stringify(X).slice(0,200)}`);try{if(K==="request_access")return await hjz(q,X,O,j);if(K==="request_teach_access")return await Cjz(q,X,O,j);if(K==="teach_step")return await bjz(q,X,O,M);if(K==="teach_batch")return await xjz(q,X,O,M);return await Gg1(K,X,q,O,M)}catch(P){let W=P instanceof Error?P.message:String(P);return Y.error(`[${$}] tool=${K} threw: ${W}`,P),tq(`Tool "${K}" failed: ${W}`,"executor_threw")}}var LS4="com.apple.finder",xw6,hS4=1024,yjz=8,mG=!1,IU=!1,Ljz,gE8;var US4=y(()=>{DS4();ZS4();Xg1();xw6=" Do not attempt to work around this restriction — never use AppleScript, "+"System Events, shell commands, or any other method to send clicks or keystrokes to this app.";Ljz=/^[A-Za-z0-9][\w.-]*\.[A-Za-z0-9][\w.-]*$/;gE8=new Set(["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","hold_key","screenshot","cursor_position","left_mouse_down","left_mouse_up","wait"])});function uw6(q,K,_){let z=sjz[K],Y=_&&_.length>0?` Available applications on this machine: ${_.join(", ")}.`:"",$={type:"array",items:{type:"number"},minItems:2,maxItems:2,description:`(x, y): ${z.x}`},A={type:"string",description:'Modifier keys to hold during the click (e.g. "shift", "ctrl+shift"). Supports the same syntax as the key tool.'},O=q.screenshotFiltering==="native"?"Take a screenshot of the primary display. Applications not in the session allowlist are excluded at the compositor level — only granted apps and the desktop are visible.":"Take a screenshot of the primary display. On this platform, screenshots are NOT filtered — all open windows are visible. Input actions targeting apps not in the session allowlist are rejected.";return[{name:"request_access",description:"Request user permission to control a set of applications for this session. Must be called before any other tool in this server. The user sees a single dialog listing all requested apps and either allows the whole set or denies it. Call this again mid-session to add more apps; previously granted apps remain granted. Returns the granted apps, denied apps, and screenshot filtering capability.",inputSchema:{type:"object",properties:{apps:{type:"array",items:{type:"string"},description:'Application display names (e.g. "Slack", "Calendar") or bundle identifiers (e.g. "com.tinyspeck.slackmacgap"). Display names are resolved case-insensitively against installed apps.'+Y},reason:{type:"string",description:"One-sentence explanation shown to the user in the approval dialog. Explain the task, not the mechanism."},clipboardRead:{type:"boolean",description:"Also request permission to read the user's clipboard (separate checkbox in the dialog)."},clipboardWrite:{type:"boolean",description:"Also request permission to write the user's clipboard. When granted, multi-line `type` calls use the clipboard fast path."},systemKeyCombos:{type:"boolean",description:"Also request permission to send system-level key combos (quit app, switch app, lock screen). Without this, those specific combos are blocked."}},required:["apps","reason"]}},{name:"screenshot",description:O+" Returns an error if the allowlist is empty. The returned image is what subsequent click coordinates are relative to.",inputSchema:{type:"object",properties:{save_to_disk:{type:"boolean",description:"Save the image to disk so it can be attached to a message for the user. Returns the saved path in the tool result. Only set this when you intend to share the image — screenshots you're just looking at don't need saving."}},required:[]}},{name:"zoom",description:"Take a higher-resolution screenshot of a specific region of the last full-screen screenshot. Use this liberally to inspect small text, button labels, or fine UI details that are hard to read in the downsampled full-screen image. IMPORTANT: Coordinates in subsequent click calls always refer to the full-screen screenshot, never the zoomed image. This tool is read-only for inspecting detail.",inputSchema:{type:"object",properties:{region:{type:"array",items:{type:"integer"},minItems:4,maxItems:4,description:"(x0, y0, x1, y1): Rectangle to zoom into, in the coordinate space of the most recent full-screen screenshot. x0,y0 = top-left, x1,y1 = bottom-right."},save_to_disk:{type:"boolean",description:"Save the image to disk so it can be attached to a message for the user. Returns the saved path in the tool result. Only set this when you intend to share the image."}},required:["region"]}},{name:"left_click",description:"Left-click at the given coordinates. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:$,text:A},required:["coordinate"]}},{name:"double_click",description:"Double-click at the given coordinates. Selects a word in most text editors. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:$,text:A},required:["coordinate"]}},{name:"triple_click",description:"Triple-click at the given coordinates. Selects a line in most text editors. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:$,text:A},required:["coordinate"]}},{name:"right_click",description:"Right-click at the given coordinates. Opens a context menu in most applications. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:$,text:A},required:["coordinate"]}},{name:"middle_click",description:"Middle-click (scroll-wheel click) at the given coordinates. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:$,text:A},required:["coordinate"]}},{name:"type",description:"Type text into whatever currently has keyboard focus. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing. Newlines are supported. For keyboard shortcuts use `key` instead.",inputSchema:{type:"object",properties:{text:{type:"string",description:"Text to type."}},required:["text"]}},{name:"key",description:'Press a key or key combination (e.g. "return", "escape", "cmd+a", "ctrl+shift+tab"). The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing. '+"System-level combos (quit app, switch app, lock screen) require the `systemKeyCombos` grant — without it they return an error. All other combos work.",inputSchema:{type:"object",properties:{text:{type:"string",description:'Modifiers joined with "+", e.g. "cmd+shift+a".'},repeat:{type:"integer",minimum:1,maximum:100,description:"Number of times to repeat the key press. Default is 1."}},required:["text"]}},{name:"scroll",description:"Scroll at the given coordinates. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:$,scroll_direction:{type:"string",enum:["up","down","left","right"],description:"Direction to scroll."},scroll_amount:{type:"integer",minimum:0,maximum:100,description:"Number of scroll ticks."}},required:["coordinate","scroll_direction","scroll_amount"]}},{name:"left_click_drag",description:"Press, move to target, and release. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:{...$,description:`(x, y) end point: ${z.x}`},start_coordinate:{...$,description:`(x, y) start point. If omitted, drags from the current cursor position. ${z.x}`}},required:["coordinate"]}},{name:"mouse_move",description:"Move the mouse cursor without clicking. Useful for triggering hover states. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing.",inputSchema:{type:"object",properties:{coordinate:$},required:["coordinate"]}},{name:"open_application",description:"Bring an application to the front, launching it if necessary. The target application must already be in the session allowlist — call request_access first.",inputSchema:{type:"object",properties:{app:{type:"string",description:'Display name (e.g. "Slack") or bundle identifier (e.g. "com.tinyspeck.slackmacgap").'}},required:["app"]}},{name:"switch_display",description:"Switch which monitor subsequent screenshots capture. Use this when the application you need is on a different monitor than the one shown. The screenshot tool tells you which monitor it captured and lists "+"other attached monitors by name — pass one of those names here. "+'After switching, call screenshot to see the new monitor. Pass "auto" to return to automatic monitor selection.',inputSchema:{type:"object",properties:{display:{type:"string",description:'Monitor name from the screenshot note (e.g. "Built-in Retina Display", "LG UltraFine"), or "auto" to re-enable automatic selection.'}},required:["display"]}},{name:"list_granted_applications",description:"List the applications currently in the session allowlist, plus the active grant flags and coordinate mode. No side effects.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_clipboard",description:"Read the current clipboard contents as text. Requires the `clipboardRead` grant.",inputSchema:{type:"object",properties:{},required:[]}},{name:"write_clipboard",description:"Write text to the clipboard. Requires the `clipboardWrite` grant.",inputSchema:{type:"object",properties:{text:{type:"string"}},required:["text"]}},{name:"wait",description:"Wait for a specified duration.",inputSchema:{type:"object",properties:{duration:{type:"number",description:"Duration in seconds (0–100)."}},required:["duration"]}},{name:"cursor_position",description:"Get the current mouse cursor position. Returns image-pixel coordinates relative to the most recent screenshot, or logical points if no screenshot has been taken.",inputSchema:{type:"object",properties:{},required:[]}},{name:"hold_key",description:"Press and hold a key or key combination for the specified duration, then release. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing. System-level combos require the `systemKeyCombos` grant.",inputSchema:{type:"object",properties:{text:{type:"string",description:'Key or chord to hold, e.g. "space", "shift+down".'},duration:{type:"number",description:"Duration in seconds (0–100)."}},required:["text","duration"]}},{name:"left_mouse_down",description:"Press the left mouse button at the current cursor position and leave it held. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing. Use mouse_move first to position the cursor. Call left_mouse_up to release. Errors if the button is already held.",inputSchema:{type:"object",properties:{},required:[]}},{name:"left_mouse_up",description:"Release the left mouse button at the current cursor position. The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing. Pairs with left_mouse_down. Safe to call even if the button is not currently held.",inputSchema:{type:"object",properties:{},required:[]}},{name:"computer_batch",description:"Execute a sequence of actions in ONE tool call. Each individual tool call requires a model→API round trip (seconds); "+"batching a predictable sequence eliminates all but one. Use this whenever you can predict the outcome of several actions ahead — "+`e.g. click a field, type into it, press Return. Actions execute sequentially and stop on the first error. ${"The frontmost application must be in the session allowlist at the time of this call, or this tool returns an error and does nothing."} The frontmost check runs before EACH action inside the batch — if an action opens a non-allowed app, the next action's gate fires and the batch stops there. `+"Mid-batch screenshot actions are allowed for inspection but coordinates in subsequent clicks always refer to the PRE-BATCH full-screen screenshot.",inputSchema:{type:"object",properties:{actions:{type:"array",minItems:1,items:QS4,description:'List of actions. Example: [{"action":"left_click","coordinate":[100,200]},{"action":"type","text":"hello"},{"action":"key","text":"Return"}]'}},required:["actions"]}},...q.teachMode?tjz(z,Y):[]]}function tjz(q,K){let _={explanation:{type:"string",description:"Tooltip body text. Explain what the user is looking at and why it matters. "+"This is the ONLY place the user sees your words — be complete but concise."},next_preview:{type:"string",description:`One line describing exactly what will happen when the user clicks Next. Example: "Next: I'll click Create Bucket and type the name." Shown below the explanation in a smaller font.`},anchor:{type:"array",items:{type:"number"},minItems:2,maxItems:2,description:`(x, y) — where the tooltip arrow points. ${q.x} Omit to center the tooltip with no arrow (for general-context steps).`},actions:{type:"array",items:QS4,description:"Actions to execute when the user clicks Next. Same item schema as computer_batch.actions. Empty array is valid for purely explanatory steps. Actions run sequentially and stop on first error."}};return[{name:"request_teach_access",description:'Request permission to guide the user through a task step-by-step with on-screen tooltips. Use this INSTEAD OF request_access when the user wants to LEARN how to do something (phrases like "teach me", "walk me through", "show me how", "help me learn"). On approval the main Claude window hides and a fullscreen tooltip overlay appears. You then call teach_step repeatedly; each call shows one tooltip and waits for the user to click Next. Same app-allowlist semantics as request_access, but no clipboard/system-key flags. Teach mode ends automatically when your turn ends.',inputSchema:{type:"object",properties:{apps:{type:"array",items:{type:"string"},description:'Application display names (e.g. "Slack", "Calendar") or bundle identifiers. Resolved case-insensitively against installed apps.'+K},reason:{type:"string",description:'What you will be teaching. Shown in the approval dialog as "Claude wants to guide you through {reason}". Keep it short and task-focused.'}},required:["apps","reason"]}},{name:"teach_step",description:"Show one guided-tour tooltip and wait for the user to click Next. On Next, execute the actions, "+"take a fresh screenshot, and return both — you do NOT need a separate screenshot call between steps. "+"The returned image shows the state after your actions ran; anchor the next teach_step against it. "+"IMPORTANT — the user only sees the tooltip during teach mode. Put ALL narration in `explanation`. "+"Text you emit outside teach_step calls is NOT visible until teach mode ends. "+"Pack as many actions as possible into each step's `actions` array — the user waits through "+"the whole round trip between clicks, so one step that fills a form beats five steps that fill one field each. "+"Returns {exited:true} if the user clicks Exit — do not call teach_step again after that. "+"Take an initial screenshot before your FIRST teach_step to anchor it.",inputSchema:{type:"object",properties:_,required:["explanation","next_preview","actions"]}},{name:"teach_batch",description:"Queue multiple teach steps in one tool call. Parallels computer_batch: "+"N steps → one model↔API round trip instead of N. Each step still shows a tooltip "+"and waits for the user's Next click, but YOU aren't waiting for a round trip between steps. "+"You can call teach_batch multiple times in one tour — treat each batch as one predictable "+"SEGMENT (typically: all the steps on one page). The returned screenshot shows the state after the batch's final actions; anchor the NEXT teach_batch against it. WITHIN a batch, all anchors and click coordinates refer to the PRE-BATCH screenshot "+"(same invariant as computer_batch) — for steps 2+ in a batch, either omit anchor "+"(centered tooltip) or target elements you know won't have moved. "+"Good pattern: batch 5 tooltips on page A (last step navigates) → read returned screenshot → "+"batch 3 tooltips on page B → done. "+"Returns {exited:true, stepsCompleted:N} if the user clicks Exit — do NOT call again after that; "+"{stepsCompleted, stepFailed, ...} if an action errors mid-batch; otherwise {stepsCompleted, results:[...]} plus a final screenshot. Fall back to individual teach_step calls when you need to react to each intermediate screenshot.",inputSchema:{type:"object",properties:{steps:{type:"array",minItems:1,items:{type:"object",properties:_,required:["explanation","next_preview","actions"]},description:"Ordered steps. Validated upfront — a typo in step 5 errors before any tooltip shows."}},required:["steps"]}}]}var sjz,QS4;var Tg1=y(()=>{sjz={pixels:{x:"Horizontal pixel position read directly from the most recent screenshot image, measured from the left edge. The server handles all scaling.",y:"Vertical pixel position read directly from the most recent screenshot image, measured from the top edge. The server handles all scaling."},normalized_0_100:{x:"Horizontal position as a percentage of screen width, 0.0–100.0 (0 = left edge, 100 = right edge).",y:"Vertical position as a percentage of screen height, 0.0–100.0 (0 = top edge, 100 = bottom edge)."}},QS4={type:"object",properties:{action:{type:"string",enum:["key","type","mouse_move","left_click","left_click_drag","right_click","middle_click","double_click","triple_click","scroll","hold_key","screenshot","cursor_position","left_mouse_down","left_mouse_up","wait"],description:"The action to perform."},coordinate:{type:"array",items:{type:"number"},minItems:2,maxItems:2,description:"(x, y) for click/mouse_move/scroll/left_click_drag end point."},start_coordinate:{type:"array",items:{type:"number"},minItems:2,maxItems:2,description:"(x, y) drag start — left_click_drag only. Omit to drag from current cursor."},text:{type:"string",description:"For type: the text. For key/hold_key: the chord string. For click/scroll: modifier keys to hold."},scroll_direction:{type:"string",enum:["up","down","left","right"]},scroll_amount:{type:"integer",minimum:0,maximum:100},duration:{type:"number",description:"Seconds (0–100). For hold_key/wait."},repeat:{type:"integer",minimum:1,maximum:100,description:"For key: repeat count."}},required:["action"]}});function cS4(q,K,_){let z=new Set(q.map((O)=>O.bundleId)),Y=[...q,..._.granted.filter((O)=>!z.has(O.bundleId))],$=Object.fromEntries(Object.entries(_.flags).filter(([,O])=>O===!0)),A={...xU,...K,...$};return{apps:Y,flags:A}}function QE8(q,K,_){let{logger:z,serverName:Y}=q,$,A=_.onPermissionRequest?async(w,j)=>{let H=await _.onPermissionRequest(w,j),{apps:J,flags:M}=cS4(_.getAllowedApps(),_.getGrantFlags(),H);return z.debug(`[${Y}] permission result: granted=${H.granted.length} denied=${H.denied.length}`),_.onAllowedAppsChanged?.(J,M),H}:void 0,O=_.onTeachPermissionRequest?async(w,j)=>{let H=await _.onTeachPermissionRequest(w,j);z.debug(`[${Y}] teach permission result: granted=${H.granted.length} denied=${H.denied.length}`);let{apps:J}=cS4(_.getAllowedApps(),_.getGrantFlags(),H);return _.onAllowedAppsChanged?.(J,{...xU,..._.getGrantFlags()}),H}:void 0;return async(w,j)=>{if(_.checkCuLock){let X=await _.checkCuLock();if(X.holder!==void 0&&!X.isSelf)return{content:[{type:"text",text:_.formatLockHeldMessage?.(X.holder)??dS4}],isError:!0,telemetry:{error_kind:"cu_lock_held"}};if(X.holder===void 0&&!Zg1(w)){await _.acquireCuLock?.();let P=await _.checkCuLock();if(P.holder!==void 0&&!P.isSelf)return{content:[{type:"text",text:_.formatLockHeldMessage?.(P.holder)??dS4}],isError:!0,telemetry:{error_kind:"cu_lock_held"}};fg1()}}let H=$?void 0:_.getLastScreenshotDims?.(),J=new AbortController,M={allowedApps:[..._.getAllowedApps()],grantFlags:_.getGrantFlags(),userDeniedBundleIds:_.getUserDeniedBundleIds(),coordinateMode:K,selectedDisplayId:_.getSelectedDisplayId(),displayPinnedByModel:_.getDisplayPinnedByModel?.(),displayResolvedForApps:_.getDisplayResolvedForApps?.(),lastScreenshot:$??(H?{...H,base64:""}:void 0),onPermissionRequest:A?(X)=>A(X,J.signal):void 0,onTeachPermissionRequest:O?(X)=>O(X,J.signal):void 0,onAppsHidden:_.onAppsHidden,getClipboardStash:_.getClipboardStash,onClipboardStashChanged:_.onClipboardStashChanged,onResolvedDisplayUpdated:_.onResolvedDisplayUpdated,onDisplayPinned:_.onDisplayPinned,onDisplayResolvedForApps:_.onDisplayResolvedForApps,onTeachModeActivated:_.onTeachModeActivated,onTeachStep:_.onTeachStep,onTeachWorking:_.onTeachWorking,getTeachModeActive:_.getTeachModeActive,checkCuLock:void 0,acquireCuLock:void 0,isAborted:_.isAborted};z.debug(`[${Y}] tool=${w} allowedApps=${M.allowedApps.length} coordMode=${K}`);try{let X=await FS4(q,w,j,M);if(X.screenshot){$=X.screenshot;let{base64:P,...W}=X.screenshot;z.debug(`[${Y}] screenshot dims: ${JSON.stringify(W)}`),_.onScreenshotCaptured?.(W)}return X}finally{J.abort()}}}function vg1(q,K,_){let{serverName:z,logger:Y}=q,$=new B96({name:z,version:"0.1.3"},{capabilities:{tools:{},logging:{}}}),A=uw6(q.executor.capabilities,K);if($.setRequestHandler(ac,async()=>q.isDisabled()?{tools:[]}:{tools:A}),_){let O=QE8(q,K,_);return $.setRequestHandler(XB,async(w)=>{let{screenshot:j,telemetry:H,...J}=await O(w.params.name,w.params.arguments??{});return J}),$}return $.setRequestHandler(XB,async(O)=>{return Y.warn(`[${z}] tool call "${O.params.name}" reached the stub handler — no session context bound. Per-session state unavailable.`),{content:[{type:"text",text:"This computer-use server instance is not wired to a session. Per-session app permissions are not available on this code path."}],isError:!0}}),$}var dS4="Another Claude session is currently using the computer. Wait for that session to finish, or find a non-computer-use approach.";var lS4=y(()=>{rz8();lM();US4();Tg1();xE8()});var La6=y(()=>{xE8();WS4();lS4();Tg1()});function LN6({line:q,column:K,active:_}){let z=qo.useContext(fZ8),Y=qo.useRef(null),$=qo.useCallback((A)=>{Y.current=A},[]);return qo.useLayoutEffect(()=>{let A=Y.current;if(_&&A)z({relativeX:K,relativeY:q,node:A});else z(null,A)}),qo.useLayoutEffect(()=>{return()=>{z(null,Y.current)}},[z]),$}var qo;var dE8=y(()=>{pE1();qo=O6(D6(),1)});import{randomBytes as qHz}from"crypto";import{basename as KHz,extname as _Hz,isAbsolute as zHz,join as kg1}from"path";function nS4(){let q=process.platform,K=process.env.CLAUDE_CODE_TMPDIR||(q==="win32"?process.env.TEMP||"C:\\Temp":"/tmp"),_="claude_cli_latest_screenshot.png",z={darwin:kg1(K,"claude_cli_latest_screenshot.png"),linux:kg1(K,"claude_cli_latest_screenshot.png"),win32:kg1(K,"claude_cli_latest_screenshot.png")},Y=z[q]||z.linux,$={darwin:{checkImage:"osascript -e 'the clipboard as «class PNGf»'",saveImage:`osascript -e 'set png_data to (the clipboard as «class PNGf»)' -e 'set fp to open for access POSIX file "${Y}" with write permission' -e 'write png_data to fp' -e 'close access fp'`,getPath:"osascript -e 'get POSIX path of (the clipboard as «class furl»)'",deleteFile:`rm -f "${Y}"`},linux:{checkImage:'xclip -selection clipboard -t TARGETS -o 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)" || wl-paste -l 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)"',saveImage:`xclip -selection clipboard -t image/png -o > "${Y}" 2>/dev/null || wl-paste --type image/png > "${Y}" 2>/dev/null || xclip -selection clipboard -t image/bmp -o > "${Y}" 2>/dev/null || wl-paste --type image/bmp > "${Y}"`,getPath:"xclip -selection clipboard -t text/plain -o 2>/dev/null || wl-paste 2>/dev/null",deleteFile:`rm -f "${Y}"`},win32:{checkImage:'powershell -NoProfile -Command "(Get-Clipboard -Format Image) -ne $null"',saveImage:`powershell -NoProfile -Command "$img = Get-Clipboard -Format Image; if ($img) { $img.Save('${Y.replace(/\\/g,"\\\\")}', [System.Drawing.Imaging.ImageFormat]::Png) }"`,getPath:'powershell -NoProfile -Command "Get-Clipboard"',deleteFile:`del /f "${Y}"`}};return{commands:$[q]||$.linux,screenshotPath:Y}}async function iS4(){if(process.platform!=="darwin")return!1;if(g8("tengu_collage_kaleidoscope",!0))try{let{getNativeModule:K}=await Promise.resolve().then(() => (ik8(),nk8)),_=K()?.hasClipboardImage;if(_)return _()}catch(K){H6(K)}return(await S7("osascript",["-e","the clipboard as «class PNGf»"])).code===0}async function RN6(){if(process.platform==="darwin"&&g8("tengu_collage_kaleidoscope",!0))try{let{getNativeModule:_}=await Promise.resolve().then(() => (ik8(),nk8)),z=_()?.readClipboardImage;if(!z)throw Error("native clipboard reader unavailable");let Y=z(nF,iF);if(!Y)return null;let $=Y.png;if($.length>vL){let A=await LL($,$.length,"png");return{base64:A.buffer.toString("base64"),mediaType:`image/${A.mediaType}`,dimensions:{originalWidth:Y.originalWidth,originalHeight:Y.originalHeight,displayWidth:A.dimensions?.displayWidth??Y.width,displayHeight:A.dimensions?.displayHeight??Y.height}}}return{base64:$.toString("base64"),mediaType:"image/png",dimensions:{originalWidth:Y.originalWidth,originalHeight:Y.originalHeight,displayWidth:Y.width,displayHeight:Y.height}}}catch(_){H6(_)}let{commands:q,screenshotPath:K}=nS4();try{if((await m_(q.checkImage,{shell:!0,reject:!1})).exitCode!==0)return null;if((await m_(q.saveImage,{shell:!0,reject:!1})).exitCode!==0)return null;let Y=X8().readFileBytesSync(K);if(Y.length>=2&&Y[0]===66&&Y[1]===77)Y=await(await KV6())(Y).png().toBuffer();let $=await LL(Y,Y.length,"png"),A=$.buffer.toString("base64"),O=Cr6(A);return m_(q.deleteFile,{shell:!0,reject:!1}),{base64:A,mediaType:O,dimensions:$.dimensions}}catch{return null}}async function YHz(){let{commands:q}=nS4();try{let K=await m_(q.getPath,{shell:!0,reject:!1});if(K.exitCode!==0||!K.stdout)return null;return K.stdout.trim()}catch(K){return H6(K),null}}function rS4(q){if(q.startsWith('"')&&q.endsWith('"')||q.startsWith("'")&&q.endsWith("'"))return q.slice(1,-1);return q}function oS4(q){if(process.platform==="win32")return q;let z=`__DOUBLE_BACKSLASH_${qHz(8).toString("hex")}__`;return q.replace(/\\\\/g,z).replace(/\\(.)/g,"$1").replace(new RegExp(z,"g"),"\\")}function nE8(q){let K=rS4(q.trim()),_=oS4(K);return lE8.test(_)}function $Hz(q){let K=rS4(q.trim()),_=oS4(K);if(lE8.test(_))return _;return null}async function aS4(q){let K=$Hz(q);if(!K)return null;let _=K,z;try{if(zHz(_))z=X8().readFileBytesSync(_);else{let w=await YHz();if(w&&_===KHz(w))z=X8().readFileBytesSync(w)}}catch(w){return H6(w),null}if(!z)return null;if(z.length===0)return N(`Image file is empty: ${_}`,{level:"warn"}),null;if(z.length>=2&&z[0]===66&&z[1]===77)z=await(await KV6())(z).png().toBuffer();let Y=_Hz(_).slice(1).toLowerCase()||"png",$=await LL(z,z.length,Y),A=$.buffer.toString("base64"),O=Cr6(A);return{path:_,base64:A,mediaType:O,dimensions:$.dimensions}}var cE8=800,lE8;var hN6=y(()=>{Df();o1();aI1();_8();XK();e7();RL();E8();lE8=/\.(png|jpe?g|gif|webp)$/i});import{mkdir as AHz,open as OHz}from"fs/promises";import{join as iE8}from"path";function tS4(){return iE8(c1(),sS4,N8())}async function jHz(){let q=tS4();await AHz(q,{recursive:!0})}function eS4(q,K){let _=K.split("/")[1]||"png";return iE8(tS4(),`${q}.${_}`)}function SN6(q){if(q.type!=="image")return null;let K=eS4(q.id,q.mediaType||"image/png");return _C4(),mw6.set(q.id,K),K}async function pw6(q){if(q.type!=="image")return null;try{await jHz();let K=eS4(q.id,q.mediaType||"image/png"),_=await OHz(K,"w",384);try{await _.writeFile(q.content,{encoding:"base64"}),await _.datasync()}finally{await _.close()}return _C4(),mw6.set(q.id,K),N(`Stored image ${q.id} to ${K}`),K}catch(K){return N(`Failed to store image: ${K}`),null}}async function qC4(q){let K=new Map;for(let[_,z]of Object.entries(q))if(z.type==="image"){let Y=await pw6(z);if(Y)K.set(Number(_),Y)}return K}function rE8(q){return mw6.get(q)??null}function KC4(){mw6.clear()}function _C4(){while(mw6.size>=wHz){let q=mw6.keys().next().value;if(q!==void 0)mw6.delete(q);else break}}async function zC4(){let q=X8(),K=iE8(c1(),sS4),_=N8();try{let z;try{z=await q.readdir(K)}catch{return}for(let Y of z){if(Y.name===_)continue;let $=iE8(K,Y.name);try{await q.rm($,{recursive:!0,force:!0}),N(`Cleaned up old image cache: ${$}`)}catch{}}try{if((await q.readdir(K)).length===0)await q.rmdir(K)}catch{}}catch{}}var sS4="image-cache",wHz=200,mw6;var Ko=y(()=>{v8();_8();m8();e7();mw6=new Map});import{pathToFileURL as HHz}from"url";function YC4(q){let K=z6(13),{imageId:_,backgroundColor:z,isSelected:Y}=q,$=Y===void 0?!1:Y,A=rE8(_),O=`[Image #${_}]`;if(A&&Nv()){let j=HHz(A).href,H,J;if(K[0]!==z||K[1]!==O||K[2]!==$)H=_o.createElement(k,{backgroundColor:z,inverse:$},O),J=_o.createElement(k,{backgroundColor:z,inverse:$,bold:$},O),K[0]=z,K[1]=O,K[2]=$,K[3]=H,K[4]=J;else H=K[3],J=K[4];let M;if(K[5]!==j||K[6]!==H||K[7]!==J)M=_o.createElement(hq,{url:j,fallback:H},J),K[5]=j,K[6]=H,K[7]=J,K[8]=M;else M=K[8];return M}let w;if(K[9]!==z||K[10]!==O||K[11]!==$)w=_o.createElement(k,{backgroundColor:z,inverse:$},O),K[9]=z,K[10]=O,K[11]=$,K[12]=w;else w=K[12];return w}var _o;var $C4=y(()=>{q8();vA6();Ui();s6();Ko();_o=O6(D6(),1)});function mU(q){let K=z6(32),{isFocused:_,isSelected:z,children:Y,description:$,showScrollDown:A,showScrollUp:O,styled:w,disabled:j,declareCursor:H}=q,J=z===void 0?!1:z,M=w===void 0?!0:w,X=j===void 0?!1:j,P;if(K[0]!==X||K[1]!==_||K[2]!==A||K[3]!==O)P=function(){if(X)return iC.default.createElement(k,null," ");if(_)return iC.default.createElement(k,{color:"suggestion"},t6.pointer);if(A)return iC.default.createElement(k,{dimColor:!0},t6.arrowDown);if(O)return iC.default.createElement(k,{dimColor:!0},t6.arrowUp);return iC.default.createElement(k,null," ")},K[0]=X,K[1]=_,K[2]=A,K[3]=O,K[4]=P;else P=K[4];let W=P,D;if(K[5]!==X||K[6]!==_||K[7]!==J||K[8]!==M)D=function(){if(X)return"inactive";if(!M)return;if(J)return"success";if(_)return"suggestion"}(),K[5]=X,K[6]=_,K[7]=J,K[8]=M,K[9]=D;else D=K[9];let f=D,G=_&&!X&&H!==!1,Z;if(K[10]!==G)Z={line:0,column:0,active:G},K[10]=G,K[11]=Z;else Z=K[11];let T=LN6(Z),v;if(K[12]!==W)v=W(),K[12]=W,K[13]=v;else v=K[13];let V;if(K[14]!==Y||K[15]!==X||K[16]!==M||K[17]!==f)V=M?iC.default.createElement(k,{color:f,dimColor:X},Y):Y,K[14]=Y,K[15]=X,K[16]=M,K[17]=f,K[18]=V;else V=K[18];let E;if(K[19]!==X||K[20]!==J)E=J&&!X&&iC.default.createElement(k,{color:"success"},t6.tick),K[19]=X,K[20]=J,K[21]=E;else E=K[21];let S;if(K[22]!==E||K[23]!==v||K[24]!==V)S=iC.default.createElement(u,{flexDirection:"row",gap:1},v,V,E),K[22]=E,K[23]=v,K[24]=V,K[25]=S;else S=K[25];let R;if(K[26]!==$)R=$&&iC.default.createElement(u,{paddingLeft:2},iC.default.createElement(k,{color:"inactive"},$)),K[26]=$,K[27]=R;else R=K[27];let x;if(K[28]!==T||K[29]!==S||K[30]!==R)x=iC.default.createElement(u,{ref:T,flexDirection:"column"},S,R),K[28]=T,K[29]=S,K[30]=R,K[31]=x;else x=K[31];return x}var iC;var Ra6=y(()=>{q8();bq();dE8();s6();iC=O6(D6(),1)});function Qq6(q){let K=z6(8),{isFocused:_,isSelected:z,children:Y,description:$,shouldShowDownArrow:A,shouldShowUpArrow:O,declareCursor:w}=q,j;if(K[0]!==Y||K[1]!==w||K[2]!==$||K[3]!==_||K[4]!==z||K[5]!==A||K[6]!==O)j=AC4.default.createElement(mU,{isFocused:_,isSelected:z,description:$,showScrollDown:A,showScrollUp:O,styled:!1,declareCursor:w},Y),K[0]=Y,K[1]=w,K[2]=$,K[3]=_,K[4]=z,K[5]=A,K[6]=O,K[7]=j;else j=K[7];return j}var AC4;var oE8=y(()=>{q8();Ra6();AC4=O6(D6(),1)});function CN6(q){let K=z6(100),{option:_,isFocused:z,isSelected:Y,shouldShowDownArrow:$,shouldShowUpArrow:A,maxIndexWidth:O,index:w,inputValue:j,onInputChange:H,onSubmit:J,onExit:M,layout:X,children:P,showLabel:W,onOpenEditor:D,resetCursorOnUpdate:f,onImagePaste:G,pastedContents:Z,onRemoveImage:T,imagesSelected:v,selectedImageIndex:V,onImagesSelectedChange:E,onSelectedImageIndexChange:S}=q,R=W===void 0?!1:W,x=f===void 0?!1:f,I=V===void 0?0:V,B;if(K[0]!==Z)B=Z?Object.values(Z).filter(JHz):[],K[0]=Z,K[1]=B;else B=K[1];let p=B,C=R||_.showLabelWithValue===!0,[g,F]=tz.useState(j.length),U=tz.useRef(!1),c;if(K[2]!==j.length||K[3]!==z||K[4]!==x)c=()=>{if(x&&z)if(U.current)U.current=!1;else F(j.length)},K[2]=j.length,K[3]=z,K[4]=x,K[5]=c;else c=K[5];let K6;if(K[6]!==j||K[7]!==z||K[8]!==x)K6=[x,z,j],K[6]=j,K[7]=z,K[8]=x,K[9]=K6;else K6=K[9];tz.useEffect(c,K6);let t;if(K[10]!==j||K[11]!==H||K[12]!==D)t=()=>{D?.(j,H)},K[10]=j,K[11]=H,K[12]=D,K[13]=t;else t=K[13];let q6=z&&!!D,e;if(K[14]!==q6)e={context:"Chat",isActive:q6},K[14]=q6,K[15]=e;else e=K[15];P1("chat:externalEditor",t,e);let i;if(K[16]!==G)i=()=>{if(!G)return;RN6().then((b6)=>{if(b6)G(b6.base64,b6.mediaType,void 0,b6.dimensions)})},K[16]=G,K[17]=i;else i=K[17];let $6=z&&!!G,M6;if(K[18]!==$6)M6={context:"Chat",isActive:$6},K[18]=$6,K[19]=M6;else M6=K[19];P1("chat:imagePaste",i,M6);let j6;if(K[20]!==p||K[21]!==T)j6=()=>{if(p.length>0&&T)T(p.at(-1).id)},K[20]=p,K[21]=T,K[22]=j6;else j6=K[22];let G6=z&&!v&&j===""&&p.length>0&&!!T,w6;if(K[23]!==G6)w6={context:"Attachments",isActive:G6},K[23]=G6,K[24]=w6;else w6=K[24];P1("attachments:remove",j6,w6);let o,s;if(K[25]!==p.length||K[26]!==S||K[27]!==I)o=()=>{if(p.length>1)S?.((I+1)%p.length)},s=()=>{if(p.length>1)S?.((I-1+p.length)%p.length)},K[25]=p.length,K[26]=S,K[27]=I,K[28]=o,K[29]=s;else o=K[28],s=K[29];let a;if(K[30]!==p||K[31]!==E||K[32]!==T||K[33]!==S||K[34]!==I)a=()=>{let b6=p[I];if(b6&&T)if(T(b6.id),p.length<=1)E?.(!1);else S?.(Math.min(I,p.length-2))},K[30]=p,K[31]=E,K[32]=T,K[33]=S,K[34]=I,K[35]=a;else a=K[35];let n;if(K[36]!==E)n=()=>{E?.(!1)},K[36]=E,K[37]=n;else n=K[37];let l;if(K[38]!==o||K[39]!==s||K[40]!==a||K[41]!==n)l={"attachments:next":o,"attachments:previous":s,"attachments:remove":a,"attachments:exit":n},K[38]=o,K[39]=s,K[40]=a,K[41]=n,K[42]=l;else l=K[42];let A6=z&&!!v,J6;if(K[43]!==A6)J6={context:"Attachments",isActive:A6},K[43]=A6,K[44]=J6;else J6=K[44];o7(l,J6);let X6;if(K[45]!==E)X6=(b6,Q6)=>{if(Q6.upArrow)E?.(!1)},K[45]=E,K[46]=X6;else X6=K[46];let f6=z&&!!v,N6;if(K[47]!==f6)N6={isActive:f6},K[47]=f6,K[48]=N6;else N6=K[48];k4(X6,N6);let Z6,V6;if(K[49]!==v||K[50]!==z||K[51]!==E)Z6=()=>{if(!z&&v)E?.(!1)},V6=[z,v,E],K[49]=v,K[50]=z,K[51]=E,K[52]=Z6,K[53]=V6;else Z6=K[52],V6=K[53];tz.useEffect(Z6,V6);let y6=X==="expanded"?O+3:O+4,T6=X==="compact"?0:void 0,n6=`${w}.`,o6;if(K[54]!==O||K[55]!==n6)o6=n6.padEnd(O+2),K[54]=O,K[55]=n6,K[56]=o6;else o6=K[56];let I6;if(K[57]!==o6)I6=tz.default.createElement(k,{dimColor:!0},o6),K[57]=o6,K[58]=I6;else I6=K[58];let C6;if(K[59]!==g||K[60]!==v||K[61]!==j||K[62]!==z||K[63]!==M||K[64]!==G||K[65]!==H||K[66]!==J||K[67]!==_||K[68]!==C)C6=C?tz.default.createElement(tz.default.Fragment,null,tz.default.createElement(k,{color:z?"suggestion":void 0},_.label),z?tz.default.createElement(tz.default.Fragment,null,tz.default.createElement(k,{color:"suggestion"},_.labelValueSeparator??", "),tz.default.createElement(r3,{value:j,onChange:(b6)=>{U.current=!0,H(b6),_.onChange(b6)},onSubmit:J,onExit:M,placeholder:_.placeholder,focus:!v,showCursor:!0,multiline:!0,cursorOffset:g,onChangeCursorOffset:F,columns:80,onImagePaste:G,onPaste:(b6)=>{U.current=!0;let Q6=j.slice(0,g),Y6=j.slice(g),_6=Q6+b6+Y6;H(_6),_.onChange(_6),F(Q6.length+b6.length)}})):j&&tz.default.createElement(k,null,_.labelValueSeparator??", ",j)):z?tz.default.createElement(r3,{value:j,onChange:(b6)=>{U.current=!0,H(b6),_.onChange(b6)},onSubmit:J,onExit:M,placeholder:_.placeholder||(typeof _.label==="string"?_.label:void 0),focus:!v,showCursor:!0,multiline:!0,cursorOffset:g,onChangeCursorOffset:F,columns:80,onImagePaste:G,onPaste:(b6)=>{U.current=!0;let Q6=j.slice(0,g),Y6=j.slice(g),_6=Q6+b6+Y6;H(_6),_.onChange(_6),F(Q6.length+b6.length)}}):tz.default.createElement(k,{color:j?void 0:"inactive"},j||_.placeholder||_.label),K[59]=g,K[60]=v,K[61]=j,K[62]=z,K[63]=M,K[64]=G,K[65]=H,K[66]=J,K[67]=_,K[68]=C,K[69]=C6;else C6=K[69];let l6;if(K[70]!==P||K[71]!==T6||K[72]!==I6||K[73]!==C6)l6=tz.default.createElement(u,{flexDirection:"row",flexShrink:T6},I6,P,C6),K[70]=P,K[71]=T6,K[72]=I6,K[73]=C6,K[74]=l6;else l6=K[74];let S6;if(K[75]!==z||K[76]!==Y||K[77]!==$||K[78]!==A||K[79]!==l6)S6=tz.default.createElement(Qq6,{isFocused:z,isSelected:Y,shouldShowDownArrow:$,shouldShowUpArrow:A,declareCursor:!1},l6),K[75]=z,K[76]=Y,K[77]=$,K[78]=A,K[79]=l6,K[80]=S6;else S6=K[80];let E6;if(K[81]!==y6||K[82]!==z||K[83]!==Y||K[84]!==_.description||K[85]!==_.dimDescription)E6=_.description&&tz.default.createElement(u,{paddingLeft:y6},tz.default.createElement(k,{dimColor:_.dimDescription!==!1,color:Y?"success":z?"suggestion":void 0},_.description)),K[81]=y6,K[82]=z,K[83]=Y,K[84]=_.description,K[85]=_.dimDescription,K[86]=E6;else E6=K[86];let R6;if(K[87]!==y6||K[88]!==p||K[89]!==v||K[90]!==z||K[91]!==I)R6=p.length>0&&tz.default.createElement(u,{flexDirection:"row",gap:1,paddingLeft:y6},p.map((b6,Q6)=>tz.default.createElement(YC4,{key:b6.id,imageId:b6.id,isSelected:!!v&&Q6===I})),tz.default.createElement(u,{flexGrow:1,justifyContent:"flex-start",flexDirection:"row"},tz.default.createElement(k,{dimColor:!0},v?tz.default.createElement(I1,null,p.length>1&&tz.default.createElement(tz.default.Fragment,null,tz.default.createElement(W1,{action:"attachments:next",context:"Attachments",fallback:"→",description:"next"}),tz.default.createElement(W1,{action:"attachments:previous",context:"Attachments",fallback:"←",description:"prev"})),tz.default.createElement(W1,{action:"attachments:remove",context:"Attachments",fallback:"backspace",description:"remove"}),tz.default.createElement(W1,{action:"attachments:exit",context:"Attachments",fallback:"esc",description:"cancel"})):z?"(↓ to select)":null))),K[87]=y6,K[88]=p,K[89]=v,K[90]=z,K[91]=I,K[92]=R6;else R6=K[92];let h6;if(K[93]!==X)h6=X==="expanded"&&tz.default.createElement(k,null," "),K[93]=X,K[94]=h6;else h6=K[94];let x6;if(K[95]!==S6||K[96]!==E6||K[97]!==R6||K[98]!==h6)x6=tz.default.createElement(u,{flexDirection:"column",flexShrink:0},S6,E6,R6,h6),K[95]=S6,K[96]=E6,K[97]=R6,K[98]=h6,K[99]=x6;else x6=K[99];return x6}function JHz(q){return q.type==="image"}var tz;var Vg1=y(()=>{q8();s6();Oq();hN6();$C4();a5();QK();CH();oE8();tz=O6(D6(),1)});function yJ(q,K){let _=z6(8),z=K===void 0?!0:K,$=bN6.useContext(ha6)?.setState,A,O;if(_[0]!==z||_[1]!==q||_[2]!==$)A=()=>{if(!z||!$)return;return $((H)=>{if(H.activeOverlays.has(q))return H;let J=new Set(H.activeOverlays);return J.add(q),{...H,activeOverlays:J}}),()=>{$((H)=>{if(!H.activeOverlays.has(q))return H;let J=new Set(H.activeOverlays);return J.delete(q),{...H,activeOverlays:J}})}},O=[q,z,$],_[0]=z,_[1]=q,_[2]=$,_[3]=A,_[4]=O;else A=_[3],O=_[4];bN6.useEffect(A,O);let w,j;if(_[5]!==z)w=()=>{if(!z)return;return XHz},j=[z],_[5]=z,_[6]=w,_[7]=j;else w=_[6],j=_[7];bN6.useLayoutEffect(w,j)}function XHz(){return VA.get(process.stdout)?.invalidatePrevFrame()}function OC4(){return P8(PHz)}function PHz(q){return q.activeOverlays.size>0}function dq6(){return P8(WHz)}function WHz(q){for(let K of q.activeOverlays)if(!MHz.has(K))return!0;return!1}var bN6,MHz;var T0=y(()=>{q8();QV();C7();bN6=O6(D6(),1),MHz=new Set(["autocomplete"])});var Ng1,wC4=({isDisabled:q=!1,disableSelection:K=!1,state:_,options:z,isMultiSelect:Y=!1,onUpFromFirstItem:$,onDownFromLastItem:A,onInputModeToggle:O,inputValues:w,imagesSelected:j=!1,onEnterImageSelection:H})=>{yJ("select",!!_.onCancel);let J=Ng1.useMemo(()=>{return z.find((P)=>P.value===_.focusedValue)?.type==="input"},[z,_.focusedValue]),M=Ng1.useMemo(()=>{let X={};if(!J)X["select:next"]=()=>{if(A){let P=z[z.length-1];if(P&&_.focusedValue===P.value){A();return}}_.focusNextOption()},X["select:previous"]=()=>{if($&&_.visibleFromIndex===0){let P=z[0];if(P&&_.focusedValue===P.value){$();return}}_.focusPreviousOption()},X["select:accept"]=()=>{if(K===!0)return;if(_.focusedValue===void 0)return;if(z.find((W)=>W.value===_.focusedValue)?.disabled===!0)return;_.selectFocusedOption?.(),_.onChange?.(_.focusedValue)};if(_.onCancel)X["select:cancel"]=()=>{_.onCancel()};return X},[z,_,A,$,J,K]);o7(M,{context:"Select",isActive:!q}),k4((X,P,W)=>{let D=T_6(X),f=z.find((Z)=>Z.value===_.focusedValue),G=f?.type==="input";if(P.tab&&O&&_.focusedValue!==void 0){O(_.focusedValue);return}if(G){if(j)return;if(P.downArrow&&H?.()){W.stopImmediatePropagation();return}if(P.downArrow||P.ctrl&&X==="n"){if(A){let Z=z[z.length-1];if(Z&&_.focusedValue===Z.value){A(),W.stopImmediatePropagation();return}}_.focusNextOption(),W.stopImmediatePropagation();return}if(P.upArrow||P.ctrl&&X==="p"){if($&&_.visibleFromIndex===0){let Z=z[0];if(Z&&_.focusedValue===Z.value){$(),W.stopImmediatePropagation();return}}_.focusPreviousOption(),W.stopImmediatePropagation();return}return}if(P.pageDown)_.focusNextPage();if(P.pageUp)_.focusPreviousPage();if(K!==!0){if(Y&&v_6(X)===" "&&_.focusedValue!==void 0){if(f?.disabled!==!0)_.selectFocusedOption?.(),_.onChange?.(_.focusedValue)}if(K!=="numeric"&&/^[0-9]+$/.test(D)){let Z=parseInt(D)-1;if(Z>=0&&Z<_.options.length){let T=_.options[Z];if(T.disabled===!0)return;if(T.type==="input"){if((w?.get(T.value)??"").trim()){_.onChange?.(T.value);return}if(T.allowEmptySubmitToCancel){_.onChange?.(T.value);return}_.focusOption(T.value);return}_.onChange?.(T.value);return}}}},{isActive:!q})};var jC4=y(()=>{T0();s6();Oq();Ng1=O6(D6(),1)});var aE8;var HC4=y(()=>{aE8=class aE8 extends Map{first;last;constructor(q){let K=[],_,z,Y,$=0;for(let A of q){let O={label:A.label,value:A.value,description:A.description,previous:Y,next:void 0,index:$};if(Y)Y.next=O;_||=O,z=O,K.push([A.value,O]),$++,Y=O}super(K);this.first=_,this.last=z}}});import{isDeepStrictEqual as DHz}from"util";function sE8({visibleOptionCount:q=5,options:K,initialFocusValue:_,onFocus:z,focusValue:Y}){let[$,A]=RX.useReducer(fHz,{visibleOptionCount:q,options:K,initialFocusValue:Y||_},JC4),O=RX.useRef(z);O.current=z;let[w,j]=RX.useState(K);if(K!==w&&!DHz(K,w))A({type:"reset",state:JC4({visibleOptionCount:q,options:K,initialFocusValue:Y??$.focusedValue??_,currentViewport:{visibleFromIndex:$.visibleFromIndex,visibleToIndex:$.visibleToIndex}})}),j(K);let H=RX.useCallback(()=>{A({type:"focus-next-option"})},[]),J=RX.useCallback(()=>{A({type:"focus-previous-option"})},[]),M=RX.useCallback(()=>{A({type:"focus-next-page"})},[]),X=RX.useCallback(()=>{A({type:"focus-previous-page"})},[]),P=RX.useCallback((Z)=>{if(Z!==void 0)A({type:"set-focus",value:Z})},[]),W=RX.useMemo(()=>{return K.map((Z,T)=>({...Z,index:T})).slice($.visibleFromIndex,$.visibleToIndex)},[K,$.visibleFromIndex,$.visibleToIndex]),D=RX.useMemo(()=>{if($.focusedValue===void 0)return;if(K.some((T)=>T.value===$.focusedValue))return $.focusedValue;return K[0]?.value},[$.focusedValue,K]),f=RX.useMemo(()=>{return K.find((T)=>T.value===D)?.type==="input"},[D,K]);RX.useEffect(()=>{if(D!==void 0)O.current?.(D)},[D]),RX.useEffect(()=>{if(Y!==void 0)A({type:"set-focus",value:Y})},[Y]);let G=RX.useMemo(()=>{if(D===void 0)return 0;let Z=K.findIndex((T)=>T.value===D);return Z>=0?Z+1:0},[D,K]);return{focusedValue:D,focusedIndex:G,visibleFromIndex:$.visibleFromIndex,visibleToIndex:$.visibleToIndex,visibleOptions:W,isInInput:f??!1,focusNextOption:H,focusPreviousOption:J,focusNextPage:M,focusPreviousPage:X,focusOption:P,options:K}}var RX,fHz=(q,K)=>{switch(K.type){case"focus-next-option":{if(q.focusedValue===void 0)return q;let _=q.optionMap.get(q.focusedValue);if(!_)return q;let z=_.next||q.optionMap.first;if(!z)return q;if(!_.next&&z===q.optionMap.first)return{...q,focusedValue:z.value,visibleFromIndex:0,visibleToIndex:q.visibleOptionCount};if(!(z.index>=q.visibleToIndex))return{...q,focusedValue:z.value};let $=Math.min(q.optionMap.size,q.visibleToIndex+1),A=$-q.visibleOptionCount;return{...q,focusedValue:z.value,visibleFromIndex:A,visibleToIndex:$}}case"focus-previous-option":{if(q.focusedValue===void 0)return q;let _=q.optionMap.get(q.focusedValue);if(!_)return q;let z=_.previous||q.optionMap.last;if(!z)return q;if(!_.previous&&z===q.optionMap.last){let O=q.optionMap.size,w=Math.max(0,O-q.visibleOptionCount);return{...q,focusedValue:z.value,visibleFromIndex:w,visibleToIndex:O}}if(!(z.index<=q.visibleFromIndex))return{...q,focusedValue:z.value};let $=Math.max(0,q.visibleFromIndex-1),A=$+q.visibleOptionCount;return{...q,focusedValue:z.value,visibleFromIndex:$,visibleToIndex:A}}case"focus-next-page":{if(q.focusedValue===void 0)return q;let _=q.optionMap.get(q.focusedValue);if(!_)return q;let z=Math.min(q.optionMap.size-1,_.index+q.visibleOptionCount),Y=q.optionMap.first;while(Y&&Y.index<z)if(Y.next)Y=Y.next;else break;if(!Y)return q;let $=Math.min(q.optionMap.size,Y.index+1),A=Math.max(0,$-q.visibleOptionCount);return{...q,focusedValue:Y.value,visibleFromIndex:A,visibleToIndex:$}}case"focus-previous-page":{if(q.focusedValue===void 0)return q;let _=q.optionMap.get(q.focusedValue);if(!_)return q;let z=Math.max(0,_.index-q.visibleOptionCount),Y=q.optionMap.first;while(Y&&Y.index<z)if(Y.next)Y=Y.next;else break;if(!Y)return q;let $=Math.max(0,Y.index),A=Math.min(q.optionMap.size,$+q.visibleOptionCount);return{...q,focusedValue:Y.value,visibleFromIndex:$,visibleToIndex:A}}case"reset":return K.state;case"set-focus":{if(q.focusedValue===K.value)return q;let _=q.optionMap.get(K.value);if(!_)return q;if(_.index>=q.visibleFromIndex&&_.index<q.visibleToIndex)return{...q,focusedValue:K.value};let z,Y;if(_.index<q.visibleFromIndex)z=_.index,Y=Math.min(q.optionMap.size,z+q.visibleOptionCount);else Y=Math.min(q.optionMap.size,_.index+1),z=Math.max(0,Y-q.visibleOptionCount);return{...q,focusedValue:K.value,visibleFromIndex:z,visibleToIndex:Y}}}},JC4=({visibleOptionCount:q,options:K,initialFocusValue:_,currentViewport:z})=>{let Y=typeof q==="number"?Math.min(q,K.length):K.length,$=new aE8(K),A=_!==void 0&&$.get(_),O=A?_:$.first?.value,w=0,j=Y;if(A){let H=A.index;if(z)if(H>=z.visibleFromIndex&&H<z.visibleToIndex)w=z.visibleFromIndex,j=Math.min($.size,z.visibleToIndex);else if(H<z.visibleFromIndex)w=H,j=Math.min($.size,w+Y);else j=Math.min($.size,H+1),w=Math.max(0,j-Y);else if(H>=Y)j=Math.min($.size,H+1),w=Math.max(0,j-Y);w=Math.max(0,Math.min(w,$.size-1)),j=Math.min($.size,Math.max(Y,j))}return{optionMap:$,visibleOptionCount:Y,focusedValue:O,visibleFromIndex:w,visibleToIndex:j}};var yg1=y(()=>{HC4();RX=O6(D6(),1)});function MC4({visibleOptionCount:q=5,options:K,defaultValue:_,onChange:z,onCancel:Y,onFocus:$,focusValue:A}){let[O,w]=tE8.useState(_),j=sE8({visibleOptionCount:q,options:K,initialFocusValue:void 0,onFocus:$,focusValue:A}),H=tE8.useCallback(()=>{w(j.focusedValue)},[j.focusedValue]);return{...j,value:O,selectFocusedOption:H,onChange:z,onCancel:Y}}var tE8;var XC4=y(()=>{yg1();tE8=O6(D6(),1)});function eE8(q){if(typeof q==="string")return q;if(typeof q==="number")return String(q);if(!q)return"";if(Array.isArray(q))return q.map(eE8).join("");if(r4.default.isValidElement(q))return eE8(q.props.children);return""}function H1(q){let K=z6(72),{isDisabled:_,hideIndexes:z,visibleOptionCount:Y,highlightText:$,options:A,defaultValue:O,onCancel:w,onChange:j,onFocus:H,defaultFocusValue:J,layout:M,disableSelection:X,inlineDescriptions:P,onUpFromFirstItem:W,onDownFromLastItem:D,onInputModeToggle:f,onOpenEditor:G,onImagePaste:Z,pastedContents:T,onRemoveImage:v}=q,V=_===void 0?!1:_,E=z===void 0?!1:z,S=Y===void 0?5:Y,R=M===void 0?"compact":M,x=X===void 0?!1:X,I=P===void 0?!1:P,[B,p]=r4.useState(!1),[C,g]=r4.useState(0),F;if(K[0]!==A)F=()=>{let l=new Map;return A.forEach((A6)=>{if(A6.type==="input"&&A6.initialValue)l.set(A6.value,A6.initialValue)}),l},K[0]=A,K[1]=F;else F=K[1];let[U,c]=r4.useState(F),K6;if(K[2]===Symbol.for("react.memo_cache_sentinel"))K6=new Map,K[2]=K6;else K6=K[2];let t=r4.useRef(K6),q6,e;if(K[3]!==U||K[4]!==A)e=()=>{for(let l of A)if(l.type==="input"&&l.initialValue!==void 0){let A6=t.current.get(l.value)??"",J6=U.get(l.value)??"",X6=l.initialValue;if(X6!==A6&&J6===A6)c((f6)=>{let N6=new Map(f6);return N6.set(l.value,X6),N6});t.current.set(l.value,X6)}},q6=[A,U],K[3]=U,K[4]=A,K[5]=q6,K[6]=e;else q6=K[5],e=K[6];r4.useEffect(e,q6);let i;if(K[7]!==J||K[8]!==O||K[9]!==w||K[10]!==j||K[11]!==H||K[12]!==A||K[13]!==S)i={visibleOptionCount:S,options:A,defaultValue:O,onChange:j,onCancel:w,onFocus:H,focusValue:J},K[7]=J,K[8]=O,K[9]=w,K[10]=j,K[11]=H,K[12]=A,K[13]=S,K[14]=i;else i=K[14];let $6=MC4(i),M6=x||(E?"numeric":!1),j6;if(K[15]!==T)j6=()=>{if(T&&Object.values(T).some(EHz)){let l=$7(Object.values(T),yHz);return p(!0),g(l-1),!0}return!1},K[15]=T,K[16]=j6;else j6=K[16];let G6;if(K[17]!==B||K[18]!==U||K[19]!==V||K[20]!==D||K[21]!==f||K[22]!==W||K[23]!==A||K[24]!==$6||K[25]!==M6||K[26]!==j6)G6={isDisabled:V,disableSelection:M6,state:$6,options:A,isMultiSelect:!1,onUpFromFirstItem:W,onDownFromLastItem:D,onInputModeToggle:f,inputValues:U,imagesSelected:B,onEnterImageSelection:j6},K[17]=B,K[18]=U,K[19]=V,K[20]=D,K[21]=f,K[22]=W,K[23]=A,K[24]=$6,K[25]=M6,K[26]=j6,K[27]=G6;else G6=K[27];wC4(G6);let w6,o,s,a;if(K[28]!==E||K[29]!==$||K[30]!==B||K[31]!==I||K[32]!==U||K[33]!==V||K[34]!==R||K[35]!==w||K[36]!==j||K[37]!==Z||K[38]!==G||K[39]!==v||K[40]!==A.length||K[41]!==T||K[42]!==C||K[43]!==$6.focusedValue||K[44]!==$6.options||K[45]!==$6.value||K[46]!==$6.visibleFromIndex||K[47]!==$6.visibleOptions||K[48]!==$6.visibleToIndex){a=Symbol.for("react.early_return_sentinel");q:{let l={container:NHz,highlightedText:VHz};if(R==="expanded"){let Z6;if(K[53]!==$6.options.length)Z6=$6.options.length.toString(),K[53]=$6.options.length,K[54]=Z6;else Z6=K[54];let V6=Z6.length;a=r4.default.createElement(u,{...l.container()},$6.visibleOptions.map((y6,T6)=>{let n6=y6.index===$6.visibleFromIndex,o6=y6.index===$6.visibleToIndex-1,I6=$6.visibleToIndex<A.length,C6=$6.visibleFromIndex>0,l6=$6.visibleFromIndex+T6+1,S6=!V&&$6.focusedValue===y6.value,E6=$6.value===y6.value;if(y6.type==="input"){let b6=U.has(y6.value)?U.get(y6.value):y6.initialValue||"";return r4.default.createElement(CN6,{key:String(y6.value),option:y6,isFocused:S6,isSelected:E6,shouldShowDownArrow:I6&&o6,shouldShowUpArrow:C6&&n6,maxIndexWidth:V6,index:l6,inputValue:b6,onInputChange:(Q6)=>{c((Y6)=>{let _6=new Map(Y6);return _6.set(y6.value,Q6),_6})},onSubmit:(Q6)=>{let Y6=T&&Object.values(T).some(kHz);if(Q6.trim()||Y6||y6.allowEmptySubmitToCancel)j?.(y6.value);else w?.()},onExit:w,layout:"expanded",showLabel:I,onOpenEditor:G,resetCursorOnUpdate:y6.resetCursorOnUpdate,onImagePaste:Z,pastedContents:T,onRemoveImage:v,imagesSelected:B,selectedImageIndex:C,onImagesSelectedChange:p,onSelectedImageIndexChange:g})}let R6=y6.label;if(typeof y6.label==="string"&&$&&y6.label.includes($)){let b6=y6.label,Q6=b6.indexOf($);R6=r4.default.createElement(r4.default.Fragment,null,b6.slice(0,Q6),r4.default.createElement(k,{...l.highlightedText()},$),b6.slice(Q6+$.length))}let h6=y6.disabled===!0,x6=h6?void 0:E6?"success":S6?"suggestion":void 0;return r4.default.createElement(u,{key:String(y6.value),flexDirection:"column",flexShrink:0},r4.default.createElement(Qq6,{isFocused:S6,isSelected:E6,shouldShowDownArrow:I6&&o6,shouldShowUpArrow:C6&&n6},r4.default.createElement(k,{dimColor:h6,color:x6},R6)),y6.description&&r4.default.createElement(u,{paddingLeft:2},r4.default.createElement(k,{dimColor:h6||y6.dimDescription!==!1,color:x6},r4.default.createElement(B5,null,y6.description))),r4.default.createElement(k,null," "))}));break q}if(R==="compact-vertical"){let Z6;if(K[55]!==E||K[56]!==$6.options)Z6=E?0:$6.options.length.toString().length,K[55]=E,K[56]=$6.options,K[57]=Z6;else Z6=K[57];let V6=Z6;a=r4.default.createElement(u,{...l.container()},$6.visibleOptions.map((y6,T6)=>{let n6=y6.index===$6.visibleFromIndex,o6=y6.index===$6.visibleToIndex-1,I6=$6.visibleToIndex<A.length,C6=$6.visibleFromIndex>0,l6=$6.visibleFromIndex+T6+1,S6=!V&&$6.focusedValue===y6.value,E6=$6.value===y6.value;if(y6.type==="input"){let x6=U.has(y6.value)?U.get(y6.value):y6.initialValue||"";return r4.default.createElement(CN6,{key:String(y6.value),option:y6,isFocused:S6,isSelected:E6,shouldShowDownArrow:I6&&o6,shouldShowUpArrow:C6&&n6,maxIndexWidth:V6,index:l6,inputValue:x6,onInputChange:(b6)=>{c((Q6)=>{let Y6=new Map(Q6);return Y6.set(y6.value,b6),Y6})},onSubmit:(b6)=>{let Q6=T&&Object.values(T).some(vHz);if(b6.trim()||Q6||y6.allowEmptySubmitToCancel)j?.(y6.value);else w?.()},onExit:w,layout:"compact",showLabel:I,onOpenEditor:G,resetCursorOnUpdate:y6.resetCursorOnUpdate,onImagePaste:Z,pastedContents:T,onRemoveImage:v,imagesSelected:B,selectedImageIndex:C,onImagesSelectedChange:p,onSelectedImageIndexChange:g})}let R6=y6.label;if(typeof y6.label==="string"&&$&&y6.label.includes($)){let x6=y6.label,b6=x6.indexOf($);R6=r4.default.createElement(r4.default.Fragment,null,x6.slice(0,b6),r4.default.createElement(k,{...l.highlightedText()},$),x6.slice(b6+$.length))}let h6=y6.disabled===!0;return r4.default.createElement(u,{key:String(y6.value),flexDirection:"column",flexShrink:0},r4.default.createElement(Qq6,{isFocused:S6,isSelected:E6,shouldShowDownArrow:I6&&o6,shouldShowUpArrow:C6&&n6},r4.default.createElement(r4.default.Fragment,null,!E&&r4.default.createElement(k,{dimColor:!0},`${l6}.`.padEnd(V6+1)),r4.default.createElement(k,{dimColor:h6,color:h6?void 0:E6?"success":S6?"suggestion":void 0},R6))),y6.description&&r4.default.createElement(u,{paddingLeft:E?4:V6+4},r4.default.createElement(k,{dimColor:h6||y6.dimDescription!==!1,color:h6?void 0:E6?"success":S6?"suggestion":void 0},r4.default.createElement(B5,null,y6.description))))}));break q}let A6;if(K[58]!==E||K[59]!==$6.options)A6=E?0:$6.options.length.toString().length,K[58]=E,K[59]=$6.options,K[60]=A6;else A6=K[60];let J6=A6,X6=$6.visibleOptions.some(THz),f6=!I&&!X6&&$6.visibleOptions.some(GHz),N6=$6.visibleOptions.map((Z6,V6)=>{let y6=Z6.index===$6.visibleFromIndex,T6=Z6.index===$6.visibleToIndex-1,n6=$6.visibleToIndex<A.length,o6=$6.visibleFromIndex>0,I6=$6.visibleFromIndex+V6+1,C6=!V&&$6.focusedValue===Z6.value,l6=$6.value===Z6.value,S6=Z6.disabled===!0,E6=Z6.label;if(typeof Z6.label==="string"&&$&&Z6.label.includes($)){let R6=Z6.label,h6=R6.indexOf($);E6=r4.default.createElement(r4.default.Fragment,null,R6.slice(0,h6),r4.default.createElement(k,{...l.highlightedText()},$),R6.slice(h6+$.length))}return{option:Z6,index:I6,label:E6,isFocused:C6,isSelected:l6,isOptionDisabled:S6,shouldShowDownArrow:n6&&T6,shouldShowUpArrow:o6&&y6}});if(f6){let Z6;if(K[61]!==E||K[62]!==J6)Z6=(T6)=>{if(T6.option.type==="input")return 0;let n6=eE8(T6.option.label),o6=E?0:J6+2,I6=T6.isSelected?2:0;return 2+o6+O1(n6)+I6},K[61]=E,K[62]=J6,K[63]=Z6;else Z6=K[63];let V6=Math.max(...N6.map(Z6)),y6;if(K[64]!==E||K[65]!==J6||K[66]!==V6)y6=(T6)=>{if(T6.option.type==="input")return null;let n6=eE8(T6.option.label),o6=E?0:J6+2,I6=T6.isSelected?2:0,C6=2+o6+O1(n6)+I6,l6=V6-C6;return r4.default.createElement(LHz,{key:String(T6.option.value),isFocused:T6.isFocused},r4.default.createElement(u,{flexDirection:"row",flexShrink:0},T6.isFocused?r4.default.createElement(k,{color:"suggestion"},t6.pointer):T6.shouldShowDownArrow?r4.default.createElement(k,{dimColor:!0},t6.arrowDown):T6.shouldShowUpArrow?r4.default.createElement(k,{dimColor:!0},t6.arrowUp):r4.default.createElement(k,null," "),r4.default.createElement(k,null," "),r4.default.createElement(k,{dimColor:T6.isOptionDisabled,color:T6.isOptionDisabled?void 0:T6.isSelected?"success":T6.isFocused?"suggestion":void 0},!E&&r4.default.createElement(k,{dimColor:!0},`${T6.index}.`.padEnd(J6+2)),T6.label),T6.isSelected&&r4.default.createElement(k,{color:"success"}," ",t6.tick),l6>0&&r4.default.createElement(k,null," ".repeat(l6))),r4.default.createElement(u,{flexGrow:1,marginLeft:2},r4.default.createElement(k,{wrap:"wrap",dimColor:T6.isOptionDisabled||T6.option.dimDescription!==!1,color:T6.isOptionDisabled?void 0:T6.isSelected?"success":T6.isFocused?"suggestion":void 0},r4.default.createElement(B5,null,T6.option.description||" "))))},K[64]=E,K[65]=J6,K[66]=V6,K[67]=y6;else y6=K[67];a=r4.default.createElement(u,{...l.container()},N6.map(y6));break q}w6=u,o=l.container(),s=$6.visibleOptions.map((Z6,V6)=>{if(Z6.type==="input"){let R6=U.has(Z6.value)?U.get(Z6.value):Z6.initialValue||"",h6=Z6.index===$6.visibleFromIndex,x6=Z6.index===$6.visibleToIndex-1,b6=$6.visibleToIndex<A.length,Q6=$6.visibleFromIndex>0,Y6=$6.visibleFromIndex+V6+1,_6=!V&&$6.focusedValue===Z6.value,F6=$6.value===Z6.value;return r4.default.createElement(CN6,{key:String(Z6.value),option:Z6,isFocused:_6,isSelected:F6,shouldShowDownArrow:b6&&x6,shouldShowUpArrow:Q6&&h6,maxIndexWidth:J6,index:Y6,inputValue:R6,onInputChange:(W6)=>{c((v6)=>{let m6=new Map(v6);return m6.set(Z6.value,W6),m6})},onSubmit:(W6)=>{let v6=T&&Object.values(T).some(ZHz);if(W6.trim()||v6||Z6.allowEmptySubmitToCancel)j?.(Z6.value);else w?.()},onExit:w,layout:"compact",showLabel:I,onOpenEditor:G,resetCursorOnUpdate:Z6.resetCursorOnUpdate,onImagePaste:Z,pastedContents:T,onRemoveImage:v,imagesSelected:B,selectedImageIndex:C,onImagesSelectedChange:p,onSelectedImageIndexChange:g})}let y6=Z6.label;if(typeof Z6.label==="string"&&$&&Z6.label.includes($)){let R6=Z6.label,h6=R6.indexOf($);y6=r4.default.createElement(r4.default.Fragment,null,R6.slice(0,h6),r4.default.createElement(k,{...l.highlightedText()},$),R6.slice(h6+$.length))}let T6=Z6.index===$6.visibleFromIndex,n6=Z6.index===$6.visibleToIndex-1,o6=$6.visibleToIndex<A.length,I6=$6.visibleFromIndex>0,C6=$6.visibleFromIndex+V6+1,l6=!V&&$6.focusedValue===Z6.value,S6=$6.value===Z6.value,E6=Z6.disabled===!0;return r4.default.createElement(Qq6,{key:String(Z6.value),isFocused:l6,isSelected:S6,shouldShowDownArrow:o6&&n6,shouldShowUpArrow:I6&&T6},r4.default.createElement(u,{flexDirection:"row",flexShrink:0},!E&&r4.default.createElement(k,{dimColor:!0},`${C6}.`.padEnd(J6+2)),r4.default.createElement(k,{dimColor:E6,color:E6?void 0:S6?"success":l6?"suggestion":void 0},y6,I&&Z6.description&&r4.default.createElement(k,{dimColor:E6||Z6.dimDescription!==!1}," ",Z6.description))),!I&&Z6.description&&r4.default.createElement(u,{flexShrink:99,marginLeft:2},r4.default.createElement(k,{wrap:"wrap-trim",dimColor:E6||Z6.dimDescription!==!1,color:E6?void 0:S6?"success":l6?"suggestion":void 0},r4.default.createElement(B5,null,Z6.description))))})}K[28]=E,K[29]=$,K[30]=B,K[31]=I,K[32]=U,K[33]=V,K[34]=R,K[35]=w,K[36]=j,K[37]=Z,K[38]=G,K[39]=v,K[40]=A.length,K[41]=T,K[42]=C,K[43]=$6.focusedValue,K[44]=$6.options,K[45]=$6.value,K[46]=$6.visibleFromIndex,K[47]=$6.visibleOptions,K[48]=$6.visibleToIndex,K[49]=w6,K[50]=o,K[51]=s,K[52]=a}else w6=K[49],o=K[50],s=K[51],a=K[52];if(a!==Symbol.for("react.early_return_sentinel"))return a;let n;if(K[68]!==w6||K[69]!==o||K[70]!==s)n=r4.default.createElement(w6,{...o},s),K[68]=w6,K[69]=o,K[70]=s,K[71]=n;else n=K[71];return n}function ZHz(q){return q.type==="image"}function GHz(q){return q.description}function THz(q){return q.type==="input"}function vHz(q){return q.type==="image"}function kHz(q){return q.type==="image"}function VHz(){return{bold:!0}}function NHz(){return{flexDirection:"column"}}function yHz(q){return q.type==="image"}function EHz(q){return q.type==="image"}function LHz(q){let K=z6(5),{isFocused:_,children:z}=q,Y;if(K[0]!==_)Y={line:0,column:0,active:_},K[0]=_,K[1]=Y;else Y=K[1];let $=LN6(Y),A;if(K[2]!==z||K[3]!==$)A=r4.default.createElement(u,{ref:$,flexDirection:"row"},z),K[2]=z,K[3]=$,K[4]=A;else A=K[4];return A}var r4;var p3=y(()=>{q8();bq();dE8();Q5();s6();Vg1();oE8();jC4();XC4();r4=O6(D6(),1)});function DC4(q){let K=z6(3),{request:_,onDone:z}=q,Y;if(K[0]!==z||K[1]!==_)Y=_.tccState?w5.createElement(RHz,{tccState:_.tccState,onDone:()=>z(WC4)}):w5.createElement(SHz,{request:_,onDone:z}),K[0]=z,K[1]=_,K[2]=Y;else Y=K[2];return Y}function RHz(q){let K=z6(26),{tccState:_,onDone:z}=q,Y;if(K[0]!==_.accessibility||K[1]!==_.screenRecording){if(Y=[],!_.accessibility){let G;if(K[3]===Symbol.for("react.memo_cache_sentinel"))G={label:"Open System Settings → Accessibility",value:"open_accessibility"},K[3]=G;else G=K[3];Y.push(G)}if(!_.screenRecording){let G;if(K[4]===Symbol.for("react.memo_cache_sentinel"))G={label:"Open System Settings → Screen Recording",value:"open_screen_recording"},K[4]=G;else G=K[4];Y.push(G)}let f;if(K[5]===Symbol.for("react.memo_cache_sentinel"))f={label:"Try again",value:"retry"},K[5]=f;else f=K[5];Y.push(f),K[0]=_.accessibility,K[1]=_.screenRecording,K[2]=Y}else Y=K[2];let $=Y,A;if(K[6]!==z)A=function(G){switch(G){case"open_accessibility":{a8("open",["x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"],{useCwd:!1});return}case"open_screen_recording":{a8("open",["x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"],{useCwd:!1});return}case"retry":{z();return}}},K[6]=z,K[7]=A;else A=K[7];let O=A,w=_.accessibility?`${t6.tick} granted`:`${t6.cross} not granted`,j;if(K[8]!==w)j=w5.createElement(k,null,"Accessibility:"," ",w),K[8]=w,K[9]=j;else j=K[9];let H=_.screenRecording?`${t6.tick} granted`:`${t6.cross} not granted`,J;if(K[10]!==H)J=w5.createElement(k,null,"Screen Recording:"," ",H),K[10]=H,K[11]=J;else J=K[11];let M;if(K[12]!==j||K[13]!==J)M=w5.createElement(u,{flexDirection:"column"},j,J),K[12]=j,K[13]=J,K[14]=M;else M=K[14];let X;if(K[15]===Symbol.for("react.memo_cache_sentinel"))X=w5.createElement(k,{dimColor:!0},'Grant the missing permissions in System Settings, then select "Try again". macOS may require you to restart Claude Code after granting Screen Recording.'),K[15]=X;else X=K[15];let P;if(K[16]!==O||K[17]!==z||K[18]!==$)P=w5.createElement(H1,{options:$,onChange:O,onCancel:z}),K[16]=O,K[17]=z,K[18]=$,K[19]=P;else P=K[19];let W;if(K[20]!==M||K[21]!==P)W=w5.createElement(u,{flexDirection:"column",paddingX:1,paddingY:1,gap:1},M,X,P),K[20]=M,K[21]=P,K[22]=W;else W=K[22];let D;if(K[23]!==z||K[24]!==W)D=w5.createElement(R1,{title:"Computer Use needs macOS permissions",onCancel:z},W),K[23]=z,K[24]=W,K[25]=D;else D=K[25];return D}function SHz(q){let K=z6(48),{request:_,onDone:z}=q,Y;if(K[0]!==_.apps)Y=()=>new Set(_.apps.flatMap(IHz)),K[0]=_.apps,K[1]=Y;else Y=K[1];let[$]=PC4.useState(Y),A;if(K[2]===Symbol.for("react.memo_cache_sentinel"))A=["clipboardRead","clipboardWrite","systemKeyCombos"],K[2]=A;else A=K[2];let O=A,w;if(K[3]!==_.requestedFlags)w=O.filter((C)=>_.requestedFlags[C]),K[3]=_.requestedFlags,K[4]=w;else w=K[4];let j=w,H=$.size,J;if(K[5]!==$.size)J=A7($.size,"app"),K[5]=$.size,K[6]=J;else J=K[6];let M=`Allow for this session (${H} ${J})`,X;if(K[7]!==M)X={label:M,value:"allow_all"},K[7]=M,K[8]=X;else X=K[8];let P;if(K[9]===Symbol.for("react.memo_cache_sentinel"))P={label:w5.createElement(k,null,"Deny, and tell Claude what to do differently ",w5.createElement(k,{bold:!0},"(esc)")),value:"deny"},K[9]=P;else P=K[9];let W;if(K[10]!==X)W=[X,P],K[10]=X,K[11]=W;else W=K[11];let D=W,f;if(K[12]!==$||K[13]!==z||K[14]!==_.apps||K[15]!==j)f=function(g){if(!g){z(WC4);return}let F=Date.now(),U=_.apps.flatMap((t)=>t.resolved&&$.has(t.resolved.bundleId)?[{bundleId:t.resolved.bundleId,displayName:t.resolved.displayName,grantedAt:F}]:[]),c=_.apps.filter((t)=>!t.resolved||!$.has(t.resolved.bundleId)).map(xHz),K6={...xU,...Object.fromEntries(j.map(bHz))};z({granted:U,denied:c,flags:K6})},K[12]=$,K[13]=z,K[14]=_.apps,K[15]=j,K[16]=f;else f=K[16];let G=f,Z;if(K[17]!==G)Z=()=>G(!1),K[17]=G,K[18]=Z;else Z=K[18];let T;if(K[19]!==_.reason)T=_.reason?w5.createElement(k,{dimColor:!0},_.reason):null,K[19]=_.reason,K[20]=T;else T=K[20];let v;if(K[21]!==$||K[22]!==_.apps){let C;if(K[24]!==$)C=(g)=>{let F=g.resolved;if(!F)return w5.createElement(k,{key:g.requestedName,dimColor:!0}," ",t6.circle," ",g.requestedName," ",w5.createElement(k,{dimColor:!0},"(not installed)"));if(g.alreadyGranted)return w5.createElement(k,{key:F.bundleId,dimColor:!0}," ",t6.tick," ",F.displayName," ",w5.createElement(k,{dimColor:!0},"(already granted)"));let U=NS4(F.bundleId),c=$.has(F.bundleId);return w5.createElement(u,{key:F.bundleId,flexDirection:"column"},w5.createElement(k,null," ",c?t6.circleFilled:t6.circle," ",F.displayName),U?w5.createElement(k,{bold:!0}," ",t6.warning," ",hHz[U]):null)},K[24]=$,K[25]=C;else C=K[25];v=_.apps.map(C),K[21]=$,K[22]=_.apps,K[23]=v}else v=K[23];let V;if(K[26]!==v)V=w5.createElement(u,{flexDirection:"column"},v),K[26]=v,K[27]=V;else V=K[27];let E;if(K[28]!==j)E=j.length>0?w5.createElement(u,{flexDirection:"column"},w5.createElement(k,{dimColor:!0},"Also requested:"),j.map(CHz)):null,K[28]=j,K[29]=E;else E=K[29];let S;if(K[30]!==_.willHide)S=_.willHide&&_.willHide.length>0?w5.createElement(k,{dimColor:!0},_.willHide.length," other"," ",A7(_.willHide.length,"app")," will be hidden while Claude works."):null,K[30]=_.willHide,K[31]=S;else S=K[31];let R,x;if(K[32]!==G)R=(C)=>G(C==="allow_all"),x=()=>G(!1),K[32]=G,K[33]=R,K[34]=x;else R=K[33],x=K[34];let I;if(K[35]!==D||K[36]!==R||K[37]!==x)I=w5.createElement(H1,{options:D,onChange:R,onCancel:x}),K[35]=D,K[36]=R,K[37]=x,K[38]=I;else I=K[38];let B;if(K[39]!==T||K[40]!==V||K[41]!==E||K[42]!==S||K[43]!==I)B=w5.createElement(u,{flexDirection:"column",paddingX:1,paddingY:1,gap:1},T,V,E,S,I),K[39]=T,K[40]=V,K[41]=E,K[42]=S,K[43]=I,K[44]=B;else B=K[44];let p;if(K[45]!==Z||K[46]!==B)p=w5.createElement(R1,{title:"Computer Use wants to control these apps",onCancel:Z},B),K[45]=Z,K[46]=B,K[47]=p;else p=K[47];return p}function CHz(q){return w5.createElement(k,{key:q,dimColor:!0}," ","· ",q)}function bHz(q){return[q,!0]}function xHz(q){return{bundleId:q.resolved?.bundleId??q.requestedName,reason:q.resolved?"user_denied":"not_installed"}}function IHz(q){return q.resolved&&!q.alreadyGranted?[q.resolved.bundleId]:[]}var w5,PC4,WC4,hHz;var fC4=y(()=>{q8();Xg1();xE8();bq();s6();XK();p3();e4();w5=O6(D6(),1),PC4=O6(D6(),1),WC4={granted:[],denied:[],flags:xU};hHz={shell:"equivalent to shell access",filesystem:"can read/write any file",system_settings:"can change system settings"}});import{mkdir as uHz,readFile as mHz,unlink as qL8,writeFile as pHz}from"fs/promises";import{join as BHz}from"path";function UHz(q){if(typeof q!=="object"||q===null)return!1;return"sessionId"in q&&typeof q.sessionId==="string"&&"pid"in q&&typeof q.pid==="number"}function xN6(){return BHz(c1(),gHz)}async function Sa6(){try{let q=await mHz(xN6(),"utf8"),K=r8(q);return UHz(K)?K:void 0}catch{return}}function ZC4(q){try{return process.kill(q,0),!0}catch{return!1}}async function Lg1(q){try{return await pHz(xN6(),g6(q),{flag:"wx"}),!0}catch(K){if(s1(K)==="EEXIST")return!1;throw K}}function Rg1(){Ca6?.(),Ca6=pq(async()=>{await hg1()})}async function GC4(){let q=await Sa6();if(!q)return{kind:"free"};if(q.sessionId===N8())return{kind:"held_by_self"};if(ZC4(q.pid))return{kind:"blocked",by:q.sessionId};return N(`Recovering stale computer-use lock from session ${q.sessionId} (PID ${q.pid})`),await qL8(xN6()).catch(()=>{}),{kind:"free"}}function TC4(){return Ca6!==void 0}async function vC4(){let q=N8(),K={sessionId:q,pid:process.pid,acquiredAt:Date.now()};if(await uHz(c1(),{recursive:!0}),await Lg1(K))return Rg1(),Eg1;let _=await Sa6();if(!_){if(await qL8(xN6()).catch(()=>{}),await Lg1(K))return Rg1(),Eg1;return{kind:"blocked",by:(await Sa6())?.sessionId??"unknown"}}if(_.sessionId===q)return FHz;if(ZC4(_.pid))return{kind:"blocked",by:_.sessionId};if(N(`Recovering stale computer-use lock from session ${_.sessionId} (PID ${_.pid})`),await qL8(xN6()).catch(()=>{}),await Lg1(K))return Rg1(),Eg1;return{kind:"blocked",by:(await Sa6())?.sessionId??"unknown"}}async function hg1(){Ca6?.(),Ca6=void 0;let q=await Sa6();if(!q||q.sessionId!==N8())return!1;try{return await qL8(xN6()),N("Released computer-use lock"),!0}catch{return!1}}var gHz="computer-use.lock",Ca6,Eg1,FHz;var Sg1=y(()=>{v8();c9();_8();m8();l8();y8();Eg1={kind:"acquired",fresh:!0},FHz={kind:"acquired",fresh:!1}});function KL8(){let q,K;return{promise:new Promise((z,Y)=>{q=z,K=Y}),resolve:q,reject:K}}var VC4=m((xPO,kC4)=>{var __dirname="/home/runner/code/tmp/claude-cli-external-build-2195/node_modules/@ant/computer-use-swift/js",QHz=U6("path");if(process.platform!=="darwin")throw Error("@ant/computer-use-swift is only available on macOS");var dHz=U6(process.env.COMPUTER_USE_SWIFT_NODE_PATH??QHz.resolve(__dirname,"../prebuilds/computer_use.node"));kC4.exports=dHz.computerUse});function Am(){if(process.platform!=="darwin")throw Error("@ant/computer-use-swift is macOS-only");return cHz??=VC4()}var cHz;function lHz(q){q._drainMainRunLoop()}function NC4(){if(_L8++,ba6===void 0)ba6=setInterval(lHz,1,Am()),N("[drainRunLoop] pump started",{level:"verbose"})}function yC4(){if(_L8--,_L8<=0&&ba6!==void 0)clearInterval(ba6),ba6=void 0,N("[drainRunLoop] pump stopped",{level:"verbose"}),_L8=0}function nHz(q){q(Error(`computer-use native call exceeded ${EC4}ms`))}async function Om(q){NC4();let K;try{let _=q();_.catch(()=>{});let z=KL8();return K=setTimeout(nHz,EC4,z.reject),await Promise.race([_,z.promise])}finally{clearTimeout(K),yC4()}}var ba6,_L8=0,EC4=30000,LC4,RC4;var Cg1=y(()=>{_8();LC4=NC4,RC4=yC4});function hC4(q){if(xa6)return!0;if(!Am().hotkey.registerEscape(q))return N("[cu-esc] registerEscape returned false",{level:"warn"}),!1;return LC4(),xa6=!0,N("[cu-esc] registered"),!0}function SC4(){if(!xa6)return;try{Am().hotkey.unregister()}finally{RC4(),xa6=!1,N("[cu-esc] unregistered")}}function bg1(){if(!xa6)return;Am().hotkey.notifyExpectedEscape()}var xa6=!1;var zL8=y(()=>{_8();Cg1()});var xC4={};T8(xC4,{getChicagoSubGates:()=>Ia6,getChicagoEnabled:()=>Ig1,getChicagoCoordinateMode:()=>Bw6});function xg1(){return{...CC4,...XG("tengu_malort_pedway",CC4)}}function iHz(){let q=yK();return q==="max"||q==="pro"}function Ig1(){return iHz()&&xg1().enabled}function Ia6(){let{enabled:q,coordinateMode:K,..._}=xg1();return _}function Bw6(){return bC4??=xg1().coordinateMode,bC4}var CC4,bC4;var IN6=y(()=>{o1();G7();m8();CC4={enabled:!1,pixelValidation:!1,clipboardPasteMultiline:!0,mouseAnimation:!0,hideBeforeAction:!0,autoTargetDisplay:!0,clipboardGuard:!0,coordinateMode:"pixels"}});var IC4=m((rPO,ug1)=>{var __dirname="/home/runner/code/tmp/claude-cli-external-build-2195/node_modules/@ant/computer-use-input/js",rHz=U6("path");if(process.platform!=="darwin")ug1.exports={isSupported:!1};else{let q=U6(process.env.COMPUTER_USE_INPUT_NODE_PATH??rHz.resolve(__dirname,"../prebuilds/computer-use-input.node"));ug1.exports={isSupported:!0,...q}}});function rC(){if(mg1)return mg1;let q=IC4();if(!q.isSupported)throw Error("@ant/computer-use-input is not supported on this platform");return mg1=q}var mg1;var pC4={};T8(pC4,{unhideComputerUseApps:()=>tHz,createCliExecutor:()=>Qg1});function Bg1(q,K,_){let z=Math.round(q*_),Y=Math.round(K*_);return IE8(z,Y,Jg1)}async function gg1(){let{stdout:q,code:K}=await a8("pbpaste",[],{useCwd:!1});if(K!==0)throw Error(`pbpaste exited with code ${K}`);return q}async function Fg1(q){let{code:K}=await a8("pbcopy",[],{input:q,useCwd:!1});if(K!==0)throw Error(`pbcopy exited with code ${K}`)}function uC4(q){if(q.length!==1)return!1;let K=q[0].toLowerCase();return K==="escape"||K==="esc"}async function uN6(q,K,_){await q.moveMouse(K,_,!1),await R7(Ug1)}async function mC4(q,K){let _;while((_=K.pop())!==void 0)try{await q.key(_,"release")}catch{}}async function oHz(q,K,_){let z=[];try{for(let Y of K)await q.key(Y,"press"),z.push(Y);return await _()}finally{await mC4(q,z)}}async function aHz(q,K){let _;try{_=await gg1()}catch{N("[computer-use] pbpaste before paste failed; proceeding without restore")}try{if(await Fg1(K),await gg1()!==K)throw Error("Clipboard write did not round-trip.");await q.keys(["command","v"]),await R7(100)}finally{if(typeof _==="string")try{await Fg1(_)}catch{N("[computer-use] clipboard restore after paste failed")}}}async function sHz(q,K,_,z){if(!z){await uN6(q,K,_);return}let Y=await q.mouseLocation(),$=K-Y.x,A=_-Y.y,O=Math.hypot($,A);if(O<1)return;let w=Math.min(O/2000,0.5);if(w<0.03){await uN6(q,K,_);return}let j=60,H=1000/j,J=Math.floor(w*j);for(let M=1;M<=J;M++){let X=M/J,P=1-Math.pow(1-X,3);if(await q.moveMouse(Math.round(Y.x+$*P),Math.round(Y.y+A*P),!1),M<J)await R7(H)}await R7(Ug1)}function Qg1(q){if(process.platform!=="darwin")throw Error(`createCliExecutor called on ${process.platform}. Computer control is macOS-only.`);let K=Am(),{getMouseAnimationEnabled:_,getHideBeforeActionEnabled:z}=q,Y=CV1(),$=Y??wf8,A=(O)=>Y===null?[...O]:O.filter((w)=>w!==Y);return N(Y?`[computer-use] terminal ${Y} → surrogate host (hide-exempt, activate-skip, screenshot-excluded)`:"[computer-use] terminal not detected; falling back to sentinel host"),{capabilities:{...Zc6,hostBundleId:wf8},async prepareForAction(O,w){if(!z())return[];return Om(async()=>{try{let j=await K.apps.prepareDisplay(O,$,w);if(j.activated)N(`[computer-use] prepareForAction: activated ${j.activated}`);return j.hidden}catch(j){return N(`[computer-use] prepareForAction failed; continuing to action: ${d6(j)}`,{level:"warn"}),[]}})},async previewHideSet(O,w){return K.apps.previewHideSet([...O,$],w)},async getDisplaySize(O){return K.display.getSize(O)},async listDisplays(){return K.display.listAll()},async findWindowDisplays(O){return K.apps.findWindowDisplays(O)},async resolvePrepareCapture(O){let w=K.display.getSize(O.preferredDisplayId),[j,H]=Bg1(w.width,w.height,w.scaleFactor);return Om(()=>K.resolvePrepareCapture(A(O.allowedBundleIds),$,pg1,j,H,O.preferredDisplayId,O.autoResolve,O.doHide))},async screenshot(O){let w=K.display.getSize(O.displayId),[j,H]=Bg1(w.width,w.height,w.scaleFactor);return Om(()=>K.screenshot.captureExcluding(A(O.allowedBundleIds),pg1,j,H,O.displayId))},async zoom(O,w,j){let H=K.display.getSize(j),[J,M]=Bg1(O.w,O.h,H.scaleFactor);return Om(()=>K.screenshot.captureRegion(A(w),O.x,O.y,O.w,O.h,J,M,pg1,j))},async key(O,w){let j=rC(),H=O.split("+").filter((X)=>X.length>0),J=uC4(H),M=w??1;await Om(async()=>{for(let X=0;X<M;X++){if(X>0)await R7(8);if(J)bg1();await j.keys(H)}})},async holdKey(O,w){let j=rC(),H=[],J=!1;try{await Om(async()=>{for(let M of O){if(J)return;if(uC4([M]))bg1();await j.key(M,"press"),H.push(M)}}),await R7(w)}finally{J=!0,await Om(()=>mC4(j,H))}},async type(O,w){let j=rC();if(w.viaClipboard){await Om(()=>aHz(j,O));return}await j.typeText(O)},readClipboard:gg1,writeClipboard:Fg1,async moveMouse(O,w){await uN6(rC(),O,w)},async click(O,w,j,H,J){let M=rC();if(await uN6(M,O,w),J&&J.length>0)await Om(()=>oHz(M,J,()=>M.mouseButton(j,"click",H)));else await M.mouseButton(j,"click",H)},async mouseDown(){await rC().mouseButton("left","press")},async mouseUp(){await rC().mouseButton("left","release")},async getCursorPosition(){return rC().mouseLocation()},async drag(O,w){let j=rC();if(O!==void 0)await uN6(j,O.x,O.y);await j.mouseButton("left","press"),await R7(Ug1);try{await sHz(j,w.x,w.y,_())}finally{await j.mouseButton("left","release")}},async scroll(O,w,j,H){let J=rC();if(await uN6(J,O,w),H!==0)await J.mouseScroll(H,"vertical");if(j!==0)await J.mouseScroll(j,"horizontal")},async getFrontmostApp(){let O=rC().getFrontmostAppInfo();if(!O||!O.bundleId)return null;return{bundleId:O.bundleId,displayName:O.appName}},async appUnderPoint(O,w){return K.apps.appUnderPoint(O,w)},async listInstalledApps(){return Om(()=>K.apps.listInstalled())},async getAppIcon(O){return K.apps.iconDataUrl(O)??void 0},async listRunningApps(){return K.apps.listRunning()},async openApp(O){await K.apps.open(O)}}}async function tHz(q){if(q.length===0)return;await Am().apps.unhide([...q])}var pg1=0.75,Ug1=50;var dg1=y(()=>{La6();_8();y8();XK();wi();Cg1();zL8()});import{format as ua6}from"util";class BC4{silly(q,...K){N(ua6(q,...K),{level:"debug"})}debug(q,...K){N(ua6(q,...K),{level:"debug"})}info(q,...K){N(ua6(q,...K),{level:"info"})}warn(q,...K){N(ua6(q,...K),{level:"warn"})}error(q,...K){N(ua6(q,...K),{level:"error"})}}function ma6(){if(YL8)return YL8;return YL8={serverName:p$6,logger:new BC4,executor:Qg1({getMouseAnimationEnabled:()=>Ia6().mouseAnimation,getHideBeforeActionEnabled:()=>Ia6().hideBeforeAction}),ensureOsPermissions:async()=>{let q=Am(),K=q.tcc.checkAccessibility(),_=q.tcc.checkScreenRecording();return K&&_?{granted:!0}:{granted:!1,accessibility:K,screenRecording:_}},isDisabled:()=>!Ig1(),getSubGates:Ia6,getAutoUnhideEnabled:()=>!0,cropRawPatch:()=>null},YL8}var YL8;var cg1=y(()=>{_8();wi();dg1();IN6()});function pa6(q){return q?`(${q[0]}, ${q[1]})`:""}function gC4(q){return{userFacingName(){return`Computer Use[${q}]`},renderToolUseMessage(K){switch(q){case"screenshot":case"left_mouse_down":case"left_mouse_up":case"cursor_position":case"list_granted_applications":case"read_clipboard":return"";case"left_click":case"right_click":case"middle_click":case"double_click":case"triple_click":case"mouse_move":return pa6(K.coordinate);case"left_click_drag":return K.start_coordinate?`${pa6(K.start_coordinate)} → ${pa6(K.coordinate)}`:`to ${pa6(K.coordinate)}`;case"type":return typeof K.text==="string"?`"${T4(K.text,40)}"`:"";case"key":case"hold_key":return typeof K.text==="string"?K.text:"";case"scroll":return[K.direction,K.amount&&`×${K.amount}`,K.coordinate&&`at ${pa6(K.coordinate)}`].filter(Boolean).join(" ");case"zoom":{let _=K.region;return Array.isArray(_)&&_.length===4?`[${_[0]}, ${_[1]}, ${_[2]}, ${_[3]}]`:""}case"wait":return typeof K.duration==="number"?`${K.duration}s`:"";case"write_clipboard":return typeof K.text==="string"?`"${T4(K.text,40)}"`:"";case"open_application":return typeof K.bundle_id==="string"?String(K.bundle_id):"";case"request_access":{let _=K.apps;if(!Array.isArray(_))return"";return _.map((Y)=>typeof Y?.displayName==="string"?Y.displayName:"").filter(Boolean).join(", ")}case"computer_batch":{let _=K.actions;return Array.isArray(_)?`${_.length} actions`:""}default:return""}},renderToolResultMessage(K,_,{verbose:z}){if(z||typeof K!=="object"||K===null)return null;let Y=eHz[q];if(!Y)return null;return Ba6.createElement(s8,{height:1},Ba6.createElement(k,{dimColor:!0},Y))}}}var Ba6,eHz;var FC4=y(()=>{gK();s6();U7();Ba6=O6(D6(),1);eHz={screenshot:"Captured",zoom:"Captured",request_access:"Access updated",left_click:"Clicked",right_click:"Clicked",middle_click:"Clicked",double_click:"Clicked",triple_click:"Clicked",type:"Typed",key:"Pressed",hold_key:"Pressed",scroll:"Scrolled",left_click_drag:"Dragged",open_application:"Opened"}});var lC4={};T8(lC4,{getComputerUseMCPToolOverrides:()=>KJz,buildSessionContext:()=>cC4});function av(){return dC4}function UC4(q){return`Computer use is in use by another Claude session (${q.slice(0,8)}…). Wait for that session to finish or run /exit there.`}function cC4(){return{getAllowedApps:()=>av().getAppState().computerUseMcpState?.allowedApps??[],getGrantFlags:()=>av().getAppState().computerUseMcpState?.grantFlags??xU,getUserDeniedBundleIds:()=>[],getSelectedDisplayId:()=>av().getAppState().computerUseMcpState?.selectedDisplayId,getDisplayPinnedByModel:()=>av().getAppState().computerUseMcpState?.displayPinnedByModel??!1,getDisplayResolvedForApps:()=>av().getAppState().computerUseMcpState?.displayResolvedForApps,getLastScreenshotDims:()=>{let q=av().getAppState().computerUseMcpState?.lastScreenshotDims;return q?{...q,displayId:q.displayId??0,originX:q.originX??0,originY:q.originY??0}:void 0},onPermissionRequest:(q,K)=>_Jz(q),onAllowedAppsChanged:(q,K)=>av().setAppState((_)=>{let z=_.computerUseMcpState,Y=z?.allowedApps,$=z?.grantFlags,A=Y?.length===q.length&&q.every((w,j)=>Y[j]?.bundleId===w.bundleId),O=$?.clipboardRead===K.clipboardRead&&$?.clipboardWrite===K.clipboardWrite&&$?.systemKeyCombos===K.systemKeyCombos;return A&&O?_:{..._,computerUseMcpState:{...z,allowedApps:[...q],grantFlags:K}}}),onAppsHidden:(q)=>{if(q.length===0)return;av().setAppState((K)=>{let _=K.computerUseMcpState,z=_?.hiddenDuringTurn;if(z&&q.every((Y)=>z.has(Y)))return K;return{...K,computerUseMcpState:{..._,hiddenDuringTurn:new Set([...z??[],...q])}}})},onResolvedDisplayUpdated:(q)=>av().setAppState((K)=>{let _=K.computerUseMcpState;if(_?.selectedDisplayId===q&&!_.displayPinnedByModel&&_.displayResolvedForApps===void 0)return K;return{...K,computerUseMcpState:{..._,selectedDisplayId:q,displayPinnedByModel:!1,displayResolvedForApps:void 0}}}),onDisplayPinned:(q)=>av().setAppState((K)=>{let _=K.computerUseMcpState,z=q!==void 0,Y=z?_?.displayResolvedForApps:void 0;if(_?.selectedDisplayId===q&&_?.displayPinnedByModel===z&&_?.displayResolvedForApps===Y)return K;return{...K,computerUseMcpState:{..._,selectedDisplayId:q,displayPinnedByModel:z,displayResolvedForApps:Y}}}),onDisplayResolvedForApps:(q)=>av().setAppState((K)=>{let _=K.computerUseMcpState;if(_?.displayResolvedForApps===q)return K;return{...K,computerUseMcpState:{..._,displayResolvedForApps:q}}}),onScreenshotCaptured:(q)=>av().setAppState((K)=>{let _=K.computerUseMcpState,z=_?.lastScreenshotDims;return z?.width===q.width&&z?.height===q.height&&z?.displayWidth===q.displayWidth&&z?.displayHeight===q.displayHeight&&z?.displayId===q.displayId&&z?.originX===q.originX&&z?.originY===q.originY?K:{...K,computerUseMcpState:{..._,lastScreenshotDims:q}}}),checkCuLock:async()=>{let q=await GC4();switch(q.kind){case"free":return{holder:void 0,isSelf:!1};case"held_by_self":return{holder:N8(),isSelf:!0};case"blocked":return{holder:q.by,isSelf:!1}}},acquireCuLock:async()=>{let q=await vC4();if(q.kind==="blocked")throw Error(UC4(q.by));if(q.fresh){let K=hC4(()=>{N("[cu-esc] user escape, aborting turn"),av().abortController.abort()});av().sendOSNotification?.({message:K?"Claude is using your computer · press Esc to stop":"Claude is using your computer · press Ctrl+C to stop",notificationType:"computer_use_enter"})}},formatLockHeldMessage:UC4}}function qJz(){if($L8)return $L8;let q=cC4();return $L8={ctx:q,dispatch:QE8(ma6(),Bw6(),q)},$L8}function KJz(q){let K=async(_,z)=>{dC4=z;let{dispatch:Y}=qJz(),{telemetry:$,...A}=await Y(q,_);if($?.error_kind)N(`[Computer Use MCP] ${q} error_kind=${$.error_kind}`);return{data:Array.isArray(A.content)?A.content.map((w)=>w.type==="image"?{type:"image",source:{type:"base64",media_type:w.mimeType??"image/jpeg",data:w.data}}:{type:"text",text:w.type==="text"?w.text:""}):A.content}};return{...gC4(q),call:K}}async function _Jz(q){let K=av(),_=K.setToolJSX;if(!_)return{granted:[],denied:[],flags:xU};try{return await new Promise((z,Y)=>{let $=K.abortController.signal;if($.aborted){Y(Error("Computer Use permission dialog aborted"));return}let A=()=>{$.removeEventListener("abort",A),Y(Error("Computer Use permission dialog aborted"))};$.addEventListener("abort",A),_({jsx:QC4.createElement(DC4,{request:q,onDone:(O)=>{$.removeEventListener("abort",A),z(O)}}),shouldHidePromptInput:!0})})}finally{_(null)}}var QC4,$L8,dC4;var nC4=y(()=>{La6();v8();fC4();_8();Sg1();zL8();IN6();cg1();FC4();QC4=O6(D6(),1)});var ng1={};T8(ng1,{createLinkedTransportPair:()=>zJz});class lg1{peer;closed=!1;onclose;onerror;onmessage;_setPeer(q){this.peer=q}async start(){}async send(q){if(this.closed)throw Error("Transport is closed");queueMicrotask(()=>{this.peer?.onmessage?.(q)})}async close(){if(this.closed)return;if(this.closed=!0,this.onclose?.(),this.peer&&!this.peer.closed)this.peer.closed=!0,this.peer.onclose?.()}}function zJz(){let q=new lg1,K=new lg1;return q._setPeer(K),K._setPeer(q),[q,K]}function wJz(q,K){if(YJz.some((_)=>q.startsWith(_)))return!0;if(K){let _=K.endsWith("/")?`${K}Applications/`:`${K}/Applications/`;if(q.startsWith(_))return!0}return!1}function jJz(q){return $Jz.some((K)=>K.test(q))}function iC4(q,K){let _=new Set;return q.map((z)=>z.trim()).filter((z)=>{if(!z)return!1;if(z.length>40)return!1;if(K&&!OJz.test(z))return!1;if(_.has(z))return!1;return _.add(z),!0}).sort((z,Y)=>z.localeCompare(Y))}function HJz(q){let K=iC4(q,!0);if(K.length<=50)return K;return[...K.slice(0,50),`… and ${K.length-50} more`]}function JJz(q){return iC4(q,!1)}function rC4(q,K){let{alwaysKept:_,rest:z}=q.reduce((A,O)=>{if(AJz.has(O.bundleId))A.alwaysKept.push(O.displayName);else if(wJz(O.path,K)&&!jJz(O.displayName))A.rest.push(O.displayName);return A},{alwaysKept:[],rest:[]}),Y=JJz(_),$=new Set(Y);return[...Y,...HJz(z).filter((A)=>!$.has(A))]}var YJz,$Jz,AJz,OJz;var oC4=y(()=>{YJz=["/Applications/","/System/Applications/"],$Jz=[/Helper(?:$|\s\()/,/Agent(?:$|\s\()/,/Service(?:$|\s\()/,/Uninstaller(?:$|\s\()/,/Updater(?:$|\s\()/,/^\./],AJz=new Set(["com.apple.Safari","com.google.Chrome","com.microsoft.edgemac","org.mozilla.firefox","company.thebrowser.Browser","com.tinyspeck.slackmacgap","us.zoom.xos","com.microsoft.teams2","com.microsoft.teams","com.apple.MobileSMS","com.apple.mail","com.microsoft.Word","com.microsoft.Excel","com.microsoft.Powerpoint","com.microsoft.Outlook","com.apple.iWork.Pages","com.apple.iWork.Numbers","com.apple.iWork.Keynote","com.google.GoogleDocs","notion.id","com.apple.Notes","md.obsidian","com.linear","com.figma.Desktop","com.microsoft.VSCode","com.apple.Terminal","com.googlecode.iterm2","com.github.GitHubDesktop","com.apple.finder","com.apple.iCal","com.apple.systempreferences"]),OJz=/^[\p{L}\p{M}\p{N}_ .&'()+-]+$/u});var ig1={};T8(ig1,{runComputerUseMcpServer:()=>PJz,createComputerUseMcpServerForCli:()=>sC4});import{homedir as MJz}from"os";async function XJz(){let K=ma6().executor.listInstalledApps(),_,z=new Promise(($)=>{_=setTimeout($,aC4,void 0)}),Y=await Promise.race([K,z]).catch(()=>{return}).finally(()=>clearTimeout(_));if(!Y){K.catch(()=>{}),N(`[Computer Use MCP] app enumeration exceeded ${aC4}ms or failed; tool description omits list`);return}return rC4(Y,MJz())}async function sC4(){let q=ma6(),K=Bw6(),_=vg1(q,K),z=await XJz(),Y=uw6(q.executor.capabilities,K,z);return _.setRequestHandler(ac,async()=>q.isDisabled()?{tools:[]}:{tools:Y}),_}async function PJz(){d$6(),tG6();let q=await sC4(),K=new g96,_=!1,z=async()=>{if(_)return;_=!0,await Promise.all([ji(),T16()]),process.exit(0)};process.stdin.on("end",()=>void z()),process.stdin.on("error",()=>void z()),N("[Computer Use MCP] Starting MCP server"),await q.connect(K),N("[Computer Use MCP] MCP server started")}var aC4=1000;var rg1=y(()=>{La6();sz8();lM();sG6();Hi();xc6();V1();_8();oC4();IN6();cg1()});import{mkdir as GJz,readFile as TJz,unlink as vJz,writeFile as kJz}from"fs/promises";import{dirname as VJz,join as NJz}from"path";function zb4(q){if(("code"in q?q.code:void 0)!==404)return!1;return q.message.includes('"code":-32001')||q.message.includes('"code": -32001')}function DJz(){return parseInt(process.env.MCP_TOOL_TIMEOUT||"",10)||WJz}function qF1(){return NJz(c1(),"mcp-needs-auth-cache.json")}function $b4(){if(!Fa6)Fa6=TJz(qF1(),"utf-8").then((q)=>r8(q)).catch(()=>({}));return Fa6}async function EJz(q){let _=(await $b4())[q];if(!_)return!1;return Date.now()-_.timestamp<yJz}function LJz(q){tC4=tC4.then(async()=>{let K=await $b4();K[q]={timestamp:Date.now()};let _=qF1();await GJz(VJz(_),{recursive:!0}),await kJz(_,g6(K)),Fa6=null}).catch(()=>{})}function qE8(){Fa6=null,vJz(qF1()).catch(()=>{})}function sg1(q){let K=LN(q);return K?{mcpServerBaseUrl:K}:{}}function og1(q,K,_){return d("tengu_mcp_server_needs_auth",{transportType:_,...sg1(K)}),C8(q,`Authentication required for ${{sse:"SSE",http:"HTTP","claudeai-proxy":"claude.ai proxy"}[_]} server`),LJz(q),{name:q,type:"needs-auth",config:K}}function RJz(q){return async(K,_)=>{let z=async()=>{await k$();let O=Kq();if(!O)throw Error("No claude.ai OAuth token available");let w=new Headers(_?.headers);return w.set("Authorization",`Bearer ${O.accessToken}`),{response:await q(K,{..._,headers:w}),sentToken:O.accessToken}},{response:Y,sentToken:$}=await z();if(Y.status!==401)return Y;let A=await OS($).catch(()=>!1);if(d("tengu_mcp_claudeai_proxy_401",{tokenChanged:A}),!A){let O=Kq()?.accessToken;if(!O||O===$)return Y}try{return(await z()).response}catch{return Y}}}async function eC4(q,K){return new(await Promise.resolve().then(() => (W96(),MI6))).default(q,["mcp"],K)}function AL8(){return parseInt(process.env.MCP_TIMEOUT||"",10)||30000}function ag1(q){return async(K,_)=>{if((_?.method??"GET").toUpperCase()==="GET")return q(K,_);let Y=new Headers(_?.headers);if(!Y.has("accept"))Y.set("accept",SJz);let $=new AbortController,A=setTimeout((H)=>H.abort(new DOMException("The operation timed out.","TimeoutError")),Ab4,$);A.unref?.();let O=_?.signal,w=()=>$.abort(O?.reason);if(O?.addEventListener("abort",w),O?.aborted)$.abort(O.reason);let j=()=>{clearTimeout(A),O?.removeEventListener("abort",w)};try{let H=await q(K,{..._,headers:Y,signal:$.signal});return j(),H}catch(H){throw j(),H}}}function KF1(){return parseInt(process.env.MCP_SERVER_CONNECTION_BATCH_SIZE||"",10)||3}function CJz(){return parseInt(process.env.MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE||"",10)||20}function qb4(q){return!q.type||q.type==="stdio"||q.type==="sdk"}function xJz(q){return!q.name.startsWith("mcp__ide__")||bJz.includes(q.name)}function tg1(q,K){return`${q}-${g6(K)}`}async function pG(q,K){let _=tg1(q,K);try{let z=await oC(q,K);if(z.type==="connected")await z.cleanup()}catch{}oC.cache.delete(_),mL.cache.delete(q),lr.cache.delete(q),Fw6.cache.delete(q)}async function _N6(q){if(q.config.type==="sdk")return q;let K=await oC(q.name,q.config);if(K.type!=="connected")throw new uk(`MCP server "${q.name}" is not connected`,"MCP server not connected");return K}function Ob4(q,K){if(q.type!==K.type)return!1;let{scope:_,...z}=q,{scope:Y,...$}=K;return g6(z)===g6($)}function IJz(q,K){let _=Object.keys(q);return _.length>0?_.map((z)=>`${z}=${String(q[z])}`).join(" "):K}async function zm(q,K,_){return(await jb4({client:_,tool:q,args:K,signal:P3().signal})).content}async function qm(q,K){try{ZV(),await pG(q,K);let _=await oC(q,K);if(_.type!=="connected")return{client:_,tools:[],commands:[]};if(K.type==="claudeai-proxy")VB1(q);let z=!!_.capabilities?.resources,[Y,$,A,O]=await Promise.all([mL(_),Fw6(_),Promise.resolve([]),z?lr(_):Promise.resolve([])]),w=[...$,...A],j=[];if(z){if(![cr,sr].some((J)=>Y.some((M)=>g_(M,J.name))))j.push(cr,sr)}return{client:_,tools:[...Y,...j],commands:w,resources:O.length>0?O:void 0}}catch(_){return Qz(q,`Error during reconnection: ${d6(_)}`),{client:{name:q,type:"failed",config:K},tools:[],commands:[]}}}async function Kb4(q,K,_){await Bo6(q,_,{concurrency:K})}async function mN6(q,K){let _=!1,z=Object.entries(K??(await Iq6()).servers),Y=[];for(let W of z)if(bG(W[0]))q({client:{name:W[0],type:"disabled",config:W[1]},tools:[],commands:[]});else Y.push(W);let $=Y.length,A=$7(Y,([W,D])=>D.type==="stdio"),O=$7(Y,([W,D])=>D.type==="sse"),w=$7(Y,([W,D])=>D.type==="http"),j=$7(Y,([W,D])=>D.type==="sse-ide"),H=$7(Y,([W,D])=>D.type==="ws-ide"),J=Y.filter(([W,D])=>qb4(D)),M=Y.filter(([W,D])=>!qb4(D)),X={totalServers:$,stdioCount:A,sseCount:O,httpCount:w,sseIdeCount:j,wsIdeCount:H},P=async([W,D])=>{try{if(bG(W)){q({client:{name:W,type:"disabled",config:D},tools:[],commands:[]});return}if((D.type==="claudeai-proxy"||D.type==="http"||D.type==="sse")&&(await EJz(W)||(D.type==="http"||D.type==="sse")&&FR4(W,D))){C8(W,"Skipping connection (cached needs-auth)"),q({client:{name:W,type:"needs-auth",config:D},tools:[BB1(W,D)],commands:[]});return}let f=await oC(W,D,X);if(f.type!=="connected"){q({client:f,tools:f.type==="needs-auth"?[BB1(W,D)]:[],commands:[]});return}if(D.type==="claudeai-proxy")VB1(W);let G=!!f.capabilities?.resources,[Z,T,v,V]=await Promise.all([mL(f),Fw6(f),Promise.resolve([]),G?lr(f):Promise.resolve([])]),E=[...T,...v],S=[];if(G&&!_)_=!0,S.push(cr,sr);q({client:f,tools:[...Z,...S],commands:E,resources:V.length>0?V:void 0})}catch(f){Qz(W,`Error fetching tools/commands/resources: ${d6(f)}`),q({client:{name:W,type:"failed",config:D},tools:[],commands:[]})}};await Promise.all([Kb4(J,KF1(),P),Kb4(M,CJz(),P)])}function Ua6(q){return new Promise((K)=>{let _=0,z=0;if(_=Object.keys(q).length,_===0){K({clients:[],tools:[],commands:[]});return}let Y=[],$=[],A=[];mN6((O)=>{if(Y.push(O.client),$.push(...O.tools),A.push(...O.commands),z++,z>=_){let w=A.reduce((j,H)=>{let J=H.name.length+(H.description??"").length+(H.argumentHint??"").length;return j+J},0);d("tengu_mcp_tools_commands_loaded",{tools_count:$.length,commands_count:A.length,commands_metadata_length:w}),K({clients:Y,tools:$,commands:A})}},q).catch((O)=>{Qz("prefetchAllMcpResources",`Failed to get MCP resources: ${d6(O)}`),K({clients:[],tools:[],commands:[]})})})}async function wb4(q,K){switch(q.type){case"text":return[{type:"text",text:q.text}];case"audio":{let _=q;return await _b4(Buffer.from(_.data,"base64"),_.mimeType,K,`[Audio from ${K}] `)}case"image":{let _=Buffer.from(String(q.data),"base64"),z=q.mimeType?.split("/")[1]||"png",Y=await LL(_,_.length,z);return[{type:"image",source:{data:Y.buffer.toString("base64"),media_type:`image/${Y.mediaType}`,type:"base64"}}]}case"resource":{let _=q.resource,z=`[Resource from ${K} at ${_.uri}] `;if("text"in _)return[{type:"text",text:`${z}${_.text}`}];else if("blob"in _)if(hJz.has(_.mimeType??"")){let $=Buffer.from(_.blob,"base64"),A=_.mimeType?.split("/")[1]||"png",O=await LL($,$.length,A),w=[];if(z)w.push({type:"text",text:z});return w.push({type:"image",source:{data:O.buffer.toString("base64"),media_type:`image/${O.mediaType}`,type:"base64"}}),w}else return await _b4(Buffer.from(_.blob,"base64"),_.mimeType,K,z);return[]}case"resource_link":{let _=q,z=`[Resource link: ${_.name}] ${_.uri}`;if(_.description)z+=` (${_.description})`;return[{type:"text",text:z}]}default:return[]}}async function _b4(q,K,_,z){let Y=`mcp-${Z2(_)}-blob-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,$=await ZN6(q,K,Y);if("error"in $)return[{type:"text",text:`${z}Binary content (${K||"unknown type"}, ${q.length} bytes) could not be saved to disk: ${$.error}`}];return[{type:"text",text:DE8($.filepath,K,$.size,z)}]}function OL8(q,K=2){if(q===null)return"null";if(Array.isArray(q)){if(q.length===0)return"[]";return`[${OL8(q[0],K-1)}]`}if(typeof q==="object"){if(K<=0)return"{...}";let z=Object.entries(q).slice(0,10).map(([$,A])=>`${$}: ${OL8(A,K-1)}`),Y=Object.keys(q).length>10?", ...":"";return`{${z.join(", ")}${Y}}`}return typeof q}async function uJz(q,K,_){if(q&&typeof q==="object"){if("toolResult"in q)return{content:String(q.toolResult),type:"toolResult"};if("structuredContent"in q&&q.structuredContent!==void 0)return{content:g6(q.structuredContent),type:"structuredContent",schema:OL8(q.structuredContent)};if("content"in q&&Array.isArray(q.content)){let Y=(await Promise.all(q.content.map(($)=>wb4($,_)))).flat();return{content:Y,type:"contentArray",schema:OL8(Y)}}}let z=`MCP server "${_}" tool "${K}": unexpected response format`;throw Qz(_,z),new uk(z,"MCP tool unexpected response format")}function mJz(q){if(!q||typeof q==="string")return!1;return q.some((K)=>K.type==="image")}async function pJz(q,K,_){let{content:z,type:Y,schema:$}=await uJz(q,K,_);if(_==="ide")return z;if(!await OB1(z))return z;let A=ao6(z);if(k_(process.env.ENABLE_MCP_LARGE_OUTPUT_FILES))return d("tengu_mcp_large_result_handled",{outcome:"truncated",reason:"env_disabled",sizeEstimateTokens:A}),await wB1(z);if(!z)return z;if(mJz(z))return d("tengu_mcp_large_result_handled",{outcome:"truncated",reason:"contains_images",sizeEstimateTokens:A}),await wB1(z);let O=Date.now(),w=`mcp-${Z2(_)}-${Z2(K)}-${O}`,j=typeof z==="string"?z:g6(z,null,2),H=await XE8(j,w);if(PE8(H)){let M=j.length;return d("tengu_mcp_large_result_handled",{outcome:"truncated",reason:"persist_failed",sizeEstimateTokens:A}),`Error: result (${M.toLocaleString()} characters) exceeds maximum allowed tokens. Failed to save output to file: ${H.error}. If this MCP server provides pagination or filtering tools, use them to retrieve specific portions of the data.`}d("tengu_mcp_large_result_handled",{outcome:"persisted",reason:"file_saved",sizeEstimateTokens:A,persistedSizeChars:H.originalSize});let J=qh4(Y,$);return Kh4(H.filepath,H.originalSize,J)}async function BJz({client:q,clientConnection:K,tool:_,args:z,meta:Y,signal:$,setAppState:A,onProgress:O,callToolFn:w=jb4,handleElicitation:j}){for(let J=0;;J++)try{return await w({client:q,tool:_,args:z,meta:Y,signal:$,onProgress:O})}catch(M){if(!(M instanceof MK)||M.code!==$5.UrlElicitationRequired)throw M;if(J>=3)throw M;let X=M.data,W=(X!=null&&typeof X==="object"&&"elicitations"in X&&Array.isArray(X.elicitations)?X.elicitations:[]).filter((f)=>{if(f==null||typeof f!=="object")return!1;let G=f;return G.mode==="url"&&typeof G.url==="string"&&typeof G.elicitationId==="string"&&typeof G.message==="string"}),D=K.type==="connected"?K.name:"unknown";if(W.length===0)throw C8(D,`Tool '${_}' returned -32042 but no valid elicitations in error data`),M;C8(D,`Tool '${_}' requires URL elicitation (error -32042, attempt ${J+1}), processing ${W.length} elicitation(s)`);for(let f of W){let{elicitationId:G}=f,Z=await ka6(D,f,$);if(Z){if(C8(D,`URL elicitation ${G} resolved by hook: ${g6(Z)}`),Z.action!=="accept")return{content:`URL elicitation was ${Z.action==="decline"?"declined":Z.action+"ed"} by a hook. The tool "${_}" could not complete because it requires the user to open a URL.`};continue}let T;if(j)T=await j(D,f,$);else{let V={actionLabel:"Retry now",showCancel:!0};T=await new Promise((E)=>{let S=()=>{E({action:"cancel"})};if($.aborted){S();return}$.addEventListener("abort",S,{once:!0}),A((R)=>({...R,elicitation:{queue:[...R.elicitation.queue,{serverName:D,requestId:`error-elicit-${G}`,params:f,signal:$,waitingState:V,respond:(x)=>{if(x.action==="accept")return;$.removeEventListener("abort",S),E(x)},onWaitingDismiss:(x)=>{if($.removeEventListener("abort",S),x==="retry")E({action:"accept"});else E({action:"cancel"})}}]}}))})}let v=await Va6(D,T,$,"url",G);if(v.action!=="accept")return C8(D,`User ${v.action==="decline"?"declined":v.action+"ed"} URL elicitation ${G}`),{content:`URL elicitation was ${v.action==="decline"?"declined":v.action+"ed"} by the user. The tool "${_}" could not complete because it requires the user to open a URL.`};C8(D,`Elicitation ${G} completed, retrying tool call`)}}}async function jb4({client:{client:q,name:K,config:_},tool:z,args:Y,meta:$,signal:A,onProgress:O}){let w=Date.now(),j;try{C8(K,`Calling MCP tool: ${z}`),j=setInterval((G,Z,T)=>{let v=Date.now()-G,E=`${Math.floor(v/1000)}s`;C8(Z,`Tool '${T}' still running (${E} elapsed)`)},30000,w,K,z);let H=DJz(),J,M=new Promise((G,Z)=>{J=setTimeout((T,v,V,E)=>{T(new uk(`MCP server "${v}" tool "${V}" timed out after ${Math.floor(E/1000)}s`,"MCP tool timeout"))},H,Z,K,z,H)}),X=await Promise.race([q.callTool({name:z,arguments:Y,_meta:$},MB,{signal:A,timeout:H,onprogress:O?(G)=>{O({type:"mcp_progress",status:"progress",serverName:K,toolName:z,progress:G.progress,total:G.total,progressMessage:G.message})}:void 0}),M]).finally(()=>{if(J)clearTimeout(J)});if("isError"in X&&X.isError){let G="Unknown error";if("content"in X&&Array.isArray(X.content)&&X.content.length>0){let Z=X.content[0];if(Z&&typeof Z==="object"&&"text"in Z)G=Z.text}else if("error"in X)G=String(X.error);throw Qz(K,G),new jL8(G,"MCP tool returned error","_meta"in X&&X._meta?{_meta:X._meta}:void 0)}let P=Date.now()-w,W=P<1000?`${P}ms`:P<60000?`${Math.floor(P/1000)}s`:`${Math.floor(P/60000)}m ${Math.floor(P%60000/1000)}s`;C8(K,`Tool '${z}' completed successfully in ${W}`);let D=Hh4(K);if(D)d("tengu_code_indexing_tool_used",{tool:D,source:"mcp",success:!0});return{content:await pJz(X,z,K),_meta:X._meta,structuredContent:X.structuredContent}}catch(H){if(j!==void 0)clearInterval(j);let J=Date.now()-w;if(H instanceof Error&&H.name!=="AbortError")C8(K,`Tool '${z}' failed after ${Math.floor(J/1000)}s: ${H.message}`);if(H instanceof Error){if(("code"in H?H.code:void 0)===401||H instanceof XD)throw C8(K,"Tool call returned 401 Unauthorized - token may have expired"),d("tengu_mcp_tool_call_auth_error",{}),new wL8(K,`MCP server "${K}" requires re-authorization (token expired)`);let X=zb4(H),P="code"in H&&H.code===-32000&&H.message.includes("Connection closed")&&(_.type==="http"||_.type==="claudeai-proxy");if(X||P)throw C8(K,`MCP session expired during tool call (${X?"404/-32001":"connection closed"}), clearing connection cache for re-initialization`),d("tengu_mcp_session_expired",{}),await pG(K,_),new eg1(K)}if(!(H instanceof Error)||H.name!=="AbortError")throw H;return{content:void 0}}finally{if(j!==void 0)clearInterval(j)}}function gJz(q){if(q.message.content[0]?.type!=="tool_use")return;return q.message.content[0].id}async function Hb4(q,K){let _=[],z=[],Y=await Promise.allSettled(Object.entries(q).map(async([$,A])=>{let O=new Hg1($,K),w=new oN8({name:"claude-code",title:"Claude Code",version:{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??"unknown",description:"Anthropic's agentic coding tool",websiteUrl:Zw6},{capabilities:{}});try{await w.connect(O);let j=w.getServerCapabilities(),H={type:"connected",name:$,capabilities:j||{},client:w,config:{...A,scope:"dynamic"},cleanup:async()=>{await w.close()}},J=[];if(j?.tools){let M=await mL(H);J.push(...M)}return{client:H,tools:J}}catch(j){return Qz($,`Failed to connect SDK MCP server: ${j}`),{client:{type:"failed",name:$,config:{...A,scope:"user"}},tools:[]}}}));for(let $ of Y)if($.status==="fulfilled")_.push($.value.client),z.push(...$.value.tools);return{clients:_,tools:z}}var wL8,eg1,jL8,WJz=1e8,ga6=2048,fJz=()=>(MS4(),Eq(JS4)),ZJz=()=>(nC4(),Eq(lC4)),Yb4,yJz=900000,Fa6=null,tC4,hJz,Ab4=60000,SJz="application/json, text/event-stream",bJz,oC,_F1=20,mL,lr,Fw6;var PD=y(()=>{ty4();WE4();fE4();GE4();lM();po6();F4();VE4();np1();v8();H3();Bq();Iy8();fL4();QR4();ZE8();B2();G7();c9();QB1();_8();m8();y8();jG();U2();RL();E8();fE8();jB1();zS4();VB();PI();qv();nC();bw6();IG();k8();CE8();ok();NJ();Dw6();wS4();xz6();or();ON6();f0();jS4();cC();m8();l8();wL8=class wL8 extends Error{serverName;constructor(q,K){super(K);this.name="McpAuthError",this.serverName=q}};eg1=class eg1 extends Error{constructor(q){super(`MCP server "${q}" session expired`);this.name="McpSessionExpiredError"}};jL8=class jL8 extends uk{mcpMeta;constructor(q,K,_){super(q,K);this.mcpMeta=_;this.name="McpToolCallError"}};Yb4=(wi(),Eq(dG6)).isComputerUseMCPServer;tC4=Promise.resolve();hJz=new Set(["image/jpeg","image/png","image/gif","image/webp"]);bJz=["mcp__ide__executeCode","mcp__ide__getDiagnostics"];oC=_1(async(q,K,_)=>{let z=Date.now(),Y;try{let $,A=WD();if(K.type==="sse"){let p=new Sw6(q,K),C=await bE8(q,K),g={authProvider:p,fetch:ag1(pB1(Pw6(),p)),requestInit:{headers:{"User-Agent":O16(),...C}}};g.eventSourceInit={fetch:async(F,U)=>{let c={},K6=await p.tokens();if(K6)c.Authorization=`Bearer ${K6.access_token}`;let t=fz6();return fetch(F,{...U,...t,headers:{"User-Agent":O16(),...c,...U?.headers,...C,Accept:"text/event-stream"}})}},$=new Xy8(new URL(K.url),g),C8(q,"SSE transport initialized, awaiting connection")}else if(K.type==="sse-ide"){C8(q,`Setting up SSE-IDE transport to ${K.url}`);let p=fz6(),C=p.dispatcher?{eventSourceInit:{fetch:async(g,F)=>{return fetch(g,{...F,...p,headers:{"User-Agent":O16(),...F?.headers}})}}}:{};$=new Xy8(new URL(K.url),Object.keys(C).length>0?C:void 0)}else if(K.type==="ws-ide"){let p=YV(),C={"User-Agent":O16(),...K.authToken&&{"X-Claude-Code-Ide-Authorization":K.authToken}},g;if(typeof Bun<"u")g=new globalThis.WebSocket(K.url,{protocols:["mcp"],headers:C,proxy:NI(K.url),tls:p||void 0});else g=await eC4(K.url,{headers:C,agent:VI(K.url),...p||{}});$=new hE8(g)}else if(K.type==="ws"){C8(q,`Initializing WebSocket transport to ${K.url}`);let p=await bE8(q,K),C=YV(),g={"User-Agent":O16(),...A&&{Authorization:`Bearer ${A}`},...p},F=NU(g,(c,K6)=>K6.toLowerCase()==="authorization"?"[REDACTED]":c);C8(q,`WebSocket transport options: ${g6({url:K.url,headers:F,hasSessionAuth:!!A})}`);let U;if(typeof Bun<"u")U=new globalThis.WebSocket(K.url,{protocols:["mcp"],headers:g,proxy:NI(K.url),tls:C||void 0});else U=await eC4(K.url,{headers:g,agent:VI(K.url),...C||{}});$=new hE8(U)}else if(K.type==="http"){C8(q,`Initializing HTTP transport to ${K.url}`),C8(q,`Node version: ${process.version}, Platform: ${process.platform}`),C8(q,`Environment: ${g6({NODE_OPTIONS:process.env.NODE_OPTIONS||"not set",UV_THREADPOOL_SIZE:process.env.UV_THREADPOOL_SIZE||"default",HTTP_PROXY:process.env.HTTP_PROXY||"not set",HTTPS_PROXY:process.env.HTTPS_PROXY||"not set",NO_PROXY:process.env.NO_PROXY||"not set"})}`);let p=new Sw6(q,K),C=await bE8(q,K),g=!!await p.tokens(),F=fz6();C8(q,`Proxy options: ${F.dispatcher?"custom dispatcher":"default"}`);let U={authProvider:p,fetch:ag1(pB1(Pw6(),p)),requestInit:{...F,headers:{"User-Agent":O16(),...A&&!g&&{Authorization:`Bearer ${A}`},...C}}},c=U.requestInit?.headers?NU(U.requestInit.headers,(K6,t)=>t.toLowerCase()==="authorization"?"[REDACTED]":K6):void 0;C8(q,`HTTP transport options: ${g6({url:K.url,headers:c,hasAuthProvider:!!p,timeoutMs:Ab4})}`),$=new Wy8(new URL(K.url),U),C8(q,"HTTP transport created successfully")}else if(K.type==="sdk")throw Error("SDK servers should be handled in print.ts");else if(K.type==="claudeai-proxy"){if(C8(q,`Initializing claude.ai proxy transport for server ${K.id}`),!Kq())throw Error("No claude.ai OAuth token found");let C=u7(),g=`${C.MCP_PROXY_URL}${C.MCP_PROXY_PATH.replace("{server_id}",K.id)}`;C8(q,`Using claude.ai proxy at ${g}`);let F=RJz(globalThis.fetch),U=fz6(),c={fetch:ag1(F),requestInit:{...U,headers:{"User-Agent":O16(),"X-Mcp-Client-Session-Id":N8()}}};$=new Wy8(new URL(g),c),C8(q,"claude.ai proxy transport created successfully")}else if((K.type==="stdio"||!K.type)&&yw6(q)){let{createChromeContext:p}=await Promise.resolve().then(() => (YF1(),zF1)),{createClaudeForChromeMcpServer:C}=await Promise.resolve().then(() => (zm6(),aG7)),{createLinkedTransportPair:g}=await Promise.resolve().then(() => ng1),F=p(K.env);Y=C(F);let[U,c]=g();await Y.connect(c),$=U,C8(q,"In-process Chrome MCP server started")}else if((K.type==="stdio"||!K.type)&&Yb4(q)){let{createComputerUseMcpServerForCli:p}=await Promise.resolve().then(() => (rg1(),ig1)),{createLinkedTransportPair:C}=await Promise.resolve().then(() => ng1);Y=await p();let[g,F]=C();await Y.connect(F),$=g,C8(q,"In-process Computer Use MCP server started")}else if(K.type==="stdio"||!K.type){let p=process.env.CLAUDE_CODE_SHELL_PREFIX||K.command,C=process.env.CLAUDE_CODE_SHELL_PREFIX?[[K.command,...K.args].join(" ")]:K.args;$=new dp1({command:p,args:C,env:{...Ym(),...K.env},stderr:"pipe"})}else throw Error(`Unsupported server type: ${K.type}`);let O,w="";if(K.type==="stdio"||!K.type){let p=$;if(p.stderr)O=(C)=>{if(w.length<67108864)try{w+=C.toString()}catch{}},p.stderr.on("data",O)}let j=new oN8({name:"claude-code",title:"Claude Code",version:{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??"unknown",description:"Anthropic's agentic coding tool",websiteUrl:Zw6},{capabilities:{roots:{},elicitation:{}}});if(K.type==="http")C8(q,"Client created, setting up request handler");if(j.setRequestHandler(a61,async()=>{return C8(q,"Received ListRoots request from server"),{roots:[{uri:`file://${r1()}`}]}}),C8(q,`Starting connection with timeout of ${AL8()}ms`),K.type==="http"){C8(q,`Testing basic HTTP connectivity to ${K.url}`);try{let p=new URL(K.url);if(C8(q,`Parsed URL: host=${p.hostname}, port=${p.port||"default"}, protocol=${p.protocol}`),p.hostname==="127.0.0.1"||p.hostname==="localhost")C8(q,`Using loopback address: ${p.hostname}`)}catch(p){C8(q,`Failed to parse URL: ${p}`)}}let H=j.connect($),J=new Promise((p,C)=>{let g=setTimeout(()=>{let F=Date.now()-z;if(C8(q,`Connection timeout triggered after ${F}ms (limit: ${AL8()}ms)`),Y)Y.close().catch(()=>{});$.close().catch(()=>{}),C(new uk(`MCP server "${q}" connection timed out after ${AL8()}ms`,"MCP connection timeout"))},AL8());H.then(()=>{clearTimeout(g)},(F)=>{clearTimeout(g)})});try{if(await Promise.race([H,J]),w)Qz(q,`Server stderr: ${w}`),w="";let p=Date.now()-z;C8(q,`Successfully connected (transport: ${K.type||"stdio"}) in ${p}ms`)}catch(p){let C=Date.now()-z;if(K.type==="sse"&&p instanceof Error){if(C8(q,`SSE Connection failed after ${C}ms: ${g6({url:K.url,error:p.message,errorType:p.constructor.name,stack:p.stack})}`),Qz(q,p),p instanceof XD)return og1(q,K,"sse")}else if(K.type==="http"&&p instanceof Error){let g=p;if(C8(q,`HTTP Connection failed after ${C}ms: ${p.message} (code: ${g.code||"none"}, errno: ${g.errno||"none"})`),Qz(q,p),p instanceof XD)return og1(q,K,"http")}else if(K.type==="claudeai-proxy"&&p instanceof Error){if(C8(q,`claude.ai proxy connection failed after ${C}ms: ${p.message}`),Qz(q,p),p.code===401)return og1(q,K,"claudeai-proxy")}else if(K.type==="sse-ide"||K.type==="ws-ide")d("tengu_mcp_ide_server_connection_failed",{connectionDurationMs:C});if(Y)Y.close().catch(()=>{});if($.close().catch(()=>{}),w)Qz(q,`Server stderr: ${w}`);throw p}let M=j.getServerCapabilities(),X=j.getServerVersion(),P=j.getInstructions(),W=P;if(P&&P.length>ga6)W=P.slice(0,ga6)+"… [truncated]",C8(q,`Server instructions truncated from ${P.length} to ${ga6} chars`);if(C8(q,`Connection established with capabilities: ${g6({hasTools:!!M?.tools,hasPrompts:!!M?.prompts,hasResources:!!M?.resources,hasResourceSubscribe:!!M?.resources?.subscribe,serverVersion:X||"unknown"})}`),N(`[MCP] Server "${q}" connected with subscribe=${!!M?.resources?.subscribe}`),j.setRequestHandler(sc,async(p)=>{return C8(q,`Elicitation request received during initialization: ${g6(p)}`),{action:"cancel"}}),K.type==="sse-ide"||K.type==="ws-ide"){let p=Date.now()-z;d("tengu_mcp_ide_server_connection_succeeded",{connectionDurationMs:p,serverVersion:X});try{rh4(j)}catch(C){Qz(q,`Failed to send ide_connected notification: ${C}`)}}let D=Date.now(),f=!1,G=j.onerror,Z=j.onclose,T=0,v=3,V=!1,E=(p)=>{if(V)return;V=!0,C8(q,`Closing transport (${p})`),j.close().catch((C)=>{C8(q,`Error during close: ${d6(C)}`)})},S=(p)=>{return p.includes("ECONNRESET")||p.includes("ETIMEDOUT")||p.includes("EPIPE")||p.includes("EHOSTUNREACH")||p.includes("ECONNREFUSED")||p.includes("Body Timeout Error")||p.includes("terminated")||p.includes("SSE stream disconnected")||p.includes("Failed to reconnect SSE stream")};j.onerror=(p)=>{let C=Date.now()-D;f=!0;let g=K.type||"stdio";if(C8(q,`${g.toUpperCase()} connection dropped after ${Math.floor(C/1000)}s uptime`),p.message)if(p.message.includes("ECONNRESET"))C8(q,"Connection reset - server may have crashed or restarted");else if(p.message.includes("ETIMEDOUT"))C8(q,"Connection timeout - network issue or server unresponsive");else if(p.message.includes("ECONNREFUSED"))C8(q,"Connection refused - server may be down");else if(p.message.includes("EPIPE"))C8(q,"Broken pipe - server closed connection unexpectedly");else if(p.message.includes("EHOSTUNREACH"))C8(q,"Host unreachable - network connectivity issue");else if(p.message.includes("ESRCH"))C8(q,"Process not found - stdio server process terminated");else if(p.message.includes("spawn"))C8(q,"Failed to spawn process - check command and permissions");else C8(q,`Connection error: ${p.message}`);if((g==="http"||g==="claudeai-proxy")&&zb4(p)){if(C8(q,"MCP session expired (server returned 404 with session-not-found), triggering reconnection"),E("session expired"),G)G(p);return}if(g==="sse"||g==="http"||g==="claudeai-proxy"){if(p.message.includes("Maximum reconnection attempts")){if(E("SSE reconnection exhausted"),G)G(p);return}if(S(p.message)){if(T++,C8(q,`Terminal connection error ${T}/${v}`),T>=v)T=0,E("max consecutive terminal errors")}else T=0}if(G)G(p)},j.onclose=()=>{let p=Date.now()-D,C=K.type??"unknown";C8(q,`${C.toUpperCase()} connection closed after ${Math.floor(p/1000)}s (${f?"with errors":"cleanly"})`);let g=tg1(q,K);if(mL.cache.delete(q),lr.cache.delete(q),Fw6.cache.delete(q),oC.cache.delete(g),C8(q,"Cleared connection cache for reconnection"),Z)Z()};let R=async()=>{if(Y){try{await Y.close()}catch(p){C8(q,`Error closing in-process server: ${p}`)}try{await j.close()}catch(p){C8(q,`Error closing client: ${p}`)}return}if(O&&(K.type==="stdio"||!K.type))$.stderr?.off("data",O);if(K.type==="stdio")try{let C=$.pid;if(C){C8(q,"Sending SIGINT to MCP server process");try{process.kill(C,"SIGINT")}catch(g){C8(q,`Error sending SIGINT: ${g}`);return}await new Promise(async(g)=>{let F=!1,U=setInterval(()=>{try{process.kill(C,0)}catch{if(!F)F=!0,clearInterval(U),clearTimeout(c),C8(q,"MCP server process exited cleanly"),g()}},50),c=setTimeout(()=>{if(!F)F=!0,clearInterval(U),C8(q,"Cleanup timeout reached, stopping process monitoring"),g()},600);try{if(await R7(100),!F){try{process.kill(C,0),C8(q,"SIGINT failed, sending SIGTERM to MCP server process");try{process.kill(C,"SIGTERM")}catch(K6){C8(q,`Error sending SIGTERM: ${K6}`),F=!0,clearInterval(U),clearTimeout(c),g();return}}catch{F=!0,clearInterval(U),clearTimeout(c),g();return}if(await R7(400),!F)try{process.kill(C,0),C8(q,"SIGTERM failed, sending SIGKILL to MCP server process");try{process.kill(C,"SIGKILL")}catch(K6){C8(q,`Error sending SIGKILL: ${K6}`)}}catch{F=!0,clearInterval(U),clearTimeout(c),g()}}if(!F)F=!0,clearInterval(U),clearTimeout(c),g()}catch{if(!F)F=!0,clearInterval(U),clearTimeout(c),g()}})}}catch(p){C8(q,`Error terminating process: ${p}`)}try{await j.close()}catch(p){C8(q,`Error closing client: ${p}`)}},x=pq(R),I=async()=>{x?.(),await R()},B=Date.now()-z;return d("tengu_mcp_server_connection_succeeded",{connectionDurationMs:B,transportType:K.type??"stdio",totalServers:_?.totalServers,stdioCount:_?.stdioCount,sseCount:_?.sseCount,httpCount:_?.httpCount,sseIdeCount:_?.sseIdeCount,wsIdeCount:_?.wsIdeCount,...sg1(K)}),{name:q,client:j,type:"connected",capabilities:M??{},serverInfo:X,instructions:W,config:K,cleanup:I}}catch($){let A=Date.now()-z;if(d("tengu_mcp_server_connection_failed",{connectionDurationMs:A,totalServers:_?.totalServers||1,stdioCount:_?.stdioCount||(K.type==="stdio"?1:0),sseCount:_?.sseCount||(K.type==="sse"?1:0),httpCount:_?.httpCount||(K.type==="http"?1:0),sseIdeCount:_?.sseIdeCount||(K.type==="sse-ide"?1:0),wsIdeCount:_?.wsIdeCount||(K.type==="ws-ide"?1:0),transportType:K.type??"stdio",...sg1(K)}),C8(q,`Connection failed after ${A}ms: ${d6($)}`),Qz(q,`Connection failed: ${d6($)}`),Y)Y.close().catch(()=>{});return{name:q,type:"failed",config:K,error:d6($)}}},tg1);mL=HP(async(q)=>{if(q.type!=="connected")return[];try{if(!q.capabilities?.tools)return[];let K=await q.client.request({method:"tools/list"},Eu6),_=Uq6(K.tools),z=q.config.type==="sdk"&&i6(process.env.CLAUDE_AGENT_SDK_MCP_NO_PREFIX);return _.map((Y)=>{let $=G_6(q.name,Y.name);return{...DL4,name:z?Y.name:$,mcpInfo:{serverName:q.name,toolName:Y.name},isMcp:!0,searchHint:typeof Y._meta?.["anthropic/searchHint"]==="string"?Y._meta["anthropic/searchHint"].replace(/\s+/g," ").trim()||void 0:void 0,alwaysLoad:Y._meta?.["anthropic/alwaysLoad"]===!0,async description(){return Y.description??""},async prompt(){let A=Y.description??"";return A.length>ga6?A.slice(0,ga6)+"… [truncated]":A},isConcurrencySafe(){return Y.annotations?.readOnlyHint??!1},isReadOnly(){return Y.annotations?.readOnlyHint??!1},toAutoClassifierInput(A){return IJz(A,Y.name)},isDestructive(){return Y.annotations?.destructiveHint??!1},isOpenWorld(){return Y.annotations?.openWorldHint??!1},isSearchOrReadCommand(){return OS4(q.name,Y.name)},inputJSONSchema:Y.inputSchema,async checkPermissions(){return{behavior:"passthrough",message:"MCPTool requires permission.",suggestions:[{type:"addRules",rules:[{toolName:$,ruleContent:void 0}],behavior:"allow",destination:"localSettings"}]}},async call(A,O,w,j,H){let J=gJz(j),M=J?{"claudecode/toolUseId":J}:{};if(H&&J)H({toolUseID:J,data:{type:"mcp_progress",status:"started",serverName:q.name,toolName:Y.name}});let X=Date.now(),P=1;for(let W=0;;W++)try{let D=await _N6(q),f=await BJz({client:D,clientConnection:q,tool:Y.name,args:A,meta:M,signal:O.abortController.signal,setAppState:O.setAppState,onProgress:H&&J?(G)=>{H({toolUseID:J,data:G})}:void 0,handleElicitation:O.handleElicitation});if(H&&J)H({toolUseID:J,data:{type:"mcp_progress",status:"completed",serverName:q.name,toolName:Y.name,elapsedTimeMs:Date.now()-X}});return{data:f.content,...(f._meta||f.structuredContent)&&{mcpMeta:{...f._meta&&{_meta:f._meta},...f.structuredContent&&{structuredContent:f.structuredContent}}}}}catch(D){if(D instanceof eg1&&W<P){C8(q.name,`Retrying tool '${Y.name}' after session recovery`);continue}if(H&&J)H({toolUseID:J,data:{type:"mcp_progress",status:"failed",serverName:q.name,toolName:Y.name,elapsedTimeMs:Date.now()-X}});if(D instanceof Error&&!(D instanceof uk)){let f=D.constructor.name;if(f==="Error")throw new uk(D.message,D.message.slice(0,200));if(f==="McpError"&&"code"in D&&typeof D.code==="number")throw new uk(D.message,`McpError ${D.code}`)}throw D}},userFacingName(){let A=Y.annotations?.title||Y.name;return`${q.name} - ${A} (MCP)`},...yw6(q.name)&&(q.config.type==="stdio"||!q.config.type)?fJz().getClaudeInChromeMCPToolOverrides(Y.name):{},...(q.config.type==="stdio"||!q.config.type)&&Yb4(q.name)?ZJz().getComputerUseMCPToolOverrides(Y.name):{}}}).filter(xJz)}catch(K){return Qz(q.name,`Failed to fetch tools: ${d6(K)}`),[]}},(q)=>q.name,_F1),lr=HP(async(q)=>{if(q.type!=="connected")return[];try{if(!q.capabilities?.resources)return[];let K=await q.client.request({method:"resources/list"},vu6);if(!K.resources)return[];return K.resources.map((_)=>({..._,server:q.name}))}catch(K){return Qz(q.name,`Failed to fetch resources: ${d6(K)}`),[]}},(q)=>q.name,_F1),Fw6=HP(async(q)=>{if(q.type!=="connected")return[];try{if(!q.capabilities?.prompts)return[];let K=await q.client.request({method:"prompts/list"},Nu6);if(!K.prompts)return[];return Uq6(K.prompts).map((z)=>{let Y=Object.values(z.arguments??{}).map(($)=>$.name);return{type:"prompt",name:"mcp__"+Z2(q.name)+"__"+z.name,description:z.description??"",hasUserSpecifiedDescription:!!z.description,contentLength:0,isEnabled:()=>!0,isHidden:!1,isMcp:!0,progressMessage:"running",userFacingName(){return`${q.name}:${z.name} (MCP)`},argNames:Y,source:"mcp",async getPromptForCommand($){let A=$.split(" ");try{let O=await _N6(q),w=await O.client.getPrompt({name:z.name,arguments:kE4(Y,A)});return(await Promise.all(w.messages.map((H)=>wb4(H.content,O.name)))).flat()}catch(O){throw Qz(q.name,`Error running command '${z.name}': ${d6(O)}`),O}}}})}catch(K){return Qz(q.name,`Failed to fetch commands: ${d6(K)}`),[]}},(q)=>q.name,_F1)});function sv(q){return typeof q==="object"&&q!==null&&"type"in q&&q.type==="local_bash"}function Qa6(q,K){A3(q,K,(_)=>{if(_.status!=="running"||!sv(_))return _;try{N(`LocalShellTask ${q} kill requested`),_.shellCommand?.kill(),_.shellCommand?.cleanup()}catch(z){H6(z)}if(_.unregisterCleanup?.(),_.cleanupTimeoutId)clearTimeout(_.cleanupTimeoutId);return{..._,status:"killed",notified:!0,shellCommand:null,unregisterCleanup:void 0,cleanupTimeoutId:void 0,endTime:Date.now()}}),Zw(q)}function Jb4(q,K,_){let z=K().tasks??{};for(let[Y,$]of Object.entries(z))if(sv($)&&$.agentId===q&&$.status==="running")N(`killShellTasksForAgent: killing orphaned shell task ${Y} (agent ${q} exiting)`),Qa6(Y,_);$V6((Y)=>Y.agentId===q)}var $F1=y(()=>{_8();E8();p2();Ij();J0()});import{resolve as FJz}from"path";function AF1(q,K){if(q.type!==K.type)return!1;let _=(z,Y)=>(z.if??"")===(Y.if??"");switch(q.type){case"command":return K.type==="command"&&q.command===K.command&&(q.shell??zD6)===(K.shell??zD6)&&_(q,K);case"prompt":return K.type==="prompt"&&q.prompt===K.prompt&&_(q,K);case"agent":return K.type==="agent"&&q.prompt===K.prompt&&_(q,K);case"http":return K.type==="http"&&q.url===K.url&&_(q,K);case"function":return!1}}function pL(q){if("statusMessage"in q&&q.statusMessage)return q.statusMessage;switch(q.type){case"command":return q.command;case"prompt":return q.prompt;case"agent":return q.prompt;case"http":return q.url;case"callback":return"callback";case"function":return"function"}}function Mb4(q){let K=[];if(v1("policySettings")?.allowManagedHooksOnly!==!0){let A=["userSettings","projectSettings","localSettings"],O=new Set;for(let w of A){let j=Hj(w);if(j){let J=FJz(j);if(O.has(J))continue;O.add(J)}let H=v1(w);if(!H?.hooks)continue;for(let[J,M]of Object.entries(H.hooks))for(let X of M)for(let P of X.hooks)K.push({event:J,config:P,matcher:X.matcher,source:w})}}let Y=N8(),$=HL8(q,Y);for(let[A,O]of $.entries())for(let w of O)for(let j of w.hooks)K.push({event:A,config:j,matcher:w.matcher,source:"sessionHook"});return K}function Xb4(q){switch(q){case"userSettings":return"User settings (~/.claude/settings.json)";case"projectSettings":return"Project settings (.claude/settings.json)";case"localSettings":return"Local settings (.claude/settings.local.json)";case"pluginHook":return"Plugin hooks (~/.claude/plugins/*/hooks/hooks.json)";case"sessionHook":return"Session hooks (in-memory, temporary)";case"builtinHook":return"Built-in hooks (registered internally by Claude Code)";default:return q}}function OF1(q){switch(q){case"userSettings":return"User Settings";case"projectSettings":return"Project Settings";case"localSettings":return"Local Settings";case"pluginHook":return"Plugin Hooks";case"sessionHook":return"Session Hooks";case"builtinHook":return"Built-in Hooks";default:return q}}function Pb4(q){switch(q){case"userSettings":return"User";case"projectSettings":return"Project";case"localSettings":return"Local";case"pluginHook":return"Plugin";case"sessionHook":return"Session";case"builtinHook":return"Built-in";default:return q}}function Wb4(q,K,_){let z=Xp6.reduce((Y,$,A)=>{return Y[$]=A,Y},{});return[...q].sort((Y,$)=>{let A=K[_]?.[Y]||[],O=K[_]?.[$]||[],w=Array.from(new Set(A.map((X)=>X.source))),j=Array.from(new Set(O.map((X)=>X.source))),H=(X)=>X==="pluginHook"||X==="builtinHook"?999:z[X],J=Math.min(...w.map(H)),M=Math.min(...j.map(H));if(J!==M)return J-M;return Y.localeCompare($)})}var Uw6=y(()=>{v8();kO();U1();PA8();zo()});function JL8(q,K,_,z,Y,$,A){fb4(q,K,_,z,Y,$,A)}function ML8(q,K,_,z,Y,$,A){let O=A?.id||`function-hook-${Date.now()}-${Math.random()}`,w={type:"function",id:O,timeout:A?.timeout||5000,callback:Y,errorMessage:$};return fb4(q,K,_,z,w),O}function fb4(q,K,_,z,Y,$,A){q((O)=>{let w=O.sessionHooks.get(K)??{hooks:{}},j=w.hooks[_]||[],H=j.findIndex((X)=>X.matcher===z&&X.skillRoot===A),J;if(H>=0){J=[...j];let X=J[H];J[H]={matcher:X.matcher,skillRoot:X.skillRoot,hooks:[...X.hooks,{hook:Y,onHookSuccess:$}]}}else J=[...j,{matcher:z,skillRoot:A,hooks:[{hook:Y,onHookSuccess:$}]}];let M={...w.hooks,[_]:J};return O.sessionHooks.set(K,{hooks:M}),O}),N(`Added session hook for event ${_} in session ${K}`)}function Zb4(q,K,_,z){q((Y)=>{let $=Y.sessionHooks.get(K);if(!$)return Y;let O=($.hooks[_]||[]).map((j)=>{let H=j.hooks.filter((J)=>!AF1(J.hook,z));return H.length>0?{...j,hooks:H}:null}).filter((j)=>j!==null),w=O.length>0?{...$.hooks,[_]:O}:{...$.hooks};if(O.length===0)delete w[_];return Y.sessionHooks.set(K,{...$,hooks:w}),Y}),N(`Removed session hook for event ${_} in session ${K}`)}function Db4(q){return q.map((K)=>({matcher:K.matcher,skillRoot:K.skillRoot,hooks:K.hooks.map((_)=>_.hook).filter((_)=>_.type!=="function")}))}function HL8(q,K,_){let z=q.sessionHooks.get(K);if(!z)return new Map;let Y=new Map;if(_){let $=z.hooks[_];if($)Y.set(_,Db4($));return Y}for(let $ of Gh){let A=z.hooks[$];if(A)Y.set($,Db4(A))}return Y}function Gb4(q,K,_){let z=q.sessionHooks.get(K);if(!z)return new Map;let Y=new Map,$=(A)=>{return A.map((O)=>({matcher:O.matcher,hooks:O.hooks.map((w)=>w.hook).filter((w)=>w.type==="function")})).filter((O)=>O.hooks.length>0)};if(_){let A=z.hooks[_];if(A){let O=$(A);if(O.length>0)Y.set(_,O)}return Y}for(let A of Gh){let O=z.hooks[A];if(O){let w=$(O);if(w.length>0)Y.set(A,w)}}return Y}function Tb4(q,K,_,z,Y){let $=q.sessionHooks.get(K);if(!$)return;let A=$.hooks[_];if(!A)return;for(let O of A)if(O.matcher===z||z===""){let w=O.hooks.find((j)=>AF1(j.hook,Y));if(w)return w}return}function pN6(q,K){q((_)=>{return _.sessionHooks.delete(K),_}),N(`Cleared all session hooks for session ${K}`)}var zo=y(()=>{_D6();_8();Uw6()});function vb4(q,K,_,z,Y=!1){if(!_||Object.keys(_).length===0)return;let $=0;for(let A of Gh){let O=_[A];if(!O||O.length===0)continue;let w=A;if(Y&&A==="Stop")w="SubagentStop",N(`Converting Stop hook to SubagentStop for ${z} (subagents trigger SubagentStop)`);for(let j of O){let H=j.matcher??"",J=j.hooks;if(!J||J.length===0)continue;for(let M of J)JL8(q,K,w,H,M),$++}}if($>0)N(`Registered ${$} frontmatter hook(s) from ${z} for session ${K}`)}var kb4=y(()=>{_D6();_8();zo()});function wF1(){return"inherit"}function BN6(q,K,_,z){if(process.env.CLAUDE_CODE_SUBAGENT_MODEL)return A5(process.env.CLAUDE_CODE_SUBAGENT_MODEL);let Y=qJ8(K),$=(w,j)=>{if(Y&&E7()==="bedrock"){if(qJ8(j))return w;return szq(w,Y)}return w};if(_){if(Vb4(_,K))return K;let w=A5(_);return $(w,_)}let A=q??wF1();if(A==="inherit")return uI({permissionMode:z??"default",mainLoopModel:K,exceeds200kTokens:!1});if(Vb4(A,K))return K;let O=A5(A);return $(O,A)}function Vb4(q,K){let _=bY(K);switch(q.toLowerCase()){case"opus":return _.includes("opus");case"sonnet":return _.includes("sonnet");case"haiku":return _.includes("haiku");default:return!1}}function XL8(q){if(!q)return"Inherit from parent (default)";if(q==="inherit")return"Inherit from parent";return Tf(q)}function Nb4(){return[{value:"sonnet",label:"Sonnet",description:"Balanced performance - best for most agents"},{value:"opus",label:"Opus",description:"Most capable for complex reasoning tasks"},{value:"haiku",label:"Haiku",description:"Fast and efficient for simple tasks"},{value:"inherit",label:"Inherit from parent",description:"Use the same model as the main conversation"}]}var TfO;var cq6=y(()=>{B06();GF6();aq();Az();TfO=[...Fz6,"inherit"]});function Eb4(q){return Math.abs(Y_6(q))||1}function Lb4(q){let K=JF1.get(q);if(K!==void 0)return K;return HF1++,JF1.set(q,HF1),HF1}function WL8(){let q=NP()??N8(),K=M_()??"main",_=_F(),z=PL8.get(q);if(z)return z;let Y={agentId:q,agentName:K,parentAgentId:_,processId:q===N8()?1:Lb4(q),threadId:Eb4(K)};return PL8.set(q,Y),yb4++,Y}function lq6(){return(Date.now()-UJz)*1000}function DL8(){return`span_${++QJz}`}function Rb4(){let q=process.env.CLAUDE_CODE_PERFETTO_TRACE;N(`[Perfetto] initializePerfettoTracing called, env value: ${q}`)}function dJz(q){if(!aC)return;if(jF1.push({name:"process_name",cat:"__metadata",ph:"M",ts:0,pid:q.processId,tid:0,args:{name:q.agentName}}),jF1.push({name:"thread_name",cat:"__metadata",ph:"M",ts:0,pid:q.processId,tid:q.threadId,args:{name:q.agentName}}),q.parentAgentId)jF1.push({name:"parent_agent",cat:"__metadata",ph:"M",ts:0,pid:q.processId,tid:0,args:{parent_agent_id:q.parentAgentId}})}function Yo(){return aC}function fL8(q,K,_){if(!aC)return;let z={agentId:q,agentName:K,parentAgentId:_,processId:Lb4(q),threadId:Eb4(K)};PL8.set(q,z),yb4++,dJz(z)}function Qw6(q){if(!aC)return;PL8.delete(q),JF1.delete(q)}function hb4(q){if(!aC)return"";let K=DL8(),_=WL8();return hX.set(K,{name:"API Call",category:"api",startTime:lq6(),agentInfo:_,args:{model:q.model,prompt_tokens:q.promptTokens,message_id:q.messageId,is_speculative:q.isSpeculative??!1,query_source:q.querySource}}),BG.push({name:"API Call",cat:"api",ph:"B",ts:hX.get(K).startTime,pid:_.processId,tid:_.threadId,args:hX.get(K).args}),K}function Sb4(q,K){if(!aC||!q)return;let _=hX.get(q);if(!_)return;let z=lq6(),Y=z-_.startTime,$=K.promptTokens??_.args.prompt_tokens,A=K.ttftMs,O=K.ttltMs,w=K.outputTokens,j=K.cacheReadTokens,H=A!==void 0&&$!==void 0&&A>0?Math.round($/(A/1000)*100)/100:void 0,J=O!==void 0&&A!==void 0?O-A:void 0,M=J!==void 0&&w!==void 0&&J>0?Math.round(w/(J/1000)*100)/100:void 0,X=j!==void 0&&$!==void 0&&$>0?Math.round(j/$*1e4)/100:void 0,P=K.requestSetupMs,W=K.attemptStartTimes,D={..._.args,ttft_ms:A,ttlt_ms:O,prompt_tokens:$,output_tokens:w,cache_read_tokens:j,cache_creation_tokens:K.cacheCreationTokens,message_id:K.messageId??_.args.message_id,success:K.success??!0,error:K.error,duration_ms:Y/1000,request_setup_ms:P,itps:H,otps:M,cache_hit_rate_pct:X},f=P!==void 0&&P>0?P*1000:0;if(f>0){let G=_.startTime+f;if(BG.push({name:"Request Setup",cat:"api,setup",ph:"B",ts:_.startTime,pid:_.agentInfo.processId,tid:_.agentInfo.threadId,args:{request_setup_ms:P,attempt_count:W?.length??1}}),W&&W.length>1){let Z=W[0];for(let T=0;T<W.length-1;T++){let v=_.startTime+(W[T]-Z)*1000,V=_.startTime+(W[T+1]-Z)*1000;BG.push({name:`Attempt ${T+1} (retry)`,cat:"api,retry",ph:"B",ts:v,pid:_.agentInfo.processId,tid:_.agentInfo.threadId,args:{attempt:T+1}}),BG.push({name:`Attempt ${T+1} (retry)`,cat:"api,retry",ph:"E",ts:V,pid:_.agentInfo.processId,tid:_.agentInfo.threadId})}}BG.push({name:"Request Setup",cat:"api,setup",ph:"E",ts:G,pid:_.agentInfo.processId,tid:_.agentInfo.threadId})}if(A!==void 0){let G=_.startTime+f,Z=G+A*1000;BG.push({name:"First Token",cat:"api,ttft",ph:"B",ts:G,pid:_.agentInfo.processId,tid:_.agentInfo.threadId,args:{ttft_ms:A,prompt_tokens:$,itps:H,cache_hit_rate_pct:X}}),BG.push({name:"First Token",cat:"api,ttft",ph:"E",ts:Z,pid:_.agentInfo.processId,tid:_.agentInfo.threadId});let T=O!==void 0?O-A-f/1000:void 0;if(T!==void 0&&T>0)BG.push({name:"Sampling",cat:"api,sampling",ph:"B",ts:Z,pid:_.agentInfo.processId,tid:_.agentInfo.threadId,args:{sampling_ms:T,output_tokens:w,otps:M}}),BG.push({name:"Sampling",cat:"api,sampling",ph:"E",ts:Z+T*1000,pid:_.agentInfo.processId,tid:_.agentInfo.threadId})}BG.push({name:_.name,cat:_.category,ph:"E",ts:z,pid:_.agentInfo.processId,tid:_.agentInfo.threadId,args:D}),hX.delete(q)}function Cb4(q,K){if(!aC)return"";let _=DL8(),z=WL8();return hX.set(_,{name:`Tool: ${q}`,category:"tool",startTime:lq6(),agentInfo:z,args:{tool_name:q,...K}}),BG.push({name:`Tool: ${q}`,cat:"tool",ph:"B",ts:hX.get(_).startTime,pid:z.processId,tid:z.threadId,args:hX.get(_).args}),_}function bb4(q,K){if(!aC||!q)return;let _=hX.get(q);if(!_)return;let z=lq6(),Y=z-_.startTime,$={..._.args,success:K?.success??!0,error:K?.error,result_tokens:K?.resultTokens,duration_ms:Y/1000};BG.push({name:_.name,cat:_.category,ph:"E",ts:z,pid:_.agentInfo.processId,tid:_.agentInfo.threadId,args:$}),hX.delete(q)}function xb4(q){if(!aC)return"";let K=DL8(),_=WL8();return hX.set(K,{name:"Waiting for User Input",category:"user_input",startTime:lq6(),agentInfo:_,args:{context:q}}),BG.push({name:"Waiting for User Input",cat:"user_input",ph:"B",ts:hX.get(K).startTime,pid:_.processId,tid:_.threadId,args:hX.get(K).args}),K}function Ib4(q,K){if(!aC||!q)return;let _=hX.get(q);if(!_)return;let z=lq6(),Y=z-_.startTime,$={..._.args,decision:K?.decision,source:K?.source,duration_ms:Y/1000};BG.push({name:_.name,cat:_.category,ph:"E",ts:z,pid:_.agentInfo.processId,tid:_.agentInfo.threadId,args:$}),hX.delete(q)}function ub4(q){if(!aC)return"";let K=DL8(),_=WL8();return hX.set(K,{name:"Interaction",category:"interaction",startTime:lq6(),agentInfo:_,args:{user_prompt_length:q?.length}}),BG.push({name:"Interaction",cat:"interaction",ph:"B",ts:hX.get(K).startTime,pid:_.processId,tid:_.threadId,args:hX.get(K).args}),K}function mb4(q){if(!aC||!q)return;let K=hX.get(q);if(!K)return;let _=lq6(),z=_-K.startTime;BG.push({name:K.name,cat:K.category,ph:"E",ts:_,pid:K.agentInfo.processId,tid:K.agentInfo.threadId,args:{...K.args,duration_ms:z/1000}}),hX.delete(q)}var aC=!1,jF1,BG,hX,PL8,yb4=0,UJz=0,QJz=0,HF1=1,JF1;var gN6=y(()=>{v8();c9();_8();m8();y8();l8();AY();jF1=[],BG=[],hX=new Map,PL8=new Map,JF1=new Map});import{randomBytes as cJz}from"crypto";function BL(q){if(typeof q!=="string")return null;return lJz.test(q)?q:null}function wm(q){let K=cJz(8).toString("hex");return q?`a${q}-${K}`:`a${K}`}var lJz;var jm=y(()=>{lJz=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var pb4=y(()=>{o1()});function Bb4(q,K){let _=q.find((z)=>z.type==="tool_use"&&z.name===K);if(!_||_.type!=="tool_use")return null;return _}function gb4(q,K){let _=K.safeParse(q.input);if(!_.success)return null;return _.data}var Fb4=m((UfO,nJz)=>{nJz.exports=`You are a security monitor for autonomous AI coding agents.
1832
1833## Context

Callers 1

jQYFunction · 0.85

Calls 3

pw6Function · 0.85
entriesMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected