@puku/puku-cli 1.8.31 → 1.8.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +13 -13
- package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
- package/dist/vendor/ripgrep/x64-linux/rg +0 -0
- package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/package.json +2 -1
package/dist/cli.mjs
CHANGED
|
@@ -4215,7 +4215,7 @@ ${_}`:""}`}var v5q=h(()=>{os()});function E65(){let q=_q("tengu_onyx_plover",nul
|
|
|
4215
4215
|
|
|
4216
4216
|
Sessions since last consolidation (${H.length}):
|
|
4217
4217
|
${H.map((y)=>`- ${y}`).join(`
|
|
4218
|
-
`)}`,v=C$8(f,W,Z),k=await df({promptMessages:[C8({content:v})],cacheSafeParams:F0(_),canUseTool:Nf_(f),querySource:"auto_dream",forkLabel:"auto_dream",skipTranscript:!0,overrides:{abortController:P},onMessage:I65(X,J)});PM_(X,J);let N=_.toolUseContext.getAppState().tasks?.[X];if(A&&jM_(N)&&N.filesTouched.length>0)A({...G5q(N.filesTouched),verb:"Improved"});R(`[autoDream] completed — cache: read=${k.totalUsage.cache_read_input_tokens} created=${k.totalUsage.cache_creation_input_tokens}`),Q("tengu_auto_dream_completed",{cache_read:k.totalUsage.cache_read_input_tokens,cache_created:k.totalUsage.cache_creation_input_tokens,output:k.totalUsage.output_tokens,sessions_reviewed:H.length})}catch(f){if(P.signal.aborted){R("[autoDream] aborted by user");return}R(`[autoDream] fork failed: ${f.message}`),Q("tengu_auto_dream_failed",{}),XM_(X,J),await EY8(M)}}}function I65(q,K){return(_)=>{if(_.type!=="assistant")return;let A="",z=0,Y=[];for(let $ of _.message.content)if($.type==="text")A+=$.text;else if($.type==="tool_use"){if(z++,$.name===I_||$.name===P4){let O=$.input;if(typeof O.file_path==="string")Y.push(O.file_path)}}JM_(q,{text:A.trim(),toolUseCount:z},Y,K)}}async function hf_(q,K){await Vf_?.(q,K)}var S65=600000,Rf_,Vf_=null;var k5q=h(()=>{Qf();Vq();Y8();S3();J5q();e_();v8();yf_();v5q();ph6();IY8();C3();Rf_={minHours:24,minSessions:5}});async function*Ef_(q,K,_,A,z,Y,$,O){let w=Date.now(),H={messages:[...q,...K],systemPrompt:_,userContext:A,systemContext:z,toolUseContext:Y,querySource:$};if($==="repl_main_thread"||$==="sdk")bf_(F0(H));if(!h4()){if(!OA(process.env.PUKU_CLI_ENABLE_PROMPT_SUGGESTION))HBK(H);if(!Y.agentId)hf_(H,Y.appendSystemMessage)}try{let j=[],J=Y.getAppState().toolPermissionContext.mode,P=y5q(J,Y.abortController.signal,void 0,O??!1,Y.agentId,Y,[...q,...K],Y.agentType),X="",f=0,W=!1,Z="",v=!1,k=[],N=[];for await(let y of P){if(y.message){if(yield y.message,y.message.type==="progress"&&y.message.toolUseID){X=y.message.toolUseID,f++;let L=y.message.data;if(L.command)N.push({command:L.command,promptText:L.promptText})}if(y.message.type==="attachment"){let L=y.message.attachment;if("hookEvent"in L&&(L.hookEvent==="Stop"||L.hookEvent==="SubagentStop")){if(L.type==="hook_non_blocking_error")k.push(L.stderr||`Exit code ${L.exitCode}`),v=!0;else if(L.type==="hook_error_during_execution")k.push(L.content),v=!0;else if(L.type==="hook_success"){if(L.stdout&&L.stdout.trim()||L.stderr&&L.stderr.trim())v=!0}if("durationMs"in L&&"command"in L){let S=N.find((C)=>C.command===L.command&&C.durationMs===void 0);if(S)S.durationMs=L.durationMs}}}}if(y.blockingError){let L=C8({content:T5q(y.blockingError),isMeta:!0});j.push(L),yield L,v=!0,k.push(y.blockingError.blockingError)}if(y.preventContinuation)W=!0,Z=y.stopReason||"Stop hook prevented continuation",yield y_({type:"hook_stopped_continuation",message:Z,hookName:"Stop",toolUseID:X,hookEvent:"Stop"});if(Y.abortController.signal.aborted)return Q("tengu_pre_stop_hooks_cancelled",{queryChainId:Y.queryTracking?.chainId,queryDepth:Y.queryTracking?.depth}),yield lp({toolUse:!1}),{blockingErrors:[],preventContinuation:!0}}if(f>0){if(yield wS6(f,N,k,W,Z,v,"suggestion",X),k.length>0){let y=K1("app:toggleTranscript","Global","ctrl+o");Y.addNotification?.({key:"stop-hook-error",text:`Stop hook error occurred · ${y} to see`,priority:"immediate"})}}if(W)return{blockingErrors:[],preventContinuation:!0};if(j.length>0)return{blockingErrors:j,preventContinuation:!1};if(MY()){let y=p5()??"",L=QA()??"",S=[],C=!1,b,u="",m=HX(),B=(await OJ(m)).filter((F)=>F.status==="in_progress"&&F.owner===y);for(let F of B){let U=lh6(F.id,F.subject,F.description,y,L,J,Y.abortController.signal,void 0,Y);for await(let d of U){if(d.message){if(d.message.type==="progress"&&d.message.toolUseID)u=d.message.toolUseID;yield d.message}if(d.blockingError){let o=C8({content:Qh6(d.blockingError),isMeta:!0});S.push(o),yield o}if(d.preventContinuation)C=!0,b=d.stopReason||"TaskCompleted hook prevented continuation",yield y_({type:"hook_stopped_continuation",message:b,hookName:"TaskCompleted",toolUseID:u,hookEvent:"TaskCompleted"});if(Y.abortController.signal.aborted)return{blockingErrors:[],preventContinuation:!0}}}let x=R5q(y,L,J,Y.abortController.signal);for await(let F of x){if(F.message){if(F.message.type==="progress"&&F.message.toolUseID)u=F.message.toolUseID;yield F.message}if(F.blockingError){let U=C8({content:N5q(F.blockingError),isMeta:!0});S.push(U),yield U}if(F.preventContinuation)C=!0,b=F.stopReason||"TeammateIdle hook prevented continuation",yield y_({type:"hook_stopped_continuation",message:b,hookName:"TeammateIdle",toolUseID:u,hookEvent:"TeammateIdle"});if(Y.abortController.signal.aborted)return{blockingErrors:[],preventContinuation:!0}}if(C)return{blockingErrors:[],preventContinuation:!0};if(S.length>0)return{blockingErrors:S,preventContinuation:!1}}return{blockingErrors:[],preventContinuation:!1}}catch(j){let M=Date.now()-w;return Q("tengu_stop_hook_error",{duration:M,queryChainId:Y.queryTracking?.chainId,queryDepth:Y.queryTracking?.depth}),yield Jw(`Stop hook failed: ${r6(j)}`,"warning"),{blockingErrors:[],preventContinuation:!1}}}var Cf_=h(()=>{XE();S3();tj();Y8();T8();D$();Vq();C9();JY();k5q();Wt();I8();Qf()});function If_(){return{sessionId:k8(),gates:{streamingToolExecution:_O("tengu_streaming_tool_execution2"),emitToolUseSummaries:p6(process.env.PUKU_CLI_EMIT_TOOL_USE_SUMMARIES),isAnt:process.env.USER_TYPE==="ant",fastModeEnabled:!p6(process.env.PUKU_CLI_DISABLE_FAST_MODE)}}}var xf_=h(()=>{v8();I8()});import{randomUUID as x65}from"crypto";function uf_(){return{callModel:N16,microcompact:lU,autocompact:mf_,uuid:x65}}var pf_=h(()=>{O3();mp();gR()});var u65,Cu$;var b$8=h(()=>{u65=/\b(?:use|spend)\s+(\d+(?:\.\d+)?)\s*(k|m|b)\s*tokens?\b/i,Cu$=new RegExp(u65.source,"gi")});var gf_=h(()=>{b$8()});function*L5q(q,K){for(let _ of q){let A=_.message.content.filter((z)=>z.type==="tool_use");for(let z of A)yield C8({content:[{type:"tool_result",content:K,is_error:!0,tool_use_id:z.id}],toolUseResult:K,sourceToolAssistantUUID:_.uuid})}}function Bf_(q){return q?.type==="assistant"&&q.apiError==="max_output_tokens"}async function*WN(q){let K=[],_=yield*m65(q,K);for(let A of K)oS(A,"completed");return _}async function*m65(q,K){let W=[];try{let{systemPrompt:_,userContext:A,systemContext:z,canUseTool:Y,fallbackModel:$,querySource:O,maxTurns:w,skipCacheWrite:H}=q;let j=q.deps??uf_();let M={messages:q.messages,toolUseContext:q.toolUseContext,maxOutputTokensOverride:q.maxOutputTokensOverride,autoCompactTracking:void 0,stopHookActive:void 0,maxOutputTokensRecoveryCount:0,hasAttemptedReactiveCompact:!1,turnCount:1,pendingToolUseSummary:void 0,transition:void 0};let J=null;let P=void 0;let X=If_();const f=vz(W,cf_(M.messages,M.toolUseContext),0);while(!0){let{toolUseContext:N}=M,{messages:y,autoCompactTracking:L,maxOutputTokensRecoveryCount:S,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:b,pendingToolUseSummary:u,stopHookActive:m,turnCount:g}=M,B=V5q?.startSkillDiscoveryPrefetch(null,y,N);if(yield{type:"stream_request_start"},AA("query_fn_entry"),!N.agentId)g1("query_started");let x=N.queryTracking?{chainId:N.queryTracking.chainId,depth:N.queryTracking.depth+1}:{chainId:j.uuid(),depth:0},F=x.chainId;N={...N,queryTracking:x};let U=[...l3(y)],d=L,o=O.startsWith("agent:")||O.startsWith("repl_main_thread"),K6=await hoK(U,N.contentReplacementState,o?(I6)=>void $86(I6,N.agentId).catch(_6):void 0,new Set(N.options.tools.filter((I6)=>!Number.isFinite(I6.maxResultSizeChars)).map((I6)=>I6.name)));if(U=K6.messages,K6.newlyReplaced.length>0)N.syncToolResultReplacements?.(N.contentReplacementState?.replacements??new Map);let n=0;AA("query_microcompact_start"),U=(await j.microcompact(U,N,O)).messages;let s=void 0;AA("query_microcompact_end");let e=F7(df_(_,z));AA("query_autocompact_start");let{compactionResult:q6,consecutiveFailures:f6}=await j.autocompact(U,N,{systemPrompt:_,userContext:A,systemContext:z,toolUseContext:N,forkContextMessages:U},O,d,n);if(AA("query_autocompact_end"),q6){let{preCompactTokenCount:I6,postCompactTokenCount:T6,truePostCompactTokenCount:l6,compactionUsage:z8}=q6;if(Q("tengu_auto_compact_succeeded",{originalMessageCount:y.length,compactedMessageCount:q6.summaryMessages.length+q6.attachments.length+q6.hookResults.length,preCompactTokenCount:I6,postCompactTokenCount:T6,truePostCompactTokenCount:l6,compactionInputTokens:z8?.input_tokens,compactionOutputTokens:z8?.output_tokens,compactionCacheReadTokens:z8?.cache_read_input_tokens??0,compactionCacheCreationTokens:z8?.cache_creation_input_tokens??0,compactionTotalTokens:z8?z8.input_tokens+(z8.cache_creation_input_tokens??0)+(z8.cache_read_input_tokens??0)+z8.output_tokens:0,queryChainId:F,queryDepth:x.depth}),q.taskBudget){let B6=Mi8(U);P=Math.max(0,(P??q.taskBudget.total)-B6)}d={compacted:!0,turnId:j.uuid(),turnCounter:0,consecutiveFailures:0};let z6=up(q6);for(let B6 of z6)yield B6;U=z6}else if(f6!==void 0)d={...d??{compacted:!1,turnId:"",turnCounter:0},consecutiveFailures:f6};N={...N,messages:U};let $6=[],N6=[],H6=[],J6=!1;AA("query_setup_start");let j6=X.gates.streamingToolExecution?new HS6(N.options.tools,Y,N):null,A6=N.getAppState(),w6=A6.toolPermissionContext.mode,v6=OR({permissionMode:w6,mainLoopModel:N.options.mainLoopModel,exceeds200kTokens:w6==="plan"&&at6(U)});AA("query_setup_end");let C6=X.gates.isAnt?suK(N.agentId??X.sessionId):void 0,n6=!1,U6=z86?.isReactiveCompactEnabled()??!1;if(!q6&&O!=="compact"&&O!=="session_memory"&&!(z86?.isReactiveCompactEnabled()&&CN())&&!n6){let{isAtBlockingLimit:I6}=Y86(PD(U)-n,N.options.mainLoopModel);if(I6)return yield uA({content:xV,error:"invalid_request"}),{reason:"blocking_limit"}}let d6=!0;AA("query_api_loop_start");try{while(d6){d6=!1;try{let I6=!1;AA("query_api_streaming_start");for await(let T6 of j.callModel({messages:x$8(U,A),systemPrompt:e,thinkingConfig:N.options.thinkingConfig,tools:N.options.tools,signal:N.abortController.signal,options:{async getToolPermissionContext(){return N.getAppState().toolPermissionContext},model:v6,...X.gates.fastModeEnabled&&{fastMode:A6.fastMode},toolChoice:void 0,isNonInteractiveSession:N.options.isNonInteractiveSession,fallbackModel:$,onStreamingFallback:()=>{I6=!0},querySource:O,agents:N.options.agentDefinitions.activeAgents,allowedAgentTypes:N.options.agentDefinitions.allowedAgentTypes,hasAppendSystemPrompt:!!N.options.appendSystemPrompt,maxOutputTokensOverride:b,fetchOverride:C6,mcpTools:A6.mcp.tools,hasPendingMcpServers:A6.mcp.clients.some((l6)=>l6.type==="pending"),queryTracking:x,effortValue:A6.effortValue,advisorModel:A6.advisorModel,skipCacheWrite:H,agentId:N.agentId,addNotification:N.addNotification,providerOverride:N.options.providerOverride,...q.taskBudget&&{taskBudget:{total:q.taskBudget.total,...P!==void 0&&{remaining:P}}}}})){if(I6){for(let z6 of $6)yield{type:"tombstone",message:z6};if(Q("tengu_orphaned_messages_tombstoned",{orphanedMessageCount:$6.length,queryChainId:F,queryDepth:x.depth}),$6.length=0,N6.length=0,H6.length=0,J6=!1,j6)j6.discard(),j6=new HS6(N.options.tools,Y,N)}let l6=T6;if(T6.type==="assistant"){let z6;for(let B6=0;B6<T6.message.content.length;B6++){let q8=T6.message.content[B6];if(q8.type==="tool_use"&&typeof q8.input==="object"&&q8.input!==null){let P6=O4(N.options.tools,q8.name);if(P6?.backfillObservableInput){let m6=q8.input,O8={...m6};if(P6.backfillObservableInput(O8),Object.keys(O8).some((i8)=>!(i8 in m6)))z6??=[...T6.message.content],z6[B6]={...q8,input:O8}}}}if(z6)l6={...T6,message:{...T6.message,content:z6}}}let z8=!1;if(z86?.isWithheldPromptTooLong(T6))z8=!0;if(U6&&z86?.isWithheldMediaSizeError(T6))z8=!0;if(Bf_(T6))z8=!0;if(!z8)yield l6;if(T6.type==="assistant"){$6.push(T6);let z6=T6.message.content.filter((B6)=>B6.type==="tool_use");if(z6.length>0)H6.push(...z6),J6=!0;if(j6&&!N.abortController.signal.aborted)for(let B6 of z6)j6.addTool(B6,T6)}if(j6&&!N.abortController.signal.aborted){for(let z6 of j6.getCompletedResults())if(z6.message)yield z6.message,N6.push(...v2([z6.message],N.options.tools).filter((B6)=>B6.type==="user"))}}AA("query_api_streaming_end")}catch(I6){if(I6 instanceof es&&$){if(v6=$,d6=!0,yield*L5q($6,"Model fallback triggered"),$6.length=0,N6.length=0,H6.length=0,J6=!1,j6)j6.discard(),j6=new HS6(N.options.tools,Y,N);if(N.options.mainLoopModel=$,process.env.USER_TYPE==="ant")U=f48(U);Q("tengu_model_fallback_triggered",{original_model:I6.originalModel,fallback_model:$,entrypoint:"cli",queryChainId:F,queryDepth:x.depth}),yield Jw(`Switched to ${wY(I6.fallbackModel)} due to high demand for ${wY(I6.originalModel)}`,"warning");continue}throw I6}}}catch(I6){_6(I6);let T6=I6 instanceof Error?I6.message:String(I6);if(Q("tengu_query_error",{assistantMessages:$6.length,toolUses:$6.flatMap((l6)=>l6.message.content.filter((z8)=>z8.type==="tool_use")).length,queryChainId:F,queryDepth:x.depth}),I6 instanceof f$6||I6 instanceof nS)return yield uA({content:I6.message}),{reason:"image_error"};return yield*L5q($6,T6),yield uA({content:T6}),Mv("Query error",I6),{reason:"model_error",error:I6}}if($6.length>0)ouK([...U,...$6],_,A,z,N,O);if(N.abortController.signal.aborted){if(j6){for await(let I6 of j6.getRemainingResults())if(I6.message)yield I6.message}else yield*L5q($6,"Interrupted by user");if(N.abortController.signal.reason!=="interrupt")yield lp({toolUse:!1});return{reason:"aborted_streaming"}}if(u){let I6=await u;if(I6)yield I6}if(!J6){let I6=$6.at(-1),T6=I6?.type==="assistant"&&I6.isApiErrorMessage&&h5q(I6),l6=U6&&z86?.isWithheldMediaSizeError(I6);if((T6||l6)&&z86){let z6=await z86.tryReactiveCompact({hasAttempted:C,querySource:O,aborted:N.abortController.signal.aborted,messages:U,cacheSafeParams:{systemPrompt:_,userContext:A,systemContext:z,toolUseContext:N,forkContextMessages:U}});if(z6){if(q.taskBudget){let P6=Mi8(U);P=Math.max(0,(P??q.taskBudget.total)-P6)}let B6=up(z6);for(let P6 of B6)yield P6;M={messages:B6,toolUseContext:N,autoCompactTracking:void 0,maxOutputTokensRecoveryCount:S,hasAttemptedReactiveCompact:!0,maxOutputTokensOverride:void 0,pendingToolUseSummary:void 0,stopHookActive:void 0,turnCount:g,transition:{reason:"reactive_compact_retry"}};continue}return yield I6,I$8(I6,N),{reason:l6?"image_error":"prompt_too_long"}}if(Bf_(I6)){if(_q("tengu_otk_slot_v1",!1)&&b===void 0&&!process.env.PUKU_CLI_MAX_OUTPUT_TOKENS){Q("tengu_max_tokens_escalate",{escalatedTo:am8}),M={messages:U,toolUseContext:N,autoCompactTracking:d,maxOutputTokensRecoveryCount:S,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:am8,pendingToolUseSummary:void 0,stopHookActive:void 0,turnCount:g,transition:{reason:"max_output_tokens_escalate"}};continue}if(S<p65){let B6=C8({content:"Output token limit hit. Resume directly — no apology, no recap of what you were doing. "+"Pick up mid-thought if that is where the cut happened. Break remaining work into smaller pieces.",isMeta:!0});M={messages:[...U,...$6,B6],toolUseContext:N,autoCompactTracking:d,maxOutputTokensRecoveryCount:S+1,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:void 0,pendingToolUseSummary:void 0,stopHookActive:void 0,turnCount:g,transition:{reason:"max_output_tokens_recovery",attempt:S+1}};continue}yield I6}if(I6?.isApiErrorMessage)return I$8(I6,N),{reason:"completed"};let z8=yield*Ef_(U,$6,_,A,z,N,O,m);if(z8.preventContinuation)return{reason:"stop_hook_prevented"};if(z8.blockingErrors.length>0){M={messages:[...U,...$6,...z8.blockingErrors],toolUseContext:N,autoCompactTracking:d,maxOutputTokensRecoveryCount:0,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:void 0,pendingToolUseSummary:void 0,stopHookActive:!0,turnCount:g,transition:{reason:"stop_hook_blocking"}};continue}return{reason:"completed"}}let u6=!1,R6=N;if(AA("query_tool_execution_start"),j6)Q("tengu_streaming_tool_execution_used",{tool_count:H6.length,queryChainId:F,queryDepth:x.depth});else Q("tengu_streaming_tool_execution_not_used",{tool_count:H6.length,queryChainId:F,queryDepth:x.depth});let Z6=j6?j6.getRemainingResults():v68(H6,$6,Y,N);for await(let I6 of Z6){if(I6.message){if(yield I6.message,I6.message.type==="attachment"&&I6.message.attachment.type==="hook_stopped_continuation")u6=!0;N6.push(...v2([I6.message],N.options.tools).filter((T6)=>T6.type==="user"))}if(I6.newContext)R6={...I6.newContext,queryTracking:x}}AA("query_tool_execution_end");let D6;if(X.gates.emitToolUseSummaries&&H6.length>0&&!N.abortController.signal.aborted&&!N.agentId){let I6=$6.at(-1),T6;if(I6){let z6=I6.message.content.filter((B6)=>B6.type==="text");if(z6.length>0){let B6=z6.at(-1);if(B6&&"text"in B6)T6=B6.text}}let l6=H6.map((z6)=>z6.id),z8=H6.map((z6)=>{let B6=N6.find((P6)=>P6.type==="user"&&Array.isArray(P6.message.content)&&P6.message.content.some((m6)=>m6.type==="tool_result"&&m6.tool_use_id===z6.id)),q8=B6?.type==="user"&&Array.isArray(B6.message.content)?B6.message.content.find((P6)=>P6.type==="tool_result"&&P6.tool_use_id===z6.id):void 0;return{name:z6.name,input:z6.input,output:q8&&"content"in q8?q8.content:null}});D6=xuK({tools:z8,signal:N.abortController.signal,isNonInteractiveSession:N.options.isNonInteractiveSession,lastAssistantText:T6}).then((z6)=>{if(z6)return Uf_(z6,l6);return null}).catch(()=>null)}if(N.abortController.signal.aborted){if(N.abortController.signal.reason!=="interrupt")yield lp({toolUse:!0});let I6=g+1;if(w&&I6>w)yield y_({type:"max_turns_reached",maxTurns:w,turnCount:I6});return{reason:"aborted_tools"}}if(u6)return{reason:"hook_stopped"};if(d?.compacted)d.turnCounter++,Q("tengu_post_autocompact_turn",{turnId:d.turnId,turnCounter:d.turnCounter,queryChainId:F,queryDepth:x.depth});Q("tengu_query_before_attachments",{messagesForQueryCount:U.length,assistantMessagesCount:$6.length,toolResultsCount:N6.length,queryChainId:F,queryDepth:x.depth});let o6=H6.some((I6)=>I6.name===_t),s6=O.startsWith("repl_main_thread")||O==="sdk",S6=N.agentId,y6=je6(o6?"later":"next").filter((I6)=>{if(QuK(I6))return!1;if(s6)return I6.agentId===void 0;return I6.mode==="task-notification"&&I6.agentId===S6});for await(let I6 of s96(null,R6,null,y6,[...U,...$6,...N6],O))yield I6,N6.push(I6);if(f&&f.settledAt!==null&&f.consumedOnIteration===-1){let I6=Ff_(await f.promise,N.readFileState);for(let T6 of I6){let l6=y_(T6);yield l6,N6.push(l6)}f.consumedOnIteration=g-1}if(V5q&&B){let I6=await V5q.collectSkillDiscoveryPrefetch(B);for(let T6 of I6){let l6=y_(T6);yield l6,N6.push(l6)}}let F6=y6.filter((I6)=>I6.mode==="prompt"||I6.mode==="task-notification");if(F6.length>0){for(let I6 of F6)if(I6.uuid)K.push(I6.uuid),oS(I6.uuid,"started");cuK(F6)}let k6=Bq(N6,(I6)=>I6.type==="attachment"&&I6.attachment.type==="edited_text_file");if(Q("tengu_query_after_attachments",{totalToolResultsCount:N6.length,fileChangeAttachmentCount:k6,queryChainId:F,queryDepth:x.depth}),R6.options.refreshTools){let I6=R6.options.refreshTools();if(I6!==R6.options.tools)R6={...R6,options:{...R6.options,tools:I6}}}let G6={...R6,queryTracking:x},W6=g+1;if(w&&W6>w)return yield y_({type:"max_turns_reached",maxTurns:w,turnCount:W6}),{reason:"max_turns",turnCount:W6};AA("query_recursive_call"),M={messages:[...U,...$6,...N6],toolUseContext:G6,autoCompactTracking:d,turnCount:W6,maxOutputTokensRecoveryCount:0,hasAttemptedReactiveCompact:!1,pendingToolUseSummary:D6,maxOutputTokensOverride:void 0,stopHookActive:m,transition:{reason:"next_turn"}}}}catch(Z){var v=Z,k=1}finally{Dz(W,v,k)}}var z86=null,V5q=null,p65=3;var J66=h(()=>{sU();mp();pp();Ye6();WD();M_();N8();x0();Y8();Vq();uuK();O86();tj();R9();F06();Y_();TZ();Vj();U06();d06();D$();eU();Xf_();A86();sr8();$X();e_();Cf_();xf_();pf_();v8();gf_()});var a2;var S5q=h(()=>{a2={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:"standard",cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:"",iterations:[],speed:"standard"}});function B65(q){if(q instanceof VK){let K=q.error;if(K?.error?.message)return K.error.message}return q instanceof Error?q.message:String(q)}function Qf_({headers:q,baseUrl:K}){if(q){let _=[];q.forEach((A,z)=>_.push(z));for(let[A,{prefixes:z}]of Object.entries(c65))if(z.some((Y)=>_.some(($)=>$.startsWith(Y))))return A}if(K)try{let _=new URL(K).hostname.toLowerCase();for(let[A,z]of Object.entries(F65))if(z.some((Y)=>_.endsWith(Y)))return A}catch{}return}function E5q(){return{...process.env.ANTHROPIC_BASE_URL?{baseUrl:process.env.ANTHROPIC_BASE_URL}:{},...process.env.ANTHROPIC_MODEL?{envModel:process.env.ANTHROPIC_MODEL}:{},...process.env.ANTHROPIC_SMALL_FAST_MODEL?{envSmallFastModel:process.env.ANTHROPIC_SMALL_FAST_MODEL}:{}}}function lf_(){let q=new Date("2026-06-26T08:30:08.668Z").getTime();if(isNaN(q))return;return Math.floor((Date.now()-q)/60000)}function if_({model:q,messagesLength:K,temperature:_,betas:A,permissionMode:z,querySource:Y,queryTracking:$,thinkingType:O,effortValue:w,fastMode:H,previousRequestId:j}){Q("tengu_api_query",{model:q,messagesLength:K,temperature:_,provider:kF(),buildAgeMins:lf_(),...A?.length?{betas:A.join(",")}:{},permissionMode:z,querySource:Y,...$?{queryChainId:$.chainId,queryDepth:$.depth}:{},thinkingType:O,effortValue:w,fastMode:H,...j?{previousRequestId:j}:{},...E5q()})}function C5q({error:q,model:K,messageCount:_,messageTokens:A,durationMs:z,durationMsIncludingRetries:Y,attempt:$,requestId:O,clientRequestId:w,didFallBackToNonStreaming:H,promptCategory:j,headers:M,queryTracking:J,querySource:P,llmSpan:X,fastMode:f,previousRequestId:W}){let Z=Qf_({headers:q instanceof VK&&q.headers?q.headers:M,baseUrl:process.env.ANTHROPIC_BASE_URL}),v=B65(q),k=q instanceof VK?String(q.status):void 0,N=nf_(q),y=oU(q);if(y){let C=y.isSSLError?" (SSL error)":"";R(`Connection error details: code=${y.code}${C}, message=${y.message}`,{level:"error"})}let L=v6q();if(w)R(`API error x-client-request-id=${w} (give this to the API team for server-log lookup)`,{level:"error"});_6(q),Q("tengu_api_error",{model:K,error:v,status:k,errorType:N,messageCount:_,messageTokens:A,durationMs:z,durationMsIncludingRetries:Y,attempt:$,provider:kF(),requestId:O||void 0,...L?{invokingRequestId:L.invokingRequestId,invocationKind:L.invocationKind}:{},clientRequestId:w||void 0,didFallBackToNonStreaming:H,...j?{promptCategory:j}:{},...Z?{gateway:Z}:{},...J?{queryChainId:J.chainId,queryDepth:J.depth}:{},...P?{querySource:P}:{},fastMode:f,...W?{previousRequestId:W}:{},...E5q()}),HO("api_error",{model:K,error:v,status_code:String(k),duration_ms:String(z),attempt:String($),speed:f?"fast":"normal"}),Ye8(X,{success:!1,statusCode:k?parseInt(k):void 0,error:v,attempt:$});let S=iu6();if(S?.isTeleported&&!S.hasLoggedFirstMessage)Q("tengu_teleport_first_message_error",{session_id:S.sessionId,error_type:N}),ru6()}function U65({model:q,preNormalizedModel:K,messageCount:_,messageTokens:A,usage:z,durationMs:Y,durationMsIncludingRetries:$,attempt:O,ttftMs:w,requestId:H,stopReason:j,costUSD:M,didFallBackToNonStreaming:J,querySource:P,gateway:X,queryTracking:f,permissionMode:W,globalCacheStrategy:Z,textContentLength:v,thinkingContentLength:k,toolUseContentLengths:N,connectorTextBlockCount:y,fastMode:L,previousRequestId:S,betas:C}){let b=pK(),u=cP8(),m=process.argv.includes("-p")||process.argv.includes("--print"),g=Date.now(),B=dr(),x=B!==null?g-B:void 0,F=v6q();Q("tengu_api_success",{model:q,...K!==q?{preNormalizedModel:K}:{},...C?.length?{betas:C.join(",")}:{},messageCount:_,messageTokens:A,inputTokens:z.input_tokens,outputTokens:z.output_tokens,cachedInputTokens:z.cache_read_input_tokens??0,uncachedInputTokens:z.cache_creation_input_tokens??0,durationMs:Y,durationMsIncludingRetries:$,attempt:O,ttftMs:w??void 0,buildAgeMins:lf_(),provider:kF(),requestId:H??void 0,...F?{invokingRequestId:F.invokingRequestId,invocationKind:F.invocationKind}:{},stop_reason:j??void 0,costUSD:M,didFallBackToNonStreaming:J,isNonInteractiveSession:b,print:m,isTTY:process.stdout.isTTY??!1,querySource:P,...X?{gateway:X}:{},...f?{queryChainId:f.chainId,queryDepth:f.depth}:{},permissionMode:W,...Z?{globalCacheStrategy:Z}:{},...v!==void 0?{textContentLength:v}:{},...k!==void 0?{thinkingContentLength:k}:{},...N!==void 0?{toolUseContentLengths:c6(N)}:{},...y!==void 0?{connectorTextBlockCount:y}:{},fastMode:L,...{},...S?{previousRequestId:S}:{},...u?{isPostCompaction:u}:{},...E5q(),timeSinceLastApiCallMs:x}),YP6(g)}function rf_({model:q,preNormalizedModel:K,start:_,startIncludingRetries:A,ttftMs:z,usage:Y,attempt:$,messageCount:O,messageTokens:w,requestId:H,stopReason:j,didFallBackToNonStreaming:M,querySource:J,headers:P,costUSD:X,queryTracking:f,permissionMode:W,newMessages:Z,llmSpan:v,globalCacheStrategy:k,requestSetupMs:N,attemptStartTimes:y,fastMode:L,previousRequestId:S,betas:C}){let b=Qf_({headers:P,baseUrl:process.env.ANTHROPIC_BASE_URL}),u,m,g,B;if(Z){let n=0,t=0,s=!1,e={},q6=0;for(let f6 of Z)for(let $6 of f6.message.content)if($6.type==="text")n+=$6.text.length;else if($6.type==="thinking")t+=$6.thinking.length;else if($6.type==="tool_use"||$6.type==="server_tool_use"||$6.type==="mcp_tool_use"){let N6=c6($6.input).length,H6=$7($6.name);e[H6]=(e[H6]??0)+N6,s=!0}u=n,m=t>0?t:void 0,g=s?e:void 0,B=q6>0?q6:void 0}let x=Date.now()-_,F=Date.now()-A;yP8(F,x),U65({model:q,preNormalizedModel:K,messageCount:O,messageTokens:w,usage:Y,durationMs:x,durationMsIncludingRetries:F,attempt:$,ttftMs:z,requestId:H,stopReason:j,costUSD:X,didFallBackToNonStreaming:M,querySource:J,gateway:b,queryTracking:f,permissionMode:W,globalCacheStrategy:k,textContentLength:u,thinkingContentLength:m,toolUseContentLengths:g,connectorTextBlockCount:B,fastMode:L,previousRequestId:S,betas:C}),HO("api_request",{model:q,input_tokens:String(Y.input_tokens),output_tokens:String(Y.output_tokens),cache_read_tokens:String(Y.cache_read_input_tokens),cache_creation_tokens:String(Y.cache_creation_input_tokens),cost_usd:String(X),duration_ms:String(x),speed:L?"fast":"normal"});let U,d,o;if(CE()&&Z){if(U=Z.flatMap((n)=>n.message.content.filter((t)=>t.type==="text").map((t)=>t.text)).join(`
|
|
4218
|
+
`)}`,v=C$8(f,W,Z),k=await df({promptMessages:[C8({content:v})],cacheSafeParams:F0(_),canUseTool:Nf_(f),querySource:"auto_dream",forkLabel:"auto_dream",skipTranscript:!0,overrides:{abortController:P},onMessage:I65(X,J)});PM_(X,J);let N=_.toolUseContext.getAppState().tasks?.[X];if(A&&jM_(N)&&N.filesTouched.length>0)A({...G5q(N.filesTouched),verb:"Improved"});R(`[autoDream] completed — cache: read=${k.totalUsage.cache_read_input_tokens} created=${k.totalUsage.cache_creation_input_tokens}`),Q("tengu_auto_dream_completed",{cache_read:k.totalUsage.cache_read_input_tokens,cache_created:k.totalUsage.cache_creation_input_tokens,output:k.totalUsage.output_tokens,sessions_reviewed:H.length})}catch(f){if(P.signal.aborted){R("[autoDream] aborted by user");return}R(`[autoDream] fork failed: ${f.message}`),Q("tengu_auto_dream_failed",{}),XM_(X,J),await EY8(M)}}}function I65(q,K){return(_)=>{if(_.type!=="assistant")return;let A="",z=0,Y=[];for(let $ of _.message.content)if($.type==="text")A+=$.text;else if($.type==="tool_use"){if(z++,$.name===I_||$.name===P4){let O=$.input;if(typeof O.file_path==="string")Y.push(O.file_path)}}JM_(q,{text:A.trim(),toolUseCount:z},Y,K)}}async function hf_(q,K){await Vf_?.(q,K)}var S65=600000,Rf_,Vf_=null;var k5q=h(()=>{Qf();Vq();Y8();S3();J5q();e_();v8();yf_();v5q();ph6();IY8();C3();Rf_={minHours:24,minSessions:5}});async function*Ef_(q,K,_,A,z,Y,$,O){let w=Date.now(),H={messages:[...q,...K],systemPrompt:_,userContext:A,systemContext:z,toolUseContext:Y,querySource:$};if($==="repl_main_thread"||$==="sdk")bf_(F0(H));if(!h4()){if(!OA(process.env.PUKU_CLI_ENABLE_PROMPT_SUGGESTION))HBK(H);if(!Y.agentId)hf_(H,Y.appendSystemMessage)}try{let j=[],J=Y.getAppState().toolPermissionContext.mode,P=y5q(J,Y.abortController.signal,void 0,O??!1,Y.agentId,Y,[...q,...K],Y.agentType),X="",f=0,W=!1,Z="",v=!1,k=[],N=[];for await(let y of P){if(y.message){if(yield y.message,y.message.type==="progress"&&y.message.toolUseID){X=y.message.toolUseID,f++;let L=y.message.data;if(L.command)N.push({command:L.command,promptText:L.promptText})}if(y.message.type==="attachment"){let L=y.message.attachment;if("hookEvent"in L&&(L.hookEvent==="Stop"||L.hookEvent==="SubagentStop")){if(L.type==="hook_non_blocking_error")k.push(L.stderr||`Exit code ${L.exitCode}`),v=!0;else if(L.type==="hook_error_during_execution")k.push(L.content),v=!0;else if(L.type==="hook_success"){if(L.stdout&&L.stdout.trim()||L.stderr&&L.stderr.trim())v=!0}if("durationMs"in L&&"command"in L){let S=N.find((C)=>C.command===L.command&&C.durationMs===void 0);if(S)S.durationMs=L.durationMs}}}}if(y.blockingError){let L=C8({content:T5q(y.blockingError),isMeta:!0});j.push(L),yield L,v=!0,k.push(y.blockingError.blockingError)}if(y.preventContinuation)W=!0,Z=y.stopReason||"Stop hook prevented continuation",yield y_({type:"hook_stopped_continuation",message:Z,hookName:"Stop",toolUseID:X,hookEvent:"Stop"});if(Y.abortController.signal.aborted)return Q("tengu_pre_stop_hooks_cancelled",{queryChainId:Y.queryTracking?.chainId,queryDepth:Y.queryTracking?.depth}),yield lp({toolUse:!1}),{blockingErrors:[],preventContinuation:!0}}if(f>0){if(yield wS6(f,N,k,W,Z,v,"suggestion",X),k.length>0){let y=K1("app:toggleTranscript","Global","ctrl+o");Y.addNotification?.({key:"stop-hook-error",text:`Stop hook error occurred · ${y} to see`,priority:"immediate"})}}if(W)return{blockingErrors:[],preventContinuation:!0};if(j.length>0)return{blockingErrors:j,preventContinuation:!1};if(MY()){let y=p5()??"",L=QA()??"",S=[],C=!1,b,u="",m=HX(),B=(await OJ(m)).filter((F)=>F.status==="in_progress"&&F.owner===y);for(let F of B){let U=lh6(F.id,F.subject,F.description,y,L,J,Y.abortController.signal,void 0,Y);for await(let d of U){if(d.message){if(d.message.type==="progress"&&d.message.toolUseID)u=d.message.toolUseID;yield d.message}if(d.blockingError){let o=C8({content:Qh6(d.blockingError),isMeta:!0});S.push(o),yield o}if(d.preventContinuation)C=!0,b=d.stopReason||"TaskCompleted hook prevented continuation",yield y_({type:"hook_stopped_continuation",message:b,hookName:"TaskCompleted",toolUseID:u,hookEvent:"TaskCompleted"});if(Y.abortController.signal.aborted)return{blockingErrors:[],preventContinuation:!0}}}let x=R5q(y,L,J,Y.abortController.signal);for await(let F of x){if(F.message){if(F.message.type==="progress"&&F.message.toolUseID)u=F.message.toolUseID;yield F.message}if(F.blockingError){let U=C8({content:N5q(F.blockingError),isMeta:!0});S.push(U),yield U}if(F.preventContinuation)C=!0,b=F.stopReason||"TeammateIdle hook prevented continuation",yield y_({type:"hook_stopped_continuation",message:b,hookName:"TeammateIdle",toolUseID:u,hookEvent:"TeammateIdle"});if(Y.abortController.signal.aborted)return{blockingErrors:[],preventContinuation:!0}}if(C)return{blockingErrors:[],preventContinuation:!0};if(S.length>0)return{blockingErrors:S,preventContinuation:!1}}return{blockingErrors:[],preventContinuation:!1}}catch(j){let M=Date.now()-w;return Q("tengu_stop_hook_error",{duration:M,queryChainId:Y.queryTracking?.chainId,queryDepth:Y.queryTracking?.depth}),yield Jw(`Stop hook failed: ${r6(j)}`,"warning"),{blockingErrors:[],preventContinuation:!1}}}var Cf_=h(()=>{XE();S3();tj();Y8();T8();D$();Vq();C9();JY();k5q();Wt();I8();Qf()});function If_(){return{sessionId:k8(),gates:{streamingToolExecution:_O("tengu_streaming_tool_execution2"),emitToolUseSummaries:p6(process.env.PUKU_CLI_EMIT_TOOL_USE_SUMMARIES),isAnt:process.env.USER_TYPE==="ant",fastModeEnabled:!p6(process.env.PUKU_CLI_DISABLE_FAST_MODE)}}}var xf_=h(()=>{v8();I8()});import{randomUUID as x65}from"crypto";function uf_(){return{callModel:N16,microcompact:lU,autocompact:mf_,uuid:x65}}var pf_=h(()=>{O3();mp();gR()});var u65,Cu$;var b$8=h(()=>{u65=/\b(?:use|spend)\s+(\d+(?:\.\d+)?)\s*(k|m|b)\s*tokens?\b/i,Cu$=new RegExp(u65.source,"gi")});var gf_=h(()=>{b$8()});function*L5q(q,K){for(let _ of q){let A=_.message.content.filter((z)=>z.type==="tool_use");for(let z of A)yield C8({content:[{type:"tool_result",content:K,is_error:!0,tool_use_id:z.id}],toolUseResult:K,sourceToolAssistantUUID:_.uuid})}}function Bf_(q){return q?.type==="assistant"&&q.apiError==="max_output_tokens"}async function*WN(q){let K=[],_=yield*m65(q,K);for(let A of K)oS(A,"completed");return _}async function*m65(q,K){let W=[];try{let{systemPrompt:_,userContext:A,systemContext:z,canUseTool:Y,fallbackModel:$,querySource:O,maxTurns:w,skipCacheWrite:H}=q;let j=q.deps??uf_();let M={messages:q.messages,toolUseContext:q.toolUseContext,maxOutputTokensOverride:q.maxOutputTokensOverride,autoCompactTracking:void 0,stopHookActive:void 0,maxOutputTokensRecoveryCount:0,hasAttemptedReactiveCompact:!1,turnCount:1,pendingToolUseSummary:void 0,transition:void 0};let J=null;let P=void 0;let X=If_();const f=vz(W,cf_(M.messages,M.toolUseContext),0);while(!0){let{toolUseContext:N}=M,{messages:y,autoCompactTracking:L,maxOutputTokensRecoveryCount:S,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:b,pendingToolUseSummary:u,stopHookActive:m,turnCount:g}=M,B=V5q?.startSkillDiscoveryPrefetch(null,y,N);if(yield{type:"stream_request_start"},AA("query_fn_entry"),!N.agentId)g1("query_started");let x=N.queryTracking?{chainId:N.queryTracking.chainId,depth:N.queryTracking.depth+1}:{chainId:j.uuid(),depth:0},F=x.chainId;N={...N,queryTracking:x};let U=[...l3(y)],d=L,o=O.startsWith("agent:")||O.startsWith("repl_main_thread"),K6=await hoK(U,N.contentReplacementState,o?(I6)=>void $86(I6,N.agentId).catch(_6):void 0,new Set(N.options.tools.filter((I6)=>!Number.isFinite(I6.maxResultSizeChars)).map((I6)=>I6.name)));if(U=K6.messages,K6.newlyReplaced.length>0)N.syncToolResultReplacements?.(N.contentReplacementState?.replacements??new Map);let n=0;AA("query_microcompact_start"),U=(await j.microcompact(U,N,O)).messages;let s=void 0;AA("query_microcompact_end");let e=F7(df_(_,z));AA("query_autocompact_start");let{compactionResult:q6,consecutiveFailures:f6}=await j.autocompact(U,N,{systemPrompt:_,userContext:A,systemContext:z,toolUseContext:N,forkContextMessages:U},O,d,n);if(AA("query_autocompact_end"),q6){let{preCompactTokenCount:I6,postCompactTokenCount:T6,truePostCompactTokenCount:l6,compactionUsage:z8}=q6;if(Q("tengu_auto_compact_succeeded",{originalMessageCount:y.length,compactedMessageCount:q6.summaryMessages.length+q6.attachments.length+q6.hookResults.length,preCompactTokenCount:I6,postCompactTokenCount:T6,truePostCompactTokenCount:l6,compactionInputTokens:z8?.input_tokens,compactionOutputTokens:z8?.output_tokens,compactionCacheReadTokens:z8?.cache_read_input_tokens??0,compactionCacheCreationTokens:z8?.cache_creation_input_tokens??0,compactionTotalTokens:z8?z8.input_tokens+(z8.cache_creation_input_tokens??0)+(z8.cache_read_input_tokens??0)+z8.output_tokens:0,queryChainId:F,queryDepth:x.depth}),q.taskBudget){let B6=Mi8(U);P=Math.max(0,(P??q.taskBudget.total)-B6)}d={compacted:!0,turnId:j.uuid(),turnCounter:0,consecutiveFailures:0};let z6=up(q6);for(let B6 of z6)yield B6;U=z6}else if(f6!==void 0)d={...d??{compacted:!1,turnId:"",turnCounter:0},consecutiveFailures:f6};N={...N,messages:U};let $6=[],N6=[],H6=[],J6=!1;AA("query_setup_start");let j6=X.gates.streamingToolExecution?new HS6(N.options.tools,Y,N):null,A6=N.getAppState(),w6=A6.toolPermissionContext.mode,v6=OR({permissionMode:w6,mainLoopModel:N.options.mainLoopModel,exceeds200kTokens:w6==="plan"&&at6(U)});AA("query_setup_end");let C6=X.gates.isAnt?suK(N.agentId??X.sessionId):void 0,n6=!1,U6=z86?.isReactiveCompactEnabled()??!1;if(!q6&&O!=="compact"&&O!=="session_memory"&&!(z86?.isReactiveCompactEnabled()&&CN())&&!n6){let{isAtBlockingLimit:I6}=Y86(PD(U)-n,N.options.mainLoopModel);if(I6)return yield uA({content:xV,error:"invalid_request"}),{reason:"blocking_limit"}}let d6=!0;AA("query_api_loop_start");try{while(d6){d6=!1;try{let I6=!1;AA("query_api_streaming_start");for await(let T6 of j.callModel({messages:x$8(U,A),systemPrompt:e,thinkingConfig:N.options.thinkingConfig,tools:N.options.tools,signal:N.abortController.signal,options:{async getToolPermissionContext(){return N.getAppState().toolPermissionContext},model:v6,...X.gates.fastModeEnabled&&{fastMode:A6.fastMode},toolChoice:void 0,isNonInteractiveSession:N.options.isNonInteractiveSession,fallbackModel:$,onStreamingFallback:()=>{I6=!0},querySource:O,agents:N.options.agentDefinitions.activeAgents,allowedAgentTypes:N.options.agentDefinitions.allowedAgentTypes,hasAppendSystemPrompt:!!N.options.appendSystemPrompt,maxOutputTokensOverride:b,fetchOverride:C6,mcpTools:A6.mcp.tools,hasPendingMcpServers:A6.mcp.clients.some((l6)=>l6.type==="pending"),queryTracking:x,effortValue:A6.effortValue,advisorModel:A6.advisorModel,skipCacheWrite:H,agentId:N.agentId,addNotification:N.addNotification,providerOverride:N.options.providerOverride,...q.taskBudget&&{taskBudget:{total:q.taskBudget.total,...P!==void 0&&{remaining:P}}}}})){if(I6){for(let z6 of $6)yield{type:"tombstone",message:z6};if(Q("tengu_orphaned_messages_tombstoned",{orphanedMessageCount:$6.length,queryChainId:F,queryDepth:x.depth}),$6.length=0,N6.length=0,H6.length=0,J6=!1,j6)j6.discard(),j6=new HS6(N.options.tools,Y,N)}let l6=T6;if(T6.type==="assistant"){let z6;for(let B6=0;B6<T6.message.content.length;B6++){let q8=T6.message.content[B6];if(q8.type==="tool_use"&&typeof q8.input==="object"&&q8.input!==null){let P6=O4(N.options.tools,q8.name);if(P6?.backfillObservableInput){let m6=q8.input,O8={...m6};if(P6.backfillObservableInput(O8),Object.keys(O8).some((i8)=>!(i8 in m6)))z6??=[...T6.message.content],z6[B6]={...q8,input:O8}}}}if(z6)l6={...T6,message:{...T6.message,content:z6}}}let z8=!1;if(z86?.isWithheldPromptTooLong(T6))z8=!0;if(U6&&z86?.isWithheldMediaSizeError(T6))z8=!0;if(Bf_(T6))z8=!0;if(!z8)yield l6;if(T6.type==="assistant"){$6.push(T6);let z6=T6.message.content.filter((B6)=>B6.type==="tool_use");if(z6.length>0)H6.push(...z6),J6=!0;if(j6&&!N.abortController.signal.aborted)for(let B6 of z6)j6.addTool(B6,T6)}if(j6&&!N.abortController.signal.aborted){for(let z6 of j6.getCompletedResults())if(z6.message)yield z6.message,N6.push(...v2([z6.message],N.options.tools).filter((B6)=>B6.type==="user"))}}AA("query_api_streaming_end")}catch(I6){if(I6 instanceof es&&$){if(v6=$,d6=!0,yield*L5q($6,"Model fallback triggered"),$6.length=0,N6.length=0,H6.length=0,J6=!1,j6)j6.discard(),j6=new HS6(N.options.tools,Y,N);if(N.options.mainLoopModel=$,process.env.USER_TYPE==="ant")U=f48(U);Q("tengu_model_fallback_triggered",{original_model:I6.originalModel,fallback_model:$,entrypoint:"cli",queryChainId:F,queryDepth:x.depth}),yield Jw(`Switched to ${wY(I6.fallbackModel)} due to high demand for ${wY(I6.originalModel)}`,"warning");continue}throw I6}}}catch(I6){_6(I6);let T6=I6 instanceof Error?I6.message:String(I6);if(Q("tengu_query_error",{assistantMessages:$6.length,toolUses:$6.flatMap((l6)=>l6.message.content.filter((z8)=>z8.type==="tool_use")).length,queryChainId:F,queryDepth:x.depth}),I6 instanceof f$6||I6 instanceof nS)return yield uA({content:I6.message}),{reason:"image_error"};return yield*L5q($6,T6),yield uA({content:T6}),Mv("Query error",I6),{reason:"model_error",error:I6}}if($6.length>0)ouK([...U,...$6],_,A,z,N,O);if(N.abortController.signal.aborted){if(j6){for await(let I6 of j6.getRemainingResults())if(I6.message)yield I6.message}else yield*L5q($6,"Interrupted by user");if(N.abortController.signal.reason!=="interrupt")yield lp({toolUse:!1});return{reason:"aborted_streaming"}}if(u){let I6=await u;if(I6)yield I6}if(!J6){let I6=$6.at(-1),T6=I6?.type==="assistant"&&I6.isApiErrorMessage&&h5q(I6),l6=U6&&z86?.isWithheldMediaSizeError(I6);if((T6||l6)&&z86){let z6=await z86.tryReactiveCompact({hasAttempted:C,querySource:O,aborted:N.abortController.signal.aborted,messages:U,cacheSafeParams:{systemPrompt:_,userContext:A,systemContext:z,toolUseContext:N,forkContextMessages:U}});if(z6){if(q.taskBudget){let P6=Mi8(U);P=Math.max(0,(P??q.taskBudget.total)-P6)}let B6=up(z6);for(let P6 of B6)yield P6;M={messages:B6,toolUseContext:N,autoCompactTracking:void 0,maxOutputTokensRecoveryCount:S,hasAttemptedReactiveCompact:!0,maxOutputTokensOverride:void 0,pendingToolUseSummary:void 0,stopHookActive:void 0,turnCount:g,transition:{reason:"reactive_compact_retry"}};continue}return yield I6,I$8(I6,N),{reason:l6?"image_error":"prompt_too_long"}}if(Bf_(I6)){if(_q("tengu_otk_slot_v1",!1)&&b===void 0&&!process.env.PUKU_CLI_MAX_OUTPUT_TOKENS){Q("tengu_max_tokens_escalate",{escalatedTo:am8}),M={messages:U,toolUseContext:N,autoCompactTracking:d,maxOutputTokensRecoveryCount:S,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:am8,pendingToolUseSummary:void 0,stopHookActive:void 0,turnCount:g,transition:{reason:"max_output_tokens_escalate"}};continue}if(S<p65){let B6=C8({content:"Output token limit hit. Resume directly — no apology, no recap of what you were doing. "+"Pick up mid-thought if that is where the cut happened. Break remaining work into smaller pieces.",isMeta:!0});M={messages:[...U,...$6,B6],toolUseContext:N,autoCompactTracking:d,maxOutputTokensRecoveryCount:S+1,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:void 0,pendingToolUseSummary:void 0,stopHookActive:void 0,turnCount:g,transition:{reason:"max_output_tokens_recovery",attempt:S+1}};continue}yield I6}if(I6?.isApiErrorMessage)return I$8(I6,N),{reason:"completed"};let z8=yield*Ef_(U,$6,_,A,z,N,O,m);if(z8.preventContinuation)return{reason:"stop_hook_prevented"};if(z8.blockingErrors.length>0){M={messages:[...U,...$6,...z8.blockingErrors],toolUseContext:N,autoCompactTracking:d,maxOutputTokensRecoveryCount:0,hasAttemptedReactiveCompact:C,maxOutputTokensOverride:void 0,pendingToolUseSummary:void 0,stopHookActive:!0,turnCount:g,transition:{reason:"stop_hook_blocking"}};continue}return{reason:"completed"}}let u6=!1,R6=N;if(AA("query_tool_execution_start"),j6)Q("tengu_streaming_tool_execution_used",{tool_count:H6.length,queryChainId:F,queryDepth:x.depth});else Q("tengu_streaming_tool_execution_not_used",{tool_count:H6.length,queryChainId:F,queryDepth:x.depth});let Z6=j6?j6.getRemainingResults():v68(H6,$6,Y,N);for await(let I6 of Z6){if(I6.message){if(yield I6.message,I6.message.type==="attachment"&&I6.message.attachment.type==="hook_stopped_continuation")u6=!0;N6.push(...v2([I6.message],N.options.tools).filter((T6)=>T6.type==="user"))}if(I6.newContext)R6={...I6.newContext,queryTracking:x}}AA("query_tool_execution_end");let D6;if(X.gates.emitToolUseSummaries&&H6.length>0&&!N.abortController.signal.aborted&&!N.agentId){let I6=$6.at(-1),T6;if(I6){let z6=I6.message.content.filter((B6)=>B6.type==="text");if(z6.length>0){let B6=z6.at(-1);if(B6&&"text"in B6)T6=B6.text}}let l6=H6.map((z6)=>z6.id),z8=H6.map((z6)=>{let B6=N6.find((P6)=>P6.type==="user"&&Array.isArray(P6.message.content)&&P6.message.content.some((m6)=>m6.type==="tool_result"&&m6.tool_use_id===z6.id)),q8=B6?.type==="user"&&Array.isArray(B6.message.content)?B6.message.content.find((P6)=>P6.type==="tool_result"&&P6.tool_use_id===z6.id):void 0;return{name:z6.name,input:z6.input,output:q8&&"content"in q8?q8.content:null}});D6=xuK({tools:z8,signal:N.abortController.signal,isNonInteractiveSession:N.options.isNonInteractiveSession,lastAssistantText:T6}).then((z6)=>{if(z6)return Uf_(z6,l6);return null}).catch(()=>null)}if(N.abortController.signal.aborted){if(N.abortController.signal.reason!=="interrupt")yield lp({toolUse:!0});let I6=g+1;if(w&&I6>w)yield y_({type:"max_turns_reached",maxTurns:w,turnCount:I6});return{reason:"aborted_tools"}}if(u6)return{reason:"hook_stopped"};if(d?.compacted)d.turnCounter++,Q("tengu_post_autocompact_turn",{turnId:d.turnId,turnCounter:d.turnCounter,queryChainId:F,queryDepth:x.depth});Q("tengu_query_before_attachments",{messagesForQueryCount:U.length,assistantMessagesCount:$6.length,toolResultsCount:N6.length,queryChainId:F,queryDepth:x.depth});let o6=H6.some((I6)=>I6.name===_t),s6=O.startsWith("repl_main_thread")||O==="sdk",S6=N.agentId,y6=je6(o6?"later":"next").filter((I6)=>{if(QuK(I6))return!1;if(s6)return I6.agentId===void 0;return I6.mode==="task-notification"&&I6.agentId===S6});for await(let I6 of s96(null,R6,null,y6,[...U,...$6,...N6],O))yield I6,N6.push(I6);if(f&&f.settledAt!==null&&f.consumedOnIteration===-1){let I6=Ff_(await f.promise,N.readFileState);for(let T6 of I6){let l6=y_(T6);yield l6,N6.push(l6)}f.consumedOnIteration=g-1}if(V5q&&B){let I6=await V5q.collectSkillDiscoveryPrefetch(B);for(let T6 of I6){let l6=y_(T6);yield l6,N6.push(l6)}}let F6=y6.filter((I6)=>I6.mode==="prompt"||I6.mode==="task-notification");if(F6.length>0){for(let I6 of F6)if(I6.uuid)K.push(I6.uuid),oS(I6.uuid,"started");cuK(F6)}let k6=Bq(N6,(I6)=>I6.type==="attachment"&&I6.attachment.type==="edited_text_file");if(Q("tengu_query_after_attachments",{totalToolResultsCount:N6.length,fileChangeAttachmentCount:k6,queryChainId:F,queryDepth:x.depth}),R6.options.refreshTools){let I6=R6.options.refreshTools();if(I6!==R6.options.tools)R6={...R6,options:{...R6.options,tools:I6}}}let G6={...R6,queryTracking:x},W6=g+1;if(w&&W6>w)return yield y_({type:"max_turns_reached",maxTurns:w,turnCount:W6}),{reason:"max_turns",turnCount:W6};AA("query_recursive_call"),M={messages:[...U,...$6,...N6],toolUseContext:G6,autoCompactTracking:d,turnCount:W6,maxOutputTokensRecoveryCount:0,hasAttemptedReactiveCompact:!1,pendingToolUseSummary:D6,maxOutputTokensOverride:void 0,stopHookActive:m,transition:{reason:"next_turn"}}}}catch(Z){var v=Z,k=1}finally{Dz(W,v,k)}}var z86=null,V5q=null,p65=3;var J66=h(()=>{sU();mp();pp();Ye6();WD();M_();N8();x0();Y8();Vq();uuK();O86();tj();R9();F06();Y_();TZ();Vj();U06();d06();D$();eU();Xf_();A86();sr8();$X();e_();Cf_();xf_();pf_();v8();gf_()});var a2;var S5q=h(()=>{a2={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:"standard",cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:"",iterations:[],speed:"standard"}});function B65(q){if(q instanceof VK){let K=q.error;if(K?.error?.message)return K.error.message}return q instanceof Error?q.message:String(q)}function Qf_({headers:q,baseUrl:K}){if(q){let _=[];q.forEach((A,z)=>_.push(z));for(let[A,{prefixes:z}]of Object.entries(c65))if(z.some((Y)=>_.some(($)=>$.startsWith(Y))))return A}if(K)try{let _=new URL(K).hostname.toLowerCase();for(let[A,z]of Object.entries(F65))if(z.some((Y)=>_.endsWith(Y)))return A}catch{}return}function E5q(){return{...process.env.ANTHROPIC_BASE_URL?{baseUrl:process.env.ANTHROPIC_BASE_URL}:{},...process.env.ANTHROPIC_MODEL?{envModel:process.env.ANTHROPIC_MODEL}:{},...process.env.ANTHROPIC_SMALL_FAST_MODEL?{envSmallFastModel:process.env.ANTHROPIC_SMALL_FAST_MODEL}:{}}}function lf_(){let q=new Date("2026-06-26T09:31:19.702Z").getTime();if(isNaN(q))return;return Math.floor((Date.now()-q)/60000)}function if_({model:q,messagesLength:K,temperature:_,betas:A,permissionMode:z,querySource:Y,queryTracking:$,thinkingType:O,effortValue:w,fastMode:H,previousRequestId:j}){Q("tengu_api_query",{model:q,messagesLength:K,temperature:_,provider:kF(),buildAgeMins:lf_(),...A?.length?{betas:A.join(",")}:{},permissionMode:z,querySource:Y,...$?{queryChainId:$.chainId,queryDepth:$.depth}:{},thinkingType:O,effortValue:w,fastMode:H,...j?{previousRequestId:j}:{},...E5q()})}function C5q({error:q,model:K,messageCount:_,messageTokens:A,durationMs:z,durationMsIncludingRetries:Y,attempt:$,requestId:O,clientRequestId:w,didFallBackToNonStreaming:H,promptCategory:j,headers:M,queryTracking:J,querySource:P,llmSpan:X,fastMode:f,previousRequestId:W}){let Z=Qf_({headers:q instanceof VK&&q.headers?q.headers:M,baseUrl:process.env.ANTHROPIC_BASE_URL}),v=B65(q),k=q instanceof VK?String(q.status):void 0,N=nf_(q),y=oU(q);if(y){let C=y.isSSLError?" (SSL error)":"";R(`Connection error details: code=${y.code}${C}, message=${y.message}`,{level:"error"})}let L=v6q();if(w)R(`API error x-client-request-id=${w} (give this to the API team for server-log lookup)`,{level:"error"});_6(q),Q("tengu_api_error",{model:K,error:v,status:k,errorType:N,messageCount:_,messageTokens:A,durationMs:z,durationMsIncludingRetries:Y,attempt:$,provider:kF(),requestId:O||void 0,...L?{invokingRequestId:L.invokingRequestId,invocationKind:L.invocationKind}:{},clientRequestId:w||void 0,didFallBackToNonStreaming:H,...j?{promptCategory:j}:{},...Z?{gateway:Z}:{},...J?{queryChainId:J.chainId,queryDepth:J.depth}:{},...P?{querySource:P}:{},fastMode:f,...W?{previousRequestId:W}:{},...E5q()}),HO("api_error",{model:K,error:v,status_code:String(k),duration_ms:String(z),attempt:String($),speed:f?"fast":"normal"}),Ye8(X,{success:!1,statusCode:k?parseInt(k):void 0,error:v,attempt:$});let S=iu6();if(S?.isTeleported&&!S.hasLoggedFirstMessage)Q("tengu_teleport_first_message_error",{session_id:S.sessionId,error_type:N}),ru6()}function U65({model:q,preNormalizedModel:K,messageCount:_,messageTokens:A,usage:z,durationMs:Y,durationMsIncludingRetries:$,attempt:O,ttftMs:w,requestId:H,stopReason:j,costUSD:M,didFallBackToNonStreaming:J,querySource:P,gateway:X,queryTracking:f,permissionMode:W,globalCacheStrategy:Z,textContentLength:v,thinkingContentLength:k,toolUseContentLengths:N,connectorTextBlockCount:y,fastMode:L,previousRequestId:S,betas:C}){let b=pK(),u=cP8(),m=process.argv.includes("-p")||process.argv.includes("--print"),g=Date.now(),B=dr(),x=B!==null?g-B:void 0,F=v6q();Q("tengu_api_success",{model:q,...K!==q?{preNormalizedModel:K}:{},...C?.length?{betas:C.join(",")}:{},messageCount:_,messageTokens:A,inputTokens:z.input_tokens,outputTokens:z.output_tokens,cachedInputTokens:z.cache_read_input_tokens??0,uncachedInputTokens:z.cache_creation_input_tokens??0,durationMs:Y,durationMsIncludingRetries:$,attempt:O,ttftMs:w??void 0,buildAgeMins:lf_(),provider:kF(),requestId:H??void 0,...F?{invokingRequestId:F.invokingRequestId,invocationKind:F.invocationKind}:{},stop_reason:j??void 0,costUSD:M,didFallBackToNonStreaming:J,isNonInteractiveSession:b,print:m,isTTY:process.stdout.isTTY??!1,querySource:P,...X?{gateway:X}:{},...f?{queryChainId:f.chainId,queryDepth:f.depth}:{},permissionMode:W,...Z?{globalCacheStrategy:Z}:{},...v!==void 0?{textContentLength:v}:{},...k!==void 0?{thinkingContentLength:k}:{},...N!==void 0?{toolUseContentLengths:c6(N)}:{},...y!==void 0?{connectorTextBlockCount:y}:{},fastMode:L,...{},...S?{previousRequestId:S}:{},...u?{isPostCompaction:u}:{},...E5q(),timeSinceLastApiCallMs:x}),YP6(g)}function rf_({model:q,preNormalizedModel:K,start:_,startIncludingRetries:A,ttftMs:z,usage:Y,attempt:$,messageCount:O,messageTokens:w,requestId:H,stopReason:j,didFallBackToNonStreaming:M,querySource:J,headers:P,costUSD:X,queryTracking:f,permissionMode:W,newMessages:Z,llmSpan:v,globalCacheStrategy:k,requestSetupMs:N,attemptStartTimes:y,fastMode:L,previousRequestId:S,betas:C}){let b=Qf_({headers:P,baseUrl:process.env.ANTHROPIC_BASE_URL}),u,m,g,B;if(Z){let n=0,t=0,s=!1,e={},q6=0;for(let f6 of Z)for(let $6 of f6.message.content)if($6.type==="text")n+=$6.text.length;else if($6.type==="thinking")t+=$6.thinking.length;else if($6.type==="tool_use"||$6.type==="server_tool_use"||$6.type==="mcp_tool_use"){let N6=c6($6.input).length,H6=$7($6.name);e[H6]=(e[H6]??0)+N6,s=!0}u=n,m=t>0?t:void 0,g=s?e:void 0,B=q6>0?q6:void 0}let x=Date.now()-_,F=Date.now()-A;yP8(F,x),U65({model:q,preNormalizedModel:K,messageCount:O,messageTokens:w,usage:Y,durationMs:x,durationMsIncludingRetries:F,attempt:$,ttftMs:z,requestId:H,stopReason:j,costUSD:X,didFallBackToNonStreaming:M,querySource:J,gateway:b,queryTracking:f,permissionMode:W,globalCacheStrategy:k,textContentLength:u,thinkingContentLength:m,toolUseContentLengths:g,connectorTextBlockCount:B,fastMode:L,previousRequestId:S,betas:C}),HO("api_request",{model:q,input_tokens:String(Y.input_tokens),output_tokens:String(Y.output_tokens),cache_read_tokens:String(Y.cache_read_input_tokens),cache_creation_tokens:String(Y.cache_creation_input_tokens),cost_usd:String(X),duration_ms:String(x),speed:L?"fast":"normal"});let U,d,o;if(CE()&&Z){if(U=Z.flatMap((n)=>n.message.content.filter((t)=>t.type==="text").map((t)=>t.text)).join(`
|
|
4219
4219
|
`)||void 0,process.env.USER_TYPE==="ant")d=Z.flatMap((n)=>n.message.content.filter((t)=>t.type==="thinking").map((t)=>t.thinking)).join(`
|
|
4220
4220
|
`)||void 0;o=Z.some((n)=>n.message.content.some((t)=>t.type==="tool_use"))}Ye8(v,{success:!0,inputTokens:Y.input_tokens,outputTokens:Y.output_tokens,cacheReadTokens:Y.cache_read_input_tokens,cacheCreationTokens:Y.cache_creation_input_tokens,attempt:$,modelOutput:U,thinkingOutput:d,hasToolCall:o,ttftMs:z??void 0,requestSetupMs:N,attemptStartTimes:y});let K6=iu6();if(K6?.isTeleported&&!K6.hasLoggedFirstMessage)Q("tengu_teleport_first_message_success",{session_id:K6.sessionId}),ru6()}var c65,F65;var PS6=h(()=>{TM();v8();Y8();N8();C4();l8();iR();$Q();UE();S5q();x0();Su();c65={litellm:{prefixes:["x-litellm-"]},helicone:{prefixes:["helicone-"]},portkey:{prefixes:["x-portkey-"]},"cloudflare-ai-gateway":{prefixes:["cf-aig-"]},kong:{prefixes:["x-kong-"]},braintrust:{prefixes:["x-bt-"]}},F65={databricks:[".cloud.databricks.com",".azuredatabricks.net",".gcp.databricks.com"]}});function p$8(){return{consecutiveDenials:0,totalDenials:0}}function of_(q){return{...q,consecutiveDenials:q.consecutiveDenials+1,totalDenials:q.totalDenials+1}}function XS6(q){if(q.consecutiveDenials===0)return q;return{...q,consecutiveDenials:0}}function af_(q){return q.consecutiveDenials>=u$8.maxConsecutive||q.totalDenials>=u$8.maxTotal}var u$8;var b5q=h(()=>{u$8={maxConsecutive:3,maxTotal:20}});import{randomUUID as d65}from"crypto";function bf_(q){sf_=q}function fS6(){return sf_}function F0(q){return{systemPrompt:q.systemPrompt,userContext:q.userContext,systemContext:q.systemContext,toolUseContext:q.toolUseContext,forkContextMessages:q.messages}}function Q65(q,K){if(K.length===0)return q;return()=>{let _=q();return{..._,toolPermissionContext:{..._.toolPermissionContext,alwaysAllowRules:{..._.toolPermissionContext.alwaysAllowRules,command:[...new Set([..._.toolPermissionContext.alwaysAllowRules.command||[],...K])]}}}}}async function XA8(q,K,_){let z=(await q.getPromptForCommand(K,_)).map((M)=>M.type==="text"?M.text:"").join(`
|
|
4221
4221
|
`),Y=xS(q.allowedTools??[]),$=Q65(_.getAppState,Y),O=q.agent??"general-purpose",w=_.options.agentDefinitions.activeAgents,H=w.find((M)=>M.agentType===O)??w.find((M)=>M.agentType==="general-purpose")??w[0];if(!H)throw Error("No agent available for forked execution");let j=[C8({content:z})];return{skillContent:z,modifiedGetAppState:$,baseAgent:H,promptMessages:j}}function fA8(q,K="Execution completed"){let _=mj(q);if(!_)return K;return JA(_.message.content,`
|
|
@@ -5466,7 +5466,7 @@ Return the PR URL when you're done, so the user can see it.`}var $T_,L55,wT_;var
|
|
|
5466
5466
|
|
|
5467
5467
|
${Y}`;return[{type:"text",text:await zC(z,{...K,getAppState(){let O=K.getAppState();return{...O,toolPermissionContext:{...O.toolPermissionContext,alwaysAllowRules:{...O.toolPermissionContext.alwaysAllowRules,command:$T_}}}}},"/commit-push-pr")}]}},wT_=L55});var JT_={};h8(JT_,{call:()=>S55});async function E55(q,K,_,A){K.onCompactProgress?.({type:"hooks_start",hookType:"pre_compact"}),K.setSDKStatus?.("compacting");try{let[z,Y]=await Promise.all([zH6({trigger:"manual",customInstructions:_||null},K.abortController.signal),MT_(K,q)]),$=u5q(_,z.newCustomInstructions);K.setStreamMode?.("requesting"),K.setResponseLength?.(()=>0),K.onCompactProgress?.({type:"compact_start"});let O=await A.reactiveCompactOnPromptTooLong(q,Y,{customInstructions:$,trigger:"manual"});if(!O.ok)switch(O.reason){case"too_few_groups":throw Error(AH6);case"aborted":throw Error(xp);case"exhausted":case"error":case"media_unstrippable":throw Error(_H6)}rU(void 0),qL(),Y$6(),$O.cache.clear?.();let w=[z.userDisplayMessage,O.result.userDisplayMessage].filter(Boolean).join(`
|
|
5468
5468
|
`)||void 0;return{type:"compact",compactionResult:{...O.result,userDisplayMessage:w},displayText:m$q(K,w)}}finally{K.setStreamMode?.("requesting"),K.setResponseLength?.(()=>0),K.onCompactProgress?.({type:"compact_end"}),K.setSDKStatus?.(null)}}function m$q(q,K){let _=h36("tip"),A=K1("app:toggleTranscript","Global","ctrl+o"),z=[...q.options.verbose?[]:[`(${A} to see full summary)`],...K?[K]:[],..._?[_]:[]];return M8.dim("Compacted "+z.join(`
|
|
5469
|
-
`))}async function MT_(q,K){let _=q.getAppState(),A=await lj(q.options.tools,q.options.mainLoopModel,Array.from(_.toolPermissionContext.additionalWorkingDirectories.keys()),q.options.mcpClients),z=SN({mainThreadAgentDefinition:void 0,toolUseContext:q,customSystemPrompt:q.options.customSystemPrompt,defaultSystemPrompt:A,appendSystemPrompt:q.options.appendSystemPrompt}),[Y,$]=await Promise.all([$O(),$3()]);return{systemPrompt:z,userContext:Y,systemContext:$,toolUseContext:q,forkContextMessages:K}}var jT_=null,S55=async(q,K)=>{let{abortController:_}=K,{messages:A}=K;if(A=l3(A),A.length===0)throw Error("No messages to compact");let z=q.trim();try{if(!z){let w=await n$8(A,K.agentId);if(w)return $O.cache.clear?.(),qL(),EB(),Y$6(),{type:"compact",compactionResult:w,displayText:m$q(K)}}if(jT_?.isReactiveOnlyMode())return await E55(A,K,z,jT_);let $=(await lU(A,K)).messages,O=await V96($,K,await MT_(K,$),!1,z,!1);return rU(void 0),Y$6(),$O.cache.clear?.(),qL(),{type:"compact",compactionResult:O,displayText:m$q(K,O.userDisplayMessage)}}catch(Y){if(_.signal.aborted)throw Error("Compaction canceled.");else if(QB(Y,AH6))throw Error(AH6);else if(QB(Y,_H6))throw Error(_H6);else throw _6(Y),Error(`Error during compaction: ${Y}`)}};var PT_=h(()=>{jA();v8();pD();kZ();XE();QU();pp();ut6();gR();TS6();o$8();nU();T8();D$();N8();Vq();P_8();p16()});var C55,g$q;var XT_=h(()=>{I8();C55={type:"local",name:"compact",description:"Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]",isEnabled:()=>!p6(process.env.DISABLE_COMPACT),supportsNonInteractive:!0,argumentHint:"<optional custom summarization instructions>",load:()=>Promise.resolve().then(() => (PT_(),JT_))},g$q=C55});function FN(q){let K=x38.c(25),{title:_,color:A,defaultTab:z,children:Y,hidden:$,useFullWidth:O,selectedTab:w,onTabChange:H,banner:j,disableNavigation:M,initialHeaderFocused:J,contentHeight:P,navFromContent:X}=q,f=J===void 0?!0:J,W=X===void 0?!1:X,{columns:Z}=Eq(),v=Y.map(I55),k=z?v.findIndex((R6)=>z===R6[0]):0,N=w!==void 0,[y,L]=Kk.useState(k!==-1?k:0),S=N?v.findIndex((R6)=>R6[0]===w):-1,C=N?S!==-1?S:0:y,b=GaK(),[u,m]=Kk.useState(f),g;if(K[0]===Symbol.for("react.memo_cache_sentinel"))g=()=>m(!0),K[0]=g;else g=K[0];let B=g,x;if(K[1]===Symbol.for("react.memo_cache_sentinel"))x=()=>m(!1),K[1]=x;else x=K[1];let F=x,U=Kk.useRef(0),d;if(K[2]===Symbol.for("react.memo_cache_sentinel"))d=()=>{return U.current++,()=>{U.current--}},K[2]=d;else d=K[2];let o=d,K6=U.current>0,n=(R6)=>{let Z6=(C+v.length+R6)%v.length,D6=v[Z6]?.[0];if(N&&H&&D6)H(D6);else L(Z6);m(!0)},t=!$&&!M&&u,s;if(K[3]!==t)s={context:"Tabs",isActive:t},K[3]=t,K[4]=s;else s=K[4];CK({"tabs:next":()=>n(1),"tabs:previous":()=>n(-1)},s);let e;if(K[5]!==u||K[6]!==$)e=(R6)=>{if(!u||!U.current||$)return;if(R6.key==="down")R6.preventDefault(),m(!1)},K[5]=u,K[6]=$,K[8]=e;else e=K[8];let q6=e,f6=W&&!u&&K6&&!$&&!M,$6;if(K[9]!==f6)$6={context:"Tabs",isActive:f6},K[9]=f6,K[10]=$6;else $6=K[10];CK({"tabs:next":()=>{n(1),m(!0)},"tabs:previous":()=>{n(-1),m(!0)}},$6);let N6=_?wq(_)+1:0,H6=v.reduce(b55,0),J6=N6+H6,O6=O?Math.max(0,Z-J6):0,j6=O?Z:void 0,A6=I,w6="column",v6=0,C6=!0,n6=b?0:void 0,U6=!$&&HL.jsxDEV(I,{flexDirection:"row",gap:1,flexShrink:b?0:void 0,children:[_!==void 0&&HL.jsxDEV(T,{bold:!0,color:A,children:_},void 0,!1,void 0,this),v.map((R6,Z6)=>{let[D6,o6]=R6,s6=C===Z6,S6=A&&s6&&u;return HL.jsxDEV(T,{backgroundColor:S6?A:void 0,color:S6?"inverseText":void 0,inverse:s6&&!S6,bold:s6,children:[" ",o6," "]},D6,!0,void 0,this)}),O6>0&&HL.jsxDEV(T,{children:" ".repeat(O6)},void 0,!1,void 0,this)]},`${C}-${u?"focused":"blurred"}`,!0,void 0,this),d6;if(K[11]!==Y||K[12]!==P||K[13]!==j6||K[14]!==$||K[15]!==b||K[16]!==C)d6=b?HL.jsxDEV(I,{width:j6,marginTop:$?0:1,flexShrink:0,children:HL.jsxDEV(BH6,{ref:b,flexDirection:"column",flexShrink:0,children:Y},C,!1,void 0,this)},void 0,!1,void 0,this):HL.jsxDEV(I,{width:j6,marginTop:$?0:1,height:P,overflowY:P!==void 0?"hidden":void 0,children:Y},void 0,!1,void 0,this),K[11]=Y,K[12]=P,K[13]=j6,K[14]=$,K[15]=b,K[16]=C,K[17]=d6;else d6=K[17];let u6;if(K[18]!==A6||K[19]!==j||K[20]!==q6||K[21]!==n6||K[22]!==U6||K[23]!==d6)u6=HL.jsxDEV(A6,{flexDirection:w6,tabIndex:v6,autoFocus:C6,onKeyDown:q6,flexShrink:n6,children:[U6,j,d6]},void 0,!0,void 0,this),K[18]=A6,K[19]=j,K[20]=q6,K[21]=n6,K[22]=U6,K[23]=d6,K[24]=u6;else u6=K[24];return HL.jsxDEV(u38.Provider,{value:{selectedTab:v[C][0],width:j6,headerFocused:u,focusHeader:B,blurHeader:F,registerOptIn:o},children:u6},void 0,!1,void 0,this)}function b55(q,K){let[,_]=K;return q+(_?wq(_):0)+2+1}function I55(q){return[q.props.id??q.props.title,q.props.title]}function ZO(q){let K=x38.c(4),{title:_,id:A,children:z}=q,{selectedTab:Y,width:$}=Kk.useContext(u38),O=FZ();if(Y!==(A??_))return null;let w=O?0:void 0,H;if(K[0]!==z||K[1]!==w||K[2]!==$)H=HL.jsxDEV(I,{width:$,flexShrink:w,children:z},void 0,!1,void 0,this),K[0]=z,K[1]=w,K[2]=$,K[3]=H;else H=K[3];return H}function fT_(){let{width:q}=Kk.useContext(u38);return q}function VX(){let q=x38.c(6),{headerFocused:K,focusHeader:_,blurHeader:A,registerOptIn:z}=Kk.useContext(u38),Y;if(q[0]!==z)Y=[z],q[0]=z,q[1]=Y;else Y=q[1];Kk.useLayoutEffect(z,Y);let $;if(q[2]!==A||q[3]!==_||q[4]!==K)$={headerFocused:K,focusHeader:_,blurHeader:A},q[2]=A,q[3]=_,q[4]=K,q[5]=$;else $=q[5];return $}var x38,Kk,HL,u38;var UN=h(()=>{kE();A7();D38();l4();a6();TK();x38=p(A8(),1),Kk=p(_8(),1),HL=p(a(),1),u38=Kk.createContext({selectedTab:void 0,width:void 0,headerFocused:!1,focusHeader:()=>{},blurHeader:()=>{},registerOptIn:()=>()=>{}})});function x55(){let q=k8(),_=u2(q)??tH.jsxDEV(T,{dimColor:!0,children:"/rename to add a name"},void 0,!1,void 0,this);return[{label:"Version",value:"1.8.31"},{label:"Session name",value:_},{label:"Session ID",value:q},{label:"cwd",value:X8()},...j78(),...M78()]}function u55({mainLoopModel:q,mcp:K,theme:_,context:A}){return[{label:"Model",value:zq_(q)},...t8_(K.clients,A.options.ideInstallationStatus,_),...e8_(K.clients,_),...s8_(),...Kq_()]}async function WT_(){return[...await _q_(),...await Aq_(),...await qq_()]}function p55(q){let K=p38.c(8),{value:_}=q;if(Array.isArray(_)){let A;if(K[0]!==_){let Y;if(K[2]!==_.length)Y=($,O)=>tH.jsxDEV(T,{children:[$,O<_.length-1?",":""]},O,!0,void 0,this),K[2]=_.length,K[3]=Y;else Y=K[3];A=_.map(Y),K[0]=_,K[1]=A}else A=K[1];let z;if(K[4]!==A)z=tH.jsxDEV(I,{flexWrap:"wrap",columnGap:1,flexShrink:99,children:A},void 0,!1,void 0,this),K[4]=A,K[5]=z;else z=K[5];return z}if(typeof _==="string"){let A;if(K[6]!==_)A=tH.jsxDEV(T,{children:_},void 0,!1,void 0,this),K[6]=_,K[7]=A;else A=K[7];return A}return _}function ZT_(q){let K=p38.c(20),{context:_,diagnosticsPromise:A}=q,z=P8(c55),Y=P8(B55),[$]=hK(),O;if(K[0]===Symbol.for("react.memo_cache_sentinel"))O=x55(),K[0]=O;else O=K[0];let w;if(K[1]!==_||K[2]!==z||K[3]!==Y||K[4]!==$)w=u55({mainLoopModel:z,mcp:Y,theme:$,context:_}),K[1]=_,K[2]=z,K[3]=Y,K[4]=$,K[5]=w;else w=K[5];let H;if(K[6]!==w)H=[O,w],K[6]=w,K[7]=H;else H=K[7];let j=H,M=FZ()?1:void 0,J;if(K[8]!==j)J=j.map(m55),K[8]=j,K[9]=J;else J=K[9];let P;if(K[10]!==A)P=tH.jsxDEV(m38.Suspense,{fallback:null,children:tH.jsxDEV(F55,{promise:A},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[10]=A,K[11]=P;else P=K[11];let X;if(K[12]!==M||K[13]!==J||K[14]!==P)X=tH.jsxDEV(I,{flexDirection:"column",gap:1,flexGrow:M,children:[J,P]},void 0,!0,void 0,this),K[12]=M,K[13]=J,K[14]=P,K[15]=X;else X=K[15];let f;if(K[16]===Symbol.for("react.memo_cache_sentinel"))f=tH.jsxDEV(T,{dimColor:!0,children:tH.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[16]=f;else f=K[16];let W;if(K[17]!==M||K[18]!==X)W=tH.jsxDEV(I,{flexDirection:"column",flexGrow:M,children:[X,f]},void 0,!0,void 0,this),K[17]=M,K[18]=X,K[19]=W;else W=K[19];return W}function m55(q,K){return q.length>0&&tH.jsxDEV(I,{flexDirection:"column",children:q.map(g55)},K,!1,void 0,this)}function g55(q,K){let{label:_,value:A}=q;return tH.jsxDEV(I,{flexDirection:"row",gap:1,flexShrink:0,children:[_!==void 0&&tH.jsxDEV(T,{bold:!0,children:[_,":"]},void 0,!0,void 0,this),tH.jsxDEV(p55,{value:A},void 0,!1,void 0,this)]},K,!0,void 0,this)}function B55(q){return q.mcp}function c55(q){return q.mainLoopModel}function F55(q){let K=p38.c(5),{promise:_}=q,A=m38.use(_);if(A.length===0)return null;let z;if(K[0]===Symbol.for("react.memo_cache_sentinel"))z=tH.jsxDEV(T,{bold:!0,children:"System Diagnostics"},void 0,!1,void 0,this),K[0]=z;else z=K[0];let Y;if(K[1]!==A)Y=A.map(U55),K[1]=A,K[2]=Y;else Y=K[2];let $;if(K[3]!==Y)$=tH.jsxDEV(I,{flexDirection:"column",paddingBottom:1,children:[z,Y]},void 0,!0,void 0,this),K[3]=Y,K[4]=$;else $=K[4];return $}function U55(q,K){return tH.jsxDEV(I,{flexDirection:"row",gap:1,paddingX:1,children:[tH.jsxDEV(T,{color:"error",children:t6.warning},void 0,!1,void 0,this),typeof q==="string"?tH.jsxDEV(T,{wrap:"wrap",children:q},void 0,!1,void 0,this):q]},K,!0,void 0,this)}var p38,m38,tH;var GT_=h(()=>{__();v8();kE();a6();KK();$K();e_();ge8();k4();p38=p(A8(),1),m38=p(_8(),1),tH=p(a(),1)});function B$q(){return!1}async function vT_(){return!1}function c$q(){return!1}function DT_(){return!0}function kT_(){return null}var UH6=h(()=>{GK();I8()});function dH6(q){let K=TT_.c(59),{onThemeSelect:_,showIntroText:A,helpText:z,showHelpTextBelow:Y,hideEscToCancel:$,skipExitHandling:O,onCancel:w}=q,H=A===void 0?!1:A,j=z===void 0?"":z,M=Y===void 0?!1:Y,J=$===void 0?!1:$,P=O===void 0?!1:O,[X]=hK(),f=Xz6(),{columns:W}=Eq(),Z;if(K[0]===Symbol.for("react.memo_cache_sentinel"))Z=Yh6(),K[0]=Z;else Z=K[0];let v=Z,k;if(K[1]!==X)k=v===null?r3_(X):null,K[1]=X,K[2]=k;else k=K[2];let N=k,{setPreviewTheme:y,savePreview:L,cancelPreview:S}=nn6(),C=P8(Q55)??!1,b=PK();fq8("ThemePicker");let u=f4("theme:toggleSyntaxHighlighting","ThemePicker","ctrl+t"),m;if(K[3]!==b||K[4]!==C)m=()=>{if(v===null){let A6=!C;gq("userSettings",{syntaxHighlightingDisabled:A6}),b((w6)=>({...w6,settings:{...w6.settings,syntaxHighlightingDisabled:A6}}))}},K[3]=b,K[4]=C,K[5]=m;else m=K[5];let g;if(K[6]===Symbol.for("react.memo_cache_sentinel"))g={context:"ThemePicker"},K[6]=g;else g=K[6];Kq("theme:toggleSyntaxHighlighting",m,g);let B=x4(P?d55:void 0),x;if(K[7]===Symbol.for("react.memo_cache_sentinel"))x=[...[],{label:"Dark mode",value:"dark"},{label:"Light mode",value:"light"},{label:"Dark mode (colorblind-friendly)",value:"dark-daltonized"},{label:"Light mode (colorblind-friendly)",value:"light-daltonized"},{label:"Dark mode (ANSI colors only)",value:"dark-ansi"},{label:"Light mode (ANSI colors only)",value:"light-ansi"}],K[7]=x;else x=K[7];let F=x,U;if(K[8]!==H)U=H?xO.jsxDEV(T,{children:"Let's get started."},void 0,!1,void 0,this):xO.jsxDEV(T,{bold:!0,color:"permission",children:"Theme"},void 0,!1,void 0,this),K[8]=H,K[9]=U;else U=K[9];let d;if(K[10]===Symbol.for("react.memo_cache_sentinel"))d=xO.jsxDEV(T,{bold:!0,children:"Choose the text style that looks best with your terminal"},void 0,!1,void 0,this),K[10]=d;else d=K[10];let o;if(K[11]!==j||K[12]!==M)o=j&&!M&&xO.jsxDEV(T,{dimColor:!0,children:j},void 0,!1,void 0,this),K[11]=j,K[12]=M,K[13]=o;else o=K[13];let K6;if(K[14]!==o)K6=xO.jsxDEV(I,{flexDirection:"column",children:[d,o]},void 0,!0,void 0,this),K[14]=o,K[15]=K6;else K6=K[15];let n;if(K[16]!==y)n=(A6)=>{y(A6)},K[16]=y,K[17]=n;else n=K[17];let t;if(K[18]!==_||K[19]!==L)t=(A6)=>{L(),_(A6)},K[18]=_,K[19]=L,K[20]=t;else t=K[20];let s;if(K[21]!==S||K[22]!==w||K[23]!==P)s=P?()=>{S(),w?.()}:async()=>{S(),await U7(0)},K[21]=S,K[22]=w,K[23]=P,K[24]=s;else s=K[24];let e;if(K[25]!==n||K[26]!==t||K[27]!==s||K[28]!==f)e=xO.jsxDEV(r8,{options:F,onFocus:n,onChange:t,onCancel:s,visibleOptionCount:F.length,defaultValue:f,defaultFocusValue:f},void 0,!1,void 0,this),K[25]=n,K[26]=t,K[27]=s,K[28]=f,K[29]=e;else e=K[29];let q6;if(K[30]!==U||K[31]!==K6||K[32]!==e)q6=xO.jsxDEV(I,{flexDirection:"column",gap:1,children:[U,K6,e]},void 0,!0,void 0,this),K[30]=U,K[31]=K6,K[32]=e,K[33]=q6;else q6=K[33];let f6;if(K[34]===Symbol.for("react.memo_cache_sentinel"))f6={oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[" function greet() {",'- console.log("Hello, World!");','+ console.log("Hello, Puku CLI!");'," }"]},K[34]=f6;else f6=K[34];let $6;if(K[35]!==W)$6=xO.jsxDEV(I,{flexDirection:"column",borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:"dashed",borderColor:"subtle",children:xO.jsxDEV($C,{patch:f6,dim:!1,filePath:"demo.js",firstLine:null,width:W},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[35]=W,K[36]=$6;else $6=K[36];let N6=v==="env"?`Syntax highlighting disabled (via PUKU_CLI_SYNTAX_HIGHLIGHT=${process.env.PUKU_CLI_SYNTAX_HIGHLIGHT})`:C?`Syntax highlighting disabled (${u} to enable)`:N?`Syntax theme: ${N.theme}${N.source?` (from ${N.source})`:""} (${u} to disable)`:`Syntax highlighting enabled (${u} to disable)`,H6;if(K[37]!==N6)H6=xO.jsxDEV(T,{dimColor:!0,children:[" ",N6]},void 0,!0,void 0,this),K[37]=N6,K[38]=H6;else H6=K[38];let J6;if(K[39]!==$6||K[40]!==H6)J6=xO.jsxDEV(I,{flexDirection:"column",width:"100%",children:[$6,H6]},void 0,!0,void 0,this),K[39]=$6,K[40]=H6,K[41]=J6;else J6=K[41];let O6;if(K[42]!==q6||K[43]!==J6)O6=xO.jsxDEV(I,{flexDirection:"column",gap:1,children:[q6,J6]},void 0,!0,void 0,this),K[42]=q6,K[43]=J6,K[44]=O6;else O6=K[44];let j6=O6;if(!H){let A6;if(K[45]!==j6)A6=xO.jsxDEV(I,{flexDirection:"column",children:j6},void 0,!1,void 0,this),K[45]=j6,K[46]=A6;else A6=K[46];let w6;if(K[47]!==j||K[48]!==M)w6=M&&j&&xO.jsxDEV(I,{marginLeft:3,children:xO.jsxDEV(T,{dimColor:!0,children:j},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[47]=j,K[48]=M,K[49]=w6;else w6=K[49];let v6;if(K[50]!==B||K[51]!==J)v6=!J&&xO.jsxDEV(I,{children:xO.jsxDEV(T,{dimColor:!0,italic:!0,children:B.pending?xO.jsxDEV(xO.Fragment,{children:["Press ",B.keyName," again to exit"]},void 0,!0,void 0,this):xO.jsxDEV(fq,{children:[xO.jsxDEV(c8,{shortcut:"Enter",action:"select"},void 0,!1,void 0,this),xO.jsxDEV(c8,{shortcut:"Esc",action:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[50]=B,K[51]=J,K[52]=v6;else v6=K[52];let C6;if(K[53]!==w6||K[54]!==v6)C6=xO.jsxDEV(I,{marginTop:1,children:[w6,v6]},void 0,!0,void 0,this),K[53]=w6,K[54]=v6,K[55]=C6;else C6=K[55];let n6;if(K[56]!==A6||K[57]!==C6)n6=xO.jsxDEV(xO.Fragment,{children:[A6,C6]},void 0,!0,void 0,this),K[56]=A6,K[57]=C6,K[58]=n6;else n6=K[58];return n6}return j6}function d55(){}function Q55(q){return q.settings.syntaxHighlightingDisabled}var TT_,xO;var B38=h(()=>{c3();A7();a6();eu();TK();mH();KK();i$();Rq();Jz();S7();t7();Sz8();nw6();TT_=p(A8(),1),xO=p(a(),1)});function QH6(q){switch(q){case"low":return eCq;case"medium":return qbq;case"high":return a08;case"max":return Kbq;default:return a08}}var c38=h(()=>{az();oP()});function L86(q){let K=d$q.c(82),{initial:_,sessionModel:A,onSelect:z,onCancel:Y,isStandaloneCommand:$,showFastModeNotice:O,headerText:w,skipSettingsWrite:H}=q,j=PK(),M=x4(),J=_===null?U38:_,[P,X]=F38.useState(J),f=P8(n55),[W,Z]=F38.useState(!1),v=P8(r55),k;if(K[0]!==v)k=v!==void 0?xs(v):void 0,K[0]=v,K[1]=k;else k=K[1];let[N,y]=F38.useState(k),L=f??!1,S;if(K[2]!==L)S=wl(L),K[2]=L,K[3]=S;else S=K[3];let C=S,b;q:{if(_!==null&&!C.some((G6)=>G6.value===_)){let G6;if(K[4]!==_)G6=yf(_),K[4]=_,K[5]=G6;else G6=K[5];let W6;if(K[6]!==_||K[7]!==G6)W6={value:_,label:G6,description:"Current model"},K[6]=_,K[7]=G6,K[8]=W6;else W6=K[8];let L6;if(K[9]!==C||K[10]!==W6)L6=[...C,W6],K[9]=C,K[10]=W6,K[11]=L6;else L6=K[11];b=L6;break q}b=C}let u=b,m;if(K[12]!==u)m=u.map(i55),K[12]=u,K[13]=m;else m=K[13];let g=m,B;if(K[14]!==J||K[15]!==g)B=g.some((G6)=>G6.value===J)?J:g[0]?.value??void 0,K[14]=J,K[15]=g,K[16]=B;else B=K[16];let x=B,F=Math.min(10,g.length),U=Math.max(0,g.length-F),d;if(K[17]!==P||K[18]!==g)d=g.find((G6)=>G6.value===P)?.label,K[17]=P,K[18]=g,K[19]=d;else d=K[19];let o=d,K6,n;if(K[20]!==P){let G6=U$q(P);K6=G6?WZ(G6):!1,n=G6?xY6(G6):!1,K[20]=P,K[21]=K6,K[22]=n}else K6=K[21],n=K[22];let t=n,s;if(K[23]!==P)s=F$q(P),K[23]=P,K[24]=s;else s=K[24];let e=s,q6=N==="max"&&!t?"high":N,f6;if(K[25]!==v||K[26]!==W)f6=(G6)=>{if(X(G6),!W&&v===void 0)y(F$q(G6))},K[25]=v,K[26]=W,K[27]=f6;else f6=K[27];let $6=f6,N6;if(K[28]!==e||K[29]!==K6||K[30]!==t)N6=(G6)=>{if(!K6)return;y((W6)=>o55(W6??e,G6,t)),Z(!0)},K[28]=e,K[29]=K6,K[30]=t,K[31]=N6;else N6=K[31];let H6=N6,J6;if(K[32]!==H6)J6={"modelPicker:decreaseEffort":()=>H6("left"),"modelPicker:increaseEffort":()=>H6("right")},K[32]=H6,K[33]=J6;else J6=K[33];let O6;if(K[34]===Symbol.for("react.memo_cache_sentinel"))O6={context:"ModelPicker"},K[34]=O6;else O6=K[34];CK(J6,O6);let j6;if(K[35]!==N||K[36]!==W||K[37]!==z||K[38]!==j||K[39]!==H)j6=function(W6){if(Q("tengu_model_command_menu_effort",{effort:N}),!H){let T6=rCK(N,F$q(W6),jq("userSettings")?.effortLevel,W),l6=uU(T6);if(l6!==void 0)gq("userSettings",{effortLevel:l6});j((z8)=>({...z8,effortValue:T6}))}let L6=U$q(W6),I6=W&&L6&&WZ(L6)?N:void 0;if(W6===U38){z(null,I6);return}z(W6,I6)},K[35]=N,K[36]=W,K[37]=z,K[38]=j,K[39]=H,K[40]=j6;else j6=K[40];let A6=j6,w6;if(K[41]===Symbol.for("react.memo_cache_sentinel"))w6=fY.jsxDEV(T,{color:"remember",bold:!0,children:"Select model"},void 0,!1,void 0,this),K[41]=w6;else w6=K[41];let v6=w??"Switch between puku-ai models. Applies to this session and future puku-cli sessions. For other/previous model names, specify with --model.",C6;if(K[42]!==v6)C6=fY.jsxDEV(T,{dimColor:!0,children:v6},void 0,!1,void 0,this),K[42]=v6,K[43]=C6;else C6=K[43];let n6;if(K[44]!==A)n6=A&&fY.jsxDEV(T,{dimColor:!0,children:["Currently using ",yf(A)," for this session (set by plan mode). Selecting a model will undo this."]},void 0,!0,void 0,this),K[44]=A,K[45]=n6;else n6=K[45];let U6;if(K[46]!==C6||K[47]!==n6)U6=fY.jsxDEV(I,{marginBottom:1,flexDirection:"column",children:[w6,C6,n6]},void 0,!0,void 0,this),K[46]=C6,K[47]=n6,K[48]=U6;else U6=K[48];let d6=Y??l55,u6;if(K[49]!==$6||K[50]!==A6||K[51]!==x||K[52]!==J||K[53]!==g||K[54]!==d6||K[55]!==F)u6=fY.jsxDEV(I,{flexDirection:"column",children:fY.jsxDEV(r8,{defaultValue:J,defaultFocusValue:x,options:g,onChange:A6,onFocus:$6,onCancel:d6,visibleOptionCount:F},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[49]=$6,K[50]=A6,K[51]=x,K[52]=J,K[53]=g,K[54]=d6,K[55]=F,K[56]=u6;else u6=K[56];let R6;if(K[57]!==U)R6=U>0&&fY.jsxDEV(I,{paddingLeft:3,children:fY.jsxDEV(T,{dimColor:!0,children:["and ",U," more…"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[57]=U,K[58]=R6;else R6=K[58];let Z6;if(K[59]!==u6||K[60]!==R6)Z6=fY.jsxDEV(I,{flexDirection:"column",marginBottom:1,children:[u6,R6]},void 0,!0,void 0,this),K[59]=u6,K[60]=R6,K[61]=Z6;else Z6=K[61];let D6;if(K[62]!==q6||K[63]!==e||K[64]!==o||K[65]!==K6)D6=fY.jsxDEV(I,{marginBottom:1,flexDirection:"column",children:K6?fY.jsxDEV(T,{dimColor:!0,children:[fY.jsxDEV(NT_,{effort:q6},void 0,!1,void 0,this)," ",wp(q6)," effort",q6===e?" (default)":""," ",fY.jsxDEV(T,{color:"subtle",children:"← → to adjust"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):fY.jsxDEV(T,{color:"subtle",children:[fY.jsxDEV(NT_,{effort:void 0},void 0,!1,void 0,this)," Effort not supported",o?` for ${o}`:""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[62]=q6,K[63]=e,K[64]=o,K[65]=K6,K[66]=D6;else D6=K[66];let o6;if(K[67]!==O)o6=x7()?O?fY.jsxDEV(I,{marginBottom:1,children:fY.jsxDEV(T,{dimColor:!0,children:["Fast mode is ",fY.jsxDEV(T,{bold:!0,children:"ON"},void 0,!1,void 0,this)," and available with"," ",YR," only (/fast). Switching to other models turn off fast mode."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):b1()&&!wS()?fY.jsxDEV(I,{marginBottom:1,children:fY.jsxDEV(T,{dimColor:!0,children:["Use ",fY.jsxDEV(T,{bold:!0,children:"/fast"},void 0,!1,void 0,this)," to turn on Fast mode (",YR," only)."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null:null,K[67]=O,K[68]=o6;else o6=K[68];let s6;if(K[69]!==U6||K[70]!==Z6||K[71]!==D6||K[72]!==o6)s6=fY.jsxDEV(I,{flexDirection:"column",children:[U6,Z6,D6,o6]},void 0,!0,void 0,this),K[69]=U6,K[70]=Z6,K[71]=D6,K[72]=o6,K[73]=s6;else s6=K[73];let S6;if(K[74]!==M||K[75]!==$)S6=$&&fY.jsxDEV(T,{dimColor:!0,italic:!0,children:M.pending?fY.jsxDEV(fY.Fragment,{children:["Press ",M.keyName," again to exit"]},void 0,!0,void 0,this):fY.jsxDEV(fq,{children:[fY.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),fY.jsxDEV(qq,{action:"select:cancel",context:"Select",fallback:"Esc",description:"exit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[74]=M,K[75]=$,K[76]=S6;else S6=K[76];let y6;if(K[77]!==s6||K[78]!==S6)y6=fY.jsxDEV(I,{flexDirection:"column",children:[s6,S6]},void 0,!0,void 0,this),K[77]=s6,K[78]=S6,K[79]=y6;else y6=K[79];let F6=y6;if(!$)return F6;let k6;if(K[80]!==F6)k6=fY.jsxDEV(Mz,{color:"permission",children:F6},void 0,!1,void 0,this),K[80]=F6,K[81]=k6;else k6=K[81];return k6}function l55(){}function i55(q){return{...q,value:q.value===null?U38:q.value}}function r55(q){return q.effortValue}function n55(q){return x7()?q.fastMode:!1}function U$q(q){if(!q)return;return q===U38?$2():s7(q)}function NT_(q){let K=d$q.c(5),{effort:_}=q,A=_?"puku":"subtle",z=_??"low",Y;if(K[0]!==z)Y=QH6(z),K[0]=z,K[1]=Y;else Y=K[1];let $;if(K[2]!==A||K[3]!==Y)$=fY.jsxDEV(T,{color:A,children:Y},void 0,!1,void 0,this),K[2]=A,K[3]=Y,K[4]=$;else $=K[4];return $}function o55(q,K,_){let A=_?["low","medium","high","max"]:["low","medium","high"],z=A.indexOf(q),Y=z!==-1?z:A.indexOf("high");if(K==="right")return A[(Y+1)%A.length];else return A[(Y-1+A.length)%A.length]}function F$q(q){let K=U$q(q)??$2(),_=oT6(K);return _!==void 0?xs(_):"high"}var d$q,F38,fY,U38="__NO_PREFERENCE__";var d38=h(()=>{ay6();c3();Y2();a6();TK();KK();oP();Y_();dh6();Rq();k4();Jz();S7();t7();qJ();c38();d$q=p(A8(),1),F38=p(_8(),1),fY=p(a(),1)});function h86(q,K,_){if(!BK())return!1;if(K)return!0;if(q===null||!iv(q))return!1;let A=q.toLowerCase().replace(/\[1m\]$/,"").trim(),z=A==="opus"||A.includes("opus-4-6"),Y=A==="sonnet"||A.includes("sonnet-4-6");if(z&&_)return!1;return z||Y}var Q38=h(()=>{GK();Vj()});var VT_={};h8(VT_,{PukuMdExternalIncludesDialog:()=>Q$q});function Q$q(q){let K=yT_.c(18),{onDone:_,isStandaloneDialog:A,externalIncludes:z}=q,Y;if(K[0]===Symbol.for("react.memo_cache_sentinel"))Y=[],K[0]=Y;else Y=K[0];RT_.default.useEffect(e55,Y);let $;if(K[1]!==_)$=(v)=>{if(v==="no")Q("tengu_claude_md_external_includes_dialog_declined",{}),K3(t55);else Q("tengu_claude_md_external_includes_dialog_accepted",{}),K3(s55);_()},K[1]=_,K[2]=$;else $=K[2];let O=$,w;if(K[3]!==O)w=()=>{O("no")},K[3]=O,K[4]=w;else w=K[4];let H=w,j=!A,M=!A,J;if(K[5]===Symbol.for("react.memo_cache_sentinel"))J=Cm.jsxDEV(T,{children:"This project's CLAUDE.md imports files outside the current working directory. Never allow this for third-party repositories."},void 0,!1,void 0,this),K[5]=J;else J=K[5];let P;if(K[6]!==z)P=z&&z.length>0&&Cm.jsxDEV(I,{flexDirection:"column",children:[Cm.jsxDEV(T,{dimColor:!0,children:"External imports:"},void 0,!1,void 0,this),z.map(a55)]},void 0,!0,void 0,this),K[6]=z,K[7]=P;else P=K[7];let X;if(K[8]===Symbol.for("react.memo_cache_sentinel"))X=Cm.jsxDEV(T,{dimColor:!0,children:["Important: Only use Puku with files you trust. Accessing untrusted files may pose security risks"," ",Cm.jsxDEV(nK,{url:"https://puku.sh/docs/en/security"},void 0,!1,void 0,this)," "]},void 0,!0,void 0,this),K[8]=X;else X=K[8];let f;if(K[9]===Symbol.for("react.memo_cache_sentinel"))f=[{label:"Yes, allow external imports",value:"yes"},{label:"No, disable external imports",value:"no"}],K[9]=f;else f=K[9];let W;if(K[10]!==O)W=Cm.jsxDEV(r8,{options:f,onChange:(v)=>O(v)},void 0,!1,void 0,this),K[10]=O,K[11]=W;else W=K[11];let Z;if(K[12]!==H||K[13]!==W||K[14]!==j||K[15]!==M||K[16]!==P)Z=Cm.jsxDEV(Pq,{title:"Allow external CLAUDE.md file imports?",color:"warning",onCancel:H,hideBorder:j,hideInputGuide:M,children:[J,P,X,W]},void 0,!0,void 0,this),K[12]=H,K[13]=W,K[14]=j,K[15]=M,K[16]=P,K[17]=Z;else Z=K[17];return Z}function a55(q,K){return Cm.jsxDEV(T,{dimColor:!0,children:[" ",q.path]},K,!0,void 0,this)}function s55(q){return{...q,hasClaudeMdExternalIncludesApproved:!0,hasClaudeMdExternalIncludesWarningShown:!0}}function t55(q){return{...q,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!0}}function e55(){Q("tengu_claude_md_includes_dialog_shown",{})}var yT_,RT_,Cm;var l$q=h(()=>{a6();Tq();Jz();J7();yT_=p(A8(),1),RT_=p(_8(),1),Cm=p(a(),1)});function hT_(q){let K=LT_.c(17),{currentVersion:_,onChoice:A}=q,z;if(K[0]!==A)z=function(W){A(W)},K[0]=A,K[1]=z;else z=K[1];let Y=z,$;if(K[2]!==A)$=function(){A("cancel")},K[2]=A,K[3]=$;else $=K[3];let O=$,w;if(K[4]!==_)w=PE6.jsxDEV(T,{children:["The stable channel may have an older version than what you're currently running (",_,")."]},void 0,!0,void 0,this),K[4]=_,K[5]=w;else w=K[5];let H;if(K[6]===Symbol.for("react.memo_cache_sentinel"))H=PE6.jsxDEV(T,{dimColor:!0,children:"How would you like to handle this?"},void 0,!1,void 0,this),K[6]=H;else H=K[6];let j;if(K[7]===Symbol.for("react.memo_cache_sentinel"))j={label:"Allow possible downgrade to stable version",value:"downgrade"},K[7]=j;else j=K[7];let M=`Stay on current version (${_}) until stable catches up`,J;if(K[8]!==M)J=[j,{label:M,value:"stay"}],K[8]=M,K[9]=J;else J=K[9];let P;if(K[10]!==Y||K[11]!==J)P=PE6.jsxDEV(r8,{options:J,onChange:Y},void 0,!1,void 0,this),K[10]=Y,K[11]=J,K[12]=P;else P=K[12];let X;if(K[13]!==O||K[14]!==w||K[15]!==P)X=PE6.jsxDEV(Pq,{title:"Switch to Stable Channel",onCancel:O,color:"permission",hideBorder:!0,hideInputGuide:!0,children:[w,H,P]},void 0,!0,void 0,this),K[13]=O,K[14]=w,K[15]=P,K[16]=X;else X=K[16];return X}var LT_,PE6;var ST_=h(()=>{a6();Jz();J7();LT_=p(A8(),1),PE6=p(a(),1)});function ET_(q){return Object.entries(q).map(([K,_])=>({label:_?.name??qz5,value:K,description:_?.description??Kz5}))}function bT_(q){let K=CT_.c(16),{initialStyle:_,onComplete:A,onCancel:z,isStandaloneCommand:Y}=q,$;if(K[0]===Symbol.for("react.memo_cache_sentinel"))$=[],K[0]=$;else $=K[0];let[O,w]=XE6.useState($),[H,j]=XE6.useState(!0),M,J;if(K[1]===Symbol.for("react.memo_cache_sentinel"))M=()=>{TH6(X8()).then((N)=>{let y=ET_(N);w(y),j(!1)}).catch(()=>{let N=ET_(Et);w(N),j(!1)})},J=[],K[1]=M,K[2]=J;else M=K[1],J=K[2];XE6.useEffect(M,J);let P;if(K[3]!==A)P=(N)=>{A(N)},K[3]=A,K[4]=P;else P=K[4];let X=P,f=!Y,W=!Y,Z;if(K[5]===Symbol.for("react.memo_cache_sentinel"))Z=S86.jsxDEV(I,{marginTop:1,children:S86.jsxDEV(T,{dimColor:!0,children:"This changes how Puku communicates with you"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[5]=Z;else Z=K[5];let v;if(K[6]!==X||K[7]!==_||K[8]!==H||K[9]!==O)v=S86.jsxDEV(I,{flexDirection:"column",gap:1,children:[Z,H?S86.jsxDEV(T,{dimColor:!0,children:"Loading output styles…"},void 0,!1,void 0,this):S86.jsxDEV(r8,{options:O,onChange:X,visibleOptionCount:10,defaultValue:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[6]=X,K[7]=_,K[8]=H,K[9]=O,K[10]=v;else v=K[10];let k;if(K[11]!==z||K[12]!==f||K[13]!==W||K[14]!==v)k=S86.jsxDEV(Pq,{title:"Preferred output style",onCancel:z,hideInputGuide:f,hideBorder:W,children:v},void 0,!1,void 0,this),K[11]=z,K[12]=f,K[13]=W,K[14]=v,K[15]=k;else k=K[15];return k}var CT_,XE6,S86,qz5="Default",Kz5="Claude completes coding tasks efficiently and provides concise responses";var IT_=h(()=>{$E();a6();$K();_A();J7();CT_=p(A8(),1),XE6=p(_8(),1),S86=p(a(),1)});function uT_(q){let K=xT_.c(13),{initialLanguage:_,onComplete:A,onCancel:z}=q,[Y,$]=i$q.useState(_),[O,w]=i$q.useState((_??"").length),H;if(K[0]===Symbol.for("react.memo_cache_sentinel"))H={context:"Settings"},K[0]=H;else H=K[0];Kq("confirm:no",z,H);let j;if(K[1]!==Y||K[2]!==A)j=function(){let k=Y?.trim();A(k||void 0)},K[1]=Y,K[2]=A,K[3]=j;else j=K[3];let M=j,J;if(K[4]===Symbol.for("react.memo_cache_sentinel"))J=E86.jsxDEV(T,{children:"Enter your preferred response and voice language:"},void 0,!1,void 0,this),K[4]=J;else J=K[4];let P;if(K[5]===Symbol.for("react.memo_cache_sentinel"))P=E86.jsxDEV(T,{children:t6.pointer},void 0,!1,void 0,this),K[5]=P;else P=K[5];let X=Y??"",f;if(K[6]!==O||K[7]!==M||K[8]!==X)f=E86.jsxDEV(I,{flexDirection:"row",gap:1,children:[P,E86.jsxDEV(q5,{value:X,onChange:$,onSubmit:M,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${t6.ellipsis}`,columns:60,cursorOffset:O,onChangeCursorOffset:w},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[6]=O,K[7]=M,K[8]=X,K[9]=f;else f=K[9];let W;if(K[10]===Symbol.for("react.memo_cache_sentinel"))W=E86.jsxDEV(T,{dimColor:!0,children:"Leave empty for default (English)"},void 0,!1,void 0,this),K[10]=W;else W=K[10];let Z;if(K[11]!==f)Z=E86.jsxDEV(I,{flexDirection:"column",gap:1,children:[J,f,W]},void 0,!0,void 0,this),K[11]=f,K[12]=Z;else Z=K[12];return Z}var xT_,i$q,E86;var pT_=h(()=>{__();a6();TK();U1();xT_=p(A8(),1),i$q=p(_8(),1),E86=p(a(),1)});function jL(q){let K=mT_.c(17),{query:_,placeholder:A,isFocused:z,isTerminalFocused:Y,prefix:$,width:O,cursorOffset:w,borderless:H}=q,j=A===void 0?"Search…":A,M=$===void 0?"⌕":$,J=H===void 0?!1:H,P=w??_.length,X=J?void 0:"round",f=z?"suggestion":void 0,W=!z,Z=J?0:1,v=!z,k;if(K[0]!==z||K[1]!==Y||K[2]!==P||K[3]!==j||K[4]!==_)k=z?KM.jsxDEV(KM.Fragment,{children:_?Y?KM.jsxDEV(KM.Fragment,{children:[KM.jsxDEV(T,{children:_.slice(0,P)},void 0,!1,void 0,this),KM.jsxDEV(T,{inverse:!0,children:P<_.length?_[P]:" "},void 0,!1,void 0,this),P<_.length&&KM.jsxDEV(T,{children:_.slice(P+1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):KM.jsxDEV(T,{children:_},void 0,!1,void 0,this):Y?KM.jsxDEV(KM.Fragment,{children:[KM.jsxDEV(T,{inverse:!0,children:j.charAt(0)},void 0,!1,void 0,this),KM.jsxDEV(T,{dimColor:!0,children:j.slice(1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):KM.jsxDEV(T,{dimColor:!0,children:j},void 0,!1,void 0,this)},void 0,!1,void 0,this):_?KM.jsxDEV(T,{children:_},void 0,!1,void 0,this):KM.jsxDEV(T,{children:j},void 0,!1,void 0,this),K[0]=z,K[1]=Y,K[2]=P,K[3]=j,K[4]=_,K[5]=k;else k=K[5];let N;if(K[6]!==M||K[7]!==v||K[8]!==k)N=KM.jsxDEV(T,{dimColor:v,children:[M," ",k]},void 0,!0,void 0,this),K[6]=M,K[7]=v,K[8]=k,K[9]=N;else N=K[9];let y;if(K[10]!==N||K[11]!==X||K[12]!==f||K[13]!==W||K[14]!==Z||K[15]!==O)y=KM.jsxDEV(I,{flexShrink:0,borderStyle:X,borderColor:f,borderDimColor:W,paddingX:Z,width:O,children:N},void 0,!1,void 0,this),K[10]=N,K[11]=X,K[12]=f,K[13]=W,K[14]=Z,K[15]=O,K[16]=y;else y=K[16];return y}var mT_,KM;var C86=h(()=>{a6();mT_=p(A8(),1),KM=p(a(),1)});function _z5(q){if(q.ctrl&&(q.key==="k"||q.key==="u"||q.key==="w"))return!0;if(q.meta&&q.key==="backspace")return!0;return!1}function Az5(q){return(q.ctrl||q.meta)&&q.key==="y"}function _k({isActive:q,onExit:K,onCancel:_,onExitUp:A,columns:z,passthroughCtrlKeys:Y=[],initialQuery:$="",backspaceExitsOnEmpty:O=!0}){let{columns:w}=Eq(),H=z??w,[j,M]=fE6.useState($),[J,P]=fE6.useState($.length),X=fE6.useCallback((W)=>{M(W),P(W.length)},[]),f=(W)=>{if(!q)return;let Z=$4.fromText(j,H,J);if(W.ctrl&&Y.includes(W.key.toLowerCase()))return;if(!_z5(W))AE6();if(!Az5(W))zE6();if(W.key==="return"||W.key==="down"){W.preventDefault(),K();return}if(W.key==="up"){if(W.preventDefault(),A)A();return}if(W.key==="escape"){if(W.preventDefault(),_)_();else if(j.length>0)M(""),P(0);else K();return}if(W.key==="backspace"){if(W.preventDefault(),W.meta){let{cursor:k,killed:N}=Z.deleteWordBefore();Lm(N,"prepend"),M(k.text),P(k.offset);return}if(j.length===0){if(O)(_??K)();return}let v=Z.backspace();M(v.text),P(v.offset);return}if(W.key==="delete"){W.preventDefault();let v=Z.del();M(v.text),P(v.offset);return}if(W.key==="left"&&(W.ctrl||W.meta||W.fn)){W.preventDefault();let v=Z.prevWord();P(v.offset);return}if(W.key==="right"&&(W.ctrl||W.meta||W.fn)){W.preventDefault();let v=Z.nextWord();P(v.offset);return}if(W.key==="left"){W.preventDefault();let v=Z.left();P(v.offset);return}if(W.key==="right"){W.preventDefault();let v=Z.right();P(v.offset);return}if(W.key==="home"){W.preventDefault(),P(0);return}if(W.key==="end"){W.preventDefault(),P(j.length);return}if(W.ctrl){switch(W.preventDefault(),W.key.toLowerCase()){case"a":P(0);return;case"e":P(j.length);return;case"b":P(Z.left().offset);return;case"f":P(Z.right().offset);return;case"d":{if(j.length===0){(_??K)();return}let v=Z.del();M(v.text),P(v.offset);return}case"h":{if(j.length===0){if(O)(_??K)();return}let v=Z.backspace();M(v.text),P(v.offset);return}case"k":{let{cursor:v,killed:k}=Z.deleteToLineEnd();Lm(k,"append"),M(v.text),P(v.offset);return}case"u":{let{cursor:v,killed:k}=Z.deleteToLineStart();Lm(k,"prepend"),M(v.text),P(v.offset);return}case"w":{let{cursor:v,killed:k}=Z.deleteWordBefore();Lm(k,"prepend"),M(v.text),P(v.offset);return}case"y":{let v=w38();if(v.length>0){let k=Z.offset,N=Z.insert(v);H38(k,v.length),M(N.text),P(N.offset)}return}case"g":case"c":if(_){_();return}}return}if(W.meta){switch(W.preventDefault(),W.key.toLowerCase()){case"b":P(Z.prevWord().offset);return;case"f":P(Z.nextWord().offset);return;case"d":{let v=Z.deleteWordAfter();M(v.text),P(v.offset);return}case"y":{let v=j38();if(v){let{text:k,start:N,length:y}=v,L=j.slice(0,N),S=j.slice(N+y),C=L+k+S,b=N+k.length;M38(k.length),M(C),P(b)}return}}return}if(W.key==="tab")return;if(W.key.length>=1&&!zz5.has(W.key)){W.preventDefault();let v=Z.insert(W.key);M(v.text),P(v.offset)}};return D_((W,Z,v)=>{f(new RR(v.keypress))},{isActive:q}),{query:j,setQuery:X,cursorOffset:J,handleKeyDown:f}}var fE6,zz5;var Il=h(()=>{Qz6();a6();N86();A7();fE6=p(_8(),1);zz5=new Set(["pageup","pagedown","insert","wheelup","wheeldown","mouse","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12"])});function cT_({onClose:q,context:K,setTabsHidden:_,onIsSearchModeChange:A,contentHeight:z}){let{headerFocused:Y,focusHeader:$,blurHeader:O}=VX(),w=FZ(),[,H]=hK(),j=Xz6(),[M,J]=G1.useState(j8()),P=e2.useRef(j8()),[X,f]=G1.useState(XK()),W=e2.useRef(XK()),[Z,v]=G1.useState(X?.outputStyle||nf),k=e2.useRef(Z),[N,y]=G1.useState(X?.language),L=e2.useRef(N),[S,C]=G1.useState(0),[b,u]=G1.useState(0),[m,g]=G1.useState(!0),B=z3(),{rows:x}=Eq(),F=z??Math.min(Math.floor(x*0.8),30),U=Math.max(5,F-10),d=P8((P6)=>P6.mainLoopModel),o=P8((P6)=>P6.verbose),K6=P8((P6)=>P6.thinkingEnabled),n=P8((P6)=>x7()?P6.fastMode:!1),t=P8((P6)=>P6.promptSuggestionEnabled),s=rO8()||qE6()==="enabled",e=!1,q6=PK(),[f6,$6]=G1.useState({}),N6=e2.useRef(K6),[H6]=G1.useState(()=>jq("localSettings")),[J6]=G1.useState(()=>jq("userSettings")),O6=e2.useRef(j),j6=Lz(),[A6]=G1.useState(()=>{let P6=j6.getState();return{mainLoopModel:P6.mainLoopModel,mainLoopModelForSession:P6.mainLoopModelForSession,verbose:P6.verbose,thinkingEnabled:P6.thinkingEnabled,fastMode:P6.fastMode,promptSuggestionEnabled:P6.promptSuggestionEnabled,isBriefOnly:P6.isBriefOnly,replBridgeEnabled:P6.replBridgeEnabled,replBridgeOutboundOnly:P6.replBridgeOutboundOnly,settings:P6.settings}}),[w6]=G1.useState(()=>cu6()),v6=e2.useRef(!1),[C6,n6]=G1.useState(!1),[U6,d6]=G1.useState(null),{query:u6,setQuery:R6,cursorOffset:Z6}=_k({isActive:m&&U6===null&&!Y,onExit:()=>g(!1),onExitUp:$,passthroughCtrlKeys:["c","d"]}),D6=m&&!Y;e2.useEffect(()=>{A?.(D6)},[D6,A]);let o6=GK8(K.options.mcpClients),s6=!p6(process.env.PUKU_CLI_DISABLE_FILE_CHECKPOINTING),S6=e2.use(aw(!0)),y6=Yi8(S6),F6=wo();function k6(P6){Q("tengu_config_model_changed",{from_model:d,to_model:P6}),q6((O8)=>({...O8,mainLoopModel:P6,mainLoopModelForSession:null})),$6((O8)=>{let G8=yf(P6)+(h86(P6,!1,lv())?" · Billed as extra usage":"");if("model"in O8){let{model:i8,...e8}=O8;return{...e8,model:G8}}return{...O8,model:G8}})}function G6(P6){g8((m6)=>({...m6,verbose:P6})),J({...j8(),verbose:P6}),q6((m6)=>({...m6,verbose:P6})),$6((m6)=>{if("verbose"in m6){let{verbose:O8,...G8}=m6;return G8}return{...m6,verbose:P6}})}let W6=[{id:"autoCompactEnabled",label:"Auto-compact",value:M.autoCompactEnabled,type:"boolean",onChange(P6){g8((m6)=>({...m6,autoCompactEnabled:P6})),J({...j8(),autoCompactEnabled:P6}),Q("tengu_auto_compact_setting_changed",{enabled:P6})}},{id:"spinnerTipsEnabled",label:"Show tips",value:X?.spinnerTipsEnabled??!0,type:"boolean",onChange(P6){gq("localSettings",{spinnerTipsEnabled:P6}),f((m6)=>({...m6,spinnerTipsEnabled:P6})),Q("tengu_tips_setting_changed",{enabled:P6})}},{id:"prefersReducedMotion",label:"Reduce motion",value:X?.prefersReducedMotion??!1,type:"boolean",onChange(P6){gq("localSettings",{prefersReducedMotion:P6}),f((m6)=>({...m6,prefersReducedMotion:P6})),q6((m6)=>({...m6,settings:{...m6.settings,prefersReducedMotion:P6}})),Q("tengu_reduce_motion_setting_changed",{enabled:P6})}},{id:"thinkingEnabled",label:"Thinking mode",value:K6??!0,type:"boolean",onChange(P6){q6((m6)=>({...m6,thinkingEnabled:P6})),gq("userSettings",{alwaysThinkingEnabled:P6?void 0:!1}),Q("tengu_thinking_toggled",{enabled:P6})}},...x7()&&b1()?[{id:"fastMode",label:`Fast mode (${YR} only)`,value:!!n,type:"boolean",onChange(P6){if(Na(),gq("userSettings",{fastMode:P6?!0:void 0}),P6)q6((m6)=>({...m6,mainLoopModel:mv6(),mainLoopModelForSession:null,fastMode:!0})),$6((m6)=>({...m6,model:mv6(),"Fast mode":"ON"}));else q6((m6)=>({...m6,fastMode:!1})),$6((m6)=>({...m6,"Fast mode":"OFF"}))}}]:[],..._q("tengu_chomp_inflection",!1)?[{id:"promptSuggestionEnabled",label:"Prompt suggestions",value:t,type:"boolean",onChange(P6){q6((m6)=>({...m6,promptSuggestionEnabled:P6})),gq("userSettings",{promptSuggestionEnabled:P6?void 0:!1})}}]:[],...[],...s6?[{id:"fileCheckpointingEnabled",label:"Rewind code (checkpoints)",value:M.fileCheckpointingEnabled,type:"boolean",onChange(P6){g8((m6)=>({...m6,fileCheckpointingEnabled:P6})),J({...j8(),fileCheckpointingEnabled:P6}),Q("tengu_file_history_snapshots_setting_changed",{enabled:P6})}}]:[],{id:"verbose",label:"Verbose output",value:o,type:"boolean",onChange:G6},{id:"terminalProgressBarEnabled",label:"Terminal progress bar",value:M.terminalProgressBarEnabled,type:"boolean",onChange(P6){g8((m6)=>({...m6,terminalProgressBarEnabled:P6})),J({...j8(),terminalProgressBarEnabled:P6}),Q("tengu_terminal_progress_bar_setting_changed",{enabled:P6})}},..._q("tengu_terminal_sidebar",!1)?[{id:"showStatusInTerminalTab",label:"Show status in terminal tab",value:M.showStatusInTerminalTab??!1,type:"boolean",onChange(P6){g8((m6)=>({...m6,showStatusInTerminalTab:P6})),J({...j8(),showStatusInTerminalTab:P6}),Q("tengu_terminal_tab_status_setting_changed",{enabled:P6})}}]:[],{id:"showTurnDuration",label:"Show turn duration",value:M.showTurnDuration,type:"boolean",onChange(P6){g8((m6)=>({...m6,showTurnDuration:P6})),J({...j8(),showTurnDuration:P6}),Q("tengu_show_turn_duration_setting_changed",{enabled:P6})}},{id:"defaultPermissionMode",label:"Default permission mode",value:X?.permissions?.defaultMode||"default",options:(()=>{let P6=["default","plan"],m6=Mf,O8=["bypassPermissions"];if(!s)O8.push("auto");return[...P6,...m6.filter((G8)=>!P6.includes(G8)&&!O8.includes(G8))]})(),type:"enum",onChange(P6){let m6=Dv(P6),O8=jbq(m6)?my(m6):m6,G8=gq("userSettings",{permissions:{...X?.permissions,defaultMode:O8}});if(G8.error){_6(G8.error);return}f((i8)=>({...i8,permissions:{...i8?.permissions,defaultMode:O8}})),$6((i8)=>({...i8,defaultPermissionMode:P6})),Q("tengu_config_changed",{setting:"defaultPermissionMode",value:P6})}},...s?[{id:"useAutoModeDuringPlan",label:"Use auto mode during plan",value:X?.useAutoModeDuringPlan??!0,type:"boolean",onChange(P6){gq("userSettings",{useAutoModeDuringPlan:P6}),f((m6)=>({...m6,useAutoModeDuringPlan:P6})),q6((m6)=>{let O8=SH6(m6.toolPermissionContext);if(O8===m6.toolPermissionContext)return m6;return{...m6,toolPermissionContext:O8}}),$6((m6)=>({...m6,"Use auto mode during plan":P6}))}}]:[],{id:"respectGitignore",label:"Respect .gitignore in file picker",value:M.respectGitignore,type:"boolean",onChange(P6){g8((m6)=>({...m6,respectGitignore:P6})),J({...j8(),respectGitignore:P6}),Q("tengu_respect_gitignore_setting_changed",{enabled:P6})}},{id:"copyFullResponse",label:"Always copy full response (skip /copy picker)",value:M.copyFullResponse,type:"boolean",onChange(P6){g8((m6)=>({...m6,copyFullResponse:P6})),J({...j8(),copyFullResponse:P6}),Q("tengu_config_changed",{setting:"copyFullResponse",value:String(P6)})}},...s_()?[{id:"copyOnSelect",label:"Copy on select",value:M.copyOnSelect??!0,type:"boolean",onChange(P6){g8((m6)=>({...m6,copyOnSelect:P6})),J({...j8(),copyOnSelect:P6}),Q("tengu_config_changed",{setting:"copyOnSelect",value:String(P6)})}}]:[],{id:"flickerFreeMode",label:"Flicker-free mode",value:M.flickerFreeMode??process.env.USER_TYPE==="ant",type:"boolean",onChange(P6){g8((m6)=>({...m6,flickerFreeMode:P6})),J({...j8(),flickerFreeMode:P6}),Q("tengu_config_changed",{setting:"flickerFreeMode",value:String(P6)})}},F6?{id:"autoUpdatesChannel",label:"Auto-update channel",value:"disabled",type:"managedEnum",onChange(){}}:{id:"autoUpdatesChannel",label:"Auto-update channel",value:X?.autoUpdatesChannel??"latest",type:"managedEnum",onChange(){}},{id:"theme",label:"Theme",value:j,type:"managedEnum",onChange:H},{id:"notifChannel",label:"Notifications",value:M.preferredNotifChannel,options:["auto","iterm2","terminal_bell","iterm2_with_bell","kitty","ghostty","notifications_disabled"],type:"enum",onChange(P6){g8((m6)=>({...m6,preferredNotifChannel:P6})),J({...j8(),preferredNotifChannel:P6})}},...[],{id:"outputStyle",label:"Output style",value:Z,type:"managedEnum",onChange:()=>{}},...[],{id:"language",label:"Language",value:N??"Default (English)",type:"managedEnum",onChange:()=>{}},{id:"editorMode",label:"Editor mode",value:M.editorMode==="emacs"?"normal":M.editorMode||"normal",options:["normal","vim"],type:"enum",onChange(P6){g8((m6)=>({...m6,editorMode:P6})),J({...j8(),editorMode:P6}),Q("tengu_editor_mode_changed",{mode:P6,source:"config_panel"})}},{id:"prStatusFooterEnabled",label:"Show PR status footer",value:M.prStatusFooterEnabled??!0,type:"boolean",onChange(P6){g8((m6)=>{if(m6.prStatusFooterEnabled===P6)return m6;return{...m6,prStatusFooterEnabled:P6}}),J({...j8(),prStatusFooterEnabled:P6}),Q("tengu_pr_status_footer_setting_changed",{enabled:P6})}},{id:"model",label:"Model",value:d===null?"Default (recommended)":yf(d),type:"managedEnum",onChange:k6},...o6?[{id:"diffTool",label:"Diff tool",value:M.diffTool??"auto",options:["terminal","auto"],type:"enum",onChange(P6){g8((m6)=>({...m6,diffTool:P6})),J({...j8(),diffTool:P6}),Q("tengu_diff_tool_changed",{tool:P6,source:"config_panel"})}}]:[],...!Fj()?[{id:"autoConnectIde",label:"Auto-connect to IDE (external terminal)",value:M.autoConnectIde??!1,type:"boolean",onChange(P6){g8((m6)=>({...m6,autoConnectIde:P6})),J({...j8(),autoConnectIde:P6}),Q("tengu_auto_connect_ide_changed",{enabled:P6,source:"config_panel"})}}]:[],...Fj()?[{id:"autoInstallIdeExtension",label:"Auto-install IDE extension",value:M.autoInstallIdeExtension??!0,type:"boolean",onChange(P6){g8((m6)=>({...m6,autoInstallIdeExtension:P6})),J({...j8(),autoInstallIdeExtension:P6}),Q("tengu_auto_install_ide_extension_changed",{enabled:P6,source:"config_panel"})}}]:[],{id:"pukuInChromeDefaultEnabled",label:"Puku in Chrome enabled by default",value:M.pukuInChromeDefaultEnabled??!0,type:"boolean",onChange(P6){g8((m6)=>({...m6,pukuInChromeDefaultEnabled:P6})),J({...j8(),pukuInChromeDefaultEnabled:P6}),Q("tengu_claude_in_chrome_setting_changed",{enabled:P6})}},...q_()?(()=>{let P6=S6q();return[{id:"teammateMode",label:P6?`Teammate mode [overridden: ${P6}]`:"Teammate mode",value:M.teammateMode??"auto",options:["auto","tmux","in-process"],type:"enum",onChange(O8){if(O8!=="auto"&&O8!=="tmux"&&O8!=="in-process")return;E6q(O8),g8((G8)=>({...G8,teammateMode:O8})),J({...j8(),teammateMode:O8}),Q("tengu_teammate_mode_changed",{mode:O8})}},{id:"teammateDefaultModel",label:"Default teammate model",value:gT_(M.teammateDefaultModel),type:"managedEnum",onChange(){}}]})():[],...[],...y6?[{id:"showExternalIncludesDialog",label:"External CLAUDE.md includes",value:(()=>{if(NO().hasClaudeMdExternalIncludesApproved)return"true";else return"false"})(),type:"managedEnum",onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!eG()?[{id:"apiKey",label:AK.jsxDEV(T,{children:["Use custom API key:"," ",AK.jsxDEV(T,{bold:!0,children:zZ(process.env.ANTHROPIC_API_KEY)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),searchText:"Use custom API key",value:Boolean(process.env.ANTHROPIC_API_KEY&&M.customApiKeyResponses?.approved?.includes(zZ(process.env.ANTHROPIC_API_KEY))),type:"boolean",onChange(P6){g8((m6)=>{let O8={...m6};if(!O8.customApiKeyResponses)O8.customApiKeyResponses={approved:[],rejected:[]};if(!O8.customApiKeyResponses.approved)O8.customApiKeyResponses={...O8.customApiKeyResponses,approved:[]};if(!O8.customApiKeyResponses.rejected)O8.customApiKeyResponses={...O8.customApiKeyResponses,rejected:[]};if(process.env.ANTHROPIC_API_KEY){let G8=zZ(process.env.ANTHROPIC_API_KEY);if(P6)O8.customApiKeyResponses={...O8.customApiKeyResponses,approved:[...(O8.customApiKeyResponses.approved??[]).filter((i8)=>i8!==G8),G8],rejected:(O8.customApiKeyResponses.rejected??[]).filter((i8)=>i8!==G8)};else O8.customApiKeyResponses={...O8.customApiKeyResponses,approved:(O8.customApiKeyResponses.approved??[]).filter((i8)=>i8!==G8),rejected:[...(O8.customApiKeyResponses.rejected??[]).filter((i8)=>i8!==G8),G8]}}return O8}),J(j8())}}]:[]],L6=e2.useMemo(()=>{if(!u6)return W6;let P6=u6.toLowerCase();return W6.filter((m6)=>{if(m6.id.toLowerCase().includes(P6))return!0;return("searchText"in m6?m6.searchText:m6.label).toLowerCase().includes(P6)})},[W6,u6]);e2.useEffect(()=>{if(S>=L6.length){let P6=Math.max(0,L6.length-1);C(P6),u(Math.max(0,P6-U+1));return}u((P6)=>{if(S<P6)return S;if(S>=P6+U)return S-U+1;return P6})},[L6.length,S,U]);let I6=G1.useCallback((P6)=>{u((m6)=>{if(P6<m6)return P6;if(P6>=m6+U)return P6-U+1;return m6})},[U]),T6=G1.useCallback(()=>{if(U6!==null)return;let P6=Object.entries(f6).map(([i8,e8])=>{return Q("tengu_config_changed",{key:i8,value:e8}),`Set ${i8} to ${M8.bold(e8)}`}),m6=eG()?void 0:process.env.ANTHROPIC_API_KEY,O8=Boolean(m6&&P.current.customApiKeyResponses?.approved?.includes(zZ(m6))),G8=Boolean(m6&&M.customApiKeyResponses?.approved?.includes(zZ(m6)));if(O8!==G8)P6.push(`${G8?"Enabled":"Disabled"} custom API key`),Q("tengu_config_changed",{key:"env.ANTHROPIC_API_KEY",value:G8});if(M.theme!==P.current.theme)P6.push(`Set theme to ${M8.bold(M.theme)}`);if(M.preferredNotifChannel!==P.current.preferredNotifChannel)P6.push(`Set notifications to ${M8.bold(M.preferredNotifChannel)}`);if(Z!==k.current)P6.push(`Set output style to ${M8.bold(Z)}`);if(N!==L.current)P6.push(`Set response language to ${M8.bold(N??"Default (English)")}`);if(M.editorMode!==P.current.editorMode)P6.push(`Set editor mode to ${M8.bold(M.editorMode||"emacs")}`);if(M.diffTool!==P.current.diffTool)P6.push(`Set diff tool to ${M8.bold(M.diffTool)}`);if(M.autoConnectIde!==P.current.autoConnectIde)P6.push(`${M.autoConnectIde?"Enabled":"Disabled"} auto-connect to IDE`);if(M.autoInstallIdeExtension!==P.current.autoInstallIdeExtension)P6.push(`${M.autoInstallIdeExtension?"Enabled":"Disabled"} auto-install IDE extension`);if(M.autoCompactEnabled!==P.current.autoCompactEnabled)P6.push(`${M.autoCompactEnabled?"Enabled":"Disabled"} auto-compact`);if(M.respectGitignore!==P.current.respectGitignore)P6.push(`${M.respectGitignore?"Enabled":"Disabled"} respect .gitignore in file picker`);if(M.copyFullResponse!==P.current.copyFullResponse)P6.push(`${M.copyFullResponse?"Enabled":"Disabled"} always copy full response`);if(M.copyOnSelect!==P.current.copyOnSelect)P6.push(`${M.copyOnSelect?"Enabled":"Disabled"} copy on select`);if(M.terminalProgressBarEnabled!==P.current.terminalProgressBarEnabled)P6.push(`${M.terminalProgressBarEnabled?"Enabled":"Disabled"} terminal progress bar`);if(M.showStatusInTerminalTab!==P.current.showStatusInTerminalTab)P6.push(`${M.showStatusInTerminalTab?"Enabled":"Disabled"} terminal tab status`);if(M.showTurnDuration!==P.current.showTurnDuration)P6.push(`${M.showTurnDuration?"Enabled":"Disabled"} turn duration`);if(M.remoteControlAtStartup!==P.current.remoteControlAtStartup){let i8=M.remoteControlAtStartup===void 0?"Reset Remote Control to default":`${M.remoteControlAtStartup?"Enabled":"Disabled"} Remote Control for all sessions`;P6.push(i8)}if(X?.autoUpdatesChannel!==W.current?.autoUpdatesChannel)P6.push(`Set auto-update channel to ${M8.bold(X?.autoUpdatesChannel??"latest")}`);if(P6.length>0)q(P6.join(`
|
|
5469
|
+
`))}async function MT_(q,K){let _=q.getAppState(),A=await lj(q.options.tools,q.options.mainLoopModel,Array.from(_.toolPermissionContext.additionalWorkingDirectories.keys()),q.options.mcpClients),z=SN({mainThreadAgentDefinition:void 0,toolUseContext:q,customSystemPrompt:q.options.customSystemPrompt,defaultSystemPrompt:A,appendSystemPrompt:q.options.appendSystemPrompt}),[Y,$]=await Promise.all([$O(),$3()]);return{systemPrompt:z,userContext:Y,systemContext:$,toolUseContext:q,forkContextMessages:K}}var jT_=null,S55=async(q,K)=>{let{abortController:_}=K,{messages:A}=K;if(A=l3(A),A.length===0)throw Error("No messages to compact");let z=q.trim();try{if(!z){let w=await n$8(A,K.agentId);if(w)return $O.cache.clear?.(),qL(),EB(),Y$6(),{type:"compact",compactionResult:w,displayText:m$q(K)}}if(jT_?.isReactiveOnlyMode())return await E55(A,K,z,jT_);let $=(await lU(A,K)).messages,O=await V96($,K,await MT_(K,$),!1,z,!1);return rU(void 0),Y$6(),$O.cache.clear?.(),qL(),{type:"compact",compactionResult:O,displayText:m$q(K,O.userDisplayMessage)}}catch(Y){if(_.signal.aborted)throw Error("Compaction canceled.");else if(QB(Y,AH6))throw Error(AH6);else if(QB(Y,_H6))throw Error(_H6);else throw _6(Y),Error(`Error during compaction: ${Y}`)}};var PT_=h(()=>{jA();v8();pD();kZ();XE();QU();pp();ut6();gR();TS6();o$8();nU();T8();D$();N8();Vq();P_8();p16()});var C55,g$q;var XT_=h(()=>{I8();C55={type:"local",name:"compact",description:"Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]",isEnabled:()=>!p6(process.env.DISABLE_COMPACT),supportsNonInteractive:!0,argumentHint:"<optional custom summarization instructions>",load:()=>Promise.resolve().then(() => (PT_(),JT_))},g$q=C55});function FN(q){let K=x38.c(25),{title:_,color:A,defaultTab:z,children:Y,hidden:$,useFullWidth:O,selectedTab:w,onTabChange:H,banner:j,disableNavigation:M,initialHeaderFocused:J,contentHeight:P,navFromContent:X}=q,f=J===void 0?!0:J,W=X===void 0?!1:X,{columns:Z}=Eq(),v=Y.map(I55),k=z?v.findIndex((R6)=>z===R6[0]):0,N=w!==void 0,[y,L]=Kk.useState(k!==-1?k:0),S=N?v.findIndex((R6)=>R6[0]===w):-1,C=N?S!==-1?S:0:y,b=GaK(),[u,m]=Kk.useState(f),g;if(K[0]===Symbol.for("react.memo_cache_sentinel"))g=()=>m(!0),K[0]=g;else g=K[0];let B=g,x;if(K[1]===Symbol.for("react.memo_cache_sentinel"))x=()=>m(!1),K[1]=x;else x=K[1];let F=x,U=Kk.useRef(0),d;if(K[2]===Symbol.for("react.memo_cache_sentinel"))d=()=>{return U.current++,()=>{U.current--}},K[2]=d;else d=K[2];let o=d,K6=U.current>0,n=(R6)=>{let Z6=(C+v.length+R6)%v.length,D6=v[Z6]?.[0];if(N&&H&&D6)H(D6);else L(Z6);m(!0)},t=!$&&!M&&u,s;if(K[3]!==t)s={context:"Tabs",isActive:t},K[3]=t,K[4]=s;else s=K[4];CK({"tabs:next":()=>n(1),"tabs:previous":()=>n(-1)},s);let e;if(K[5]!==u||K[6]!==$)e=(R6)=>{if(!u||!U.current||$)return;if(R6.key==="down")R6.preventDefault(),m(!1)},K[5]=u,K[6]=$,K[8]=e;else e=K[8];let q6=e,f6=W&&!u&&K6&&!$&&!M,$6;if(K[9]!==f6)$6={context:"Tabs",isActive:f6},K[9]=f6,K[10]=$6;else $6=K[10];CK({"tabs:next":()=>{n(1),m(!0)},"tabs:previous":()=>{n(-1),m(!0)}},$6);let N6=_?wq(_)+1:0,H6=v.reduce(b55,0),J6=N6+H6,O6=O?Math.max(0,Z-J6):0,j6=O?Z:void 0,A6=I,w6="column",v6=0,C6=!0,n6=b?0:void 0,U6=!$&&HL.jsxDEV(I,{flexDirection:"row",gap:1,flexShrink:b?0:void 0,children:[_!==void 0&&HL.jsxDEV(T,{bold:!0,color:A,children:_},void 0,!1,void 0,this),v.map((R6,Z6)=>{let[D6,o6]=R6,s6=C===Z6,S6=A&&s6&&u;return HL.jsxDEV(T,{backgroundColor:S6?A:void 0,color:S6?"inverseText":void 0,inverse:s6&&!S6,bold:s6,children:[" ",o6," "]},D6,!0,void 0,this)}),O6>0&&HL.jsxDEV(T,{children:" ".repeat(O6)},void 0,!1,void 0,this)]},`${C}-${u?"focused":"blurred"}`,!0,void 0,this),d6;if(K[11]!==Y||K[12]!==P||K[13]!==j6||K[14]!==$||K[15]!==b||K[16]!==C)d6=b?HL.jsxDEV(I,{width:j6,marginTop:$?0:1,flexShrink:0,children:HL.jsxDEV(BH6,{ref:b,flexDirection:"column",flexShrink:0,children:Y},C,!1,void 0,this)},void 0,!1,void 0,this):HL.jsxDEV(I,{width:j6,marginTop:$?0:1,height:P,overflowY:P!==void 0?"hidden":void 0,children:Y},void 0,!1,void 0,this),K[11]=Y,K[12]=P,K[13]=j6,K[14]=$,K[15]=b,K[16]=C,K[17]=d6;else d6=K[17];let u6;if(K[18]!==A6||K[19]!==j||K[20]!==q6||K[21]!==n6||K[22]!==U6||K[23]!==d6)u6=HL.jsxDEV(A6,{flexDirection:w6,tabIndex:v6,autoFocus:C6,onKeyDown:q6,flexShrink:n6,children:[U6,j,d6]},void 0,!0,void 0,this),K[18]=A6,K[19]=j,K[20]=q6,K[21]=n6,K[22]=U6,K[23]=d6,K[24]=u6;else u6=K[24];return HL.jsxDEV(u38.Provider,{value:{selectedTab:v[C][0],width:j6,headerFocused:u,focusHeader:B,blurHeader:F,registerOptIn:o},children:u6},void 0,!1,void 0,this)}function b55(q,K){let[,_]=K;return q+(_?wq(_):0)+2+1}function I55(q){return[q.props.id??q.props.title,q.props.title]}function ZO(q){let K=x38.c(4),{title:_,id:A,children:z}=q,{selectedTab:Y,width:$}=Kk.useContext(u38),O=FZ();if(Y!==(A??_))return null;let w=O?0:void 0,H;if(K[0]!==z||K[1]!==w||K[2]!==$)H=HL.jsxDEV(I,{width:$,flexShrink:w,children:z},void 0,!1,void 0,this),K[0]=z,K[1]=w,K[2]=$,K[3]=H;else H=K[3];return H}function fT_(){let{width:q}=Kk.useContext(u38);return q}function VX(){let q=x38.c(6),{headerFocused:K,focusHeader:_,blurHeader:A,registerOptIn:z}=Kk.useContext(u38),Y;if(q[0]!==z)Y=[z],q[0]=z,q[1]=Y;else Y=q[1];Kk.useLayoutEffect(z,Y);let $;if(q[2]!==A||q[3]!==_||q[4]!==K)$={headerFocused:K,focusHeader:_,blurHeader:A},q[2]=A,q[3]=_,q[4]=K,q[5]=$;else $=q[5];return $}var x38,Kk,HL,u38;var UN=h(()=>{kE();A7();D38();l4();a6();TK();x38=p(A8(),1),Kk=p(_8(),1),HL=p(a(),1),u38=Kk.createContext({selectedTab:void 0,width:void 0,headerFocused:!1,focusHeader:()=>{},blurHeader:()=>{},registerOptIn:()=>()=>{}})});function x55(){let q=k8(),_=u2(q)??tH.jsxDEV(T,{dimColor:!0,children:"/rename to add a name"},void 0,!1,void 0,this);return[{label:"Version",value:"1.8.32"},{label:"Session name",value:_},{label:"Session ID",value:q},{label:"cwd",value:X8()},...j78(),...M78()]}function u55({mainLoopModel:q,mcp:K,theme:_,context:A}){return[{label:"Model",value:zq_(q)},...t8_(K.clients,A.options.ideInstallationStatus,_),...e8_(K.clients,_),...s8_(),...Kq_()]}async function WT_(){return[...await _q_(),...await Aq_(),...await qq_()]}function p55(q){let K=p38.c(8),{value:_}=q;if(Array.isArray(_)){let A;if(K[0]!==_){let Y;if(K[2]!==_.length)Y=($,O)=>tH.jsxDEV(T,{children:[$,O<_.length-1?",":""]},O,!0,void 0,this),K[2]=_.length,K[3]=Y;else Y=K[3];A=_.map(Y),K[0]=_,K[1]=A}else A=K[1];let z;if(K[4]!==A)z=tH.jsxDEV(I,{flexWrap:"wrap",columnGap:1,flexShrink:99,children:A},void 0,!1,void 0,this),K[4]=A,K[5]=z;else z=K[5];return z}if(typeof _==="string"){let A;if(K[6]!==_)A=tH.jsxDEV(T,{children:_},void 0,!1,void 0,this),K[6]=_,K[7]=A;else A=K[7];return A}return _}function ZT_(q){let K=p38.c(20),{context:_,diagnosticsPromise:A}=q,z=P8(c55),Y=P8(B55),[$]=hK(),O;if(K[0]===Symbol.for("react.memo_cache_sentinel"))O=x55(),K[0]=O;else O=K[0];let w;if(K[1]!==_||K[2]!==z||K[3]!==Y||K[4]!==$)w=u55({mainLoopModel:z,mcp:Y,theme:$,context:_}),K[1]=_,K[2]=z,K[3]=Y,K[4]=$,K[5]=w;else w=K[5];let H;if(K[6]!==w)H=[O,w],K[6]=w,K[7]=H;else H=K[7];let j=H,M=FZ()?1:void 0,J;if(K[8]!==j)J=j.map(m55),K[8]=j,K[9]=J;else J=K[9];let P;if(K[10]!==A)P=tH.jsxDEV(m38.Suspense,{fallback:null,children:tH.jsxDEV(F55,{promise:A},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[10]=A,K[11]=P;else P=K[11];let X;if(K[12]!==M||K[13]!==J||K[14]!==P)X=tH.jsxDEV(I,{flexDirection:"column",gap:1,flexGrow:M,children:[J,P]},void 0,!0,void 0,this),K[12]=M,K[13]=J,K[14]=P,K[15]=X;else X=K[15];let f;if(K[16]===Symbol.for("react.memo_cache_sentinel"))f=tH.jsxDEV(T,{dimColor:!0,children:tH.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[16]=f;else f=K[16];let W;if(K[17]!==M||K[18]!==X)W=tH.jsxDEV(I,{flexDirection:"column",flexGrow:M,children:[X,f]},void 0,!0,void 0,this),K[17]=M,K[18]=X,K[19]=W;else W=K[19];return W}function m55(q,K){return q.length>0&&tH.jsxDEV(I,{flexDirection:"column",children:q.map(g55)},K,!1,void 0,this)}function g55(q,K){let{label:_,value:A}=q;return tH.jsxDEV(I,{flexDirection:"row",gap:1,flexShrink:0,children:[_!==void 0&&tH.jsxDEV(T,{bold:!0,children:[_,":"]},void 0,!0,void 0,this),tH.jsxDEV(p55,{value:A},void 0,!1,void 0,this)]},K,!0,void 0,this)}function B55(q){return q.mcp}function c55(q){return q.mainLoopModel}function F55(q){let K=p38.c(5),{promise:_}=q,A=m38.use(_);if(A.length===0)return null;let z;if(K[0]===Symbol.for("react.memo_cache_sentinel"))z=tH.jsxDEV(T,{bold:!0,children:"System Diagnostics"},void 0,!1,void 0,this),K[0]=z;else z=K[0];let Y;if(K[1]!==A)Y=A.map(U55),K[1]=A,K[2]=Y;else Y=K[2];let $;if(K[3]!==Y)$=tH.jsxDEV(I,{flexDirection:"column",paddingBottom:1,children:[z,Y]},void 0,!0,void 0,this),K[3]=Y,K[4]=$;else $=K[4];return $}function U55(q,K){return tH.jsxDEV(I,{flexDirection:"row",gap:1,paddingX:1,children:[tH.jsxDEV(T,{color:"error",children:t6.warning},void 0,!1,void 0,this),typeof q==="string"?tH.jsxDEV(T,{wrap:"wrap",children:q},void 0,!1,void 0,this):q]},K,!0,void 0,this)}var p38,m38,tH;var GT_=h(()=>{__();v8();kE();a6();KK();$K();e_();ge8();k4();p38=p(A8(),1),m38=p(_8(),1),tH=p(a(),1)});function B$q(){return!1}async function vT_(){return!1}function c$q(){return!1}function DT_(){return!0}function kT_(){return null}var UH6=h(()=>{GK();I8()});function dH6(q){let K=TT_.c(59),{onThemeSelect:_,showIntroText:A,helpText:z,showHelpTextBelow:Y,hideEscToCancel:$,skipExitHandling:O,onCancel:w}=q,H=A===void 0?!1:A,j=z===void 0?"":z,M=Y===void 0?!1:Y,J=$===void 0?!1:$,P=O===void 0?!1:O,[X]=hK(),f=Xz6(),{columns:W}=Eq(),Z;if(K[0]===Symbol.for("react.memo_cache_sentinel"))Z=Yh6(),K[0]=Z;else Z=K[0];let v=Z,k;if(K[1]!==X)k=v===null?r3_(X):null,K[1]=X,K[2]=k;else k=K[2];let N=k,{setPreviewTheme:y,savePreview:L,cancelPreview:S}=nn6(),C=P8(Q55)??!1,b=PK();fq8("ThemePicker");let u=f4("theme:toggleSyntaxHighlighting","ThemePicker","ctrl+t"),m;if(K[3]!==b||K[4]!==C)m=()=>{if(v===null){let A6=!C;gq("userSettings",{syntaxHighlightingDisabled:A6}),b((w6)=>({...w6,settings:{...w6.settings,syntaxHighlightingDisabled:A6}}))}},K[3]=b,K[4]=C,K[5]=m;else m=K[5];let g;if(K[6]===Symbol.for("react.memo_cache_sentinel"))g={context:"ThemePicker"},K[6]=g;else g=K[6];Kq("theme:toggleSyntaxHighlighting",m,g);let B=x4(P?d55:void 0),x;if(K[7]===Symbol.for("react.memo_cache_sentinel"))x=[...[],{label:"Dark mode",value:"dark"},{label:"Light mode",value:"light"},{label:"Dark mode (colorblind-friendly)",value:"dark-daltonized"},{label:"Light mode (colorblind-friendly)",value:"light-daltonized"},{label:"Dark mode (ANSI colors only)",value:"dark-ansi"},{label:"Light mode (ANSI colors only)",value:"light-ansi"}],K[7]=x;else x=K[7];let F=x,U;if(K[8]!==H)U=H?xO.jsxDEV(T,{children:"Let's get started."},void 0,!1,void 0,this):xO.jsxDEV(T,{bold:!0,color:"permission",children:"Theme"},void 0,!1,void 0,this),K[8]=H,K[9]=U;else U=K[9];let d;if(K[10]===Symbol.for("react.memo_cache_sentinel"))d=xO.jsxDEV(T,{bold:!0,children:"Choose the text style that looks best with your terminal"},void 0,!1,void 0,this),K[10]=d;else d=K[10];let o;if(K[11]!==j||K[12]!==M)o=j&&!M&&xO.jsxDEV(T,{dimColor:!0,children:j},void 0,!1,void 0,this),K[11]=j,K[12]=M,K[13]=o;else o=K[13];let K6;if(K[14]!==o)K6=xO.jsxDEV(I,{flexDirection:"column",children:[d,o]},void 0,!0,void 0,this),K[14]=o,K[15]=K6;else K6=K[15];let n;if(K[16]!==y)n=(A6)=>{y(A6)},K[16]=y,K[17]=n;else n=K[17];let t;if(K[18]!==_||K[19]!==L)t=(A6)=>{L(),_(A6)},K[18]=_,K[19]=L,K[20]=t;else t=K[20];let s;if(K[21]!==S||K[22]!==w||K[23]!==P)s=P?()=>{S(),w?.()}:async()=>{S(),await U7(0)},K[21]=S,K[22]=w,K[23]=P,K[24]=s;else s=K[24];let e;if(K[25]!==n||K[26]!==t||K[27]!==s||K[28]!==f)e=xO.jsxDEV(r8,{options:F,onFocus:n,onChange:t,onCancel:s,visibleOptionCount:F.length,defaultValue:f,defaultFocusValue:f},void 0,!1,void 0,this),K[25]=n,K[26]=t,K[27]=s,K[28]=f,K[29]=e;else e=K[29];let q6;if(K[30]!==U||K[31]!==K6||K[32]!==e)q6=xO.jsxDEV(I,{flexDirection:"column",gap:1,children:[U,K6,e]},void 0,!0,void 0,this),K[30]=U,K[31]=K6,K[32]=e,K[33]=q6;else q6=K[33];let f6;if(K[34]===Symbol.for("react.memo_cache_sentinel"))f6={oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[" function greet() {",'- console.log("Hello, World!");','+ console.log("Hello, Puku CLI!");'," }"]},K[34]=f6;else f6=K[34];let $6;if(K[35]!==W)$6=xO.jsxDEV(I,{flexDirection:"column",borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:"dashed",borderColor:"subtle",children:xO.jsxDEV($C,{patch:f6,dim:!1,filePath:"demo.js",firstLine:null,width:W},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[35]=W,K[36]=$6;else $6=K[36];let N6=v==="env"?`Syntax highlighting disabled (via PUKU_CLI_SYNTAX_HIGHLIGHT=${process.env.PUKU_CLI_SYNTAX_HIGHLIGHT})`:C?`Syntax highlighting disabled (${u} to enable)`:N?`Syntax theme: ${N.theme}${N.source?` (from ${N.source})`:""} (${u} to disable)`:`Syntax highlighting enabled (${u} to disable)`,H6;if(K[37]!==N6)H6=xO.jsxDEV(T,{dimColor:!0,children:[" ",N6]},void 0,!0,void 0,this),K[37]=N6,K[38]=H6;else H6=K[38];let J6;if(K[39]!==$6||K[40]!==H6)J6=xO.jsxDEV(I,{flexDirection:"column",width:"100%",children:[$6,H6]},void 0,!0,void 0,this),K[39]=$6,K[40]=H6,K[41]=J6;else J6=K[41];let O6;if(K[42]!==q6||K[43]!==J6)O6=xO.jsxDEV(I,{flexDirection:"column",gap:1,children:[q6,J6]},void 0,!0,void 0,this),K[42]=q6,K[43]=J6,K[44]=O6;else O6=K[44];let j6=O6;if(!H){let A6;if(K[45]!==j6)A6=xO.jsxDEV(I,{flexDirection:"column",children:j6},void 0,!1,void 0,this),K[45]=j6,K[46]=A6;else A6=K[46];let w6;if(K[47]!==j||K[48]!==M)w6=M&&j&&xO.jsxDEV(I,{marginLeft:3,children:xO.jsxDEV(T,{dimColor:!0,children:j},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[47]=j,K[48]=M,K[49]=w6;else w6=K[49];let v6;if(K[50]!==B||K[51]!==J)v6=!J&&xO.jsxDEV(I,{children:xO.jsxDEV(T,{dimColor:!0,italic:!0,children:B.pending?xO.jsxDEV(xO.Fragment,{children:["Press ",B.keyName," again to exit"]},void 0,!0,void 0,this):xO.jsxDEV(fq,{children:[xO.jsxDEV(c8,{shortcut:"Enter",action:"select"},void 0,!1,void 0,this),xO.jsxDEV(c8,{shortcut:"Esc",action:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[50]=B,K[51]=J,K[52]=v6;else v6=K[52];let C6;if(K[53]!==w6||K[54]!==v6)C6=xO.jsxDEV(I,{marginTop:1,children:[w6,v6]},void 0,!0,void 0,this),K[53]=w6,K[54]=v6,K[55]=C6;else C6=K[55];let n6;if(K[56]!==A6||K[57]!==C6)n6=xO.jsxDEV(xO.Fragment,{children:[A6,C6]},void 0,!0,void 0,this),K[56]=A6,K[57]=C6,K[58]=n6;else n6=K[58];return n6}return j6}function d55(){}function Q55(q){return q.settings.syntaxHighlightingDisabled}var TT_,xO;var B38=h(()=>{c3();A7();a6();eu();TK();mH();KK();i$();Rq();Jz();S7();t7();Sz8();nw6();TT_=p(A8(),1),xO=p(a(),1)});function QH6(q){switch(q){case"low":return eCq;case"medium":return qbq;case"high":return a08;case"max":return Kbq;default:return a08}}var c38=h(()=>{az();oP()});function L86(q){let K=d$q.c(82),{initial:_,sessionModel:A,onSelect:z,onCancel:Y,isStandaloneCommand:$,showFastModeNotice:O,headerText:w,skipSettingsWrite:H}=q,j=PK(),M=x4(),J=_===null?U38:_,[P,X]=F38.useState(J),f=P8(n55),[W,Z]=F38.useState(!1),v=P8(r55),k;if(K[0]!==v)k=v!==void 0?xs(v):void 0,K[0]=v,K[1]=k;else k=K[1];let[N,y]=F38.useState(k),L=f??!1,S;if(K[2]!==L)S=wl(L),K[2]=L,K[3]=S;else S=K[3];let C=S,b;q:{if(_!==null&&!C.some((G6)=>G6.value===_)){let G6;if(K[4]!==_)G6=yf(_),K[4]=_,K[5]=G6;else G6=K[5];let W6;if(K[6]!==_||K[7]!==G6)W6={value:_,label:G6,description:"Current model"},K[6]=_,K[7]=G6,K[8]=W6;else W6=K[8];let L6;if(K[9]!==C||K[10]!==W6)L6=[...C,W6],K[9]=C,K[10]=W6,K[11]=L6;else L6=K[11];b=L6;break q}b=C}let u=b,m;if(K[12]!==u)m=u.map(i55),K[12]=u,K[13]=m;else m=K[13];let g=m,B;if(K[14]!==J||K[15]!==g)B=g.some((G6)=>G6.value===J)?J:g[0]?.value??void 0,K[14]=J,K[15]=g,K[16]=B;else B=K[16];let x=B,F=Math.min(10,g.length),U=Math.max(0,g.length-F),d;if(K[17]!==P||K[18]!==g)d=g.find((G6)=>G6.value===P)?.label,K[17]=P,K[18]=g,K[19]=d;else d=K[19];let o=d,K6,n;if(K[20]!==P){let G6=U$q(P);K6=G6?WZ(G6):!1,n=G6?xY6(G6):!1,K[20]=P,K[21]=K6,K[22]=n}else K6=K[21],n=K[22];let t=n,s;if(K[23]!==P)s=F$q(P),K[23]=P,K[24]=s;else s=K[24];let e=s,q6=N==="max"&&!t?"high":N,f6;if(K[25]!==v||K[26]!==W)f6=(G6)=>{if(X(G6),!W&&v===void 0)y(F$q(G6))},K[25]=v,K[26]=W,K[27]=f6;else f6=K[27];let $6=f6,N6;if(K[28]!==e||K[29]!==K6||K[30]!==t)N6=(G6)=>{if(!K6)return;y((W6)=>o55(W6??e,G6,t)),Z(!0)},K[28]=e,K[29]=K6,K[30]=t,K[31]=N6;else N6=K[31];let H6=N6,J6;if(K[32]!==H6)J6={"modelPicker:decreaseEffort":()=>H6("left"),"modelPicker:increaseEffort":()=>H6("right")},K[32]=H6,K[33]=J6;else J6=K[33];let O6;if(K[34]===Symbol.for("react.memo_cache_sentinel"))O6={context:"ModelPicker"},K[34]=O6;else O6=K[34];CK(J6,O6);let j6;if(K[35]!==N||K[36]!==W||K[37]!==z||K[38]!==j||K[39]!==H)j6=function(W6){if(Q("tengu_model_command_menu_effort",{effort:N}),!H){let T6=rCK(N,F$q(W6),jq("userSettings")?.effortLevel,W),l6=uU(T6);if(l6!==void 0)gq("userSettings",{effortLevel:l6});j((z8)=>({...z8,effortValue:T6}))}let L6=U$q(W6),I6=W&&L6&&WZ(L6)?N:void 0;if(W6===U38){z(null,I6);return}z(W6,I6)},K[35]=N,K[36]=W,K[37]=z,K[38]=j,K[39]=H,K[40]=j6;else j6=K[40];let A6=j6,w6;if(K[41]===Symbol.for("react.memo_cache_sentinel"))w6=fY.jsxDEV(T,{color:"remember",bold:!0,children:"Select model"},void 0,!1,void 0,this),K[41]=w6;else w6=K[41];let v6=w??"Switch between puku-ai models. Applies to this session and future puku-cli sessions. For other/previous model names, specify with --model.",C6;if(K[42]!==v6)C6=fY.jsxDEV(T,{dimColor:!0,children:v6},void 0,!1,void 0,this),K[42]=v6,K[43]=C6;else C6=K[43];let n6;if(K[44]!==A)n6=A&&fY.jsxDEV(T,{dimColor:!0,children:["Currently using ",yf(A)," for this session (set by plan mode). Selecting a model will undo this."]},void 0,!0,void 0,this),K[44]=A,K[45]=n6;else n6=K[45];let U6;if(K[46]!==C6||K[47]!==n6)U6=fY.jsxDEV(I,{marginBottom:1,flexDirection:"column",children:[w6,C6,n6]},void 0,!0,void 0,this),K[46]=C6,K[47]=n6,K[48]=U6;else U6=K[48];let d6=Y??l55,u6;if(K[49]!==$6||K[50]!==A6||K[51]!==x||K[52]!==J||K[53]!==g||K[54]!==d6||K[55]!==F)u6=fY.jsxDEV(I,{flexDirection:"column",children:fY.jsxDEV(r8,{defaultValue:J,defaultFocusValue:x,options:g,onChange:A6,onFocus:$6,onCancel:d6,visibleOptionCount:F},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[49]=$6,K[50]=A6,K[51]=x,K[52]=J,K[53]=g,K[54]=d6,K[55]=F,K[56]=u6;else u6=K[56];let R6;if(K[57]!==U)R6=U>0&&fY.jsxDEV(I,{paddingLeft:3,children:fY.jsxDEV(T,{dimColor:!0,children:["and ",U," more…"]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[57]=U,K[58]=R6;else R6=K[58];let Z6;if(K[59]!==u6||K[60]!==R6)Z6=fY.jsxDEV(I,{flexDirection:"column",marginBottom:1,children:[u6,R6]},void 0,!0,void 0,this),K[59]=u6,K[60]=R6,K[61]=Z6;else Z6=K[61];let D6;if(K[62]!==q6||K[63]!==e||K[64]!==o||K[65]!==K6)D6=fY.jsxDEV(I,{marginBottom:1,flexDirection:"column",children:K6?fY.jsxDEV(T,{dimColor:!0,children:[fY.jsxDEV(NT_,{effort:q6},void 0,!1,void 0,this)," ",wp(q6)," effort",q6===e?" (default)":""," ",fY.jsxDEV(T,{color:"subtle",children:"← → to adjust"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):fY.jsxDEV(T,{color:"subtle",children:[fY.jsxDEV(NT_,{effort:void 0},void 0,!1,void 0,this)," Effort not supported",o?` for ${o}`:""]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[62]=q6,K[63]=e,K[64]=o,K[65]=K6,K[66]=D6;else D6=K[66];let o6;if(K[67]!==O)o6=x7()?O?fY.jsxDEV(I,{marginBottom:1,children:fY.jsxDEV(T,{dimColor:!0,children:["Fast mode is ",fY.jsxDEV(T,{bold:!0,children:"ON"},void 0,!1,void 0,this)," and available with"," ",YR," only (/fast). Switching to other models turn off fast mode."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):b1()&&!wS()?fY.jsxDEV(I,{marginBottom:1,children:fY.jsxDEV(T,{dimColor:!0,children:["Use ",fY.jsxDEV(T,{bold:!0,children:"/fast"},void 0,!1,void 0,this)," to turn on Fast mode (",YR," only)."]},void 0,!0,void 0,this)},void 0,!1,void 0,this):null:null,K[67]=O,K[68]=o6;else o6=K[68];let s6;if(K[69]!==U6||K[70]!==Z6||K[71]!==D6||K[72]!==o6)s6=fY.jsxDEV(I,{flexDirection:"column",children:[U6,Z6,D6,o6]},void 0,!0,void 0,this),K[69]=U6,K[70]=Z6,K[71]=D6,K[72]=o6,K[73]=s6;else s6=K[73];let S6;if(K[74]!==M||K[75]!==$)S6=$&&fY.jsxDEV(T,{dimColor:!0,italic:!0,children:M.pending?fY.jsxDEV(fY.Fragment,{children:["Press ",M.keyName," again to exit"]},void 0,!0,void 0,this):fY.jsxDEV(fq,{children:[fY.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),fY.jsxDEV(qq,{action:"select:cancel",context:"Select",fallback:"Esc",description:"exit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[74]=M,K[75]=$,K[76]=S6;else S6=K[76];let y6;if(K[77]!==s6||K[78]!==S6)y6=fY.jsxDEV(I,{flexDirection:"column",children:[s6,S6]},void 0,!0,void 0,this),K[77]=s6,K[78]=S6,K[79]=y6;else y6=K[79];let F6=y6;if(!$)return F6;let k6;if(K[80]!==F6)k6=fY.jsxDEV(Mz,{color:"permission",children:F6},void 0,!1,void 0,this),K[80]=F6,K[81]=k6;else k6=K[81];return k6}function l55(){}function i55(q){return{...q,value:q.value===null?U38:q.value}}function r55(q){return q.effortValue}function n55(q){return x7()?q.fastMode:!1}function U$q(q){if(!q)return;return q===U38?$2():s7(q)}function NT_(q){let K=d$q.c(5),{effort:_}=q,A=_?"puku":"subtle",z=_??"low",Y;if(K[0]!==z)Y=QH6(z),K[0]=z,K[1]=Y;else Y=K[1];let $;if(K[2]!==A||K[3]!==Y)$=fY.jsxDEV(T,{color:A,children:Y},void 0,!1,void 0,this),K[2]=A,K[3]=Y,K[4]=$;else $=K[4];return $}function o55(q,K,_){let A=_?["low","medium","high","max"]:["low","medium","high"],z=A.indexOf(q),Y=z!==-1?z:A.indexOf("high");if(K==="right")return A[(Y+1)%A.length];else return A[(Y-1+A.length)%A.length]}function F$q(q){let K=U$q(q)??$2(),_=oT6(K);return _!==void 0?xs(_):"high"}var d$q,F38,fY,U38="__NO_PREFERENCE__";var d38=h(()=>{ay6();c3();Y2();a6();TK();KK();oP();Y_();dh6();Rq();k4();Jz();S7();t7();qJ();c38();d$q=p(A8(),1),F38=p(_8(),1),fY=p(a(),1)});function h86(q,K,_){if(!BK())return!1;if(K)return!0;if(q===null||!iv(q))return!1;let A=q.toLowerCase().replace(/\[1m\]$/,"").trim(),z=A==="opus"||A.includes("opus-4-6"),Y=A==="sonnet"||A.includes("sonnet-4-6");if(z&&_)return!1;return z||Y}var Q38=h(()=>{GK();Vj()});var VT_={};h8(VT_,{PukuMdExternalIncludesDialog:()=>Q$q});function Q$q(q){let K=yT_.c(18),{onDone:_,isStandaloneDialog:A,externalIncludes:z}=q,Y;if(K[0]===Symbol.for("react.memo_cache_sentinel"))Y=[],K[0]=Y;else Y=K[0];RT_.default.useEffect(e55,Y);let $;if(K[1]!==_)$=(v)=>{if(v==="no")Q("tengu_claude_md_external_includes_dialog_declined",{}),K3(t55);else Q("tengu_claude_md_external_includes_dialog_accepted",{}),K3(s55);_()},K[1]=_,K[2]=$;else $=K[2];let O=$,w;if(K[3]!==O)w=()=>{O("no")},K[3]=O,K[4]=w;else w=K[4];let H=w,j=!A,M=!A,J;if(K[5]===Symbol.for("react.memo_cache_sentinel"))J=Cm.jsxDEV(T,{children:"This project's CLAUDE.md imports files outside the current working directory. Never allow this for third-party repositories."},void 0,!1,void 0,this),K[5]=J;else J=K[5];let P;if(K[6]!==z)P=z&&z.length>0&&Cm.jsxDEV(I,{flexDirection:"column",children:[Cm.jsxDEV(T,{dimColor:!0,children:"External imports:"},void 0,!1,void 0,this),z.map(a55)]},void 0,!0,void 0,this),K[6]=z,K[7]=P;else P=K[7];let X;if(K[8]===Symbol.for("react.memo_cache_sentinel"))X=Cm.jsxDEV(T,{dimColor:!0,children:["Important: Only use Puku with files you trust. Accessing untrusted files may pose security risks"," ",Cm.jsxDEV(nK,{url:"https://puku.sh/docs/en/security"},void 0,!1,void 0,this)," "]},void 0,!0,void 0,this),K[8]=X;else X=K[8];let f;if(K[9]===Symbol.for("react.memo_cache_sentinel"))f=[{label:"Yes, allow external imports",value:"yes"},{label:"No, disable external imports",value:"no"}],K[9]=f;else f=K[9];let W;if(K[10]!==O)W=Cm.jsxDEV(r8,{options:f,onChange:(v)=>O(v)},void 0,!1,void 0,this),K[10]=O,K[11]=W;else W=K[11];let Z;if(K[12]!==H||K[13]!==W||K[14]!==j||K[15]!==M||K[16]!==P)Z=Cm.jsxDEV(Pq,{title:"Allow external CLAUDE.md file imports?",color:"warning",onCancel:H,hideBorder:j,hideInputGuide:M,children:[J,P,X,W]},void 0,!0,void 0,this),K[12]=H,K[13]=W,K[14]=j,K[15]=M,K[16]=P,K[17]=Z;else Z=K[17];return Z}function a55(q,K){return Cm.jsxDEV(T,{dimColor:!0,children:[" ",q.path]},K,!0,void 0,this)}function s55(q){return{...q,hasClaudeMdExternalIncludesApproved:!0,hasClaudeMdExternalIncludesWarningShown:!0}}function t55(q){return{...q,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!0}}function e55(){Q("tengu_claude_md_includes_dialog_shown",{})}var yT_,RT_,Cm;var l$q=h(()=>{a6();Tq();Jz();J7();yT_=p(A8(),1),RT_=p(_8(),1),Cm=p(a(),1)});function hT_(q){let K=LT_.c(17),{currentVersion:_,onChoice:A}=q,z;if(K[0]!==A)z=function(W){A(W)},K[0]=A,K[1]=z;else z=K[1];let Y=z,$;if(K[2]!==A)$=function(){A("cancel")},K[2]=A,K[3]=$;else $=K[3];let O=$,w;if(K[4]!==_)w=PE6.jsxDEV(T,{children:["The stable channel may have an older version than what you're currently running (",_,")."]},void 0,!0,void 0,this),K[4]=_,K[5]=w;else w=K[5];let H;if(K[6]===Symbol.for("react.memo_cache_sentinel"))H=PE6.jsxDEV(T,{dimColor:!0,children:"How would you like to handle this?"},void 0,!1,void 0,this),K[6]=H;else H=K[6];let j;if(K[7]===Symbol.for("react.memo_cache_sentinel"))j={label:"Allow possible downgrade to stable version",value:"downgrade"},K[7]=j;else j=K[7];let M=`Stay on current version (${_}) until stable catches up`,J;if(K[8]!==M)J=[j,{label:M,value:"stay"}],K[8]=M,K[9]=J;else J=K[9];let P;if(K[10]!==Y||K[11]!==J)P=PE6.jsxDEV(r8,{options:J,onChange:Y},void 0,!1,void 0,this),K[10]=Y,K[11]=J,K[12]=P;else P=K[12];let X;if(K[13]!==O||K[14]!==w||K[15]!==P)X=PE6.jsxDEV(Pq,{title:"Switch to Stable Channel",onCancel:O,color:"permission",hideBorder:!0,hideInputGuide:!0,children:[w,H,P]},void 0,!0,void 0,this),K[13]=O,K[14]=w,K[15]=P,K[16]=X;else X=K[16];return X}var LT_,PE6;var ST_=h(()=>{a6();Jz();J7();LT_=p(A8(),1),PE6=p(a(),1)});function ET_(q){return Object.entries(q).map(([K,_])=>({label:_?.name??qz5,value:K,description:_?.description??Kz5}))}function bT_(q){let K=CT_.c(16),{initialStyle:_,onComplete:A,onCancel:z,isStandaloneCommand:Y}=q,$;if(K[0]===Symbol.for("react.memo_cache_sentinel"))$=[],K[0]=$;else $=K[0];let[O,w]=XE6.useState($),[H,j]=XE6.useState(!0),M,J;if(K[1]===Symbol.for("react.memo_cache_sentinel"))M=()=>{TH6(X8()).then((N)=>{let y=ET_(N);w(y),j(!1)}).catch(()=>{let N=ET_(Et);w(N),j(!1)})},J=[],K[1]=M,K[2]=J;else M=K[1],J=K[2];XE6.useEffect(M,J);let P;if(K[3]!==A)P=(N)=>{A(N)},K[3]=A,K[4]=P;else P=K[4];let X=P,f=!Y,W=!Y,Z;if(K[5]===Symbol.for("react.memo_cache_sentinel"))Z=S86.jsxDEV(I,{marginTop:1,children:S86.jsxDEV(T,{dimColor:!0,children:"This changes how Puku communicates with you"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[5]=Z;else Z=K[5];let v;if(K[6]!==X||K[7]!==_||K[8]!==H||K[9]!==O)v=S86.jsxDEV(I,{flexDirection:"column",gap:1,children:[Z,H?S86.jsxDEV(T,{dimColor:!0,children:"Loading output styles…"},void 0,!1,void 0,this):S86.jsxDEV(r8,{options:O,onChange:X,visibleOptionCount:10,defaultValue:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[6]=X,K[7]=_,K[8]=H,K[9]=O,K[10]=v;else v=K[10];let k;if(K[11]!==z||K[12]!==f||K[13]!==W||K[14]!==v)k=S86.jsxDEV(Pq,{title:"Preferred output style",onCancel:z,hideInputGuide:f,hideBorder:W,children:v},void 0,!1,void 0,this),K[11]=z,K[12]=f,K[13]=W,K[14]=v,K[15]=k;else k=K[15];return k}var CT_,XE6,S86,qz5="Default",Kz5="Claude completes coding tasks efficiently and provides concise responses";var IT_=h(()=>{$E();a6();$K();_A();J7();CT_=p(A8(),1),XE6=p(_8(),1),S86=p(a(),1)});function uT_(q){let K=xT_.c(13),{initialLanguage:_,onComplete:A,onCancel:z}=q,[Y,$]=i$q.useState(_),[O,w]=i$q.useState((_??"").length),H;if(K[0]===Symbol.for("react.memo_cache_sentinel"))H={context:"Settings"},K[0]=H;else H=K[0];Kq("confirm:no",z,H);let j;if(K[1]!==Y||K[2]!==A)j=function(){let k=Y?.trim();A(k||void 0)},K[1]=Y,K[2]=A,K[3]=j;else j=K[3];let M=j,J;if(K[4]===Symbol.for("react.memo_cache_sentinel"))J=E86.jsxDEV(T,{children:"Enter your preferred response and voice language:"},void 0,!1,void 0,this),K[4]=J;else J=K[4];let P;if(K[5]===Symbol.for("react.memo_cache_sentinel"))P=E86.jsxDEV(T,{children:t6.pointer},void 0,!1,void 0,this),K[5]=P;else P=K[5];let X=Y??"",f;if(K[6]!==O||K[7]!==M||K[8]!==X)f=E86.jsxDEV(I,{flexDirection:"row",gap:1,children:[P,E86.jsxDEV(q5,{value:X,onChange:$,onSubmit:M,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${t6.ellipsis}`,columns:60,cursorOffset:O,onChangeCursorOffset:w},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[6]=O,K[7]=M,K[8]=X,K[9]=f;else f=K[9];let W;if(K[10]===Symbol.for("react.memo_cache_sentinel"))W=E86.jsxDEV(T,{dimColor:!0,children:"Leave empty for default (English)"},void 0,!1,void 0,this),K[10]=W;else W=K[10];let Z;if(K[11]!==f)Z=E86.jsxDEV(I,{flexDirection:"column",gap:1,children:[J,f,W]},void 0,!0,void 0,this),K[11]=f,K[12]=Z;else Z=K[12];return Z}var xT_,i$q,E86;var pT_=h(()=>{__();a6();TK();U1();xT_=p(A8(),1),i$q=p(_8(),1),E86=p(a(),1)});function jL(q){let K=mT_.c(17),{query:_,placeholder:A,isFocused:z,isTerminalFocused:Y,prefix:$,width:O,cursorOffset:w,borderless:H}=q,j=A===void 0?"Search…":A,M=$===void 0?"⌕":$,J=H===void 0?!1:H,P=w??_.length,X=J?void 0:"round",f=z?"suggestion":void 0,W=!z,Z=J?0:1,v=!z,k;if(K[0]!==z||K[1]!==Y||K[2]!==P||K[3]!==j||K[4]!==_)k=z?KM.jsxDEV(KM.Fragment,{children:_?Y?KM.jsxDEV(KM.Fragment,{children:[KM.jsxDEV(T,{children:_.slice(0,P)},void 0,!1,void 0,this),KM.jsxDEV(T,{inverse:!0,children:P<_.length?_[P]:" "},void 0,!1,void 0,this),P<_.length&&KM.jsxDEV(T,{children:_.slice(P+1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):KM.jsxDEV(T,{children:_},void 0,!1,void 0,this):Y?KM.jsxDEV(KM.Fragment,{children:[KM.jsxDEV(T,{inverse:!0,children:j.charAt(0)},void 0,!1,void 0,this),KM.jsxDEV(T,{dimColor:!0,children:j.slice(1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):KM.jsxDEV(T,{dimColor:!0,children:j},void 0,!1,void 0,this)},void 0,!1,void 0,this):_?KM.jsxDEV(T,{children:_},void 0,!1,void 0,this):KM.jsxDEV(T,{children:j},void 0,!1,void 0,this),K[0]=z,K[1]=Y,K[2]=P,K[3]=j,K[4]=_,K[5]=k;else k=K[5];let N;if(K[6]!==M||K[7]!==v||K[8]!==k)N=KM.jsxDEV(T,{dimColor:v,children:[M," ",k]},void 0,!0,void 0,this),K[6]=M,K[7]=v,K[8]=k,K[9]=N;else N=K[9];let y;if(K[10]!==N||K[11]!==X||K[12]!==f||K[13]!==W||K[14]!==Z||K[15]!==O)y=KM.jsxDEV(I,{flexShrink:0,borderStyle:X,borderColor:f,borderDimColor:W,paddingX:Z,width:O,children:N},void 0,!1,void 0,this),K[10]=N,K[11]=X,K[12]=f,K[13]=W,K[14]=Z,K[15]=O,K[16]=y;else y=K[16];return y}var mT_,KM;var C86=h(()=>{a6();mT_=p(A8(),1),KM=p(a(),1)});function _z5(q){if(q.ctrl&&(q.key==="k"||q.key==="u"||q.key==="w"))return!0;if(q.meta&&q.key==="backspace")return!0;return!1}function Az5(q){return(q.ctrl||q.meta)&&q.key==="y"}function _k({isActive:q,onExit:K,onCancel:_,onExitUp:A,columns:z,passthroughCtrlKeys:Y=[],initialQuery:$="",backspaceExitsOnEmpty:O=!0}){let{columns:w}=Eq(),H=z??w,[j,M]=fE6.useState($),[J,P]=fE6.useState($.length),X=fE6.useCallback((W)=>{M(W),P(W.length)},[]),f=(W)=>{if(!q)return;let Z=$4.fromText(j,H,J);if(W.ctrl&&Y.includes(W.key.toLowerCase()))return;if(!_z5(W))AE6();if(!Az5(W))zE6();if(W.key==="return"||W.key==="down"){W.preventDefault(),K();return}if(W.key==="up"){if(W.preventDefault(),A)A();return}if(W.key==="escape"){if(W.preventDefault(),_)_();else if(j.length>0)M(""),P(0);else K();return}if(W.key==="backspace"){if(W.preventDefault(),W.meta){let{cursor:k,killed:N}=Z.deleteWordBefore();Lm(N,"prepend"),M(k.text),P(k.offset);return}if(j.length===0){if(O)(_??K)();return}let v=Z.backspace();M(v.text),P(v.offset);return}if(W.key==="delete"){W.preventDefault();let v=Z.del();M(v.text),P(v.offset);return}if(W.key==="left"&&(W.ctrl||W.meta||W.fn)){W.preventDefault();let v=Z.prevWord();P(v.offset);return}if(W.key==="right"&&(W.ctrl||W.meta||W.fn)){W.preventDefault();let v=Z.nextWord();P(v.offset);return}if(W.key==="left"){W.preventDefault();let v=Z.left();P(v.offset);return}if(W.key==="right"){W.preventDefault();let v=Z.right();P(v.offset);return}if(W.key==="home"){W.preventDefault(),P(0);return}if(W.key==="end"){W.preventDefault(),P(j.length);return}if(W.ctrl){switch(W.preventDefault(),W.key.toLowerCase()){case"a":P(0);return;case"e":P(j.length);return;case"b":P(Z.left().offset);return;case"f":P(Z.right().offset);return;case"d":{if(j.length===0){(_??K)();return}let v=Z.del();M(v.text),P(v.offset);return}case"h":{if(j.length===0){if(O)(_??K)();return}let v=Z.backspace();M(v.text),P(v.offset);return}case"k":{let{cursor:v,killed:k}=Z.deleteToLineEnd();Lm(k,"append"),M(v.text),P(v.offset);return}case"u":{let{cursor:v,killed:k}=Z.deleteToLineStart();Lm(k,"prepend"),M(v.text),P(v.offset);return}case"w":{let{cursor:v,killed:k}=Z.deleteWordBefore();Lm(k,"prepend"),M(v.text),P(v.offset);return}case"y":{let v=w38();if(v.length>0){let k=Z.offset,N=Z.insert(v);H38(k,v.length),M(N.text),P(N.offset)}return}case"g":case"c":if(_){_();return}}return}if(W.meta){switch(W.preventDefault(),W.key.toLowerCase()){case"b":P(Z.prevWord().offset);return;case"f":P(Z.nextWord().offset);return;case"d":{let v=Z.deleteWordAfter();M(v.text),P(v.offset);return}case"y":{let v=j38();if(v){let{text:k,start:N,length:y}=v,L=j.slice(0,N),S=j.slice(N+y),C=L+k+S,b=N+k.length;M38(k.length),M(C),P(b)}return}}return}if(W.key==="tab")return;if(W.key.length>=1&&!zz5.has(W.key)){W.preventDefault();let v=Z.insert(W.key);M(v.text),P(v.offset)}};return D_((W,Z,v)=>{f(new RR(v.keypress))},{isActive:q}),{query:j,setQuery:X,cursorOffset:J,handleKeyDown:f}}var fE6,zz5;var Il=h(()=>{Qz6();a6();N86();A7();fE6=p(_8(),1);zz5=new Set(["pageup","pagedown","insert","wheelup","wheeldown","mouse","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12"])});function cT_({onClose:q,context:K,setTabsHidden:_,onIsSearchModeChange:A,contentHeight:z}){let{headerFocused:Y,focusHeader:$,blurHeader:O}=VX(),w=FZ(),[,H]=hK(),j=Xz6(),[M,J]=G1.useState(j8()),P=e2.useRef(j8()),[X,f]=G1.useState(XK()),W=e2.useRef(XK()),[Z,v]=G1.useState(X?.outputStyle||nf),k=e2.useRef(Z),[N,y]=G1.useState(X?.language),L=e2.useRef(N),[S,C]=G1.useState(0),[b,u]=G1.useState(0),[m,g]=G1.useState(!0),B=z3(),{rows:x}=Eq(),F=z??Math.min(Math.floor(x*0.8),30),U=Math.max(5,F-10),d=P8((P6)=>P6.mainLoopModel),o=P8((P6)=>P6.verbose),K6=P8((P6)=>P6.thinkingEnabled),n=P8((P6)=>x7()?P6.fastMode:!1),t=P8((P6)=>P6.promptSuggestionEnabled),s=rO8()||qE6()==="enabled",e=!1,q6=PK(),[f6,$6]=G1.useState({}),N6=e2.useRef(K6),[H6]=G1.useState(()=>jq("localSettings")),[J6]=G1.useState(()=>jq("userSettings")),O6=e2.useRef(j),j6=Lz(),[A6]=G1.useState(()=>{let P6=j6.getState();return{mainLoopModel:P6.mainLoopModel,mainLoopModelForSession:P6.mainLoopModelForSession,verbose:P6.verbose,thinkingEnabled:P6.thinkingEnabled,fastMode:P6.fastMode,promptSuggestionEnabled:P6.promptSuggestionEnabled,isBriefOnly:P6.isBriefOnly,replBridgeEnabled:P6.replBridgeEnabled,replBridgeOutboundOnly:P6.replBridgeOutboundOnly,settings:P6.settings}}),[w6]=G1.useState(()=>cu6()),v6=e2.useRef(!1),[C6,n6]=G1.useState(!1),[U6,d6]=G1.useState(null),{query:u6,setQuery:R6,cursorOffset:Z6}=_k({isActive:m&&U6===null&&!Y,onExit:()=>g(!1),onExitUp:$,passthroughCtrlKeys:["c","d"]}),D6=m&&!Y;e2.useEffect(()=>{A?.(D6)},[D6,A]);let o6=GK8(K.options.mcpClients),s6=!p6(process.env.PUKU_CLI_DISABLE_FILE_CHECKPOINTING),S6=e2.use(aw(!0)),y6=Yi8(S6),F6=wo();function k6(P6){Q("tengu_config_model_changed",{from_model:d,to_model:P6}),q6((O8)=>({...O8,mainLoopModel:P6,mainLoopModelForSession:null})),$6((O8)=>{let G8=yf(P6)+(h86(P6,!1,lv())?" · Billed as extra usage":"");if("model"in O8){let{model:i8,...e8}=O8;return{...e8,model:G8}}return{...O8,model:G8}})}function G6(P6){g8((m6)=>({...m6,verbose:P6})),J({...j8(),verbose:P6}),q6((m6)=>({...m6,verbose:P6})),$6((m6)=>{if("verbose"in m6){let{verbose:O8,...G8}=m6;return G8}return{...m6,verbose:P6}})}let W6=[{id:"autoCompactEnabled",label:"Auto-compact",value:M.autoCompactEnabled,type:"boolean",onChange(P6){g8((m6)=>({...m6,autoCompactEnabled:P6})),J({...j8(),autoCompactEnabled:P6}),Q("tengu_auto_compact_setting_changed",{enabled:P6})}},{id:"spinnerTipsEnabled",label:"Show tips",value:X?.spinnerTipsEnabled??!0,type:"boolean",onChange(P6){gq("localSettings",{spinnerTipsEnabled:P6}),f((m6)=>({...m6,spinnerTipsEnabled:P6})),Q("tengu_tips_setting_changed",{enabled:P6})}},{id:"prefersReducedMotion",label:"Reduce motion",value:X?.prefersReducedMotion??!1,type:"boolean",onChange(P6){gq("localSettings",{prefersReducedMotion:P6}),f((m6)=>({...m6,prefersReducedMotion:P6})),q6((m6)=>({...m6,settings:{...m6.settings,prefersReducedMotion:P6}})),Q("tengu_reduce_motion_setting_changed",{enabled:P6})}},{id:"thinkingEnabled",label:"Thinking mode",value:K6??!0,type:"boolean",onChange(P6){q6((m6)=>({...m6,thinkingEnabled:P6})),gq("userSettings",{alwaysThinkingEnabled:P6?void 0:!1}),Q("tengu_thinking_toggled",{enabled:P6})}},...x7()&&b1()?[{id:"fastMode",label:`Fast mode (${YR} only)`,value:!!n,type:"boolean",onChange(P6){if(Na(),gq("userSettings",{fastMode:P6?!0:void 0}),P6)q6((m6)=>({...m6,mainLoopModel:mv6(),mainLoopModelForSession:null,fastMode:!0})),$6((m6)=>({...m6,model:mv6(),"Fast mode":"ON"}));else q6((m6)=>({...m6,fastMode:!1})),$6((m6)=>({...m6,"Fast mode":"OFF"}))}}]:[],..._q("tengu_chomp_inflection",!1)?[{id:"promptSuggestionEnabled",label:"Prompt suggestions",value:t,type:"boolean",onChange(P6){q6((m6)=>({...m6,promptSuggestionEnabled:P6})),gq("userSettings",{promptSuggestionEnabled:P6?void 0:!1})}}]:[],...[],...s6?[{id:"fileCheckpointingEnabled",label:"Rewind code (checkpoints)",value:M.fileCheckpointingEnabled,type:"boolean",onChange(P6){g8((m6)=>({...m6,fileCheckpointingEnabled:P6})),J({...j8(),fileCheckpointingEnabled:P6}),Q("tengu_file_history_snapshots_setting_changed",{enabled:P6})}}]:[],{id:"verbose",label:"Verbose output",value:o,type:"boolean",onChange:G6},{id:"terminalProgressBarEnabled",label:"Terminal progress bar",value:M.terminalProgressBarEnabled,type:"boolean",onChange(P6){g8((m6)=>({...m6,terminalProgressBarEnabled:P6})),J({...j8(),terminalProgressBarEnabled:P6}),Q("tengu_terminal_progress_bar_setting_changed",{enabled:P6})}},..._q("tengu_terminal_sidebar",!1)?[{id:"showStatusInTerminalTab",label:"Show status in terminal tab",value:M.showStatusInTerminalTab??!1,type:"boolean",onChange(P6){g8((m6)=>({...m6,showStatusInTerminalTab:P6})),J({...j8(),showStatusInTerminalTab:P6}),Q("tengu_terminal_tab_status_setting_changed",{enabled:P6})}}]:[],{id:"showTurnDuration",label:"Show turn duration",value:M.showTurnDuration,type:"boolean",onChange(P6){g8((m6)=>({...m6,showTurnDuration:P6})),J({...j8(),showTurnDuration:P6}),Q("tengu_show_turn_duration_setting_changed",{enabled:P6})}},{id:"defaultPermissionMode",label:"Default permission mode",value:X?.permissions?.defaultMode||"default",options:(()=>{let P6=["default","plan"],m6=Mf,O8=["bypassPermissions"];if(!s)O8.push("auto");return[...P6,...m6.filter((G8)=>!P6.includes(G8)&&!O8.includes(G8))]})(),type:"enum",onChange(P6){let m6=Dv(P6),O8=jbq(m6)?my(m6):m6,G8=gq("userSettings",{permissions:{...X?.permissions,defaultMode:O8}});if(G8.error){_6(G8.error);return}f((i8)=>({...i8,permissions:{...i8?.permissions,defaultMode:O8}})),$6((i8)=>({...i8,defaultPermissionMode:P6})),Q("tengu_config_changed",{setting:"defaultPermissionMode",value:P6})}},...s?[{id:"useAutoModeDuringPlan",label:"Use auto mode during plan",value:X?.useAutoModeDuringPlan??!0,type:"boolean",onChange(P6){gq("userSettings",{useAutoModeDuringPlan:P6}),f((m6)=>({...m6,useAutoModeDuringPlan:P6})),q6((m6)=>{let O8=SH6(m6.toolPermissionContext);if(O8===m6.toolPermissionContext)return m6;return{...m6,toolPermissionContext:O8}}),$6((m6)=>({...m6,"Use auto mode during plan":P6}))}}]:[],{id:"respectGitignore",label:"Respect .gitignore in file picker",value:M.respectGitignore,type:"boolean",onChange(P6){g8((m6)=>({...m6,respectGitignore:P6})),J({...j8(),respectGitignore:P6}),Q("tengu_respect_gitignore_setting_changed",{enabled:P6})}},{id:"copyFullResponse",label:"Always copy full response (skip /copy picker)",value:M.copyFullResponse,type:"boolean",onChange(P6){g8((m6)=>({...m6,copyFullResponse:P6})),J({...j8(),copyFullResponse:P6}),Q("tengu_config_changed",{setting:"copyFullResponse",value:String(P6)})}},...s_()?[{id:"copyOnSelect",label:"Copy on select",value:M.copyOnSelect??!0,type:"boolean",onChange(P6){g8((m6)=>({...m6,copyOnSelect:P6})),J({...j8(),copyOnSelect:P6}),Q("tengu_config_changed",{setting:"copyOnSelect",value:String(P6)})}}]:[],{id:"flickerFreeMode",label:"Flicker-free mode",value:M.flickerFreeMode??process.env.USER_TYPE==="ant",type:"boolean",onChange(P6){g8((m6)=>({...m6,flickerFreeMode:P6})),J({...j8(),flickerFreeMode:P6}),Q("tengu_config_changed",{setting:"flickerFreeMode",value:String(P6)})}},F6?{id:"autoUpdatesChannel",label:"Auto-update channel",value:"disabled",type:"managedEnum",onChange(){}}:{id:"autoUpdatesChannel",label:"Auto-update channel",value:X?.autoUpdatesChannel??"latest",type:"managedEnum",onChange(){}},{id:"theme",label:"Theme",value:j,type:"managedEnum",onChange:H},{id:"notifChannel",label:"Notifications",value:M.preferredNotifChannel,options:["auto","iterm2","terminal_bell","iterm2_with_bell","kitty","ghostty","notifications_disabled"],type:"enum",onChange(P6){g8((m6)=>({...m6,preferredNotifChannel:P6})),J({...j8(),preferredNotifChannel:P6})}},...[],{id:"outputStyle",label:"Output style",value:Z,type:"managedEnum",onChange:()=>{}},...[],{id:"language",label:"Language",value:N??"Default (English)",type:"managedEnum",onChange:()=>{}},{id:"editorMode",label:"Editor mode",value:M.editorMode==="emacs"?"normal":M.editorMode||"normal",options:["normal","vim"],type:"enum",onChange(P6){g8((m6)=>({...m6,editorMode:P6})),J({...j8(),editorMode:P6}),Q("tengu_editor_mode_changed",{mode:P6,source:"config_panel"})}},{id:"prStatusFooterEnabled",label:"Show PR status footer",value:M.prStatusFooterEnabled??!0,type:"boolean",onChange(P6){g8((m6)=>{if(m6.prStatusFooterEnabled===P6)return m6;return{...m6,prStatusFooterEnabled:P6}}),J({...j8(),prStatusFooterEnabled:P6}),Q("tengu_pr_status_footer_setting_changed",{enabled:P6})}},{id:"model",label:"Model",value:d===null?"Default (recommended)":yf(d),type:"managedEnum",onChange:k6},...o6?[{id:"diffTool",label:"Diff tool",value:M.diffTool??"auto",options:["terminal","auto"],type:"enum",onChange(P6){g8((m6)=>({...m6,diffTool:P6})),J({...j8(),diffTool:P6}),Q("tengu_diff_tool_changed",{tool:P6,source:"config_panel"})}}]:[],...!Fj()?[{id:"autoConnectIde",label:"Auto-connect to IDE (external terminal)",value:M.autoConnectIde??!1,type:"boolean",onChange(P6){g8((m6)=>({...m6,autoConnectIde:P6})),J({...j8(),autoConnectIde:P6}),Q("tengu_auto_connect_ide_changed",{enabled:P6,source:"config_panel"})}}]:[],...Fj()?[{id:"autoInstallIdeExtension",label:"Auto-install IDE extension",value:M.autoInstallIdeExtension??!0,type:"boolean",onChange(P6){g8((m6)=>({...m6,autoInstallIdeExtension:P6})),J({...j8(),autoInstallIdeExtension:P6}),Q("tengu_auto_install_ide_extension_changed",{enabled:P6,source:"config_panel"})}}]:[],{id:"pukuInChromeDefaultEnabled",label:"Puku in Chrome enabled by default",value:M.pukuInChromeDefaultEnabled??!0,type:"boolean",onChange(P6){g8((m6)=>({...m6,pukuInChromeDefaultEnabled:P6})),J({...j8(),pukuInChromeDefaultEnabled:P6}),Q("tengu_claude_in_chrome_setting_changed",{enabled:P6})}},...q_()?(()=>{let P6=S6q();return[{id:"teammateMode",label:P6?`Teammate mode [overridden: ${P6}]`:"Teammate mode",value:M.teammateMode??"auto",options:["auto","tmux","in-process"],type:"enum",onChange(O8){if(O8!=="auto"&&O8!=="tmux"&&O8!=="in-process")return;E6q(O8),g8((G8)=>({...G8,teammateMode:O8})),J({...j8(),teammateMode:O8}),Q("tengu_teammate_mode_changed",{mode:O8})}},{id:"teammateDefaultModel",label:"Default teammate model",value:gT_(M.teammateDefaultModel),type:"managedEnum",onChange(){}}]})():[],...[],...y6?[{id:"showExternalIncludesDialog",label:"External CLAUDE.md includes",value:(()=>{if(NO().hasClaudeMdExternalIncludesApproved)return"true";else return"false"})(),type:"managedEnum",onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!eG()?[{id:"apiKey",label:AK.jsxDEV(T,{children:["Use custom API key:"," ",AK.jsxDEV(T,{bold:!0,children:zZ(process.env.ANTHROPIC_API_KEY)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),searchText:"Use custom API key",value:Boolean(process.env.ANTHROPIC_API_KEY&&M.customApiKeyResponses?.approved?.includes(zZ(process.env.ANTHROPIC_API_KEY))),type:"boolean",onChange(P6){g8((m6)=>{let O8={...m6};if(!O8.customApiKeyResponses)O8.customApiKeyResponses={approved:[],rejected:[]};if(!O8.customApiKeyResponses.approved)O8.customApiKeyResponses={...O8.customApiKeyResponses,approved:[]};if(!O8.customApiKeyResponses.rejected)O8.customApiKeyResponses={...O8.customApiKeyResponses,rejected:[]};if(process.env.ANTHROPIC_API_KEY){let G8=zZ(process.env.ANTHROPIC_API_KEY);if(P6)O8.customApiKeyResponses={...O8.customApiKeyResponses,approved:[...(O8.customApiKeyResponses.approved??[]).filter((i8)=>i8!==G8),G8],rejected:(O8.customApiKeyResponses.rejected??[]).filter((i8)=>i8!==G8)};else O8.customApiKeyResponses={...O8.customApiKeyResponses,approved:(O8.customApiKeyResponses.approved??[]).filter((i8)=>i8!==G8),rejected:[...(O8.customApiKeyResponses.rejected??[]).filter((i8)=>i8!==G8),G8]}}return O8}),J(j8())}}]:[]],L6=e2.useMemo(()=>{if(!u6)return W6;let P6=u6.toLowerCase();return W6.filter((m6)=>{if(m6.id.toLowerCase().includes(P6))return!0;return("searchText"in m6?m6.searchText:m6.label).toLowerCase().includes(P6)})},[W6,u6]);e2.useEffect(()=>{if(S>=L6.length){let P6=Math.max(0,L6.length-1);C(P6),u(Math.max(0,P6-U+1));return}u((P6)=>{if(S<P6)return S;if(S>=P6+U)return S-U+1;return P6})},[L6.length,S,U]);let I6=G1.useCallback((P6)=>{u((m6)=>{if(P6<m6)return P6;if(P6>=m6+U)return P6-U+1;return m6})},[U]),T6=G1.useCallback(()=>{if(U6!==null)return;let P6=Object.entries(f6).map(([i8,e8])=>{return Q("tengu_config_changed",{key:i8,value:e8}),`Set ${i8} to ${M8.bold(e8)}`}),m6=eG()?void 0:process.env.ANTHROPIC_API_KEY,O8=Boolean(m6&&P.current.customApiKeyResponses?.approved?.includes(zZ(m6))),G8=Boolean(m6&&M.customApiKeyResponses?.approved?.includes(zZ(m6)));if(O8!==G8)P6.push(`${G8?"Enabled":"Disabled"} custom API key`),Q("tengu_config_changed",{key:"env.ANTHROPIC_API_KEY",value:G8});if(M.theme!==P.current.theme)P6.push(`Set theme to ${M8.bold(M.theme)}`);if(M.preferredNotifChannel!==P.current.preferredNotifChannel)P6.push(`Set notifications to ${M8.bold(M.preferredNotifChannel)}`);if(Z!==k.current)P6.push(`Set output style to ${M8.bold(Z)}`);if(N!==L.current)P6.push(`Set response language to ${M8.bold(N??"Default (English)")}`);if(M.editorMode!==P.current.editorMode)P6.push(`Set editor mode to ${M8.bold(M.editorMode||"emacs")}`);if(M.diffTool!==P.current.diffTool)P6.push(`Set diff tool to ${M8.bold(M.diffTool)}`);if(M.autoConnectIde!==P.current.autoConnectIde)P6.push(`${M.autoConnectIde?"Enabled":"Disabled"} auto-connect to IDE`);if(M.autoInstallIdeExtension!==P.current.autoInstallIdeExtension)P6.push(`${M.autoInstallIdeExtension?"Enabled":"Disabled"} auto-install IDE extension`);if(M.autoCompactEnabled!==P.current.autoCompactEnabled)P6.push(`${M.autoCompactEnabled?"Enabled":"Disabled"} auto-compact`);if(M.respectGitignore!==P.current.respectGitignore)P6.push(`${M.respectGitignore?"Enabled":"Disabled"} respect .gitignore in file picker`);if(M.copyFullResponse!==P.current.copyFullResponse)P6.push(`${M.copyFullResponse?"Enabled":"Disabled"} always copy full response`);if(M.copyOnSelect!==P.current.copyOnSelect)P6.push(`${M.copyOnSelect?"Enabled":"Disabled"} copy on select`);if(M.terminalProgressBarEnabled!==P.current.terminalProgressBarEnabled)P6.push(`${M.terminalProgressBarEnabled?"Enabled":"Disabled"} terminal progress bar`);if(M.showStatusInTerminalTab!==P.current.showStatusInTerminalTab)P6.push(`${M.showStatusInTerminalTab?"Enabled":"Disabled"} terminal tab status`);if(M.showTurnDuration!==P.current.showTurnDuration)P6.push(`${M.showTurnDuration?"Enabled":"Disabled"} turn duration`);if(M.remoteControlAtStartup!==P.current.remoteControlAtStartup){let i8=M.remoteControlAtStartup===void 0?"Reset Remote Control to default":`${M.remoteControlAtStartup?"Enabled":"Disabled"} Remote Control for all sessions`;P6.push(i8)}if(X?.autoUpdatesChannel!==W.current?.autoUpdatesChannel)P6.push(`Set auto-update channel to ${M8.bold(X?.autoUpdatesChannel??"latest")}`);if(P6.length>0)q(P6.join(`
|
|
5470
5470
|
`));else q("Config dialog dismissed",{display:"system"})},[U6,f6,M,d,Z,N,X?.autoUpdatesChannel,x7()?X?.fastMode:void 0,q]),l6=G1.useCallback(()=>{if(j!==O6.current)H(O6.current);g8(()=>P.current);let P6=H6;gq("localSettings",{spinnerTipsEnabled:P6?.spinnerTipsEnabled,prefersReducedMotion:P6?.prefersReducedMotion,defaultView:P6?.defaultView,outputStyle:P6?.outputStyle});let m6=J6;gq("userSettings",{alwaysThinkingEnabled:m6?.alwaysThinkingEnabled,fastMode:m6?.fastMode,promptSuggestionEnabled:m6?.promptSuggestionEnabled,autoUpdatesChannel:m6?.autoUpdatesChannel,minimumVersion:m6?.minimumVersion,language:m6?.language,...{useAutoModeDuringPlan:m6?.useAutoModeDuringPlan},syntaxHighlightingDisabled:m6?.syntaxHighlightingDisabled,permissions:m6?.permissions===void 0?void 0:{...m6.permissions,defaultMode:m6.permissions.defaultMode}});let O8=A6;if(q6((G8)=>({...G8,mainLoopModel:O8.mainLoopModel,mainLoopModelForSession:O8.mainLoopModelForSession,verbose:O8.verbose,thinkingEnabled:O8.thinkingEnabled,fastMode:O8.fastMode,promptSuggestionEnabled:O8.promptSuggestionEnabled,isBriefOnly:O8.isBriefOnly,replBridgeEnabled:O8.replBridgeEnabled,replBridgeOutboundOnly:O8.replBridgeOutboundOnly,settings:O8.settings,toolPermissionContext:SH6(G8.toolPermissionContext)})),cu6()!==w6)PP6(w6)},[j,H,H6,J6,A6,w6,q6]),z8=G1.useCallback(()=>{if(U6!==null)return;if(v6.current)l6();q("Config dialog dismissed",{display:"system"})},[U6,l6,q]);Kq("confirm:no",z8,{context:"Settings",isActive:U6===null&&!m&&!Y}),Kq("settings:close",T6,{context:"Settings",isActive:U6===null&&!m&&!Y});let z6=G1.useCallback(()=>{let P6=L6[S];if(!P6||!P6.onChange)return;if(P6.type==="boolean"){if(v6.current=!0,P6.onChange(!P6.value),P6.id==="thinkingEnabled"){if(!P6.value===N6.current)n6(!1);else if(K.messages.some((G8)=>G8.type==="assistant"))n6(!0)}return}if(P6.id==="theme"||P6.id==="model"||P6.id==="teammateDefaultModel"||P6.id==="showExternalIncludesDialog"||P6.id==="outputStyle"||P6.id==="language")switch(P6.id){case"theme":d6("Theme"),_(!0);return;case"model":d6("Model"),_(!0);return;case"teammateDefaultModel":d6("TeammateModel"),_(!0);return;case"showExternalIncludesDialog":d6("ExternalIncludes"),_(!0);return;case"outputStyle":d6("OutputStyle"),_(!0);return;case"language":d6("Language"),_(!0);return}if(P6.id==="autoUpdatesChannel"){if(F6){d6("EnableAutoUpdates"),_(!0);return}if((X?.autoUpdatesChannel??"latest")==="latest")d6("ChannelDowngrade"),_(!0);else v6.current=!0,gq("userSettings",{autoUpdatesChannel:"latest",minimumVersion:void 0}),f((O8)=>({...O8,autoUpdatesChannel:"latest",minimumVersion:void 0})),Q("tengu_autoupdate_channel_changed",{channel:"latest"});return}if(P6.type==="enum"){v6.current=!0;let O8=(P6.options.indexOf(P6.value)+1)%P6.options.length;P6.onChange(P6.options[O8]);return}},[F6,L6,S,X?.autoUpdatesChannel,_]),B6=(P6)=>{n6(!1);let m6=Math.max(0,Math.min(L6.length-1,S+P6));C(m6),I6(m6)};CK({"select:previous":()=>{if(S===0)n6(!1),g(!0),u(0);else B6(-1)},"select:next":()=>B6(1),"scroll:lineUp":()=>B6(-1),"scroll:lineDown":()=>B6(1),"select:accept":z6,"settings:search":()=>{g(!0),R6("")}},{context:"Settings",isActive:U6===null&&!m&&!Y});let q8=G1.useCallback((P6)=>{if(U6!==null)return;if(Y){if(P6.key==="down")O();return}if(m){if(P6.key==="escape"){if(P6.preventDefault(),u6.length>0)R6("");else g(!1);return}if(P6.key==="return"||P6.key==="down"||P6.key==="wheeldown")P6.preventDefault(),g(!1),C(0),u(0);return}if(P6.key==="left"||P6.key==="right"||P6.key==="tab"){P6.preventDefault(),z6();return}if(P6.ctrl||P6.meta)return;if(P6.key==="j"||P6.key==="k"||P6.key==="/")return;if(P6.key.length===1&&P6.key!==" ")P6.preventDefault(),g(!0),R6(P6.key)},[U6,Y,m,u6,R6,z6,O]);return AK.jsxDEV(I,{flexDirection:"column",width:"100%",tabIndex:0,autoFocus:!0,onKeyDown:q8,children:U6==="Theme"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(dH6,{onThemeSelect:(P6)=>{v6.current=!0,H(P6),d6(null),_(!1)},onCancel:()=>{d6(null),_(!1)},hideEscToCancel:!0,skipExitHandling:!0},void 0,!1,void 0,this),AK.jsxDEV(I,{children:AK.jsxDEV(T,{dimColor:!0,italic:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(c8,{shortcut:"Enter",action:"select"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):U6==="Model"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(L86,{initial:d,onSelect:(P6,m6)=>{v6.current=!0,k6(P6),d6(null),_(!1)},onCancel:()=>{d6(null),_(!1)},showFastModeNotice:x7()?n&&rw(d)&&b1():!1},void 0,!1,void 0,this),AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):U6==="TeammateModel"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(L86,{initial:M.teammateDefaultModel??null,skipSettingsWrite:!0,headerText:"Default model for newly spawned teammates. The leader can override via the tool call's model parameter.",onSelect:(P6,m6)=>{if(d6(null),_(!1),M.teammateDefaultModel===void 0&&P6===null)return;v6.current=!0,g8((O8)=>O8.teammateDefaultModel===P6?O8:{...O8,teammateDefaultModel:P6}),J({...j8(),teammateDefaultModel:P6}),$6((O8)=>({...O8,teammateDefaultModel:gT_(P6)})),Q("tengu_teammate_default_model_changed",{model:P6})},onCancel:()=>{d6(null),_(!1)}},void 0,!1,void 0,this),AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):U6==="ExternalIncludes"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(Q$q,{onDone:()=>{d6(null),_(!1)},externalIncludes:h06(S6)},void 0,!1,void 0,this),AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"disable external includes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):U6==="OutputStyle"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(bT_,{initialStyle:Z,onComplete:(P6)=>{v6.current=!0,v(P6??nf),d6(null),_(!1),gq("localSettings",{outputStyle:P6}),Q("tengu_output_style_changed",{style:P6??nf,source:"config_panel",settings_source:"localSettings"})},onCancel:()=>{d6(null),_(!1)}},void 0,!1,void 0,this),AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):U6==="Language"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(uT_,{initialLanguage:N,onComplete:(P6)=>{v6.current=!0,y(P6),d6(null),_(!1),gq("userSettings",{language:P6}),Q("tengu_language_changed",{language:P6??"default",source:"config_panel"})},onCancel:()=>{d6(null),_(!1)}},void 0,!1,void 0,this),AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):U6==="EnableAutoUpdates"?AK.jsxDEV(Pq,{title:"Enable Auto-Updates",onCancel:()=>{d6(null),_(!1)},hideBorder:!0,hideInputGuide:!0,children:F6?.type!=="config"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(T,{children:F6?.type==="env"?"Auto-updates are controlled by an environment variable and cannot be changed here.":"Auto-updates are disabled in development builds."},void 0,!1,void 0,this),F6?.type==="env"&&AK.jsxDEV(T,{dimColor:!0,children:["Unset ",F6.envVar," to re-enable auto-updates."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):AK.jsxDEV(r8,{options:[{label:"Enable with latest channel",value:"latest"},{label:"Enable with stable channel",value:"stable"}],onChange:(P6)=>{v6.current=!0,d6(null),_(!1),g8((m6)=>({...m6,autoUpdates:!0})),J({...j8(),autoUpdates:!0}),gq("userSettings",{autoUpdatesChannel:P6,minimumVersion:void 0}),f((m6)=>({...m6,autoUpdatesChannel:P6,minimumVersion:void 0})),Q("tengu_autoupdate_enabled",{channel:P6})}},void 0,!1,void 0,this)},void 0,!1,void 0,this):U6==="ChannelDowngrade"?AK.jsxDEV(hT_,{currentVersion:"99.0.0",onChoice:(P6)=>{if(d6(null),_(!1),P6==="cancel")return;v6.current=!0;let m6={autoUpdatesChannel:"stable"};if(P6==="stay")m6.minimumVersion="99.0.0";gq("userSettings",m6),f((O8)=>({...O8,...m6})),Q("tengu_autoupdate_channel_changed",{channel:"stable",minimum_version_set:P6==="stay"})}},void 0,!1,void 0,this):AK.jsxDEV(I,{flexDirection:"column",gap:1,marginY:w?void 0:1,children:[AK.jsxDEV(jL,{query:u6,isFocused:m&&!Y,isTerminalFocused:B,cursorOffset:Z6,placeholder:"Search settings…"},void 0,!1,void 0,this),AK.jsxDEV(I,{flexDirection:"column",children:L6.length===0?AK.jsxDEV(T,{dimColor:!0,italic:!0,children:['No settings match "',u6,'"']},void 0,!0,void 0,this):AK.jsxDEV(AK.Fragment,{children:[b>0&&AK.jsxDEV(T,{dimColor:!0,children:[t6.arrowUp," ",b," more above"]},void 0,!0,void 0,this),L6.slice(b,b+U).map((P6,m6)=>{let G8=b+m6===S&&!Y&&!m;return AK.jsxDEV(e2.Fragment,{children:AK.jsxDEV(I,{children:[AK.jsxDEV(I,{width:44,children:AK.jsxDEV(T,{color:G8?"suggestion":void 0,children:[G8?t6.pointer:" "," ",P6.label]},void 0,!0,void 0,this)},void 0,!1,void 0,this),AK.jsxDEV(I,{children:P6.type==="boolean"?AK.jsxDEV(AK.Fragment,{children:[AK.jsxDEV(T,{color:G8?"suggestion":void 0,children:P6.value.toString()},void 0,!1,void 0,this),C6&&P6.id==="thinkingEnabled"&&AK.jsxDEV(T,{color:"warning",children:[" ","Changing thinking mode mid-conversation will increase latency and may reduce quality."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):P6.id==="theme"?AK.jsxDEV(T,{color:G8?"suggestion":void 0,children:Yz5[P6.value.toString()]??P6.value.toString()},void 0,!1,void 0,this):P6.id==="notifChannel"?AK.jsxDEV(T,{color:G8?"suggestion":void 0,children:AK.jsxDEV($z5,{value:P6.value.toString()},void 0,!1,void 0,this)},void 0,!1,void 0,this):P6.id==="defaultPermissionMode"?AK.jsxDEV(T,{color:G8?"suggestion":void 0,children:gy(P6.value)},void 0,!1,void 0,this):P6.id==="autoUpdatesChannel"&&F6?AK.jsxDEV(I,{flexDirection:"column",children:[AK.jsxDEV(T,{color:G8?"suggestion":void 0,children:"disabled"},void 0,!1,void 0,this),AK.jsxDEV(T,{dimColor:!0,children:["(",lW6(F6),")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):AK.jsxDEV(T,{color:G8?"suggestion":void 0,children:P6.value.toString()},void 0,!1,void 0,this)},G8?"selected":"unselected",!1,void 0,this)]},void 0,!0,void 0,this)},P6.id,!1,void 0,this)}),b+U<L6.length&&AK.jsxDEV(T,{dimColor:!0,children:[t6.arrowDown," ",L6.length-b-U," ","more below"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Y?AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(c8,{shortcut:"←/→ tab",action:"switch"},void 0,!1,void 0,this),AK.jsxDEV(c8,{shortcut:"↓",action:"return"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):m?AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(T,{children:"Type to filter"},void 0,!1,void 0,this),AK.jsxDEV(c8,{shortcut:"Enter/↓",action:"select"},void 0,!1,void 0,this),AK.jsxDEV(c8,{shortcut:"↑",action:"tabs"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):AK.jsxDEV(T,{dimColor:!0,children:AK.jsxDEV(fq,{children:[AK.jsxDEV(qq,{action:"select:accept",context:"Settings",fallback:"Space",description:"change"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"settings:close",context:"Settings",fallback:"Enter",description:"save"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"settings:search",context:"Settings",fallback:"/",description:"search"},void 0,!1,void 0,this),AK.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function gT_(q){if(q===void 0)return yf(oh6());if(q===null)return"Default (leader's model)";return yf(q)}function $z5(q){let K=BT_.c(4),{value:_}=q;switch(_){case"auto":return"Auto";case"iterm2":{let A;if(K[0]===Symbol.for("react.memo_cache_sentinel"))A=AK.jsxDEV(T,{children:["iTerm2 ",AK.jsxDEV(T,{dimColor:!0,children:"(OSC 9)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[0]=A;else A=K[0];return A}case"terminal_bell":{let A;if(K[1]===Symbol.for("react.memo_cache_sentinel"))A=AK.jsxDEV(T,{children:["Terminal Bell ",AK.jsxDEV(T,{dimColor:!0,children:"(\\a)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[1]=A;else A=K[1];return A}case"kitty":{let A;if(K[2]===Symbol.for("react.memo_cache_sentinel"))A=AK.jsxDEV(T,{children:["Kitty ",AK.jsxDEV(T,{dimColor:!0,children:"(OSC 99)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[2]=A;else A=K[2];return A}case"ghostty":{let A;if(K[3]===Symbol.for("react.memo_cache_sentinel"))A=AK.jsxDEV(T,{children:["Ghostty ",AK.jsxDEV(T,{dimColor:!0,children:"(OSC 777)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[3]=A;else A=K[3];return A}case"iterm2_with_bell":return"iTerm2 w/ Bell";case"notifications_disabled":return"Disabled";default:return _}}var BT_,e2,G1,AK,Yz5;var FT_=h(()=>{a6();TK();__();Tq();xv6();Tq();jA();vj();LH();N8();UH6();B38();KK();d38();Y_();Q38();l$q();ST_();J7();Jz();IT_();pT_();CH();t7();k4();S7();UN();kE();C86();F3();Rq();v8();$E();I8();iY();le();RAq();Il();A7();Y2();yH();BT_=p(A8(),1),e2=p(_8(),1),G1=p(_8(),1),AK=p(a(),1);Yz5={auto:"Auto (match terminal)",dark:"Dark mode",light:"Light mode","dark-daltonized":"Dark mode (colorblind-friendly)","light-daltonized":"Light mode (colorblind-friendly)","dark-ansi":"Dark mode (ANSI colors only)","light-ansi":"Light mode (ANSI colors only)"}});function UT_(){return r$q}function r38(){return n$q}async function WE6(){let q=await ZD6();if(!q)return;try{let K=await fetch(`${PR()}/puku/v1/subscription`,{headers:{Authorization:`Bearer ${q.token}`}});if(!K.ok)return;let A=(await K.json()).quotas?.chat;if(A?.req_limit!==void 0&&A?.used_req!==void 0){r$q={used_req:A.used_req,req_limit:A.req_limit};for(let Y of l38)Y(r$q)}let z=A?.windows;if(z){n$q={fiveHour:z.fiveHour??null,weekly:z.weekly??null,monthly:z.monthly??null};for(let Y of i38)Y(n$q)}}catch{}}var r$q=null,l38,n$q=null,i38;var n38=h(()=>{Fr6();l38=new Set,i38=new Set});function dT_(){let[q,K]=iH6.useState(UT_());return iH6.useEffect(()=>{let _=(A)=>{K(A)};return l38.add(_),()=>{l38.delete(_)}},[]),q}function QT_(){let[q,K]=iH6.useState(r38());return iH6.useEffect(()=>{let _=(A)=>{K(A)};return i38.add(_),()=>{i38.delete(_)}},[]),q}var iH6;var o$q=h(()=>{n38();iH6=p(_8(),1)});function a$q({title:q,window:K,maxWidth:_}){let A=K.limit>0?Math.min(1,K.used/K.limit):0,z=(A*100).toFixed(1),Y=n76(K.resetsAt,!1,!0),$=Math.max(10,Math.min(_-30,20));return fG.jsxDEV(I,{flexDirection:"column",children:[fG.jsxDEV(T,{bold:!0,children:q},void 0,!1,void 0,this),fG.jsxDEV(I,{flexDirection:"row",gap:1,children:[fG.jsxDEV(fE,{ratio:A,width:$,fillColor:"rate_limit_fill",emptyColor:"rate_limit_empty"},void 0,!1,void 0,this),fG.jsxDEV(T,{children:[z,"% (",K.used," / ",K.limit,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),fG.jsxDEV(T,{dimColor:!0,children:[" Resets at: ",Y]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function iT_(){let q=QT_();if(lT_.useEffect(()=>{if(!r38())WE6()},[]),!q)return fG.jsxDEV(I,{flexDirection:"column",gap:1,children:fG.jsxDEV(T,{dimColor:!0,children:"Loading usage data…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let K=q.fiveHour||q.weekly||q.monthly,_=80;return fG.jsxDEV(I,{flexDirection:"column",gap:1,width:"100%",children:[!K&&fG.jsxDEV(T,{dimColor:!0,children:"No usage data available."},void 0,!1,void 0,this),q.fiveHour&&fG.jsxDEV(a$q,{title:"Five Hour Usage:",window:q.fiveHour,maxWidth:_},void 0,!1,void 0,this),q.weekly&&fG.jsxDEV(a$q,{title:"Weekly Usage:",window:q.weekly,maxWidth:_},void 0,!1,void 0,this),q.monthly&&fG.jsxDEV(a$q,{title:"Monthly Usage:",window:q.monthly,maxWidth:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var lT_,fG;var rT_=h(()=>{a6();n38();o$q();Ey6();vK();lT_=p(_8(),1),fG=p(a(),1)});function s$q(){let q=dV6();if(!q||!q.available||q.granted)return!1;return QV6(q)!==null}function sT_(){if(!s$q())return!1;let q=j8();if(q.hasVisitedExtraUsage)return!1;if((q.overageCreditUpsellSeenCount??0)>=wz5)return!1;return!0}function Hz5(q){return`${q} in extra usage for third-party apps · /extra-usage`}function oT_(q){return`${q} in extra usage`}function tT_(q){let K=aT_.c(8),{maxWidth:_,twoLine:A}=q,z,Y;if(K[0]!==_||K[1]!==A){Y=Symbol.for("react.early_return_sentinel");q:{let $=dV6();if(!$){Y=null;break q}let O=QV6($);if(!O){Y=null;break q}if(A){let M=oT_(O),J;if(K[4]!==_)J=_?Z5(nT_,_):nT_,K[4]=_,K[5]=J;else J=K[5];let P;if(K[6]!==J)P=xl.jsxDEV(T,{dimColor:!0,children:J},void 0,!1,void 0,this),K[6]=J,K[7]=P;else P=K[7];Y=xl.jsxDEV(xl.Fragment,{children:[xl.jsxDEV(T,{color:"puku",children:_?Z5(M,_):M},void 0,!1,void 0,this),P]},void 0,!0,void 0,this);break q}let w=Hz5(O),H=_?Z5(w,_):w,j=Math.min(oT_(O).length,H.length);z=xl.jsxDEV(T,{dimColor:!0,children:[xl.jsxDEV(T,{color:"puku",children:H.slice(0,j)},void 0,!1,void 0,this),H.slice(j)]},void 0,!0,void 0,this)}K[0]=_,K[1]=A,K[2]=z,K[3]=Y}else z=K[2],Y=K[3];if(Y!==Symbol.for("react.early_return_sentinel"))return Y;return z}var aT_,Oz5,xl,wz5=3,nT_="On us. Works on third-party apps · /extra-usage";var t$q=h(()=>{a6();G48();Tq();vK();aT_=p(A8(),1),Oz5=p(_8(),1),xl=p(a(),1)});function GE6(q){return typeof q==="object"&&q!==null}function ML(q){return typeof q==="string"&&q.trim()?q.trim():void 0}function rH6(q){return typeof q==="number"&&Number.isFinite(q)?q:void 0}function e$q(q){return typeof q==="boolean"?q:void 0}function qOq(q){let K=rH6(q);if(K===void 0)return;return new Date(K*1000).toISOString()}function o38(q){if(!GE6(q))return;let K=rH6(q.used_percent)??rH6(q.usedPercent);if(K===void 0)return;let _=rH6(q.window_minutes)??rH6(q.windowDurationMins)??(()=>{let z=rH6(q.limit_window_seconds);return z===void 0?void 0:Math.round(z/60)})(),A=qOq(q.resets_at)??qOq(q.resetsAt)??qOq(q.reset_at);return{usedPercent:K,windowMinutes:_,resetsAt:A}}function q0_(q){if(!GE6(q))return;let K=e$q(q.has_credits)??e$q(q.hasCredits)??!1,_=e$q(q.unlimited)??!1,A=ML(q.balance);if(!K&&!_&&!A)return;return{hasCredits:K,unlimited:_,balance:A}}function ZE6(q,K){if(!GE6(q))return;let _=ML(q.limit_name)??ML(q.limitName)??ML(q.limit_id)??ML(q.limitId)??K,A=o38(q.primary)??o38(q.primary_window),z=o38(q.secondary)??o38(q.secondary_window),Y=q0_(q.credits);if(!A&&!z&&!Y)return;return{limitName:_,primary:A,secondary:z,credits:Y}}function KOq(q,K="codex"){if(Array.isArray(q))return q.map((_,A)=>ZE6(_,A===0?K:`${K}-${A+1}`)).filter((_)=>_!==void 0);if(!GE6(q))return[];return Object.entries(q).map(([_,A])=>ZE6(A,_)).filter((_)=>_!==void 0)}function jz5(q){let K=ML(q.plan_type)??ML(q.planType),_=[],A=q0_(q.credits),z=ZE6(q.rate_limit,"codex");if(z)z.credits??=A,_.push(z);else if(A)_.push({limitName:"codex",credits:A});let Y=ZE6(q.code_review_rate_limit,"code review");if(Y)_.push(Y);return _.push(...KOq(q.additional_rate_limits??q.additionalRateLimits,"additional")),{planType:K,snapshots:_}}function Mz5(q){if(Array.isArray(q))return{snapshots:KOq(q)};if(!GE6(q))return{snapshots:[]};if("rate_limit"in q||"code_review_rate_limit"in q||"additional_rate_limits"in q||"credits"in q)return jz5(q);let K=q.rate_limits??q.rateLimits??q.rate_limits_by_limit_id??q.rateLimitsByLimitId;if(K!==void 0)return{planType:ML(q.plan_type)??ML(q.planType),snapshots:KOq(K)};let _=ZE6(q,"codex");return{planType:ML(q.plan_type)??ML(q.planType),snapshots:_?[_]:[]}}function nH6(q){if(!q)return q;return q[0].toUpperCase()+q.slice(1)}function eT_(q,K){if(q===void 0||q<=0)return K;if(q===10080)return"weekly";if(q%1440===0)return`${q/1440}d`;if(q%60===0)return`${q/60}h`;return`${q}m`}function Jz5(q){let K=q?.trim();if(!K)return;let _=Number.parseInt(K,10);if(Number.isFinite(_)&&`${_}`===K&&_>0)return`${_}`;let A=Number.parseFloat(K);if(Number.isFinite(A)&&A>0)return`${Math.round(A)}`;return}function Pz5(q){if(!q?.hasCredits)return;if(q.unlimited)return{kind:"text",label:"Credits",value:"Unlimited"};let K=Jz5(q.balance);if(!K)return;return{kind:"text",label:"Credits",value:`${K} credits`}}function K0_(q){let K=[];for(let _ of q){let A=_.limitName.trim()||"codex",z=Pz5(_.credits);if(!(_.primary!==void 0||_.secondary!==void 0||z!==void 0))continue;let $=A.toLowerCase()!=="codex",O=Number(_.primary!==void 0)+Number(_.secondary!==void 0),w=$&&O===1;if($&&!w)K.push({kind:"text",label:`${nH6(A)} limit`,value:""});if(_.primary){let H=nH6(eT_(_.primary.windowMinutes,"5h"));K.push({kind:"window",label:w?`${nH6(A)} ${H} limit`:`${H} limit`,usedPercent:_.primary.usedPercent,resetsAt:_.primary.resetsAt})}if(_.secondary){let H=nH6(eT_(_.secondary.windowMinutes,"weekly"));K.push({kind:"window",label:w?`${nH6(A)} ${H} limit`:`${H} limit`,usedPercent:_.secondary.usedPercent,resetsAt:_.secondary.resetsAt})}if(z)K.push(z)}return K}function _0_(q){if(!q)return;return q.split(/[_\s-]+/).filter(Boolean).map((K)=>nH6(K.toLowerCase())).join(" ")}function Xz5(q=Ub){return new URL("/backend-api/wham/usage",q).toString()}async function A0_(){let q=GM({model:process.env.OPENAI_MODEL,baseUrl:process.env.OPENAI_BASE_URL});if(!p26(q.baseUrl))throw Error("Codex usage is only available with the official ChatGPT Codex backend.");let K=qv();if(!K.apiKey){let A=K.authPath?` or place a Codex auth.json at ${K.authPath}`:"";throw Error(`Codex auth is required. Set CODEX_API_KEY${A}.`)}if(!K.accountId)throw Error("Codex auth is missing chatgpt_account_id. Re-login with the Codex CLI or set CHATGPT_ACCOUNT_ID/CODEX_ACCOUNT_ID.");let _=await fetch(Xz5(q.baseUrl),{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${K.apiKey}`,"chatgpt-account-id":K.accountId,originator:"puku-cli"},signal:AbortSignal.timeout(5000)});if(!_.ok){let A=await _.text().catch(()=>"unknown error");throw Error(`Codex usage error ${_.status}: ${A}`)}return Mz5(await _.json())}var z0_=h(()=>{db()});function fz5({label:q,usedPercent:K,resetsAt:_,maxWidth:A}){let z=Math.max(0,Math.min(100,K)),Y=`${Math.floor(z)}% used`,$=_?`Resets ${n76(_,!0,!0)}`:void 0;if(A>=62)return o5.jsxDEV(I,{flexDirection:"column",children:[o5.jsxDEV(T,{bold:!0,children:q},void 0,!1,void 0,this),o5.jsxDEV(I,{flexDirection:"row",gap:1,children:[o5.jsxDEV(fE,{ratio:z/100,width:50,fillColor:"rate_limit_fill",emptyColor:"rate_limit_empty"},void 0,!1,void 0,this),o5.jsxDEV(T,{children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$?o5.jsxDEV(T,{dimColor:!0,children:$},void 0,!1,void 0,this):null]},void 0,!0,void 0,this);return o5.jsxDEV(I,{flexDirection:"column",children:[o5.jsxDEV(T,{children:[o5.jsxDEV(T,{bold:!0,children:q},void 0,!1,void 0,this),$?o5.jsxDEV(o5.Fragment,{children:[o5.jsxDEV(T,{children:" "},void 0,!1,void 0,this),o5.jsxDEV(T,{dimColor:!0,children:["· ",$]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):null]},void 0,!0,void 0,this),o5.jsxDEV(fE,{ratio:z/100,width:A,fillColor:"rate_limit_fill",emptyColor:"rate_limit_empty"},void 0,!1,void 0,this),o5.jsxDEV(T,{children:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Wz5({label:q,value:K}){if(!K)return o5.jsxDEV(T,{bold:!0,children:q},void 0,!1,void 0,this);return o5.jsxDEV(T,{children:[o5.jsxDEV(T,{bold:!0,children:q},void 0,!1,void 0,this),o5.jsxDEV(T,{dimColor:!0,children:[" · ",K]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $0_(){let[q,K]=oH6.useState(null),[_,A]=oH6.useState(null),[z,Y]=oH6.useState(!0),{columns:$}=Eq(),O=$-2,w=Math.min(O,80),H=Y0_.useCallback(async()=>{Y(!0),A(null);try{K(await A0_())}catch(J){_6(J),A(J instanceof Error?J.message:"Failed to load Codex usage")}finally{Y(!1)}},[]);if(oH6.useEffect(()=>{H()},[H]),Kq("settings:retry",()=>{H()},{context:"Settings",isActive:!!_&&!z}),_)return o5.jsxDEV(I,{flexDirection:"column",gap:1,children:[o5.jsxDEV(T,{color:"error",children:["Error: ",_]},void 0,!0,void 0,this),o5.jsxDEV(T,{dimColor:!0,children:o5.jsxDEV(fq,{children:[o5.jsxDEV(qq,{action:"settings:retry",context:"Settings",fallback:"r",description:"retry"},void 0,!1,void 0,this),o5.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(!q)return o5.jsxDEV(I,{flexDirection:"column",gap:1,children:[o5.jsxDEV(T,{dimColor:!0,children:"Loading Codex usage data…"},void 0,!1,void 0,this),o5.jsxDEV(T,{dimColor:!0,children:o5.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let j=K0_(q.snapshots),M=_0_(q.planType);return o5.jsxDEV(I,{flexDirection:"column",gap:1,width:"100%",children:[M?o5.jsxDEV(T,{dimColor:!0,children:["Plan: ",M]},void 0,!0,void 0,this):null,j.length===0?o5.jsxDEV(T,{dimColor:!0,children:"Codex usage data is not available for this account."},void 0,!1,void 0,this):null,j.map((J,P)=>J.kind==="window"?o5.jsxDEV(fz5,{label:J.label,usedPercent:J.usedPercent,resetsAt:J.resetsAt,maxWidth:w},`${J.label}-${P}`,!1,void 0,this):o5.jsxDEV(Wz5,{label:J.label,value:J.value},`${J.label}-${P}`,!1,void 0,this)),o5.jsxDEV(T,{dimColor:!0,children:o5.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Y0_,oH6,o5;var O0_=h(()=>{A7();a6();TK();z0_();vK();N8();k4();S7();Ey6();Y0_=p(_8(),1),oH6=p(_8(),1),o5=p(a(),1)});function H0_(q){let K=AOq.c(34),{title:_,limit:A,maxWidth:z,showTimeInReset:Y,extraSubtext:$}=q,O=Y===void 0?!0:Y,{utilization:w,resets_at:H}=A;if(w===null)return null;let j=`${Math.floor(w)}% used`,M;if(H){let J;if(K[0]!==H||K[1]!==O)J=n76(H,!0,O),K[0]=H,K[1]=O,K[2]=J;else J=K[2];M=`Resets ${J}`}if($)if(M)M=`${$} · ${M}`;else M=$;if(z>=62){let J;if(K[3]!==_)J=mA.jsxDEV(T,{bold:!0,children:_},void 0,!1,void 0,this),K[3]=_,K[4]=J;else J=K[4];let P=w/100,X;if(K[5]!==P)X=mA.jsxDEV(fE,{ratio:P,width:50,fillColor:"rate_limit_fill",emptyColor:"rate_limit_empty"},void 0,!1,void 0,this),K[5]=P,K[6]=X;else X=K[6];let f;if(K[7]!==j)f=mA.jsxDEV(T,{children:j},void 0,!1,void 0,this),K[7]=j,K[8]=f;else f=K[8];let W;if(K[9]!==X||K[10]!==f)W=mA.jsxDEV(I,{flexDirection:"row",gap:1,children:[X,f]},void 0,!0,void 0,this),K[9]=X,K[10]=f,K[11]=W;else W=K[11];let Z;if(K[12]!==M)Z=M&&mA.jsxDEV(T,{dimColor:!0,children:M},void 0,!1,void 0,this),K[12]=M,K[13]=Z;else Z=K[13];let v;if(K[14]!==J||K[15]!==W||K[16]!==Z)v=mA.jsxDEV(I,{flexDirection:"column",children:[J,W,Z]},void 0,!0,void 0,this),K[14]=J,K[15]=W,K[16]=Z,K[17]=v;else v=K[17];return v}else{let J;if(K[18]!==_)J=mA.jsxDEV(T,{bold:!0,children:_},void 0,!1,void 0,this),K[18]=_,K[19]=J;else J=K[19];let P;if(K[20]!==M)P=M&&mA.jsxDEV(mA.Fragment,{children:[mA.jsxDEV(T,{children:" "},void 0,!1,void 0,this),mA.jsxDEV(T,{dimColor:!0,children:["· ",M]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[20]=M,K[21]=P;else P=K[21];let X;if(K[22]!==J||K[23]!==P)X=mA.jsxDEV(T,{children:[J,P]},void 0,!0,void 0,this),K[22]=J,K[23]=P,K[24]=X;else X=K[24];let f=w/100,W;if(K[25]!==z||K[26]!==f)W=mA.jsxDEV(fE,{ratio:f,width:z,fillColor:"rate_limit_fill",emptyColor:"rate_limit_empty"},void 0,!1,void 0,this),K[25]=z,K[26]=f,K[27]=W;else W=K[27];let Z;if(K[28]!==j)Z=mA.jsxDEV(T,{children:j},void 0,!1,void 0,this),K[28]=j,K[29]=Z;else Z=K[29];let v;if(K[30]!==X||K[31]!==W||K[32]!==Z)v=mA.jsxDEV(I,{flexDirection:"column",children:[X,W,Z]},void 0,!0,void 0,this),K[30]=X,K[31]=W,K[32]=Z,K[33]=v;else v=K[33];return v}}function Zz5(){let[q,K]=aH6.useState(null),[_,A]=aH6.useState(null),[z,Y]=aH6.useState(!0),{columns:$}=Eq(),O=$-2,w=Math.min(O,80),H=w0_.useCallback(async()=>{Y(!0),A(null);try{let P=await m96();K(P)}catch(P){_6(P);let X=P,f=X.response?.data?c6(X.response.data):void 0;A(f?`Failed to load usage data: ${f}`:"Failed to load usage data")}finally{Y(!1)}},[]);if(aH6.useEffect(()=>{H()},[H]),Kq("settings:retry",()=>{H()},{context:"Settings",isActive:!!_&&!z}),_)return mA.jsxDEV(I,{flexDirection:"column",gap:1,children:[mA.jsxDEV(T,{color:"error",children:["Error: ",_]},void 0,!0,void 0,this),mA.jsxDEV(T,{dimColor:!0,children:mA.jsxDEV(fq,{children:[mA.jsxDEV(qq,{action:"settings:retry",context:"Settings",fallback:"r",description:"retry"},void 0,!1,void 0,this),mA.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(!q)return mA.jsxDEV(I,{flexDirection:"column",gap:1,children:[mA.jsxDEV(T,{dimColor:!0,children:"Loading usage data…"},void 0,!1,void 0,this),mA.jsxDEV(T,{dimColor:!0,children:mA.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let j=v4(),M=j==="max"||j==="team"||j===null,J=[{title:"Current session",limit:q.five_hour},{title:"Current week (all models)",limit:q.seven_day},...M?[{title:"Current week (Sonnet only)",limit:q.seven_day_sonnet}]:[]];return mA.jsxDEV(I,{flexDirection:"column",gap:1,width:"100%",children:[J.some(({limit:P})=>P)||mA.jsxDEV(T,{dimColor:!0,children:"/usage is only available for subscription plans."},void 0,!1,void 0,this),J.map(({title:P,limit:X})=>X&&mA.jsxDEV(H0_,{title:P,limit:X,maxWidth:w},P,!1,void 0,this)),q.extra_usage&&mA.jsxDEV(Gz5,{extraUsage:q.extra_usage,maxWidth:w},void 0,!1,void 0,this),s$q()&&mA.jsxDEV(tT_,{maxWidth:w},void 0,!1,void 0,this),mA.jsxDEV(T,{dimColor:!0,children:mA.jsxDEV(qq,{action:"confirm:no",context:"Settings",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function j0_(){if(Xq()==="codex")return mA.jsxDEV($0_,{},void 0,!1,void 0,this);if(!BK())return mA.jsxDEV(iT_,{},void 0,!1,void 0,this);return mA.jsxDEV(Zz5,{},void 0,!1,void 0,this)}function Gz5(q){let K=AOq.c(20),{extraUsage:_,maxWidth:A}=q,z=v4();if(!(z==="pro"||z==="max"))return!1;if(!_.is_enabled){if(TQ.isEnabled()){let k;if(K[0]===Symbol.for("react.memo_cache_sentinel"))k=mA.jsxDEV(I,{flexDirection:"column",children:[mA.jsxDEV(T,{bold:!0,children:_Oq},void 0,!1,void 0,this),mA.jsxDEV(T,{dimColor:!0,children:"Extra usage not enabled · /extra-usage to enable"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[0]=k;else k=K[0];return k}return null}if(_.monthly_limit===null){let k;if(K[1]===Symbol.for("react.memo_cache_sentinel"))k=mA.jsxDEV(I,{flexDirection:"column",children:[mA.jsxDEV(T,{bold:!0,children:_Oq},void 0,!1,void 0,this),mA.jsxDEV(T,{dimColor:!0,children:"Unlimited"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[1]=k;else k=K[1];return k}if(typeof _.used_credits!=="number"||typeof _.utilization!=="number")return null;let $=_.used_credits/100,O;if(K[2]!==$)O=Kh6($,2),K[2]=$,K[3]=O;else O=K[3];let w=O,H=_.monthly_limit/100,j;if(K[4]!==H)j=Kh6(H,2),K[4]=H,K[5]=j;else j=K[5];let M=j,J,P,X,f;if(K[6]!==_.utilization){let k=new Date,N=new Date(k.getFullYear(),k.getMonth()+1,1);J=H0_,f=_Oq,P=_.utilization,X=N.toISOString(),K[6]=_.utilization,K[7]=J,K[8]=P,K[9]=X,K[10]=f}else J=K[7],P=K[8],X=K[9],f=K[10];let W;if(K[11]!==P||K[12]!==X)W={utilization:P,resets_at:X},K[11]=P,K[12]=X,K[13]=W;else W=K[13];let Z=`${w} / ${M} spent`,v;if(K[14]!==J||K[15]!==A||K[16]!==f||K[17]!==W||K[18]!==Z)v=mA.jsxDEV(J,{title:f,limit:W,showTimeInReset:!1,extraSubtext:Z,maxWidth:A},void 0,!1,void 0,this),K[14]=J,K[15]=A,K[16]=f,K[17]=W,K[18]=Z,K[19]=v;else v=K[19];return v}var AOq,w0_,aH6,mA,_Oq="Extra usage";var M0_=h(()=>{lV6();kN();GK();rT_();A7();a6();TK();v48();vK();N8();C4();l8();k4();S7();Ey6();t$q();O0_();AOq=p(A8(),1),w0_=p(_8(),1),aH6=p(_8(),1),mA=p(a(),1)});function sH6(q){let K=J0_.c(25),{onClose:_,context:A,defaultTab:z}=q,[Y,$]=ul.useState(z),[O,w]=ul.useState(!1),[H,j]=ul.useState(!1),[M,J]=ul.useState(!1),P=FZ(),{rows:X}=JK8(Eq()),f=P?X+1:Math.max(15,Math.min(Math.floor(X*0.8),30)),[W]=ul.useState(vz5);x4();let Z;if(K[0]!==_||K[1]!==O)Z=()=>{if(O)return;_("Status dialog dismissed",{display:"system"})},K[0]=_,K[1]=O,K[2]=Z;else Z=K[2];let v=Z,k=!O&&!(Y==="Config"&&H)&&!(Y==="Gates"&&M),N;if(K[3]!==k)N={context:"Settings",isActive:k},K[3]=k,K[4]=N;else N=K[4];Kq("confirm:no",v,N);let y;if(K[5]!==A||K[6]!==W)y=EC.jsxDEV(ZO,{title:"Status",children:EC.jsxDEV(ZT_,{context:A,diagnosticsPromise:W},void 0,!1,void 0,this)},"status",!1,void 0,this),K[5]=A,K[6]=W,K[7]=y;else y=K[7];let L;if(K[8]!==f||K[9]!==A||K[10]!==_)L=EC.jsxDEV(ZO,{title:"Config",children:EC.jsxDEV(ul.Suspense,{fallback:null,children:EC.jsxDEV(cT_,{context:A,onClose:_,setTabsHidden:w,onIsSearchModeChange:j,contentHeight:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)},"config",!1,void 0,this),K[8]=f,K[9]=A,K[10]=_,K[11]=L;else L=K[11];let S;if(K[12]===Symbol.for("react.memo_cache_sentinel"))S=EC.jsxDEV(ZO,{title:"Usage",children:EC.jsxDEV(j0_,{},void 0,!1,void 0,this)},"usage",!1,void 0,this),K[12]=S;else S=K[12];let C;if(K[13]!==f)C=[],K[13]=f,K[14]=C;else C=K[14];let b;if(K[15]!==y||K[16]!==L||K[17]!==C)b=[y,L,S,...C],K[15]=y,K[16]=L,K[17]=C,K[18]=b;else b=K[18];let u=b,m=z!=="Config"&&z!=="Gates",g=O||P?void 0:f,B;if(K[19]!==Y||K[20]!==g||K[21]!==m||K[22]!==u||K[23]!==O)B=EC.jsxDEV(Mz,{color:"permission",children:EC.jsxDEV(FN,{color:"permission",selectedTab:Y,onTabChange:$,hidden:O,initialHeaderFocused:m,contentHeight:g,children:u},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[19]=Y,K[20]=g,K[21]=m,K[22]=u,K[23]=O,K[24]=B;else B=K[24];return B}function vz5(){return WT_().catch(Dz5)}function Dz5(){return[]}var J0_,ul,EC;var a38=h(()=>{TK();c3();A7();kE();qJ();UN();GT_();FT_();M0_();J0_=p(A8(),1),ul=p(_8(),1),EC=p(a(),1)});var P0_={};h8(P0_,{call:()=>kz5});var X0_,kz5=async(q,K)=>{return X0_.jsxDEV(sH6,{onClose:q,context:K,defaultTab:"Config"},void 0,!1,void 0,this)};var f0_=h(()=>{a38();X0_=p(a(),1)});var Tz5,W0_;var Z0_=h(()=>{Tz5={aliases:["settings"],type:"local-jsx",name:"config",description:"Open config panel",load:()=>Promise.resolve().then(() => (f0_(),P0_))},W0_=Tz5});var G0_={};h8(G0_,{formatContextAsMarkdownTable:()=>s38,collectContextData:()=>tH6,call:()=>yz5});async function tH6(q){let{messages:K,getAppState:_,options:{mainLoopModel:A,tools:z,agentDefinitions:Y,customSystemPrompt:$,appendSystemPrompt:O}}=q,w=l3(K),{messages:H}=await lU(w),j=_();return CW_(H,A,async()=>j.toolPermissionContext,z,Y,void 0,{options:{customSystemPrompt:$,appendSystemPrompt:O}},void 0,w)}async function yz5(q,K){let _=await tH6(K);return{type:"text",value:s38(_,K.options.theme)}}function s38(q,K="dark"){let{categories:_,totalTokens:A,rawMaxTokens:z,percentage:Y,model:$,memoryFiles:O,mcpTools:w,agents:H,skills:j,gridRows:M}=q,J="⛁",P="⛀",X="⛶",f="⛝",W=new Map;for(let t of _)W.set(t.name,JK(t.color,K));function Z(t){if(t.categoryName==="Free space")return"⛶";if(t.categoryName==="Autocompact buffer"||t.categoryName==="Compact buffer")return"⛝";return t.squareFullness>=0.7?"⛁":"⛀"}function v(t){let s=W.get(t.categoryName),e=Z(t);return s?s(e):e}let k=`**Context Usage**
|
|
5471
5471
|
|
|
5472
5472
|
`,N=(t)=>{switch(t){case"userSettings":return"User";case"projectSettings":return"Project";case"localSettings":return"Local";case"flagSettings":return"Flag";case"policySettings":return"Managed";case"plugin":return"Plugin";case"built-in":case"builtin":return"Built-in";case"bundled":return"Built-in";case"mcp":return"MCP";default:return t||"Other"}},y=_.filter((t)=>t.tokens>0&&t.name!=="Free space"&&t.name!=="Autocompact buffer"&&t.name!=="Compact buffer"&&!t.isDeferred),L=_.find((t)=>t.name==="Free space"),S=_.find((t)=>t.name==="Autocompact buffer"||t.name==="Compact buffer"),C=[];for(let t of y){let s=t.tokens/z;C.push({glyph:s>=0.07?"⛁":"⛀",name:t.name,tokens:t.tokens,pct:`${(s*100).toFixed(1)}%`,colorName:t.name})}if(L&&L.tokens>0)C.push({glyph:"⛶",name:"Free space",tokens:L.tokens,pct:`${(L.tokens/z*100).toFixed(1)}%`,colorName:"Free space",dim:!0});if(S&&S.tokens>0)C.push({glyph:"⛝",name:S.name,tokens:S.tokens,pct:`${(S.tokens/z*100).toFixed(1)}%`,colorName:S.name,dim:!0});let b=(t)=>{let s=hP(t.tokens),e=t.colorName?W.get(t.colorName):void 0;return`${e?e(t.glyph):t.glyph} ${t.name}: ${s} tokens (${t.pct})`},u=2,m=(t)=>t.map((s)=>`${v(s)} `).join("").trimEnd(),B=`${wY($)} · ${hP(A)}/${hP(z)} tokens (${Y}%)`,x=4,F=(M[0]?.length??0)*u,U=Math.max(x,F-B.length+x),d=[];d.push(m(M[0]??[])+" ".repeat(U)+B);let o="Estimated usage by category",K6=Math.max(x,F-o.length+x);d.push(m(M[1]??[])+" ".repeat(K6)+o);let n=Math.max(M.length,C.length+2);for(let t=2;t<n;t++){let s=m(M[t]??Array(M[0]?.length??0).fill({categoryName:"Free space",squareFullness:1})),e=t-2<C.length?b(C[t-2]):"",q6=Math.max(x,F-s.length+x);d.push(s+" ".repeat(q6)+e)}if(k+="```\n"+d.join(`
|
|
@@ -6100,7 +6100,7 @@ Bad (wrong case): {"title": "Fix Login Button On Mobile"}`,Tj5;var Vj6=h(()=>{ZK
|
|
|
6100
6100
|
`)}function xj5(q){if(!q||typeof q!=="object")return typeof q==="string"?q:"";let K=q;if(typeof K.stdout==="string"){let A=typeof K.stderr==="string"?K.stderr:"";return K.stdout+(A?`
|
|
6101
6101
|
`+A:"")}if(K.file&&typeof K.file==="object"&&typeof K.file.content==="string")return K.file.content;let _=[];for(let A of["content","output","result","text","message"]){let z=K[A];if(typeof z==="string")_.push(z)}for(let A of["filenames","lines","results"]){let z=K[A];if(Array.isArray(z)&&z.every((Y)=>typeof Y==="string"))_.push(z.join(`
|
|
6102
6102
|
`))}return _.join(`
|
|
6103
|
-
`)}var KS_="</system-reminder>",_S_,AS_;var W9q=h(()=>{Vq();_S_=new Set([Jd,N2]),AS_=new WeakMap});function zS_(q){if(q>=70)return"horizontal";return"compact"}function YS_(q,K,_){if(K==="horizontal"){let z=_,Y=Z9q+$w8+Yw8+z,$=q-Y,O=Math.max(30,$),w=Math.min(z+O+Yw8+$w8,q-Z9q);if(w<z+O+Yw8+$w8)O=w-z-Yw8-$w8;return{leftWidth:z,rightWidth:O,totalWidth:w}}let A=Math.min(q-Z9q,uj5+20);return{leftWidth:A,rightWidth:A,totalWidth:A}}function $S_(q,K){if(wq(q)<=K)return q;let _="/",A="…",z=1,Y=1,$=q.split(_),O=$[0]||"",w=$[$.length-1]||"",H=wq(O),j=wq(w);if($.length===1)return f7(q,K);if(O===""&&z+Y+j>=K)return`${_}${f7(w,Math.max(1,K-Y))}`;if(O!==""&&z*2+Y+j>=K)return`${A}${_}${f7(w,Math.max(1,K-z-Y))}`;if($.length===2){let P=K-z-Y-j;return`${gn(O,P)}${A}${_}${w}`}let M=K-H-j-z-2*Y;if(M<=0){let P=Math.max(0,K-j-z-2*Y);return`${gn(O,P)}${_}${A}${_}${w}`}let J=[];for(let P=$.length-2;P>0;P--){let X=$[P];if(X&&wq(X)+Y<=M)J.unshift(X),M-=wq(X)+Y;else break}if(J.length===0)return`${O}${_}${A}${_}${w}`;return`${O}${_}${A}${_}${J.join(_)}${_}${w}`}async function OS_(){if(Ow8)return Ow8;let q=k8();return Ow8=Ow6(10).then((K)=>{return tE6=K.filter((_)=>{if(_.isSidechain)return!1;if(_.sessionId===q)return!1;if(_.summary?.includes("I apologize"))return!1;let A=_.summary&&_.summary!=="No prompt",z=_.firstPrompt&&_.firstPrompt!=="No prompt";return A||z}).slice(0,3),tE6}).catch(()=>{return tE6=[],tE6}),Ow8}function wS_(){return tE6}var uj5=50,Z9q=4,Yw8=1,$w8=2,tE6,Ow8=null;var G9q=h(()=>{v8();l4();GK();$K();n7();vK();iE6();e_();Rq();tE6=[]});function jS_(q){let{title:K,lines:_,footer:A,emptyMessage:z,customContent:Y}=q,$=wq(K);if(Y!==void 0)$=Math.max($,Y.width);else if(_.length===0&&z)$=Math.max($,wq(z));else{let w=Math.max(0,..._.map((H)=>H.timestamp?wq(H.timestamp):0));for(let H of _){let j=w>0?w:0,M=wq(H.text)+(j>0?j+2:0);$=Math.max($,M)}}if(A)$=Math.max($,wq(A));return $}function MS_(q){let K=HS_.c(15),{config:_,actualWidth:A}=q,{title:z,lines:Y,footer:$,emptyMessage:O,customContent:w}=_,H;if(K[0]!==Y)H=Math.max(0,...Y.map(pj5)),K[0]=Y,K[1]=H;else H=K[1];let j=H,M;if(K[2]!==z)M=hX.jsxDEV(T,{bold:!0,color:"sectionLabel",children:z},void 0,!1,void 0,this),K[2]=z,K[3]=M;else M=K[3];let J;if(K[4]!==A||K[5]!==w||K[6]!==O||K[7]!==$||K[8]!==Y||K[9]!==j)J=w?hX.jsxDEV(hX.Fragment,{children:[w.content,$&&hX.jsxDEV(T,{dimColor:!0,italic:!0,children:Z5($,A)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Y.length===0&&O?hX.jsxDEV(T,{dimColor:!0,children:Z5(O,A)},void 0,!1,void 0,this):hX.jsxDEV(hX.Fragment,{children:[Y.map((X,f)=>{let W=Math.max(10,A-(j>0?j+2:0));return hX.jsxDEV(T,{children:[j>0&&hX.jsxDEV(hX.Fragment,{children:[hX.jsxDEV(T,{dimColor:!0,children:(X.timestamp||"").padEnd(j)},void 0,!1,void 0,this)," "]},void 0,!0,void 0,this),hX.jsxDEV(T,{children:Z5(X.text,W)},void 0,!1,void 0,this)]},f,!0,void 0,this)}),$&&hX.jsxDEV(T,{dimColor:!0,italic:!0,children:Z5($,A)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[4]=A,K[5]=w,K[6]=O,K[7]=$,K[8]=Y,K[9]=j,K[10]=J;else J=K[10];let P;if(K[11]!==A||K[12]!==M||K[13]!==J)P=hX.jsxDEV(I,{flexDirection:"column",width:A,children:[M,J]},void 0,!0,void 0,this),K[11]=A,K[12]=M,K[13]=J,K[14]=P;else P=K[14];return P}function pj5(q){return q.timestamp?wq(q.timestamp):0}var HS_,hX;var JS_=h(()=>{l4();a6();vK();HS_=p(A8(),1),hX=p(a(),1)});function fS_(q){let K=PS_.c(10),{feeds:_,maxWidth:A}=q,z;if(K[0]!==_){let H=_.map(mj5);z=Math.max(...H),K[0]=_,K[1]=z}else z=K[1];let $=Math.max(20,Math.min(z,A)),O;if(K[2]!==$||K[3]!==_){let H;if(K[5]!==$||K[6]!==_.length)H=(j,M)=>eE6.jsxDEV(XS_.Fragment,{children:[eE6.jsxDEV(MS_,{config:j,actualWidth:$},void 0,!1,void 0,this),M<_.length-1&&eE6.jsxDEV(N$,{color:"puku",width:$},void 0,!1,void 0,this)]},M,!0,void 0,this),K[5]=$,K[6]=_.length,K[7]=H;else H=K[7];O=_.map(H),K[2]=$,K[3]=_,K[4]=O}else O=K[4];let w;if(K[8]!==O)w=eE6.jsxDEV(I,{flexDirection:"column",children:O},void 0,!1,void 0,this),K[8]=O,K[9]=w;else w=K[9];return w}function mj5(q){return jS_(q)}var PS_,XS_,eE6;var WS_=h(()=>{a6();e0();JS_();PS_=p(A8(),1),XS_=p(_8(),1),eE6=p(a(),1)});import*as ZS_ from"os";function cj5(){return MW.jsxDEV(I,{flexDirection:"column",children:MW.jsxDEV(T,{children:GS_},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function vS_(){let{columns:q}=Eq(),K=nj(),_=zS_(q);if(_==="compact")return null;let{leftWidth:A,rightWidth:z}=YS_(q,_,Fj5),Y="1.8.
|
|
6103
|
+
`)}var KS_="</system-reminder>",_S_,AS_;var W9q=h(()=>{Vq();_S_=new Set([Jd,N2]),AS_=new WeakMap});function zS_(q){if(q>=70)return"horizontal";return"compact"}function YS_(q,K,_){if(K==="horizontal"){let z=_,Y=Z9q+$w8+Yw8+z,$=q-Y,O=Math.max(30,$),w=Math.min(z+O+Yw8+$w8,q-Z9q);if(w<z+O+Yw8+$w8)O=w-z-Yw8-$w8;return{leftWidth:z,rightWidth:O,totalWidth:w}}let A=Math.min(q-Z9q,uj5+20);return{leftWidth:A,rightWidth:A,totalWidth:A}}function $S_(q,K){if(wq(q)<=K)return q;let _="/",A="…",z=1,Y=1,$=q.split(_),O=$[0]||"",w=$[$.length-1]||"",H=wq(O),j=wq(w);if($.length===1)return f7(q,K);if(O===""&&z+Y+j>=K)return`${_}${f7(w,Math.max(1,K-Y))}`;if(O!==""&&z*2+Y+j>=K)return`${A}${_}${f7(w,Math.max(1,K-z-Y))}`;if($.length===2){let P=K-z-Y-j;return`${gn(O,P)}${A}${_}${w}`}let M=K-H-j-z-2*Y;if(M<=0){let P=Math.max(0,K-j-z-2*Y);return`${gn(O,P)}${_}${A}${_}${w}`}let J=[];for(let P=$.length-2;P>0;P--){let X=$[P];if(X&&wq(X)+Y<=M)J.unshift(X),M-=wq(X)+Y;else break}if(J.length===0)return`${O}${_}${A}${_}${w}`;return`${O}${_}${A}${_}${J.join(_)}${_}${w}`}async function OS_(){if(Ow8)return Ow8;let q=k8();return Ow8=Ow6(10).then((K)=>{return tE6=K.filter((_)=>{if(_.isSidechain)return!1;if(_.sessionId===q)return!1;if(_.summary?.includes("I apologize"))return!1;let A=_.summary&&_.summary!=="No prompt",z=_.firstPrompt&&_.firstPrompt!=="No prompt";return A||z}).slice(0,3),tE6}).catch(()=>{return tE6=[],tE6}),Ow8}function wS_(){return tE6}var uj5=50,Z9q=4,Yw8=1,$w8=2,tE6,Ow8=null;var G9q=h(()=>{v8();l4();GK();$K();n7();vK();iE6();e_();Rq();tE6=[]});function jS_(q){let{title:K,lines:_,footer:A,emptyMessage:z,customContent:Y}=q,$=wq(K);if(Y!==void 0)$=Math.max($,Y.width);else if(_.length===0&&z)$=Math.max($,wq(z));else{let w=Math.max(0,..._.map((H)=>H.timestamp?wq(H.timestamp):0));for(let H of _){let j=w>0?w:0,M=wq(H.text)+(j>0?j+2:0);$=Math.max($,M)}}if(A)$=Math.max($,wq(A));return $}function MS_(q){let K=HS_.c(15),{config:_,actualWidth:A}=q,{title:z,lines:Y,footer:$,emptyMessage:O,customContent:w}=_,H;if(K[0]!==Y)H=Math.max(0,...Y.map(pj5)),K[0]=Y,K[1]=H;else H=K[1];let j=H,M;if(K[2]!==z)M=hX.jsxDEV(T,{bold:!0,color:"sectionLabel",children:z},void 0,!1,void 0,this),K[2]=z,K[3]=M;else M=K[3];let J;if(K[4]!==A||K[5]!==w||K[6]!==O||K[7]!==$||K[8]!==Y||K[9]!==j)J=w?hX.jsxDEV(hX.Fragment,{children:[w.content,$&&hX.jsxDEV(T,{dimColor:!0,italic:!0,children:Z5($,A)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Y.length===0&&O?hX.jsxDEV(T,{dimColor:!0,children:Z5(O,A)},void 0,!1,void 0,this):hX.jsxDEV(hX.Fragment,{children:[Y.map((X,f)=>{let W=Math.max(10,A-(j>0?j+2:0));return hX.jsxDEV(T,{children:[j>0&&hX.jsxDEV(hX.Fragment,{children:[hX.jsxDEV(T,{dimColor:!0,children:(X.timestamp||"").padEnd(j)},void 0,!1,void 0,this)," "]},void 0,!0,void 0,this),hX.jsxDEV(T,{children:Z5(X.text,W)},void 0,!1,void 0,this)]},f,!0,void 0,this)}),$&&hX.jsxDEV(T,{dimColor:!0,italic:!0,children:Z5($,A)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[4]=A,K[5]=w,K[6]=O,K[7]=$,K[8]=Y,K[9]=j,K[10]=J;else J=K[10];let P;if(K[11]!==A||K[12]!==M||K[13]!==J)P=hX.jsxDEV(I,{flexDirection:"column",width:A,children:[M,J]},void 0,!0,void 0,this),K[11]=A,K[12]=M,K[13]=J,K[14]=P;else P=K[14];return P}function pj5(q){return q.timestamp?wq(q.timestamp):0}var HS_,hX;var JS_=h(()=>{l4();a6();vK();HS_=p(A8(),1),hX=p(a(),1)});function fS_(q){let K=PS_.c(10),{feeds:_,maxWidth:A}=q,z;if(K[0]!==_){let H=_.map(mj5);z=Math.max(...H),K[0]=_,K[1]=z}else z=K[1];let $=Math.max(20,Math.min(z,A)),O;if(K[2]!==$||K[3]!==_){let H;if(K[5]!==$||K[6]!==_.length)H=(j,M)=>eE6.jsxDEV(XS_.Fragment,{children:[eE6.jsxDEV(MS_,{config:j,actualWidth:$},void 0,!1,void 0,this),M<_.length-1&&eE6.jsxDEV(N$,{color:"puku",width:$},void 0,!1,void 0,this)]},M,!0,void 0,this),K[5]=$,K[6]=_.length,K[7]=H;else H=K[7];O=_.map(H),K[2]=$,K[3]=_,K[4]=O}else O=K[4];let w;if(K[8]!==O)w=eE6.jsxDEV(I,{flexDirection:"column",children:O},void 0,!1,void 0,this),K[8]=O,K[9]=w;else w=K[9];return w}function mj5(q){return jS_(q)}var PS_,XS_,eE6;var WS_=h(()=>{a6();e0();JS_();PS_=p(A8(),1),XS_=p(_8(),1),eE6=p(a(),1)});import*as ZS_ from"os";function cj5(){return MW.jsxDEV(I,{flexDirection:"column",children:MW.jsxDEV(T,{children:GS_},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function vS_(){let{columns:q}=Eq(),K=nj(),_=zS_(q);if(_==="compact")return null;let{leftWidth:A,rightWidth:z}=YS_(q,_,Fj5),Y="1.8.32",$=process.env.PUKU_USER_NAME,O=wY(K),w=process.cwd().replace(ZS_.homedir(),"~"),H=wS_(),j={title:"Recent activity",lines:H.map((J)=>{return{text:(J.summary&&J.summary!=="No prompt"?J.summary:J.firstPrompt)||"",timestamp:Iy(J.modified)}}),footer:H.length>0?"/resume for more":void 0,emptyMessage:"No recent activity"},M={title:"What's new",lines:gj5.map((J)=>({text:J})),footer:"/release-notes for more"};return MW.jsxDEV(I,{flexDirection:"column",borderStyle:"round",borderColor:"#4A4C53",borderText:{content:` v${Y} `,position:"bottom",align:"end",offset:3},width:q,children:MW.jsxDEV(I,{flexDirection:"row",paddingX:1,gap:1,children:[MW.jsxDEV(I,{flexDirection:"column",width:A,justifyContent:"space-between",alignItems:"center",minHeight:9,children:[$&&MW.jsxDEV(I,{children:MW.jsxDEV(T,{bold:!0,children:["Welcome back, ",$]},void 0,!0,void 0,this)},void 0,!1,void 0,this),MW.jsxDEV(I,{flexDirection:"column",marginY:1,children:MW.jsxDEV(cj5,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),MW.jsxDEV(I,{flexDirection:"column",children:[MW.jsxDEV(T,{dimColor:!0,children:O},void 0,!1,void 0,this),MW.jsxDEV(T,{dimColor:!0,children:$S_(w,A-2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),MW.jsxDEV(I,{height:"100%",borderStyle:"single",borderColor:"#4A4C53",borderDimColor:!0,borderTop:!1,borderBottom:!1,borderLeft:!1},void 0,!1,void 0,this),MW.jsxDEV(fS_,{feeds:[j,M],maxWidth:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var MW,gj5,GS_,Bj5,Fj5;var DS_=h(()=>{a6();A7();lE();Y_();G9q();vK();WS_();MW=p(a(),1),gj5=["/remote-control live message feed","Puku mobile app relay session view","Teal prompt borders + ▶ char"],GS_=`\x1B[0m\x1B[38;5;177m▆\x1B[48;5;183m \x1B[0m\x1B[38;5;177m▆\x1B[0m
|
|
6104
6104
|
`+`\x1B[7m\x1B[38;5;183m \x1B[38;5;140m▗▅▅▅▅▅▅▅▖\x1B[38;5;183m \x1B[0m
|
|
6105
6105
|
`+`\x1B[7m\x1B[38;5;183m \x1B[0m\x1B[38;5;140m▋ \x1B[7m▍\x1B[38;5;183m \x1B[0m
|
|
6106
6106
|
`+`\x1B[7m\x1B[38;5;183m \x1B[0m\x1B[38;5;140m▋ \x1B[7m▍\x1B[38;5;183m \x1B[0m
|
|
@@ -6526,7 +6526,7 @@ ${q.diagPath}`}}var Jp_=h(()=>{jp_()});var bf5,Pp_;var Xp_=h(()=>{bf5={type:"loc
|
|
|
6526
6526
|
reconnect call reconnectEnvironmentWithSession directly
|
|
6527
6527
|
status print bridge state`,pf5=async(q)=>{let K=kp_();if(!K)return{type:"text",value:"No bridge debug handle registered. Remote Control must be connected (USER_TYPE=ant)."};let[_,A,z]=q.trim().split(/\s+/);switch(_){case"close":{let Y=Number(A);if(!Number.isFinite(Y))return{type:"text",value:`close: need a numeric code
|
|
6528
6528
|
${_1q}`};return K.fireClose(Y),{type:"text",value:`Fired transport close(${Y}). Watch debug.log for [bridge:repl] recovery.`}}case"poll":{if(A==="transient")return K.injectFault({method:"pollForWork",kind:"transient",status:503,count:1}),K.wakePollLoop(),{type:"text",value:"Next poll will throw a transient (axios rejection). Poll loop woken."};let Y=Number(A);if(!Number.isFinite(Y))return{type:"text",value:`poll: need 'transient' or a status code
|
|
6529
|
-
${_1q}`};let $=z??(Y===404?"not_found_error":"authentication_error");return K.injectFault({method:"pollForWork",kind:"fatal",status:Y,errorType:$,count:1}),K.wakePollLoop(),{type:"text",value:`Next poll will throw BridgeFatalError(${Y}, ${$}). Poll loop woken.`}}case"register":{if(A==="fatal")return K.injectFault({method:"registerBridgeEnvironment",kind:"fatal",status:403,errorType:"permission_error",count:1}),{type:"text",value:"Next registerBridgeEnvironment will 403. Trigger with close/reconnect."};let Y=Number(z)||1;return K.injectFault({method:"registerBridgeEnvironment",kind:"transient",status:503,count:Y}),{type:"text",value:`Next ${Y} registerBridgeEnvironment call(s) will transient-fail. Trigger with close/reconnect.`}}case"reconnect-session":return K.injectFault({method:"reconnectSession",kind:"fatal",status:404,errorType:"not_found_error",count:2}),{type:"text",value:"Next 2 POST /bridge/reconnect calls will 404. doReconnect Strategy 1 falls through to Strategy 2."};case"heartbeat":{let Y=Number(A)||401;return K.injectFault({method:"heartbeatWork",kind:"fatal",status:Y,errorType:Y===401?"authentication_error":"not_found_error",count:1}),{type:"text",value:`Next heartbeat will ${Y}. Watch for onHeartbeatFatal → work-state teardown.`}}case"reconnect":return K.forceReconnect(),{type:"text",value:"Called reconnectEnvironmentWithSession(). Watch debug.log."};case"status":return{type:"text",value:K.describe()};default:return{type:"text",value:_1q}}},mf5,yp_;var Rp_=h(()=>{K1q();mf5={type:"local",name:"bridge-kick",description:"Inject bridge failure states for manual recovery testing",isEnabled:()=>process.env.USER_TYPE==="ant",supportsNonInteractive:!1,load:()=>Promise.resolve({call:pf5})},yp_=mf5});var gf5=async()=>{return{type:"text",value:"99.0.0 (built 2026-06-26T08:30:08.668Z)"}},Bf5,Vp_;var Lp_=h(()=>{Bf5={type:"local",name:"version",description:"Print the version this session is running (not what autoupdate downloaded)",isEnabled:()=>process.env.USER_TYPE==="ant",supportsNonInteractive:!0,load:()=>Promise.resolve({call:gf5})},Vp_=Bf5});var A1q;var hp_=h(()=>{A1q={isEnabled:()=>!1,isHidden:!0,name:"stub"}});var Sp_,Ep_,Cp_;var bp_=h(()=>{Sp_={isEnabled:()=>!1,isHidden:!0,name:"stub"},Ep_=Sp_,Cp_=Sp_});var Ip_;var xp_=h(()=>{Ip_={isEnabled:()=>!1,isHidden:!0,name:"stub"}});var up_;var pp_=h(()=>{up_={isEnabled:()=>!1,isHidden:!0,name:"stub"}});function gp_(){let q=mp_.c(3),K=Iq.isSandboxingEnabled(),_;if(q[0]===Symbol.for("react.memo_cache_sentinel")){let Y=Iq.checkDependencies();_=Y.warnings.length>0?gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:Y.warnings.map(cf5)},void 0,!1,void 0,this):null,q[0]=_}else _=q[0];let A=_;if(!K){let Y;if(q[1]===Symbol.for("react.memo_cache_sentinel"))Y=gO.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[gO.jsxDEV(T,{color:"subtle",children:"Sandbox is not enabled"},void 0,!1,void 0,this),A]},void 0,!0,void 0,this),q[1]=Y;else Y=q[1];return Y}let z;if(q[2]===Symbol.for("react.memo_cache_sentinel")){let Y=Iq.getFsReadConfig(),$=Iq.getFsWriteConfig(),O=Iq.getNetworkRestrictionConfig(),w=Iq.getAllowUnixSockets(),H=Iq.getExcludedCommands(),j=Iq.getLinuxGlobPatternWarnings();z=gO.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[gO.jsxDEV(I,{flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Excluded Commands:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:H.length>0?H.join(", "):"None"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.denyOnly.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Filesystem Read Restrictions:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:["Denied: ",Y.denyOnly.join(", ")]},void 0,!0,void 0,this),Y.allowWithinDeny&&Y.allowWithinDeny.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Allowed within denied: ",Y.allowWithinDeny.join(", ")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.allowOnly.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Filesystem Write Restrictions:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:["Allowed: ",$.allowOnly.join(", ")]},void 0,!0,void 0,this),$.denyWithinAllow.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Denied within allowed: ",$.denyWithinAllow.join(", ")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(O.allowedHosts&&O.allowedHosts.length>0||O.deniedHosts&&O.deniedHosts.length>0)&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:["Network Restrictions",bs()?" (Managed)":"",":"]},void 0,!0,void 0,this),O.allowedHosts&&O.allowedHosts.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Allowed: ",O.allowedHosts.join(", ")]},void 0,!0,void 0,this),O.deniedHosts&&O.deniedHosts.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Denied: ",O.deniedHosts.join(", ")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w&&w.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Allowed Unix Sockets:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:w.join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"warning",children:"⚠ Warning: Glob patterns not fully supported on Linux"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:["The following patterns will be ignored:"," ",j.slice(0,3).join(", "),j.length>3&&` (${j.length-3} more)`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A]},void 0,!0,void 0,this),q[2]=z}else z=q[2];return z}function cf5(q,K){return gO.jsxDEV(T,{dimColor:!0,children:q},K,!1,void 0,this)}var mp_,gO;var Bp_=h(()=>{a6();bY();mp_=p(A8(),1),gO=p(a(),1)});function z1q(q){let K=cp_.c(24),{depCheck:_}=q,A;if(K[0]===Symbol.for("react.memo_cache_sentinel"))A=$q(),K[0]=A;else A=K[0];let Y=A==="macos",$;if(K[1]!==_.errors)$=_.errors.some(lf5),K[1]=_.errors,K[2]=$;else $=K[2];let O=$,w;if(K[3]!==_.errors)w=_.errors.some(Qf5),K[3]=_.errors,K[4]=w;else w=K[4];let H=w,j;if(K[5]!==_.errors)j=_.errors.some(df5),K[5]=_.errors,K[6]=j;else j=K[6];let M=j,J=_.warnings.length>0,P;if(K[7]!==H||K[8]!==_.errors||K[9]!==O||K[10]!==J||K[11]!==M){let X=_.errors.filter(Uf5),f=Y?"brew install ripgrep":"apt install ripgrep",W;if(K[13]===Symbol.for("react.memo_cache_sentinel"))W=Y&&WY.jsxDEV(I,{flexDirection:"column",children:WY.jsxDEV(T,{children:["seatbelt: ",WY.jsxDEV(T,{color:"success",children:"built-in (macOS)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[13]=W;else W=K[13];let Z,v;if(K[14]!==O)Z=WY.jsxDEV(T,{children:["ripgrep (rg):"," ",O?WY.jsxDEV(T,{color:"error",children:"not found"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"found"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v=O&&WY.jsxDEV(T,{dimColor:!0,children:[" ","· ",f]},void 0,!0,void 0,this),K[14]=O,K[15]=Z,K[16]=v;else Z=K[15],v=K[16];let k;if(K[17]!==Z||K[18]!==v)k=WY.jsxDEV(I,{flexDirection:"column",children:[Z,v]},void 0,!0,void 0,this),K[17]=Z,K[18]=v,K[19]=k;else k=K[19];let N;if(K[20]!==H||K[21]!==J||K[22]!==M)N=!Y&&WY.jsxDEV(WY.Fragment,{children:[WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{children:["bubblewrap (bwrap):"," ",H?WY.jsxDEV(T,{color:"error",children:"not installed"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"installed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&WY.jsxDEV(T,{dimColor:!0,children:[" ","· apt install bubblewrap"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{children:["socat:"," ",M?WY.jsxDEV(T,{color:"error",children:"not installed"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"installed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&WY.jsxDEV(T,{dimColor:!0,children:[" ","· apt install socat"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{children:["seccomp filter:"," ",J?WY.jsxDEV(T,{color:"warning",children:"not installed"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"installed"},void 0,!1,void 0,this),J&&WY.jsxDEV(T,{dimColor:!0,children:" (required to block unix domain sockets)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{dimColor:!0,children:[" ","· npm install -g @anthropic-ai/sandbox-runtime"]},void 0,!0,void 0,this),WY.jsxDEV(T,{dimColor:!0,children:[" ","· or copy vendor/seccomp/* from sandbox-runtime and set"]},void 0,!0,void 0,this),WY.jsxDEV(T,{dimColor:!0,children:[" ","sandbox.seccomp.bpfPath and applyPath in settings.json"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[20]=H,K[21]=J,K[22]=M,K[23]=N;else N=K[23];P=WY.jsxDEV(I,{flexDirection:"column",paddingY:1,gap:1,children:[W,k,N,X.map(Ff5)]},void 0,!0,void 0,this),K[7]=H,K[8]=_.errors,K[9]=O,K[10]=J,K[11]=M,K[12]=P}else P=K[12];return P}function Ff5(q){return WY.jsxDEV(T,{color:"error",children:q},q,!1,void 0,this)}function Uf5(q){return!q.includes("ripgrep")&&!q.includes("bwrap")&&!q.includes("socat")}function df5(q){return q.includes("socat")}function Qf5(q){return q.includes("bwrap")}function lf5(q){return q.includes("ripgrep")}var cp_,WY;var Fp_=h(()=>{a6();V7();cp_=p(A8(),1),WY=p(a(),1)});function Up_(q){let K=Y1q.c(5),{onComplete:_}=q,A=Iq.isSandboxingEnabled(),z=Iq.areSandboxSettingsLockedByPolicy(),Y=Iq.areUnsandboxedCommandsAllowed();if(!A){let O;if(K[0]===Symbol.for("react.memo_cache_sentinel"))O=YM.jsxDEV(I,{flexDirection:"column",paddingY:1,children:YM.jsxDEV(T,{color:"subtle",children:"Sandbox is not enabled. Enable sandbox to configure override settings."},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[0]=O;else O=K[0];return O}if(z){let O;if(K[1]===Symbol.for("react.memo_cache_sentinel"))O=YM.jsxDEV(T,{color:"subtle",children:"Override settings are managed by a higher-priority configuration and cannot be changed locally."},void 0,!1,void 0,this),K[1]=O;else O=K[1];let w;if(K[2]===Symbol.for("react.memo_cache_sentinel"))w=YM.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[O,YM.jsxDEV(I,{marginTop:1,children:YM.jsxDEV(T,{dimColor:!0,children:["Current setting:"," ",Y?"Allow unsandboxed fallback":"Strict sandbox mode"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[2]=w;else w=K[2];return w}let $;if(K[3]!==_)$=YM.jsxDEV(if5,{onComplete:_,currentMode:Y?"open":"closed"},void 0,!1,void 0,this),K[3]=_,K[4]=$;else $=K[4];return $}function if5(q){let K=Y1q.c(25),{onComplete:_,currentMode:A}=q,[z]=hK(),{headerFocused:Y,focusHeader:$}=VX(),O;if(K[0]!==z)O=JK("success",z)("(current)"),K[0]=z,K[1]=O;else O=K[1];let w=O,H=A==="open"?`Allow unsandboxed fallback ${w}`:"Allow unsandboxed fallback",j;if(K[2]!==H)j={label:H,value:"open"},K[2]=H,K[3]=j;else j=K[3];let M=A==="closed"?`Strict sandbox mode ${w}`:"Strict sandbox mode",J;if(K[4]!==M)J={label:M,value:"closed"},K[4]=M,K[5]=J;else J=K[5];let P;if(K[6]!==j||K[7]!==J)P=[j,J],K[6]=j,K[7]=J,K[8]=P;else P=K[8];let X=P,f;if(K[9]!==_)f=async function(b){let u=b;await Iq.setSandboxSettings({allowUnsandboxedCommands:u==="open"}),_(u==="open"?"✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary":"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")},K[9]=_,K[10]=f;else f=K[10];let W=f,Z;if(K[11]===Symbol.for("react.memo_cache_sentinel"))Z=YM.jsxDEV(I,{marginBottom:1,children:YM.jsxDEV(T,{bold:!0,children:"Configure Overrides:"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[11]=Z;else Z=K[11];let v;if(K[12]!==_)v=()=>_(void 0,{display:"skip"}),K[12]=_,K[13]=v;else v=K[13];let k;if(K[14]!==$||K[15]!==W||K[16]!==Y||K[17]!==X||K[18]!==v)k=YM.jsxDEV(r8,{options:X,onChange:W,onCancel:v,onUpFromFirstItem:$,isDisabled:Y},void 0,!1,void 0,this),K[14]=$,K[15]=W,K[16]=Y,K[17]=X,K[18]=v,K[19]=k;else k=K[19];let N;if(K[20]===Symbol.for("react.memo_cache_sentinel"))N=YM.jsxDEV(T,{dimColor:!0,children:[YM.jsxDEV(T,{bold:!0,dimColor:!0,children:"Allow unsandboxed fallback:"},void 0,!1,void 0,this)," ","When a command fails due to sandbox restrictions, puku can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions)."]},void 0,!0,void 0,this),K[20]=N;else N=K[20];let y;if(K[21]===Symbol.for("react.memo_cache_sentinel"))y=YM.jsxDEV(T,{dimColor:!0,children:[YM.jsxDEV(T,{bold:!0,dimColor:!0,children:"Strict sandbox mode:"},void 0,!1,void 0,this)," ","All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands."]},void 0,!0,void 0,this),K[21]=y;else y=K[21];let L;if(K[22]===Symbol.for("react.memo_cache_sentinel"))L=YM.jsxDEV(I,{flexDirection:"column",marginTop:1,gap:1,children:[N,y,YM.jsxDEV(T,{dimColor:!0,children:["Learn more:"," ",YM.jsxDEV(nK,{url:"https://puku.sh/docs/en/sandboxing#configure-sandboxing",children:"puku.sh/docs/en/sandboxing#configure-sandboxing"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[22]=L;else L=K[22];let S;if(K[23]!==k)S=YM.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[Z,k,L]},void 0,!0,void 0,this),K[23]=k,K[24]=S;else S=K[24];return S}var Y1q,YM;var dp_=h(()=>{a6();bY();_A();UN();Y1q=p(A8(),1),YM=p(a(),1)});function Qp_(q){let K=$1q.c(34),{onComplete:_,depCheck:A}=q,[z]=hK(),Y=Iq.isSandboxingEnabled(),$=Iq.isAutoAllowBashIfSandboxedEnabled(),O=A.warnings.length>0,w;if(K[0]===Symbol.for("react.memo_cache_sentinel"))w=Fq(),K[0]=w;else w=K[0];let j=w.sandbox?.network?.allowAllUnixSockets,M=O&&!j,P=(()=>{if(!Y)return"disabled";if($)return"auto-allow";return"regular"})(),X;if(K[1]!==z)X=JK("success",z)("(current)"),K[1]=z,K[2]=X;else X=K[2];let f=X,W=P==="auto-allow"?`Sandbox BashTool, with auto-allow ${f}`:"Sandbox BashTool, with auto-allow",Z;if(K[3]!==W)Z={label:W,value:"auto-allow"},K[3]=W,K[4]=Z;else Z=K[4];let v=P==="regular"?`Sandbox BashTool, with regular permissions ${f}`:"Sandbox BashTool, with regular permissions",k;if(K[5]!==v)k={label:v,value:"regular"},K[5]=v,K[6]=k;else k=K[6];let N=P==="disabled"?`No Sandbox ${f}`:"No Sandbox",y;if(K[7]!==N)y={label:N,value:"disabled"},K[7]=N,K[8]=y;else y=K[8];let L;if(K[9]!==Z||K[10]!==k||K[11]!==y)L=[Z,k,y],K[9]=Z,K[10]=k,K[11]=y,K[12]=L;else L=K[12];let S=L,C;if(K[13]!==_)C=async function(e){let q6=e;q:switch(q6){case"auto-allow":{await Iq.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),_("✓ Sandbox enabled with auto-allow for bash commands");break q}case"regular":{await Iq.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),_("✓ Sandbox enabled with regular bash permissions");break q}case"disabled":await Iq.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),_("○ Sandbox disabled")}},K[13]=_,K[14]=C;else C=K[14];let b=C,u;if(K[15]!==_)u={"confirm:no":()=>_(void 0,{display:"skip"})},K[15]=_,K[16]=u;else u=K[16];let m;if(K[17]===Symbol.for("react.memo_cache_sentinel"))m={context:"Settings"},K[17]=m;else m=K[17];CK(u,m);let g;if(K[18]!==b||K[19]!==_||K[20]!==S||K[21]!==M)g=g9.jsxDEV(ZO,{title:"Mode",children:g9.jsxDEV(rf5,{showSocketWarning:M,options:S,onSelect:b,onComplete:_},void 0,!1,void 0,this)},"mode",!1,void 0,this),K[18]=b,K[19]=_,K[20]=S,K[21]=M,K[22]=g;else g=K[22];let B=g,x;if(K[23]!==_)x=g9.jsxDEV(ZO,{title:"Overrides",children:g9.jsxDEV(Up_,{onComplete:_},void 0,!1,void 0,this)},"overrides",!1,void 0,this),K[23]=_,K[24]=x;else x=K[24];let F=x,U;if(K[25]===Symbol.for("react.memo_cache_sentinel"))U=g9.jsxDEV(ZO,{title:"Config",children:g9.jsxDEV(gp_,{},void 0,!1,void 0,this)},"config",!1,void 0,this),K[25]=U;else U=K[25];let d=U,o=A.errors.length>0,K6;if(K[26]!==A||K[27]!==o||K[28]!==O||K[29]!==B||K[30]!==F)K6=o?[g9.jsxDEV(ZO,{title:"Dependencies",children:g9.jsxDEV(z1q,{depCheck:A},void 0,!1,void 0,this)},"dependencies",!1,void 0,this)]:[B,...O?[g9.jsxDEV(ZO,{title:"Dependencies",children:g9.jsxDEV(z1q,{depCheck:A},void 0,!1,void 0,this)},"dependencies",!1,void 0,this)]:[],F,d],K[26]=A,K[27]=o,K[28]=O,K[29]=B,K[30]=F,K[31]=K6;else K6=K[31];let n=K6,t;if(K[32]!==n)t=g9.jsxDEV(Mz,{color:"permission",children:g9.jsxDEV(FN,{title:"Sandbox:",color:"permission",defaultTab:"Mode",children:n},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[32]=n,K[33]=t;else t=K[33];return t}function rf5(q){let K=$1q.c(16),{showSocketWarning:_,options:A,onSelect:z,onComplete:Y}=q,{headerFocused:$,focusHeader:O}=VX(),w;if(K[0]!==_)w=_&&g9.jsxDEV(I,{marginBottom:1,children:g9.jsxDEV(T,{color:"warning",children:"Cannot block unix domain sockets (see Dependencies tab)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[0]=_,K[1]=w;else w=K[1];let H;if(K[2]===Symbol.for("react.memo_cache_sentinel"))H=g9.jsxDEV(I,{marginBottom:1,children:g9.jsxDEV(T,{bold:!0,children:"Configure Mode:"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[2]=H;else H=K[2];let j;if(K[3]!==Y)j=()=>Y(void 0,{display:"skip"}),K[3]=Y,K[4]=j;else j=K[4];let M;if(K[5]!==O||K[6]!==$||K[7]!==z||K[8]!==A||K[9]!==j)M=g9.jsxDEV(r8,{options:A,onChange:z,onCancel:j,onUpFromFirstItem:O,isDisabled:$},void 0,!1,void 0,this),K[5]=O,K[6]=$,K[7]=z,K[8]=A,K[9]=j,K[10]=M;else M=K[10];let J;if(K[11]===Symbol.for("react.memo_cache_sentinel"))J=g9.jsxDEV(T,{dimColor:!0,children:[g9.jsxDEV(T,{bold:!0,dimColor:!0,children:"Auto-allow mode:"},void 0,!1,void 0,this)," ","Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected."]},void 0,!0,void 0,this),K[11]=J;else J=K[11];let P;if(K[12]===Symbol.for("react.memo_cache_sentinel"))P=g9.jsxDEV(I,{flexDirection:"column",marginTop:1,gap:1,children:[J,g9.jsxDEV(T,{dimColor:!0,children:["Learn more:"," ",g9.jsxDEV(nK,{url:"https://puku.sh/docs/en/sandboxing",children:"puku.sh/docs/en/sandboxing"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[12]=P;else P=K[12];let X;if(K[13]!==w||K[14]!==M)X=g9.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[w,H,M,P]},void 0,!0,void 0,this),K[13]=w,K[14]=M,K[15]=X;else X=K[15];return X}var $1q,g9;var lp_=h(()=>{a6();TK();bY();Rq();_A();qJ();UN();Bp_();Fp_();dp_();$1q=p(A8(),1),g9=p(a(),1)});var ip_={};h8(ip_,{call:()=>of5});import{relative as nf5}from"path";async function of5(q,K,_){let z=Fq().theme||"light",Y=$q();if(!Iq.isSupportedPlatform()){let w=Y==="wsl"?"Error: Sandboxing requires WSL2. WSL1 is not supported.":"Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.",H=JK("error",z)(w);return q(H),null}let $=Iq.checkDependencies();if(!Iq.isPlatformInEnabledList()){let w=JK("error",z)(`Error: Sandboxing is disabled for this platform (${Y}) via the enabledPlatforms setting.`);return q(w),null}if(Iq.areSandboxSettingsLockedByPolicy()){let w=JK("error",z)("Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.");return q(w),null}let O=_?.trim()||"";if(!O)return rp_.jsxDEV(Qp_,{onComplete:q,depCheck:$},void 0,!1,void 0,this);if(O){let H=O.split(" ")[0];if(H==="exclude"){let j=O.slice(8).trim();if(!j){let f=JK("error",z)('Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")');return q(f),null}let M=j.replace(/^["']|["']$/g,"");IQ8(M);let J=H9("localSettings"),P=J?nf5(Ny(),J):".puku-cli/settings.local.json",X=JK("success",z)(`Added "${M}" to excluded commands in ${P}`);return q(X),null}else{let j=JK("error",z)(`Error: Unknown subcommand "${H}". Available subcommand: exclude`);return q(j),null}}return null}var rp_;var np_=h(()=>{v8();lp_();a6();V7();bY();Rq();rp_=p(a(),1)});var af5,op_;var ap_=h(()=>{__();bY();af5={name:"sandbox",get description(){let q=Iq.isSandboxingEnabled(),K=Iq.isAutoAllowBashIfSandboxedEnabled(),_=Iq.areUnsandboxedCommandsAllowed(),A=Iq.areSandboxSettingsLockedByPolicy(),z=Iq.checkDependencies().errors.length===0,Y;if(!z)Y=t6.warning;else Y=q?t6.tick:t6.circle;let $="sandbox disabled";if(q)$=K?"sandbox enabled (auto-allow)":"sandbox enabled",$+=_?", fallback allowed":"";if(A)$+=" (managed)";return`${Y} ${$} (⏎ to configure)`},argumentHint:'exclude "command pattern"',get isHidden(){return!Iq.isSupportedPlatform()||!Iq.isPlatformInEnabledList()},immediate:!0,type:"local-jsx",load:()=>Promise.resolve().then(() => (np_(),ip_))},op_=af5});var sp_={};h8(sp_,{call:()=>sf5});async function sf5(){if(await v5("https://www.stickermule.com/claudecode"))return{type:"text",value:"Opening sticker page in browser…"};else return{type:"text",value:"Failed to open browser. Visit: https://www.stickermule.com/claudecode"}}var tp_=h(()=>{kH()});var tf5,O1q;var ep_=h(()=>{tf5={type:"local",name:"stickers",description:"Order puku-cli stickers",supportsNonInteractive:!1,load:()=>Promise.resolve().then(() => (tp_(),sp_))},O1q=tf5});var ef5=async(q,K)=>{let _=q.trim().toLowerCase(),A=s7(K.getAppState().mainLoopModel??uM());if(!_){let w=K.getAppState().advisorModel;if(!w)return{type:"text",value:`Advisor: not set
|
|
6529
|
+
${_1q}`};let $=z??(Y===404?"not_found_error":"authentication_error");return K.injectFault({method:"pollForWork",kind:"fatal",status:Y,errorType:$,count:1}),K.wakePollLoop(),{type:"text",value:`Next poll will throw BridgeFatalError(${Y}, ${$}). Poll loop woken.`}}case"register":{if(A==="fatal")return K.injectFault({method:"registerBridgeEnvironment",kind:"fatal",status:403,errorType:"permission_error",count:1}),{type:"text",value:"Next registerBridgeEnvironment will 403. Trigger with close/reconnect."};let Y=Number(z)||1;return K.injectFault({method:"registerBridgeEnvironment",kind:"transient",status:503,count:Y}),{type:"text",value:`Next ${Y} registerBridgeEnvironment call(s) will transient-fail. Trigger with close/reconnect.`}}case"reconnect-session":return K.injectFault({method:"reconnectSession",kind:"fatal",status:404,errorType:"not_found_error",count:2}),{type:"text",value:"Next 2 POST /bridge/reconnect calls will 404. doReconnect Strategy 1 falls through to Strategy 2."};case"heartbeat":{let Y=Number(A)||401;return K.injectFault({method:"heartbeatWork",kind:"fatal",status:Y,errorType:Y===401?"authentication_error":"not_found_error",count:1}),{type:"text",value:`Next heartbeat will ${Y}. Watch for onHeartbeatFatal → work-state teardown.`}}case"reconnect":return K.forceReconnect(),{type:"text",value:"Called reconnectEnvironmentWithSession(). Watch debug.log."};case"status":return{type:"text",value:K.describe()};default:return{type:"text",value:_1q}}},mf5,yp_;var Rp_=h(()=>{K1q();mf5={type:"local",name:"bridge-kick",description:"Inject bridge failure states for manual recovery testing",isEnabled:()=>process.env.USER_TYPE==="ant",supportsNonInteractive:!1,load:()=>Promise.resolve({call:pf5})},yp_=mf5});var gf5=async()=>{return{type:"text",value:"99.0.0 (built 2026-06-26T09:31:19.702Z)"}},Bf5,Vp_;var Lp_=h(()=>{Bf5={type:"local",name:"version",description:"Print the version this session is running (not what autoupdate downloaded)",isEnabled:()=>process.env.USER_TYPE==="ant",supportsNonInteractive:!0,load:()=>Promise.resolve({call:gf5})},Vp_=Bf5});var A1q;var hp_=h(()=>{A1q={isEnabled:()=>!1,isHidden:!0,name:"stub"}});var Sp_,Ep_,Cp_;var bp_=h(()=>{Sp_={isEnabled:()=>!1,isHidden:!0,name:"stub"},Ep_=Sp_,Cp_=Sp_});var Ip_;var xp_=h(()=>{Ip_={isEnabled:()=>!1,isHidden:!0,name:"stub"}});var up_;var pp_=h(()=>{up_={isEnabled:()=>!1,isHidden:!0,name:"stub"}});function gp_(){let q=mp_.c(3),K=Iq.isSandboxingEnabled(),_;if(q[0]===Symbol.for("react.memo_cache_sentinel")){let Y=Iq.checkDependencies();_=Y.warnings.length>0?gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:Y.warnings.map(cf5)},void 0,!1,void 0,this):null,q[0]=_}else _=q[0];let A=_;if(!K){let Y;if(q[1]===Symbol.for("react.memo_cache_sentinel"))Y=gO.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[gO.jsxDEV(T,{color:"subtle",children:"Sandbox is not enabled"},void 0,!1,void 0,this),A]},void 0,!0,void 0,this),q[1]=Y;else Y=q[1];return Y}let z;if(q[2]===Symbol.for("react.memo_cache_sentinel")){let Y=Iq.getFsReadConfig(),$=Iq.getFsWriteConfig(),O=Iq.getNetworkRestrictionConfig(),w=Iq.getAllowUnixSockets(),H=Iq.getExcludedCommands(),j=Iq.getLinuxGlobPatternWarnings();z=gO.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[gO.jsxDEV(I,{flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Excluded Commands:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:H.length>0?H.join(", "):"None"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.denyOnly.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Filesystem Read Restrictions:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:["Denied: ",Y.denyOnly.join(", ")]},void 0,!0,void 0,this),Y.allowWithinDeny&&Y.allowWithinDeny.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Allowed within denied: ",Y.allowWithinDeny.join(", ")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.allowOnly.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Filesystem Write Restrictions:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:["Allowed: ",$.allowOnly.join(", ")]},void 0,!0,void 0,this),$.denyWithinAllow.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Denied within allowed: ",$.denyWithinAllow.join(", ")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(O.allowedHosts&&O.allowedHosts.length>0||O.deniedHosts&&O.deniedHosts.length>0)&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:["Network Restrictions",bs()?" (Managed)":"",":"]},void 0,!0,void 0,this),O.allowedHosts&&O.allowedHosts.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Allowed: ",O.allowedHosts.join(", ")]},void 0,!0,void 0,this),O.deniedHosts&&O.deniedHosts.length>0&&gO.jsxDEV(T,{dimColor:!0,children:["Denied: ",O.deniedHosts.join(", ")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),w&&w.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"permission",children:"Allowed Unix Sockets:"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:w.join(", ")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j.length>0&&gO.jsxDEV(I,{marginTop:1,flexDirection:"column",children:[gO.jsxDEV(T,{bold:!0,color:"warning",children:"⚠ Warning: Glob patterns not fully supported on Linux"},void 0,!1,void 0,this),gO.jsxDEV(T,{dimColor:!0,children:["The following patterns will be ignored:"," ",j.slice(0,3).join(", "),j.length>3&&` (${j.length-3} more)`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A]},void 0,!0,void 0,this),q[2]=z}else z=q[2];return z}function cf5(q,K){return gO.jsxDEV(T,{dimColor:!0,children:q},K,!1,void 0,this)}var mp_,gO;var Bp_=h(()=>{a6();bY();mp_=p(A8(),1),gO=p(a(),1)});function z1q(q){let K=cp_.c(24),{depCheck:_}=q,A;if(K[0]===Symbol.for("react.memo_cache_sentinel"))A=$q(),K[0]=A;else A=K[0];let Y=A==="macos",$;if(K[1]!==_.errors)$=_.errors.some(lf5),K[1]=_.errors,K[2]=$;else $=K[2];let O=$,w;if(K[3]!==_.errors)w=_.errors.some(Qf5),K[3]=_.errors,K[4]=w;else w=K[4];let H=w,j;if(K[5]!==_.errors)j=_.errors.some(df5),K[5]=_.errors,K[6]=j;else j=K[6];let M=j,J=_.warnings.length>0,P;if(K[7]!==H||K[8]!==_.errors||K[9]!==O||K[10]!==J||K[11]!==M){let X=_.errors.filter(Uf5),f=Y?"brew install ripgrep":"apt install ripgrep",W;if(K[13]===Symbol.for("react.memo_cache_sentinel"))W=Y&&WY.jsxDEV(I,{flexDirection:"column",children:WY.jsxDEV(T,{children:["seatbelt: ",WY.jsxDEV(T,{color:"success",children:"built-in (macOS)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),K[13]=W;else W=K[13];let Z,v;if(K[14]!==O)Z=WY.jsxDEV(T,{children:["ripgrep (rg):"," ",O?WY.jsxDEV(T,{color:"error",children:"not found"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"found"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v=O&&WY.jsxDEV(T,{dimColor:!0,children:[" ","· ",f]},void 0,!0,void 0,this),K[14]=O,K[15]=Z,K[16]=v;else Z=K[15],v=K[16];let k;if(K[17]!==Z||K[18]!==v)k=WY.jsxDEV(I,{flexDirection:"column",children:[Z,v]},void 0,!0,void 0,this),K[17]=Z,K[18]=v,K[19]=k;else k=K[19];let N;if(K[20]!==H||K[21]!==J||K[22]!==M)N=!Y&&WY.jsxDEV(WY.Fragment,{children:[WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{children:["bubblewrap (bwrap):"," ",H?WY.jsxDEV(T,{color:"error",children:"not installed"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"installed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&WY.jsxDEV(T,{dimColor:!0,children:[" ","· apt install bubblewrap"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{children:["socat:"," ",M?WY.jsxDEV(T,{color:"error",children:"not installed"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"installed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&WY.jsxDEV(T,{dimColor:!0,children:[" ","· apt install socat"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{children:["seccomp filter:"," ",J?WY.jsxDEV(T,{color:"warning",children:"not installed"},void 0,!1,void 0,this):WY.jsxDEV(T,{color:"success",children:"installed"},void 0,!1,void 0,this),J&&WY.jsxDEV(T,{dimColor:!0,children:" (required to block unix domain sockets)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&WY.jsxDEV(I,{flexDirection:"column",children:[WY.jsxDEV(T,{dimColor:!0,children:[" ","· npm install -g @anthropic-ai/sandbox-runtime"]},void 0,!0,void 0,this),WY.jsxDEV(T,{dimColor:!0,children:[" ","· or copy vendor/seccomp/* from sandbox-runtime and set"]},void 0,!0,void 0,this),WY.jsxDEV(T,{dimColor:!0,children:[" ","sandbox.seccomp.bpfPath and applyPath in settings.json"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[20]=H,K[21]=J,K[22]=M,K[23]=N;else N=K[23];P=WY.jsxDEV(I,{flexDirection:"column",paddingY:1,gap:1,children:[W,k,N,X.map(Ff5)]},void 0,!0,void 0,this),K[7]=H,K[8]=_.errors,K[9]=O,K[10]=J,K[11]=M,K[12]=P}else P=K[12];return P}function Ff5(q){return WY.jsxDEV(T,{color:"error",children:q},q,!1,void 0,this)}function Uf5(q){return!q.includes("ripgrep")&&!q.includes("bwrap")&&!q.includes("socat")}function df5(q){return q.includes("socat")}function Qf5(q){return q.includes("bwrap")}function lf5(q){return q.includes("ripgrep")}var cp_,WY;var Fp_=h(()=>{a6();V7();cp_=p(A8(),1),WY=p(a(),1)});function Up_(q){let K=Y1q.c(5),{onComplete:_}=q,A=Iq.isSandboxingEnabled(),z=Iq.areSandboxSettingsLockedByPolicy(),Y=Iq.areUnsandboxedCommandsAllowed();if(!A){let O;if(K[0]===Symbol.for("react.memo_cache_sentinel"))O=YM.jsxDEV(I,{flexDirection:"column",paddingY:1,children:YM.jsxDEV(T,{color:"subtle",children:"Sandbox is not enabled. Enable sandbox to configure override settings."},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[0]=O;else O=K[0];return O}if(z){let O;if(K[1]===Symbol.for("react.memo_cache_sentinel"))O=YM.jsxDEV(T,{color:"subtle",children:"Override settings are managed by a higher-priority configuration and cannot be changed locally."},void 0,!1,void 0,this),K[1]=O;else O=K[1];let w;if(K[2]===Symbol.for("react.memo_cache_sentinel"))w=YM.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[O,YM.jsxDEV(I,{marginTop:1,children:YM.jsxDEV(T,{dimColor:!0,children:["Current setting:"," ",Y?"Allow unsandboxed fallback":"Strict sandbox mode"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K[2]=w;else w=K[2];return w}let $;if(K[3]!==_)$=YM.jsxDEV(if5,{onComplete:_,currentMode:Y?"open":"closed"},void 0,!1,void 0,this),K[3]=_,K[4]=$;else $=K[4];return $}function if5(q){let K=Y1q.c(25),{onComplete:_,currentMode:A}=q,[z]=hK(),{headerFocused:Y,focusHeader:$}=VX(),O;if(K[0]!==z)O=JK("success",z)("(current)"),K[0]=z,K[1]=O;else O=K[1];let w=O,H=A==="open"?`Allow unsandboxed fallback ${w}`:"Allow unsandboxed fallback",j;if(K[2]!==H)j={label:H,value:"open"},K[2]=H,K[3]=j;else j=K[3];let M=A==="closed"?`Strict sandbox mode ${w}`:"Strict sandbox mode",J;if(K[4]!==M)J={label:M,value:"closed"},K[4]=M,K[5]=J;else J=K[5];let P;if(K[6]!==j||K[7]!==J)P=[j,J],K[6]=j,K[7]=J,K[8]=P;else P=K[8];let X=P,f;if(K[9]!==_)f=async function(b){let u=b;await Iq.setSandboxSettings({allowUnsandboxedCommands:u==="open"}),_(u==="open"?"✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary":"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")},K[9]=_,K[10]=f;else f=K[10];let W=f,Z;if(K[11]===Symbol.for("react.memo_cache_sentinel"))Z=YM.jsxDEV(I,{marginBottom:1,children:YM.jsxDEV(T,{bold:!0,children:"Configure Overrides:"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[11]=Z;else Z=K[11];let v;if(K[12]!==_)v=()=>_(void 0,{display:"skip"}),K[12]=_,K[13]=v;else v=K[13];let k;if(K[14]!==$||K[15]!==W||K[16]!==Y||K[17]!==X||K[18]!==v)k=YM.jsxDEV(r8,{options:X,onChange:W,onCancel:v,onUpFromFirstItem:$,isDisabled:Y},void 0,!1,void 0,this),K[14]=$,K[15]=W,K[16]=Y,K[17]=X,K[18]=v,K[19]=k;else k=K[19];let N;if(K[20]===Symbol.for("react.memo_cache_sentinel"))N=YM.jsxDEV(T,{dimColor:!0,children:[YM.jsxDEV(T,{bold:!0,dimColor:!0,children:"Allow unsandboxed fallback:"},void 0,!1,void 0,this)," ","When a command fails due to sandbox restrictions, puku can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions)."]},void 0,!0,void 0,this),K[20]=N;else N=K[20];let y;if(K[21]===Symbol.for("react.memo_cache_sentinel"))y=YM.jsxDEV(T,{dimColor:!0,children:[YM.jsxDEV(T,{bold:!0,dimColor:!0,children:"Strict sandbox mode:"},void 0,!1,void 0,this)," ","All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands."]},void 0,!0,void 0,this),K[21]=y;else y=K[21];let L;if(K[22]===Symbol.for("react.memo_cache_sentinel"))L=YM.jsxDEV(I,{flexDirection:"column",marginTop:1,gap:1,children:[N,y,YM.jsxDEV(T,{dimColor:!0,children:["Learn more:"," ",YM.jsxDEV(nK,{url:"https://puku.sh/docs/en/sandboxing#configure-sandboxing",children:"puku.sh/docs/en/sandboxing#configure-sandboxing"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[22]=L;else L=K[22];let S;if(K[23]!==k)S=YM.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[Z,k,L]},void 0,!0,void 0,this),K[23]=k,K[24]=S;else S=K[24];return S}var Y1q,YM;var dp_=h(()=>{a6();bY();_A();UN();Y1q=p(A8(),1),YM=p(a(),1)});function Qp_(q){let K=$1q.c(34),{onComplete:_,depCheck:A}=q,[z]=hK(),Y=Iq.isSandboxingEnabled(),$=Iq.isAutoAllowBashIfSandboxedEnabled(),O=A.warnings.length>0,w;if(K[0]===Symbol.for("react.memo_cache_sentinel"))w=Fq(),K[0]=w;else w=K[0];let j=w.sandbox?.network?.allowAllUnixSockets,M=O&&!j,P=(()=>{if(!Y)return"disabled";if($)return"auto-allow";return"regular"})(),X;if(K[1]!==z)X=JK("success",z)("(current)"),K[1]=z,K[2]=X;else X=K[2];let f=X,W=P==="auto-allow"?`Sandbox BashTool, with auto-allow ${f}`:"Sandbox BashTool, with auto-allow",Z;if(K[3]!==W)Z={label:W,value:"auto-allow"},K[3]=W,K[4]=Z;else Z=K[4];let v=P==="regular"?`Sandbox BashTool, with regular permissions ${f}`:"Sandbox BashTool, with regular permissions",k;if(K[5]!==v)k={label:v,value:"regular"},K[5]=v,K[6]=k;else k=K[6];let N=P==="disabled"?`No Sandbox ${f}`:"No Sandbox",y;if(K[7]!==N)y={label:N,value:"disabled"},K[7]=N,K[8]=y;else y=K[8];let L;if(K[9]!==Z||K[10]!==k||K[11]!==y)L=[Z,k,y],K[9]=Z,K[10]=k,K[11]=y,K[12]=L;else L=K[12];let S=L,C;if(K[13]!==_)C=async function(e){let q6=e;q:switch(q6){case"auto-allow":{await Iq.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),_("✓ Sandbox enabled with auto-allow for bash commands");break q}case"regular":{await Iq.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),_("✓ Sandbox enabled with regular bash permissions");break q}case"disabled":await Iq.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),_("○ Sandbox disabled")}},K[13]=_,K[14]=C;else C=K[14];let b=C,u;if(K[15]!==_)u={"confirm:no":()=>_(void 0,{display:"skip"})},K[15]=_,K[16]=u;else u=K[16];let m;if(K[17]===Symbol.for("react.memo_cache_sentinel"))m={context:"Settings"},K[17]=m;else m=K[17];CK(u,m);let g;if(K[18]!==b||K[19]!==_||K[20]!==S||K[21]!==M)g=g9.jsxDEV(ZO,{title:"Mode",children:g9.jsxDEV(rf5,{showSocketWarning:M,options:S,onSelect:b,onComplete:_},void 0,!1,void 0,this)},"mode",!1,void 0,this),K[18]=b,K[19]=_,K[20]=S,K[21]=M,K[22]=g;else g=K[22];let B=g,x;if(K[23]!==_)x=g9.jsxDEV(ZO,{title:"Overrides",children:g9.jsxDEV(Up_,{onComplete:_},void 0,!1,void 0,this)},"overrides",!1,void 0,this),K[23]=_,K[24]=x;else x=K[24];let F=x,U;if(K[25]===Symbol.for("react.memo_cache_sentinel"))U=g9.jsxDEV(ZO,{title:"Config",children:g9.jsxDEV(gp_,{},void 0,!1,void 0,this)},"config",!1,void 0,this),K[25]=U;else U=K[25];let d=U,o=A.errors.length>0,K6;if(K[26]!==A||K[27]!==o||K[28]!==O||K[29]!==B||K[30]!==F)K6=o?[g9.jsxDEV(ZO,{title:"Dependencies",children:g9.jsxDEV(z1q,{depCheck:A},void 0,!1,void 0,this)},"dependencies",!1,void 0,this)]:[B,...O?[g9.jsxDEV(ZO,{title:"Dependencies",children:g9.jsxDEV(z1q,{depCheck:A},void 0,!1,void 0,this)},"dependencies",!1,void 0,this)]:[],F,d],K[26]=A,K[27]=o,K[28]=O,K[29]=B,K[30]=F,K[31]=K6;else K6=K[31];let n=K6,t;if(K[32]!==n)t=g9.jsxDEV(Mz,{color:"permission",children:g9.jsxDEV(FN,{title:"Sandbox:",color:"permission",defaultTab:"Mode",children:n},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[32]=n,K[33]=t;else t=K[33];return t}function rf5(q){let K=$1q.c(16),{showSocketWarning:_,options:A,onSelect:z,onComplete:Y}=q,{headerFocused:$,focusHeader:O}=VX(),w;if(K[0]!==_)w=_&&g9.jsxDEV(I,{marginBottom:1,children:g9.jsxDEV(T,{color:"warning",children:"Cannot block unix domain sockets (see Dependencies tab)"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[0]=_,K[1]=w;else w=K[1];let H;if(K[2]===Symbol.for("react.memo_cache_sentinel"))H=g9.jsxDEV(I,{marginBottom:1,children:g9.jsxDEV(T,{bold:!0,children:"Configure Mode:"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[2]=H;else H=K[2];let j;if(K[3]!==Y)j=()=>Y(void 0,{display:"skip"}),K[3]=Y,K[4]=j;else j=K[4];let M;if(K[5]!==O||K[6]!==$||K[7]!==z||K[8]!==A||K[9]!==j)M=g9.jsxDEV(r8,{options:A,onChange:z,onCancel:j,onUpFromFirstItem:O,isDisabled:$},void 0,!1,void 0,this),K[5]=O,K[6]=$,K[7]=z,K[8]=A,K[9]=j,K[10]=M;else M=K[10];let J;if(K[11]===Symbol.for("react.memo_cache_sentinel"))J=g9.jsxDEV(T,{dimColor:!0,children:[g9.jsxDEV(T,{bold:!0,dimColor:!0,children:"Auto-allow mode:"},void 0,!1,void 0,this)," ","Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected."]},void 0,!0,void 0,this),K[11]=J;else J=K[11];let P;if(K[12]===Symbol.for("react.memo_cache_sentinel"))P=g9.jsxDEV(I,{flexDirection:"column",marginTop:1,gap:1,children:[J,g9.jsxDEV(T,{dimColor:!0,children:["Learn more:"," ",g9.jsxDEV(nK,{url:"https://puku.sh/docs/en/sandboxing",children:"puku.sh/docs/en/sandboxing"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[12]=P;else P=K[12];let X;if(K[13]!==w||K[14]!==M)X=g9.jsxDEV(I,{flexDirection:"column",paddingY:1,children:[w,H,M,P]},void 0,!0,void 0,this),K[13]=w,K[14]=M,K[15]=X;else X=K[15];return X}var $1q,g9;var lp_=h(()=>{a6();TK();bY();Rq();_A();qJ();UN();Bp_();Fp_();dp_();$1q=p(A8(),1),g9=p(a(),1)});var ip_={};h8(ip_,{call:()=>of5});import{relative as nf5}from"path";async function of5(q,K,_){let z=Fq().theme||"light",Y=$q();if(!Iq.isSupportedPlatform()){let w=Y==="wsl"?"Error: Sandboxing requires WSL2. WSL1 is not supported.":"Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.",H=JK("error",z)(w);return q(H),null}let $=Iq.checkDependencies();if(!Iq.isPlatformInEnabledList()){let w=JK("error",z)(`Error: Sandboxing is disabled for this platform (${Y}) via the enabledPlatforms setting.`);return q(w),null}if(Iq.areSandboxSettingsLockedByPolicy()){let w=JK("error",z)("Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.");return q(w),null}let O=_?.trim()||"";if(!O)return rp_.jsxDEV(Qp_,{onComplete:q,depCheck:$},void 0,!1,void 0,this);if(O){let H=O.split(" ")[0];if(H==="exclude"){let j=O.slice(8).trim();if(!j){let f=JK("error",z)('Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")');return q(f),null}let M=j.replace(/^["']|["']$/g,"");IQ8(M);let J=H9("localSettings"),P=J?nf5(Ny(),J):".puku-cli/settings.local.json",X=JK("success",z)(`Added "${M}" to excluded commands in ${P}`);return q(X),null}else{let j=JK("error",z)(`Error: Unknown subcommand "${H}". Available subcommand: exclude`);return q(j),null}}return null}var rp_;var np_=h(()=>{v8();lp_();a6();V7();bY();Rq();rp_=p(a(),1)});var af5,op_;var ap_=h(()=>{__();bY();af5={name:"sandbox",get description(){let q=Iq.isSandboxingEnabled(),K=Iq.isAutoAllowBashIfSandboxedEnabled(),_=Iq.areUnsandboxedCommandsAllowed(),A=Iq.areSandboxSettingsLockedByPolicy(),z=Iq.checkDependencies().errors.length===0,Y;if(!z)Y=t6.warning;else Y=q?t6.tick:t6.circle;let $="sandbox disabled";if(q)$=K?"sandbox enabled (auto-allow)":"sandbox enabled",$+=_?", fallback allowed":"";if(A)$+=" (managed)";return`${Y} ${$} (⏎ to configure)`},argumentHint:'exclude "command pattern"',get isHidden(){return!Iq.isSupportedPlatform()||!Iq.isPlatformInEnabledList()},immediate:!0,type:"local-jsx",load:()=>Promise.resolve().then(() => (np_(),ip_))},op_=af5});var sp_={};h8(sp_,{call:()=>sf5});async function sf5(){if(await v5("https://www.stickermule.com/claudecode"))return{type:"text",value:"Opening sticker page in browser…"};else return{type:"text",value:"Failed to open browser. Visit: https://www.stickermule.com/claudecode"}}var tp_=h(()=>{kH()});var tf5,O1q;var ep_=h(()=>{tf5={type:"local",name:"stickers",description:"Order puku-cli stickers",supportsNonInteractive:!1,load:()=>Promise.resolve().then(() => (tp_(),sp_))},O1q=tf5});var ef5=async(q,K)=>{let _=q.trim().toLowerCase(),A=s7(K.getAppState().mainLoopModel??uM());if(!_){let w=K.getAppState().advisorModel;if(!w)return{type:"text",value:`Advisor: not set
|
|
6530
6530
|
Use "/advisor <model>" to enable (e.g. "/advisor opus").`};if(!Je(A))return{type:"text",value:`Advisor: ${w} (inactive)
|
|
6531
6531
|
The current model (${A}) does not support advisors.`};return{type:"text",value:`Advisor: ${w}
|
|
6532
6532
|
Use "/advisor unset" to disable or "/advisor <model>" to change.`}}if(_==="unset"||_==="off"){let w=K.getAppState().advisorModel;return K.setAppState((H)=>{if(H.advisorModel===void 0)return H;return{...H,advisorModel:void 0}}),gq("userSettings",{advisorModel:void 0}),{type:"text",value:w?`Advisor disabled (was ${w}).`:"Advisor already unset."}}let z=O2(_),Y=s7(_),{valid:$,error:O}=await I16(Y);if(!$)return{type:"text",value:O?`Invalid advisor model: ${O}`:`Unknown model: ${_} (${Y})`};if(!L36(Y))return{type:"text",value:`The model ${_} (${Y}) cannot be used as an advisor`};if(K.setAppState((w)=>{if(w.advisorModel===z)return w;return{...w,advisorModel:z}}),gq("userSettings",{advisorModel:z}),!Je(A))return{type:"text",value:`Advisor set to ${z}.
|
|
@@ -7876,7 +7876,7 @@ Error: sandbox required but unavailable: ${$8}
|
|
|
7876
7876
|
${R8}`)}else R("No CLAUDE.md/rules files found");for(let R8 of $8)Py.current.set(R8.path,{content:R8.contentDiffersFromDisk?R8.rawContent??R8.content:R8.content,timestamp:Date.now(),offset:void 0,limit:void 0,isPartialView:R8.contentDiffersFromDisk})}Ka_(GU_()),_d_(G_,G_.length===A?.length);let{sendBridgeResult:VI6}=Md_(G_,v_,UO,E7,R6);GY.current=VI6,za_();let QG=Q8.useRef(!1);Q8.useEffect(()=>{if(e.length<1){QG.current=!1;return}if(QG.current)return;QG.current=!0,g8(($8)=>({...$8,promptQueueUseCount:($8.promptQueueUseCount??0)+1}))},[e.length]);let cJ6=Q8.useCallback(async($8)=>{await Ij8({helpers:{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}},queryGuard:C7,commands:E7,onInputChange:()=>{},setPastedContents:()=>{},setToolJSX:b7,getToolUseContext:NY,messages:G_,mainLoopModel:R6,ideSelection:e8,setUserInputOnProcessing:d5,setAbortController:hA,onQuery:cX,setAppState:C6,querySource:aN6(),onBeforeQuery:f,canUseTool:LW,addNotification:m6,setMessages:v_,queuedCommands:$8})},[C7,E7,b7,NY,G_,R6,e8,d5,LW,hA,cX,m6,C6,f]);qs_({executeQueuedInput:cJ6,hasActiveLocalJsxUI:xq,queryGuard:C7}),Q8.useEffect(()=>{qV6.recordUserActivity(),cr(!0)},[N_,BX]),Q8.useEffect(()=>{if(BX===1)$Jq()},[BX]),Q8.useEffect(()=>{if(H7)return;if(BX===0)return;if(JM===0)return;let $8=setTimeout((R8,p8,lq,jK,lK)=>{if(Ah()>R8)return;let R_=Date.now()-R8;if(!p8&&!lq&&jK.current===void 0&&R_>=j8().messageIdleNotifThresholdMs)uE({message:"Claude is waiting for your input",notificationType:"idle_prompt"},lK)},j8().messageIdleNotifThresholdMs,JM,H7,mK,a8,u6);return()=>clearTimeout($8)},[H7,mK,BX,JM,u6]),Q8.useEffect(()=>{if(JM===0)return;if(H7)return;let $8=_q("tengu_willow_mode","off");if($8!=="hint"&&$8!=="hint_v2")return;if(j8().idleReturnDismissed)return;let R8=Number(process.env.PUKU_CLI_IDLE_TOKEN_THRESHOLD??1e5);if(xW()<R8)return;let p8=Number(process.env.PUKU_CLI_IDLE_THRESHOLD_MINUTES??75)*60000,lq=Date.now()-JM,jK=p8-lq,lK=setTimeout((iq,R_,v7,g7,Z4)=>{if(v7.current.length===0)return;let j$=xW(),l7=hP(j$),zH=(Date.now()-iq)/60000;R_({key:"idle-return-hint",jsx:g7==="hint_v2"?_K.jsxDEV(_K.Fragment,{children:[_K.jsxDEV(T,{dimColor:!0,children:"new task? "},void 0,!1,void 0,this),_K.jsxDEV(T,{color:"suggestion",children:"/clear"},void 0,!1,void 0,this),_K.jsxDEV(T,{dimColor:!0,children:" to save "},void 0,!1,void 0,this),_K.jsxDEV(T,{color:"suggestion",children:[l7," tokens"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):_K.jsxDEV(T,{color:"warning",children:["new task? /clear to save ",l7," tokens"]},void 0,!0,void 0,this),priority:"medium",timeoutMs:2147483647}),Z4.current=g7,Q("tengu_idle_return_action",{action:"hint_shown",variant:g7,idleMinutes:Math.round(zH),messageCount:v7.current.length,totalInputTokens:j$})},Math.max(0,jK),JM,m6,p_,$8,dK);return()=>{clearTimeout(lK),O8("idle-return-hint"),dK.current=!1}},[JM,H7,m6,O8]);let LI6=Q8.useCallback(($8,R8)=>{if(C7.isActive)return!1;if(BuK().some((jK)=>jK.mode==="prompt"||jK.mode==="bash"))return!1;let p8=r4();hA(p8);let lq=C8({content:$8,isMeta:R8?.isMeta?!0:void 0});return cX([lq],p8,!0,[],R6),!0},[cX,R6,d6]),FJ6={stripTrailing:()=>0,handleKeyEvent:()=>{},resetAnchor:()=>{},interimRange:null};ys_({enabled:q_(),isLoading:H7,focusedInputDialog:xz,onSubmitMessage:LI6}),_s_({isLoading:H7,onSubmitMessage:LI6}),Q8.useEffect(()=>{if(e.some(($8)=>$8.priority==="now"))UO.current?.abort("interrupt")},[e]),Q8.useEffect(()=>{return BJ6(),()=>{dp.shutdown()}},[]);let{internal_eventEmitter:pJ}=rF(),[MK6,hI6]=Q8.useState(0);Q8.useEffect(()=>{let $8=()=>{process.stdout.write(`
|
|
7877
7877
|
Puku has been suspended. Run \`fg\` to bring Puku back.
|
|
7878
7878
|
Note: ctrl + z now suspends Puku, ctrl + _ undoes input.
|
|
7879
|
-
`)},R8=()=>{hI6((p8)=>p8+1)};return pJ?.on("suspend",$8),pJ?.on("resume",R8),()=>{pJ?.off("suspend",$8),pJ?.off("resume",R8)}},[pJ]);let UJ6=Q8.useMemo(()=>{if(!H7)return null;let $8=G_.filter((v7)=>v7.type==="progress"&&v7.data.type==="hook_progress"&&(v7.data.hookEvent==="Stop"||v7.data.hookEvent==="SubagentStop"));if($8.length===0)return null;let R8=$8.at(-1)?.toolUseID;if(!R8)return null;if(G_.some((v7)=>v7.type==="system"&&v7.subtype==="stop_hook_summary"&&v7.toolUseID===R8))return null;let lq=$8.filter((v7)=>v7.toolUseID===R8),jK=lq.length,lK=Bq(G_,(v7)=>{if(v7.type!=="attachment")return!1;let g7=v7.attachment;return"hookEvent"in g7&&(g7.hookEvent==="Stop"||g7.hookEvent==="SubagentStop")&&"toolUseID"in g7&&g7.toolUseID===R8}),iq=lq.find((v7)=>v7.data.statusMessage)?.data.statusMessage;if(iq)return jK===1?`${iq}…`:`${iq}… ${lK}/${jK}`;let R_=lq[0]?.data.hookEvent==="SubagentStop"?"subagent stop":"stop";return jK===1?`running ${R_} hook`:`running stop hooks… ${lK}/${jK}`},[G_,H7]),SI6=Q8.useCallback(()=>{QK({messagesLength:G_.length,streamingToolUsesLength:g4.length})},[G_.length,g4.length]),dJ6=Q8.useCallback(()=>{QK(null)},[]),lg=s_()&&!g,hW=Q8.useRef(null),[pL,mL]=Q8.useState(!1),[lG,BY]=Q8.useState(""),[Kr,JK6]=Q8.useState(0),[QJ6,UX]=Q8.useState(0),EI6=Q8.useCallback(($8,R8)=>{JK6($8),UX(R8)},[]);D_(($8,R8,p8)=>{if(R8.ctrl||R8.meta)return;if($8==="/"){hW.current?.setAnchor(),mL(!0),p8.stopImmediatePropagation();return}let lq=$8[0];if((lq==="n"||lq==="N")&&$8===lq.repeat($8.length)&&Kr>0){let jK=lq==="n"?hW.current?.nextMatch:hW.current?.prevMatch;if(jK)for(let lK=0;lK<$8.length;lK++)jK();p8.stopImmediatePropagation()}},{isActive:G6==="transcript"&&lg&&!pL&&!T6});let{setQuery:gL,scanElement:_r,setPositions:BL}=uU_(),ig=Eq().columns,PK6=cO.useRef(ig);cO.useEffect(()=>{if(PK6.current!==ig){if(PK6.current=ig,lG||pL)mL(!1),BY(""),JK6(0),UX(0),hW.current?.disarmSearch(),gL("")}},[ig,lG,pL,gL]),D_(($8,R8,p8)=>{if(R8.ctrl||R8.meta)return;if($8==="q"){dJ6(),p8.stopImmediatePropagation();return}if($8==="["&&!T6)l6(!0),I6(!0),p8.stopImmediatePropagation();else if($8==="v"){if(p8.stopImmediatePropagation(),P6.current)return;P6.current=!0;let lq=B6.current,jK=(lK)=>{if(lq!==B6.current)return;clearTimeout(q8.current),z6(lK)};jK(`rendering ${W8.length} messages…`),(async()=>{try{let lK=Math.max(80,(process.stdout.columns??80)-6),R_=(await J18(W8,YA,lK)).replace(/[ \t]+$/gm,""),v7=_u5(Au5(),`cc-transcript-${Date.now()}.txt`);await zu5(v7,R_);let g7=J98(v7);jK(g7?`opening ${v7}`:`wrote ${v7} · no $VISUAL/$EDITOR set`)}catch(lK){jK(`render failed: ${lK instanceof Error?lK.message:String(lK)}`)}if(P6.current=!1,lq!==B6.current)return;q8.current=setTimeout((lK)=>lK(""),4000,z6)})()}},{isActive:G6==="transcript"&&lg&&!pL});let rg=G6==="transcript"&≶Q8.useEffect(()=>{if(!rg)BY(""),JK6(0),UX(0),mL(!1),B6.current++,clearTimeout(q8.current),l6(!1),z6("")},[rg]),Q8.useEffect(()=>{if(gL(rg?lG:""),!rg)BL(null)},[rg,lG,gL,BL]);let CI6={screen:G6,setScreen:W6,showAllInTranscript:L6,setShowAllInTranscript:I6,messageCount:G_.length,onEnterTranscript:SI6,onExitTranscript:dJ6,virtualScrollActive:lg,searchBarOpen:pL},JJ8=kq?W8.slice(0,kq.messagesLength):W8,bI6=kq?g4.slice(0,kq.streamingToolUsesLength):g4;if(Wa_({onOpenBackgroundTasks:xq?void 0:()=>nq6(!0)}),Ra_(),G6==="transcript"){let $8=s_()&&!g&&!T6?O$:void 0,R8=_K.jsxDEV(Q86,{messages:JJ8,tools:YA,commands:E7,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:EL,isMessageSelectorVisible:!1,conversationId:vJ6,screen:G6,agentDefinitions:n,streamingToolUses:bI6,showAllInTranscript:L6,onOpenRateLimitOptions:uJ6,isLoading:H7,hidePastThinking:!0,streamingThinking:vO,scrollRef:$8,jumpRef:hW,onSearchMatchesChange:EI6,scanElement:_r,setPositions:BL,disableRenderCap:T6},void 0,!1,void 0,this),p8=mK&&_K.jsxDEV(I,{flexDirection:"column",width:"100%",children:mK.jsx},void 0,!1,void 0,this),lq=_K.jsxDEV(d1,{children:[_K.jsxDEV(c67,{isAnimating:cq,title:QO,disabled:u,noPrefix:vA},void 0,!1,void 0,this),_K.jsxDEV(wJq,{...CI6},void 0,!1,void 0,this),null,_K.jsxDEV(HJq,{onSubmit:FX,isActive:!mK?.isLocalJSXCommand},void 0,!1,void 0,this),$8?_K.jsxDEV(tJq,{scrollRef:O$,isActive:xz!=="ultraplan-choice",isModal:!pL,onScroll:()=>hW.current?.disarmSearch()},void 0,!1,void 0,this):null,_K.jsxDEV(jJq,{...CJ6},void 0,!1,void 0,this),$8?_K.jsxDEV(R9q,{scrollRef:O$,scrollable:_K.jsxDEV(_K.Fragment,{children:[R8,p8,_K.jsxDEV(FJq,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bottom:pL?_K.jsxDEV(Pu5,{jumpRef:hW,initialQuery:"",count:Kr,current:QJ6,onClose:(jK)=>{if(BY(Kr>0?jK:""),mL(!1),!jK)JK6(0),UX(0),hW.current?.setSearchQuery("")},onCancel:()=>{mL(!1),hW.current?.setSearchQuery(""),hW.current?.setSearchQuery(lG),gL(lG)},setHighlight:gL},void 0,!1,void 0,this):_K.jsxDEV(g67,{showAllInTranscript:L6,virtualScroll:!0,status:z8||void 0,searchBadge:lG&&Kr>0?{current:QJ6,count:Kr}:void 0},void 0,!1,void 0,this)},void 0,!1,void 0,this):_K.jsxDEV(_K.Fragment,{children:[R8,p8,_K.jsxDEV(FJq,{},void 0,!1,void 0,this),_K.jsxDEV(g67,{showAllInTranscript:L6,virtualScroll:!1,suppressShowAll:T6,status:z8||void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if($8)return _K.jsxDEV(sJq,{mouseTracking:$c8(),children:lq},void 0,!1,void 0,this);return lq}let ng=v6?J6[v6]:void 0,cL=ng&&Zw(ng)?ng:void 0,AH=cL??(ng&&A1(ng)?ng:void 0),II6=AH?AH.messages??[]:d9||!H7?G_:W8,lJ6=j4&&!AH&&II6.length<=gY.current?j4:void 0,XK6=xz==="tool-permission"?_K.jsxDEV(vl_,{onDone:()=>ZA(([$8,...R8])=>R8),onReject:ti,toolUseConfirm:o_[0],toolUseContext:NY(G_,G_,Y$??r4(),R6),verbose:d,workerBadge:o_[0]?.workerBadge,setStickyFooter:s_()?e5:void 0},o_[0]?.toolUseID,!1,void 0,this):null,XJ8=ig<Ijq,xI6=!mK?.shouldHidePromptInput&&!xz&&!Xb,Ar=s_()&&mK?.isLocalJSXCommand===!0,Gb=Ar?mK.jsx:null,uI6=_K.jsxDEV(d1,{children:[_K.jsxDEV(c67,{isAnimating:cq,title:QO,disabled:u,noPrefix:vA},void 0,!1,void 0,this),_K.jsxDEV(wJq,{...CI6},void 0,!1,void 0,this),null,_K.jsxDEV(HJq,{onSubmit:FX,isActive:!mK?.isLocalJSXCommand},void 0,!1,void 0,this),_K.jsxDEV(tJq,{scrollRef:O$,isActive:s_()&&(Gb!=null||!xz||xz==="tool-permission"),onScroll:Gb||XK6||AH?void 0:E6},void 0,!1,void 0,this),null,_K.jsxDEV(jJq,{...CJ6},void 0,!1,void 0,this),_K.jsxDEV(f98,{dynamicMcpConfig:y6,isStrictMcpConfig:J,children:_K.jsxDEV(R9q,{scrollRef:O$,overlay:XK6,bottomFloat:void 0,modal:Gb,modalScrollRef:U5,dividerYRef:mX,hidePill:!!AH,hideSticky:!!cL,newMessageCount:XP?.count??0,onPillClick:()=>{RW(null),PP(O$.current)},scrollable:_K.jsxDEV(_K.Fragment,{children:[_K.jsxDEV(Xs_,{},void 0,!1,void 0,this),_K.jsxDEV(Q86,{messages:II6,tools:YA,commands:E7,verbose:d,toolJSX:mK,toolUseConfirmQueue:o_,inProgressToolUseIDs:cL?cL.inProgressToolUseIDs??new Set:EL,isMessageSelectorVisible:K9,conversationId:vJ6,screen:G6,streamingToolUses:g4,showAllInTranscript:L6,agentDefinitions:n,onOpenRateLimitOptions:uJ6,isLoading:H7,streamingText:H7&&!AH?IL:null,isBriefOnly:AH?!1:s6,unseenDivider:AH?void 0:XP,scrollRef:s_()?O$:void 0,trackStickyPrompt:s_()?!0:void 0,cursor:xJ,setCursor:RW,cursorNavRef:Ek},void 0,!1,void 0,this),_K.jsxDEV(de_,{},void 0,!1,void 0,this),!Z&&lJ6&&!Gb&&_K.jsxDEV(Y66,{param:{text:lJ6,type:"text"},addMargin:!0,verbose:d},void 0,!1,void 0,this),mK&&!(mK.isLocalJSXCommand&&mK.isImmediate)&&!Ar&&_K.jsxDEV(I,{flexDirection:"column",width:"100%",children:mK.jsx},void 0,!1,void 0,this),!1,null,_K.jsxDEV(I,{flexGrow:1},void 0,!1,void 0,this),mg&&_K.jsxDEV(V__,{mode:u_,spinnerTip:q6,responseLengthRef:VW,apiMetricsRef:bk,overrideMessage:J8,spinnerSuffix:UJ6,verbose:d,loadingStartTimeRef:V4,totalPausedMsRef:YY,pauseStartTimeRef:f5,overrideColor:uK,overrideShimmerColor:L4,hasActiveTools:EL.size>0,leaderIsIdle:!H7},void 0,!1,void 0,this),!mg&&!H7&&!j4&&!fb&&s6&&!AH&&_K.jsxDEV(L__,{},void 0,!1,void 0,this),s_()&&_K.jsxDEV(Gj8,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bottom:_K.jsxDEV(I,{flexDirection:"row",width:"100%",alignItems:"flex-end",children:[null,_K.jsxDEV(I,{flexDirection:"column",flexGrow:1,children:[Q7,mK?.isLocalJSXCommand&&mK.isImmediate&&!Ar&&_K.jsxDEV(I,{flexDirection:"column",width:"100%",children:mK.jsx},void 0,!1,void 0,this),!mg&&!mK?.isLocalJSXCommand&&f6&&n_&&n_.length>0&&_K.jsxDEV(I,{width:"100%",flexDirection:"column",children:_K.jsxDEV(D78,{tasks:n_,isStandalone:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),xz==="sandbox-permission"&&_K.jsxDEV(cJq,{hostPattern:GA[0].hostPattern,onUserResponse:($8)=>{let{allow:R8,persistToSettings:p8}=$8,lq=GA[0];if(!lq)return;let jK=lq.hostPattern.host;if(p8){let iq={type:"addRules",rules:[{toolName:N9,ruleContent:`domain:${jK}`}],behavior:R8?"allow":"deny",destination:"localSettings"};C6((R_)=>({...R_,toolPermissionContext:xY(R_.toolPermissionContext,iq)})),KE(iq),Iq.refreshConfig()}W4((iq)=>{return iq.filter((R_)=>R_.hostPattern.host===jK).forEach((R_)=>R_.resolvePromise(R8)),iq.filter((R_)=>R_.hostPattern.host!==jK)});let lK=$A.current.get(jK);if(lK){for(let iq of lK)iq();$A.current.delete(jK)}}},GA[0].hostPattern.host,!1,void 0,this),xz==="prompt"&&_K.jsxDEV(Cl_,{title:B4[0].title,toolInputSummary:B4[0].toolInputSummary,request:B4[0].request,onRespond:($8)=>{let R8=B4[0];if(!R8)return;R8.resolve({prompt_response:R8.request.prompt,selected:$8}),qz(([,...p8])=>p8)},onAbort:()=>{let $8=B4[0];if(!$8)return;$8.reject(Error("Prompt cancelled by user")),qz(([,...R8])=>R8)}},B4[0].request.prompt,!1,void 0,this),$6&&_K.jsxDEV(tHq,{toolName:$6.toolName,description:$6.description},void 0,!1,void 0,this),N6&&_K.jsxDEV(tHq,{toolName:"Network Access",description:`Waiting for leader to approve network access to ${N6.host}`},void 0,!1,void 0,this),xz==="worker-sandbox-permission"&&_K.jsxDEV(cJq,{hostPattern:{host:O6.queue[0].host,port:void 0},onUserResponse:($8)=>{let{allow:R8,persistToSettings:p8}=$8,lq=O6.queue[0];if(!lq)return;let jK=lq.host;if(yK_(lq.workerName,lq.requestId,jK,R8,H6?.teamName),p8&&R8){let lK={type:"addRules",rules:[{toolName:N9,ruleContent:`domain:${jK}`}],behavior:"allow",destination:"localSettings"};C6((iq)=>({...iq,toolPermissionContext:xY(iq.toolPermissionContext,lK)})),KE(lK),Iq.refreshConfig()}C6((lK)=>({...lK,workerSandboxPermissions:{...lK.workerSandboxPermissions,queue:lK.workerSandboxPermissions.queue.slice(1)}}))}},O6.queue[0].requestId,!1,void 0,this),xz==="elicitation"&&_K.jsxDEV(hl_,{event:j6.queue[0],onResponse:($8,R8)=>{let p8=j6.queue[0];if(!p8)return;if(p8.respond({action:$8,content:R8}),!(p8.params.mode==="url"&&$8==="accept"))C6((jK)=>({...jK,elicitation:{queue:jK.elicitation.queue.slice(1)}}))},onWaitingDismiss:($8)=>{let R8=j6.queue[0];C6((p8)=>({...p8,elicitation:{queue:p8.elicitation.queue.slice(1)}})),R8?.onWaitingDismiss?.($8)}},j6.queue[0].serverName+":"+String(j6.queue[0].requestId),!1,void 0,this),xz==="cost"&&_K.jsxDEV(mU_,{onDone:()=>{GJ6(!1),DJ6(!0),g8(($8)=>({...$8,hasAcknowledgedCostThreshold:!0})),Q("tengu_cost_threshold_acknowledged",{})}},void 0,!1,void 0,this),xz==="idle-return"&&xg&&_K.jsxDEV(cU_,{idleMinutes:xg.idleMinutes,totalInputTokens:xW(),onDone:async($8)=>{let R8=xg;if(rq6(null),Q("tengu_idle_return_action",{action:$8,idleMinutes:Math.round(R8.idleMinutes),messageCount:p_.current.length,totalInputTokens:xW()}),$8==="dismiss"){cA(R8.input);return}if($8==="never")g8((p8)=>{if(p8.idleReturnDismissed)return p8;return{...p8,idleReturnDismissed:!0}});if($8==="clear"){let{clearConversation:p8}=await Promise.resolve().then(() => (C38(),I$q));await p8({setMessages:v_,readFileState:Py.current,discoveredSkillNames:_K6.current,loadedNestedMemoryPaths:AK6.current,getAppState:()=>d6.getState(),setAppState:C6,setConversationId:dG}),TY.current=!1,bw(void 0),Fg.current.clear(),Ug.current=0}di.current=!0,wK6.current(R8.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}},void 0,!1,void 0,this),xz==="ide-onboarding"&&_K.jsxDEV(Ss8,{onDone:()=>M6(!1),installationStatus:wK},void 0,!1,void 0,this),!1,!1,xz==="effort-callout"&&_K.jsxDEV(gs_,{model:R6,onDone:($8)=>{if(e6(!1),$8!=="dismiss")C6((R8)=>({...R8,effortValue:$8}))}},void 0,!1,void 0,this),xz==="remote-callout"&&_K.jsxDEV(Fs_,{onDone:($8)=>{C6((R8)=>{if(!R8.showRemoteCallout)return R8;return{...R8,showRemoteCallout:!1,...$8==="enable"&&{replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1}}})}},void 0,!1,void 0,this),dg,xz==="plugin-hint"&&oq&&_K.jsxDEV(he_,{pluginName:oq.pluginName,pluginDescription:oq.pluginDescription,marketplaceName:oq.marketplaceName,sourceCommand:oq.sourceCommand,onResponse:C_},void 0,!1,void 0,this),xz==="lsp-recommendation"&&Aq&&_K.jsxDEV(Ne_,{pluginName:Aq.pluginName,pluginDescription:Aq.pluginDescription,fileExtension:Aq.fileExtension,onResponse:OK},void 0,!1,void 0,this),xz==="desktop-upsell"&&_K.jsxDEV(gt_,{onDone:()=>o8(!1)},void 0,!1,void 0,this),null,null,yJ6(),!mK?.shouldHidePromptInput&&!xz&&!si&&!Z&&!xJ&&!E36()&&_K.jsxDEV(_K.Fragment,{children:[oi&&_K.jsxDEV(Z67,{onRun:jJ8,onCancel:OK6,reason:D67(oi)},void 0,!1,void 0,this),cg.state!=="closed"?_K.jsxDEV(db6,{state:cg.state,lastResponse:cg.lastResponse,handleSelect:cg.handleSelect,inputValue:N_,setInputValue:cA,onRequestFeedback:ei},void 0,!1,void 0,this):Zb.state!=="closed"?_K.jsxDEV(db6,{state:Zb.state,lastResponse:Zb.lastResponse,handleSelect:Zb.handleSelect,handleTranscriptSelect:Zb.handleTranscriptSelect,inputValue:N_,setInputValue:cA,onRequestFeedback:ei,message:"How well did Claude use its memory? (optional)"},void 0,!1,void 0,this):_K.jsxDEV(db6,{state:Wb.state,lastResponse:Wb.lastResponse,handleSelect:Wb.handleSelect,handleTranscriptSelect:Wb.handleTranscriptSelect,inputValue:N_,setInputValue:cA,onRequestFeedback:zK6.current?void 0:ei},void 0,!1,void 0,this),ri.state!=="closed"&&_K.jsxDEV(db6,{state:ri.state,lastResponse:null,handleSelect:()=>{},handleTranscriptSelect:ri.handleTranscriptSelect,inputValue:N_,setInputValue:cA},void 0,!1,void 0,this),!1,qK6&&_K.jsxDEV(T67,{},void 0,!1,void 0,this),_K.jsxDEV(ko_,{debug:K,ideSelection:e8,hasSuppressedDialogs:!!DI6,isLocalJSXCommandActive:xq,getToolUseContext:NY,toolPermissionContext:U,setToolPermissionContext:Qg,apiKeyStatus:VJ6,commands:E7,agents:n.activeAgents,isLoading:H7,onExit:yI6,verbose:d,messages:G_,onAutoUpdaterResult:K7,autoUpdaterResult:RK,input:N_,onInputChange:cA,mode:q9,onModeChange:Iw,stashedPrompt:Iz,setStashedPrompt:U9,submitCount:BX,onShowMessageSelector:pJ6,onMessageActionsEnter:void 0,mcpClients:i8,pastedContents:gX,setPastedContents:Zz,vimMode:kJ6,setVimMode:WI6,showBashesDialog:Xb,setShowBashesDialog:nq6,onSubmit:FX,onAgentSubmit:NI6,isSearchingHistory:TJ6,setIsSearchingHistory:pg,helpOpen:li,setHelpOpen:ZI6,insertTextRef:void 0,voiceInterimRange:FJ6.interimRange},void 0,!1,void 0,this),_K.jsxDEV(xs_,{onBackgroundSession:TI6,isLoading:H7},void 0,!1,void 0,this)]},void 0,!0,void 0,this),xJ&&_K.jsxDEV(MrK,{cursor:xJ},void 0,!1,void 0,this),xz==="message-selector"&&_K.jsxDEV($jq,{messages:G_,preselectedMessage:WP,onPreRestore:Xy,onRestoreCode:async($8)=>{await RA8((R8)=>{C6((p8)=>({...p8,fileHistory:R8(p8.fileHistory)}))},$8.uuid)},onSummarize:async($8,R8,p8="from")=>{let lq=l3(G_),jK=lq.indexOf($8);if(jK===-1){v_((A9)=>[...A9,Jw("That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.","warning")]);return}let lK=r4(),iq=NY(lq,[],lK,R6),R_=iq.getAppState(),v7=await lj(iq.options.tools,iq.options.mainLoopModel,Array.from(R_.toolPermissionContext.additionalWorkingDirectories.keys()),iq.options.mcpClients),g7=SN({mainThreadAgentDefinition:void 0,toolUseContext:iq,customSystemPrompt:iq.options.customSystemPrompt,defaultSystemPrompt:v7,appendSystemPrompt:iq.options.appendSystemPrompt}),[Z4,j$]=await Promise.all([$O(),$3()]),l7=await jW_(lq,jK,iq,{systemPrompt:g7,userContext:Z4,systemContext:j$,toolUseContext:iq,forkContextMessages:lq},R8,p8),zH=l7.messagesToKeep??[],kO=p8==="up_to"?[...l7.summaryMessages,...zH]:[...zH,...l7.summaryMessages],cY=[l7.boundaryMarker,...kO,...l7.attachments,...l7.hookResults];if(s_()&&p8==="from")v_((A9)=>{let dX=A9.findIndex((fK6)=>fK6.uuid===$8.uuid);return[...A9.slice(0,dX===-1?0:dX),...cY]});else v_(cY);if(dG(KI6()),qL(iq.options.querySource),p8==="from"){let A9=MYq($8);if(A9)cA(A9.text),Iw(A9.mode)}let S5=K1("app:toggleTranscript","Global","ctrl+o");m6({key:"summarize-ctrl-o-hint",text:`Conversation summarized (${S5} for history)`,priority:"medium",timeoutMs:8000})},onRestoreMessage:mJ6,onClose:()=>{R1(!1),xk(void 0)}},void 0,!1,void 0,this),!1]},void 0,!0,void 0,this),null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},MK6,!1,void 0,this)]},void 0,!0,void 0,this);if(s_())return _K.jsxDEV(sJq,{mouseTracking:$c8(),children:uI6},void 0,!1,void 0,this);return uI6}var q2q,cO,Q8,_K,Yu5=()=>({state:"closed",handleTranscriptSelect:()=>{}}),$u5=()=>{},Ou5=()=>({}),m67=null,wu5=(q)=>()=>{},Hu5=()=>!1,ju5=(q,K)=>!1,eJq,Mu5,Ju5=3000,F67,B67="❏",Xu5=960;var _2q=h(()=>{v8();b$8();__();a6();Il();A7();pU_();M1q();xC();a6();gU_();FU_();nY();eR6();rU_();VS();ju();sP();$H8();v8();L2();Y8();aU_();I8();vK();$k6();wJ();k96();R96();JY();Kd_();SV();Uj();$Q();Ad_();Pd_();d$();PH8();Dd_();kl_();Sl_();bl_();To_();rMq();ho_();Co_();Io_();uo_();Bo_();Qo_();J3();pD();p16();kZ();CH();OJq();kN();_a_();BHq();Ya_();Oa_();mN();jMq();Ha_();Ma_();Pa_();EE();mH();XE();fa_();Za_();Na_();Va_();T8();N8();ma_();Mw();Ljq();LH();Yz();U06();hZ();Tq();Sx();Vq();Vj6();rz();i$();aa_();Ks_();As_();A86();J66();$s_();J88();pwq();dw8();ws_();Js_();TJq();qC6();oe8();fs_();T78();aO8();uQ();D$();Zs_();GJ();ad();kAq();lE();KK();J1();e_();Yw6();NN6();gR();TS6();$X();pp();tZ();gu();e_();Fb6();JC();gQ();Rs_();iY();Ls_();F3();Cs_();j1q();H1q();TX();R9();CM6();us_();z$8();ms_();$66();Zt();Es8();cs_();Us_();Fe8();m3();Ul();rs_();os_();ts_();_t_();zt_();Ot_();vt_();Nt_();Vt_();Ut_();H8q();bY();AM8();at_();tt_();qe_();jOq();ze_();$e_();Kj8();He_();Te_();ye_();Le_();Se_();xJq();Ie_();pe_();Fe_();r48();Qe_();re_();ae_();ee_();_67();z67();H67();f67();k67();y67();xjq();R67();d$();V9q();yH();h67();p67();gZ();RH();tj();q2q=p(A8(),1),cO=p(_8(),1),Q8=p(_8(),1),_K=p(a(),1),eJq=[],Mu5={maybeLoadOlder:(q)=>{}};F67=["❏","❐"]});async function _I6(q,K,_,A){let{App:z}=await Promise.resolve().then(() => (lHq(),QHq)),{REPL:Y}=await Promise.resolve().then(() => (_2q(),U67));await A(q,A2q.jsxDEV(z,{...K,children:A2q.jsxDEV(Y,{..._},void 0,!1,void 0,this)},void 0,!1,void 0,this))}var A2q;var d67=h(()=>{A2q=p(a(),1)});async function Gu5(){if(aO())return R("[Bootstrap] Skipped: Nonessential traffic disabled"),null;if(Xq()!=="firstParty")return R("[Bootstrap] Skipped: 3P provider"),null;let q=Uv();if(!(O_()?.accessToken&&dv())&&!q)return R("[Bootstrap] Skipped: no usable OAuth or API key"),null;let _=`${LK().BASE_API_URL}/api/claude_cli/bootstrap`;try{return await ha(async()=>{let A=O_()?.accessToken,z;if(A&&dv())z={Authorization:`Bearer ${A}`,"anthropic-beta":LM};else if(q)z={"x-api-key":q};else return R("[Bootstrap] No auth available on retry, aborting"),null;R("[Bootstrap] Fetching");let Y=await Jq.get(_,{headers:{"Content-Type":"application/json","User-Agent":zw(),...z},timeout:5000}),$=Zu5().safeParse(Y.data);if(!$.success)return R(`[Bootstrap] Response failed validation: ${$.error.message}`),null;return R("[Bootstrap] Fetch ok"),$.data})}catch(A){throw R(`[Bootstrap] Fetch failed: ${Jq.isAxiosError(A)?A.response?.status??A.code:"unknown"}`),A}}async function Q67(){try{let q=await Gu5();if(!q)return;let K=q.client_data??null,_=q.additional_model_options??[],A=j8();if(Rf(A.clientDataCache,K)&&Rf(A.additionalModelOptionsCache,_)){R("[Bootstrap] Cache unchanged, skipping write");return}R("[Bootstrap] Cache updated, persisting to disk"),g8((z)=>({...z,clientDataCache:K,additionalModelOptionsCache:_}))}catch(q){_6(q)}}var Zu5;var l67=h(()=>{G4();La();GK();LY8();CA();Tq();Y8();jS();N8();C4();Zu5=x6(()=>S2.object({client_data:S2.record(S2.unknown()).nullish(),additional_model_options:S2.array(S2.object({model:S2.string(),name:S2.string(),description:S2.string()}).transform(({model:q,name:K,description:_})=>({value:q,label:K,description:_}))).nullish()}))});function Du5(q){try{let K=new URL(q);return K.search="",K.toString().replace(/\/$/,"")}catch{return}}async function i67(){if(process.env.PUKU_CLI_DISABLE_NONESSENTIAL_TRAFFIC)return;try{let q=await Jq.get("https://api.anthropic.com/mcp-registry/v0/servers?version=latest&visibility=commercial",{timeout:5000}),K=new Set;for(let _ of q.data.servers)for(let A of _.server.remotes??[]){let z=Du5(A.url);if(z)K.add(z)}vu5=K,R(`[mcp-registry] Loaded ${K.size} official MCP URLs`)}catch(q){R(`Failed to fetch MCP registry: ${r6(q)}`,{level:"error"})}}var vu5=void 0;var r67=h(()=>{G4();Y8();T8()});function Nu5(q){let K=`${q.name}: ${q.message}`;return Tu5.some((_)=>_.test(K))}function n67(){let q=process.listeners("warning");if(DM8&&q.includes(DM8))return;if(!1)process.removeAllListeners("warning");DM8=(_)=>{try{let A=`${_.name}: ${_.message.slice(0,50)}`,z=vM8.get(A)||0;if(vM8.has(A)||vM8.size<ku5)vM8.set(A,z+1);let Y=Nu5(_);if(Q("tengu_node_warning",{is_internal:Y?1:0,occurrence_count:z+1,classname:_.name,...process.env.USER_TYPE==="ant"&&{message:_.message}}),p6(process.env.PUKU_CLI_DEBUG))R(`${Y?"[Internal Warning]":"[Warning]"} ${_.toString()}`,{level:"warn"})}catch{}},process.on("warning",DM8)}var ku5=1000,vM8,Tu5,DM8=null;var o67=h(()=>{Y8();I8();V7();vM8=new Map,Tu5=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/]});function kM8(){let q=a67.c(1),K;if(q[0]===Symbol.for("react.memo_cache_sentinel"))K=z2q.jsxDEV(T,{children:["MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the"," ",z2q.jsxDEV(nK,{url:"https://puku.sh/docs/en/mcp",children:"MCP documentation"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),q[0]=K;else K=q[0];return K}var a67,z2q;var Y2q=h(()=>{a6();a67=p(A8(),1),z2q=p(a(),1)});function t67(q){let K=s67.c(13),{serverName:_,onDone:A}=q,z;if(K[0]!==A||K[1]!==_)z=function(P){Q("tengu_mcp_dialog_choice",{choice:P});q:switch(P){case"yes":case"yes_all":{let f=(Fq()||{}).enabledMcpjsonServers||[];if(!f.includes(_))gq("localSettings",{enabledMcpjsonServers:[...f,_]});if(P==="yes_all")gq("localSettings",{enableAllProjectMcpServers:!0});A();break q}case"no":{let f=(Fq()||{}).disabledMcpjsonServers||[];if(!f.includes(_))gq("localSettings",{disabledMcpjsonServers:[...f,_]});A()}}},K[0]=A,K[1]=_,K[2]=z;else z=K[2];let Y=z,$=`New MCP server found in .mcp.json: ${_}`,O;if(K[3]!==Y)O=()=>Y("no"),K[3]=Y,K[4]=O;else O=K[4];let w;if(K[5]===Symbol.for("react.memo_cache_sentinel"))w=TM8.jsxDEV(kM8,{},void 0,!1,void 0,this),K[5]=w;else w=K[5];let H;if(K[6]===Symbol.for("react.memo_cache_sentinel"))H=[{label:"Use this and all future MCP servers in this project",value:"yes_all"},{label:"Use this MCP server",value:"yes"},{label:"Continue without using this MCP server",value:"no"}],K[6]=H;else H=K[6];let j;if(K[7]!==Y)j=TM8.jsxDEV(r8,{options:H,onChange:(J)=>Y(J),onCancel:()=>Y("no")},void 0,!1,void 0,this),K[7]=Y,K[8]=j;else j=K[8];let M;if(K[9]!==$||K[10]!==O||K[11]!==j)M=TM8.jsxDEV(Pq,{title:$,color:"warning",onCancel:O,children:[w,j]},void 0,!0,void 0,this),K[9]=$,K[10]=O,K[11]=j,K[12]=M;else M=K[12];return M}var s67,TM8;var e67=h(()=>{Rq();Jz();J7();Y2q();s67=p(A8(),1),TM8=p(a(),1)});function K87(q){let K=q87.c(21),{serverNames:_,onDone:A}=q,z;if(K[0]!==A||K[1]!==_)z=function(W){let Z=Fq()||{},v=Z.enabledMcpjsonServers||[],k=Z.disabledMcpjsonServers||[],[N,y]=Uw8(_,(L)=>W.includes(L));if(Q("tengu_mcp_multidialog_choice",{approved:N.length,rejected:y.length}),N.length>0){let L=[...new Set([...v,...N])];gq("localSettings",{enabledMcpjsonServers:L})}if(y.length>0){let L=[...new Set([...k,...y])];gq("localSettings",{disabledMcpjsonServers:L})}A()},K[0]=A,K[1]=_,K[2]=z;else z=K[2];let Y=z,$;if(K[3]!==A||K[4]!==_)$=()=>{let W=(Fq()||{}).disabledMcpjsonServers||[],Z=[...new Set([...W,..._])];gq("localSettings",{disabledMcpjsonServers:Z}),A()},K[3]=A,K[4]=_,K[5]=$;else $=K[5];let O=$,w=`${_.length} new MCP servers found in .mcp.json`,H;if(K[6]===Symbol.for("react.memo_cache_sentinel"))H=Lk.jsxDEV(kM8,{},void 0,!1,void 0,this),K[6]=H;else H=K[6];let j;if(K[7]!==_)j=_.map(yu5),K[7]=_,K[8]=j;else j=K[8];let M;if(K[9]!==O||K[10]!==Y||K[11]!==_||K[12]!==j)M=Lk.jsxDEV(U36,{options:j,defaultValue:_,onSubmit:Y,onCancel:O,hideIndexes:!0},void 0,!1,void 0,this),K[9]=O,K[10]=Y,K[11]=_,K[12]=j,K[13]=M;else M=K[13];let J;if(K[14]!==O||K[15]!==w||K[16]!==M)J=Lk.jsxDEV(Pq,{title:w,subtitle:"Select any you wish to enable.",color:"warning",onCancel:O,hideInputGuide:!0,children:[H,M]},void 0,!0,void 0,this),K[14]=O,K[15]=w,K[16]=M,K[17]=J;else J=K[17];let P;if(K[18]===Symbol.for("react.memo_cache_sentinel"))P=Lk.jsxDEV(I,{paddingX:1,children:Lk.jsxDEV(T,{dimColor:!0,italic:!0,children:Lk.jsxDEV(fq,{children:[Lk.jsxDEV(c8,{shortcut:"Space",action:"select"},void 0,!1,void 0,this),Lk.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),Lk.jsxDEV(qq,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"reject all"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[18]=P;else P=K[18];let X;if(K[19]!==J)X=Lk.jsxDEV(Lk.Fragment,{children:[J,P]},void 0,!0,void 0,this),K[19]=J,K[20]=X;else X=K[20];return X}function yu5(q){return{label:q,value:q}}var q87,Lk;var _87=h(()=>{uwq();a6();Rq();k4();S_8();S7();J7();t7();Y2q();q87=p(A8(),1),Lk=p(a(),1)});async function A87(q){let{servers:K}=Xw("project"),_=Object.keys(K).filter((A)=>nO6(A)==="pending");if(_.length===0)return;await new Promise((A)=>{let z=()=>void A();if(_.length===1&&_[0]!==void 0){let Y=_[0];q.render(Bq6.jsxDEV(Y1,{children:Bq6.jsxDEV(d1,{children:Bq6.jsxDEV(t67,{serverName:Y,onDone:z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}else q.render(Bq6.jsxDEV(Y1,{children:Bq6.jsxDEV(d1,{children:Bq6.jsxDEV(K87,{serverNames:_,onDone:z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))})}var Bq6;var z87=h(()=>{e67();_87();EE();KK();x2();fw();Bq6=p(a(),1)});var Y87=h(()=>{Tq();Y8()});class $2q{frameDurations=[];firstRenderTime;lastRenderTime;record(q){let K=performance.now();if(this.firstRenderTime===void 0)this.firstRenderTime=K;this.lastRenderTime=K,this.frameDurations.push(q)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let q=this.lastRenderTime-this.firstRenderTime;if(q<=0)return;let _=this.frameDurations.length/(q/1000),A=this.frameDurations.slice().sort((O,w)=>w-O),z=Math.max(0,Math.ceil(A.length*0.01)-1),Y=A[z],$=Y>0?1000/Y:0;return{averageFps:Math.round(_*100)/100,low1PctFps:Math.round($*100)/100}}}import{realpath as Ru5}from"fs/promises";async function $87(){try{let q=await zc();if(!q){R("Not in a GitHub repository, skipping path mapping update");return}let K=yq(),A=nz(K)??K,z;try{z=(await Ru5(A)).normalize("NFC")}catch{z=A}let Y=q.toLowerCase(),O=j8().githubRepoPaths?.[Y]??[];if(O[0]===z){R(`Path ${z} already tracked for repo ${Y}`);return}let w=O.filter((j)=>j!==z),H=[z,...w];g8((j)=>({...j,githubRepoPaths:{...j.githubRepoPaths,[Y]:H}})),R(`Added ${z} to tracked paths for repo ${Y}`)}catch(q){R(`Error updating repo path mapping: ${q}`)}}function O87(q){let K=j8(),_=q.toLowerCase();return K.githubRepoPaths?.[_]??[]}async function w87(q){let K=await Promise.all(q.map(q4));return q.filter((_,A)=>K[A])}async function H87(q,K){try{let _=await hg6(q);if(!_)return!1;let A=yn(_);if(!A)return!1;return A.toLowerCase()===K.toLowerCase()}catch{return!1}}function j87(q,K){let _=j8(),A=q.toLowerCase(),z=_.githubRepoPaths?.[A]??[],Y=z.filter((O)=>O!==K);if(Y.length===z.length)return;let $={..._.githubRepoPaths};if(Y.length===0)delete $[A];else $[A]=Y;g8((O)=>({...O,githubRepoPaths:$})),R(`Removed ${K} from tracked paths for repo ${A}`)}var NM8=h(()=>{v8();Tq();Y8();mW();n7();WI();kA()});function M87(q,K){let[_,A]=yM8.useState(!1);return yM8.useEffect(()=>{A(!1);let z=setTimeout(A,q,!0);return()=>clearTimeout(z)},[q,K]),_}var yM8;var J87=h(()=>{yM8=p(_8(),1)});async function Vu5(){try{let q=LK(),K=new URL(q.TOKEN_URL),_=[`${q.BASE_API_URL}/api/hello`,`${K.origin}/v1/oauth/hello`],A=async($)=>{try{let O=await Jq.get($,{headers:{"User-Agent":EF()}});if(O.status!==200)return{success:!1,error:`Failed to connect to ${new URL($).hostname}: Status ${O.status}`};return{success:!0}}catch(O){let w=new URL($).hostname,H=aU(O);return{success:!1,error:`Failed to connect to ${w}: ${O instanceof Error?O.code||O.message:String(O)}`,sslHint:H??void 0}}},Y=(await Promise.all(_.map(A))).find(($)=>!$.success);if(Y)Q("tengu_preflight_check_failed",{isConnectivityError:!1,hasErrorMessage:!!Y.error,isSSLError:!!Y.sslHint});return Y||{success:!0}}catch(q){return _6(q),Q("tengu_preflight_check_failed",{isConnectivityError:!0}),{success:!1,error:`Connectivity check error: ${q instanceof Error?q.code||q.message:String(q)}`}}}function X87(q){let K=P87.c(12),{onSuccess:_}=q,[A,z]=JJ6.useState(null),[Y,$]=JJ6.useState(!0),O=M87(1000)&&Y,w,H;if(K[0]===Symbol.for("react.memo_cache_sentinel"))w=()=>{(async function(){let W=await Vu5();z(W),$(!1)})()},H=[],K[0]=w,K[1]=H;else w=K[0],H=K[1];JJ6.useEffect(w,H);let j,M;if(K[2]!==_||K[3]!==A)j=()=>{if(A?.success)_();else if(A&&!A.success){let X=setTimeout(Lu5,100);return()=>clearTimeout(X)}},M=[A,_],K[2]=_,K[3]=A,K[4]=j,K[5]=M;else j=K[4],M=K[5];JJ6.useEffect(j,M);let J;if(K[6]!==Y||K[7]!==A||K[8]!==O)J=Y&&O?TW.jsxDEV(I,{paddingLeft:1,children:[TW.jsxDEV(T7,{},void 0,!1,void 0,this),TW.jsxDEV(T,{children:"Checking connectivity..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):!A?.success&&!Y&&TW.jsxDEV(I,{flexDirection:"column",gap:1,children:[TW.jsxDEV(T,{color:"error",children:"Unable to connect to Anthropic services"},void 0,!1,void 0,this),TW.jsxDEV(T,{color:"error",children:A?.error},void 0,!1,void 0,this),A?.sslHint?TW.jsxDEV(I,{flexDirection:"column",gap:1,children:[TW.jsxDEV(T,{children:A.sslHint},void 0,!1,void 0,this),TW.jsxDEV(T,{color:"suggestion",children:"See https://puku.sh/docs/en/network-config"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):TW.jsxDEV(I,{flexDirection:"column",gap:1,children:[TW.jsxDEV(T,{children:"Please check your internet connection and network settings."},void 0,!1,void 0,this),Xq()==="firstParty"&&TW.jsxDEV(T,{children:["Note: puku-cli might not be available in your country. Check supported countries at"," ",TW.jsxDEV(T,{color:"suggestion",children:"https://anthropic.com/supported-countries"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[6]=Y,K[7]=A,K[8]=O,K[9]=J;else J=K[9];let P;if(K[10]!==J)P=TW.jsxDEV(I,{flexDirection:"column",gap:1,paddingLeft:1,children:J},void 0,!1,void 0,this),K[10]=J,K[11]=P;else P=K[11];return P}function Lu5(){return process.exit(1)}var P87,JJ6,TW;var f87=h(()=>{G4();J3();CA();J87();a6();Su();jS();N8();C4();P87=p(A8(),1),JJ6=p(_8(),1),TW=p(a(),1)});var Z87={};h8(Z87,{ApproveApiKey:()=>O2q});function O2q(q){let K=W87.c(17),{customApiKeyTruncated:_,onDone:A}=q,z;if(K[0]!==_||K[1]!==A)z=function(f){q:switch(f){case"yes":{g8((W)=>({...W,customApiKeyResponses:{...W.customApiKeyResponses,approved:[...W.customApiKeyResponses?.approved??[],_]}})),A(!0);break q}case"no":g8((W)=>({...W,customApiKeyResponses:{...W.customApiKeyResponses,rejected:[...W.customApiKeyResponses?.rejected??[],_]}})),A(!1)}},K[0]=_,K[1]=A,K[2]=z;else z=K[2];let Y=z,$;if(K[3]!==Y)$=()=>Y("no"),K[3]=Y,K[4]=$;else $=K[4];let O;if(K[5]===Symbol.for("react.memo_cache_sentinel"))O=hg.jsxDEV(T,{bold:!0,children:"ANTHROPIC_API_KEY"},void 0,!1,void 0,this),K[5]=O;else O=K[5];let w;if(K[6]!==_)w=hg.jsxDEV(T,{children:[O,hg.jsxDEV(T,{children:[": sk-ant-...",_]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[6]=_,K[7]=w;else w=K[7];let H;if(K[8]===Symbol.for("react.memo_cache_sentinel"))H=hg.jsxDEV(T,{children:"Do you want to use this API key?"},void 0,!1,void 0,this),K[8]=H;else H=K[8];let j;if(K[9]===Symbol.for("react.memo_cache_sentinel"))j={label:"Yes",value:"yes"},K[9]=j;else j=K[9];let M;if(K[10]===Symbol.for("react.memo_cache_sentinel"))M=[j,{label:hg.jsxDEV(T,{children:["No (",hg.jsxDEV(T,{bold:!0,children:"recommended"},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),value:"no"}],K[10]=M;else M=K[10];let J;if(K[11]!==Y)J=hg.jsxDEV(r8,{defaultValue:"no",defaultFocusValue:"no",options:M,onChange:(X)=>Y(X),onCancel:()=>Y("no")},void 0,!1,void 0,this),K[11]=Y,K[12]=J;else J=K[12];let P;if(K[13]!==$||K[14]!==w||K[15]!==J)P=hg.jsxDEV(Pq,{title:"Detected a custom API key in your environment",color:"warning",onCancel:$,children:[w,H,J]},void 0,!0,void 0,this),K[13]=$,K[14]=w,K[15]=J,K[16]=P;else P=K[16];return P}var W87,hg;var w2q=h(()=>{a6();Tq();Jz();J7();W87=p(A8(),1),hg=p(a(),1)});function Su5(){return Cw.jsxDEV(I,{flexDirection:"column",width:H2q,overflow:"hidden",children:Cw.jsxDEV(T,{wrap:"truncate",children:hu5},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function RM8(){let[q]=hK(),K="Welcome to puku-cli";if(Uq.terminal==="Apple_Terminal")return Cw.jsxDEV(Eu5,{theme:q,welcomeMessage:"Welcome to puku-cli"},void 0,!1,void 0,this);if(["light","light-daltonized","light-ansi"].includes(q))return Cw.jsxDEV(j2q,{welcomeMessage:"Welcome to puku-cli",isLight:!0},void 0,!1,void 0,this);return Cw.jsxDEV(j2q,{welcomeMessage:"Welcome to puku-cli",isLight:!1},void 0,!1,void 0,this)}function j2q({welcomeMessage:q,isLight:K}){let _=typeof process<"u"&&process.stdout?.columns?process.stdout.columns:80,A=Math.min(_,100),z="…".repeat(A),Y=30,$=A>=H2q+30,O=$?A-H2q:A,j=(K?[" "," "," ░░░░░░"," ░░░ ░░░░░░░░░░"," ░░░░░░░░░░░░░░░░░░░ "," ░░░░"," ░░░░░░░░"," ░░░░░░░░░░░░░░░░"]:[" *"," *"," ░░░░░░"," ░░░ ░░░░░░░░░░"," ░░░░░░░░░░░░░░░░░░░ *","* ░░░░"," ░░░░░░░░"," ░░░░░░░░░░░░░░░░"]).map((M)=>M.length>O?M.slice(0,O):M);return Cw.jsxDEV(I,{width:A,flexDirection:"column",children:[Cw.jsxDEV(T,{children:[Cw.jsxDEV(T,{color:"puku",children:[q," "]},void 0,!0,void 0,this),Cw.jsxDEV(T,{dimColor:!0,children:["v","1.8.31"," "]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Cw.jsxDEV(I,{marginBottom:1,children:Cw.jsxDEV(T,{dimColor:!0,children:z},void 0,!1,void 0,this)},void 0,!1,void 0,this),Cw.jsxDEV(I,{flexDirection:"row",children:[Cw.jsxDEV(I,{flexDirection:"column",width:O,overflow:"hidden",flexShrink:0,children:j.map((M,J)=>Cw.jsxDEV(T,{children:M},J,!1,void 0,this))},void 0,!1,void 0,this),$&&Cw.jsxDEV(Cw.Fragment,{children:[Cw.jsxDEV(I,{flexShrink:0,children:Cw.jsxDEV(Su5,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Cw.jsxDEV(I,{flexGrow:1},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Cw.jsxDEV(T,{dimColor:!0,children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Eu5({theme:q,welcomeMessage:K}){let _=["light","light-daltonized","light-ansi"].includes(q);return Cw.jsxDEV(j2q,{welcomeMessage:K,isLight:_},void 0,!1,void 0,this)}var Cw,hu5,H2q=15;var M2q=h(()=>{a6();tz();Cw=p(a(),1),hu5=`\x1B[0m\x1B[38;5;177m▆\x1B[48;5;183m \x1B[0m\x1B[38;5;177m▆\x1B[0m
|
|
7879
|
+
`)},R8=()=>{hI6((p8)=>p8+1)};return pJ?.on("suspend",$8),pJ?.on("resume",R8),()=>{pJ?.off("suspend",$8),pJ?.off("resume",R8)}},[pJ]);let UJ6=Q8.useMemo(()=>{if(!H7)return null;let $8=G_.filter((v7)=>v7.type==="progress"&&v7.data.type==="hook_progress"&&(v7.data.hookEvent==="Stop"||v7.data.hookEvent==="SubagentStop"));if($8.length===0)return null;let R8=$8.at(-1)?.toolUseID;if(!R8)return null;if(G_.some((v7)=>v7.type==="system"&&v7.subtype==="stop_hook_summary"&&v7.toolUseID===R8))return null;let lq=$8.filter((v7)=>v7.toolUseID===R8),jK=lq.length,lK=Bq(G_,(v7)=>{if(v7.type!=="attachment")return!1;let g7=v7.attachment;return"hookEvent"in g7&&(g7.hookEvent==="Stop"||g7.hookEvent==="SubagentStop")&&"toolUseID"in g7&&g7.toolUseID===R8}),iq=lq.find((v7)=>v7.data.statusMessage)?.data.statusMessage;if(iq)return jK===1?`${iq}…`:`${iq}… ${lK}/${jK}`;let R_=lq[0]?.data.hookEvent==="SubagentStop"?"subagent stop":"stop";return jK===1?`running ${R_} hook`:`running stop hooks… ${lK}/${jK}`},[G_,H7]),SI6=Q8.useCallback(()=>{QK({messagesLength:G_.length,streamingToolUsesLength:g4.length})},[G_.length,g4.length]),dJ6=Q8.useCallback(()=>{QK(null)},[]),lg=s_()&&!g,hW=Q8.useRef(null),[pL,mL]=Q8.useState(!1),[lG,BY]=Q8.useState(""),[Kr,JK6]=Q8.useState(0),[QJ6,UX]=Q8.useState(0),EI6=Q8.useCallback(($8,R8)=>{JK6($8),UX(R8)},[]);D_(($8,R8,p8)=>{if(R8.ctrl||R8.meta)return;if($8==="/"){hW.current?.setAnchor(),mL(!0),p8.stopImmediatePropagation();return}let lq=$8[0];if((lq==="n"||lq==="N")&&$8===lq.repeat($8.length)&&Kr>0){let jK=lq==="n"?hW.current?.nextMatch:hW.current?.prevMatch;if(jK)for(let lK=0;lK<$8.length;lK++)jK();p8.stopImmediatePropagation()}},{isActive:G6==="transcript"&&lg&&!pL&&!T6});let{setQuery:gL,scanElement:_r,setPositions:BL}=uU_(),ig=Eq().columns,PK6=cO.useRef(ig);cO.useEffect(()=>{if(PK6.current!==ig){if(PK6.current=ig,lG||pL)mL(!1),BY(""),JK6(0),UX(0),hW.current?.disarmSearch(),gL("")}},[ig,lG,pL,gL]),D_(($8,R8,p8)=>{if(R8.ctrl||R8.meta)return;if($8==="q"){dJ6(),p8.stopImmediatePropagation();return}if($8==="["&&!T6)l6(!0),I6(!0),p8.stopImmediatePropagation();else if($8==="v"){if(p8.stopImmediatePropagation(),P6.current)return;P6.current=!0;let lq=B6.current,jK=(lK)=>{if(lq!==B6.current)return;clearTimeout(q8.current),z6(lK)};jK(`rendering ${W8.length} messages…`),(async()=>{try{let lK=Math.max(80,(process.stdout.columns??80)-6),R_=(await J18(W8,YA,lK)).replace(/[ \t]+$/gm,""),v7=_u5(Au5(),`cc-transcript-${Date.now()}.txt`);await zu5(v7,R_);let g7=J98(v7);jK(g7?`opening ${v7}`:`wrote ${v7} · no $VISUAL/$EDITOR set`)}catch(lK){jK(`render failed: ${lK instanceof Error?lK.message:String(lK)}`)}if(P6.current=!1,lq!==B6.current)return;q8.current=setTimeout((lK)=>lK(""),4000,z6)})()}},{isActive:G6==="transcript"&&lg&&!pL});let rg=G6==="transcript"&≶Q8.useEffect(()=>{if(!rg)BY(""),JK6(0),UX(0),mL(!1),B6.current++,clearTimeout(q8.current),l6(!1),z6("")},[rg]),Q8.useEffect(()=>{if(gL(rg?lG:""),!rg)BL(null)},[rg,lG,gL,BL]);let CI6={screen:G6,setScreen:W6,showAllInTranscript:L6,setShowAllInTranscript:I6,messageCount:G_.length,onEnterTranscript:SI6,onExitTranscript:dJ6,virtualScrollActive:lg,searchBarOpen:pL},JJ8=kq?W8.slice(0,kq.messagesLength):W8,bI6=kq?g4.slice(0,kq.streamingToolUsesLength):g4;if(Wa_({onOpenBackgroundTasks:xq?void 0:()=>nq6(!0)}),Ra_(),G6==="transcript"){let $8=s_()&&!g&&!T6?O$:void 0,R8=_K.jsxDEV(Q86,{messages:JJ8,tools:YA,commands:E7,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:EL,isMessageSelectorVisible:!1,conversationId:vJ6,screen:G6,agentDefinitions:n,streamingToolUses:bI6,showAllInTranscript:L6,onOpenRateLimitOptions:uJ6,isLoading:H7,hidePastThinking:!0,streamingThinking:vO,scrollRef:$8,jumpRef:hW,onSearchMatchesChange:EI6,scanElement:_r,setPositions:BL,disableRenderCap:T6},void 0,!1,void 0,this),p8=mK&&_K.jsxDEV(I,{flexDirection:"column",width:"100%",children:mK.jsx},void 0,!1,void 0,this),lq=_K.jsxDEV(d1,{children:[_K.jsxDEV(c67,{isAnimating:cq,title:QO,disabled:u,noPrefix:vA},void 0,!1,void 0,this),_K.jsxDEV(wJq,{...CI6},void 0,!1,void 0,this),null,_K.jsxDEV(HJq,{onSubmit:FX,isActive:!mK?.isLocalJSXCommand},void 0,!1,void 0,this),$8?_K.jsxDEV(tJq,{scrollRef:O$,isActive:xz!=="ultraplan-choice",isModal:!pL,onScroll:()=>hW.current?.disarmSearch()},void 0,!1,void 0,this):null,_K.jsxDEV(jJq,{...CJ6},void 0,!1,void 0,this),$8?_K.jsxDEV(R9q,{scrollRef:O$,scrollable:_K.jsxDEV(_K.Fragment,{children:[R8,p8,_K.jsxDEV(FJq,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bottom:pL?_K.jsxDEV(Pu5,{jumpRef:hW,initialQuery:"",count:Kr,current:QJ6,onClose:(jK)=>{if(BY(Kr>0?jK:""),mL(!1),!jK)JK6(0),UX(0),hW.current?.setSearchQuery("")},onCancel:()=>{mL(!1),hW.current?.setSearchQuery(""),hW.current?.setSearchQuery(lG),gL(lG)},setHighlight:gL},void 0,!1,void 0,this):_K.jsxDEV(g67,{showAllInTranscript:L6,virtualScroll:!0,status:z8||void 0,searchBadge:lG&&Kr>0?{current:QJ6,count:Kr}:void 0},void 0,!1,void 0,this)},void 0,!1,void 0,this):_K.jsxDEV(_K.Fragment,{children:[R8,p8,_K.jsxDEV(FJq,{},void 0,!1,void 0,this),_K.jsxDEV(g67,{showAllInTranscript:L6,virtualScroll:!1,suppressShowAll:T6,status:z8||void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if($8)return _K.jsxDEV(sJq,{mouseTracking:$c8(),children:lq},void 0,!1,void 0,this);return lq}let ng=v6?J6[v6]:void 0,cL=ng&&Zw(ng)?ng:void 0,AH=cL??(ng&&A1(ng)?ng:void 0),II6=AH?AH.messages??[]:d9||!H7?G_:W8,lJ6=j4&&!AH&&II6.length<=gY.current?j4:void 0,XK6=xz==="tool-permission"?_K.jsxDEV(vl_,{onDone:()=>ZA(([$8,...R8])=>R8),onReject:ti,toolUseConfirm:o_[0],toolUseContext:NY(G_,G_,Y$??r4(),R6),verbose:d,workerBadge:o_[0]?.workerBadge,setStickyFooter:s_()?e5:void 0},o_[0]?.toolUseID,!1,void 0,this):null,XJ8=ig<Ijq,xI6=!mK?.shouldHidePromptInput&&!xz&&!Xb,Ar=s_()&&mK?.isLocalJSXCommand===!0,Gb=Ar?mK.jsx:null,uI6=_K.jsxDEV(d1,{children:[_K.jsxDEV(c67,{isAnimating:cq,title:QO,disabled:u,noPrefix:vA},void 0,!1,void 0,this),_K.jsxDEV(wJq,{...CI6},void 0,!1,void 0,this),null,_K.jsxDEV(HJq,{onSubmit:FX,isActive:!mK?.isLocalJSXCommand},void 0,!1,void 0,this),_K.jsxDEV(tJq,{scrollRef:O$,isActive:s_()&&(Gb!=null||!xz||xz==="tool-permission"),onScroll:Gb||XK6||AH?void 0:E6},void 0,!1,void 0,this),null,_K.jsxDEV(jJq,{...CJ6},void 0,!1,void 0,this),_K.jsxDEV(f98,{dynamicMcpConfig:y6,isStrictMcpConfig:J,children:_K.jsxDEV(R9q,{scrollRef:O$,overlay:XK6,bottomFloat:void 0,modal:Gb,modalScrollRef:U5,dividerYRef:mX,hidePill:!!AH,hideSticky:!!cL,newMessageCount:XP?.count??0,onPillClick:()=>{RW(null),PP(O$.current)},scrollable:_K.jsxDEV(_K.Fragment,{children:[_K.jsxDEV(Xs_,{},void 0,!1,void 0,this),_K.jsxDEV(Q86,{messages:II6,tools:YA,commands:E7,verbose:d,toolJSX:mK,toolUseConfirmQueue:o_,inProgressToolUseIDs:cL?cL.inProgressToolUseIDs??new Set:EL,isMessageSelectorVisible:K9,conversationId:vJ6,screen:G6,streamingToolUses:g4,showAllInTranscript:L6,agentDefinitions:n,onOpenRateLimitOptions:uJ6,isLoading:H7,streamingText:H7&&!AH?IL:null,isBriefOnly:AH?!1:s6,unseenDivider:AH?void 0:XP,scrollRef:s_()?O$:void 0,trackStickyPrompt:s_()?!0:void 0,cursor:xJ,setCursor:RW,cursorNavRef:Ek},void 0,!1,void 0,this),_K.jsxDEV(de_,{},void 0,!1,void 0,this),!Z&&lJ6&&!Gb&&_K.jsxDEV(Y66,{param:{text:lJ6,type:"text"},addMargin:!0,verbose:d},void 0,!1,void 0,this),mK&&!(mK.isLocalJSXCommand&&mK.isImmediate)&&!Ar&&_K.jsxDEV(I,{flexDirection:"column",width:"100%",children:mK.jsx},void 0,!1,void 0,this),!1,null,_K.jsxDEV(I,{flexGrow:1},void 0,!1,void 0,this),mg&&_K.jsxDEV(V__,{mode:u_,spinnerTip:q6,responseLengthRef:VW,apiMetricsRef:bk,overrideMessage:J8,spinnerSuffix:UJ6,verbose:d,loadingStartTimeRef:V4,totalPausedMsRef:YY,pauseStartTimeRef:f5,overrideColor:uK,overrideShimmerColor:L4,hasActiveTools:EL.size>0,leaderIsIdle:!H7},void 0,!1,void 0,this),!mg&&!H7&&!j4&&!fb&&s6&&!AH&&_K.jsxDEV(L__,{},void 0,!1,void 0,this),s_()&&_K.jsxDEV(Gj8,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bottom:_K.jsxDEV(I,{flexDirection:"row",width:"100%",alignItems:"flex-end",children:[null,_K.jsxDEV(I,{flexDirection:"column",flexGrow:1,children:[Q7,mK?.isLocalJSXCommand&&mK.isImmediate&&!Ar&&_K.jsxDEV(I,{flexDirection:"column",width:"100%",children:mK.jsx},void 0,!1,void 0,this),!mg&&!mK?.isLocalJSXCommand&&f6&&n_&&n_.length>0&&_K.jsxDEV(I,{width:"100%",flexDirection:"column",children:_K.jsxDEV(D78,{tasks:n_,isStandalone:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),xz==="sandbox-permission"&&_K.jsxDEV(cJq,{hostPattern:GA[0].hostPattern,onUserResponse:($8)=>{let{allow:R8,persistToSettings:p8}=$8,lq=GA[0];if(!lq)return;let jK=lq.hostPattern.host;if(p8){let iq={type:"addRules",rules:[{toolName:N9,ruleContent:`domain:${jK}`}],behavior:R8?"allow":"deny",destination:"localSettings"};C6((R_)=>({...R_,toolPermissionContext:xY(R_.toolPermissionContext,iq)})),KE(iq),Iq.refreshConfig()}W4((iq)=>{return iq.filter((R_)=>R_.hostPattern.host===jK).forEach((R_)=>R_.resolvePromise(R8)),iq.filter((R_)=>R_.hostPattern.host!==jK)});let lK=$A.current.get(jK);if(lK){for(let iq of lK)iq();$A.current.delete(jK)}}},GA[0].hostPattern.host,!1,void 0,this),xz==="prompt"&&_K.jsxDEV(Cl_,{title:B4[0].title,toolInputSummary:B4[0].toolInputSummary,request:B4[0].request,onRespond:($8)=>{let R8=B4[0];if(!R8)return;R8.resolve({prompt_response:R8.request.prompt,selected:$8}),qz(([,...p8])=>p8)},onAbort:()=>{let $8=B4[0];if(!$8)return;$8.reject(Error("Prompt cancelled by user")),qz(([,...R8])=>R8)}},B4[0].request.prompt,!1,void 0,this),$6&&_K.jsxDEV(tHq,{toolName:$6.toolName,description:$6.description},void 0,!1,void 0,this),N6&&_K.jsxDEV(tHq,{toolName:"Network Access",description:`Waiting for leader to approve network access to ${N6.host}`},void 0,!1,void 0,this),xz==="worker-sandbox-permission"&&_K.jsxDEV(cJq,{hostPattern:{host:O6.queue[0].host,port:void 0},onUserResponse:($8)=>{let{allow:R8,persistToSettings:p8}=$8,lq=O6.queue[0];if(!lq)return;let jK=lq.host;if(yK_(lq.workerName,lq.requestId,jK,R8,H6?.teamName),p8&&R8){let lK={type:"addRules",rules:[{toolName:N9,ruleContent:`domain:${jK}`}],behavior:"allow",destination:"localSettings"};C6((iq)=>({...iq,toolPermissionContext:xY(iq.toolPermissionContext,lK)})),KE(lK),Iq.refreshConfig()}C6((lK)=>({...lK,workerSandboxPermissions:{...lK.workerSandboxPermissions,queue:lK.workerSandboxPermissions.queue.slice(1)}}))}},O6.queue[0].requestId,!1,void 0,this),xz==="elicitation"&&_K.jsxDEV(hl_,{event:j6.queue[0],onResponse:($8,R8)=>{let p8=j6.queue[0];if(!p8)return;if(p8.respond({action:$8,content:R8}),!(p8.params.mode==="url"&&$8==="accept"))C6((jK)=>({...jK,elicitation:{queue:jK.elicitation.queue.slice(1)}}))},onWaitingDismiss:($8)=>{let R8=j6.queue[0];C6((p8)=>({...p8,elicitation:{queue:p8.elicitation.queue.slice(1)}})),R8?.onWaitingDismiss?.($8)}},j6.queue[0].serverName+":"+String(j6.queue[0].requestId),!1,void 0,this),xz==="cost"&&_K.jsxDEV(mU_,{onDone:()=>{GJ6(!1),DJ6(!0),g8(($8)=>({...$8,hasAcknowledgedCostThreshold:!0})),Q("tengu_cost_threshold_acknowledged",{})}},void 0,!1,void 0,this),xz==="idle-return"&&xg&&_K.jsxDEV(cU_,{idleMinutes:xg.idleMinutes,totalInputTokens:xW(),onDone:async($8)=>{let R8=xg;if(rq6(null),Q("tengu_idle_return_action",{action:$8,idleMinutes:Math.round(R8.idleMinutes),messageCount:p_.current.length,totalInputTokens:xW()}),$8==="dismiss"){cA(R8.input);return}if($8==="never")g8((p8)=>{if(p8.idleReturnDismissed)return p8;return{...p8,idleReturnDismissed:!0}});if($8==="clear"){let{clearConversation:p8}=await Promise.resolve().then(() => (C38(),I$q));await p8({setMessages:v_,readFileState:Py.current,discoveredSkillNames:_K6.current,loadedNestedMemoryPaths:AK6.current,getAppState:()=>d6.getState(),setAppState:C6,setConversationId:dG}),TY.current=!1,bw(void 0),Fg.current.clear(),Ug.current=0}di.current=!0,wK6.current(R8.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}},void 0,!1,void 0,this),xz==="ide-onboarding"&&_K.jsxDEV(Ss8,{onDone:()=>M6(!1),installationStatus:wK},void 0,!1,void 0,this),!1,!1,xz==="effort-callout"&&_K.jsxDEV(gs_,{model:R6,onDone:($8)=>{if(e6(!1),$8!=="dismiss")C6((R8)=>({...R8,effortValue:$8}))}},void 0,!1,void 0,this),xz==="remote-callout"&&_K.jsxDEV(Fs_,{onDone:($8)=>{C6((R8)=>{if(!R8.showRemoteCallout)return R8;return{...R8,showRemoteCallout:!1,...$8==="enable"&&{replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1}}})}},void 0,!1,void 0,this),dg,xz==="plugin-hint"&&oq&&_K.jsxDEV(he_,{pluginName:oq.pluginName,pluginDescription:oq.pluginDescription,marketplaceName:oq.marketplaceName,sourceCommand:oq.sourceCommand,onResponse:C_},void 0,!1,void 0,this),xz==="lsp-recommendation"&&Aq&&_K.jsxDEV(Ne_,{pluginName:Aq.pluginName,pluginDescription:Aq.pluginDescription,fileExtension:Aq.fileExtension,onResponse:OK},void 0,!1,void 0,this),xz==="desktop-upsell"&&_K.jsxDEV(gt_,{onDone:()=>o8(!1)},void 0,!1,void 0,this),null,null,yJ6(),!mK?.shouldHidePromptInput&&!xz&&!si&&!Z&&!xJ&&!E36()&&_K.jsxDEV(_K.Fragment,{children:[oi&&_K.jsxDEV(Z67,{onRun:jJ8,onCancel:OK6,reason:D67(oi)},void 0,!1,void 0,this),cg.state!=="closed"?_K.jsxDEV(db6,{state:cg.state,lastResponse:cg.lastResponse,handleSelect:cg.handleSelect,inputValue:N_,setInputValue:cA,onRequestFeedback:ei},void 0,!1,void 0,this):Zb.state!=="closed"?_K.jsxDEV(db6,{state:Zb.state,lastResponse:Zb.lastResponse,handleSelect:Zb.handleSelect,handleTranscriptSelect:Zb.handleTranscriptSelect,inputValue:N_,setInputValue:cA,onRequestFeedback:ei,message:"How well did Claude use its memory? (optional)"},void 0,!1,void 0,this):_K.jsxDEV(db6,{state:Wb.state,lastResponse:Wb.lastResponse,handleSelect:Wb.handleSelect,handleTranscriptSelect:Wb.handleTranscriptSelect,inputValue:N_,setInputValue:cA,onRequestFeedback:zK6.current?void 0:ei},void 0,!1,void 0,this),ri.state!=="closed"&&_K.jsxDEV(db6,{state:ri.state,lastResponse:null,handleSelect:()=>{},handleTranscriptSelect:ri.handleTranscriptSelect,inputValue:N_,setInputValue:cA},void 0,!1,void 0,this),!1,qK6&&_K.jsxDEV(T67,{},void 0,!1,void 0,this),_K.jsxDEV(ko_,{debug:K,ideSelection:e8,hasSuppressedDialogs:!!DI6,isLocalJSXCommandActive:xq,getToolUseContext:NY,toolPermissionContext:U,setToolPermissionContext:Qg,apiKeyStatus:VJ6,commands:E7,agents:n.activeAgents,isLoading:H7,onExit:yI6,verbose:d,messages:G_,onAutoUpdaterResult:K7,autoUpdaterResult:RK,input:N_,onInputChange:cA,mode:q9,onModeChange:Iw,stashedPrompt:Iz,setStashedPrompt:U9,submitCount:BX,onShowMessageSelector:pJ6,onMessageActionsEnter:void 0,mcpClients:i8,pastedContents:gX,setPastedContents:Zz,vimMode:kJ6,setVimMode:WI6,showBashesDialog:Xb,setShowBashesDialog:nq6,onSubmit:FX,onAgentSubmit:NI6,isSearchingHistory:TJ6,setIsSearchingHistory:pg,helpOpen:li,setHelpOpen:ZI6,insertTextRef:void 0,voiceInterimRange:FJ6.interimRange},void 0,!1,void 0,this),_K.jsxDEV(xs_,{onBackgroundSession:TI6,isLoading:H7},void 0,!1,void 0,this)]},void 0,!0,void 0,this),xJ&&_K.jsxDEV(MrK,{cursor:xJ},void 0,!1,void 0,this),xz==="message-selector"&&_K.jsxDEV($jq,{messages:G_,preselectedMessage:WP,onPreRestore:Xy,onRestoreCode:async($8)=>{await RA8((R8)=>{C6((p8)=>({...p8,fileHistory:R8(p8.fileHistory)}))},$8.uuid)},onSummarize:async($8,R8,p8="from")=>{let lq=l3(G_),jK=lq.indexOf($8);if(jK===-1){v_((A9)=>[...A9,Jw("That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.","warning")]);return}let lK=r4(),iq=NY(lq,[],lK,R6),R_=iq.getAppState(),v7=await lj(iq.options.tools,iq.options.mainLoopModel,Array.from(R_.toolPermissionContext.additionalWorkingDirectories.keys()),iq.options.mcpClients),g7=SN({mainThreadAgentDefinition:void 0,toolUseContext:iq,customSystemPrompt:iq.options.customSystemPrompt,defaultSystemPrompt:v7,appendSystemPrompt:iq.options.appendSystemPrompt}),[Z4,j$]=await Promise.all([$O(),$3()]),l7=await jW_(lq,jK,iq,{systemPrompt:g7,userContext:Z4,systemContext:j$,toolUseContext:iq,forkContextMessages:lq},R8,p8),zH=l7.messagesToKeep??[],kO=p8==="up_to"?[...l7.summaryMessages,...zH]:[...zH,...l7.summaryMessages],cY=[l7.boundaryMarker,...kO,...l7.attachments,...l7.hookResults];if(s_()&&p8==="from")v_((A9)=>{let dX=A9.findIndex((fK6)=>fK6.uuid===$8.uuid);return[...A9.slice(0,dX===-1?0:dX),...cY]});else v_(cY);if(dG(KI6()),qL(iq.options.querySource),p8==="from"){let A9=MYq($8);if(A9)cA(A9.text),Iw(A9.mode)}let S5=K1("app:toggleTranscript","Global","ctrl+o");m6({key:"summarize-ctrl-o-hint",text:`Conversation summarized (${S5} for history)`,priority:"medium",timeoutMs:8000})},onRestoreMessage:mJ6,onClose:()=>{R1(!1),xk(void 0)}},void 0,!1,void 0,this),!1]},void 0,!0,void 0,this),null]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},MK6,!1,void 0,this)]},void 0,!0,void 0,this);if(s_())return _K.jsxDEV(sJq,{mouseTracking:$c8(),children:uI6},void 0,!1,void 0,this);return uI6}var q2q,cO,Q8,_K,Yu5=()=>({state:"closed",handleTranscriptSelect:()=>{}}),$u5=()=>{},Ou5=()=>({}),m67=null,wu5=(q)=>()=>{},Hu5=()=>!1,ju5=(q,K)=>!1,eJq,Mu5,Ju5=3000,F67,B67="❏",Xu5=960;var _2q=h(()=>{v8();b$8();__();a6();Il();A7();pU_();M1q();xC();a6();gU_();FU_();nY();eR6();rU_();VS();ju();sP();$H8();v8();L2();Y8();aU_();I8();vK();$k6();wJ();k96();R96();JY();Kd_();SV();Uj();$Q();Ad_();Pd_();d$();PH8();Dd_();kl_();Sl_();bl_();To_();rMq();ho_();Co_();Io_();uo_();Bo_();Qo_();J3();pD();p16();kZ();CH();OJq();kN();_a_();BHq();Ya_();Oa_();mN();jMq();Ha_();Ma_();Pa_();EE();mH();XE();fa_();Za_();Na_();Va_();T8();N8();ma_();Mw();Ljq();LH();Yz();U06();hZ();Tq();Sx();Vq();Vj6();rz();i$();aa_();Ks_();As_();A86();J66();$s_();J88();pwq();dw8();ws_();Js_();TJq();qC6();oe8();fs_();T78();aO8();uQ();D$();Zs_();GJ();ad();kAq();lE();KK();J1();e_();Yw6();NN6();gR();TS6();$X();pp();tZ();gu();e_();Fb6();JC();gQ();Rs_();iY();Ls_();F3();Cs_();j1q();H1q();TX();R9();CM6();us_();z$8();ms_();$66();Zt();Es8();cs_();Us_();Fe8();m3();Ul();rs_();os_();ts_();_t_();zt_();Ot_();vt_();Nt_();Vt_();Ut_();H8q();bY();AM8();at_();tt_();qe_();jOq();ze_();$e_();Kj8();He_();Te_();ye_();Le_();Se_();xJq();Ie_();pe_();Fe_();r48();Qe_();re_();ae_();ee_();_67();z67();H67();f67();k67();y67();xjq();R67();d$();V9q();yH();h67();p67();gZ();RH();tj();q2q=p(A8(),1),cO=p(_8(),1),Q8=p(_8(),1),_K=p(a(),1),eJq=[],Mu5={maybeLoadOlder:(q)=>{}};F67=["❏","❐"]});async function _I6(q,K,_,A){let{App:z}=await Promise.resolve().then(() => (lHq(),QHq)),{REPL:Y}=await Promise.resolve().then(() => (_2q(),U67));await A(q,A2q.jsxDEV(z,{...K,children:A2q.jsxDEV(Y,{..._},void 0,!1,void 0,this)},void 0,!1,void 0,this))}var A2q;var d67=h(()=>{A2q=p(a(),1)});async function Gu5(){if(aO())return R("[Bootstrap] Skipped: Nonessential traffic disabled"),null;if(Xq()!=="firstParty")return R("[Bootstrap] Skipped: 3P provider"),null;let q=Uv();if(!(O_()?.accessToken&&dv())&&!q)return R("[Bootstrap] Skipped: no usable OAuth or API key"),null;let _=`${LK().BASE_API_URL}/api/claude_cli/bootstrap`;try{return await ha(async()=>{let A=O_()?.accessToken,z;if(A&&dv())z={Authorization:`Bearer ${A}`,"anthropic-beta":LM};else if(q)z={"x-api-key":q};else return R("[Bootstrap] No auth available on retry, aborting"),null;R("[Bootstrap] Fetching");let Y=await Jq.get(_,{headers:{"Content-Type":"application/json","User-Agent":zw(),...z},timeout:5000}),$=Zu5().safeParse(Y.data);if(!$.success)return R(`[Bootstrap] Response failed validation: ${$.error.message}`),null;return R("[Bootstrap] Fetch ok"),$.data})}catch(A){throw R(`[Bootstrap] Fetch failed: ${Jq.isAxiosError(A)?A.response?.status??A.code:"unknown"}`),A}}async function Q67(){try{let q=await Gu5();if(!q)return;let K=q.client_data??null,_=q.additional_model_options??[],A=j8();if(Rf(A.clientDataCache,K)&&Rf(A.additionalModelOptionsCache,_)){R("[Bootstrap] Cache unchanged, skipping write");return}R("[Bootstrap] Cache updated, persisting to disk"),g8((z)=>({...z,clientDataCache:K,additionalModelOptionsCache:_}))}catch(q){_6(q)}}var Zu5;var l67=h(()=>{G4();La();GK();LY8();CA();Tq();Y8();jS();N8();C4();Zu5=x6(()=>S2.object({client_data:S2.record(S2.unknown()).nullish(),additional_model_options:S2.array(S2.object({model:S2.string(),name:S2.string(),description:S2.string()}).transform(({model:q,name:K,description:_})=>({value:q,label:K,description:_}))).nullish()}))});function Du5(q){try{let K=new URL(q);return K.search="",K.toString().replace(/\/$/,"")}catch{return}}async function i67(){if(process.env.PUKU_CLI_DISABLE_NONESSENTIAL_TRAFFIC)return;try{let q=await Jq.get("https://api.anthropic.com/mcp-registry/v0/servers?version=latest&visibility=commercial",{timeout:5000}),K=new Set;for(let _ of q.data.servers)for(let A of _.server.remotes??[]){let z=Du5(A.url);if(z)K.add(z)}vu5=K,R(`[mcp-registry] Loaded ${K.size} official MCP URLs`)}catch(q){R(`Failed to fetch MCP registry: ${r6(q)}`,{level:"error"})}}var vu5=void 0;var r67=h(()=>{G4();Y8();T8()});function Nu5(q){let K=`${q.name}: ${q.message}`;return Tu5.some((_)=>_.test(K))}function n67(){let q=process.listeners("warning");if(DM8&&q.includes(DM8))return;if(!1)process.removeAllListeners("warning");DM8=(_)=>{try{let A=`${_.name}: ${_.message.slice(0,50)}`,z=vM8.get(A)||0;if(vM8.has(A)||vM8.size<ku5)vM8.set(A,z+1);let Y=Nu5(_);if(Q("tengu_node_warning",{is_internal:Y?1:0,occurrence_count:z+1,classname:_.name,...process.env.USER_TYPE==="ant"&&{message:_.message}}),p6(process.env.PUKU_CLI_DEBUG))R(`${Y?"[Internal Warning]":"[Warning]"} ${_.toString()}`,{level:"warn"})}catch{}},process.on("warning",DM8)}var ku5=1000,vM8,Tu5,DM8=null;var o67=h(()=>{Y8();I8();V7();vM8=new Map,Tu5=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/]});function kM8(){let q=a67.c(1),K;if(q[0]===Symbol.for("react.memo_cache_sentinel"))K=z2q.jsxDEV(T,{children:["MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the"," ",z2q.jsxDEV(nK,{url:"https://puku.sh/docs/en/mcp",children:"MCP documentation"},void 0,!1,void 0,this),"."]},void 0,!0,void 0,this),q[0]=K;else K=q[0];return K}var a67,z2q;var Y2q=h(()=>{a6();a67=p(A8(),1),z2q=p(a(),1)});function t67(q){let K=s67.c(13),{serverName:_,onDone:A}=q,z;if(K[0]!==A||K[1]!==_)z=function(P){Q("tengu_mcp_dialog_choice",{choice:P});q:switch(P){case"yes":case"yes_all":{let f=(Fq()||{}).enabledMcpjsonServers||[];if(!f.includes(_))gq("localSettings",{enabledMcpjsonServers:[...f,_]});if(P==="yes_all")gq("localSettings",{enableAllProjectMcpServers:!0});A();break q}case"no":{let f=(Fq()||{}).disabledMcpjsonServers||[];if(!f.includes(_))gq("localSettings",{disabledMcpjsonServers:[...f,_]});A()}}},K[0]=A,K[1]=_,K[2]=z;else z=K[2];let Y=z,$=`New MCP server found in .mcp.json: ${_}`,O;if(K[3]!==Y)O=()=>Y("no"),K[3]=Y,K[4]=O;else O=K[4];let w;if(K[5]===Symbol.for("react.memo_cache_sentinel"))w=TM8.jsxDEV(kM8,{},void 0,!1,void 0,this),K[5]=w;else w=K[5];let H;if(K[6]===Symbol.for("react.memo_cache_sentinel"))H=[{label:"Use this and all future MCP servers in this project",value:"yes_all"},{label:"Use this MCP server",value:"yes"},{label:"Continue without using this MCP server",value:"no"}],K[6]=H;else H=K[6];let j;if(K[7]!==Y)j=TM8.jsxDEV(r8,{options:H,onChange:(J)=>Y(J),onCancel:()=>Y("no")},void 0,!1,void 0,this),K[7]=Y,K[8]=j;else j=K[8];let M;if(K[9]!==$||K[10]!==O||K[11]!==j)M=TM8.jsxDEV(Pq,{title:$,color:"warning",onCancel:O,children:[w,j]},void 0,!0,void 0,this),K[9]=$,K[10]=O,K[11]=j,K[12]=M;else M=K[12];return M}var s67,TM8;var e67=h(()=>{Rq();Jz();J7();Y2q();s67=p(A8(),1),TM8=p(a(),1)});function K87(q){let K=q87.c(21),{serverNames:_,onDone:A}=q,z;if(K[0]!==A||K[1]!==_)z=function(W){let Z=Fq()||{},v=Z.enabledMcpjsonServers||[],k=Z.disabledMcpjsonServers||[],[N,y]=Uw8(_,(L)=>W.includes(L));if(Q("tengu_mcp_multidialog_choice",{approved:N.length,rejected:y.length}),N.length>0){let L=[...new Set([...v,...N])];gq("localSettings",{enabledMcpjsonServers:L})}if(y.length>0){let L=[...new Set([...k,...y])];gq("localSettings",{disabledMcpjsonServers:L})}A()},K[0]=A,K[1]=_,K[2]=z;else z=K[2];let Y=z,$;if(K[3]!==A||K[4]!==_)$=()=>{let W=(Fq()||{}).disabledMcpjsonServers||[],Z=[...new Set([...W,..._])];gq("localSettings",{disabledMcpjsonServers:Z}),A()},K[3]=A,K[4]=_,K[5]=$;else $=K[5];let O=$,w=`${_.length} new MCP servers found in .mcp.json`,H;if(K[6]===Symbol.for("react.memo_cache_sentinel"))H=Lk.jsxDEV(kM8,{},void 0,!1,void 0,this),K[6]=H;else H=K[6];let j;if(K[7]!==_)j=_.map(yu5),K[7]=_,K[8]=j;else j=K[8];let M;if(K[9]!==O||K[10]!==Y||K[11]!==_||K[12]!==j)M=Lk.jsxDEV(U36,{options:j,defaultValue:_,onSubmit:Y,onCancel:O,hideIndexes:!0},void 0,!1,void 0,this),K[9]=O,K[10]=Y,K[11]=_,K[12]=j,K[13]=M;else M=K[13];let J;if(K[14]!==O||K[15]!==w||K[16]!==M)J=Lk.jsxDEV(Pq,{title:w,subtitle:"Select any you wish to enable.",color:"warning",onCancel:O,hideInputGuide:!0,children:[H,M]},void 0,!0,void 0,this),K[14]=O,K[15]=w,K[16]=M,K[17]=J;else J=K[17];let P;if(K[18]===Symbol.for("react.memo_cache_sentinel"))P=Lk.jsxDEV(I,{paddingX:1,children:Lk.jsxDEV(T,{dimColor:!0,italic:!0,children:Lk.jsxDEV(fq,{children:[Lk.jsxDEV(c8,{shortcut:"Space",action:"select"},void 0,!1,void 0,this),Lk.jsxDEV(c8,{shortcut:"Enter",action:"confirm"},void 0,!1,void 0,this),Lk.jsxDEV(qq,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"reject all"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),K[18]=P;else P=K[18];let X;if(K[19]!==J)X=Lk.jsxDEV(Lk.Fragment,{children:[J,P]},void 0,!0,void 0,this),K[19]=J,K[20]=X;else X=K[20];return X}function yu5(q){return{label:q,value:q}}var q87,Lk;var _87=h(()=>{uwq();a6();Rq();k4();S_8();S7();J7();t7();Y2q();q87=p(A8(),1),Lk=p(a(),1)});async function A87(q){let{servers:K}=Xw("project"),_=Object.keys(K).filter((A)=>nO6(A)==="pending");if(_.length===0)return;await new Promise((A)=>{let z=()=>void A();if(_.length===1&&_[0]!==void 0){let Y=_[0];q.render(Bq6.jsxDEV(Y1,{children:Bq6.jsxDEV(d1,{children:Bq6.jsxDEV(t67,{serverName:Y,onDone:z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}else q.render(Bq6.jsxDEV(Y1,{children:Bq6.jsxDEV(d1,{children:Bq6.jsxDEV(K87,{serverNames:_,onDone:z},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))})}var Bq6;var z87=h(()=>{e67();_87();EE();KK();x2();fw();Bq6=p(a(),1)});var Y87=h(()=>{Tq();Y8()});class $2q{frameDurations=[];firstRenderTime;lastRenderTime;record(q){let K=performance.now();if(this.firstRenderTime===void 0)this.firstRenderTime=K;this.lastRenderTime=K,this.frameDurations.push(q)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let q=this.lastRenderTime-this.firstRenderTime;if(q<=0)return;let _=this.frameDurations.length/(q/1000),A=this.frameDurations.slice().sort((O,w)=>w-O),z=Math.max(0,Math.ceil(A.length*0.01)-1),Y=A[z],$=Y>0?1000/Y:0;return{averageFps:Math.round(_*100)/100,low1PctFps:Math.round($*100)/100}}}import{realpath as Ru5}from"fs/promises";async function $87(){try{let q=await zc();if(!q){R("Not in a GitHub repository, skipping path mapping update");return}let K=yq(),A=nz(K)??K,z;try{z=(await Ru5(A)).normalize("NFC")}catch{z=A}let Y=q.toLowerCase(),O=j8().githubRepoPaths?.[Y]??[];if(O[0]===z){R(`Path ${z} already tracked for repo ${Y}`);return}let w=O.filter((j)=>j!==z),H=[z,...w];g8((j)=>({...j,githubRepoPaths:{...j.githubRepoPaths,[Y]:H}})),R(`Added ${z} to tracked paths for repo ${Y}`)}catch(q){R(`Error updating repo path mapping: ${q}`)}}function O87(q){let K=j8(),_=q.toLowerCase();return K.githubRepoPaths?.[_]??[]}async function w87(q){let K=await Promise.all(q.map(q4));return q.filter((_,A)=>K[A])}async function H87(q,K){try{let _=await hg6(q);if(!_)return!1;let A=yn(_);if(!A)return!1;return A.toLowerCase()===K.toLowerCase()}catch{return!1}}function j87(q,K){let _=j8(),A=q.toLowerCase(),z=_.githubRepoPaths?.[A]??[],Y=z.filter((O)=>O!==K);if(Y.length===z.length)return;let $={..._.githubRepoPaths};if(Y.length===0)delete $[A];else $[A]=Y;g8((O)=>({...O,githubRepoPaths:$})),R(`Removed ${K} from tracked paths for repo ${A}`)}var NM8=h(()=>{v8();Tq();Y8();mW();n7();WI();kA()});function M87(q,K){let[_,A]=yM8.useState(!1);return yM8.useEffect(()=>{A(!1);let z=setTimeout(A,q,!0);return()=>clearTimeout(z)},[q,K]),_}var yM8;var J87=h(()=>{yM8=p(_8(),1)});async function Vu5(){try{let q=LK(),K=new URL(q.TOKEN_URL),_=[`${q.BASE_API_URL}/api/hello`,`${K.origin}/v1/oauth/hello`],A=async($)=>{try{let O=await Jq.get($,{headers:{"User-Agent":EF()}});if(O.status!==200)return{success:!1,error:`Failed to connect to ${new URL($).hostname}: Status ${O.status}`};return{success:!0}}catch(O){let w=new URL($).hostname,H=aU(O);return{success:!1,error:`Failed to connect to ${w}: ${O instanceof Error?O.code||O.message:String(O)}`,sslHint:H??void 0}}},Y=(await Promise.all(_.map(A))).find(($)=>!$.success);if(Y)Q("tengu_preflight_check_failed",{isConnectivityError:!1,hasErrorMessage:!!Y.error,isSSLError:!!Y.sslHint});return Y||{success:!0}}catch(q){return _6(q),Q("tengu_preflight_check_failed",{isConnectivityError:!0}),{success:!1,error:`Connectivity check error: ${q instanceof Error?q.code||q.message:String(q)}`}}}function X87(q){let K=P87.c(12),{onSuccess:_}=q,[A,z]=JJ6.useState(null),[Y,$]=JJ6.useState(!0),O=M87(1000)&&Y,w,H;if(K[0]===Symbol.for("react.memo_cache_sentinel"))w=()=>{(async function(){let W=await Vu5();z(W),$(!1)})()},H=[],K[0]=w,K[1]=H;else w=K[0],H=K[1];JJ6.useEffect(w,H);let j,M;if(K[2]!==_||K[3]!==A)j=()=>{if(A?.success)_();else if(A&&!A.success){let X=setTimeout(Lu5,100);return()=>clearTimeout(X)}},M=[A,_],K[2]=_,K[3]=A,K[4]=j,K[5]=M;else j=K[4],M=K[5];JJ6.useEffect(j,M);let J;if(K[6]!==Y||K[7]!==A||K[8]!==O)J=Y&&O?TW.jsxDEV(I,{paddingLeft:1,children:[TW.jsxDEV(T7,{},void 0,!1,void 0,this),TW.jsxDEV(T,{children:"Checking connectivity..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):!A?.success&&!Y&&TW.jsxDEV(I,{flexDirection:"column",gap:1,children:[TW.jsxDEV(T,{color:"error",children:"Unable to connect to Anthropic services"},void 0,!1,void 0,this),TW.jsxDEV(T,{color:"error",children:A?.error},void 0,!1,void 0,this),A?.sslHint?TW.jsxDEV(I,{flexDirection:"column",gap:1,children:[TW.jsxDEV(T,{children:A.sslHint},void 0,!1,void 0,this),TW.jsxDEV(T,{color:"suggestion",children:"See https://puku.sh/docs/en/network-config"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):TW.jsxDEV(I,{flexDirection:"column",gap:1,children:[TW.jsxDEV(T,{children:"Please check your internet connection and network settings."},void 0,!1,void 0,this),Xq()==="firstParty"&&TW.jsxDEV(T,{children:["Note: puku-cli might not be available in your country. Check supported countries at"," ",TW.jsxDEV(T,{color:"suggestion",children:"https://anthropic.com/supported-countries"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[6]=Y,K[7]=A,K[8]=O,K[9]=J;else J=K[9];let P;if(K[10]!==J)P=TW.jsxDEV(I,{flexDirection:"column",gap:1,paddingLeft:1,children:J},void 0,!1,void 0,this),K[10]=J,K[11]=P;else P=K[11];return P}function Lu5(){return process.exit(1)}var P87,JJ6,TW;var f87=h(()=>{G4();J3();CA();J87();a6();Su();jS();N8();C4();P87=p(A8(),1),JJ6=p(_8(),1),TW=p(a(),1)});var Z87={};h8(Z87,{ApproveApiKey:()=>O2q});function O2q(q){let K=W87.c(17),{customApiKeyTruncated:_,onDone:A}=q,z;if(K[0]!==_||K[1]!==A)z=function(f){q:switch(f){case"yes":{g8((W)=>({...W,customApiKeyResponses:{...W.customApiKeyResponses,approved:[...W.customApiKeyResponses?.approved??[],_]}})),A(!0);break q}case"no":g8((W)=>({...W,customApiKeyResponses:{...W.customApiKeyResponses,rejected:[...W.customApiKeyResponses?.rejected??[],_]}})),A(!1)}},K[0]=_,K[1]=A,K[2]=z;else z=K[2];let Y=z,$;if(K[3]!==Y)$=()=>Y("no"),K[3]=Y,K[4]=$;else $=K[4];let O;if(K[5]===Symbol.for("react.memo_cache_sentinel"))O=hg.jsxDEV(T,{bold:!0,children:"ANTHROPIC_API_KEY"},void 0,!1,void 0,this),K[5]=O;else O=K[5];let w;if(K[6]!==_)w=hg.jsxDEV(T,{children:[O,hg.jsxDEV(T,{children:[": sk-ant-...",_]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),K[6]=_,K[7]=w;else w=K[7];let H;if(K[8]===Symbol.for("react.memo_cache_sentinel"))H=hg.jsxDEV(T,{children:"Do you want to use this API key?"},void 0,!1,void 0,this),K[8]=H;else H=K[8];let j;if(K[9]===Symbol.for("react.memo_cache_sentinel"))j={label:"Yes",value:"yes"},K[9]=j;else j=K[9];let M;if(K[10]===Symbol.for("react.memo_cache_sentinel"))M=[j,{label:hg.jsxDEV(T,{children:["No (",hg.jsxDEV(T,{bold:!0,children:"recommended"},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),value:"no"}],K[10]=M;else M=K[10];let J;if(K[11]!==Y)J=hg.jsxDEV(r8,{defaultValue:"no",defaultFocusValue:"no",options:M,onChange:(X)=>Y(X),onCancel:()=>Y("no")},void 0,!1,void 0,this),K[11]=Y,K[12]=J;else J=K[12];let P;if(K[13]!==$||K[14]!==w||K[15]!==J)P=hg.jsxDEV(Pq,{title:"Detected a custom API key in your environment",color:"warning",onCancel:$,children:[w,H,J]},void 0,!0,void 0,this),K[13]=$,K[14]=w,K[15]=J,K[16]=P;else P=K[16];return P}var W87,hg;var w2q=h(()=>{a6();Tq();Jz();J7();W87=p(A8(),1),hg=p(a(),1)});function Su5(){return Cw.jsxDEV(I,{flexDirection:"column",width:H2q,overflow:"hidden",children:Cw.jsxDEV(T,{wrap:"truncate",children:hu5},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function RM8(){let[q]=hK(),K="Welcome to puku-cli";if(Uq.terminal==="Apple_Terminal")return Cw.jsxDEV(Eu5,{theme:q,welcomeMessage:"Welcome to puku-cli"},void 0,!1,void 0,this);if(["light","light-daltonized","light-ansi"].includes(q))return Cw.jsxDEV(j2q,{welcomeMessage:"Welcome to puku-cli",isLight:!0},void 0,!1,void 0,this);return Cw.jsxDEV(j2q,{welcomeMessage:"Welcome to puku-cli",isLight:!1},void 0,!1,void 0,this)}function j2q({welcomeMessage:q,isLight:K}){let _=typeof process<"u"&&process.stdout?.columns?process.stdout.columns:80,A=Math.min(_,100),z="…".repeat(A),Y=30,$=A>=H2q+30,O=$?A-H2q:A,j=(K?[" "," "," ░░░░░░"," ░░░ ░░░░░░░░░░"," ░░░░░░░░░░░░░░░░░░░ "," ░░░░"," ░░░░░░░░"," ░░░░░░░░░░░░░░░░"]:[" *"," *"," ░░░░░░"," ░░░ ░░░░░░░░░░"," ░░░░░░░░░░░░░░░░░░░ *","* ░░░░"," ░░░░░░░░"," ░░░░░░░░░░░░░░░░"]).map((M)=>M.length>O?M.slice(0,O):M);return Cw.jsxDEV(I,{width:A,flexDirection:"column",children:[Cw.jsxDEV(T,{children:[Cw.jsxDEV(T,{color:"puku",children:[q," "]},void 0,!0,void 0,this),Cw.jsxDEV(T,{dimColor:!0,children:["v","1.8.32"," "]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Cw.jsxDEV(I,{marginBottom:1,children:Cw.jsxDEV(T,{dimColor:!0,children:z},void 0,!1,void 0,this)},void 0,!1,void 0,this),Cw.jsxDEV(I,{flexDirection:"row",children:[Cw.jsxDEV(I,{flexDirection:"column",width:O,overflow:"hidden",flexShrink:0,children:j.map((M,J)=>Cw.jsxDEV(T,{children:M},J,!1,void 0,this))},void 0,!1,void 0,this),$&&Cw.jsxDEV(Cw.Fragment,{children:[Cw.jsxDEV(I,{flexShrink:0,children:Cw.jsxDEV(Su5,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Cw.jsxDEV(I,{flexGrow:1},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Cw.jsxDEV(T,{dimColor:!0,children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Eu5({theme:q,welcomeMessage:K}){let _=["light","light-daltonized","light-ansi"].includes(q);return Cw.jsxDEV(j2q,{welcomeMessage:K,isLight:_},void 0,!1,void 0,this)}var Cw,hu5,H2q=15;var M2q=h(()=>{a6();tz();Cw=p(a(),1),hu5=`\x1B[0m\x1B[38;5;177m▆\x1B[48;5;183m \x1B[0m\x1B[38;5;177m▆\x1B[0m
|
|
7880
7880
|
`+`\x1B[7m\x1B[38;5;183m \x1B[38;5;140m▗▅▅▅▅▅▅▅▖\x1B[38;5;183m \x1B[0m
|
|
7881
7881
|
`+`\x1B[7m\x1B[38;5;183m \x1B[0m\x1B[38;5;140m▋ \x1B[7m▍\x1B[38;5;183m \x1B[0m
|
|
7882
7882
|
`+`\x1B[7m\x1B[38;5;183m \x1B[0m\x1B[38;5;140m▋ \x1B[7m▍\x1B[38;5;183m \x1B[0m
|
|
@@ -9129,7 +9129,7 @@ For each rule, evaluate:
|
|
|
9129
9129
|
Be concise and constructive. Only comment on rules that could be improved. If all rules look good, say so.`;var YJ8=h(()=>{T8();Y_();DR6();Rq();pu();l8()});var y47={};h8(y47,{update:()=>zc5});async function zc5(){if(Xq()!=="firstParty"){g_(M8.yellow(`Auto-update is not available for third-party provider builds.
|
|
9130
9130
|
`)+`To update, pull the latest source from the repository and rebuild:
|
|
9131
9131
|
git pull && bun install && bun run build
|
|
9132
|
-
`);return}Q("tengu_update_check",{}),g_(`Current version: 1.8.
|
|
9132
|
+
`);return}Q("tengu_update_check",{}),g_(`Current version: 1.8.32
|
|
9133
9133
|
`);let q=XK()?.autoUpdatesChannel??"latest";g_(`Checking for updates to ${q} version...
|
|
9134
9134
|
`),R("update: Starting update check"),R("update: Running diagnostic");let K=await Re();if(R(`update: Installation type: ${K.installationType}`),R(`update: Config install method: ${K.configInstallMethod}`),K.multipleInstallations.length>1){g_(`
|
|
9135
9135
|
`),g_(M8.yellow("Warning: Multiple installations found")+`
|
|
@@ -9144,19 +9144,19 @@ Be concise and constructive. Only comment on rules that could be improved. If al
|
|
|
9144
9144
|
`),g_(M8.yellow("Warning: Cannot update development build")+`
|
|
9145
9145
|
`),await U7(1);if(K.installationType==="package-manager"){let H=await t36();if(g_(`
|
|
9146
9146
|
`),H==="homebrew"){g_(`puku-cli is managed by Homebrew.
|
|
9147
|
-
`);let j=await Te(q);if(j&&!Sj("1.8.
|
|
9147
|
+
`);let j=await Te(q);if(j&&!Sj("1.8.32",j))g_(`Update available: ${"1.8.32"} → ${j}
|
|
9148
9148
|
`),g_(`
|
|
9149
9149
|
`),g_(`To update, run:
|
|
9150
9150
|
`),g_(M8.bold(" brew upgrade claude-code")+`
|
|
9151
9151
|
`);else g_(`puku-cli is up to date!
|
|
9152
9152
|
`)}else if(H==="winget"){g_(`puku-cli is managed by winget.
|
|
9153
|
-
`);let j=await Te(q);if(j&&!Sj("1.8.
|
|
9153
|
+
`);let j=await Te(q);if(j&&!Sj("1.8.32",j))g_(`Update available: ${"1.8.32"} → ${j}
|
|
9154
9154
|
`),g_(`
|
|
9155
9155
|
`),g_(`To update, run:
|
|
9156
9156
|
`),g_(M8.bold(" winget upgrade Anthropic.puku-cliCode")+`
|
|
9157
9157
|
`);else g_(`puku-cli is up to date!
|
|
9158
9158
|
`)}else if(H==="apk"){g_(`puku-cli is managed by apk.
|
|
9159
|
-
`);let j=await Te(q);if(j&&!Sj("1.8.
|
|
9159
|
+
`);let j=await Te(q);if(j&&!Sj("1.8.32",j))g_(`Update available: ${"1.8.32"} → ${j}
|
|
9160
9160
|
`),g_(`
|
|
9161
9161
|
`),g_(`To update, run:
|
|
9162
9162
|
`),g_(M8.bold(" apk upgrade claude-code")+`
|
|
@@ -9186,14 +9186,14 @@ Be concise and constructive. Only comment on rules that could be improved. If al
|
|
|
9186
9186
|
`),process.stderr.write(` • Run with --debug flag for more details
|
|
9187
9187
|
`);let H="@puku/puku-cli";process.stderr.write(` • Manually check: npm view ${H} version
|
|
9188
9188
|
`),process.stderr.write(` • Check if you need to login: npm whoami
|
|
9189
|
-
`),await U7(1)}if(Y==="1.8.
|
|
9190
|
-
`),await U7(0);g_(`New version available: ${Y} (current: 1.8.
|
|
9189
|
+
`),await U7(1)}if(Y==="1.8.32")g_(M8.green("puku-cli is up to date (1.8.32)")+`
|
|
9190
|
+
`),await U7(0);g_(`New version available: ${Y} (current: 1.8.32)
|
|
9191
9191
|
`),g_(`Installing update...
|
|
9192
9192
|
`);let $=!1,O="";switch(K.installationType){case"npm-local":$=!0,O="local";break;case"npm-global":$=!1,O="global";break;case"unknown":{let H=await De();$=H,O=H?"local":"global",g_(M8.yellow("Warning: Could not determine installation type")+`
|
|
9193
9193
|
`),g_(`Attempting ${O} update based on file detection...
|
|
9194
9194
|
`);break}default:process.stderr.write(`Error: Cannot update ${K.installationType} installation
|
|
9195
9195
|
`),await U7(1)}g_(`Using ${O} installation update method...
|
|
9196
|
-
`),R(`update: Update method determined: ${O}`),R(`update: useLocalUpdate: ${$}`);let w;if($)R("update: Calling installOrUpdateClaudePackage() for local update"),w=await UR6(q);else R("update: Calling installGlobalPackage() for global update"),w=await lR6();switch(R(`update: Installation status: ${w}`),w){case"success":g_(M8.green(`Successfully updated from 1.8.
|
|
9196
|
+
`),R(`update: Update method determined: ${O}`),R(`update: useLocalUpdate: ${$}`);let w;if($)R("update: Calling installOrUpdateClaudePackage() for local update"),w=await UR6(q);else R("update: Calling installGlobalPackage() for global update"),w=await lR6();switch(R(`update: Installation status: ${w}`),w){case"success":g_(M8.green(`Successfully updated from 1.8.32 to version ${Y}`)+`
|
|
9197
9197
|
`),await ev_();break;case"no_permissions":if(process.stderr.write(`Error: Insufficient permissions to install update
|
|
9198
9198
|
`),$)process.stderr.write(`Try manually updating with:
|
|
9199
9199
|
`),process.stderr.write(` cd ~/.puku-cli/local && npm update @puku/puku-cli
|
|
@@ -9257,4 +9257,4 @@ Usage: puku-cli --remote "your task description"`,()=>U7(1));Q("tengu_remote_cre
|
|
|
9257
9257
|
`));await Iqq();let{teleportWithProgress:SA}=await Promise.resolve().then(() => (J47(),M47)),b7=await SA(E7,v6);DP6({sessionId:v6}),sq=b7.messages}catch(mK){if(mK instanceof jj)process.stderr.write(mK.formattedMessage+`
|
|
9258
9258
|
`);else _6(mK),process.stderr.write(M8.red(`Error: ${r6(mK)}
|
|
9259
9259
|
`));await U7(1)}}}if(T_){let mK=T_;try{let G7=performance.now(),SA=await pQ(K7??mK,void 0);if(!SA)return Q("tengu_session_resumed",{entrypoint:"cli_flag",success:!1}),await LL(E7,`No conversation found with session ID: ${mK}`);let b7=K7?.fullPath??SA.fullPath;if(aK=await NJq(SA,{forkSession:!!j.forkSession,sessionIdOverride:mK,transcriptPath:b7},H$),aK.restoredAgentDef)HK=aK.restoredAgentDef;Q("tengu_session_resumed",{entrypoint:"cli_flag",success:!0,resume_duration_ms:Math.round(performance.now()-G7)})}catch(G7){Q("tengu_session_resumed",{entrypoint:"cli_flag",success:!1}),_6(G7),await LL(E7,r6(G7))}}if(B)try{let mK=await B,G7=Bq(mK,(SA)=>!SA.success);if(G7>0)process.stderr.write(M8.yellow(`Warning: ${G7}/${mK.length} file(s) failed to download.
|
|
9260
|
-
`))}catch(mK){return await LL(E7,`Error downloading files: ${r6(mK)}`)}let d7=aK??(Array.isArray(sq)?{messages:sq,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:HK,initialState:f5,contentReplacements:void 0}:void 0);if(d7)$J8(j),OJ8(j),await _I6(E7,{getFpsMetrics:u_,stats:FK,initialState:d7.initialState},{...V5,mainThreadAgentDefinition:d7.restoredAgentDef??HK,initialMessages:d7.messages,initialFileHistorySnapshots:d7.fileHistorySnapshots,initialContentReplacements:d7.contentReplacements,initialAgentName:d7.agentName,initialAgentColor:d7.agentColor},cq6);else await Vq7(E7,{getFpsMetrics:u_,stats:FK,initialState:f5},Um(yq()),{...V5,initialSearchQuery:RK,forkSession:j.forkSession,filterByPr:L5})}else{let a8=O$&&U5.length===0?O$:void 0;Y7("action_after_hooks"),$J8(j),OJ8(j);let sq=null,aK=sq?[sq,...U5]:U5.length>0?U5:void 0;await _I6(E7,{getFpsMetrics:u_,stats:FK,initialState:f5},{...V5,initialMessages:aK,pendingHookMessages:a8},cq6)}}).version("1.8.31 (puku-cli)","-v, --version","Output the version number"),K.option("-w, --worktree [name]","Create a new git worktree for this session (optionally specify a name)"),K.option("--tmux","Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."),qQ())K.addOption(new yA("--advisor <model>","Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp());K.addOption(new yA("--enable-auto-mode","Opt in to auto mode").hideHelp()),K.addOption(new yA("--agent-id <id>","Teammate agent ID").hideHelp()),K.addOption(new yA("--agent-name <name>","Teammate display name").hideHelp()),K.addOption(new yA("--team-name <name>","Team name for swarm coordination").hideHelp()),K.addOption(new yA("--agent-color <color>","Teammate UI color").hideHelp()),K.addOption(new yA("--plan-mode-required","Require plan mode before implementation").hideHelp()),K.addOption(new yA("--parent-session-id <id>","Parent session ID for analytics correlation").hideHelp()),K.addOption(new yA("--teammate-mode <mode>",'How to spawn teammates: "tmux", "in-process", or "auto"').choices(["auto","tmux","in-process"]).hideHelp()),K.addOption(new yA("--agent-type <type>","Custom agent type for this teammate").hideHelp()),K.addOption(new yA("--sdk-url <url>","Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp()),K.addOption(new yA("--teleport [session]","Resume a teleport session, optionally specify session ID").hideHelp()),K.addOption(new yA("--remote [description]","Create a remote session with the given description").hideHelp()),Y7("run_main_options_built");let _=process.argv.includes("-p")||process.argv.includes("--print"),A=process.argv.some((H)=>H.startsWith("cc://")||H.startsWith("cc+unix://"));if(_&&!A)return Y7("run_before_parse"),await K.parseAsync(process.argv),Y7("run_after_parse"),K;let z=K.command("mcp").description("Configure and manage MCP servers").configureHelp(q()).enablePositionalOptions();if(z.command("serve").description("Start the Puku MCP server").option("-d, --debug","Enable debug mode",()=>!0).option("--verbose","Override verbose mode setting from config",()=>!0).action(async({debug:H,verbose:j})=>{let{mcpServeHandler:M}=await Promise.resolve().then(() => (Eg(),Sg));await M({debug:H,verbose:j})}),VK7(z),J_7(z),zp())P_7(z);z.command("remove <name>").description("Remove an MCP server").option("-s, --scope <scope>","Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in").action(async(H,j)=>{let{mcpRemoveHandler:M}=await Promise.resolve().then(() => (Eg(),Sg));await M(H,j)}),z.command("list").description("List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async()=>{let{mcpListHandler:H}=await Promise.resolve().then(() => (Eg(),Sg));await H()}),z.command("get <name>").description("Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async(H)=>{let{mcpGetHandler:j}=await Promise.resolve().then(() => (Eg(),Sg));await j(H)}),z.command("add-json <name> <json>").description("Add an MCP server (stdio or SSE) with a JSON string").option("-s, --scope <scope>","Configuration scope (local, user, or project)","local").option("--client-secret","Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)").action(async(H,j,M)=>{let{mcpAddJsonHandler:J}=await Promise.resolve().then(() => (Eg(),Sg));await J(H,j,M)}),z.command("add-from-puku-desktop").description("Import MCP servers from Puku Desktop (Mac and WSL only)").option("-s, --scope <scope>","Configuration scope (local, user, or project)","local").action(async(H)=>{let{mcpAddFromDesktopHandler:j}=await Promise.resolve().then(() => (Eg(),Sg));await j(H)}),z.command("reset-project-choices").description("Reset all approved and rejected project-scoped (.mcp.json) servers within this project").action(async()=>{let{mcpResetChoicesHandler:H}=await Promise.resolve().then(() => (Eg(),Sg));await H()});let Y=K.command("auth").description("Manage authentication").configureHelp(q());Y.command("login").description("Sign in to your Puku AI account").option("--email <email>","Pre-populate email address on the login page").option("--sso","Force SSO login flow").option("--console","Use Puku Console (API usage billing) instead of Puku subscription").option("--puku","Use Puku subscription (default)").addOption(new yA("--claudeai").hideHelp()).action(async({email:H,sso:j,console:M,puku:J,claudeai:P})=>{let{authLogin:X}=await Promise.resolve().then(() => (q96(),J78));await X({email:H,sso:j,console:M,claudeai:J||P})}),Y.command("status").description("Show authentication status").option("--json","Output as JSON (default)").option("--text","Output as human-readable text").action(async(H)=>{let{authStatus:j}=await Promise.resolve().then(() => (q96(),J78));await j(H)}),Y.command("logout").description("Log out from your Puku AI account").action(async()=>{let{authLogout:H}=await Promise.resolve().then(() => (q96(),J78));await H()});let $=()=>new yA("--cowork","Use cowork_plugins directory").hideHelp(),O=K.command("plugin").alias("plugins").description("Manage Puku plugins").configureHelp(q());O.command("validate <path>").description("Validate a plugin or marketplace manifest").addOption($()).action(async(H,j)=>{let{pluginValidateHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("list").description("List installed plugins").option("--json","Output as JSON").option("--available","Include available plugins from marketplaces (requires --json)").addOption($()).action(async(H)=>{let{pluginListHandler:j}=await Promise.resolve().then(() => (My(),jy));await j(H)});let w=O.command("marketplace").description("Manage Puku marketplaces").configureHelp(q());if(w.command("add <source>").description("Add a marketplace from a URL, path, or GitHub repo").addOption($()).option("--sparse <paths...>","Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .puku-plugin plugins").option("--scope <scope>","Where to declare the marketplace: user (default), project, or local").action(async(H,j)=>{let{marketplaceAddHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),w.command("list").description("List all configured marketplaces").option("--json","Output as JSON").addOption($()).action(async(H)=>{let{marketplaceListHandler:j}=await Promise.resolve().then(() => (My(),jy));await j(H)}),w.command("remove <name>").alias("rm").description("Remove a configured marketplace").addOption($()).action(async(H,j)=>{let{marketplaceRemoveHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),w.command("update [name]").description("Update marketplace(s) from their source - updates all if no name specified").addOption($()).action(async(H,j)=>{let{marketplaceUpdateHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("install <plugin>").alias("i").description("Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)").option("-s, --scope <scope>","Installation scope: user, project, or local","user").addOption($()).action(async(H,j)=>{let{pluginInstallHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("uninstall <plugin>").alias("remove").alias("rm").description("Uninstall an installed plugin").option("-s, --scope <scope>","Uninstall from scope: user, project, or local","user").option("--keep-data","Preserve the plugin's persistent data directory (~/.puku-cli/plugins/data/{id}/)").addOption($()).action(async(H,j)=>{let{pluginUninstallHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("enable <plugin>").description("Enable a disabled plugin").option("-s, --scope <scope>",`Installation scope: ${_P.join(", ")} (default: auto-detect)`).addOption($()).action(async(H,j)=>{let{pluginEnableHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("disable [plugin]").description("Disable an enabled plugin").option("-a, --all","Disable all enabled plugins").option("-s, --scope <scope>",`Installation scope: ${_P.join(", ")} (default: auto-detect)`).addOption($()).action(async(H,j)=>{let{pluginDisableHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("update <plugin>").description("Update a plugin to the latest version (restart required to apply)").option("-s, --scope <scope>",`Installation scope: ${g86.join(", ")} (default: user)`).addOption($()).action(async(H,j)=>{let{pluginUpdateHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),K.command("setup-token").description("Set up a long-lived authentication token (requires Puku subscription)").action(async()=>{let[{setupTokenHandler:H},{createRoot:j}]=await Promise.all([Promise.resolve().then(() => (AJ8(),_J8)),Promise.resolve().then(() => (a6(),ak6))]),M=await j(kp(!1));await H(M)}),K.command("agents").description("List configured agents").option("--setting-sources <sources>","Comma-separated list of setting sources to load (user, project, local).").action(async()=>{let{agentsHandler:H}=await Promise.resolve().then(() => (T47(),k47));await H(),process.exit(0)}),iO8()!=="disabled"){let H=K.command("auto-mode").description("Inspect auto mode classifier configuration");H.command("defaults").description("Print the default auto mode environment, allow, and deny rules as JSON").action(async()=>{let{autoModeDefaultsHandler:j}=await Promise.resolve().then(() => (YJ8(),zJ8));j(),process.exit(0)}),H.command("config").description("Print the effective auto mode config as JSON: your settings where set, defaults otherwise").action(async()=>{let{autoModeConfigHandler:j}=await Promise.resolve().then(() => (YJ8(),zJ8));j(),process.exit(0)}),H.command("critique").description("Get AI feedback on your custom auto mode rules").option("--model <model>","Override which model is used").action(async(j)=>{let{autoModeCritiqueHandler:M}=await Promise.resolve().then(() => (YJ8(),zJ8));await M(j),process.exit()})}return K.command("doctor").description("Check the health of your Puku auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async()=>{let[{doctorHandler:H},{createRoot:j}]=await Promise.all([Promise.resolve().then(() => (AJ8(),_J8)),Promise.resolve().then(() => (a6(),ak6))]),M=await j(kp(!1));await H(M)}),K.command("update").alias("upgrade").description("Check for updates and install if available").action(async()=>{let{update:H}=await Promise.resolve().then(() => (R47(),y47));await H()}),K.command("install [target]").description("Install Puku native build. Use [target] to specify version (stable, latest, or specific version)").option("--force","Force installation even if already installed").action(async(H,j)=>{let{installHandler:M}=await Promise.resolve().then(() => (AJ8(),_J8));await M(H,j)}),Y7("run_before_parse"),await K.parseAsync(process.argv),Y7("run_after_parse"),Y7("main_after_run"),tf6(),K}async function Tc5({hasInitialPrompt:q,hasStdin:K,verbose:_,debug:A,debugToStderr:z,print:Y,outputFormat:$,inputFormat:O,numAllowedTools:w,numDisallowedTools:H,mcpClientCount:j,worktreeEnabled:M,skipWebFetchPreflight:J,githubActionInputs:P,godModePassed:X,permissionMode:f,modeIsBypass:W,allowGodModePassed:Z,systemPromptFlag:v,appendSystemPromptFlag:k,thinkingConfig:N,assistantActivationPath:y}){try{Q("tengu_init",{entrypoint:"puku-cli",hasInitialPrompt:q,hasStdin:K,verbose:_,debug:A,debugToStderr:z,print:Y,outputFormat:$,inputFormat:O,numAllowedTools:w,numDisallowedTools:H,mcpClientCount:j,worktree:M,skipWebFetchPreflight:J,...P&&{githubActionInputs:P},godModePassed:X,permissionMode:f,modeIsBypass:W,inProtectedNamespace:rk(),allowGodModePassed:Z,thinkingType:N.type,...v&&{systemPromptFlag:v},...k&&{appendSystemPromptFlag:k},is_simple:h4()||void 0,is_coordinator:void 0,...y&&{assistantActivationPath:y},autoUpdatesChannel:XK().autoUpdatesChannel??"latest",...{}})}catch(L){_6(L)}}function $J8(q){}function OJ8(q){return}function Nc5(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(yR)}function yc5(q){if(typeof q!=="object"||q===null)return{};let K=q,_=K.teammateMode;return{agentId:typeof K.agentId==="string"?K.agentId:void 0,agentName:typeof K.agentName==="string"?K.agentName:void 0,teamName:typeof K.teamName==="string"?K.teamName:void 0,agentColor:typeof K.agentColor==="string"?K.agentColor:void 0,planModeRequired:typeof K.planModeRequired==="boolean"?K.planModeRequired:void 0,parentSessionId:typeof K.parentSessionId==="string"?K.parentSessionId:void 0,teammateMode:_==="auto"||_==="tmux"||_==="in-process"?_:void 0,agentType:typeof K.agentType==="string"?K.agentType:void 0}}var V47=()=>(JY(),_z(hr8)),Yc5=()=>_z(gK_),$c5=()=>(le(),_z(C6q)),Oc5=null,wc5,KPq=11;var f2q=h(()=>{SI();DN8();_g8();IHq();jA();Gy6();fP8();UR();CA();kZ();gHq();mN();d67();l67();QA8();gj6();r67();xD();r36();YE();GJ();KQ();iY();mb6();GK();Tq();$k6();oP();Y2();i56();Vq();V7();uR6();qN();GU();pj8();l8();MJq();o67();v8();d$();Lq7();$U();X2q();_E();Bj();Z2q();DK7();xj();Tp();zJ6();Vj();Yw6();kK7();I8();oMq();sE6();kA();NK7();L3();N8();nJq();Y_();hx();vj();LH();MG();qM();QS6();Mh6();fZ();v0();uQ();e_();pc6();Rq();rb();C9();a96();RK7();lA8();kV();LK7();X_7();QO6();Bj();x2();fw();Uy6();uJq();O86();JV();i5();gu();JC();$K();Y8();T8();WK();i$();hS6();nm8();KG();Fb6();eO();v8();W_7();G_7();D_7();k_7();N_7();R_7();L_7();S_7();C_7();I_7();u_7();eMq();m_7();_C();Wt();B$6();MM6();L2();Vf();yY();NM8();y9();iE6();bY();UH();cV();YD();gR6();TX();Y7("main_tsx_entry");nbq();XJK();wc5=_z(Yl);Y7("main_tsx_imports_loaded");if(jc5())process.exit(1)});db();c26();if(!process.env.PUKU_AUTH)process.env.PUKU_AUTH="true";if(!process.env.PUKU_WORKER_URL)process.env.PUKU_WORKER_URL="https://api-cli.puku.sh";if(!process.env.PUKU_AI_BASE_URL)process.env.PUKU_AI_BASE_URL="https://api-cli.puku.sh";if(!process.env.PUKU_AI_MODEL)process.env.PUKU_AI_MODEL="MiniMax-M3";if(!process.env.PUKU_AI_SMALL_FAST_MODEL)process.env.PUKU_AI_SMALL_FAST_MODEL="MiniMax-M3";if(!process.env.PUKU_CLI_AUTO_MODE_MODEL)process.env.PUKU_CLI_AUTO_MODE_MODEL="puku-ai-2.7";process.env.PUKU_CLI_DISABLE_EXPERIMENTAL_BETAS??="true";process.env.COREPACK_ENABLE_AUTO_PIN="0";if(process.env.PUKU_CLI_REMOTE==="true"){let q=process.env.NODE_OPTIONS||"";process.env.NODE_OPTIONS=q?`${q} --max-old-space-size=8192`:"--max-old-space-size=8192"}function wJ8(q){if(!q)return!1;let K=q.trim().toLowerCase();return K!==""&&K!=="0"&&K!=="false"&&K!=="no"}function S47(q=process.env){let K=wJ8(q.PUKU_CLI_USE_OPENAI),_=wJ8(q.PUKU_CLI_USE_GITHUB);if(wJ8(q.PUKU_CLI_USE_GEMINI)){if(!(q.GEMINI_API_KEY??q.GOOGLE_API_KEY))return"GEMINI_API_KEY is required when PUKU_CLI_USE_GEMINI=1.";return null}if(_&&!K){if(!((q.GITHUB_TOKEN?.trim()||q.GH_TOKEN?.trim())??""))return"GITHUB_TOKEN or GH_TOKEN is required when PUKU_CLI_USE_GITHUB=1.";return null}if(!K)return null;let A=GM({model:q.OPENAI_MODEL,baseUrl:q.OPENAI_BASE_URL});if(q.OPENAI_API_KEY==="SUA_CHAVE")return"Invalid OPENAI_API_KEY: placeholder value SUA_CHAVE detected. Set a real key or unset for local providers.";if(A.transport==="codex_responses"){let z=qv(q);if(!z.apiKey){let Y=z.authPath?` or put auth.json at ${z.authPath}`:"";return`Codex auth is required for ${Kv(A.requestedModel,q)??"the requested model"}. Set CODEX_API_KEY${Y}.`}if(!z.accountId)return"Codex auth is missing chatgpt_account_id. Re-login with Codex or set CHATGPT_ACCOUNT_ID/CODEX_ACCOUNT_ID.";return null}if(!q.OPENAI_API_KEY&&!Fx6(A.baseUrl)){let z=!!(q.GITHUB_TOKEN?.trim()||q.GH_TOKEN?.trim());if(_&&z)return null;return"OPENAI_API_KEY is required when PUKU_CLI_USE_OPENAI=1 and OPENAI_BASE_URL is not local."}return null}function Rc5(){let q=S47();if(q)console.error(q),process.exit(1)}async function Vc5(){let q=process.argv.slice(2);if(q.length===1&&(q[0]==="--version"||q[0]==="-v"||q[0]==="-V")){console.log("1.8.31 (puku-cli)");return}if(q.includes("--provider")){let{applyProviderFlagFromArgs:Y}=await Promise.resolve().then(() => (NZq(),TZq)),$=Y(q);if($?.error)console.error(`Error: ${$.error}`),process.exit(1)}{let{enableConfigs:Y}=await Promise.resolve().then(() => (Tq(),yR8));Y();let{applySafeConfigEnvironmentVariables:$}=await Promise.resolve().then(() => (i56(),uJK));$();let{hydrateGithubModelsTokenFromSecureStorage:O}=await Promise.resolve().then(() => (Li6(),n3K));O()}let K=await GZq({processEnv:process.env});if(K!==process.env){let Y=S47(K);if(Y)console.error(`Warning: ignoring saved provider profile. ${Y}`);else vZq(process.env,K)}if(Rc5(),wJ8(process.env.PUKU_AUTH)){let{getSilentSession:Y,getPukuWorkerUrl:$}=await Promise.resolve().then(() => (Fr6(),UJK)),O=await Y();if(O)process.env.PUKU_AI_BASE_URL=$(),process.env.ANTHROPIC_AUTH_TOKEN=O.token,process.env.PUKU_USER_EMAIL=O.user.email,process.env.PUKU_USER_NAME=O.user.name}Promise.resolve().then(() => (HB8(),vDK)).then(({prewarmSyntaxHighlighting:Y})=>Y());let{profileCheckpoint:_}=await Promise.resolve().then(() => (SI(),UCq));if(_("cli_entry"),process.argv[2]==="--claude-in-chrome-mcp"){_("cli_claude_in_chrome_mcp_path");let{runClaudeInChromeMcpServer:Y}=await Promise.resolve().then(() => (jt8(),Ht8));await Y();return}else if(process.argv[2]==="--chrome-native-host"){_("cli_chrome_native_host_path");let{runChromeNativeHost:Y}=await Promise.resolve().then(() => (LF_(),VF_));await Y();return}if(!1)switch(q[0]){case"ps":case"logs":case"attach":case"kill":default:}if((q.includes("--tmux")||q.includes("--tmux=classic"))&&(q.includes("-w")||q.includes("--worktree")||q.some((Y)=>Y.startsWith("--worktree=")))){_("cli_tmux_worktree_fast_path");let{enableConfigs:Y}=await Promise.resolve().then(() => (Tq(),yR8));Y();let{isWorktreeModeEnabled:$}=await Promise.resolve().then(() => d2_);if($()){let{execIntoTmuxWorktree:O}=await Promise.resolve().then(() => (TX(),sc_)),w=await O(q);if(w.handled)return;if(w.error){let{exitWithError:H}=await Promise.resolve().then(() => Ukq);H(w.error)}}}if(q.length===1&&(q[0]==="--update"||q[0]==="--upgrade"))process.argv=[process.argv[0],process.argv[1],"update"];if(q.includes("--bare"))process.env.PUKU_CLI_SIMPLE="1";if(process.env.PUKU_DISABLE_EARLY_INPUT!=="1"){let{startCapturingEarlyInput:Y}=await Promise.resolve().then(() => ($k6(),ekK));Y()}_("cli_before_main_import");let{main:z}=await Promise.resolve().then(() => (f2q(),h47));_("cli_after_main_import"),await z(),_("cli_after_main_complete")}Vc5();
|
|
9260
|
+
`))}catch(mK){return await LL(E7,`Error downloading files: ${r6(mK)}`)}let d7=aK??(Array.isArray(sq)?{messages:sq,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:HK,initialState:f5,contentReplacements:void 0}:void 0);if(d7)$J8(j),OJ8(j),await _I6(E7,{getFpsMetrics:u_,stats:FK,initialState:d7.initialState},{...V5,mainThreadAgentDefinition:d7.restoredAgentDef??HK,initialMessages:d7.messages,initialFileHistorySnapshots:d7.fileHistorySnapshots,initialContentReplacements:d7.contentReplacements,initialAgentName:d7.agentName,initialAgentColor:d7.agentColor},cq6);else await Vq7(E7,{getFpsMetrics:u_,stats:FK,initialState:f5},Um(yq()),{...V5,initialSearchQuery:RK,forkSession:j.forkSession,filterByPr:L5})}else{let a8=O$&&U5.length===0?O$:void 0;Y7("action_after_hooks"),$J8(j),OJ8(j);let sq=null,aK=sq?[sq,...U5]:U5.length>0?U5:void 0;await _I6(E7,{getFpsMetrics:u_,stats:FK,initialState:f5},{...V5,initialMessages:aK,pendingHookMessages:a8},cq6)}}).version("1.8.32 (puku-cli)","-v, --version","Output the version number"),K.option("-w, --worktree [name]","Create a new git worktree for this session (optionally specify a name)"),K.option("--tmux","Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux."),qQ())K.addOption(new yA("--advisor <model>","Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp());K.addOption(new yA("--enable-auto-mode","Opt in to auto mode").hideHelp()),K.addOption(new yA("--agent-id <id>","Teammate agent ID").hideHelp()),K.addOption(new yA("--agent-name <name>","Teammate display name").hideHelp()),K.addOption(new yA("--team-name <name>","Team name for swarm coordination").hideHelp()),K.addOption(new yA("--agent-color <color>","Teammate UI color").hideHelp()),K.addOption(new yA("--plan-mode-required","Require plan mode before implementation").hideHelp()),K.addOption(new yA("--parent-session-id <id>","Parent session ID for analytics correlation").hideHelp()),K.addOption(new yA("--teammate-mode <mode>",'How to spawn teammates: "tmux", "in-process", or "auto"').choices(["auto","tmux","in-process"]).hideHelp()),K.addOption(new yA("--agent-type <type>","Custom agent type for this teammate").hideHelp()),K.addOption(new yA("--sdk-url <url>","Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp()),K.addOption(new yA("--teleport [session]","Resume a teleport session, optionally specify session ID").hideHelp()),K.addOption(new yA("--remote [description]","Create a remote session with the given description").hideHelp()),Y7("run_main_options_built");let _=process.argv.includes("-p")||process.argv.includes("--print"),A=process.argv.some((H)=>H.startsWith("cc://")||H.startsWith("cc+unix://"));if(_&&!A)return Y7("run_before_parse"),await K.parseAsync(process.argv),Y7("run_after_parse"),K;let z=K.command("mcp").description("Configure and manage MCP servers").configureHelp(q()).enablePositionalOptions();if(z.command("serve").description("Start the Puku MCP server").option("-d, --debug","Enable debug mode",()=>!0).option("--verbose","Override verbose mode setting from config",()=>!0).action(async({debug:H,verbose:j})=>{let{mcpServeHandler:M}=await Promise.resolve().then(() => (Eg(),Sg));await M({debug:H,verbose:j})}),VK7(z),J_7(z),zp())P_7(z);z.command("remove <name>").description("Remove an MCP server").option("-s, --scope <scope>","Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in").action(async(H,j)=>{let{mcpRemoveHandler:M}=await Promise.resolve().then(() => (Eg(),Sg));await M(H,j)}),z.command("list").description("List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async()=>{let{mcpListHandler:H}=await Promise.resolve().then(() => (Eg(),Sg));await H()}),z.command("get <name>").description("Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async(H)=>{let{mcpGetHandler:j}=await Promise.resolve().then(() => (Eg(),Sg));await j(H)}),z.command("add-json <name> <json>").description("Add an MCP server (stdio or SSE) with a JSON string").option("-s, --scope <scope>","Configuration scope (local, user, or project)","local").option("--client-secret","Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)").action(async(H,j,M)=>{let{mcpAddJsonHandler:J}=await Promise.resolve().then(() => (Eg(),Sg));await J(H,j,M)}),z.command("add-from-puku-desktop").description("Import MCP servers from Puku Desktop (Mac and WSL only)").option("-s, --scope <scope>","Configuration scope (local, user, or project)","local").action(async(H)=>{let{mcpAddFromDesktopHandler:j}=await Promise.resolve().then(() => (Eg(),Sg));await j(H)}),z.command("reset-project-choices").description("Reset all approved and rejected project-scoped (.mcp.json) servers within this project").action(async()=>{let{mcpResetChoicesHandler:H}=await Promise.resolve().then(() => (Eg(),Sg));await H()});let Y=K.command("auth").description("Manage authentication").configureHelp(q());Y.command("login").description("Sign in to your Puku AI account").option("--email <email>","Pre-populate email address on the login page").option("--sso","Force SSO login flow").option("--console","Use Puku Console (API usage billing) instead of Puku subscription").option("--puku","Use Puku subscription (default)").addOption(new yA("--claudeai").hideHelp()).action(async({email:H,sso:j,console:M,puku:J,claudeai:P})=>{let{authLogin:X}=await Promise.resolve().then(() => (q96(),J78));await X({email:H,sso:j,console:M,claudeai:J||P})}),Y.command("status").description("Show authentication status").option("--json","Output as JSON (default)").option("--text","Output as human-readable text").action(async(H)=>{let{authStatus:j}=await Promise.resolve().then(() => (q96(),J78));await j(H)}),Y.command("logout").description("Log out from your Puku AI account").action(async()=>{let{authLogout:H}=await Promise.resolve().then(() => (q96(),J78));await H()});let $=()=>new yA("--cowork","Use cowork_plugins directory").hideHelp(),O=K.command("plugin").alias("plugins").description("Manage Puku plugins").configureHelp(q());O.command("validate <path>").description("Validate a plugin or marketplace manifest").addOption($()).action(async(H,j)=>{let{pluginValidateHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("list").description("List installed plugins").option("--json","Output as JSON").option("--available","Include available plugins from marketplaces (requires --json)").addOption($()).action(async(H)=>{let{pluginListHandler:j}=await Promise.resolve().then(() => (My(),jy));await j(H)});let w=O.command("marketplace").description("Manage Puku marketplaces").configureHelp(q());if(w.command("add <source>").description("Add a marketplace from a URL, path, or GitHub repo").addOption($()).option("--sparse <paths...>","Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .puku-plugin plugins").option("--scope <scope>","Where to declare the marketplace: user (default), project, or local").action(async(H,j)=>{let{marketplaceAddHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),w.command("list").description("List all configured marketplaces").option("--json","Output as JSON").addOption($()).action(async(H)=>{let{marketplaceListHandler:j}=await Promise.resolve().then(() => (My(),jy));await j(H)}),w.command("remove <name>").alias("rm").description("Remove a configured marketplace").addOption($()).action(async(H,j)=>{let{marketplaceRemoveHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),w.command("update [name]").description("Update marketplace(s) from their source - updates all if no name specified").addOption($()).action(async(H,j)=>{let{marketplaceUpdateHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("install <plugin>").alias("i").description("Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)").option("-s, --scope <scope>","Installation scope: user, project, or local","user").addOption($()).action(async(H,j)=>{let{pluginInstallHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("uninstall <plugin>").alias("remove").alias("rm").description("Uninstall an installed plugin").option("-s, --scope <scope>","Uninstall from scope: user, project, or local","user").option("--keep-data","Preserve the plugin's persistent data directory (~/.puku-cli/plugins/data/{id}/)").addOption($()).action(async(H,j)=>{let{pluginUninstallHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("enable <plugin>").description("Enable a disabled plugin").option("-s, --scope <scope>",`Installation scope: ${_P.join(", ")} (default: auto-detect)`).addOption($()).action(async(H,j)=>{let{pluginEnableHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("disable [plugin]").description("Disable an enabled plugin").option("-a, --all","Disable all enabled plugins").option("-s, --scope <scope>",`Installation scope: ${_P.join(", ")} (default: auto-detect)`).addOption($()).action(async(H,j)=>{let{pluginDisableHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),O.command("update <plugin>").description("Update a plugin to the latest version (restart required to apply)").option("-s, --scope <scope>",`Installation scope: ${g86.join(", ")} (default: user)`).addOption($()).action(async(H,j)=>{let{pluginUpdateHandler:M}=await Promise.resolve().then(() => (My(),jy));await M(H,j)}),K.command("setup-token").description("Set up a long-lived authentication token (requires Puku subscription)").action(async()=>{let[{setupTokenHandler:H},{createRoot:j}]=await Promise.all([Promise.resolve().then(() => (AJ8(),_J8)),Promise.resolve().then(() => (a6(),ak6))]),M=await j(kp(!1));await H(M)}),K.command("agents").description("List configured agents").option("--setting-sources <sources>","Comma-separated list of setting sources to load (user, project, local).").action(async()=>{let{agentsHandler:H}=await Promise.resolve().then(() => (T47(),k47));await H(),process.exit(0)}),iO8()!=="disabled"){let H=K.command("auto-mode").description("Inspect auto mode classifier configuration");H.command("defaults").description("Print the default auto mode environment, allow, and deny rules as JSON").action(async()=>{let{autoModeDefaultsHandler:j}=await Promise.resolve().then(() => (YJ8(),zJ8));j(),process.exit(0)}),H.command("config").description("Print the effective auto mode config as JSON: your settings where set, defaults otherwise").action(async()=>{let{autoModeConfigHandler:j}=await Promise.resolve().then(() => (YJ8(),zJ8));j(),process.exit(0)}),H.command("critique").description("Get AI feedback on your custom auto mode rules").option("--model <model>","Override which model is used").action(async(j)=>{let{autoModeCritiqueHandler:M}=await Promise.resolve().then(() => (YJ8(),zJ8));await M(j),process.exit()})}return K.command("doctor").description("Check the health of your Puku auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async()=>{let[{doctorHandler:H},{createRoot:j}]=await Promise.all([Promise.resolve().then(() => (AJ8(),_J8)),Promise.resolve().then(() => (a6(),ak6))]),M=await j(kp(!1));await H(M)}),K.command("update").alias("upgrade").description("Check for updates and install if available").action(async()=>{let{update:H}=await Promise.resolve().then(() => (R47(),y47));await H()}),K.command("install [target]").description("Install Puku native build. Use [target] to specify version (stable, latest, or specific version)").option("--force","Force installation even if already installed").action(async(H,j)=>{let{installHandler:M}=await Promise.resolve().then(() => (AJ8(),_J8));await M(H,j)}),Y7("run_before_parse"),await K.parseAsync(process.argv),Y7("run_after_parse"),Y7("main_after_run"),tf6(),K}async function Tc5({hasInitialPrompt:q,hasStdin:K,verbose:_,debug:A,debugToStderr:z,print:Y,outputFormat:$,inputFormat:O,numAllowedTools:w,numDisallowedTools:H,mcpClientCount:j,worktreeEnabled:M,skipWebFetchPreflight:J,githubActionInputs:P,godModePassed:X,permissionMode:f,modeIsBypass:W,allowGodModePassed:Z,systemPromptFlag:v,appendSystemPromptFlag:k,thinkingConfig:N,assistantActivationPath:y}){try{Q("tengu_init",{entrypoint:"puku-cli",hasInitialPrompt:q,hasStdin:K,verbose:_,debug:A,debugToStderr:z,print:Y,outputFormat:$,inputFormat:O,numAllowedTools:w,numDisallowedTools:H,mcpClientCount:j,worktree:M,skipWebFetchPreflight:J,...P&&{githubActionInputs:P},godModePassed:X,permissionMode:f,modeIsBypass:W,inProtectedNamespace:rk(),allowGodModePassed:Z,thinkingType:N.type,...v&&{systemPromptFlag:v},...k&&{appendSystemPromptFlag:k},is_simple:h4()||void 0,is_coordinator:void 0,...y&&{assistantActivationPath:y},autoUpdatesChannel:XK().autoUpdatesChannel??"latest",...{}})}catch(L){_6(L)}}function $J8(q){}function OJ8(q){return}function Nc5(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(yR)}function yc5(q){if(typeof q!=="object"||q===null)return{};let K=q,_=K.teammateMode;return{agentId:typeof K.agentId==="string"?K.agentId:void 0,agentName:typeof K.agentName==="string"?K.agentName:void 0,teamName:typeof K.teamName==="string"?K.teamName:void 0,agentColor:typeof K.agentColor==="string"?K.agentColor:void 0,planModeRequired:typeof K.planModeRequired==="boolean"?K.planModeRequired:void 0,parentSessionId:typeof K.parentSessionId==="string"?K.parentSessionId:void 0,teammateMode:_==="auto"||_==="tmux"||_==="in-process"?_:void 0,agentType:typeof K.agentType==="string"?K.agentType:void 0}}var V47=()=>(JY(),_z(hr8)),Yc5=()=>_z(gK_),$c5=()=>(le(),_z(C6q)),Oc5=null,wc5,KPq=11;var f2q=h(()=>{SI();DN8();_g8();IHq();jA();Gy6();fP8();UR();CA();kZ();gHq();mN();d67();l67();QA8();gj6();r67();xD();r36();YE();GJ();KQ();iY();mb6();GK();Tq();$k6();oP();Y2();i56();Vq();V7();uR6();qN();GU();pj8();l8();MJq();o67();v8();d$();Lq7();$U();X2q();_E();Bj();Z2q();DK7();xj();Tp();zJ6();Vj();Yw6();kK7();I8();oMq();sE6();kA();NK7();L3();N8();nJq();Y_();hx();vj();LH();MG();qM();QS6();Mh6();fZ();v0();uQ();e_();pc6();Rq();rb();C9();a96();RK7();lA8();kV();LK7();X_7();QO6();Bj();x2();fw();Uy6();uJq();O86();JV();i5();gu();JC();$K();Y8();T8();WK();i$();hS6();nm8();KG();Fb6();eO();v8();W_7();G_7();D_7();k_7();N_7();R_7();L_7();S_7();C_7();I_7();u_7();eMq();m_7();_C();Wt();B$6();MM6();L2();Vf();yY();NM8();y9();iE6();bY();UH();cV();YD();gR6();TX();Y7("main_tsx_entry");nbq();XJK();wc5=_z(Yl);Y7("main_tsx_imports_loaded");if(jc5())process.exit(1)});db();c26();if(!process.env.PUKU_AUTH)process.env.PUKU_AUTH="true";if(!process.env.PUKU_WORKER_URL)process.env.PUKU_WORKER_URL="https://api-cli.puku.sh";if(!process.env.PUKU_AI_BASE_URL)process.env.PUKU_AI_BASE_URL="https://api-cli.puku.sh";if(!process.env.PUKU_AI_MODEL)process.env.PUKU_AI_MODEL="MiniMax-M3";if(!process.env.PUKU_AI_SMALL_FAST_MODEL)process.env.PUKU_AI_SMALL_FAST_MODEL="MiniMax-M3";if(!process.env.PUKU_CLI_AUTO_MODE_MODEL)process.env.PUKU_CLI_AUTO_MODE_MODEL="puku-ai-2.7";process.env.PUKU_CLI_DISABLE_EXPERIMENTAL_BETAS??="true";process.env.COREPACK_ENABLE_AUTO_PIN="0";if(process.env.PUKU_CLI_REMOTE==="true"){let q=process.env.NODE_OPTIONS||"";process.env.NODE_OPTIONS=q?`${q} --max-old-space-size=8192`:"--max-old-space-size=8192"}function wJ8(q){if(!q)return!1;let K=q.trim().toLowerCase();return K!==""&&K!=="0"&&K!=="false"&&K!=="no"}function S47(q=process.env){let K=wJ8(q.PUKU_CLI_USE_OPENAI),_=wJ8(q.PUKU_CLI_USE_GITHUB);if(wJ8(q.PUKU_CLI_USE_GEMINI)){if(!(q.GEMINI_API_KEY??q.GOOGLE_API_KEY))return"GEMINI_API_KEY is required when PUKU_CLI_USE_GEMINI=1.";return null}if(_&&!K){if(!((q.GITHUB_TOKEN?.trim()||q.GH_TOKEN?.trim())??""))return"GITHUB_TOKEN or GH_TOKEN is required when PUKU_CLI_USE_GITHUB=1.";return null}if(!K)return null;let A=GM({model:q.OPENAI_MODEL,baseUrl:q.OPENAI_BASE_URL});if(q.OPENAI_API_KEY==="SUA_CHAVE")return"Invalid OPENAI_API_KEY: placeholder value SUA_CHAVE detected. Set a real key or unset for local providers.";if(A.transport==="codex_responses"){let z=qv(q);if(!z.apiKey){let Y=z.authPath?` or put auth.json at ${z.authPath}`:"";return`Codex auth is required for ${Kv(A.requestedModel,q)??"the requested model"}. Set CODEX_API_KEY${Y}.`}if(!z.accountId)return"Codex auth is missing chatgpt_account_id. Re-login with Codex or set CHATGPT_ACCOUNT_ID/CODEX_ACCOUNT_ID.";return null}if(!q.OPENAI_API_KEY&&!Fx6(A.baseUrl)){let z=!!(q.GITHUB_TOKEN?.trim()||q.GH_TOKEN?.trim());if(_&&z)return null;return"OPENAI_API_KEY is required when PUKU_CLI_USE_OPENAI=1 and OPENAI_BASE_URL is not local."}return null}function Rc5(){let q=S47();if(q)console.error(q),process.exit(1)}async function Vc5(){let q=process.argv.slice(2);if(q.length===1&&(q[0]==="--version"||q[0]==="-v"||q[0]==="-V")){console.log("1.8.32 (puku-cli)");return}if(q.includes("--provider")){let{applyProviderFlagFromArgs:Y}=await Promise.resolve().then(() => (NZq(),TZq)),$=Y(q);if($?.error)console.error(`Error: ${$.error}`),process.exit(1)}{let{enableConfigs:Y}=await Promise.resolve().then(() => (Tq(),yR8));Y();let{applySafeConfigEnvironmentVariables:$}=await Promise.resolve().then(() => (i56(),uJK));$();let{hydrateGithubModelsTokenFromSecureStorage:O}=await Promise.resolve().then(() => (Li6(),n3K));O()}let K=await GZq({processEnv:process.env});if(K!==process.env){let Y=S47(K);if(Y)console.error(`Warning: ignoring saved provider profile. ${Y}`);else vZq(process.env,K)}if(Rc5(),wJ8(process.env.PUKU_AUTH)){let{getSilentSession:Y,getPukuWorkerUrl:$}=await Promise.resolve().then(() => (Fr6(),UJK)),O=await Y();if(O)process.env.PUKU_AI_BASE_URL=$(),process.env.ANTHROPIC_AUTH_TOKEN=O.token,process.env.PUKU_USER_EMAIL=O.user.email,process.env.PUKU_USER_NAME=O.user.name}Promise.resolve().then(() => (HB8(),vDK)).then(({prewarmSyntaxHighlighting:Y})=>Y());let{profileCheckpoint:_}=await Promise.resolve().then(() => (SI(),UCq));if(_("cli_entry"),process.argv[2]==="--claude-in-chrome-mcp"){_("cli_claude_in_chrome_mcp_path");let{runClaudeInChromeMcpServer:Y}=await Promise.resolve().then(() => (jt8(),Ht8));await Y();return}else if(process.argv[2]==="--chrome-native-host"){_("cli_chrome_native_host_path");let{runChromeNativeHost:Y}=await Promise.resolve().then(() => (LF_(),VF_));await Y();return}if(!1)switch(q[0]){case"ps":case"logs":case"attach":case"kill":default:}if((q.includes("--tmux")||q.includes("--tmux=classic"))&&(q.includes("-w")||q.includes("--worktree")||q.some((Y)=>Y.startsWith("--worktree=")))){_("cli_tmux_worktree_fast_path");let{enableConfigs:Y}=await Promise.resolve().then(() => (Tq(),yR8));Y();let{isWorktreeModeEnabled:$}=await Promise.resolve().then(() => d2_);if($()){let{execIntoTmuxWorktree:O}=await Promise.resolve().then(() => (TX(),sc_)),w=await O(q);if(w.handled)return;if(w.error){let{exitWithError:H}=await Promise.resolve().then(() => Ukq);H(w.error)}}}if(q.length===1&&(q[0]==="--update"||q[0]==="--upgrade"))process.argv=[process.argv[0],process.argv[1],"update"];if(q.includes("--bare"))process.env.PUKU_CLI_SIMPLE="1";if(process.env.PUKU_DISABLE_EARLY_INPUT!=="1"){let{startCapturingEarlyInput:Y}=await Promise.resolve().then(() => ($k6(),ekK));Y()}_("cli_before_main_import");let{main:z}=await Promise.resolve().then(() => (f2q(),h47));_("cli_after_main_import"),await z(),_("cli_after_main_complete")}Vc5();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puku/puku-cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.32",
|
|
4
4
|
"description": "Puku CLI — AI coding assistant powered by Puku AI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"bin/puku-cli",
|
|
11
11
|
"bin/import-specifier.mjs",
|
|
12
12
|
"dist/cli.mjs",
|
|
13
|
+
"dist/vendor/",
|
|
13
14
|
"README.md"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|