@readmagic/workmate 0.0.31 → 0.0.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/chunks/{AddWorkspaceDirectory-C07tZJZN.js → AddWorkspaceDirectory-vexJPqPV.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-C1YY3Zjr.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-6_bT7l-8.js → AgentsMdExternalIncludesDialog-DgfH_qbT.js} +1 -1
- package/dist/chunks/{App--Nvun0sE.js → App-Dc1bPgMO.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-DTWNv4Gc.js → BackgroundTasksDialog-By1aAUjA.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-CJ6U9Vb2.js → BypassPermissionsModeDialog-BfT29YcX.js} +1 -1
- package/dist/chunks/{CustomSelect-uOjgHk8D.js → CustomSelect-C1eyA6Kb.js} +1 -1
- package/dist/chunks/{DiffDialog-CTFLCtYp.js → DiffDialog-DlzYbkSE.js} +1 -1
- package/dist/chunks/Doctor-BTo-aW25.js +1 -0
- package/dist/chunks/{Doctor-CgZxiFf3.js → Doctor-Bysh947B.js} +1 -1
- package/dist/chunks/{ExitFlow-DGqwlF8J.js → ExitFlow-DdgKWYBy.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-8ZJmSDBO.js → InvalidConfigDialog-B5hyg2fw.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-B7czkYPj.js → InvalidSettingsDialog-NORkKmDs.js} +1 -1
- package/dist/chunks/{KeybindingProviderSetup-C8rq4fwQ.js → KeybindingProviderSetup-Dfo4pevM.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-DbPzbRdc.js → MCPConnectionManager-DTNuL42C.js} +1 -1
- package/dist/chunks/{MCPToolListView-BsO2uWCL.js → MCPToolListView-CmyNoMRA.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-BIpQ_Dle.js → McpParsingWarnings-F5n38r1V.js} +1 -1
- package/dist/chunks/{MessageSelector-DuCpdn-Q.js → MessageSelector-CB3shj7u.js} +1 -1
- package/dist/chunks/{Messages-SKlSLbVo.js → Messages-DHOApZZj.js} +1 -1
- package/dist/chunks/{Onboarding-CLEqdl35.js → Onboarding-LjlAtPO-.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-cu1KF4_b.js → PromptInputFooterSuggestions-ChS18ulx.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-MH_gVGmN.js → PromptInputHelpMenu-BG4Xvwlp.js} +1 -1
- package/dist/chunks/{ProviderSetup-zjQQUmDr.js → ProviderSetup-ebTTSOUN.js} +1 -1
- package/dist/chunks/{QueryEngine-Cb2ncWE6.js → QueryEngine-D_X2cZgn.js} +1 -1
- package/dist/chunks/REPL-BmB39a3K.js +1 -0
- package/dist/chunks/{REPL-CWbLkb3q.js → REPL-CJAN4D4C.js} +4 -4
- package/dist/chunks/{ResumeConversation-DRcIMHTE.js → ResumeConversation-Vsc6MgfT.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DxijDdxt.js +1 -0
- package/dist/chunks/{Settings-B-EscJrZ.js → Settings-Bx9sAK4z.js} +2 -2
- package/dist/chunks/{Spinner-ByYcKk2V.js → Spinner-bYnSD54K.js} +1 -1
- package/dist/chunks/{TextInput-eYxBj_1-.js → TextInput-DJaXm3Y2.js} +1 -1
- package/dist/chunks/{ThemePicker-BqeGU99Q.js → ThemePicker-DTRkcYKg.js} +1 -1
- package/dist/chunks/{TrustDialog-DYZ0i7rH.js → TrustDialog-CCLPfwKL.js} +1 -1
- package/dist/chunks/{_baseEach-BQ2jM5Sg.js → _baseEach-CVpc553F.js} +1 -1
- package/dist/chunks/{add-dir-3q2C-Kfj.js → add-dir-CC99_pE2.js} +1 -1
- package/dist/chunks/{agentDisplay-C18dbK7V.js → agentDisplay-CouNgts6.js} +1 -1
- package/dist/chunks/{agents--BKL-glS.js → agents-B0CpBZFY.js} +1 -1
- package/dist/chunks/{agents-B_Ik_9lY.js → agents-ByQvpZ-y.js} +1 -1
- package/dist/chunks/{allErrors-CJOE7EGx.js → allErrors-BlYbbyyw.js} +1 -1
- package/dist/chunks/{backgroundHousekeeping-FPn2H48W.js → backgroundHousekeeping-C86ALKjw.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-FTpq_e19.js +1 -0
- package/dist/chunks/{branch-7SdIl7ZG.js → branch-BQ_M1T0j.js} +1 -1
- package/dist/chunks/{btw-BhVWw00h.js → btw-y1tuqCvG.js} +1 -1
- package/dist/chunks/caches-CO82GKDD.js +1 -0
- package/dist/chunks/{caches-DaOhyHsb.js → caches-CcK6hjFh.js} +1 -1
- package/dist/chunks/{channel-BNS35qVl.js → channel-BocoQ6RM.js} +1 -1
- package/dist/chunks/{channel-DWDK9jut.js → channel-D0MXuZ5p.js} +1 -1
- package/dist/chunks/{clear-B5WkPxlz.js → clear-Dh0ZUTyq.js} +1 -1
- package/dist/chunks/commands-CqI8Xw3J.js +1 -0
- package/dist/chunks/{compact-DriVPdmX.js → compact-Drhb6hKF.js} +1 -1
- package/dist/chunks/config-DFScnxW_.js +1 -0
- package/dist/chunks/{context-CXi66Ghx.js → context-BsbQnZOh.js} +1 -1
- package/dist/chunks/context-noninteractive-4Vn-NMDi.js +1 -0
- package/dist/chunks/{context-noninteractive-BRoUkLxt.js → context-noninteractive-BmjENE43.js} +1 -1
- package/dist/chunks/conversation-CSnPSTPX.js +1 -0
- package/dist/chunks/{conversation-DrEE7olO.js → conversation-CxvOL7c4.js} +1 -1
- package/dist/chunks/{conversationRecovery-CZzxsT_R.js → conversationRecovery-CM94gKCQ.js} +1 -1
- package/dist/chunks/{crossProjectResume-CbXDWdHE.js → crossProjectResume-Cq1oZ0F6.js} +1 -1
- package/dist/chunks/{diff-CH8kHqwX.js → diff-DHn2Qup2.js} +1 -1
- package/dist/chunks/doctor-DmJqkQqg.js +1 -0
- package/dist/chunks/{entry-CyH0Rkjq.js → entry-tt6FI8GT.js} +1 -1
- package/dist/chunks/{exit-zYpIKg68.js → exit-Q-xc8GEs.js} +1 -1
- package/dist/chunks/{extraUsage-Dp_LtcKE.js → extraUsage-CnQUVxGf.js} +1 -1
- package/dist/chunks/extractMemories-DOfFiInm.js +1 -0
- package/dist/chunks/{fast-DnP_x58e.js → fast-BeKnNZaH.js} +1 -1
- package/dist/chunks/fast-ClJARykP.js +1 -0
- package/dist/chunks/{fetchModelList-BctZn47N.js → fetchModelList-531U79it.js} +1 -1
- package/dist/chunks/fetchModelList-6pNEKem5.js +1 -0
- package/dist/chunks/{fileSuggestions-CoYWpIJB.js → fileSuggestions-sTa3fiI8.js} +1 -1
- package/dist/chunks/{gemini-CyZAw1Wg.js → gemini-BzN-GtAf.js} +1 -1
- package/dist/chunks/{generateSessionName-CJ13ZLWG.js → generateSessionName-DGzU61fU.js} +1 -1
- package/dist/chunks/{goal-CiuF90SO.js → goal-DOF3kWop.js} +1 -1
- package/dist/chunks/{grok-B4R78Wy4.js → grok-jsEI7sLT.js} +1 -1
- package/dist/chunks/{help-CQ8yZg8_.js → help-CYH2fCqh.js} +1 -1
- package/dist/chunks/{hooks-DgsxCW0L.js → hooks-BBL70Pl1.js} +1 -1
- package/dist/chunks/hooks-ujSG0QYH.js +1 -0
- package/dist/chunks/{install-W_2JVR8Y.js → install-DIv3UQHd.js} +1 -1
- package/dist/chunks/{instrumentation-Yk5dlvD_.js → instrumentation-CzXp-AVx.js} +3 -3
- package/dist/chunks/{job-CAbdQPkT.js → job-B38MURYt.js} +1 -1
- package/dist/chunks/{launchLocalMemory-C-KuYLDQ.js → launchLocalMemory-ClOCP1QH.js} +1 -1
- package/dist/chunks/{launchOnboarding-2-AEYja0.js → launchOnboarding-Km72c-fV.js} +1 -1
- package/dist/chunks/loadAgentsDir-DbkvUkkw.js +1 -0
- package/dist/chunks/{loadAgentsDir-CgDTTnMX.js → loadAgentsDir-izAo6rpy.js} +22 -22
- package/dist/chunks/{loadPluginHooks-CWkivYx4.js → loadPluginHooks-BBa5nd8Z.js} +1 -1
- package/dist/chunks/localSearch-BObbNIdd.js +1 -0
- package/dist/chunks/{localSearch-BhygSl0K.js → localSearch-BqJfYIga.js} +1 -1
- package/dist/chunks/{logoUtils-rZbHAggC.js → logoUtils-Mvbi4iz4.js} +1 -1
- package/dist/chunks/{magicDocs-430IH4o3.js → magicDocs-Beuyy0aV.js} +1 -1
- package/dist/chunks/{main-DuS6HbbE.js → main-CkDjqZz5.js} +5 -5
- package/dist/chunks/{mcp-XaHs-eh9.js → mcp-BQubBUXS.js} +1 -1
- package/dist/chunks/{mcp-BoJ9rdef.js → mcp-D8SeoRoL.js} +1 -1
- package/dist/chunks/{mcp-C2GF6Gp7.js → mcp-YtIqT_CN.js} +1 -1
- package/dist/chunks/{memory-D0vG6luI.js → memory-CFvypHzK.js} +1 -1
- package/dist/chunks/{mode-4ZXGLC71.js → mode-CLmT-L6g.js} +1 -1
- package/dist/chunks/{model-CcgVXT3w.js → model-BdWlSYyq.js} +1 -1
- package/dist/chunks/{model-BidsdFhX.js → model-cu29eOoS.js} +1 -1
- package/dist/chunks/{modelOptions-Bw53Jebp.js → modelOptions-d5F1-LIh.js} +1 -1
- package/dist/chunks/{nativeInstaller-BczAzL96.js → nativeInstaller-oMsFvcUC.js} +1 -1
- package/dist/chunks/{notifications-B3v1XAdd.js → notifications-ClFVMgnt.js} +1 -1
- package/dist/chunks/{onChangeAppState-wASLrUas.js → onChangeAppState-CvlswuIl.js} +1 -1
- package/dist/chunks/{openai-CvSNI6b2.js → openai-BoYbxtOG.js} +1 -1
- package/dist/chunks/{overlayContext-0wuZMXWl.js → overlayContext-DNYDip6r.js} +1 -1
- package/dist/chunks/{partition-CGKLltyv.js → partition-DRloaIYE.js} +1 -1
- package/dist/chunks/{permissions-DawwDdur.js → permissions-RfHevyA2.js} +1 -1
- package/dist/chunks/{pidLock-TOlSC34M.js → pidLock-Bn9y7GMY.js} +2 -2
- package/dist/chunks/{plan-D_vIEUQa.js → plan-CWfN8okc.js} +1 -1
- package/dist/chunks/{plugin-CDWB3AFL.js → plugin-Bee-4gyo.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-CPzXHVsX.js → pluginAutoupdate-xsdXYyA-.js} +1 -1
- package/dist/chunks/{pluginBlocklist-Bu6GP9_C.js → pluginBlocklist-BTdbSAHE.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CNpseXZD.js → pluginCliCommands-AlVmiNIz.js} +1 -1
- package/dist/chunks/{pluginFlagging-1MM3zuMP.js → pluginFlagging-BGOionRt.js} +1 -1
- package/dist/chunks/{pluginOperations-qT-GGKNu.js → pluginOperations-DYX4XPSc.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DXPIrR7f.js → pluginStartupCheck-CGmmDw8e.js} +1 -1
- package/dist/chunks/pluginStartupCheck-CQi735a4.js +1 -0
- package/dist/chunks/{plugins-Bbbvm9KH.js → plugins-_mf-Z_F5.js} +1 -1
- package/dist/chunks/{print-Db7IDW_T.js → print-9f_73BN2.js} +2 -2
- package/dist/chunks/{processBashCommand-DtEP1Js2.js → processBashCommand-Do8AJN_g.js} +1 -1
- package/dist/chunks/{processSlashCommand-BIIOr3n4.js → processSlashCommand-BcMLjAEQ.js} +1 -1
- package/dist/chunks/{prompt-CduUPV0s.js → prompt-B4rM4cgp.js} +1 -1
- package/dist/chunks/prompt-BnLHkqxH.js +1 -0
- package/dist/chunks/prompt-Bxk7M5A5.js +1 -0
- package/dist/chunks/{reconciler-DQxjz0OK.js → reconciler-BcpooxDV.js} +1 -1
- package/dist/chunks/{refresh-BmkkYKno.js → refresh-nrBMGYPi.js} +1 -1
- package/dist/chunks/{reject-DYsU8jkO.js → reject-B3lkQjOv.js} +1 -1
- package/dist/chunks/{reload-plugins-CmHAxvlA.js → reload-plugins-C6aSczZl.js} +1 -1
- package/dist/chunks/{rename-BrGuvkvC.js → rename-D3rmIsGf.js} +1 -1
- package/dist/chunks/{resume-COSo0ATp.js → resume-Cj_JBDJU.js} +1 -1
- package/dist/chunks/{runtimeObserver-Dpi40Nfi.js → runtimeObserver-4vJtpquK.js} +2 -2
- package/dist/chunks/{runtimeObserver-CoNTwrJ3.js → runtimeObserver-CgdVfPHy.js} +1 -1
- package/dist/chunks/sandbox-adapter-BNLLtZ41.js +1 -0
- package/dist/chunks/{sandbox-toggle-CrjErH9V.js → sandbox-toggle-Dt4lDgnB.js} +1 -1
- package/dist/chunks/searchExtraTools-C1v6F01_.js +1 -0
- package/dist/chunks/{select-BNeFiLNP.js → select-CPlgmbIJ.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-BnOpxVs-.js +1 -0
- package/dist/chunks/{sessionObserver-CAvR0MCN.js → sessionObserver-CFN7Ig3Q.js} +1 -1
- package/dist/chunks/sessionObserver-CnWQCO-S.js +1 -0
- package/dist/chunks/sessionStorage-Dr6JjGiG.js +1 -0
- package/dist/chunks/{sessionTracing-rMBtalMz.js → sessionTracing-nqfu1pVT.js} +1 -1
- package/dist/chunks/{setup-X5QOX_BW.js → setup-Im12wZpx.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-BucAPuXp.js → shadowedRuleDetection-CiG8S6iX.js} +1 -1
- package/dist/chunks/{sideQuestion-B1W_L7NR.js → sideQuestion-BW9eo3IE.js} +1 -1
- package/dist/chunks/{sinks-Bqzavjot.js → sinks-C7vJLHLA.js} +1 -1
- package/dist/chunks/sinks-DMDnR8N8.js +1 -0
- package/dist/chunks/{skillChangeDetector-jKxXTp4F.js → skillChangeDetector-CrsPxCzn.js} +1 -1
- package/dist/chunks/{skillGapStore-CQVCxlWd.js → skillGapStore-BV5H9Flk.js} +2 -2
- package/dist/chunks/{skillLifecycle-GGpX7H8W.js → skillLifecycle-EnEI14W2.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DDM0zZ_r.js → skillSearchPanel-CSm2Eq_U.js} +2 -2
- package/dist/chunks/{skills-Bmdrtecu.js → skills-C69Im5ML.js} +1 -1
- package/dist/chunks/status-D2nNF67-.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-DRJcaVdx.js → statusNoticeHelpers-BHExATuY.js} +1 -1
- package/dist/chunks/{switcher-CqGz0hjQ.js → switcher-BdsveDwj.js} +1 -1
- package/dist/chunks/switcher-DFyvU0Qc.js +1 -0
- package/dist/chunks/{tasks-CNQUkXoq.js → tasks-CJDAZERm.js} +1 -1
- package/dist/chunks/{templateJobs-CYArZLti.js → templateJobs-fCnSjC9_.js} +1 -1
- package/dist/chunks/{theme-DVkXXIPx.js → theme-B3baZuK8.js} +1 -1
- package/dist/chunks/{tipRegistry-DzOyYhJT.js → tipRegistry-devcMyyn.js} +1 -1
- package/dist/chunks/{toolEventObserver-BAkhiG0F.js → toolEventObserver-CNXN4TOt.js} +1 -1
- package/dist/chunks/{toolPool-D_7Onp-c.js → toolPool-B4XkmUDX.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-z3RiW9jT.js → useExitOnCtrlCDWithKeybindings-BfgcAS50.js} +1 -1
- package/dist/chunks/useMainLoopModel-CO_oa76K.js +1 -0
- package/dist/chunks/{useManagePlugins-DSRLHKH5.js → useManagePlugins-CYUa0_Sn.js} +1 -1
- package/dist/chunks/{useMergedTools-C7wh5W03.js → useMergedTools-By1K71LJ.js} +1 -1
- package/dist/chunks/{useSearchInput-r534PKo1.js → useSearchInput-C4O9vs6X.js} +1 -1
- package/dist/chunks/{useSettingsErrors-DL_ai-el.js → useSettingsErrors-Cw8_cPbg.js} +1 -1
- package/dist/chunks/{util-DombpJHQ.js → util-CEVuoH2G.js} +1 -1
- package/dist/chunks/{validatePlugin-DU3C7Mvb.js → validatePlugin-B7OHQSIx.js} +1 -1
- package/dist/chunks/worktree-C9F9fuJ9.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BbSA-E68.js +0 -1
- package/dist/chunks/Doctor-Bd0k7Jo7.js +0 -1
- package/dist/chunks/REPL-D1bn80_0.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-B6Qlr08G.js +0 -1
- package/dist/chunks/backgroundHousekeeping-COON_jRA.js +0 -1
- package/dist/chunks/caches-DgNr-KX3.js +0 -1
- package/dist/chunks/commands-DJe5bkNw.js +0 -1
- package/dist/chunks/config-FEF6EcWp.js +0 -1
- package/dist/chunks/context-noninteractive-Bupgkyt9.js +0 -1
- package/dist/chunks/conversation-CCV0BYD_.js +0 -1
- package/dist/chunks/doctor-HV7-zZgq.js +0 -1
- package/dist/chunks/extractMemories-1_fkJtc-.js +0 -1
- package/dist/chunks/fast-Bi-RRDlf.js +0 -1
- package/dist/chunks/fetchModelList-Dfyy0Yds.js +0 -1
- package/dist/chunks/hooks-Cj3t3ItG.js +0 -1
- package/dist/chunks/loadAgentsDir-jBY44wEO.js +0 -1
- package/dist/chunks/localSearch-B3aRqi3q.js +0 -1
- package/dist/chunks/pluginStartupCheck-CCDpCchC.js +0 -1
- package/dist/chunks/prompt-CCP82QoX.js +0 -1
- package/dist/chunks/prompt-DmWyLDH6.js +0 -1
- package/dist/chunks/sandbox-adapter-D0bQ6nsv.js +0 -1
- package/dist/chunks/searchExtraTools-_Fo0KDnz.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-BCBV26Ut.js +0 -1
- package/dist/chunks/sessionObserver-QbHl_0Dr.js +0 -1
- package/dist/chunks/sessionStorage-CscAodvT.js +0 -1
- package/dist/chunks/sinks-ofVW99nt.js +0 -1
- package/dist/chunks/status-CFpCBQX1.js +0 -1
- package/dist/chunks/switcher-BCr3vwnq.js +0 -1
- package/dist/chunks/useMainLoopModel-DMB41HoQ.js +0 -1
- package/dist/chunks/worktree-CjnMMjR6.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{i as r,l as i,o as a}from"./envUtils-QyzA_cFM.js";import{n as o,t as s}from"./defineProperty-C-QyHrDq.js";import{n as c,t as l}from"./figures-5ThXQEtq.js";import{C as u,D as d,Ft as f,Gr as p,Gt as m,H as h,I as g,Kr as _,Kt as v,Lt as y,P as b,Pn as x,Rn as S,T as C,Tt as w,Vn as T,Wt as E,Xn as D,Xt as O,Y as k,Yt as A,Z as j,Zn as M,_n as N,ai as P,bn as F,ct as I,di as L,dr as R,et as ee,fi as te,hn as ne,ir as z,j as B,lr as re,lt as V,ot as ie,q as ae,qr as oe,t as H,tr as se,vn as ce,x as le,y as U,yn as ue,yt as W}from"./src-BX54x08P.js";import{t as de}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as fe,$t as pe,B as me,Bt as he,Ft as ge,Hi as _e,Hr as ve,In as ye,Jn as be,Jr as xe,Jt as Se,L as Ce,Li as we,Nn as Te,Nt as Ee,Pi as De,Pt as Oe,Qn as ke,Vr as Ae,Vt as je,Wr as Me,Xn as Ne,Xr as Pe,Xt as Fe,Yn as Ie,Zr as Le,bn as Re,d as ze,di as Be,dn as Ve,dr as He,ea as Ue,en as We,er as Ge,fi as Ke,fr as qe,gt as Je,m as Ye,mn as Xe,na as Ze,ot as Qe,pr as $e,qt as et,s as tt,sa as nt,vn as rt,y as it,zi as at,zt as ot}from"./settings-CA-5Px85.js";import{Cn as st,Ft as ct,Gn as lt,Gt as ut,Hn as dt,I as ft,Kn as pt,Kt as mt,Pt as ht,Qt as gt,Tt as _t,Un as vt,Ut as yt,Vn as bt,W as xt,Wt as St,X as Ct,_n as wt,_t as Tt,at as Et,bt as Dt,ft as G,gt as Ot,in as kt,jt as At,kt as jt,q as Mt,rt as Nt,vt as Pt,w as Ft,wn as It,xt as Lt,y as Rt,yt as zt,z as Bt}from"./state-CXY-q5gr.js";import{$ as Vt,$C as Ht,$g as Ut,$h as Wt,$i as Gt,$l as Kt,$n as qt,$r as Jt,$s as Yt,$v as Xt,$x as Zt,A as Qt,AC as $t,Aa as en,Ac as tn,Ah as nn,An as rn,Ao as an,B as on,BC as sn,Ba as cn,Bc as ln,Bg as un,Bm as dn,Bs as fn,Bu as pn,Bv as mn,Bx as hn,C as gn,Ch as _n,Co as vn,Cp as yn,Cr as bn,Cs as xn,Cv as Sn,Cy as Cn,Db as wn,Dg as Tn,Di as En,Dl as Dn,Dv as On,Eb as K,Eg as kn,Eh as An,El as jn,Em as q,Ev as Mn,FC as Nn,Fc as Pn,Fh as Fn,Fi as In,Fl as Ln,Fm as Rn,Fn as zn,Fp as Bn,Fu as Vn,Fv as Hn,G as Un,GC as Wn,G_ as Gn,Gb as Kn,Gg as qn,Gu as Jn,Gx as Yn,H_ as Xn,Ha as Zn,Hg as Qn,Hh as J,Hm as $n,Hn as er,Ht as tr,Hv as nr,Hy as rr,IC as ir,I_ as ar,Ia as or,Ic as sr,Ig as cr,Ih as lr,Im as ur,In as dr,Ip as fr,Iu as pr,Iv as mr,J as hr,JC as gr,Jp as _r,Jr as vr,Ju as yr,Jv as br,Jx as xr,Jy as Sr,K as Cr,KC as wr,K_ as Tr,Kb as Er,Kg as Dr,Kn as Or,Kr as kr,Ku as Ar,Kv as jr,LC as Mr,L_ as Nr,Lc as Pr,Lg as Fr,Lh as Ir,Li as Lr,Lp as Rr,Lv as zr,Lx as Br,MC as Vr,Ma as Hr,Mc as Ur,Mg as Wr,Mh as Gr,Ms as Kr,Mu as qr,Mv as Jr,NC as Yr,N_ as Xr,Nc as Zr,Ng as Qr,Nh as $r,Ni as ei,Nm as ti,Nn as ni,Nu as ri,Nv as ii,O as ai,Ob as oi,Oc as si,Og as ci,Oi as li,Ov as ui,PC as di,P_ as fi,Pc as pi,Pg as mi,Ph as hi,Pi as gi,Pl as _i,Pm as vi,Ps as yi,Pt as bi,Pu as xi,Pv as Si,Q as Ci,QC as wi,Qh as Ti,Qr as Ei,Qs as Di,Qt as Oi,Qx as ki,Qy as Ai,RC as ji,R_ as Mi,Rc as Ni,Rh as Pi,Ri as Fi,Rn as Ii,Rp as Li,Rs as Ri,Rv as zi,Rx as Bi,Sb as Vi,Sc as Hi,Sh as Ui,So as Wi,Ss as Gi,Su as Ki,Sv as qi,Sy as Ji,Tc as Yi,Tg as Xi,Th as Zi,Ti as Qi,Tl as $i,Tm as ea,Ts as ta,Tu as na,Tv as ra,Ua as ia,Ug as aa,Uh as oa,Um as sa,Ut as ca,Uu as la,Ux as ua,Uy as da,V as fa,Vc as pa,Vh as Y,Vm as ma,Vs as ha,Vu as ga,Vv as _a,Vy as va,W_ as ya,Wg as ba,Wh as xa,Wm as Sa,Wu as Ca,Wx as wa,Wy as Ta,X as Ea,XC as Da,Xh as Oa,Xi as ka,Xo as Aa,Xp as ja,Xs as Ma,Xv as Na,Xy as Pa,Y as Fa,YC as Ia,Yh as La,Yo as Ra,Yp as za,Ys as Ba,Yt as Va,Yv as Ha,Za as Ua,Zh as Wa,Zi as Ga,Zo as Ka,Zp as qa,Zr as Ja,Zv as Ya,_b as Xa,_d as Za,_g as Qa,_h as $a,_i as eo,_l as to,_m as no,_o as ro,_s as io,_u as ao,ab as oo,ag as so,aw as co,ay as lo,b as uo,bS as fo,bb as po,bc as mo,bg as ho,bh as go,bl as _o,bp as vo,bs as yo,bu as bo,bx as xo,cb as So,cd as Co,cg as wo,ci as To,cn as Eo,co as Do,cs as Oo,ct as ko,cw as Ao,cy as jo,dS as Mo,da as No,db as Po,dd as Fo,dg as Io,dl as Lo,dm as Ro,do as zo,dr as Bo,dv as Vo,dw as Ho,dy as Uo,e_ as Wo,el as Go,em as Ko,es as qo,eu as Jo,ew as Yo,ey as Xo,fS as Zo,fb as Qo,fg as $o,fl as es,fo as ts,fu as ns,fy as rs,gd as is,gg as as,gm as os,gn as ss,gs as cs,gu as ls,hb as us,hd as ds,hg as fs,hh as ps,hm as ms,hs,hu as gs,hx as _s,hy as vs,i_ as ys,ib as bs,ic as xs,id as Ss,ig as Cs,iw as ws,iy as Ts,jb as Es,jh as Ds,jo as Os,js as ks,jv as As,jy as js,k as Ms,kb as Ns,kc as Ps,ki as Fs,kv as Is,ky as Ls,lC as Rs,lb as zs,ld as Bs,lg as Vs,ll as Hs,lm as Us,lo as Ws,lt as Gs,lv as Ks,mC as qs,mS as Js,mb as Ys,md as Xs,mh as Zs,mm as Qs,mr as $s,mu as ec,mv as tc,mx as nc,nS as rc,nb as ic,nc as ac,ni as oc,nl as sc,nm as cc,nr as lc,ns as uc,nu as dc,nw as fc,ny as pc,ob as mc,og as hc,oo as gc,ow as _c,oy as vc,pC as yc,pS as bc,pd as xc,pl as Sc,pm as Cc,po as wc,pv as Tc,px as Ec,py as Dc,qC as Oc,qS as kc,qp as Ac,qu as jc,qv as Mc,qx as Nc,qy as Pc,r_ as Fc,rb as Ic,rc as Lc,rd as Rc,rg as zc,rm as Bc,rs as Vc,ry as Hc,sC as Uc,sb as Wc,sg as Gc,si as Kc,sl as qc,so as Jc,ss as Yc,sw as Xc,sy as Zc,tS as Qc,tc as $c,tg as el,tl,tm as nl,to as rl,tu as il,tv as al,tw as ol,ty as sl,uC as cl,ub as ll,ug as ul,ul as dl,um as fl,uo as pl,uw as ml,uy as hl,va as gl,vb as _l,vh as vl,vi as yl,vl as bl,vm as xl,vr as Sl,vs as Cl,vu as wl,wg as Tl,wh as El,wl as Dl,wm as Ol,wp as kl,wt as Al,wu as jl,wv as Ml,wy as Nl,xS as Pl,xb as Fl,xc as Il,xg as Ll,xh as Rl,xl as zl,xr as Bl,xs as Vl,xt as Hl,xu as Ul,xv as Wl,xx as Gl,xy as Kl,yb as ql,yc as Jl,yh as Yl,yl as Xl,ym as Zl,yo as Ql,yp as $l,yr as eu,ys as tu,yu as nu,yx as ru,zC as iu,zc as au,zg as ou,zh as su,zi as cu,zr as lu,zs as uu,zx as du}from"./loadAgentsDir-CgDTTnMX.js";import{n as fu,t as pu}from"./cwd-DrEEb4f5.js";import{$ as mu,C as hu,E as gu,H as _u,I as vu,M as yu,R as bu,S as xu,V as Su,Y as Cu,c as X,et as wu,f as Tu,g as Eu,i as Du,u as Ou,x as ku}from"./debug-NBJH_NxR.js";import{d as Au,h as ju,o as Mu,t as Nu}from"./config-CMtnYZR9.js";import{B as Pu,F as Fu,H as Iu,L as Lu,R as Ru,j as zu,o as Bu,q as Vu,s as Hu}from"./log-D98mO6yJ.js";import{i as Uu,t as Wu}from"./execFileNoThrow-7Ys9mO27.js";import{c as Gu,i as Ku,n as qu,o as Ju,s as Yu,t as Xu}from"./bundledMode-Dqe4pz0a.js";import{n as Zu}from"./analytics-COpjZpvd.js";import{n as Qu,o as $u,s as ed,t as td}from"./intl-D2kgJmX7.js";import{S as nd,_ as rd,d as id,g as ad,l as od,u as sd}from"./startupProfiler-C_xcIvEA.js";import{a as cd,d as ld,l as ud,o as dd,r as fd}from"./stringUtils-CtJhTszO.js";import{$ as pd,At as md,S as hd,at as gd,b as _d,et as vd,f as yd,g as bd,h as xd,jt as Sd,l as Cd,s as wd,u as Td}from"./model-BidsdFhX.js";import{Ct as Ed,Rt as Dd,dn as Od,fn as kd,in as Ad,ln as jd,pn as Md,rn as Nd,tt as Pd,wt as Fd,zt as Id}from"./prompt-CduUPV0s.js";import{i as Ld,r as Rd}from"./projectOnboardingState-DqGLXSM_.js";import{a as zd,l as Bd}from"./sleep-BGewNhNx.js";import{a as Vd}from"./ripgrep-CnK9qx1e.js";import{a as Hd}from"./loader-DsEdsMHv.js";import{n as Ud,r as Wd}from"./switcher-CqGz0hjQ.js";import{B as Gd,L as Kd,c as qd,r as Jd}from"./sessionTracing-rMBtalMz.js";import{i as Yd,n as Xd,r as Zd}from"./parser-D2kggQDp.js";import{n as Qd,t as $d}from"./poorMode-BvypUTur.js";import{n as ef,t as tf}from"./notifications-B3v1XAdd.js";import{t as nf}from"./useManagePlugins-DSRLHKH5.js";import{t as rf}from"./KeybindingProviderSetup-C8rq4fwQ.js";import{n as af,t as of}from"./MCPConnectionManager-DbPzbRdc.js";import{n as sf,t as cf}from"./toolPool-D_7Onp-c.js";import{t as lf}from"./conversationRecovery-CZzxsT_R.js";import{a as uf,i as df,o as ff,r as pf,t as mf}from"./MessageSelector-DuCpdn-Q.js";import{t as hf}from"./useDoublePress-zA5QwIpO.js";import{n as gf,t as _f}from"./useExitOnCtrlCDWithKeybindings-z3RiW9jT.js";import{C as vf,D as yf,E as bf,O as xf,S as Sf,T as Cf,a as wf,c as Tf,d as Ef,f as Df,i as Of,l as kf,m as Af,n as jf,o as Mf,p as Nf,r as Pf,s as Ff,t as If,w as Lf,x as Rf}from"./TextInput-eYxBj_1-.js";import{n as zf,t as Bf}from"./select-BNeFiLNP.js";import{i as Vf,n as Hf}from"./terminalSetup-h_TPZN2E.js";import{a as Uf,c as Wf,i as Gf,l as Kf,n as qf,o as Jf,r as Yf,s as Xf,t as Zf,u as Qf}from"./history-PZLMYab7.js";import{i as $f,n as ep,r as tp,t as np}from"./overlayContext-0wuZMXWl.js";import{a as rp,c as ip,d as ap,f as op,i as sp,l as cp,n as lp,o as up,r as dp,s as fp,u as pp}from"./Spinner-ByYcKk2V.js";import{l as mp,u as hp}from"./SpinnerGlyph-4aVLQdJf.js";import{n as gp,r as _p}from"./sessionTitle-k4wpUS5l.js";import{n as vp,t as yp}from"./sideQuestion-B1W_L7NR.js";import{a as bp,n as xp,o as Sp,r as Cp,s as wp,t as Tp}from"./skillChangeDetector-jKxXTp4F.js";import{n as Ep,t as Dp}from"./reconciler-DQxjz0OK.js";import{n as Op,t as kp}from"./refresh-BmkkYKno.js";import{i as Ap,n as jp,r as Mp,t as Np}from"./directoryCompletion-CwKPuwrS.js";import{r as Pp,t as Fp}from"./PromptInputFooterSuggestions-cu1KF4_b.js";import{n as Ip,t as Lp}from"./useMergedTools-C7wh5W03.js";import{a as Rp,i as zp,n as Bp,o as Vp,r as Hp,t as Up}from"./promptEditor-CyMqa_av.js";import{n as Wp,t as Gp}from"./useMainLoopModel-DMB41HoQ.js";import{a as Kp,i as qp,o as Jp,r as Yp,s as Xp,t as Zp}from"./fileSuggestions-CoYWpIJB.js";import{E as Qp,T as $p,g as em,m as tm}from"./pidLock-TOlSC34M.js";import{n as nm,t as rm}from"./nativeInstaller-BczAzL96.js";import{n as im,t as am}from"./CustomSelect-uOjgHk8D.js";import{i as om,n as sm,r as cm,t as lm}from"./extraUsage-Dp_LtcKE.js";import{n as um,t as dm}from"./useSearchInput-r534PKo1.js";import{n as fm,t as pm}from"./staticRender-Bt82RvGc.js";import{n as mm,t as hm}from"./useSettingsErrors-DL_ai-el.js";import{n as gm,t as _m}from"./shadowedRuleDetection-BucAPuXp.js";import{n as vm,t as ym}from"./ExitFlow-DGqwlF8J.js";import{a as bm,i as xm,r as Sm,t as Cm}from"./fast-DnP_x58e.js";import{i as wm,n as Tm,r as Em,t as Dm}from"./PermissionDialog-DjCRuzSm.js";import{a as Om,i as km,n as Am,r as jm,t as Mm}from"./PromptInputHelpMenu-MH_gVGmN.js";import{n as Nm,r as Pm}from"./pluginAutoupdate-CPzXHVsX.js";import{n as Fm,t as Im}from"./generateSessionName-CJ13ZLWG.js";import{a as Lm,c as Rm,i as zm,l as Bm,n as Vm,o as Hm,r as Um,s as Wm,t as Gm}from"./Messages-SKlSLbVo.js";import{a as Km,i as qm,n as Jm,o as Ym,r as Xm,t as Zm}from"./BackgroundTasksDialog-DTWNv4Gc.js";import{n as Qm}from"./fpsMetrics-DIpm2-xw.js";import{a as $m,i as eh,n as th,r as nh,t as rh}from"./tipRegistry-DzOyYhJT.js";import{t as ih}from"./earlyInput-IghoCjG5.js";import{t as ah}from"./backgroundHousekeeping-FPn2H48W.js";import{homedir as oh,tmpdir as sh}from"os";import{basename as ch,dirname as lh,extname as uh,join as dh,relative as fh,sep as ph}from"path";import{dirname as mh,join as hh}from"node:path";import{createHash as gh}from"node:crypto";import{randomUUID as _h}from"crypto";import{writeFile as vh}from"fs/promises";import{spawn as yh,spawnSync as bh}from"child_process";import{mkdir as xh,readFile as Sh,rename as Ch,writeFile as wh}from"node:fs/promises";function Th(e){return Array.isArray?Array.isArray(e):Fh(e)===`[object Array]`}function Eh(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function Dh(e){return e==null?``:Eh(e)}function Oh(e){return typeof e==`string`}function kh(e){return typeof e==`number`}function Ah(e){return e===!0||e===!1||Mh(e)&&Fh(e)==`[object Boolean]`}function jh(e){return typeof e==`object`}function Mh(e){return jh(e)&&e!==null}function Nh(e){return e!=null}function Ph(e){return!e.trim().length}function Fh(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}function Ih(e){let t=null,n=null,r=null,i=1,a=null;if(Oh(e)||Th(e))r=e,t=Lh(e),n=Rh(e);else{if(!bg.call(e,`name`))throw Error(_g(`name`));let o=e.name;if(r=o,bg.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(vg(Rh(o)));t=Lh(o),n=Rh(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function Lh(e){return Th(e)?e:e.split(`.`)}function Rh(e){return Th(e)?e.join(`.`):e}function zh(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(Nh(e))if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!Nh(s))return;if(a===t.length-1&&(Oh(s)||kh(s)||Ah(s)||typeof s==`bigint`))n.push(o===void 0?Dh(s):{v:Dh(s),i:o});else if(Th(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}};return i(e,Oh(t)?t.split(`.`):t,0),r?n:n[0]}function Bh(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=1,a=!1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===32?a||(i++,a=!0):a=!1;if(n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}function Vh(e,t,{getFn:n=Z.getFn,fieldNormWeight:r=Z.fieldNormWeight}={}){let i=new Eg({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Ih)),i.setSources(t),i.create(),i}function Hh(e,{getFn:t=Z.getFn,fieldNormWeight:n=Z.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new Eg({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function Uh(e=[],t=Z.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function Wh(e,t,n,{location:r=Z.location,distance:i=Z.distance,threshold:a=Z.threshold,findAllMatches:o=Z.findAllMatches,minMatchCharLength:s=Z.minMatchCharLength,includeMatches:c=Z.includeMatches,ignoreLocation:l=Z.ignoreLocation}={}){if(t.length>32)throw Error(gg(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=Uh(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function Gh(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function Kh(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}function qh(e){return e.startsWith(`inverse`)}function Jh(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function Yh(e,t){let n=e.match(t);return n?n[1]:null}function Xh(e,t={}){return e.replace(/\\\|/g,Pg).split(Fg).map(e=>{let n=Jh(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<Ng;){let e=Mg[o],n=Yh(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<Ng;){let e=Mg[o],n=Yh(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}function Zh(...e){Lg.push(...e)}function Qh(e,t){for(let n=0,r=Lg.length;n<r;n+=1){let r=Lg[n];if(r.condition(e,t))return new r(e,t)}return new Ag(e,t)}function $h(e,t,{auto:n=!0}={}){let r=e=>{if(Oh(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=Qh(e,t)),r}let i=Object.keys(e),a=Vg(e);if(!a&&i.length>1&&!Bg(e))return r(Ug(e));if(Hg(e)){let r=a?e[zg.PATH]:i[0],o=a?e[zg.PATTERN]:e[r];if(!Oh(o))throw Error(hg(r));let s={keyId:Rh(r),pattern:o};return n&&(s.searcher=Qh(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Th(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Bg(e)||(e=Ug(e)),r(e)}function eg(e,{ignoreFieldNorm:t=Z.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function tg(e,{ignoreFieldNorm:t=Z.ignoreFieldNorm}){e.forEach(e=>{e.score=eg(e.matches,{ignoreFieldNorm:t})})}function ng(e){let t=[];return e.matches.forEach(e=>{if(!Nh(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function rg(e,t,{includeMatches:n=Z.includeMatches,includeScore:r=Z.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=ng(e)),r&&(a.score=e.score),a})}function ig(e){Kg.has(e)||(Kg.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function ag(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||ig(e),t=>t.match(e)||[]):e=>e.match(Gg)||[]}function og({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=ag(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=kg(n)),r(n)}}}function sg(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function cg(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0){sg(e,a,i,r);return}if(o)for(let t=0;t<n;t++){let n=o[t];if(n)if(Array.isArray(n))for(let t of n)sg(e,t.v,i,r);else sg(e,n.v,i,r)}}function lg(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)cg(r,i,t,n);return r}function ug(e,t,n,r){cg(e,t,n,r)}function dg(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function fg(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)dg(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var pg,mg,hg,gg,_g,vg,yg,bg,xg,Sg,Cg,wg,Tg,Z,Eg,Dg,Og,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig,Lg,Rg,zg,Bg,Vg,Hg,Ug,Wg,Gg,Kg,qg,Jg,Yg,Xg=t((()=>{pg=`Incorrect 'index' type`,mg=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,hg=e=>`Invalid value for key ${e}`,gg=e=>`Pattern length exceeds max of ${e}.`,_g=e=>`Missing ${e} property in key`,vg=e=>`Property 'weight' in key '${e}' must be a positive integer`,yg=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,bg=Object.prototype.hasOwnProperty,xg=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Ih(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}},Sg={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Cg={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},wg={location:0,threshold:.6,distance:100},Tg={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:zh,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Z=Object.freeze({...Cg,...Sg,...wg,...Tg}),Eg=class{constructor({getFn:e=Z.getFn,fieldNormWeight:t=Z.fieldNormWeight}={}){this.norm=Bh(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(Oh(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(mg);if(Oh(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(mg);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!Nh(e)||Ph(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(Nh(i)){if(Th(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(Nh(n)){if(Oh(n)){if(!Ph(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(Nh(n.v)){let t=Oh(n.v)?n.v:Dh(n.v);if(!Ph(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(Oh(i)&&!Ph(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}},Dg={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},Og=RegExp(`[`+Object.keys(Dg).join(``)+`]`,`g`),kg=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(Og,e=>Dg[e]):e=>e,Ag=class{constructor(e,{location:t=Z.location,threshold:n=Z.threshold,distance:r=Z.distance,includeMatches:i=Z.includeMatches,findAllMatches:a=Z.findAllMatches,minMatchCharLength:o=Z.minMatchCharLength,isCaseSensitive:s=Z.isCaseSensitive,ignoreDiacritics:c=Z.ignoreDiacritics,ignoreLocation:l=Z.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?kg(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Gh(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?kg(e):e,this.pattern===e){let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=Wh(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=Kh(u)),p}},jg=new Set([`fuzzy`,`include`]),Mg=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new Ag(e,{location:t.location??Z.location,threshold:t.threshold??Z.threshold,distance:t.distance??Z.distance,includeMatches:t.includeMatches??Z.includeMatches,findAllMatches:t.findAllMatches??Z.findAllMatches,minMatchCharLength:t.minMatchCharLength??Z.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??Z.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??Z.ignoreDiacritics,ignoreLocation:t.ignoreLocation??Z.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],Ng=Mg.length,Pg=`\0`,Fg=`|`,Ig=class{constructor(e,{isCaseSensitive:t=Z.isCaseSensitive,ignoreDiacritics:n=Z.ignoreDiacritics,includeMatches:r=Z.includeMatches,minMatchCharLength:i=Z.minMatchCharLength,ignoreLocation:a=Z.ignoreLocation,findAllMatches:o=Z.findAllMatches,location:s=Z.location,threshold:c=Z.threshold,distance:l=Z.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?kg(e):e,this.pattern=e,this.query=Xh(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?kg(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,qh(r.type)&&(c=!0),n&&(jg.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=Kh(o)),e}}return{isMatch:!1,score:1}}},Lg=[],Rg={AND:`$and`,OR:`$or`},zg={PATH:`$path`,PATTERN:`$val`},Bg=e=>!!(e[Rg.AND]||e[Rg.OR]),Vg=e=>!!e[zg.PATH],Hg=e=>!Th(e)&&jh(e)&&!Bg(e),Ug=e=>({[Rg.AND]:Object.keys(e).map(t=>({[t]:e[t]}))}),Wg=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&t[i].score>t[r].score&&(r=i),a<n&&t[a].score>t[r].score&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}},Gg=/[\p{L}\p{M}\p{N}_]+/gu,Kg=new WeakSet,qg=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=og({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new Ag(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=Kh(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}},Jg=class{constructor(e,t,n){this.options={...Z,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new xg(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=Qh(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Eg))throw Error(pg);if(this._myIndex=t||Vh(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=og({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=lg(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!Nh(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=og({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});ug(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&fg(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(mg);this._invertedIndex&&fg(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(Oh(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return kh(n)&&n>-1&&(e=e.slice(0,n)),e}let c=kh(n)&&n>0&&Oh(e),l;if(c){let t=new Wg(n);Oh(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=Oh(e)?Oh(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),tg(l,{ignoreFieldNorm:s}),a&&l.sort(o),kh(n)&&n>-1&&(l=l.slice(0,n));return rg(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!Nh(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=eg(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=$h(e,this.options),n=(e,t,r)=>{if(!(`children`in e)){let{keyId:n,searcher:i}=e,a;return n===null?(a=[],this._myIndex.keys.forEach((e,n)=>{a.push(...this._findMatches({key:e,value:t[n],searcher:i}))})):a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i}),a&&a.length?[{idx:r,item:t,matches:a}]:[]}let{children:i,operator:a}=e,o=[];for(let e=0,s=i.length;e<s;e+=1){let s=i[e],c=n(s,t,r);if(c.length)o.push(...c);else if(a===Rg.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(Nh(e)){let o=n(t,e,r);o.length&&(i.has(r)||(i.set(r,{idx:r,item:e,matches:[]}),a.push(i.get(r))),o.forEach(({matches:e})=>{i.get(r).matches.push(...e)}))}}),a}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{keys:a,records:o}=this._myIndex,s=t?null:[];return o.forEach(({$:e,i:o})=>{if(!Nh(e))return;let c=[],l=!1,u=!1;if(a.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:o,item:e,matches:c};t?(r.score=eg(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!Nh(t))return[];let r=[];if(Th(t))t.forEach(({v:t,i,n:a})=>{if(!Nh(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}},Jg.version=`7.4.2`,Jg.createIndex=Vh,Jg.parseIndex=Hh,Jg.config=Z,Jg.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(yg);return Qh(e,{...Z,...n}).searchIn(t)},Jg.parseQuery=$h,Zh(Ig),Zh(qg),Jg.use=function(...e){e.forEach(e=>Zh(e))},Yg=Jg}));o(),ce(),c(),H(),pt(),ht(),fe(),$u(),zs(),Lc(),Ef(),dm();var Q=n(P(),1);_(),Vm(),mc(),zd(),Y(),pm();var $=de();function Zg({children:e}){let{bindings:t}=Bd(),n=(0,Q.useRef)(null),r=(0,Q.useRef)(new Map),i=(0,Q.useRef)(new Set).current;return(0,$.jsx)(v,{bindings:t,pendingChordRef:n,pendingChord:null,setPendingChord:()=>{},activeContexts:i,registerActiveContext:()=>{},unregisterActiveContext:()=>{},handlerRegistryRef:r,children:e})}function Qg(e){if(!(`message`in e))return 1;let t=e.message.content;return Array.isArray(t)?t.length:1}async function $g(e,t,n,{columns:r,verbose:i=!1,chunkSize:a=40,onProgress:o}={}){let s=n=>fm((0,$.jsx)(su,{children:(0,$.jsx)(Zg,{children:(0,$.jsx)(Gm,{messages:e,tools:t,commands:[],verbose:i,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:`export`,screen:`prompt`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1,renderRange:n})})}),r),c=a;for(let t of e)c+=Qg(t);for(let e=0;e<c;e+=a){let t=await s([e,e+a]);if(oe(t).trim()===``)break;await n(t),o?.(e+a)}}async function e_(e,t=[],n){let r=[];return await $g(e,t,e=>void r.push(oe(e)),{columns:n}),r.join(``)}a(),te(),De(),fu(),mu(),_u(),vu(),ku(),Tu(),Du(),Be(),Vu(),Bu(),Uu(),Pe(),Yu(),xe(),Ju(),$e(),Zu(),Ie(),ye(),rt(),rd(),Xe(),pe(),Xu(),Fe(),Oe(),Je(),Ce(),dd(),Ye(),Au(),Md(),gd(),yd(),Ad(),ml(),wr(),Vr(),yc(),Vd(),Rs(),Kd(),Gl(),nc(),Kn(),Ns(),K(),Vi(),ql(),us(),Po(),ll(),bs(),Ic(),Ai(),rr(),Id(),js(),Nl(),Kl(),Dc(),jo(),lo(),Hc(),Fd(),Pd(),sl(),Ha(),Mc(),nr(),Jr(),qi(),Tc(),al(),Tr(),Xn(),Mi(),Fc(),Ut(),Zd(),qn(),ou(),mi(),ci(),kn(),ho(),Qa(),ul(),Gc(),Oa(),Ir(),$r(),Gr(),Sa(),ma(),ur(),vi(),ea(),Zl(),no(),Cc(),Us(),cc(),Ko(),ja(),ds(),xc(),jc(),Vn(),ri(),dc(),Jo(),Dn(),$i(),_o(),bl(),pa(),Ps(),qd(),Jl(),Di(),Ba(),fn(),Kr(),ta(),Vl(),hs(),Yc(),Vc(),an(),vn(),ts(),Ua(),Zn(),or(),en(),ka(),cu(),gi(),yl(),Sl(),ni(),ss(),Ci(),Fa(),Un(),fa(),uo(),Rp(),am();function t_({onDone:e}){return(0,$.jsxs)(U,{title:`You've spent $5 on the API this session.`,onCancel:e,children:[(0,$.jsxs)(g,{flexDirection:`column`,children:[(0,$.jsx)(b,{children:`Learn more about how to monitor your spending:`}),(0,$.jsx)(y,{url:`https://code.workmate.com/docs/en/costs`})]}),(0,$.jsx)(Bf,{options:[{value:`ok`,label:`Got it, thanks!`}],onChange:e})]})}zf(),H(),am();function n_({idleMinutes:e,totalInputTokens:t,onDone:n}){return(0,$.jsxs)(U,{title:`You've been away ${r_(e)} and this conversation is ${ad(t)} tokens.`,onCancel:()=>n(`dismiss`),children:[(0,$.jsx)(g,{flexDirection:`column`,children:(0,$.jsx)(b,{children:`If this is a new task, clearing context will save usage and be faster.`})}),(0,$.jsx)(Bf,{options:[{value:`continue`,label:`Continue this conversation`},{value:`clear`,label:`Send message as a new conversation`},{value:`never`,label:`Don't ask me again`}],onChange:e=>n(e)})]})}function r_(e){if(e<1)return`< 1m`;if(e<60)return`${Math.floor(e)}m`;let t=Math.floor(e/60),n=Math.floor(e%60);return n===0?`${t}h`:`${t}h ${n}m`}tf();async function i_(e,t){let n=Mu().preferredNotifChannel;await tr(e),await o_(n,e,t),et.terminal}var a_=`Work Mate`;async function o_(e,t,n){let r=t.title||a_;try{switch(e){case`auto`:return s_(t,n);case`iterm2`:return n.notifyITerm2(t),`iterm2`;case`iterm2_with_bell`:return n.notifyITerm2(t),n.notifyBell(),`iterm2_with_bell`;case`kitty`:return n.notifyKitty({...t,title:r,id:c_()}),`kitty`;case`ghostty`:return n.notifyGhostty({...t,title:r}),`ghostty`;case`terminal_bell`:return n.notifyBell(),`terminal_bell`;case`notifications_disabled`:return`disabled`;default:return`none`}}catch{return`error`}}async function s_(e,t){let n=e.title||a_;switch(et.terminal){case`Apple_Terminal`:return await l_()?(t.notifyBell(),`terminal_bell`):`no_method_available`;case`iTerm.app`:return t.notifyITerm2(e),`iterm2`;case`kitty`:return t.notifyKitty({...e,title:n,id:c_()}),`kitty`;case`ghostty`:return t.notifyGhostty({...e,title:n}),`ghostty`;default:return`no_method_available`}}function c_(){return Math.floor(Math.random()*1e4)}async function l_(){try{if(et.terminal!==`Apple_Terminal`)return!1;let e=(await Wu(`osascript`,[`-e`,`tell application "Terminal" to name of current settings of front window`])).stdout.trim();if(!e)return!1;let t=await Wu(`defaults`,[`export`,`com.apple.Terminal`,`-`]);if(t.code!==0)return!1;let r=(await import(`./plist-Bzo2VMe9.js`).then(e=>n(e.default,1))).parse(t.stdout)?.[`Window Settings`]?.[e];return r?r.Bell===!1:!1}catch(e){return Hu(e),!1}}var u_=300,d_=240*1e3,f_=null,p_=null,m_=0,h_=!1;function g_(){m_++,m_===1&&(x_(),y_())}function __(){m_>0&&m_--,m_===0&&(b_(),S_())}function v_(){m_=0,b_(),S_()}function y_(){process.platform===`darwin`&&p_===null&&(p_=setInterval(()=>{m_>0&&(X(`Restarting caffeinate to maintain sleep prevention`),S_(),x_())},d_),p_.unref())}function b_(){p_!==null&&(clearInterval(p_),p_=null)}function x_(){if(process.platform===`darwin`&&f_===null){h_||(h_=!0,wu(async()=>{v_()}));try{f_=yh(`caffeinate`,[`-i`,`-t`,String(u_)],{stdio:`ignore`}),f_.unref();let e=f_;f_.on(`error`,t=>{X(`caffeinate spawn error: ${t.message}`),f_===e&&(f_=null)}),f_.on(`exit`,()=>{f_===e&&(f_=null)}),X(`Started caffeinate to prevent sleep`)}catch{f_=null}}}function S_(){if(f_!==null){let e=f_;f_=null;try{e.kill(`SIGKILL`),X(`Stopped caffeinate, allowing sleep`)}catch{}}}var C_=class{constructor(){s(this,`_status`,`idle`),s(this,`_generation`,0),s(this,`_changed`,lt()),s(this,`subscribe`,this._changed.subscribe),s(this,`getSnapshot`,()=>this._status!==`idle`)}reserve(){return this._status===`idle`?(this._status=`dispatching`,this._notify(),!0):!1}cancelReservation(){this._status===`dispatching`&&(this._status=`idle`,this._notify())}tryStart(){return this._status===`running`?null:(this._status=`running`,++this._generation,this._notify(),this._generation)}end(e){return this._generation!==e||this._status!==`running`?!1:(this._status=`idle`,this._notify(),!0)}forceEnd(){this._status!==`idle`&&(this._status=`idle`,++this._generation,this._notify())}get isActive(){return this._status!==`idle`}get generation(){return this._generation}_notify(){this._changed.emit()}};function w_(e,t=!1){let n=(0,Q.useRef)(0),r=(0,Q.useRef)(void 0),i=(0,Q.useRef)(void 0),a=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(t)return;let o=e[0]?.uuid,s=n.current,c=i.current===void 0,l=o!==void 0&&!c&&o===i.current&&s<=e.length,u=o!==void 0&&!c&&o===i.current&&s>e.length,d=l?s:0;if(d===e.length)return;let f=d===0?e:e.slice(d),p=l?r.current:void 0,m=++a.current;if(kr(f,{},p,e).then(e=>{m===a.current&&e&&!l&&(r.current=e)}),l||c||u){let t=er(f,e).findLast(eu);t&&(r.current=t.uuid)}n.current=e.length,i.current=o},[e,t])}_f(),op(),pp(),up(),dp(),pf(),H();var T_=6e3;function E_(){return Date.now()-Bt()}function D_(e){return E_()<e}function O_(e){return!D_(e)}function k_(e,t){let n=x();(0,Q.useEffect)(()=>{vt(!0)},[]),(0,Q.useEffect)(()=>{let r=!1,i=setInterval(()=>{O_(6e3)&&!r&&(r=!0,clearInterval(i),i_({message:e,notificationType:t},n))},T_);return()=>clearInterval(i)},[e,t,n])}Rd(),So(),Ta(),pn(),Ni(),Pn(),Ur(),hf(),xf(),Cf(),vf(),Vf(),Xf(),Ff(),Of(),jf(),Hp(),wm(),H(),Pc();var A_={topLeft:`┌`,topRight:`┐`,bottomLeft:`└`,bottomRight:`┘`,horizontal:`─`,vertical:`│`,teeLeft:`├`,teeRight:`┤`};function j_(e){return Pi().syntaxHighlightingDisabled?(0,$.jsx)(N_,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(N_,{...e,highlight:null}),children:(0,$.jsx)(M_,{...e})})}function M_(e){let t=(0,Q.use)(nn());return(0,$.jsx)(N_,{...e,highlight:t})}function N_({content:e,maxLines:t,minHeight:n,minWidth:r=40,maxWidth:i,highlight:a}){let{columns:o}=ie(),[s]=h(),c=i??o-4,l=t??20,u=(0,Q.useMemo)(()=>Xs(e,s,a),[e,s,a]).split(`
|
|
1
|
+
import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{i as r,l as i,o as a}from"./envUtils-QyzA_cFM.js";import{n as o,t as s}from"./defineProperty-C-QyHrDq.js";import{n as c,t as l}from"./figures-5ThXQEtq.js";import{C as u,D as d,Ft as f,Gr as p,Gt as m,H as h,I as g,Kr as _,Kt as v,Lt as y,P as b,Pn as x,Rn as S,T as C,Tt as w,Vn as T,Wt as E,Xn as D,Xt as O,Y as k,Yt as A,Z as j,Zn as M,_n as N,ai as P,bn as F,ct as I,di as L,dr as R,et as ee,fi as te,hn as ne,ir as z,j as B,lr as re,lt as V,ot as ie,q as ae,qr as oe,t as H,tr as se,vn as ce,x as le,y as U,yn as ue,yt as W}from"./src-BX54x08P.js";import{t as de}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as fe,$t as pe,B as me,Bt as he,Ft as ge,Hi as _e,Hr as ve,In as ye,Jn as be,Jr as xe,Jt as Se,L as Ce,Li as we,Nn as Te,Nt as Ee,Pi as De,Pt as Oe,Qn as ke,Vr as Ae,Vt as je,Wr as Me,Xn as Ne,Xr as Pe,Xt as Fe,Yn as Ie,Zr as Le,bn as Re,d as ze,di as Be,dn as Ve,dr as He,ea as Ue,en as We,er as Ge,fi as Ke,fr as qe,gt as Je,m as Ye,mn as Xe,na as Ze,ot as Qe,pr as $e,qt as et,s as tt,sa as nt,vn as rt,y as it,zi as at,zt as ot}from"./settings-CA-5Px85.js";import{Cn as st,Ft as ct,Gn as lt,Gt as ut,Hn as dt,I as ft,Kn as pt,Kt as mt,Pt as ht,Qt as gt,Tt as _t,Un as vt,Ut as yt,Vn as bt,W as xt,Wt as St,X as Ct,_n as wt,_t as Tt,at as Et,bt as Dt,ft as G,gt as Ot,in as kt,jt as At,kt as jt,q as Mt,rt as Nt,vt as Pt,w as Ft,wn as It,xt as Lt,y as Rt,yt as zt,z as Bt}from"./state-CXY-q5gr.js";import{$ as Vt,$C as Ht,$g as Ut,$h as Wt,$i as Gt,$l as Kt,$n as qt,$r as Jt,$s as Yt,$v as Xt,$x as Zt,A as Qt,AC as $t,Aa as en,Ac as tn,Ah as nn,An as rn,Ao as an,B as on,BC as sn,Ba as cn,Bc as ln,Bg as un,Bm as dn,Bs as fn,Bu as pn,Bv as mn,Bx as hn,C as gn,Ch as _n,Co as vn,Cp as yn,Cr as bn,Cs as xn,Cv as Sn,Cy as Cn,Db as wn,Dg as Tn,Di as En,Dl as Dn,Dv as On,Eb as K,Eg as kn,Eh as An,El as jn,Em as q,Ev as Mn,FC as Nn,Fc as Pn,Fh as Fn,Fi as In,Fl as Ln,Fm as Rn,Fn as zn,Fp as Bn,Fu as Vn,Fv as Hn,G as Un,GC as Wn,G_ as Gn,Gb as Kn,Gg as qn,Gu as Jn,Gx as Yn,H_ as Xn,Ha as Zn,Hg as Qn,Hh as J,Hm as $n,Hn as er,Ht as tr,Hv as nr,Hy as rr,IC as ir,I_ as ar,Ia as or,Ic as sr,Ig as cr,Ih as lr,Im as ur,In as dr,Ip as fr,Iu as pr,Iv as mr,J as hr,JC as gr,Jp as _r,Jr as vr,Ju as yr,Jv as br,Jx as xr,Jy as Sr,K as Cr,KC as wr,K_ as Tr,Kb as Er,Kg as Dr,Kn as Or,Kr as kr,Ku as Ar,Kv as jr,LC as Mr,L_ as Nr,Lc as Pr,Lg as Fr,Lh as Ir,Li as Lr,Lp as Rr,Lv as zr,Lx as Br,MC as Vr,Ma as Hr,Mc as Ur,Mg as Wr,Mh as Gr,Ms as Kr,Mu as qr,Mv as Jr,NC as Yr,N_ as Xr,Nc as Zr,Ng as Qr,Nh as $r,Ni as ei,Nm as ti,Nn as ni,Nu as ri,Nv as ii,O as ai,Ob as oi,Oc as si,Og as ci,Oi as li,Ov as ui,PC as di,P_ as fi,Pc as pi,Pg as mi,Ph as hi,Pi as gi,Pl as _i,Pm as vi,Ps as yi,Pt as bi,Pu as xi,Pv as Si,Q as Ci,QC as wi,Qh as Ti,Qr as Ei,Qs as Di,Qt as Oi,Qx as ki,Qy as Ai,RC as ji,R_ as Mi,Rc as Ni,Rh as Pi,Ri as Fi,Rn as Ii,Rp as Li,Rs as Ri,Rv as zi,Rx as Bi,Sb as Vi,Sc as Hi,Sh as Ui,So as Wi,Ss as Gi,Su as Ki,Sv as qi,Sy as Ji,Tc as Yi,Tg as Xi,Th as Zi,Ti as Qi,Tl as $i,Tm as ea,Ts as ta,Tu as na,Tv as ra,Ua as ia,Ug as aa,Uh as oa,Um as sa,Ut as ca,Uu as la,Ux as ua,Uy as da,V as fa,Vc as pa,Vh as Y,Vm as ma,Vs as ha,Vu as ga,Vv as _a,Vy as va,W_ as ya,Wg as ba,Wh as xa,Wm as Sa,Wu as Ca,Wx as wa,Wy as Ta,X as Ea,XC as Da,Xh as Oa,Xi as ka,Xo as Aa,Xp as ja,Xs as Ma,Xv as Na,Xy as Pa,Y as Fa,YC as Ia,Yh as La,Yo as Ra,Yp as za,Ys as Ba,Yt as Va,Yv as Ha,Za as Ua,Zh as Wa,Zi as Ga,Zo as Ka,Zp as qa,Zr as Ja,Zv as Ya,_b as Xa,_d as Za,_g as Qa,_h as $a,_i as eo,_l as to,_m as no,_o as ro,_s as io,_u as ao,ab as oo,ag as so,aw as co,ay as lo,b as uo,bS as fo,bb as po,bc as mo,bg as ho,bh as go,bl as _o,bp as vo,bs as yo,bu as bo,bx as xo,cb as So,cd as Co,cg as wo,ci as To,cn as Eo,co as Do,cs as Oo,ct as ko,cw as Ao,cy as jo,dS as Mo,da as No,db as Po,dd as Fo,dg as Io,dl as Lo,dm as Ro,do as zo,dr as Bo,dv as Vo,dw as Ho,dy as Uo,e_ as Wo,el as Go,em as Ko,es as qo,eu as Jo,ew as Yo,ey as Xo,fS as Zo,fb as Qo,fg as $o,fl as es,fo as ts,fu as ns,fy as rs,gd as is,gg as as,gm as os,gn as ss,gs as cs,gu as ls,hb as us,hd as ds,hg as fs,hh as ps,hm as ms,hs,hu as gs,hx as _s,hy as vs,i_ as ys,ib as bs,ic as xs,id as Ss,ig as Cs,iw as ws,iy as Ts,jb as Es,jh as Ds,jo as Os,js as ks,jv as As,jy as js,k as Ms,kb as Ns,kc as Ps,ki as Fs,kv as Is,ky as Ls,lC as Rs,lb as zs,ld as Bs,lg as Vs,ll as Hs,lm as Us,lo as Ws,lt as Gs,lv as Ks,mC as qs,mS as Js,mb as Ys,md as Xs,mh as Zs,mm as Qs,mr as $s,mu as ec,mv as tc,mx as nc,nS as rc,nb as ic,nc as ac,ni as oc,nl as sc,nm as cc,nr as lc,ns as uc,nu as dc,nw as fc,ny as pc,ob as mc,og as hc,oo as gc,ow as _c,oy as vc,pC as yc,pS as bc,pd as xc,pl as Sc,pm as Cc,po as wc,pv as Tc,px as Ec,py as Dc,qC as Oc,qS as kc,qp as Ac,qu as jc,qv as Mc,qx as Nc,qy as Pc,r_ as Fc,rb as Ic,rc as Lc,rd as Rc,rg as zc,rm as Bc,rs as Vc,ry as Hc,sC as Uc,sb as Wc,sg as Gc,si as Kc,sl as qc,so as Jc,ss as Yc,sw as Xc,sy as Zc,tS as Qc,tc as $c,tg as el,tl,tm as nl,to as rl,tu as il,tv as al,tw as ol,ty as sl,uC as cl,ub as ll,ug as ul,ul as dl,um as fl,uo as pl,uw as ml,uy as hl,va as gl,vb as _l,vh as vl,vi as yl,vl as bl,vm as xl,vr as Sl,vs as Cl,vu as wl,wg as Tl,wh as El,wl as Dl,wm as Ol,wp as kl,wt as Al,wu as jl,wv as Ml,wy as Nl,xS as Pl,xb as Fl,xc as Il,xg as Ll,xh as Rl,xl as zl,xr as Bl,xs as Vl,xt as Hl,xu as Ul,xv as Wl,xx as Gl,xy as Kl,yb as ql,yc as Jl,yh as Yl,yl as Xl,ym as Zl,yo as Ql,yp as $l,yr as eu,ys as tu,yu as nu,yx as ru,zC as iu,zc as au,zg as ou,zh as su,zi as cu,zr as lu,zs as uu,zx as du}from"./loadAgentsDir-izAo6rpy.js";import{n as fu,t as pu}from"./cwd-DrEEb4f5.js";import{$ as mu,C as hu,E as gu,H as _u,I as vu,M as yu,R as bu,S as xu,V as Su,Y as Cu,c as X,et as wu,f as Tu,g as Eu,i as Du,u as Ou,x as ku}from"./debug-NBJH_NxR.js";import{d as Au,h as ju,o as Mu,t as Nu}from"./config-CMtnYZR9.js";import{B as Pu,F as Fu,H as Iu,L as Lu,R as Ru,j as zu,o as Bu,q as Vu,s as Hu}from"./log-D98mO6yJ.js";import{i as Uu,t as Wu}from"./execFileNoThrow-7Ys9mO27.js";import{c as Gu,i as Ku,n as qu,o as Ju,s as Yu,t as Xu}from"./bundledMode-Dqe4pz0a.js";import{n as Zu}from"./analytics-COpjZpvd.js";import{n as Qu,o as $u,s as ed,t as td}from"./intl-D2kgJmX7.js";import{S as nd,_ as rd,d as id,g as ad,l as od,u as sd}from"./startupProfiler-C_xcIvEA.js";import{a as cd,d as ld,l as ud,o as dd,r as fd}from"./stringUtils-CtJhTszO.js";import{$ as pd,At as md,S as hd,at as gd,b as _d,et as vd,f as yd,g as bd,h as xd,jt as Sd,l as Cd,s as wd,u as Td}from"./model-cu29eOoS.js";import{Ct as Ed,Rt as Dd,dn as Od,fn as kd,in as Ad,ln as jd,pn as Md,rn as Nd,tt as Pd,wt as Fd,zt as Id}from"./prompt-B4rM4cgp.js";import{i as Ld,r as Rd}from"./projectOnboardingState-DqGLXSM_.js";import{a as zd,l as Bd}from"./sleep-BGewNhNx.js";import{a as Vd}from"./ripgrep-CnK9qx1e.js";import{a as Hd}from"./loader-DsEdsMHv.js";import{n as Ud,r as Wd}from"./switcher-BdsveDwj.js";import{B as Gd,L as Kd,c as qd,r as Jd}from"./sessionTracing-nqfu1pVT.js";import{i as Yd,n as Xd,r as Zd}from"./parser-D2kggQDp.js";import{n as Qd,t as $d}from"./poorMode-BvypUTur.js";import{n as ef,t as tf}from"./notifications-ClFVMgnt.js";import{t as nf}from"./useManagePlugins-CYUa0_Sn.js";import{t as rf}from"./KeybindingProviderSetup-Dfo4pevM.js";import{n as af,t as of}from"./MCPConnectionManager-DTNuL42C.js";import{n as sf,t as cf}from"./toolPool-B4XkmUDX.js";import{t as lf}from"./conversationRecovery-CM94gKCQ.js";import{a as uf,i as df,o as ff,r as pf,t as mf}from"./MessageSelector-CB3shj7u.js";import{t as hf}from"./useDoublePress-zA5QwIpO.js";import{n as gf,t as _f}from"./useExitOnCtrlCDWithKeybindings-BfgcAS50.js";import{C as vf,D as yf,E as bf,O as xf,S as Sf,T as Cf,a as wf,c as Tf,d as Ef,f as Df,i as Of,l as kf,m as Af,n as jf,o as Mf,p as Nf,r as Pf,s as Ff,t as If,w as Lf,x as Rf}from"./TextInput-DJaXm3Y2.js";import{n as zf,t as Bf}from"./select-CPlgmbIJ.js";import{i as Vf,n as Hf}from"./terminalSetup-h_TPZN2E.js";import{a as Uf,c as Wf,i as Gf,l as Kf,n as qf,o as Jf,r as Yf,s as Xf,t as Zf,u as Qf}from"./history-PZLMYab7.js";import{i as $f,n as ep,r as tp,t as np}from"./overlayContext-DNYDip6r.js";import{a as rp,c as ip,d as ap,f as op,i as sp,l as cp,n as lp,o as up,r as dp,s as fp,u as pp}from"./Spinner-bYnSD54K.js";import{l as mp,u as hp}from"./SpinnerGlyph-4aVLQdJf.js";import{n as gp,r as _p}from"./sessionTitle-k4wpUS5l.js";import{n as vp,t as yp}from"./sideQuestion-BW9eo3IE.js";import{a as bp,n as xp,o as Sp,r as Cp,s as wp,t as Tp}from"./skillChangeDetector-CrsPxCzn.js";import{n as Ep,t as Dp}from"./reconciler-BcpooxDV.js";import{n as Op,t as kp}from"./refresh-nrBMGYPi.js";import{i as Ap,n as jp,r as Mp,t as Np}from"./directoryCompletion-CwKPuwrS.js";import{r as Pp,t as Fp}from"./PromptInputFooterSuggestions-ChS18ulx.js";import{n as Ip,t as Lp}from"./useMergedTools-By1K71LJ.js";import{a as Rp,i as zp,n as Bp,o as Vp,r as Hp,t as Up}from"./promptEditor-CyMqa_av.js";import{n as Wp,t as Gp}from"./useMainLoopModel-CO_oa76K.js";import{a as Kp,i as qp,o as Jp,r as Yp,s as Xp,t as Zp}from"./fileSuggestions-sTa3fiI8.js";import{E as Qp,T as $p,g as em,m as tm}from"./pidLock-Bn9y7GMY.js";import{n as nm,t as rm}from"./nativeInstaller-oMsFvcUC.js";import{n as im,t as am}from"./CustomSelect-C1eyA6Kb.js";import{i as om,n as sm,r as cm,t as lm}from"./extraUsage-CnQUVxGf.js";import{n as um,t as dm}from"./useSearchInput-C4O9vs6X.js";import{n as fm,t as pm}from"./staticRender-Bt82RvGc.js";import{n as mm,t as hm}from"./useSettingsErrors-Cw8_cPbg.js";import{n as gm,t as _m}from"./shadowedRuleDetection-CiG8S6iX.js";import{n as vm,t as ym}from"./ExitFlow-DdgKWYBy.js";import{a as bm,i as xm,r as Sm,t as Cm}from"./fast-BeKnNZaH.js";import{i as wm,n as Tm,r as Em,t as Dm}from"./PermissionDialog-DjCRuzSm.js";import{a as Om,i as km,n as Am,r as jm,t as Mm}from"./PromptInputHelpMenu-BG4Xvwlp.js";import{n as Nm,r as Pm}from"./pluginAutoupdate-xsdXYyA-.js";import{n as Fm,t as Im}from"./generateSessionName-DGzU61fU.js";import{a as Lm,c as Rm,i as zm,l as Bm,n as Vm,o as Hm,r as Um,s as Wm,t as Gm}from"./Messages-DHOApZZj.js";import{a as Km,i as qm,n as Jm,o as Ym,r as Xm,t as Zm}from"./BackgroundTasksDialog-By1aAUjA.js";import{n as Qm}from"./fpsMetrics-DIpm2-xw.js";import{a as $m,i as eh,n as th,r as nh,t as rh}from"./tipRegistry-devcMyyn.js";import{t as ih}from"./earlyInput-IghoCjG5.js";import{t as ah}from"./backgroundHousekeeping-C86ALKjw.js";import{homedir as oh,tmpdir as sh}from"os";import{basename as ch,dirname as lh,extname as uh,join as dh,relative as fh,sep as ph}from"path";import{dirname as mh,join as hh}from"node:path";import{createHash as gh}from"node:crypto";import{randomUUID as _h}from"crypto";import{writeFile as vh}from"fs/promises";import{spawn as yh,spawnSync as bh}from"child_process";import{mkdir as xh,readFile as Sh,rename as Ch,writeFile as wh}from"node:fs/promises";function Th(e){return Array.isArray?Array.isArray(e):Fh(e)===`[object Array]`}function Eh(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function Dh(e){return e==null?``:Eh(e)}function Oh(e){return typeof e==`string`}function kh(e){return typeof e==`number`}function Ah(e){return e===!0||e===!1||Mh(e)&&Fh(e)==`[object Boolean]`}function jh(e){return typeof e==`object`}function Mh(e){return jh(e)&&e!==null}function Nh(e){return e!=null}function Ph(e){return!e.trim().length}function Fh(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}function Ih(e){let t=null,n=null,r=null,i=1,a=null;if(Oh(e)||Th(e))r=e,t=Lh(e),n=Rh(e);else{if(!bg.call(e,`name`))throw Error(_g(`name`));let o=e.name;if(r=o,bg.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(vg(Rh(o)));t=Lh(o),n=Rh(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function Lh(e){return Th(e)?e:e.split(`.`)}function Rh(e){return Th(e)?e.join(`.`):e}function zh(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(Nh(e))if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!Nh(s))return;if(a===t.length-1&&(Oh(s)||kh(s)||Ah(s)||typeof s==`bigint`))n.push(o===void 0?Dh(s):{v:Dh(s),i:o});else if(Th(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}};return i(e,Oh(t)?t.split(`.`):t,0),r?n:n[0]}function Bh(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=1,a=!1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===32?a||(i++,a=!0):a=!1;if(n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}function Vh(e,t,{getFn:n=Z.getFn,fieldNormWeight:r=Z.fieldNormWeight}={}){let i=new Eg({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Ih)),i.setSources(t),i.create(),i}function Hh(e,{getFn:t=Z.getFn,fieldNormWeight:n=Z.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new Eg({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function Uh(e=[],t=Z.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function Wh(e,t,n,{location:r=Z.location,distance:i=Z.distance,threshold:a=Z.threshold,findAllMatches:o=Z.findAllMatches,minMatchCharLength:s=Z.minMatchCharLength,includeMatches:c=Z.includeMatches,ignoreLocation:l=Z.ignoreLocation}={}){if(t.length>32)throw Error(gg(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=Uh(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function Gh(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function Kh(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}function qh(e){return e.startsWith(`inverse`)}function Jh(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function Yh(e,t){let n=e.match(t);return n?n[1]:null}function Xh(e,t={}){return e.replace(/\\\|/g,Pg).split(Fg).map(e=>{let n=Jh(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<Ng;){let e=Mg[o],n=Yh(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<Ng;){let e=Mg[o],n=Yh(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}function Zh(...e){Lg.push(...e)}function Qh(e,t){for(let n=0,r=Lg.length;n<r;n+=1){let r=Lg[n];if(r.condition(e,t))return new r(e,t)}return new Ag(e,t)}function $h(e,t,{auto:n=!0}={}){let r=e=>{if(Oh(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=Qh(e,t)),r}let i=Object.keys(e),a=Vg(e);if(!a&&i.length>1&&!Bg(e))return r(Ug(e));if(Hg(e)){let r=a?e[zg.PATH]:i[0],o=a?e[zg.PATTERN]:e[r];if(!Oh(o))throw Error(hg(r));let s={keyId:Rh(r),pattern:o};return n&&(s.searcher=Qh(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Th(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Bg(e)||(e=Ug(e)),r(e)}function eg(e,{ignoreFieldNorm:t=Z.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function tg(e,{ignoreFieldNorm:t=Z.ignoreFieldNorm}){e.forEach(e=>{e.score=eg(e.matches,{ignoreFieldNorm:t})})}function ng(e){let t=[];return e.matches.forEach(e=>{if(!Nh(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function rg(e,t,{includeMatches:n=Z.includeMatches,includeScore:r=Z.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=ng(e)),r&&(a.score=e.score),a})}function ig(e){Kg.has(e)||(Kg.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function ag(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||ig(e),t=>t.match(e)||[]):e=>e.match(Gg)||[]}function og({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=ag(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=kg(n)),r(n)}}}function sg(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function cg(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0){sg(e,a,i,r);return}if(o)for(let t=0;t<n;t++){let n=o[t];if(n)if(Array.isArray(n))for(let t of n)sg(e,t.v,i,r);else sg(e,n.v,i,r)}}function lg(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)cg(r,i,t,n);return r}function ug(e,t,n,r){cg(e,t,n,r)}function dg(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function fg(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)dg(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var pg,mg,hg,gg,_g,vg,yg,bg,xg,Sg,Cg,wg,Tg,Z,Eg,Dg,Og,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig,Lg,Rg,zg,Bg,Vg,Hg,Ug,Wg,Gg,Kg,qg,Jg,Yg,Xg=t((()=>{pg=`Incorrect 'index' type`,mg=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,hg=e=>`Invalid value for key ${e}`,gg=e=>`Pattern length exceeds max of ${e}.`,_g=e=>`Missing ${e} property in key`,vg=e=>`Property 'weight' in key '${e}' must be a positive integer`,yg=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,bg=Object.prototype.hasOwnProperty,xg=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Ih(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}},Sg={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Cg={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},wg={location:0,threshold:.6,distance:100},Tg={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:zh,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},Z=Object.freeze({...Cg,...Sg,...wg,...Tg}),Eg=class{constructor({getFn:e=Z.getFn,fieldNormWeight:t=Z.fieldNormWeight}={}){this.norm=Bh(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(Oh(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(mg);if(Oh(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(mg);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!Nh(e)||Ph(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(Nh(i)){if(Th(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(Nh(n)){if(Oh(n)){if(!Ph(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(Nh(n.v)){let t=Oh(n.v)?n.v:Dh(n.v);if(!Ph(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(Oh(i)&&!Ph(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}},Dg={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},Og=RegExp(`[`+Object.keys(Dg).join(``)+`]`,`g`),kg=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(Og,e=>Dg[e]):e=>e,Ag=class{constructor(e,{location:t=Z.location,threshold:n=Z.threshold,distance:r=Z.distance,includeMatches:i=Z.includeMatches,findAllMatches:a=Z.findAllMatches,minMatchCharLength:o=Z.minMatchCharLength,isCaseSensitive:s=Z.isCaseSensitive,ignoreDiacritics:c=Z.ignoreDiacritics,ignoreLocation:l=Z.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?kg(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Gh(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?kg(e):e,this.pattern===e){let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=Wh(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=Kh(u)),p}},jg=new Set([`fuzzy`,`include`]),Mg=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new Ag(e,{location:t.location??Z.location,threshold:t.threshold??Z.threshold,distance:t.distance??Z.distance,includeMatches:t.includeMatches??Z.includeMatches,findAllMatches:t.findAllMatches??Z.findAllMatches,minMatchCharLength:t.minMatchCharLength??Z.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??Z.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??Z.ignoreDiacritics,ignoreLocation:t.ignoreLocation??Z.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],Ng=Mg.length,Pg=`\0`,Fg=`|`,Ig=class{constructor(e,{isCaseSensitive:t=Z.isCaseSensitive,ignoreDiacritics:n=Z.ignoreDiacritics,includeMatches:r=Z.includeMatches,minMatchCharLength:i=Z.minMatchCharLength,ignoreLocation:a=Z.ignoreLocation,findAllMatches:o=Z.findAllMatches,location:s=Z.location,threshold:c=Z.threshold,distance:l=Z.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?kg(e):e,this.pattern=e,this.query=Xh(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?kg(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,qh(r.type)&&(c=!0),n&&(jg.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=Kh(o)),e}}return{isMatch:!1,score:1}}},Lg=[],Rg={AND:`$and`,OR:`$or`},zg={PATH:`$path`,PATTERN:`$val`},Bg=e=>!!(e[Rg.AND]||e[Rg.OR]),Vg=e=>!!e[zg.PATH],Hg=e=>!Th(e)&&jh(e)&&!Bg(e),Ug=e=>({[Rg.AND]:Object.keys(e).map(t=>({[t]:e[t]}))}),Wg=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&t[i].score>t[r].score&&(r=i),a<n&&t[a].score>t[r].score&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}},Gg=/[\p{L}\p{M}\p{N}_]+/gu,Kg=new WeakSet,qg=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=og({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new Ag(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=Kh(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}},Jg=class{constructor(e,t,n){this.options={...Z,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new xg(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=Qh(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Eg))throw Error(pg);if(this._myIndex=t||Vh(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=og({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=lg(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!Nh(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=og({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});ug(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&fg(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(mg);this._invertedIndex&&fg(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(Oh(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return kh(n)&&n>-1&&(e=e.slice(0,n)),e}let c=kh(n)&&n>0&&Oh(e),l;if(c){let t=new Wg(n);Oh(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=Oh(e)?Oh(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),tg(l,{ignoreFieldNorm:s}),a&&l.sort(o),kh(n)&&n>-1&&(l=l.slice(0,n));return rg(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!Nh(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=eg(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=$h(e,this.options),n=(e,t,r)=>{if(!(`children`in e)){let{keyId:n,searcher:i}=e,a;return n===null?(a=[],this._myIndex.keys.forEach((e,n)=>{a.push(...this._findMatches({key:e,value:t[n],searcher:i}))})):a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i}),a&&a.length?[{idx:r,item:t,matches:a}]:[]}let{children:i,operator:a}=e,o=[];for(let e=0,s=i.length;e<s;e+=1){let s=i[e],c=n(s,t,r);if(c.length)o.push(...c);else if(a===Rg.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(Nh(e)){let o=n(t,e,r);o.length&&(i.has(r)||(i.set(r,{idx:r,item:e,matches:[]}),a.push(i.get(r))),o.forEach(({matches:e})=>{i.get(r).matches.push(...e)}))}}),a}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{keys:a,records:o}=this._myIndex,s=t?null:[];return o.forEach(({$:e,i:o})=>{if(!Nh(e))return;let c=[],l=!1,u=!1;if(a.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:o,item:e,matches:c};t?(r.score=eg(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!Nh(t))return[];let r=[];if(Th(t))t.forEach(({v:t,i,n:a})=>{if(!Nh(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}},Jg.version=`7.4.2`,Jg.createIndex=Vh,Jg.parseIndex=Hh,Jg.config=Z,Jg.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(yg);return Qh(e,{...Z,...n}).searchIn(t)},Jg.parseQuery=$h,Zh(Ig),Zh(qg),Jg.use=function(...e){e.forEach(e=>Zh(e))},Yg=Jg}));o(),ce(),c(),H(),pt(),ht(),fe(),$u(),zs(),Lc(),Ef(),dm();var Q=n(P(),1);_(),Vm(),mc(),zd(),Y(),pm();var $=de();function Zg({children:e}){let{bindings:t}=Bd(),n=(0,Q.useRef)(null),r=(0,Q.useRef)(new Map),i=(0,Q.useRef)(new Set).current;return(0,$.jsx)(v,{bindings:t,pendingChordRef:n,pendingChord:null,setPendingChord:()=>{},activeContexts:i,registerActiveContext:()=>{},unregisterActiveContext:()=>{},handlerRegistryRef:r,children:e})}function Qg(e){if(!(`message`in e))return 1;let t=e.message.content;return Array.isArray(t)?t.length:1}async function $g(e,t,n,{columns:r,verbose:i=!1,chunkSize:a=40,onProgress:o}={}){let s=n=>fm((0,$.jsx)(su,{children:(0,$.jsx)(Zg,{children:(0,$.jsx)(Gm,{messages:e,tools:t,commands:[],verbose:i,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:`export`,screen:`prompt`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1,renderRange:n})})}),r),c=a;for(let t of e)c+=Qg(t);for(let e=0;e<c;e+=a){let t=await s([e,e+a]);if(oe(t).trim()===``)break;await n(t),o?.(e+a)}}async function e_(e,t=[],n){let r=[];return await $g(e,t,e=>void r.push(oe(e)),{columns:n}),r.join(``)}a(),te(),De(),fu(),mu(),_u(),vu(),ku(),Tu(),Du(),Be(),Vu(),Bu(),Uu(),Pe(),Yu(),xe(),Ju(),$e(),Zu(),Ie(),ye(),rt(),rd(),Xe(),pe(),Xu(),Fe(),Oe(),Je(),Ce(),dd(),Ye(),Au(),Md(),gd(),yd(),Ad(),ml(),wr(),Vr(),yc(),Vd(),Rs(),Kd(),Gl(),nc(),Kn(),Ns(),K(),Vi(),ql(),us(),Po(),ll(),bs(),Ic(),Ai(),rr(),Id(),js(),Nl(),Kl(),Dc(),jo(),lo(),Hc(),Fd(),Pd(),sl(),Ha(),Mc(),nr(),Jr(),qi(),Tc(),al(),Tr(),Xn(),Mi(),Fc(),Ut(),Zd(),qn(),ou(),mi(),ci(),kn(),ho(),Qa(),ul(),Gc(),Oa(),Ir(),$r(),Gr(),Sa(),ma(),ur(),vi(),ea(),Zl(),no(),Cc(),Us(),cc(),Ko(),ja(),ds(),xc(),jc(),Vn(),ri(),dc(),Jo(),Dn(),$i(),_o(),bl(),pa(),Ps(),qd(),Jl(),Di(),Ba(),fn(),Kr(),ta(),Vl(),hs(),Yc(),Vc(),an(),vn(),ts(),Ua(),Zn(),or(),en(),ka(),cu(),gi(),yl(),Sl(),ni(),ss(),Ci(),Fa(),Un(),fa(),uo(),Rp(),am();function t_({onDone:e}){return(0,$.jsxs)(U,{title:`You've spent $5 on the API this session.`,onCancel:e,children:[(0,$.jsxs)(g,{flexDirection:`column`,children:[(0,$.jsx)(b,{children:`Learn more about how to monitor your spending:`}),(0,$.jsx)(y,{url:`https://code.workmate.com/docs/en/costs`})]}),(0,$.jsx)(Bf,{options:[{value:`ok`,label:`Got it, thanks!`}],onChange:e})]})}zf(),H(),am();function n_({idleMinutes:e,totalInputTokens:t,onDone:n}){return(0,$.jsxs)(U,{title:`You've been away ${r_(e)} and this conversation is ${ad(t)} tokens.`,onCancel:()=>n(`dismiss`),children:[(0,$.jsx)(g,{flexDirection:`column`,children:(0,$.jsx)(b,{children:`If this is a new task, clearing context will save usage and be faster.`})}),(0,$.jsx)(Bf,{options:[{value:`continue`,label:`Continue this conversation`},{value:`clear`,label:`Send message as a new conversation`},{value:`never`,label:`Don't ask me again`}],onChange:e=>n(e)})]})}function r_(e){if(e<1)return`< 1m`;if(e<60)return`${Math.floor(e)}m`;let t=Math.floor(e/60),n=Math.floor(e%60);return n===0?`${t}h`:`${t}h ${n}m`}tf();async function i_(e,t){let n=Mu().preferredNotifChannel;await tr(e),await o_(n,e,t),et.terminal}var a_=`Work Mate`;async function o_(e,t,n){let r=t.title||a_;try{switch(e){case`auto`:return s_(t,n);case`iterm2`:return n.notifyITerm2(t),`iterm2`;case`iterm2_with_bell`:return n.notifyITerm2(t),n.notifyBell(),`iterm2_with_bell`;case`kitty`:return n.notifyKitty({...t,title:r,id:c_()}),`kitty`;case`ghostty`:return n.notifyGhostty({...t,title:r}),`ghostty`;case`terminal_bell`:return n.notifyBell(),`terminal_bell`;case`notifications_disabled`:return`disabled`;default:return`none`}}catch{return`error`}}async function s_(e,t){let n=e.title||a_;switch(et.terminal){case`Apple_Terminal`:return await l_()?(t.notifyBell(),`terminal_bell`):`no_method_available`;case`iTerm.app`:return t.notifyITerm2(e),`iterm2`;case`kitty`:return t.notifyKitty({...e,title:n,id:c_()}),`kitty`;case`ghostty`:return t.notifyGhostty({...e,title:n}),`ghostty`;default:return`no_method_available`}}function c_(){return Math.floor(Math.random()*1e4)}async function l_(){try{if(et.terminal!==`Apple_Terminal`)return!1;let e=(await Wu(`osascript`,[`-e`,`tell application "Terminal" to name of current settings of front window`])).stdout.trim();if(!e)return!1;let t=await Wu(`defaults`,[`export`,`com.apple.Terminal`,`-`]);if(t.code!==0)return!1;let r=(await import(`./plist-Bzo2VMe9.js`).then(e=>n(e.default,1))).parse(t.stdout)?.[`Window Settings`]?.[e];return r?r.Bell===!1:!1}catch(e){return Hu(e),!1}}var u_=300,d_=240*1e3,f_=null,p_=null,m_=0,h_=!1;function g_(){m_++,m_===1&&(x_(),y_())}function __(){m_>0&&m_--,m_===0&&(b_(),S_())}function v_(){m_=0,b_(),S_()}function y_(){process.platform===`darwin`&&p_===null&&(p_=setInterval(()=>{m_>0&&(X(`Restarting caffeinate to maintain sleep prevention`),S_(),x_())},d_),p_.unref())}function b_(){p_!==null&&(clearInterval(p_),p_=null)}function x_(){if(process.platform===`darwin`&&f_===null){h_||(h_=!0,wu(async()=>{v_()}));try{f_=yh(`caffeinate`,[`-i`,`-t`,String(u_)],{stdio:`ignore`}),f_.unref();let e=f_;f_.on(`error`,t=>{X(`caffeinate spawn error: ${t.message}`),f_===e&&(f_=null)}),f_.on(`exit`,()=>{f_===e&&(f_=null)}),X(`Started caffeinate to prevent sleep`)}catch{f_=null}}}function S_(){if(f_!==null){let e=f_;f_=null;try{e.kill(`SIGKILL`),X(`Stopped caffeinate, allowing sleep`)}catch{}}}var C_=class{constructor(){s(this,`_status`,`idle`),s(this,`_generation`,0),s(this,`_changed`,lt()),s(this,`subscribe`,this._changed.subscribe),s(this,`getSnapshot`,()=>this._status!==`idle`)}reserve(){return this._status===`idle`?(this._status=`dispatching`,this._notify(),!0):!1}cancelReservation(){this._status===`dispatching`&&(this._status=`idle`,this._notify())}tryStart(){return this._status===`running`?null:(this._status=`running`,++this._generation,this._notify(),this._generation)}end(e){return this._generation!==e||this._status!==`running`?!1:(this._status=`idle`,this._notify(),!0)}forceEnd(){this._status!==`idle`&&(this._status=`idle`,++this._generation,this._notify())}get isActive(){return this._status!==`idle`}get generation(){return this._generation}_notify(){this._changed.emit()}};function w_(e,t=!1){let n=(0,Q.useRef)(0),r=(0,Q.useRef)(void 0),i=(0,Q.useRef)(void 0),a=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(t)return;let o=e[0]?.uuid,s=n.current,c=i.current===void 0,l=o!==void 0&&!c&&o===i.current&&s<=e.length,u=o!==void 0&&!c&&o===i.current&&s>e.length,d=l?s:0;if(d===e.length)return;let f=d===0?e:e.slice(d),p=l?r.current:void 0,m=++a.current;if(kr(f,{},p,e).then(e=>{m===a.current&&e&&!l&&(r.current=e)}),l||c||u){let t=er(f,e).findLast(eu);t&&(r.current=t.uuid)}n.current=e.length,i.current=o},[e,t])}_f(),op(),pp(),up(),dp(),pf(),H();var T_=6e3;function E_(){return Date.now()-Bt()}function D_(e){return E_()<e}function O_(e){return!D_(e)}function k_(e,t){let n=x();(0,Q.useEffect)(()=>{vt(!0)},[]),(0,Q.useEffect)(()=>{let r=!1,i=setInterval(()=>{O_(6e3)&&!r&&(r=!0,clearInterval(i),i_({message:e,notificationType:t},n))},T_);return()=>clearInterval(i)},[e,t,n])}Rd(),So(),Ta(),pn(),Ni(),Pn(),Ur(),hf(),xf(),Cf(),vf(),Vf(),Xf(),Ff(),Of(),jf(),Hp(),wm(),H(),Pc();var A_={topLeft:`┌`,topRight:`┐`,bottomLeft:`└`,bottomRight:`┘`,horizontal:`─`,vertical:`│`,teeLeft:`├`,teeRight:`┤`};function j_(e){return Pi().syntaxHighlightingDisabled?(0,$.jsx)(N_,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(N_,{...e,highlight:null}),children:(0,$.jsx)(M_,{...e})})}function M_(e){let t=(0,Q.use)(nn());return(0,$.jsx)(N_,{...e,highlight:t})}function N_({content:e,maxLines:t,minHeight:n,minWidth:r=40,maxWidth:i,highlight:a}){let{columns:o}=ie(),[s]=h(),c=i??o-4,l=t??20,u=(0,Q.useMemo)(()=>Xs(e,s,a),[e,s,a]).split(`
|
|
2
2
|
`),d=u.length>l,m=d?u.slice(0,l):u,_=Math.max(0,Math.min(n??0,l)-m.length-+!!d),v=_>0?[...m,...Array(_).fill(``)]:m,y=Math.max(r,...v.map(e=>p(e))),x=Math.min(y+4,c),S=x-4,C=`${A_.topLeft}${A_.horizontal.repeat(x-2)}${A_.topRight}`,w=`${A_.bottomLeft}${A_.horizontal.repeat(x-2)}${A_.bottomRight}`,T=d?(()=>{let e=u.length-l,t=`${A_.horizontal.repeat(3)} \u2702 ${A_.horizontal.repeat(3)} ${e} lines hidden `,n=p(t),r=Math.max(0,x-2-n);return`${A_.teeLeft}${t}${A_.horizontal.repeat(r)}${A_.teeRight}`})():null;return(0,$.jsxs)(g,{flexDirection:`column`,children:[(0,$.jsx)(b,{dimColor:!0,children:C}),v.map((e,t)=>{let n=p(e)>S?Sr(e,0,S):e,r=` `.repeat(Math.max(0,S-p(n)));return(0,$.jsxs)(g,{flexDirection:`row`,children:[(0,$.jsxs)(b,{dimColor:!0,children:[A_.vertical,` `]}),(0,$.jsx)(f,{children:n}),(0,$.jsxs)(b,{dimColor:!0,children:[r,` `,A_.vertical]})]},t)}),T&&(0,$.jsx)(b,{color:`warning`,children:T}),(0,$.jsx)(b,{dimColor:!0,children:w})]})}zs(),H(),rd();function P_({questions:e,currentQuestionIndex:t,answers:n,hideSubmitTab:r=!1}){let{columns:i}=ie(),a=(0,Q.useMemo)(()=>{let n=r?``:` ${l.tick} Submit `,a=p(`← `)+p(` →`)+p(n),o=i-a;if(o<=0)return e.map((e,n)=>{let r=e?.header||`Q${n+1}`;return n===t?r.slice(0,3):``});let s=e.map((e,t)=>e?.header||`Q${t+1}`);if(s.map(e=>4+p(e)).reduce((e,t)=>e+t,0)<=o)return s;let c=4+p(s[t]||``),u=Math.min(c,o/2),d=o-u,f=e.length-1,m=Math.max(6,Math.floor(d/Math.max(f,1)));return s.map((e,n)=>n===t?nd(e,u-2-2):nd(e,m-2-2))},[e,t,i,r]),o=e.length===1&&r;return(0,$.jsxs)(g,{flexDirection:`row`,marginBottom:1,children:[!o&&(0,$.jsx)(b,{color:t===0?`inactive`:void 0,children:`← `}),e.map((e,r)=>{let i=r===t,o=e?.question&&n[e.question]?l.checkboxOn:l.checkboxOff,s=a[r]||e?.header||`Q${r+1}`;return(0,$.jsx)(g,{children:i?(0,$.jsxs)(b,{backgroundColor:`permission`,color:`inverseText`,children:[` `,o,` `,s,` `]}):(0,$.jsxs)(b,{children:[` `,o,` `,s,` `]})},e?.question||`question-${r}`)}),!r&&(0,$.jsx)(g,{children:t===e.length?(0,$.jsxs)(b,{backgroundColor:`permission`,color:`inverseText`,children:[` `,l.tick,` Submit`,` `]}):(0,$.jsxs)(b,{children:[` `,l.tick,` Submit `]})},`submit`),!o&&(0,$.jsx)(b,{color:t===e.length?`inactive`:void 0,children:` →`})]})}c(),zs(),H(),Y();function F_({question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a=!1,minContentHeight:o,minContentWidth:s,onUpdateQuestionState:c,onAnswer:d,onTextInputFocus:f,onCancel:p,onTabPrev:h,onTabNext:_,onRespondToClaude:v,onFinishPlanInterview:y}){let x=J(e=>e.toolPermissionContext.mode)===`plan`,[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(0),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(0),j=zp(),M=j??null,N=e.question,P=i[N],F=e.options,[I,L]=(0,Q.useState)(0),R=(0,Q.useRef)(N);if(R.current!==N){R.current=N;let e=P?.selectedValue,t=e?F.findIndex(t=>t.label===e):-1;L(t>=0?t:0)}let ee=F[I],te=P?.selectedValue,ne=P?.textInputValue||``,z=(0,Q.useCallback)(e=>{let t=F[e];t&&(L(e),c(N,{selectedValue:t.label},!1),d(N,t.label))},[F,N,c,d]),B=(0,Q.useCallback)(e=>{if(D)return;let t;t=typeof e==`number`?e:e===`up`?I>0?I-1:I:I<F.length-1?I+1:I,t>=0&&t<F.length&&L(t)},[I,F.length,D]);E(`chat:externalEditor`,async()=>{let e=P?.textInputValue||``,t=await Bp(e);t.content!==null&&t.content!==e&&c(N,{textInputValue:t.content},!1)},{context:`Chat`,isActive:D&&!!j}),m({"tabs:previous":()=>h?.(),"tabs:next":()=>_?.()},{context:`Tabs`,isActive:!D&&!S});let re=(0,Q.useCallback)(()=>{O(!1),f(!1),te&&d(N,te)},[te,N,d,f]),V=(0,Q.useCallback)(()=>{C(!0)},[]),ae=(0,Q.useCallback)(()=>{C(!1)},[]),oe=(0,Q.useCallback)(e=>{if(S){if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),w===0?ae():T(0);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),x&&w===0&&T(1);return}if(e.key===`return`){e.preventDefault(),w===0?v():y();return}e.key===`escape`&&(e.preventDefault(),p());return}if(D){e.key===`escape`&&(e.preventDefault(),re());return}if(e.key===`up`||e.ctrl&&e.key===`p`)e.preventDefault(),I>0&&B(`up`);else if(e.key===`down`||e.ctrl&&e.key===`n`)e.preventDefault(),I===F.length-1?V():B(`down`);else if(e.key===`return`)e.preventDefault(),z(I);else if(e.key===`n`&&!e.ctrl&&!e.meta)e.preventDefault(),O(!0),f(!0);else if(e.key===`escape`)e.preventDefault(),p();else if(e.key.length===1&&e.key>=`1`&&e.key<=`9`){e.preventDefault();let t=parseInt(e.key,10)-1;t<F.length&&B(t)}},[S,w,x,D,I,F.length,ae,V,B,z,re,v,y,p,f]),H=ee?.preview||null,{columns:se}=ie(),ce=se-30-4,le=(0,Q.useMemo)(()=>o?Math.max(1,o-11):void 0,[o]);return(0,$.jsxs)(g,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:oe,children:[(0,$.jsx)(u,{color:`inactive`}),(0,$.jsxs)(g,{flexDirection:`column`,paddingTop:0,children:[(0,$.jsx)(P_,{questions:t,currentQuestionIndex:n,answers:r,hideSubmitTab:a}),(0,$.jsx)(Em,{title:e.question,color:`text`}),(0,$.jsxs)(g,{flexDirection:`column`,minHeight:o,children:[(0,$.jsxs)(g,{marginTop:1,flexDirection:`row`,gap:4,children:[(0,$.jsx)(g,{flexDirection:`column`,width:30,children:F.map((e,t)=>{let n=I===t,r=te===e.label;return(0,$.jsxs)(g,{flexDirection:`row`,children:[n?(0,$.jsx)(b,{color:`suggestion`,children:l.pointer}):(0,$.jsx)(b,{children:` `}),(0,$.jsxs)(b,{dimColor:!0,children:[` `,t+1,`.`]}),(0,$.jsxs)(b,{color:r?`success`:n?`suggestion`:void 0,bold:n,children:[` `,e.label]}),r&&(0,$.jsxs)(b,{color:`success`,children:[` `,l.tick]})]},e.label)})}),(0,$.jsxs)(g,{flexDirection:`column`,flexGrow:1,children:[(0,$.jsx)(j_,{content:H||`No preview available`,maxLines:le,minWidth:s,maxWidth:ce}),(0,$.jsxs)(g,{marginTop:1,flexDirection:`row`,gap:1,children:[(0,$.jsx)(b,{color:`suggestion`,children:`Notes:`}),D?(0,$.jsx)(If,{value:ne,placeholder:`Add notes on this design…`,onChange:e=>{c(N,{textInputValue:e},!1)},onSubmit:re,onExit:re,focus:!0,showCursor:!0,columns:60,cursorOffset:k,onChangeCursorOffset:A}):(0,$.jsx)(b,{dimColor:!0,italic:!0,children:ne||`press n to add notes`})]})]})]}),(0,$.jsxs)(g,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(u,{color:`inactive`}),(0,$.jsxs)(g,{flexDirection:`row`,gap:1,children:[S&&w===0?(0,$.jsx)(b,{color:`suggestion`,children:l.pointer}):(0,$.jsx)(b,{children:` `}),(0,$.jsx)(b,{color:S&&w===0?`suggestion`:void 0,children:`Chat about this`})]}),x&&(0,$.jsxs)(g,{flexDirection:`row`,gap:1,children:[S&&w===1?(0,$.jsx)(b,{color:`suggestion`,children:l.pointer}):(0,$.jsx)(b,{children:` `}),(0,$.jsx)(b,{color:S&&w===1?`suggestion`:void 0,children:`Skip interview and plan immediately`})]})]}),(0,$.jsx)(g,{marginTop:1,children:(0,$.jsxs)(b,{color:`inactive`,dimColor:!0,children:[`Enter to select · `,l.arrowUp,`/`,l.arrowDown,` to navigate · n to add notes`,t.length>1&&(0,$.jsx)($.Fragment,{children:` · Tab to switch questions`}),D&&M&&(0,$.jsxs)($.Fragment,{children:[` · ctrl+g to edit in `,M]}),` · Esc to cancel`]})})]})]})]})}c(),H(),Y(),Rp(),Hp(),am(),wm();function I_({question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a=!1,planFilePath:o,minContentHeight:s,minContentWidth:c,onUpdateQuestionState:d,onAnswer:f,onTextInputFocus:p,onCancel:m,onSubmit:h,onTabPrev:_,onTabNext:v,onRespondToClaude:y,onFinishPlanInterview:x,onImagePaste:S,pastedContents:C,onRemoveImage:w}){let T=J(e=>e.toolPermissionContext.mode)===`plan`,[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(0),[A,j]=(0,Q.useState)(!1),M=zp()??null,N=(0,Q.useCallback)(e=>{let t=e===`__other__`;j(t),p(t)},[p]),P=(0,Q.useCallback)(()=>{D(!0)},[]),F=(0,Q.useCallback)(()=>{D(!1)},[]),I=(0,Q.useCallback)(e=>{if(E){if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),O===0?F():k(0);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),T&&O===0&&k(1);return}if(e.key===`return`){e.preventDefault(),O===0?y():x();return}e.key===`escape`&&(e.preventDefault(),m())}},[E,O,T,F,y,x,m]),L=e.options.map(e=>({type:`text`,value:e.label,label:e.label,description:e.description})),R=e.question,ee=i[R],te=(0,Q.useCallback)(async(t,n)=>{let r=await Bp(t);r.content!==null&&r.content!==t&&(n(r.content),d(R,{textInputValue:r.content},e.multiSelect??!1))},[R,d,e.multiSelect]),ne={type:`input`,value:`__other__`,label:`Other`,placeholder:e.multiSelect?`Type something`:`Type something.`,initialValue:ee?.textInputValue??``,onChange:t=>{d(R,{textInputValue:t},e.multiSelect??!1)}},z=[...L,ne];return!e.multiSelect&&e.options.some(e=>e.preview)?(0,$.jsx)(F_,{question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a,minContentHeight:s,minContentWidth:c,onUpdateQuestionState:d,onAnswer:f,onTextInputFocus:p,onCancel:m,onTabPrev:_,onTabNext:v,onRespondToClaude:y,onFinishPlanInterview:x}):(0,$.jsxs)(g,{flexDirection:`column`,marginTop:0,tabIndex:0,autoFocus:!0,onKeyDown:I,children:[T&&o&&(0,$.jsxs)(g,{flexDirection:`column`,gap:0,children:[(0,$.jsx)(u,{color:`inactive`}),(0,$.jsxs)(b,{color:`inactive`,children:[`Planning: `,(0,$.jsx)(da,{filePath:o})]})]}),(0,$.jsx)(g,{marginTop:-1,children:(0,$.jsx)(u,{color:`inactive`})}),(0,$.jsxs)(g,{flexDirection:`column`,paddingTop:0,children:[(0,$.jsx)(P_,{questions:t,currentQuestionIndex:n,answers:r,hideSubmitTab:a}),(0,$.jsx)(Em,{title:e.question,color:`text`}),(0,$.jsxs)(g,{flexDirection:`column`,minHeight:s,children:[(0,$.jsx)(g,{marginTop:1,children:e.multiSelect?(0,$.jsx)(im,{options:z,defaultValue:i[e.question]?.selectedValue,onChange:e=>{d(R,{selectedValue:e},!0);let t=e.includes(`__other__`)?i[R]?.textInputValue:void 0,n=e.filter(e=>e!==`__other__`).concat(t?[t]:[]);f(R,n,void 0,!1)},onFocus:N,onCancel:m,submitButtonText:n===t.length-1?`Submit`:`Next`,onSubmit:h,onDownFromLastItem:P,isDisabled:E,onOpenEditor:te,onImagePaste:S,pastedContents:C,onRemoveImage:w},e.question):(0,$.jsx)(Bf,{options:z,defaultValue:i[e.question]?.selectedValue,onChange:e=>{d(R,{selectedValue:e},!1);let t=e===`__other__`?i[R]?.textInputValue:void 0;f(R,e,t)},onFocus:N,onCancel:m,onDownFromLastItem:P,isDisabled:E,layout:`compact-vertical`,onOpenEditor:te,onImagePaste:S,pastedContents:C,onRemoveImage:w},e.question)}),(0,$.jsxs)(g,{flexDirection:`column`,children:[(0,$.jsx)(u,{color:`inactive`}),(0,$.jsxs)(g,{flexDirection:`row`,gap:1,children:[E&&O===0?(0,$.jsx)(b,{color:`suggestion`,children:l.pointer}):(0,$.jsx)(b,{children:` `}),(0,$.jsxs)(b,{color:E&&O===0?`suggestion`:void 0,children:[z.length+1,`. Chat about this`]})]}),T&&(0,$.jsxs)(g,{flexDirection:`row`,gap:1,children:[E&&O===1?(0,$.jsx)(b,{color:`suggestion`,children:l.pointer}):(0,$.jsx)(b,{children:` `}),(0,$.jsxs)(b,{color:E&&O===1?`suggestion`:void 0,children:[z.length+2,`. Skip interview and plan immediately`]})]})]}),(0,$.jsx)(g,{marginTop:1,children:(0,$.jsxs)(b,{color:`inactive`,dimColor:!0,children:[`Enter to select ·`,` `,t.length===1?(0,$.jsxs)($.Fragment,{children:[l.arrowUp,`/`,l.arrowDown,` to navigate`]}):`Tab/Arrow keys to navigate`,A&&M&&(0,$.jsxs)($.Fragment,{children:[` · ctrl+g to edit in `,M]}),` · Esc to cancel`]})})]})]})]})}H(),bo(),Y();function L_(e,t){if(!e)return null;switch(e.type){case`rule`:return{reasonString:`Permission rule ${L.bold(me(e.rule.ruleValue))} requires confirmation for this ${t}.`,configString:e.rule.source===`policySettings`?void 0:`/permissions to update rules`};case`hook`:{let n=e.reason?`:\n${e.reason}`:`.`,r=e.hookSource?` ${L.dim(`[${e.hookSource}]`)}`:``;return{reasonString:`Hook ${L.bold(e.hookName)} requires confirmation for this ${t}${n}${r}`,configString:`/hooks to update`}}case`safetyCheck`:case`other`:return{reasonString:e.reason,configString:void 0};case`workingDir`:return{reasonString:e.reason,configString:`/permissions to update rules`};default:return null}}function R_({permissionResult:e,toolType:t}){let n=J(e=>e.toolPermissionContext.mode),r=L_(e?.decisionReason,t);if(!r)return null;let i=r.themeColor??(e?.decisionReason?.type===`hook`&&n===`auto`?`warning`:void 0);return(0,$.jsxs)(g,{marginBottom:1,flexDirection:`column`,children:[i?(0,$.jsx)(b,{color:i,children:r.reasonString}):(0,$.jsx)(b,{children:(0,$.jsx)(f,{children:r.reasonString})}),r.configString&&(0,$.jsx)(b,{dimColor:!0,children:r.configString})]})}c(),H(),am(),wm();function z_({questions:e,currentQuestionIndex:t,answers:n,allQuestionsAnswered:r,permissionResult:i,minContentHeight:a,onFinalResponse:o}){return(0,$.jsxs)(g,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(u,{color:`inactive`}),(0,$.jsxs)(g,{flexDirection:`column`,borderTop:!0,borderColor:`inactive`,paddingTop:0,children:[(0,$.jsx)(P_,{questions:e,currentQuestionIndex:t,answers:n}),(0,$.jsx)(Em,{title:`Review your answers`,color:`text`}),(0,$.jsxs)(g,{flexDirection:`column`,marginTop:1,minHeight:a,children:[!r&&(0,$.jsx)(g,{marginBottom:1,children:(0,$.jsxs)(b,{color:`warning`,children:[l.warning,` You have not answered all questions`]})}),Object.keys(n).length>0&&(0,$.jsx)(g,{flexDirection:`column`,marginBottom:1,children:e.filter(e=>e?.question&&n[e.question]).map(e=>{let t=n[e?.question];return(0,$.jsxs)(g,{flexDirection:`column`,marginLeft:1,children:[(0,$.jsxs)(b,{children:[l.bullet,` `,e?.question||`Question`]}),(0,$.jsx)(g,{marginLeft:2,children:(0,$.jsxs)(b,{color:`success`,children:[l.arrowRight,` `,t]})})]},e?.question||`answer`)})}),(0,$.jsx)(R_,{permissionResult:i,toolType:`tool`}),(0,$.jsx)(b,{color:`inactive`,children:`Ready to submit your answers?`}),(0,$.jsx)(g,{marginTop:1,children:(0,$.jsx)(Bf,{options:[{type:`text`,label:`Submit answers`,value:`submit`},{type:`text`,label:`Cancel`,value:`cancel`}],onChange:e=>o(e),onCancel:()=>o(`cancel`)})})]})]})]})}function B_(e,t){switch(t.type){case`next-question`:return{...e,currentQuestionIndex:e.currentQuestionIndex+1,isInTextInput:!1};case`prev-question`:return{...e,currentQuestionIndex:Math.max(0,e.currentQuestionIndex-1),isInTextInput:!1};case`update-question-state`:{let n=e.questionStates[t.questionText],r={selectedValue:t.updates.selectedValue??n?.selectedValue??(t.isMultiSelect?[]:void 0),textInputValue:t.updates.textInputValue??n?.textInputValue??``};return{...e,questionStates:{...e.questionStates,[t.questionText]:r}}}case`set-answer`:{let n={...e,answers:{...e.answers,[t.questionText]:t.answer}};return t.shouldAdvance?{...n,currentQuestionIndex:n.currentQuestionIndex+1,isInTextInput:!1}:n}case`set-text-input-mode`:return{...e,isInTextInput:t.isInInput}}}var V_={currentQuestionIndex:0,answers:{},questionStates:{},isInTextInput:!1};function H_(){let[e,t]=(0,Q.useReducer)(B_,V_),n=(0,Q.useCallback)(()=>{t({type:`next-question`})},[]),r=(0,Q.useCallback)(()=>{t({type:`prev-question`})},[]),i=(0,Q.useCallback)((e,n,r)=>{t({type:`update-question-state`,questionText:e,updates:n,isMultiSelect:r})},[]),a=(0,Q.useCallback)((e,n,r=!0)=>{t({type:`set-answer`,questionText:e,answer:n,shouldAdvance:r})},[]),o=(0,Q.useCallback)(e=>{t({type:`set-text-input-mode`,isInInput:e})},[]);return{currentQuestionIndex:e.currentQuestionIndex,answers:e.answers,questionStates:e.questionStates,isInTextInput:e.isInTextInput,nextQuestion:n,prevQuestion:r,updateQuestionState:i,setAnswer:a,setTextInputMode:o}}Ir(),zs(),H(),Ic(),Zu(),Y(),Gr(),Bu(),ds();var U_=12,W_=40,G_=15;function K_(e){return Pi().syntaxHighlightingDisabled?(0,$.jsx)(J_,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(J_,{...e,highlight:null}),children:(0,$.jsx)(q_,{...e})})}function q_(e){let t=(0,Q.use)(nn());return(0,$.jsx)(J_,{...e,highlight:t})}function J_({toolUseConfirm:e,onDone:t,onReject:n,highlight:r}){let i=(0,Q.useMemo)(()=>Dl.inputSchema.safeParse(e.input),[e.input]),a=i.success&&i.data.questions||[],{rows:o}=ie(),[s]=h(),{globalContentHeight:c,globalContentWidth:l}=(0,Q.useMemo)(()=>{let e=0,t=0,n=Math.max(U_,o-G_);for(let i of a)if(i.options.some(e=>e.preview)){let a=Math.max(1,n-11),o=0;for(let e of i.options)if(e.preview){let n=Xs(e.preview,s,r).split(`
|
|
3
3
|
`),i=n.length>a,c=i?a:n.length;o=Math.max(o,c+ +!!i+2);for(let e of n)t=Math.max(t,p(e))}let c=o+2,l=i.options.length+2;e=Math.max(e,Math.max(l,c)+7)}else e=Math.max(e,i.options.length+3+7);return{globalContentHeight:Math.min(Math.max(e,U_),n),globalContentWidth:Math.max(t,W_)}},[a,o,s,r]),u=i.success?i.data.metadata?.source:void 0,[d,f]=(0,Q.useState)({}),g=(0,Q.useRef)(0);function _(e,t,n,r,i,a){let o=g.current++,s={id:o,type:`image`,content:t,mediaType:n||`image/png`,filename:r||`Pasted image`,dimensions:i};pr(s),ga(s),f(t=>({...t,[e]:{...t[e]??{},[o]:s}}))}let v=(0,Q.useCallback)((e,t)=>{f(n=>{let r={...n[e]??{}};return delete r[t],{...n,[e]:r}})},[]),y=Object.values(d).flatMap(e=>Object.values(e)).filter(e=>e.type===`image`),b=J(e=>e.toolPermissionContext.mode)===`plan`,x=b?Xc():void 0,{currentQuestionIndex:S,answers:C,questionStates:w,isInTextInput:T,nextQuestion:E,prevQuestion:D,updateQuestionState:O,setAnswer:k,setTextInputMode:A}=H_(),j=S<(a?.length||0)?a?.[S]:null,M=S===(a?.length||0),N=a?.every(e=>e?.question&&!!C[e.question])??!1,P=a.length===1&&!a[0]?.multiSelect,F=(0,Q.useCallback)(()=>{u&&(a.length,b&&zl()),t(),n(),e.onReject()},[t,n,e,u,a.length,b]),I=(0,Q.useCallback)(async()=>{let n=`The user wants to clarify these questions.
|
|
4
4
|
This means they may have additional information, context or questions for you.
|
|
@@ -59,7 +59,7 @@ Parse the user's input into ISO 8601 format. Return ONLY the formatted string, o
|
|
|
59
59
|
`&&--a):o=n+1}else dS(n)&&e.offset<=t.offset&&(o=e.measuredText.nextOffset(o));return a=e.snapOutOfImageRef(a,`start`),o=e.snapOutOfImageRef(o,`end`),{from:a,to:o,linewise:s}}function jS(e,t,n){let r=Math.min(e.offset,t.offset),i=Math.max(e.offset,t.offset);return{from:r,to:e.measuredText.nextOffset(i)}}function MS(e,t,n,r,i=!1){let a=r.text.slice(t,n);if(i&&!a.endsWith(`
|
|
60
60
|
`)&&(a=`${a}\n`),r.setRegister(a,i),e===`yank`)r.setOffset(t);else if(e===`delete`){let e=r.text.slice(0,t)+r.text.slice(n);r.setText(e);let i=Math.max(0,e.length-(ed(e).length||1));r.setOffset(Math.min(t,i))}else if(e===`change`){let e=r.text.slice(0,t)+r.text.slice(n);r.setText(e),r.enterInsert(t)}}function NS(e,t,n){let r=t===1?n.cursor.startOfLastLine():n.cursor.goToLine(t);if(r.equals(n.cursor))return;let i=AS(n.cursor,r,`G`,e,t);MS(e,i.from,i.to,n,i.linewise),n.recordChange({type:`operator`,op:e,motion:`G`,count:t})}function PS(e,t,n){let r=t===1?n.cursor.startOfFirstLine():n.cursor.goToLine(t);if(r.equals(n.cursor))return;let i=AS(n.cursor,r,`gg`,e,t);MS(e,i.from,i.to,n,i.linewise),n.recordChange({type:`operator`,op:e,motion:`gg`,count:t})}var FS={d:`delete`,c:`change`,y:`yank`};function IS(e){return e in FS}var LS=new Set([`h`,`l`,`j`,`k`,`w`,`b`,`e`,`W`,`B`,`E`,`0`,`^`,`$`]),RS=new Set([`f`,`F`,`t`,`T`]),zS={i:`inner`,a:`around`};function BS(e){return e in zS}var VS=new Set([`w`,`W`,`"`,`'`,"`",`(`,`)`,`b`,`[`,`]`,`{`,`}`,`B`,`<`,`>`]),HS=1e4;function US(){return{mode:`INSERT`,insertedText:``}}function WS(){return{lastChange:null,lastFind:null,register:``,registerIsLinewise:!1}}function GS(e,t,n){switch(e.type){case`idle`:return JS(t,n);case`count`:return YS(e,t,n);case`operator`:return XS(e,t,n);case`operatorCount`:return ZS(e,t,n);case`operatorFind`:return QS(e,t,n);case`operatorTextObj`:return $S(e,t,n);case`find`:return eC(e,t,n);case`g`:return tC(e,t,n);case`operatorG`:return nC(e,t,n);case`replace`:return rC(e,t,n);case`indent`:return iC(e,t,n)}}function KS(e,t,n){return IS(e)?{next:{type:`operator`,op:FS[e],count:t}}:LS.has(e)?{execute:()=>{let r=lS(e,n.cursor,t);n.setOffset(r.offset)}}:RS.has(e)?{next:{type:`find`,find:e,count:t}}:e===`g`?{next:{type:`g`,count:t}}:e===`r`?{next:{type:`replace`,count:t}}:e===`>`||e===`<`?{next:{type:`indent`,dir:e,count:t}}:e===`~`?{execute:()=>wS(t,n)}:e===`x`?{execute:()=>SS(t,n)}:e===`J`?{execute:()=>TS(t,n)}:e===`p`||e===`P`?{execute:()=>ES(e===`p`,t,n)}:e===`D`?{execute:()=>vS(`delete`,`$`,1,n)}:e===`C`?{execute:()=>vS(`change`,`$`,1,n)}:e===`Y`?{execute:()=>xS(`yank`,t,n)}:e===`G`?{execute:()=>{t===1?n.setOffset(n.cursor.startOfLastLine().offset):n.setOffset(n.cursor.goToLine(t).offset)}}:e===`.`?{execute:()=>n.onDotRepeat?.()}:e===`;`||e===`,`?{execute:()=>aC(e===`,`,t,n)}:e===`u`?{execute:()=>n.onUndo?.()}:e===`i`?{execute:()=>n.enterInsert(n.cursor.offset)}:e===`I`?{execute:()=>n.enterInsert(n.cursor.firstNonBlankInLogicalLine().offset)}:e===`a`?{execute:()=>{let e=n.cursor.isAtEnd()?n.cursor.offset:n.cursor.right().offset;n.enterInsert(e)}}:e===`A`?{execute:()=>n.enterInsert(n.cursor.endOfLogicalLine().offset)}:e===`o`?{execute:()=>OS(`below`,n)}:e===`O`?{execute:()=>OS(`above`,n)}:null}function qS(e,t,n,r){return BS(n)?{next:{type:`operatorTextObj`,op:e,count:t,scope:zS[n]}}:RS.has(n)?{next:{type:`operatorFind`,op:e,count:t,find:n}}:LS.has(n)?{execute:()=>vS(e,n,t,r)}:n===`G`?{execute:()=>NS(e,t,r)}:n===`g`?{next:{type:`operatorG`,op:e,count:t}}:null}function JS(e,t){return/[1-9]/.test(e)?{next:{type:`count`,digits:e}}:e===`0`?{execute:()=>t.setOffset(t.cursor.startOfLogicalLine().offset)}:KS(e,1,t)||{}}function YS(e,t,n){if(/[0-9]/.test(t)){let n=e.digits+t;return{next:{type:`count`,digits:String(Math.min(parseInt(n,10),HS))}}}return KS(t,parseInt(e.digits,10),n)||{next:{type:`idle`}}}function XS(e,t,n){return t===e.op[0]?{execute:()=>xS(e.op,e.count,n)}:/[0-9]/.test(t)?{next:{type:`operatorCount`,op:e.op,count:e.count,digits:t}}:qS(e.op,e.count,t,n)||{next:{type:`idle`}}}function ZS(e,t,n){if(/[0-9]/.test(t)){let n=e.digits+t,r=Math.min(parseInt(n,10),HS);return{next:{...e,digits:String(r)}}}let r=parseInt(e.digits,10),i=e.count*r;return qS(e.op,i,t,n)||{next:{type:`idle`}}}function QS(e,t,n){return{execute:()=>yS(e.op,e.find,t,e.count,n)}}function $S(e,t,n){return VS.has(t)?{execute:()=>bS(e.op,e.scope,t,e.count,n)}:{next:{type:`idle`}}}function eC(e,t,n){return{execute:()=>{let r=n.cursor.findCharacter(t,e.find,e.count);r!==null&&(n.setOffset(r),n.setLastFind(e.find,t))}}}function tC(e,t,n){return t===`j`||t===`k`?{execute:()=>{let r=lS(`g${t}`,n.cursor,e.count);n.setOffset(r.offset)}}:t===`g`?e.count>1?{execute:()=>{let t=n.text.split(`
|
|
61
61
|
`),r=Math.min(e.count-1,t.length-1),i=0;for(let e=0;e<r;e++)i+=(t[e]?.length??0)+1;n.setOffset(i)}}:{execute:()=>n.setOffset(n.cursor.startOfFirstLine().offset)}:{next:{type:`idle`}}}function nC(e,t,n){return t===`j`||t===`k`?{execute:()=>vS(e.op,`g${t}`,e.count,n)}:t===`g`?{execute:()=>PS(e.op,e.count,n)}:{next:{type:`idle`}}}function rC(e,t,n){return t===``?{next:{type:`idle`}}:{execute:()=>CS(t,e.count,n)}}function iC(e,t,n){return t===e.dir?{execute:()=>DS(e.dir,e.count,n)}:{next:{type:`idle`}}}function aC(e,t,n){let r=n.getLastFind();if(!r)return;let i=r.type;e&&(i={f:`F`,F:`f`,t:`T`,T:`t`}[i]);let a=n.cursor.findCharacter(r.char,i,t);a!==null&&n.setOffset(a)}Ef(),$u();function oC(e){let t=Q.useRef(US()),[n,r]=(0,Q.useState)(`INSERT`),i=Q.useRef(WS()),a=Tf({...e,inputFilter:void 0}),{onModeChange:o,inputFilter:s}=e,c=(0,Q.useCallback)(e=>{e!==void 0&&a.setOffset(e),t.current={mode:`INSERT`,insertedText:``},r(`INSERT`),o?.(`INSERT`)},[a,o]),l=(0,Q.useCallback)(()=>{let n=t.current;n.mode===`INSERT`&&n.insertedText&&(i.current.lastChange={type:`insert`,text:n.insertedText});let s=a.offset;s>0&&e.value[s-1]!==`
|
|
62
|
-
`&&a.setOffset(s-1),t.current={mode:`NORMAL`,command:{type:`idle`}},r(`NORMAL`),o?.(`NORMAL`)},[o,a,e.value]);function u(t,n=!1){return{cursor:t,text:e.value,setText:t=>e.onChange(t),setOffset:e=>a.setOffset(e),enterInsert:e=>c(e),getRegister:()=>i.current.register,setRegister:(e,t)=>{i.current.register=e,i.current.registerIsLinewise=t},getLastFind:()=>i.current.lastFind,setLastFind:(e,t)=>{i.current.lastFind={type:e,char:t}},recordChange:n?()=>{}:e=>{i.current.lastChange=e}}}function d(){let t=i.current.lastChange;if(!t)return;let n=kf.fromText(e.value,e.columns,a.offset),r=u(n,!0);switch(t.type){case`insert`:if(t.text){let r=n.insert(t.text);e.onChange(r.text),a.setOffset(r.offset)}break;case`x`:SS(t.count,r);break;case`replace`:CS(t.char,t.count,r);break;case`toggleCase`:wS(t.count,r);break;case`indent`:DS(t.dir,t.count,r);break;case`join`:TS(t.count,r);break;case`openLine`:OS(t.direction,r);break;case`operator`:vS(t.op,t.motion,t.count,r);break;case`operatorFind`:yS(t.op,t.find,t.char,t.count,r);break;case`operatorTextObj`:bS(t.op,t.scope,t.objType,t.count,r);break}}function f(n,r){let i=t.current,o=s?s(n,r):n,c=i.mode===`INSERT`?o:n,f=kf.fromText(e.value,e.columns,a.offset);if(r.ctrl){a.onInput(c,r);return}if(r.escape&&i.mode===`INSERT`){l();return}if(r.escape&&i.mode===`NORMAL`){t.current={mode:`NORMAL`,command:{type:`idle`}};return}if(r.return){a.onInput(c,r);return}if(i.mode===`INSERT`){r.backspace||r.delete?i.insertedText.length>0&&(t.current={mode:`INSERT`,insertedText:i.insertedText.slice(0,-(ed(i.insertedText).length||1))}):t.current={mode:`INSERT`,insertedText:i.insertedText+c},a.onInput(c,r);return}if(i.mode!==`NORMAL`)return;if(i.command.type===`idle`&&(r.upArrow||r.downArrow||r.leftArrow||r.rightArrow)){a.onInput(c,r);return}let p={...u(f,!1),onUndo:e.onUndo,onDotRepeat:d},m=i.command.type===`idle`||i.command.type===`count`||i.command.type===`operator`||i.command.type===`operatorCount`,h=c;r.leftArrow?h=`h`:r.rightArrow?h=`l`:r.upArrow?h=`k`:r.downArrow?h=`j`:m&&r.backspace?h=`h`:m&&i.command.type!==`count`&&r.delete&&(h=`x`);let g=GS(i.command,h,p);g.execute&&g.execute(),t.current.mode===`NORMAL`&&(g.next?t.current={mode:`NORMAL`,command:g.next}:g.execute&&(t.current={mode:`NORMAL`,command:{type:`idle`}})),c===`?`&&i.mode===`NORMAL`&&i.command.type===`idle`&&e.onChange(`?`)}let p=(0,Q.useCallback)(e=>{e===`INSERT`?t.current={mode:`INSERT`,insertedText:``}:t.current={mode:`NORMAL`,command:{type:`idle`}},r(e),o?.(e)},[o]);return{...a,onInput:f,mode:n,setMode:p}}te(),H();function sC(e){let[t]=h(),n=D();bf(n,!!e.onImagePaste);let r=oC({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:n?L.inverse:e=>e,themeText:B(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,onModeChange:e.onModeChange,onUndo:e.onUndo}),{mode:i,setMode:a}=r;return Q.useEffect(()=>{e.initialMode&&e.initialMode!==i&&a(e.initialMode)},[e.initialMode,i,a]),(0,$.jsx)(g,{flexDirection:`column`,children:(0,$.jsx)(Pf,{inputState:r,terminalFocus:n,highlights:e.highlights,...e})})}Al(),jm(),a();function cC(e){if(!e)return null;let t=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;return t===0?null:Math.round(e.cache_read_input_tokens/t*100)}function lC(e){return`${e.input_tokens}|${e.cache_creation_input_tokens}|${e.cache_read_input_tokens}`}function uC(e){let t=gh(`sha256`).update(e).digest(`hex`).slice(0,16);return hh(r(),`cache-stats`,`${t}.json`)}var dC={version:1,signature:null,lastResetAt:null,lastHitRate:null};function fC(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.version===1&&(t.signature===null||typeof t.signature==`string`)&&(t.lastResetAt===null||typeof t.lastResetAt==`number`)&&(t.lastHitRate===null||typeof t.lastHitRate==`number`)}async function pC(e){try{let t=await Sh(e,`utf8`),n=JSON.parse(t);return fC(n)?n:{...dC}}catch{return{...dC}}}async function mC(e,t){await xh(mh(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;try{await wh(n,JSON.stringify(t),`utf8`),await Ch(n,e)}catch{}}var hC={signature:null,lastResetAt:null,lastHitRate:null},gC=null;async function _C(e){gC=e;let t=await pC(uC(e));hC={signature:t.signature,lastResetAt:t.lastResetAt,lastHitRate:t.lastHitRate}}function vC(e){let t=lC(e),n=cC(e);return t!==hC.signature&&(hC={signature:t,lastResetAt:Date.now(),lastHitRate:n},gC!==null&&mC(uC(gC),{version:1,signature:t,lastResetAt:hC.lastResetAt,lastHitRate:n})),{...hC}}function yC(){return{...hC}}H(),rd(),zs();function bC(e){let t=e-Date.now()/1e3;if(t<=0)return`now`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>=1?`${n}d${r}h`:r>=1?`${r}h${i}m`:`${i}m`}function xC(){return(0,$.jsx)(b,{dimColor:!0,children:` │ `})}function SC({modelName:e,contextUsedPct:t,usedTokens:n,contextWindowSize:r,totalCostUsd:i,rateLimits:a}){let{columns:o}=ie(),[s,c]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!((a.five_hour?.resets_at??0)||(a.seven_day?.resets_at??0)))return;let e=setInterval(()=>c(e=>e+1),6e4);return()=>clearInterval(e)},[a.five_hour?.resets_at,a.seven_day?.resets_at]);let l=e.split(` `),u=l.length>=2?`${l[0]} ${l[1]}`:e,d=o<60,f=a.five_hour!=null,p=a.seven_day!=null,m=f?Math.round(a.five_hour.utilization*100):0,h=p?Math.round(a.seven_day.utilization*100):0,_=`${ad(n)}/${ad(r)}`;return(0,$.jsxs)(g,{children:[(0,$.jsx)(b,{children:u}),(0,$.jsx)(xC,{}),(0,$.jsx)(b,{dimColor:!0,children:`Context `}),(0,$.jsxs)(b,{children:[t,`%`]}),!d&&(0,$.jsxs)(b,{dimColor:!0,children:[` (`,_,`)`]}),f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xC,{}),(0,$.jsx)(b,{dimColor:!0,children:`Session `}),(0,$.jsxs)(b,{children:[m,`%`]}),!d&&a.five_hour.resets_at>0&&(0,$.jsxs)(b,{dimColor:!0,children:[` `,bC(a.five_hour.resets_at)]})]}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xC,{}),(0,$.jsx)(b,{dimColor:!0,children:`Weekly `}),(0,$.jsxs)(b,{children:[h,`%`]}),!d&&a.seven_day.resets_at>0&&(0,$.jsxs)(b,{dimColor:!0,children:[` `,bC(a.seven_day.resets_at)]})]}),i>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xC,{}),(0,$.jsx)(b,{children:hl(i)})]})]})}var CC=Q.memo(SC);Zu(),Y(),ht(),tf(),Dc(),Gp(),Ir(),H(),fn(),Au(),gd(),fu(),Du(),ss(),ka(),yd(),Sl(),Tc(),rd();var wC=3600*1e3;function TC(e){return String(Math.floor(e)).padStart(2,`0`)}function EC(e){if(e<=0)return`exp`;let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${TC(t)}:${TC(n)}`}function DC({messages:e}){let[t,n]=(0,Q.useState)(()=>Date.now()),[r,i]=(0,Q.useState)(!0),a=Vo(e),o=(0,Q.useRef)(null);if(a!==null){let e=lC(a);e!==o.current&&(o.current=e,vC(a))}let{lastResetAt:s,lastHitRate:c}=yC(),l=s===null?null:t-s,u=l===null?null:wC-l,d=l===null?null:l/6e4,f=u!==null&&u<=0;(0,Q.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=d!==null&&d>=55&&!f;(0,Q.useEffect)(()=>{if(!p){i(!0);return}let e=setInterval(()=>i(e=>!e),500);return()=>clearInterval(e)},[p]);let m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(m.current=!0,_C(Et()))},[]);let h=a===null?c:cC(a);if(h===null&&s===null)return(0,$.jsx)(b,{dimColor:!0,children:` Cache --% --:--`});let g=u===null?`--:--`:EC(u),_=h===null?`--%`:`${h}%`,v;return v=f||d===null?`inactive`:d<20?`success`:d<40?`warning`:`error`,(0,$.jsxs)(b,{children:[(0,$.jsx)(b,{dimColor:!0,children:` Cache `}),(0,$.jsx)(b,{color:h!==null&&h>=50?`success`:`inactive`,children:_}),(0,$.jsxs)(b,{color:v,dimColor:p&&!r,children:[` `,g]})]})}function OC(){return null}function kC(e){return e?.statusLineEnabled===!1?!1:e?.statusLineEnabled===!0||!!e?.statusLine?.command}function AC(e,t,n,r,i,a,o){let s=xt(),c=Hl(),l=Cd({permissionMode:e,mainLoopModel:a,exceeds200kTokens:t}),u=n?.outputStyle||`default`,d=Vo(r),f=vd(l,Nt()),p=pd(d,f),m=lc(Et()),h=uu(),g={...h.five_hour&&{five_hour:{used_percentage:h.five_hour.utilization*100,resets_at:h.five_hour.resets_at}},...h.seven_day&&{seven_day:{used_percentage:h.seven_day.utilization*100,resets_at:h.seven_day.resets_at}}};return{...bi(),...m&&{session_name:m},model:{id:l,display_name:_d(l)},workspace:{current_dir:pu(),project_dir:Mt(),added_dirs:i},version:`0.0.31`,output_style:{name:u},cost:{total_cost_usd:Ot(),total_duration_ms:Tt(),total_api_duration_ms:G(),total_lines_added:zt(),total_lines_removed:Dt()},context_window:{total_input_tokens:Pt(),total_output_tokens:Lt(),context_window_size:f,current_usage:d,used_percentage:p.used,remaining_percentage:p.remaining},exceeds_200k_tokens:t,...(g.five_hour||g.seven_day)&&{rate_limits:g},...Om()&&{vim:{mode:o??`INSERT`}},...s&&{agent:{name:s}},...c&&{worktree:{name:c.worktreeName,path:c.worktreePath,branch:c.worktreeBranch,original_cwd:c.originalCwd,original_branch:c.originalBranch}}}}function jC(e){return du(e)?.uuid??null}function MC({messagesRef:e,lastAssistantMessageId:t,vimMode:n}){let r=(0,Q.useRef)(void 0),i=J(e=>e.toolPermissionContext.mode),a=J(e=>e.toolPermissionContext.additionalWorkingDirectories),o=J(e=>e.statusLineText),s=xa(),c=Pi(),{addNotification:l}=ef(),u=Wp(),d=(0,Q.useRef)(c);d.current=c;let p=(0,Q.useRef)(n);p.current=n;let m=(0,Q.useRef)(i);m.current=i;let h=(0,Q.useRef)(a);h.current=a;let _=(0,Q.useRef)(u);_.current=u;let v=(0,Q.useRef)({messageId:null,exceeds200kTokens:!1,permissionMode:i,vimMode:n,mainLoopModel:u}),y=(0,Q.useRef)(void 0),x=(0,Q.useRef)(!0),S=(0,Q.useCallback)(async()=>{r.current?.abort();let t=new AbortController;r.current=t;let n=e.current,i=x.current;if(x.current=!1,d.current?.statusLine?.command)try{let e=v.current.exceeds200kTokens,r=jC(n);r!==v.current.messageId&&(e=Ks(n),v.current.messageId=r,v.current.exceeds200kTokens=e);let a=await Oi(AC(m.current,e,d.current,n,Array.from(h.current.keys()),_.current,p.current),t.signal,void 0,i);t.signal.aborted||s(e=>e.statusLineText===a?e:{...e,statusLineText:a})}catch{}},[e,s]),C=(0,Q.useCallback)(()=>{y.current!==void 0&&clearTimeout(y.current),y.current=setTimeout((e,t)=>{e.current=void 0,t()},300,y,S)},[S]);(0,Q.useEffect)(()=>{(t!==v.current.messageId||i!==v.current.permissionMode||n!==v.current.vimMode||u!==v.current.mainLoopModel)&&(v.current.permissionMode=i,v.current.vimMode=n,v.current.mainLoopModel=u,C())},[t,i,n,u,C]);let w=c?.statusLine?.command,T=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{if(T.current){T.current=!1;return}x.current=!0,S()},[w,S]),(0,Q.useEffect)(()=>{let e=c?.statusLine;e&&(e.command.length,e.padding,c.disableAllHooks===!0&&X(`Status line is configured but disableAllHooks is true`,{level:`warn`}),Nu()||(l({key:`statusline-trust-blocked`,text:`statusline skipped · restart to fix`,color:`warning`,priority:`low`}),X(`Status line command skipped: workspace trust not accepted`,{level:`warn`})))},[]),(0,Q.useEffect)(()=>(S(),()=>{r.current?.abort(),y.current!==void 0&&clearTimeout(y.current)}),[]);let E=c?.statusLine?.padding??0,D=Cd({permissionMode:i,mainLoopModel:u,exceeds200kTokens:v.current.exceeds200kTokens}),O=vd(D,Nt()),k=Vo(e.current),A=k?k.input_tokens+k.cache_creation_input_tokens+k.cache_read_input_tokens:0,j=k?Math.round(pd(k,O).used??0):0,M=uu(),N={...M.five_hour&&{five_hour:{utilization:M.five_hour.utilization,resets_at:M.five_hour.resets_at}},...M.seven_day&&{seven_day:{utilization:M.seven_day.utilization,resets_at:M.seven_day.resets_at}}},P=c?.statusLineEnabled===!0,F=!!c?.statusLine?.command;return(0,$.jsxs)(g,{flexDirection:`column`,paddingX:E,children:[P&&(0,$.jsxs)(g,{gap:2,children:[(0,$.jsx)(CC,{modelName:_d(D),contextUsedPct:j,usedTokens:A,contextWindowSize:O,totalCostUsd:Ot(),rateLimits:N}),(0,$.jsx)(OC,{}),(0,$.jsx)(DC,{messages:e.current})]}),o?(0,$.jsx)(b,{dimColor:!0,wrap:`truncate`,children:(0,$.jsx)(f,{children:o})}):F&&hi()?(0,$.jsx)(b,{children:` `}):null]})}var NC=(0,Q.memo)(MC);c(),Y(),ls(),H();function PC({tasksSelected:e,onOpenDialog:t}){let n=J(e=>e.tasks),r=(0,Q.useMemo)(()=>Object.values(n??{}).filter(e=>nu(e)),[n]);return qm(n??{},!1)||r.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(FC,{selected:e,onClick:t,children:gs(r)}),ao(r)&&(0,$.jsxs)(b,{dimColor:!0,children:[` · `,l.arrowDown,` to view`]})]})}function FC({selected:e,onClick:t,children:n}){let[r,i]=(0,Q.useState)(!1),a=(0,$.jsx)(b,{color:`background`,inverse:e||r,children:n});return t?(0,$.jsx)(g,{onClick:t,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:a}):a}H(),jf();function IC({value:e,onChange:t,historyFailedMatch:n}){return(0,$.jsxs)(g,{gap:1,children:[(0,$.jsx)(b,{dimColor:!0,children:n?`no matching prompt:`:`search prompts:`}),(0,$.jsx)(If,{value:e,onChange:t,cursorOffset:e.length,onChangeCursorOffset:()=>{},columns:p(e)+1,focus:!0,showCursor:!0,multiline:!1,dimColor:!0})]})}Uu(),ku();var LC=5e3;function RC(e,t){if(e)return`draft`;switch(t){case`APPROVED`:return`approved`;case`CHANGES_REQUESTED`:return`changes_requested`;default:return`pending`}}async function zC(){if(!await Me())return null;let[e,t]=await Promise.all([Ae(),ve()]);if(e===t)return null;let{stdout:n,code:r}=await Wu(`gh`,[`pr`,`view`,`--json`,`number,url,reviewDecision,isDraft,headRefName,state`],{timeout:LC,preserveOutputOnError:!1});if(r!==0||!n.trim())return null;try{let e=xu(n);return e.headRefName===t||e.headRefName===`main`||e.headRefName===`master`||e.state===`MERGED`||e.state===`CLOSED`?null:{number:e.number,url:e.url,reviewState:RC(e.isDraft,e.reviewDecision)}}catch{return null}}ht();var BC=6e4,VC=4e3,HC=60*6e4,UC={number:null,url:null,reviewState:null,lastUpdated:0};function WC(e,t=!0){let[n,r]=(0,Q.useState)(UC),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!t||a.current)return;let e=!1,n=-1,s=Date.now();async function c(){if(e)return;let t=Bt();if(n!==t)n=t,s=Date.now();else if(Date.now()-s>=HC)return;let l=Date.now(),u=await zC();if(!e){if(o.current=l,r(e=>{let t=u?.number??null,n=u?.reviewState??null;return e.number===t&&e.reviewState===n?e:{number:t,url:u?.url??null,reviewState:n,lastUpdated:Date.now()}}),Date.now()-l>VC){a.current=!0;return}e||(i.current=setTimeout(c,BC))}}let l=Date.now()-o.current;return l>=BC?c():i.current=setTimeout(c,BC-l),()=>{e=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[e,t]),n}H(),jm(),bs(),Oe(),wl(),fe(),Xm(),Y(),zs(),rd(),$r(),yd(),Wd(),Au(),na();var GC=()=>null,KC=5e3,qC=1e3;function JC(){let[e,t]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{function e(){let e=process.memoryUsage().rss/(1024*1024),n=e>=1024?`error`:e>=512?`warning`:`normal`,r=sd(e*1024*1024);t(e=>e?.text===r?e:{text:r,level:n})}e();let n=setInterval(e,KC);return()=>clearInterval(n)},[]),e}function YC(){let e=(0,Q.useSyncExternalStore)(fc,Wn,GC),[t,n]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(e===null){n(null);return}function t(){let t=Math.max(0,Math.ceil((e-Date.now())/1e3));n(t)}t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t===null?null:(0,$.jsxs)(b,{dimColor:!0,children:[`waiting `,od(t*1e3,{mostSignificantOnly:!0})]})}function XC(){let[t,n]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=setInterval(()=>n(e=>e+1),qC);return()=>clearInterval(e)},[]);let r=(es(),e(dl)),i=r.getGoal();if(!i)return null;let a=r.getActiveElapsedMs(i),o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60,u;u=s>=1?`${s}h${c}min`:c>=1?`${c}min`:`${l}s`;let d;switch(i.status){case`active`:d=`ansi:green`;break;case`paused`:case`budget_limited`:case`usage_limited`:d=`ansi:yellow`;break;case`blocked`:d=`ansi:red`;break;case`complete`:d=`ansi:cyan`;break}return(0,$.jsxs)(b,{color:d,children:[`goal (`,u,`)`]})}function ZC({exitMessage:e,vimMode:t,mode:n,toolPermissionContext:r,suppressHint:i,isLoading:a,tasksSelected:o,tmuxSelected:s,isPasting:c,isSearching:l,historyQuery:u,setHistoryQuery:d,historyFailedMatch:f,onOpenTasksDialog:p}){if(e.show)return(0,$.jsxs)(b,{dimColor:!0,children:[`Press `,e.key,` again to exit`]},`exit-message`);if(c)return(0,$.jsx)(b,{dimColor:!0,children:`Pasting text…`},`pasting-message`);let m=Om()&&t===`INSERT`&&!l;return(0,$.jsxs)(g,{justifyContent:`flex-start`,gap:1,children:[l&&(0,$.jsx)(IC,{value:u,onChange:d,historyFailedMatch:f}),m?(0,$.jsx)(b,{dimColor:!0,children:`-- INSERT --`},`vim-insert`):null,(0,$.jsx)(QC,{mode:n,toolPermissionContext:r,showHint:!i&&!m,isLoading:a,tasksSelected:o,tmuxSelected:s,onOpenTasksDialog:p})]})}function QC({mode:t,toolPermissionContext:n,showHint:r,isLoading:i,tasksSelected:a,tmuxSelected:o,onOpenTasksDialog:s}){let{columns:c}=ie(),l=oo(`chat:cycleMode`,`Chat`,`shift+tab`),u=J(e=>e.tasks);oa();let f=WC(i,ew()),p=(0,Q.useSyncExternalStore)(fc,Wn,GC),m=I(),h=V().getState,_=p!==null,v=(0,Q.useMemo)(()=>ke(Object.values(u),e=>nu(e)),[u]),y=fp(),x=y!==void 0&&y.length>0,S=oo(`chat:cancel`,`Chat`,`esc`).toLowerCase(),w=oo(`app:toggleTodos`,`Global`,`ctrl+t`),T=oo(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),E=J(e=>e.notifications.current?.key===`kill-agents-confirm`),D=JC(),O=(0,Q.useMemo)(()=>_d(wd()),[J(e=>e.mainLoopModel)]),k=Ud();if(t===`bash`)return(0,$.jsx)(b,{color:`bashBorder`,children:`! for bash mode`});let A=n?.mode,j=!ge(A),M=v>0,N=+!!j+ +!!M,P=ew()&&f.number!==null&&f.reviewState!==null&&f.url!==null&&N<2&&(N===0||c>=80),F=N<2,L=A&&j?(0,$.jsxs)(b,{color:Ee(A),children:[ot(A),` `,he(A).toLowerCase(),` on`,F&&(0,$.jsxs)(b,{dimColor:!0,children:[` `,(0,$.jsx)(d,{shortcut:l,action:`cycle`,parens:!0})]})]},`mode`):null,R=[...P?[(0,$.jsx)(jl,{number:f.number,url:f.url,reviewState:f.reviewState},`pr-status`)]:[],...D?[(0,$.jsxs)(b,{dimColor:D.level===`normal`,color:D.level===`error`?`error`:D.level===`warning`?`warning`:void 0,children:[D.text,` · pid:`,process.pid,` · `,O,k?` · ${k}`:``]},`rss`)]:[],...(es(),e(dl)).getGoal()?[(0,$.jsx)(XC,{},`goal-elapsed`)]:[]],ee=Object.values(u).some(e=>e.type===`local_agent`&&e.status===`running`),te=r?$C(i,S,w,T,x,ee,E):[];_?R.push((0,$.jsx)(YC,{},`proactive`)):r&&R.push(...te);let ne=M&&!qm(u,!1)?(0,$.jsx)(PC,{tasksSelected:a,onOpenDialog:s}):null;R.length===0&&!ne&&!L&&r&&R.push((0,$.jsx)(b,{dimColor:!0,children:`? for shortcuts`},`shortcuts-hint`));let B=Mu().copyOnSelect??!0,re=m&&(!B||z());if(hi()&&re){let e=Ku()===`macos`,t=e&&(h()?.lastPressHadAlt??!1);R.push((0,$.jsx)(b,{dimColor:!0,children:(0,$.jsxs)(C,{children:[!B&&(0,$.jsx)(d,{shortcut:`ctrl+c`,action:`copy`}),z()&&(t?(0,$.jsx)(b,{children:`set macOptionClickForcesSelection in VS Code settings`}):(0,$.jsx)(d,{shortcut:e?`option+click`:`shift+click`,action:`native select`}))]})},`selection-copy`))}return ne&&r&&R.push((0,$.jsx)(b,{dimColor:!0,children:a?(0,$.jsx)(d,{shortcut:`Enter`,action:`view tasks`}):(0,$.jsx)(d,{shortcut:`↓`,action:`manage`})},`manage-tasks`)),R.length===0&&!ne&&!L?hi()?(0,$.jsx)(b,{children:` `}):null:(0,$.jsxs)(g,{height:1,overflow:`hidden`,children:[L&&(0,$.jsxs)(g,{flexShrink:0,children:[L,(ne||R.length>0)&&(0,$.jsx)(b,{dimColor:!0,children:` · `})]}),ne&&(0,$.jsxs)(g,{flexShrink:0,children:[ne,R.length>0&&(0,$.jsx)(b,{dimColor:!0,children:` · `})]}),R.length>0&&(0,$.jsx)(b,{wrap:`truncate`,children:(0,$.jsx)(C,{children:R})})]})}function $C(e,t,n,r,i,a,o){let s=i;return[...e?[(0,$.jsx)(b,{dimColor:!0,children:(0,$.jsx)(d,{shortcut:t,action:`interrupt`})},`esc`)]:[],...!e&&a&&!o?[(0,$.jsx)(b,{dimColor:!0,children:(0,$.jsx)(d,{shortcut:r,action:`stop agents`})},`kill-agents`)]:[],...s?[(0,$.jsx)(b,{dimColor:!0,children:(0,$.jsx)(d,{shortcut:n,action:`show tasks`})},`toggle-tasks`)]:[]]}function ew(){return Mu().prStatusFooterEnabled??!0}Ir(),zs(),H(),$r(),Pp(),Am();function tw({apiKeyStatus:e,debug:t,exitMessage:n,vimMode:r,mode:i,autoUpdaterResult:a,isAutoUpdating:o,verbose:s,onAutoUpdaterResult:c,onChangeIsUpdating:l,suggestions:u,selectedSuggestion:d,maxColumnWidth:f,toolPermissionContext:p,helpOpen:m,suppressHint:h,isLoading:_,tasksSelected:v,tmuxSelected:y,mcpClients:b,isPasting:x=!1,isInputWrapped:S=!1,messages:C,isSearching:w,historyQuery:T,setHistoryQuery:E,historyFailedMatch:D,onOpenTasksDialog:O}){let k=Pi(),{columns:A,rows:j}=ie(),M=(0,Q.useRef)(C);M.current=C;let N=(0,Q.useMemo)(()=>jC(C),[C]),P=A<80,F=hi(),I=F&&j<24,L=v,R=h||kC(k)||w;return Rm((0,Q.useMemo)(()=>F&&u.length?{suggestions:u,selectedSuggestion:d,maxColumnWidth:f}:null,[F,u,d,f])),u.length&&!F?(0,$.jsx)(g,{paddingX:2,paddingY:0,children:(0,$.jsx)(Fp,{suggestions:u,selectedSuggestion:d,maxColumnWidth:f})}):m?(0,$.jsx)(Mm,{dimColor:!0,fixedWidth:!0,paddingX:2}):(0,$.jsxs)(g,{flexDirection:P?`column`:`row`,justifyContent:P?`flex-start`:`space-between`,paddingX:2,gap:+!P,children:[(0,$.jsxs)(g,{flexDirection:`column`,flexShrink:+!P,children:[i===`prompt`&&!I&&!n.show&&!x&&kC(k)&&(0,$.jsx)(NC,{messagesRef:M,lastAssistantMessageId:N,vimMode:r}),(0,$.jsx)(rw,{}),(0,$.jsx)(ZC,{exitMessage:n,vimMode:r,mode:i,toolPermissionContext:p,suppressHint:R,isLoading:_,tasksSelected:L,tmuxSelected:y,isPasting:x,isSearching:w,historyQuery:T,setHistoryQuery:E,historyFailedMatch:D,onOpenTasksDialog:O})]}),(0,$.jsx)(g,{flexShrink:1,gap:1,children:F?null:(0,$.jsx)(bb,{apiKeyStatus:e,autoUpdaterResult:a,debug:t,isAutoUpdating:o,verbose:s,messages:C,onAutoUpdaterResult:c,onChangeIsUpdating:l,mcpClients:b,isInputWrapped:S,isNarrow:P})})]})}var nw=(0,Q.memo)(tw);function rw(){return null}c(),H();function iw({isLoading:e}){return(0,$.jsxs)(b,{dimColor:e,children:[l.pointer,`\xA0`]})}function aw({mode:e,isLoading:t}){return(0,$.jsx)(g,{alignItems:`flex-start`,alignSelf:`flex-start`,flexWrap:`nowrap`,justifyContent:`flex-start`,children:e===`bash`?(0,$.jsx)(b,{color:`bashBorder`,dimColor:t,children:`!\xA0`}):(0,$.jsx)(iw,{isLoading:t})})}H();var ow=Q.createContext(void 0),sw=2;function cw({isFirst:e,children:t}){let n=sw,r=Q.useMemo(()=>({isQueued:!0,isFirst:e,paddingWidth:n*2}),[e,n]);return(0,$.jsx)(ow.Provider,{value:r,children:(0,$.jsx)(g,{paddingX:n,children:t})})}H(),Y(),Jr(),ka(),ku(),ec();var lw=new Set;function uw(e){try{return xu(e)?.type===`idle_notification`}catch{return!1}}var dw=3;function fw(e){return`<${Pu}>
|
|
62
|
+
`&&a.setOffset(s-1),t.current={mode:`NORMAL`,command:{type:`idle`}},r(`NORMAL`),o?.(`NORMAL`)},[o,a,e.value]);function u(t,n=!1){return{cursor:t,text:e.value,setText:t=>e.onChange(t),setOffset:e=>a.setOffset(e),enterInsert:e=>c(e),getRegister:()=>i.current.register,setRegister:(e,t)=>{i.current.register=e,i.current.registerIsLinewise=t},getLastFind:()=>i.current.lastFind,setLastFind:(e,t)=>{i.current.lastFind={type:e,char:t}},recordChange:n?()=>{}:e=>{i.current.lastChange=e}}}function d(){let t=i.current.lastChange;if(!t)return;let n=kf.fromText(e.value,e.columns,a.offset),r=u(n,!0);switch(t.type){case`insert`:if(t.text){let r=n.insert(t.text);e.onChange(r.text),a.setOffset(r.offset)}break;case`x`:SS(t.count,r);break;case`replace`:CS(t.char,t.count,r);break;case`toggleCase`:wS(t.count,r);break;case`indent`:DS(t.dir,t.count,r);break;case`join`:TS(t.count,r);break;case`openLine`:OS(t.direction,r);break;case`operator`:vS(t.op,t.motion,t.count,r);break;case`operatorFind`:yS(t.op,t.find,t.char,t.count,r);break;case`operatorTextObj`:bS(t.op,t.scope,t.objType,t.count,r);break}}function f(n,r){let i=t.current,o=s?s(n,r):n,c=i.mode===`INSERT`?o:n,f=kf.fromText(e.value,e.columns,a.offset);if(r.ctrl){a.onInput(c,r);return}if(r.escape&&i.mode===`INSERT`){l();return}if(r.escape&&i.mode===`NORMAL`){t.current={mode:`NORMAL`,command:{type:`idle`}};return}if(r.return){a.onInput(c,r);return}if(i.mode===`INSERT`){r.backspace||r.delete?i.insertedText.length>0&&(t.current={mode:`INSERT`,insertedText:i.insertedText.slice(0,-(ed(i.insertedText).length||1))}):t.current={mode:`INSERT`,insertedText:i.insertedText+c},a.onInput(c,r);return}if(i.mode!==`NORMAL`)return;if(i.command.type===`idle`&&(r.upArrow||r.downArrow||r.leftArrow||r.rightArrow)){a.onInput(c,r);return}let p={...u(f,!1),onUndo:e.onUndo,onDotRepeat:d},m=i.command.type===`idle`||i.command.type===`count`||i.command.type===`operator`||i.command.type===`operatorCount`,h=c;r.leftArrow?h=`h`:r.rightArrow?h=`l`:r.upArrow?h=`k`:r.downArrow?h=`j`:m&&r.backspace?h=`h`:m&&i.command.type!==`count`&&r.delete&&(h=`x`);let g=GS(i.command,h,p);g.execute&&g.execute(),t.current.mode===`NORMAL`&&(g.next?t.current={mode:`NORMAL`,command:g.next}:g.execute&&(t.current={mode:`NORMAL`,command:{type:`idle`}})),c===`?`&&i.mode===`NORMAL`&&i.command.type===`idle`&&e.onChange(`?`)}let p=(0,Q.useCallback)(e=>{e===`INSERT`?t.current={mode:`INSERT`,insertedText:``}:t.current={mode:`NORMAL`,command:{type:`idle`}},r(e),o?.(e)},[o]);return{...a,onInput:f,mode:n,setMode:p}}te(),H();function sC(e){let[t]=h(),n=D();bf(n,!!e.onImagePaste);let r=oC({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:n?L.inverse:e=>e,themeText:B(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,onModeChange:e.onModeChange,onUndo:e.onUndo}),{mode:i,setMode:a}=r;return Q.useEffect(()=>{e.initialMode&&e.initialMode!==i&&a(e.initialMode)},[e.initialMode,i,a]),(0,$.jsx)(g,{flexDirection:`column`,children:(0,$.jsx)(Pf,{inputState:r,terminalFocus:n,highlights:e.highlights,...e})})}Al(),jm(),a();function cC(e){if(!e)return null;let t=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;return t===0?null:Math.round(e.cache_read_input_tokens/t*100)}function lC(e){return`${e.input_tokens}|${e.cache_creation_input_tokens}|${e.cache_read_input_tokens}`}function uC(e){let t=gh(`sha256`).update(e).digest(`hex`).slice(0,16);return hh(r(),`cache-stats`,`${t}.json`)}var dC={version:1,signature:null,lastResetAt:null,lastHitRate:null};function fC(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.version===1&&(t.signature===null||typeof t.signature==`string`)&&(t.lastResetAt===null||typeof t.lastResetAt==`number`)&&(t.lastHitRate===null||typeof t.lastHitRate==`number`)}async function pC(e){try{let t=await Sh(e,`utf8`),n=JSON.parse(t);return fC(n)?n:{...dC}}catch{return{...dC}}}async function mC(e,t){await xh(mh(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;try{await wh(n,JSON.stringify(t),`utf8`),await Ch(n,e)}catch{}}var hC={signature:null,lastResetAt:null,lastHitRate:null},gC=null;async function _C(e){gC=e;let t=await pC(uC(e));hC={signature:t.signature,lastResetAt:t.lastResetAt,lastHitRate:t.lastHitRate}}function vC(e){let t=lC(e),n=cC(e);return t!==hC.signature&&(hC={signature:t,lastResetAt:Date.now(),lastHitRate:n},gC!==null&&mC(uC(gC),{version:1,signature:t,lastResetAt:hC.lastResetAt,lastHitRate:n})),{...hC}}function yC(){return{...hC}}H(),rd(),zs();function bC(e){let t=e-Date.now()/1e3;if(t<=0)return`now`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>=1?`${n}d${r}h`:r>=1?`${r}h${i}m`:`${i}m`}function xC(){return(0,$.jsx)(b,{dimColor:!0,children:` │ `})}function SC({modelName:e,contextUsedPct:t,usedTokens:n,contextWindowSize:r,totalCostUsd:i,rateLimits:a}){let{columns:o}=ie(),[s,c]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!((a.five_hour?.resets_at??0)||(a.seven_day?.resets_at??0)))return;let e=setInterval(()=>c(e=>e+1),6e4);return()=>clearInterval(e)},[a.five_hour?.resets_at,a.seven_day?.resets_at]);let l=e.split(` `),u=l.length>=2?`${l[0]} ${l[1]}`:e,d=o<60,f=a.five_hour!=null,p=a.seven_day!=null,m=f?Math.round(a.five_hour.utilization*100):0,h=p?Math.round(a.seven_day.utilization*100):0,_=`${ad(n)}/${ad(r)}`;return(0,$.jsxs)(g,{children:[(0,$.jsx)(b,{children:u}),(0,$.jsx)(xC,{}),(0,$.jsx)(b,{dimColor:!0,children:`Context `}),(0,$.jsxs)(b,{children:[t,`%`]}),!d&&(0,$.jsxs)(b,{dimColor:!0,children:[` (`,_,`)`]}),f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xC,{}),(0,$.jsx)(b,{dimColor:!0,children:`Session `}),(0,$.jsxs)(b,{children:[m,`%`]}),!d&&a.five_hour.resets_at>0&&(0,$.jsxs)(b,{dimColor:!0,children:[` `,bC(a.five_hour.resets_at)]})]}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xC,{}),(0,$.jsx)(b,{dimColor:!0,children:`Weekly `}),(0,$.jsxs)(b,{children:[h,`%`]}),!d&&a.seven_day.resets_at>0&&(0,$.jsxs)(b,{dimColor:!0,children:[` `,bC(a.seven_day.resets_at)]})]}),i>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xC,{}),(0,$.jsx)(b,{children:hl(i)})]})]})}var CC=Q.memo(SC);Zu(),Y(),ht(),tf(),Dc(),Gp(),Ir(),H(),fn(),Au(),gd(),fu(),Du(),ss(),ka(),yd(),Sl(),Tc(),rd();var wC=3600*1e3;function TC(e){return String(Math.floor(e)).padStart(2,`0`)}function EC(e){if(e<=0)return`exp`;let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${TC(t)}:${TC(n)}`}function DC({messages:e}){let[t,n]=(0,Q.useState)(()=>Date.now()),[r,i]=(0,Q.useState)(!0),a=Vo(e),o=(0,Q.useRef)(null);if(a!==null){let e=lC(a);e!==o.current&&(o.current=e,vC(a))}let{lastResetAt:s,lastHitRate:c}=yC(),l=s===null?null:t-s,u=l===null?null:wC-l,d=l===null?null:l/6e4,f=u!==null&&u<=0;(0,Q.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=d!==null&&d>=55&&!f;(0,Q.useEffect)(()=>{if(!p){i(!0);return}let e=setInterval(()=>i(e=>!e),500);return()=>clearInterval(e)},[p]);let m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(m.current=!0,_C(Et()))},[]);let h=a===null?c:cC(a);if(h===null&&s===null)return(0,$.jsx)(b,{dimColor:!0,children:` Cache --% --:--`});let g=u===null?`--:--`:EC(u),_=h===null?`--%`:`${h}%`,v;return v=f||d===null?`inactive`:d<20?`success`:d<40?`warning`:`error`,(0,$.jsxs)(b,{children:[(0,$.jsx)(b,{dimColor:!0,children:` Cache `}),(0,$.jsx)(b,{color:h!==null&&h>=50?`success`:`inactive`,children:_}),(0,$.jsxs)(b,{color:v,dimColor:p&&!r,children:[` `,g]})]})}function OC(){return null}function kC(e){return e?.statusLineEnabled===!1?!1:e?.statusLineEnabled===!0||!!e?.statusLine?.command}function AC(e,t,n,r,i,a,o){let s=xt(),c=Hl(),l=Cd({permissionMode:e,mainLoopModel:a,exceeds200kTokens:t}),u=n?.outputStyle||`default`,d=Vo(r),f=vd(l,Nt()),p=pd(d,f),m=lc(Et()),h=uu(),g={...h.five_hour&&{five_hour:{used_percentage:h.five_hour.utilization*100,resets_at:h.five_hour.resets_at}},...h.seven_day&&{seven_day:{used_percentage:h.seven_day.utilization*100,resets_at:h.seven_day.resets_at}}};return{...bi(),...m&&{session_name:m},model:{id:l,display_name:_d(l)},workspace:{current_dir:pu(),project_dir:Mt(),added_dirs:i},version:`0.0.32`,output_style:{name:u},cost:{total_cost_usd:Ot(),total_duration_ms:Tt(),total_api_duration_ms:G(),total_lines_added:zt(),total_lines_removed:Dt()},context_window:{total_input_tokens:Pt(),total_output_tokens:Lt(),context_window_size:f,current_usage:d,used_percentage:p.used,remaining_percentage:p.remaining},exceeds_200k_tokens:t,...(g.five_hour||g.seven_day)&&{rate_limits:g},...Om()&&{vim:{mode:o??`INSERT`}},...s&&{agent:{name:s}},...c&&{worktree:{name:c.worktreeName,path:c.worktreePath,branch:c.worktreeBranch,original_cwd:c.originalCwd,original_branch:c.originalBranch}}}}function jC(e){return du(e)?.uuid??null}function MC({messagesRef:e,lastAssistantMessageId:t,vimMode:n}){let r=(0,Q.useRef)(void 0),i=J(e=>e.toolPermissionContext.mode),a=J(e=>e.toolPermissionContext.additionalWorkingDirectories),o=J(e=>e.statusLineText),s=xa(),c=Pi(),{addNotification:l}=ef(),u=Wp(),d=(0,Q.useRef)(c);d.current=c;let p=(0,Q.useRef)(n);p.current=n;let m=(0,Q.useRef)(i);m.current=i;let h=(0,Q.useRef)(a);h.current=a;let _=(0,Q.useRef)(u);_.current=u;let v=(0,Q.useRef)({messageId:null,exceeds200kTokens:!1,permissionMode:i,vimMode:n,mainLoopModel:u}),y=(0,Q.useRef)(void 0),x=(0,Q.useRef)(!0),S=(0,Q.useCallback)(async()=>{r.current?.abort();let t=new AbortController;r.current=t;let n=e.current,i=x.current;if(x.current=!1,d.current?.statusLine?.command)try{let e=v.current.exceeds200kTokens,r=jC(n);r!==v.current.messageId&&(e=Ks(n),v.current.messageId=r,v.current.exceeds200kTokens=e);let a=await Oi(AC(m.current,e,d.current,n,Array.from(h.current.keys()),_.current,p.current),t.signal,void 0,i);t.signal.aborted||s(e=>e.statusLineText===a?e:{...e,statusLineText:a})}catch{}},[e,s]),C=(0,Q.useCallback)(()=>{y.current!==void 0&&clearTimeout(y.current),y.current=setTimeout((e,t)=>{e.current=void 0,t()},300,y,S)},[S]);(0,Q.useEffect)(()=>{(t!==v.current.messageId||i!==v.current.permissionMode||n!==v.current.vimMode||u!==v.current.mainLoopModel)&&(v.current.permissionMode=i,v.current.vimMode=n,v.current.mainLoopModel=u,C())},[t,i,n,u,C]);let w=c?.statusLine?.command,T=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{if(T.current){T.current=!1;return}x.current=!0,S()},[w,S]),(0,Q.useEffect)(()=>{let e=c?.statusLine;e&&(e.command.length,e.padding,c.disableAllHooks===!0&&X(`Status line is configured but disableAllHooks is true`,{level:`warn`}),Nu()||(l({key:`statusline-trust-blocked`,text:`statusline skipped · restart to fix`,color:`warning`,priority:`low`}),X(`Status line command skipped: workspace trust not accepted`,{level:`warn`})))},[]),(0,Q.useEffect)(()=>(S(),()=>{r.current?.abort(),y.current!==void 0&&clearTimeout(y.current)}),[]);let E=c?.statusLine?.padding??0,D=Cd({permissionMode:i,mainLoopModel:u,exceeds200kTokens:v.current.exceeds200kTokens}),O=vd(D,Nt()),k=Vo(e.current),A=k?k.input_tokens+k.cache_creation_input_tokens+k.cache_read_input_tokens:0,j=k?Math.round(pd(k,O).used??0):0,M=uu(),N={...M.five_hour&&{five_hour:{utilization:M.five_hour.utilization,resets_at:M.five_hour.resets_at}},...M.seven_day&&{seven_day:{utilization:M.seven_day.utilization,resets_at:M.seven_day.resets_at}}},P=c?.statusLineEnabled===!0,F=!!c?.statusLine?.command;return(0,$.jsxs)(g,{flexDirection:`column`,paddingX:E,children:[P&&(0,$.jsxs)(g,{gap:2,children:[(0,$.jsx)(CC,{modelName:_d(D),contextUsedPct:j,usedTokens:A,contextWindowSize:O,totalCostUsd:Ot(),rateLimits:N}),(0,$.jsx)(OC,{}),(0,$.jsx)(DC,{messages:e.current})]}),o?(0,$.jsx)(b,{dimColor:!0,wrap:`truncate`,children:(0,$.jsx)(f,{children:o})}):F&&hi()?(0,$.jsx)(b,{children:` `}):null]})}var NC=(0,Q.memo)(MC);c(),Y(),ls(),H();function PC({tasksSelected:e,onOpenDialog:t}){let n=J(e=>e.tasks),r=(0,Q.useMemo)(()=>Object.values(n??{}).filter(e=>nu(e)),[n]);return qm(n??{},!1)||r.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(FC,{selected:e,onClick:t,children:gs(r)}),ao(r)&&(0,$.jsxs)(b,{dimColor:!0,children:[` · `,l.arrowDown,` to view`]})]})}function FC({selected:e,onClick:t,children:n}){let[r,i]=(0,Q.useState)(!1),a=(0,$.jsx)(b,{color:`background`,inverse:e||r,children:n});return t?(0,$.jsx)(g,{onClick:t,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:a}):a}H(),jf();function IC({value:e,onChange:t,historyFailedMatch:n}){return(0,$.jsxs)(g,{gap:1,children:[(0,$.jsx)(b,{dimColor:!0,children:n?`no matching prompt:`:`search prompts:`}),(0,$.jsx)(If,{value:e,onChange:t,cursorOffset:e.length,onChangeCursorOffset:()=>{},columns:p(e)+1,focus:!0,showCursor:!0,multiline:!1,dimColor:!0})]})}Uu(),ku();var LC=5e3;function RC(e,t){if(e)return`draft`;switch(t){case`APPROVED`:return`approved`;case`CHANGES_REQUESTED`:return`changes_requested`;default:return`pending`}}async function zC(){if(!await Me())return null;let[e,t]=await Promise.all([Ae(),ve()]);if(e===t)return null;let{stdout:n,code:r}=await Wu(`gh`,[`pr`,`view`,`--json`,`number,url,reviewDecision,isDraft,headRefName,state`],{timeout:LC,preserveOutputOnError:!1});if(r!==0||!n.trim())return null;try{let e=xu(n);return e.headRefName===t||e.headRefName===`main`||e.headRefName===`master`||e.state===`MERGED`||e.state===`CLOSED`?null:{number:e.number,url:e.url,reviewState:RC(e.isDraft,e.reviewDecision)}}catch{return null}}ht();var BC=6e4,VC=4e3,HC=60*6e4,UC={number:null,url:null,reviewState:null,lastUpdated:0};function WC(e,t=!0){let[n,r]=(0,Q.useState)(UC),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!t||a.current)return;let e=!1,n=-1,s=Date.now();async function c(){if(e)return;let t=Bt();if(n!==t)n=t,s=Date.now();else if(Date.now()-s>=HC)return;let l=Date.now(),u=await zC();if(!e){if(o.current=l,r(e=>{let t=u?.number??null,n=u?.reviewState??null;return e.number===t&&e.reviewState===n?e:{number:t,url:u?.url??null,reviewState:n,lastUpdated:Date.now()}}),Date.now()-l>VC){a.current=!0;return}e||(i.current=setTimeout(c,BC))}}let l=Date.now()-o.current;return l>=BC?c():i.current=setTimeout(c,BC-l),()=>{e=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[e,t]),n}H(),jm(),bs(),Oe(),wl(),fe(),Xm(),Y(),zs(),rd(),$r(),yd(),Wd(),Au(),na();var GC=()=>null,KC=5e3,qC=1e3;function JC(){let[e,t]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{function e(){let e=process.memoryUsage().rss/(1024*1024),n=e>=1024?`error`:e>=512?`warning`:`normal`,r=sd(e*1024*1024);t(e=>e?.text===r?e:{text:r,level:n})}e();let n=setInterval(e,KC);return()=>clearInterval(n)},[]),e}function YC(){let e=(0,Q.useSyncExternalStore)(fc,Wn,GC),[t,n]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(e===null){n(null);return}function t(){let t=Math.max(0,Math.ceil((e-Date.now())/1e3));n(t)}t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t===null?null:(0,$.jsxs)(b,{dimColor:!0,children:[`waiting `,od(t*1e3,{mostSignificantOnly:!0})]})}function XC(){let[t,n]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=setInterval(()=>n(e=>e+1),qC);return()=>clearInterval(e)},[]);let r=(es(),e(dl)),i=r.getGoal();if(!i)return null;let a=r.getActiveElapsedMs(i),o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60,u;u=s>=1?`${s}h${c}min`:c>=1?`${c}min`:`${l}s`;let d;switch(i.status){case`active`:d=`ansi:green`;break;case`paused`:case`budget_limited`:case`usage_limited`:d=`ansi:yellow`;break;case`blocked`:d=`ansi:red`;break;case`complete`:d=`ansi:cyan`;break}return(0,$.jsxs)(b,{color:d,children:[`goal (`,u,`)`]})}function ZC({exitMessage:e,vimMode:t,mode:n,toolPermissionContext:r,suppressHint:i,isLoading:a,tasksSelected:o,tmuxSelected:s,isPasting:c,isSearching:l,historyQuery:u,setHistoryQuery:d,historyFailedMatch:f,onOpenTasksDialog:p}){if(e.show)return(0,$.jsxs)(b,{dimColor:!0,children:[`Press `,e.key,` again to exit`]},`exit-message`);if(c)return(0,$.jsx)(b,{dimColor:!0,children:`Pasting text…`},`pasting-message`);let m=Om()&&t===`INSERT`&&!l;return(0,$.jsxs)(g,{justifyContent:`flex-start`,gap:1,children:[l&&(0,$.jsx)(IC,{value:u,onChange:d,historyFailedMatch:f}),m?(0,$.jsx)(b,{dimColor:!0,children:`-- INSERT --`},`vim-insert`):null,(0,$.jsx)(QC,{mode:n,toolPermissionContext:r,showHint:!i&&!m,isLoading:a,tasksSelected:o,tmuxSelected:s,onOpenTasksDialog:p})]})}function QC({mode:t,toolPermissionContext:n,showHint:r,isLoading:i,tasksSelected:a,tmuxSelected:o,onOpenTasksDialog:s}){let{columns:c}=ie(),l=oo(`chat:cycleMode`,`Chat`,`shift+tab`),u=J(e=>e.tasks);oa();let f=WC(i,ew()),p=(0,Q.useSyncExternalStore)(fc,Wn,GC),m=I(),h=V().getState,_=p!==null,v=(0,Q.useMemo)(()=>ke(Object.values(u),e=>nu(e)),[u]),y=fp(),x=y!==void 0&&y.length>0,S=oo(`chat:cancel`,`Chat`,`esc`).toLowerCase(),w=oo(`app:toggleTodos`,`Global`,`ctrl+t`),T=oo(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),E=J(e=>e.notifications.current?.key===`kill-agents-confirm`),D=JC(),O=(0,Q.useMemo)(()=>_d(wd()),[J(e=>e.mainLoopModel)]),k=Ud();if(t===`bash`)return(0,$.jsx)(b,{color:`bashBorder`,children:`! for bash mode`});let A=n?.mode,j=!ge(A),M=v>0,N=+!!j+ +!!M,P=ew()&&f.number!==null&&f.reviewState!==null&&f.url!==null&&N<2&&(N===0||c>=80),F=N<2,L=A&&j?(0,$.jsxs)(b,{color:Ee(A),children:[ot(A),` `,he(A).toLowerCase(),` on`,F&&(0,$.jsxs)(b,{dimColor:!0,children:[` `,(0,$.jsx)(d,{shortcut:l,action:`cycle`,parens:!0})]})]},`mode`):null,R=[...P?[(0,$.jsx)(jl,{number:f.number,url:f.url,reviewState:f.reviewState},`pr-status`)]:[],...D?[(0,$.jsxs)(b,{dimColor:D.level===`normal`,color:D.level===`error`?`error`:D.level===`warning`?`warning`:void 0,children:[D.text,` · pid:`,process.pid,` · `,O,k?` · ${k}`:``]},`rss`)]:[],...(es(),e(dl)).getGoal()?[(0,$.jsx)(XC,{},`goal-elapsed`)]:[]],ee=Object.values(u).some(e=>e.type===`local_agent`&&e.status===`running`),te=r?$C(i,S,w,T,x,ee,E):[];_?R.push((0,$.jsx)(YC,{},`proactive`)):r&&R.push(...te);let ne=M&&!qm(u,!1)?(0,$.jsx)(PC,{tasksSelected:a,onOpenDialog:s}):null;R.length===0&&!ne&&!L&&r&&R.push((0,$.jsx)(b,{dimColor:!0,children:`? for shortcuts`},`shortcuts-hint`));let B=Mu().copyOnSelect??!0,re=m&&(!B||z());if(hi()&&re){let e=Ku()===`macos`,t=e&&(h()?.lastPressHadAlt??!1);R.push((0,$.jsx)(b,{dimColor:!0,children:(0,$.jsxs)(C,{children:[!B&&(0,$.jsx)(d,{shortcut:`ctrl+c`,action:`copy`}),z()&&(t?(0,$.jsx)(b,{children:`set macOptionClickForcesSelection in VS Code settings`}):(0,$.jsx)(d,{shortcut:e?`option+click`:`shift+click`,action:`native select`}))]})},`selection-copy`))}return ne&&r&&R.push((0,$.jsx)(b,{dimColor:!0,children:a?(0,$.jsx)(d,{shortcut:`Enter`,action:`view tasks`}):(0,$.jsx)(d,{shortcut:`↓`,action:`manage`})},`manage-tasks`)),R.length===0&&!ne&&!L?hi()?(0,$.jsx)(b,{children:` `}):null:(0,$.jsxs)(g,{height:1,overflow:`hidden`,children:[L&&(0,$.jsxs)(g,{flexShrink:0,children:[L,(ne||R.length>0)&&(0,$.jsx)(b,{dimColor:!0,children:` · `})]}),ne&&(0,$.jsxs)(g,{flexShrink:0,children:[ne,R.length>0&&(0,$.jsx)(b,{dimColor:!0,children:` · `})]}),R.length>0&&(0,$.jsx)(b,{wrap:`truncate`,children:(0,$.jsx)(C,{children:R})})]})}function $C(e,t,n,r,i,a,o){let s=i;return[...e?[(0,$.jsx)(b,{dimColor:!0,children:(0,$.jsx)(d,{shortcut:t,action:`interrupt`})},`esc`)]:[],...!e&&a&&!o?[(0,$.jsx)(b,{dimColor:!0,children:(0,$.jsx)(d,{shortcut:r,action:`stop agents`})},`kill-agents`)]:[],...s?[(0,$.jsx)(b,{dimColor:!0,children:(0,$.jsx)(d,{shortcut:n,action:`show tasks`})},`toggle-tasks`)]:[]]}function ew(){return Mu().prStatusFooterEnabled??!0}Ir(),zs(),H(),$r(),Pp(),Am();function tw({apiKeyStatus:e,debug:t,exitMessage:n,vimMode:r,mode:i,autoUpdaterResult:a,isAutoUpdating:o,verbose:s,onAutoUpdaterResult:c,onChangeIsUpdating:l,suggestions:u,selectedSuggestion:d,maxColumnWidth:f,toolPermissionContext:p,helpOpen:m,suppressHint:h,isLoading:_,tasksSelected:v,tmuxSelected:y,mcpClients:b,isPasting:x=!1,isInputWrapped:S=!1,messages:C,isSearching:w,historyQuery:T,setHistoryQuery:E,historyFailedMatch:D,onOpenTasksDialog:O}){let k=Pi(),{columns:A,rows:j}=ie(),M=(0,Q.useRef)(C);M.current=C;let N=(0,Q.useMemo)(()=>jC(C),[C]),P=A<80,F=hi(),I=F&&j<24,L=v,R=h||kC(k)||w;return Rm((0,Q.useMemo)(()=>F&&u.length?{suggestions:u,selectedSuggestion:d,maxColumnWidth:f}:null,[F,u,d,f])),u.length&&!F?(0,$.jsx)(g,{paddingX:2,paddingY:0,children:(0,$.jsx)(Fp,{suggestions:u,selectedSuggestion:d,maxColumnWidth:f})}):m?(0,$.jsx)(Mm,{dimColor:!0,fixedWidth:!0,paddingX:2}):(0,$.jsxs)(g,{flexDirection:P?`column`:`row`,justifyContent:P?`flex-start`:`space-between`,paddingX:2,gap:+!P,children:[(0,$.jsxs)(g,{flexDirection:`column`,flexShrink:+!P,children:[i===`prompt`&&!I&&!n.show&&!x&&kC(k)&&(0,$.jsx)(NC,{messagesRef:M,lastAssistantMessageId:N,vimMode:r}),(0,$.jsx)(rw,{}),(0,$.jsx)(ZC,{exitMessage:n,vimMode:r,mode:i,toolPermissionContext:p,suppressHint:R,isLoading:_,tasksSelected:L,tmuxSelected:y,isPasting:x,isSearching:w,historyQuery:T,setHistoryQuery:E,historyFailedMatch:D,onOpenTasksDialog:O})]}),(0,$.jsx)(g,{flexShrink:1,gap:1,children:F?null:(0,$.jsx)(bb,{apiKeyStatus:e,autoUpdaterResult:a,debug:t,isAutoUpdating:o,verbose:s,messages:C,onAutoUpdaterResult:c,onChangeIsUpdating:l,mcpClients:b,isInputWrapped:S,isNarrow:P})})]})}var nw=(0,Q.memo)(tw);function rw(){return null}c(),H();function iw({isLoading:e}){return(0,$.jsxs)(b,{dimColor:e,children:[l.pointer,`\xA0`]})}function aw({mode:e,isLoading:t}){return(0,$.jsx)(g,{alignItems:`flex-start`,alignSelf:`flex-start`,flexWrap:`nowrap`,justifyContent:`flex-start`,children:e===`bash`?(0,$.jsx)(b,{color:`bashBorder`,dimColor:t,children:`!\xA0`}):(0,$.jsx)(iw,{isLoading:t})})}H();var ow=Q.createContext(void 0),sw=2;function cw({isFirst:e,children:t}){let n=sw,r=Q.useMemo(()=>({isQueued:!0,isFirst:e,paddingWidth:n*2}),[e,n]);return(0,$.jsx)(ow.Provider,{value:r,children:(0,$.jsx)(g,{paddingX:n,children:t})})}H(),Y(),Jr(),ka(),ku(),ec();var lw=new Set;function uw(e){try{return xu(e)?.type===`idle_notification`}catch{return!1}}var dw=3;function fw(e){return`<${Pu}>
|
|
63
63
|
<${Ru}>+${e} more tasks completed</${Ru}>
|
|
64
64
|
<${Lu}>completed</${Lu}>
|
|
65
65
|
</${Pu}>`}function pw(e){let t=e.filter(e=>typeof e.value!=`string`||!uw(e.value)),n=t.filter(e=>e.mode===`task-notification`),r=t.filter(e=>e.mode!==`task-notification`);if(n.length<=dw)return[...r,...n];let i=n.slice(0,dw-1),a={value:fw(n.length-(dw-1)),mode:`task-notification`};return[...r,...i,a]}function mw(){let e=mb(),t=J(e=>!!e.viewingAgentTaskId),n=(0,Q.useMemo)(()=>{if(e.length===0)return null;let t=e.filter(Si);return t.length===0?null:No(pw(t).map(e=>{let t=e.value;return e.mode===`bash`&&typeof t==`string`&&(t=`<bash-input>${t}</bash-input>`),Qc({content:t})}))},[e]);return t||n===null?null:(0,$.jsx)(g,{marginTop:1,flexDirection:`column`,children:n.map((e,t)=>(0,$.jsx)(cw,{isFirst:t===0,children:(0,$.jsx)(ns,{message:e,lookups:Gt,addMargin:!1,tools:[],commands:[],verbose:!1,inProgressToolUseIDs:lw,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,isTranscriptMode:!1,isStatic:!0})},t))})}var hw=Q.memo(mw);Ca(),c(),H();function gw({hasStash:e}){return e?(0,$.jsx)(g,{paddingLeft:2,children:(0,$.jsxs)(b,{dimColor:!0,children:[l.pointerSmall,` Stashed (auto-restores after submit)`]})}):null}Xf();var _w=1e4,vw=1e3;function yw(e,t){if(e.length<=_w)return{truncatedText:e,placeholderContent:``};let n=Math.floor(vw/2),r=e.slice(0,n),i=e.slice(-500),a=e.slice(n,-500);return{truncatedText:r+bw(t,Jf(a))+i,placeholderContent:a}}function bw(e,t){return`[...Truncated text #${e} +${t} lines...]`}function xw(e,t){let n=Object.keys(t).map(Number),r=n.length>0?Math.max(...n)+1:1,{truncatedText:i,placeholderContent:a}=yw(e,r);return a?{newInput:i,newPastedContents:{...t,[r]:{id:r,type:`text`,content:a}}}:{newInput:e,newPastedContents:t}}function Sw({input:e,pastedContents:t,onInputChange:n,setCursorOffset:r,setPastedContents:i}){let[a,o]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(a||e.length<=1e4)return;let{newInput:s,newPastedContents:c}=xw(e,t);n(s),r(s.length),i(c),o(!0)},[e,a,t,n,i,r]),(0,Q.useEffect)(()=>{e===``&&o(!1)},[e])}Y(),Au(),Jr(),wr();var Cw=3;function ww({input:e,submitCount:t}){let n=mb(),r=J(e=>e.promptSuggestionEnabled);return(0,Q.useMemo)(()=>{if(e===``){if(n.some(ii)&&(Mu().queuedCommandUpHintCount||0)<Cw)return`Press up to edit queued messages`;if(t<1&&r&&!gr())return $m()}},[e,n,t,r])}var Tw=5e3,Ew=!1;function Dw(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(Ew||!e)return;Ew=!0,n(!0);let t=setTimeout(n,Tw,!1);return()=>{clearTimeout(t),n(!1)}},[e]),t}te(),tf(),Zu(),Y(),Jr(),_(),gi(),np(),Wm(),Xf(),Gp(),zs(),H(),mc(),So(),Ic(),Vl(),fe(),Ef(),Au(),Du(),Fe(),vu(),$r(),pn(),Bu(),yd(),Ju(),Hp(),Za(),jf(),Xm(),vf(),jm();var Ow=5,kw=3;function Aw({debug:e,toolPermissionContext:t,setToolPermissionContext:n,apiKeyStatus:r,commands:i,agents:a,isLoading:o,verbose:s,messages:c,onAutoUpdaterResult:l,autoUpdaterResult:u,input:d,onInputChange:f,mode:p,onModeChange:h,stashedPrompt:_,setStashedPrompt:v,submitCount:y,onShowMessageSelector:x,onMessageActionsEnter:S,mcpClients:C,pastedContents:w,setPastedContents:D,vimMode:O,setVimMode:k,showBashesDialog:j,setShowBashesDialog:M,onExit:N,getToolUseContext:P,onSubmit:F,isSearchingHistory:I,setIsSearchingHistory:L,onDismissSideQuestion:R,isSideQuestionVisible:te,helpOpen:z,setHelpOpen:B,hasSuppressedDialogs:re,isLocalJSXCommandActive:V=!1,insertTextRef:ae}){let H=Wp(),se=ep()||V,[ce,le]=(0,Q.useState)(!1),[U,ue]=(0,Q.useState)({show:!1}),[W,de]=(0,Q.useState)(d.length),fe=Q.useRef(d);d!==fe.current&&(de(d.length),fe.current=d);let pe=Q.useCallback(e=>{fe.current=e,f(e)},[f]);ae&&(ae.current={cursorOffset:W,insert:e=>{let t=W===d.length&&d.length>0&&!/\s$/.test(d)?` ${e}`:e,n=d.slice(0,W)+t+d.slice(W);fe.current=n,f(n),de(W+t.length)},setInputWithCursor:(e,t)=>{fe.current=e,f(e),de(t)}});let me=oa(),he=xa(),ge=J(e=>e.tasks),_e=mb(),ve=J(e=>e.promptSuggestion),ye=J(e=>e.speculation),be=J(e=>e.speculationSessionTimeSavedMs),xe=J(e=>e.mainLoopModel),Se=J(e=>e.mainLoopModelForSession),Ce=J(e=>e.thinkingEnabled),we=J(e=>Nn()?e.fastMode:!1),Te=J(e=>e.viewingAgentTaskId);J(e=>e.viewSelectionMode);let{historyQuery:Ee,setHistoryQuery:De,historyMatch:Oe,historyFailedMatch:Ae,handleKeyDown:je}=kb(e=>{D(e.pastedContents),Gt(e.display)},d,pe,de,W,h,p,I,L,D,w);ne((e,t,n)=>{je(new T(n.keypress))},{isActive:I});let Me=(0,Q.useRef)(-1);Me.current===-1&&(Me.current=jw(c));let Ne=(0,Q.useRef)(!1),Pe=J(e=>e.selectedBgAgentIndex),Fe=(0,Q.useCallback)(e=>he(t=>{let n=typeof e==`function`?e(t.selectedBgAgentIndex):e;return n===t.selectedBgAgentIndex?t:{...t,selectedBgAgentIndex:n}}),[he]),[Ie,Le]=(0,Q.useState)(!1),[Re,ze]=(0,Q.useState)(!1),[Be,Ve]=(0,Q.useState)(!1),[He,Ue]=(0,Q.useState)(!1),[We,Ge]=(0,Q.useState)(!1),[Ke,qe]=(0,Q.useState)(!1),[Je,Ye]=(0,Q.useState)(!1),[Xe,Ze]=(0,Q.useState)(!1),Qe=(0,Q.useMemo)(()=>{let e=d.indexOf(`
|
|
@@ -117,8 +117,8 @@ Instead, provide a brief summary:
|
|
|
117
117
|
|
|
118
118
|
Then use the GoalTool to mark the goal as complete (if truly done) or leave it in its current state for the user to decide.
|
|
119
119
|
</goal-steering>`}Du(),es(),Jr();function _T(e){X(`[goal] hook: ${e}`)}function vT(e){let t=(0,Q.useRef)(e);t.current=e;let n=(0,Q.useRef)(!1),r=(0,Q.useRef)(!1);(0,Q.useLayoutEffect)(()=>{if(e.isLoading){n.current=!1;return}if(e.isQueryActiveNow?.()){_T(`skip: queryActiveNow=true`);return}if(e.wasAborted){_T(`skip: wasAborted=true`);return}if(n.current)return;if(Is().length>0){_T(`skip: yielding to queued user messages`);return}if(e.hasActiveLocalJsxUI){_T(`skip: activeLocalJsxUI`);return}if(e.isInPlanMode){_T(`skip: planMode`);return}let t=Hs();if(!t){r.current=!1;return}if(t.status===`active`&&(r.current=!1),t.status===`budget_limited`&&!r.current){r.current=!0,n.current=!0;let e=gT(t);X(`[goal] hook: budget limit reached, injecting wrap-up prompt`),Mn({value:e,mode:`prompt`,priority:`now`,isMeta:!0,origin:`goal-budget-limit`,skipSlashCommands:!0});return}if(t.status!==`active`){_T(`skip: status="${t.status}" (not active)`);return}if(t.turnsExecuted>=150){Sc()&&(sc(),e.onMaxTurnsReached?.()),X(`[goal] hook: MAX_GOAL_TURNS (150) reached, stopping`);return}n.current=!0;let i=Lo();sc();let a=hT(t);X(`[goal] hook: enqueuing turn ${i} for "${t.objective.slice(0,60)}"`),Mn({value:a,mode:`prompt`,priority:`now`,isMeta:!0,origin:`goal-continuation`,skipSlashCommands:!0}),e.onContinuationEnqueued?.({turn:i,objective:t.objective})},[e.isLoading,e.wasAborted,e.queuedCommandsLength,e.hasActiveLocalJsxUI,e.isInPlanMode])}vm(),hf(),H(),Ic(),bs(),Y(),Au(),Fe(),a();function yT({onBackgroundSession:e,isLoading:t}){let n=xa(),r=oa(),[a,o]=(0,Q.useState)(!1),s=ee(o,e,()=>{}),c=(0,Q.useCallback)(()=>{i(process.env.WORKMATE_DISABLE_BACKGROUND_TASKS)||(as(r.getState())?(fs(()=>r.getState(),n),Mu().hasUsedBackgroundTask||ju(e=>e.hasUsedBackgroundTask?e:{...e,hasUsedBackgroundTask:!0})):i(`false`)&&t&&s())},[n,r,t,s]),l=J(as),u=i(`false`);E(`task:background`,c,{context:`Task`,isActive:l||u&&t});let f=oo(`task:background`,`Task`,`ctrl+b`),p=et.terminal===`tmux`&&f===`ctrl+b`?`ctrl+b ctrl+b`:f;return!t||!a?null:(0,$.jsx)(g,{paddingLeft:2,children:(0,$.jsx)(b,{dimColor:!0,children:(0,$.jsx)(d,{shortcut:p,action:`background`})})})}Y();function bT({setMessages:e,setIsLoading:t,resetLoadingState:n,setAbortController:r,onBackgroundQuery:i}){let a=J(e=>e.foregroundedTaskId),o=J(e=>e.foregroundedTaskId?e.tasks[e.foregroundedTaskId]:void 0),s=xa(),c=(0,Q.useRef)(0),l=(0,Q.useCallback)(()=>{if(a){s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),e([]),n(),r(null);return}i()},[a,s,e,n,r,i]);return(0,Q.useEffect)(()=>{if(!a){c.current=0;return}if(o?.type!==`local_agent`){s(e=>({...e,foregroundedTaskId:void 0})),n(),c.current=0;return}let i=o.messages??[];if(i.length!==c.current&&(c.current=i.length,e([...i])),o.status===`running`){let e=o.abortController;if(e?.signal.aborted){s(e=>{if(!e.foregroundedTaskId)return e;let t=e.tasks[e.foregroundedTaskId];return t?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[e.foregroundedTaskId]:{...t,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0;return}t(!0),e&&r(e)}else s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0},[a,o,s,e,t,n,r]),{handleBackgroundSession:l}}af(),em(),rm(),tf(),Bu();function xT(e){let{addNotification:t}=ef(),n=(0,Q.useRef)(!1),r=(0,Q.useRef)(e);r.current=e,(0,Q.useEffect)(()=>{n.current||(n.current=!0,Promise.resolve().then(()=>r.current()).then(e=>{if(e)for(let n of Array.isArray(e)?e:[e])t(n)}).catch(Hu))},[t])}function ST(){xT(async()=>(await nm()).map((e,t)=>{let n=`low`;return e.type===`error`||e.userActionRequired?n=`high`:(e.type===`path`||e.type===`alias`)&&(n=`medium`),{key:`install-message-${t}-${e.type}`,text:e.message,priority:n,color:e.type===`error`?`error`:`warning`}}))}Au(),_u(),Du(),ka(),yd(),Hc(),Ci(),H(),ka();function CT(e,t,n){(0,Q.useRef)(null),(0,Q.useRef)(null);let r=(0,Q.useRef)(e),i=(0,Q.useRef)(n),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(null);r.current=e,i.current=n,(0,Q.useEffect)(()=>{},[!1,t]),(0,Q.useEffect)(()=>{if(n||!a.current)return;let e=M();e!==`blurred`&&e!==`unknown`||o.current?.()},[n]),(0,Q.useEffect)(()=>{M()},[n,!1])}Zu(),Au(),Du(),a(),vu(),Bu();function wT(){return i(process.env.WORKMATE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)}var TT={MAX_ATTEMPTS:10,INITIAL_DELAY_MS:3600*1e3,BACKOFF_MULTIPLIER:2,MAX_DELAY_MS:10080*60*1e3};function ET(e){let t=TT.INITIAL_DELAY_MS*TT.BACKOFF_MULTIPLIER**e;return Math.min(t,TT.MAX_DELAY_MS)}function DT(e){if(!e.officialMarketplaceAutoInstallAttempted)return!0;if(e.officialMarketplaceAutoInstalled)return!1;let t=e.officialMarketplaceAutoInstallFailReason,n=e.officialMarketplaceAutoInstallRetryCount||0,r=e.officialMarketplaceAutoInstallNextRetryTime,i=Date.now();return n>=TT.MAX_ATTEMPTS||t===`policy_blocked`||r&&i<r?!1:t===`unknown`||t===`git_unavailable`||t===`gcs_unavailable`||t===void 0}async function OT(){let e=Mu();if(!DT(e)){let t=e.officialMarketplaceAutoInstallFailReason??`already_attempted`;return X(`Official marketplace auto-install skipped: ${t}`),{installed:!1,skipped:!0,reason:t}}try{if(wT())return X(`Official marketplace auto-install disabled via env var, skipping`),ju(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),{installed:!1,skipped:!0,reason:`policy_blocked`};if((await wc())[`claude-plugins-official`])return X(`Official marketplace '${ru}' already installed, skipping`),ju(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0})),{installed:!1,skipped:!0,reason:`already_installed`};if(!Os(xo))return X(`Official marketplace blocked by enterprise policy, skipping`),ju(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),{installed:!1,skipped:!0,reason:`policy_blocked`};let t=pl(),n=dh(t,ru);if(await Wi(n,t)!==null){let e=await wc();return e[ru]={source:xo,installLocation:n,lastUpdated:new Date().toISOString()},await Ql(e),ju(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),{installed:!0,skipped:!1}}if(!await Ec()){X(`Git not available, skipping official marketplace auto-install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+ET(t),i=!1;try{ju(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`git_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r}))}catch(e){i=!0,Hu(Su(e)),X(`Failed to save marketplace auto-install git_unavailable state: ${e}`,{level:`error`})}return{installed:!1,skipped:!0,reason:`git_unavailable`,configSaveFailed:i}}return X(`Attempting to auto-install official marketplace`),await gc(xo),X(`Successfully auto-installed official marketplace`),e.officialMarketplaceAutoInstallRetryCount,ju(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),{installed:!0,skipped:!1}}catch(t){let n=t instanceof Error?t.message:String(t);if(n.includes(`xcrun: error:`))return _s(),X(`Official marketplace auto-install: git is a non-functional macOS xcrun shim, treating as git_unavailable`),{installed:!1,skipped:!0,reason:`git_unavailable`};X(`Failed to auto-install official marketplace: ${n}`,{level:`error`}),Hu(Su(t));let r=(e.officialMarketplaceAutoInstallRetryCount||0)+1,i=Date.now(),a=i+ET(r),o=!1;try{ju(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`unknown`,officialMarketplaceAutoInstallRetryCount:r,officialMarketplaceAutoInstallLastAttemptTime:i,officialMarketplaceAutoInstallNextRetryTime:a}))}catch(e){o=!0,Hu(Su(e)),X(`Failed to save marketplace auto-install failure state: ${e}`,{level:`error`})}return{installed:!1,skipped:!0,reason:`unknown`,configSaveFailed:o}}}H(),Du();function kT(){xT(async()=>{let e=await OT(),t=[];return e.configSaveFailed&&(X(`Showing marketplace config save failure notification`),t.push({key:`marketplace-config-save-failed`,jsx:(0,$.jsx)(b,{color:`error`,children:`Failed to save marketplace retry info · Check ~/.workmate.json permissions`}),priority:`immediate`,timeoutMs:1e4})),e.installed?(X(`Showing marketplace installation success notification`),t.push({key:`marketplace-installed`,jsx:(0,$.jsx)(b,{color:`success`,children:`✓ Official marketplace installed · /plugin to see available plugins`}),priority:`immediate`,timeoutMs:7e3})):e.skipped&&e.reason===`unknown`&&(X(`Showing marketplace installation failure notification`),t.push({key:`marketplace-install-failed`,jsx:(0,$.jsx)(b,{color:`warning`,children:`Failed to install official marketplace · Will retry on next startup`}),priority:`immediate`,timeoutMs:8e3})),t})}Ye(),Zu();function AT(e){if(e.length===0)return;if(e.length===1)return e[0];let t=e.map(e=>({tip:e,sessions:th(e.id)}));return t.sort((e,t)=>t.sessions-e.sessions),t[0]?.tip}async function jT(e){if(ze().spinnerTipsEnabled===!1)return;let t=await rh(e);if(t.length!==0)return AT(t)}function MT(e){nh(e.id),e.id,e.cooldownSessions}vu(),Bu(),Y();async function NT(e,t,n){}function PT(){let e=J(e=>e.mainLoopModel),t=J(e=>e.mainLoopModelForSession),n=J(e=>e.fastMode),r=xa(),i=oa(),a=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{a.current&&(a.current=!1),NT(i.getState().toolPermissionContext,r,n).catch(e=>{Hu(Error(`Auto mode gate check failed`,{cause:Su(e)}))})},[e,t,n])}Gc();function FT(e,t,n){let r=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!el()||r.current||(r.current=!0,e&&so(e,n))},[t,e,n])}H(),Rs(),zf(),Tm();function IT({hostPattern:{host:e},onUserResponse:t}){function n(e){switch(e){case`yes`:t({allow:!0,persistToSettings:!1});break;case`yes-dont-ask-again`:t({allow:!0,persistToSettings:!0});break;case`no`:t({allow:!1,persistToSettings:!1});break}}let r=[{label:`Yes`,value:`yes`},...cl()?[]:[{label:(0,$.jsxs)(b,{children:[`Yes, and don't ask again for `,(0,$.jsx)(b,{bold:!0,children:e})]}),value:`yes-dont-ask-again`}],{label:(0,$.jsxs)(b,{children:[`No, and tell Work Mate what to do differently `,(0,$.jsx)(b,{bold:!0,children:`(esc)`})]}),value:`no`}];return(0,$.jsx)(Dm,{title:`Network request outside of sandbox`,children:(0,$.jsxs)(g,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsxs)(g,{children:[(0,$.jsx)(b,{dimColor:!0,children:`Host:`}),(0,$.jsxs)(b,{children:[` `,e]})]}),(0,$.jsx)(g,{marginTop:1,children:(0,$.jsx)(b,{children:`Do you want to allow this connection?`})}),(0,$.jsx)(g,{children:(0,$.jsx)(Bf,{options:r,onChange:n,onCancel:()=>{t({allow:!1,persistToSettings:!1})}})})]})})}H(),Rs(),Ju();function LT(e){return`${e.getHours()%12||12}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}${e.getHours()<12?`am`:`pm`}`}function RT(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)(0);return(0,Q.useEffect)(()=>{let e=Uc.getSandboxViolationStore();return e.subscribe(n=>{t(n.slice(-10)),r(e.getTotalCount())})},[]),!Uc.isSandboxingEnabled()||Ku()===`linux`||n===0?null:(0,$.jsxs)(g,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(g,{marginLeft:0,children:(0,$.jsxs)(b,{color:`permission`,children:[`⧈ Sandbox blocked `,n,` total `,n===1?`operation`:`operations`]})}),e.map((e,t)=>(0,$.jsx)(g,{paddingLeft:2,children:(0,$.jsxs)(b,{dimColor:!0,children:[LT(e.timestamp),e.command?` ${e.command}:`:``,` `,e.line]})},`${e.timestamp.getTime()}-${t}`)),(0,$.jsx)(g,{paddingLeft:2,children:(0,$.jsxs)(b,{dimColor:!0,children:[`… showing last `,Math.min(10,e.length),` of `,n]})})]})}hm(),tf(),H();var zT=[];function BT({mcpClients:e=zT}){let{addNotification:t}=ef();(0,Q.useEffect)(()=>{let n=e.filter(e=>e.type===`failed`&&e.config.type!==`sse-ide`&&e.config.type!==`ws-ide`),r=e.filter(e=>e.type===`needs-auth`);n.length===0&&r.length===0||(n.length>0&&t({key:`mcp-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{color:`error`,children:[n.length,` MCP `,n.length===1?`server`:`servers`,` failed`]}),(0,$.jsx)(b,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),r.length>0&&t({key:`mcp-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{color:`warning`,children:[r.length,` MCP `,r.length===1?`server needs`:`servers need`,` `,`auth`]}),(0,$.jsx)(b,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}))},[t,e])}H(),Ye(),am();var VT=`Auto mode lets Work Mate handle permission prompts automatically — Work Mate checks each tool call for risky actions and prompt injection before executing. Actions Work Mate identifies as safe are executed, while actions Work Mate identifies as risky are blocked and Work Mate may try a different approach. Ideal for long-running tasks. Sessions are slightly more expensive. Work Mate can make mistakes that allow harmful commands to run, it's recommended to only use in isolated environments. Shift+Tab to change mode.`;ce(),ht(),tf(),H(),Y(),Du(),a();var HT=5e3;function UT(){let{addNotification:e}=ef(),t=xa(),[n,r]=Q.useState(()=>i(`true`)),a=Q.useRef(new Set),o=Q.useCallback((n,r)=>{let i=`${n}:${r}`;if(a.current.has(i))return;a.current.add(i),X(`LSP error: ${n} - ${r}`),t(e=>{let t=new Set(e.plugins.errors.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),i=`generic-error:${n}:${r}`;return t.has(i)?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,{type:`generic-error`,source:n,error:r}]}}});let o=n.startsWith(`plugin:`)?n.split(`:`)[1]??n:n;e({key:`lsp-error-${n}`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{color:`error`,children:[`LSP for `,o,` failed`]}),(0,$.jsx)(b,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`,timeoutMs:8e3})},[e,t]),s=Q.useCallback(()=>{if(ft())return;let e=$n();if(e.status===`failed`){o(`lsp-manager`,e.error.message),r(!1);return}if(e.status===`pending`||e.status===`not-started`)return;let t=sa();if(t){let e=t.getAllServers();for(let[t,n]of e)n.state===`error`&&n.lastError&&o(t,n.lastError.message)}},[o]);F(s,n?HT:null),Q.useEffect(()=>{n&&s()},[s,n])}Du();var WT=new Map;async function GT(e){if(!e?.trim())return X(`[binaryCheck] Empty command provided, returning false`),!1;let t=e.trim(),n=WT.get(t);if(n!==void 0)return X(`[binaryCheck] Cache hit for '${t}': ${n}`),n;let r=!1;return await Gu(t).catch(()=>null)&&(r=!0),WT.set(t,r),X(`[binaryCheck] Binary '${t}' ${r?`found`:`not found`}`),r}Au(),Du(),ts();var KT=5;function qT(e){return Qe.has(e.toLowerCase())}function JT(e){if(!e)return null;if(typeof e==`string`)return X(`[lspRecommendation] Skipping string path lspServers (not readable from marketplace)`),null;if(Array.isArray(e)){for(let t of e){if(typeof t==`string`)continue;let e=XT(t);if(e)return e}return null}return XT(e)}function YT(e){return typeof e==`object`&&!!e}function XT(e){let t=new Set,n=null;for(let[r,i]of Object.entries(e)){if(!YT(i))continue;!n&&typeof i.command==`string`&&(n=i.command);let e=i.extensionToLanguage;if(YT(e))for(let n of Object.keys(e))t.add(n.toLowerCase())}return!n||t.size===0?null:{extensions:t,command:n}}async function ZT(){let e=new Map;try{let t=await wc();for(let n of Object.keys(t))try{let t=await Ws(n),r=qT(n);for(let i of t.plugins){if(!i.lspServers)continue;let t=JT(i.lspServers);if(!t)continue;let a=`${i.name}@${n}`;e.set(a,{entry:i,marketplaceName:n,extensions:t.extensions,command:t.command,isOfficial:r})}}catch(e){X(`[lspRecommendation] Failed to load marketplace ${n}: ${e}`)}}catch(e){X(`[lspRecommendation] Failed to load marketplaces config: ${e}`)}return e}async function QT(e){if(tE())return X(`[lspRecommendation] Recommendations are disabled`),[];let t=uh(e).toLowerCase();if(!t)return X(`[lspRecommendation] No file extension found`),[];X(`[lspRecommendation] Looking for LSP plugins for ${t}`);let n=await ZT(),r=Mu().lspRecommendationNeverPlugins??[],i=[];for(let[e,a]of n)if(a.extensions.has(t)){if(r.includes(e)){X(`[lspRecommendation] Skipping ${e} (in never suggest list)`);continue}if(rl(e)){X(`[lspRecommendation] Skipping ${e} (already installed)`);continue}i.push({info:a,pluginId:e})}let a=[];for(let{info:e,pluginId:t}of i)await GT(e.command)?(a.push({info:e,pluginId:t}),X(`[lspRecommendation] Binary '${e.command}' found for ${t}`)):X(`[lspRecommendation] Skipping ${t} (binary '${e.command}' not found)`);return a.sort((e,t)=>e.info.isOfficial&&!t.info.isOfficial?-1:!e.info.isOfficial&&t.info.isOfficial?1:0),a.map(({info:e,pluginId:t})=>({pluginId:t,pluginName:e.entry.name,marketplaceName:e.marketplaceName,description:e.entry.description,isOfficial:e.isOfficial,extensions:Array.from(e.extensions),command:e.command}))}function $T(e){ju(t=>{let n=t.lspRecommendationNeverPlugins??[];return n.includes(e)?t:{...t,lspRecommendationNeverPlugins:[...n,e]}}),X(`[lspRecommendation] Added ${e} to never suggest`)}function eE(){ju(e=>{let t=(e.lspRecommendationIgnoredCount??0)+1;return{...e,lspRecommendationIgnoredCount:t}}),X(`[lspRecommendation] Incremented ignored count`)}function tE(){let e=Mu();return e.lspRecommendationDisabled===!0||(e.lspRecommendationIgnoredCount??0)>=KT}c(),H(),Bu(),ts();function nE(){let[e,t]=Q.useState(null),n=Q.useRef(!1),r=Q.useCallback(r=>{e||n.current||(n.current=!0,r().then(e=>{e&&t(e)}).catch(Hu).finally(()=>{n.current=!1}))},[e]);return{recommendation:e,clearRecommendation:Q.useCallback(()=>t(null),[]),tryResolve:r}}async function rE(e,t,n,r,i){try{let a=await zo(e);if(!a)throw Error(`Plugin ${e} not found in marketplace`);await i(a),r({key:`${n}-installed`,jsx:(0,$.jsxs)(b,{color:`success`,children:[l.tick,` `,t,` installed · restart to apply`]}),priority:`immediate`,timeoutMs:5e3})}catch(e){Hu(e),r({key:`${n}-install-failed`,jsx:(0,$.jsxs)(b,{color:`error`,children:[`Failed to install `,t]}),priority:`immediate`,timeoutMs:5e3})}}ht(),tf(),Y(),Au(),Du(),Bu(),Ye();var iE=28e3;function aE(){let e=J(e=>e.fileHistory.trackedFiles),{addNotification:t}=ef(),n=Q.useRef(new Set),{recommendation:r,clearRecommendation:i,tryResolve:a}=nE();return Q.useEffect(()=>{a(async()=>{if(At())return null;let t=[];for(let r of e)n.current.has(r)||(n.current.add(r),t.push(r));for(let e of t)try{let t=(await QT(e))[0];if(t)return X(`[useLspPluginRecommendation] Found match: ${t.pluginName} for ${e}`),wt(!0),{pluginId:t.pluginId,pluginName:t.pluginName,pluginDescription:t.description,fileExtension:uh(e),shownAt:Date.now()}}catch(e){Hu(e)}return null})},[e,a]),{recommendation:r,handleResponse:Q.useCallback(e=>{if(!r)return;let{pluginId:n,pluginName:a,shownAt:o}=r;switch(X(`[useLspPluginRecommendation] User response: ${e} for ${a}`),e){case`yes`:rE(n,a,`lsp-plugin`,t,async e=>{X(`[useLspPluginRecommendation] Installing plugin: ${n}`);let t=typeof e.entry.source==`string`?dh(e.marketplaceInstallLocation,e.entry.source):void 0;await cn(n,e.entry,`user`,void 0,t),it(`userSettings`,{enabledPlugins:{...tt(`userSettings`)?.enabledPlugins,[n]:!0}}),X(`[useLspPluginRecommendation] Plugin installed: ${n}`)});break;case`no`:{let e=Date.now()-o;e>=iE&&(X(`[useLspPluginRecommendation] Timeout detected (${e}ms), incrementing ignored count`),eE());break}case`never`:$T(n);break;case`disable`:ju(e=>e.lspRecommendationDisabled?e:{...e,lspRecommendationDisabled:!0});break}i()},[r,t,i])}}H(),zf(),Tm();var oE=3e4;function sE({pluginName:e,pluginDescription:t,fileExtension:n,onResponse:r}){let i=Q.useRef(r);i.current=r,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),oE,i);return()=>clearTimeout(e)},[]);function a(e){switch(e){case`yes`:r(`yes`);break;case`no`:r(`no`);break;case`never`:r(`never`);break;case`disable`:r(`disable`);break}}return(0,$.jsx)(Dm,{title:`LSP Plugin Recommendation`,children:(0,$.jsxs)(g,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(g,{marginBottom:1,children:(0,$.jsx)(b,{dimColor:!0,children:`LSP provides code intelligence like go-to-definition and error checking`})}),(0,$.jsxs)(g,{children:[(0,$.jsx)(b,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(b,{children:[` `,e]})]}),t&&(0,$.jsx)(g,{children:(0,$.jsx)(b,{dimColor:!0,children:t})}),(0,$.jsxs)(g,{children:[(0,$.jsx)(b,{dimColor:!0,children:`Triggered by:`}),(0,$.jsxs)(b,{children:[` `,n,` files`]})]}),(0,$.jsx)(g,{marginTop:1,children:(0,$.jsx)(b,{children:`Would you like to install this LSP plugin?`})}),(0,$.jsx)(g,{children:(0,$.jsx)(Bf,{options:[{label:(0,$.jsxs)(b,{children:[`Yes, install `,(0,$.jsx)(b,{bold:!0,children:e})]}),value:`yes`},{label:`No, not now`,value:`no`},{label:(0,$.jsxs)(b,{children:[`Never for `,(0,$.jsx)(b,{bold:!0,children:e})]}),value:`never`},{label:`Disable all LSP recommendations`,value:`disable`}],onChange:a,onCancel:()=>r(`no`)})})]})})}tf(),Zu(),Du(),Zn();function cE(){let e=Q.useSyncExternalStore($o,Vs),{addNotification:t}=ef(),{recommendation:n,clearRecommendation:r,tryResolve:i}=nE();return Q.useEffect(()=>{e&&i(async()=>{let t=await Ti(e);return t&&(X(`[useWorkMateHintRecommendation] surfacing ${t.pluginId} from ${t.sourceCommand}`),Io()),Vs()===e&&wo(),t})},[e,i]),{recommendation:n,handleResponse:Q.useCallback(e=>{if(n){switch(Wa(n.pluginId),n.pluginName,n.marketplaceName,e){case`yes`:{let{pluginId:e,pluginName:r,marketplaceName:i}=n;rE(e,r,`hint-plugin`,t,async t=>{let n=await ia({pluginId:e,entry:t.entry,marketplaceName:i,scope:`user`,trigger:`hint`});if(!n.success)throw Error(n.success?`Unknown error`:n.error)});break}case`disable`:La();break;case`no`:break}r()}},[n,t,r])}}H(),zf(),Tm();var lE=3e4;function uE({pluginName:e,pluginDescription:t,marketplaceName:n,sourceCommand:r,onResponse:i}){let a=Q.useRef(i);a.current=i,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),lE,a);return()=>clearTimeout(e)},[]);function o(e){switch(e){case`yes`:i(`yes`);break;case`disable`:i(`disable`);break;default:i(`no`)}}return(0,$.jsx)(Dm,{title:`Plugin Recommendation`,children:(0,$.jsxs)(g,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(g,{marginBottom:1,children:(0,$.jsxs)(b,{dimColor:!0,children:[`The `,(0,$.jsx)(b,{bold:!0,children:r}),` command suggests installing a plugin.`]})}),(0,$.jsxs)(g,{children:[(0,$.jsx)(b,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(b,{children:[` `,e]})]}),(0,$.jsxs)(g,{children:[(0,$.jsx)(b,{dimColor:!0,children:`Marketplace:`}),(0,$.jsxs)(b,{children:[` `,n]})]}),t&&(0,$.jsx)(g,{children:(0,$.jsx)(b,{dimColor:!0,children:t})}),(0,$.jsx)(g,{marginTop:1,children:(0,$.jsx)(b,{children:`Would you like to install it?`})}),(0,$.jsx)(g,{children:(0,$.jsx)(Bf,{options:[{label:(0,$.jsxs)(b,{children:[`Yes, install `,(0,$.jsx)(b,{bold:!0,children:e})]}),value:`yes`},{label:`No`,value:`no`},{label:`No, and don't show plugin installation hints again`,value:`disable`}],onChange:o,onCancel:()=>i(`no`)})})]})})}zf(),Tm();var dE=3e4;function fE({tools:e,onSelect:t,onDismiss:n}){let r=Q.useRef(t),i=Q.useRef(n);r.current=t,i.current=n,Q.useEffect(()=>{let e=setTimeout(e=>e.current(),dE,i);return()=>clearTimeout(e)},[]);let a=e.map(e=>({label:`${e.name} — ${e.description.slice(0,60)} (score: ${e.score.toFixed(2)})`,value:e.name}));return a.push({label:`Dismiss`,value:`__dismiss__`}),(0,$.jsx)(Dm,{title:`Tool Recommendation`,children:(0,$.jsx)(Bf,{options:a,onChange:e=>{e===`__dismiss__`?i.current():(i.current(),r.current(e))}})})}var pE=.15,mE=3;function hE(){let e=Q.useSyncExternalStore(pc,Xo),t=Q.useMemo(()=>e.length===0?[]:e.slice(0,mE).map(e=>({name:e.name,description:e.description.slice(0,60),score:e.score})),[e]);return{tools:t,visible:t.length>0&&(t[0]?.score??0)>=pE,handleSelect:Q.useCallback(e=>{Xt()},[]),handleDismiss:Q.useCallback(()=>{Xt()},[])}}tf(),H(),Y(),Du(),dd();function gE(){let{addNotification:e}=ef(),t=J(e=>e.plugins.installationStatus),{totalFailed:n,failedMarketplacesCount:r,failedPluginsCount:i}=(0,Q.useMemo)(()=>{if(!t)return{totalFailed:0,failedMarketplacesCount:0,failedPluginsCount:0};let e=t.marketplaces.filter(e=>e.status===`failed`),n=t.plugins.filter(e=>e.status===`failed`);return{totalFailed:e.length+n.length,failedMarketplacesCount:e.length,failedPluginsCount:n.length}},[t]);(0,Q.useEffect)(()=>{if(!t){X(`No installation status to monitor`);return}n!==0&&(X(`Plugin installation status: ${r} failed marketplaces, ${i} failed plugins`),n!==0&&(X(`Adding notification for ${n} failed installations`),e({key:`plugin-install-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{color:`error`,children:[n,` `,ud(n,`plugin`),` failed to install`]}),(0,$.jsx)(b,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`})))},[e,n,r,i])}tf(),H(),Du(),Nm();function _E(){let{addNotification:e}=ef(),[t,n]=(0,Q.useState)([]);(0,Q.useEffect)(()=>Pm(e=>{X(`Plugin autoupdate notification: ${e.length} plugin(s) updated`),n(e)}),[]),(0,Q.useEffect)(()=>{if(t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`@`);return t>0?e.substring(0,t):e}),r=n.length<=2?n.join(` and `):`${n.length} plugins`;e({key:`plugin-autoupdate-restart`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{color:`success`,children:[n.length===1?`Plugin`:`Plugins`,` updated: `,r]}),(0,$.jsx)(b,{dimColor:!0,children:` · Run /reload-plugins to apply`})]}),priority:`low`,timeoutMs:1e4}),X(`Showing plugin autoupdate notification for: ${n.join(`, `)}`)},[t,e])}Du(),Bu(),ts(),kp(),Zu();function vE(e,t,n,r){e(e=>({...e,plugins:{...e.plugins,installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.map(e=>e.name===t?{...e,status:n,error:r}:e)}}}))}async function yE(e){X(`performBackgroundPluginInstallations called`);try{let t=Dp(Do(),await wc().catch(()=>({}))),n=[...t.missing,...t.sourceChanged.map(e=>e.name)];if(e(e=>({...e,plugins:{...e.plugins,installationStatus:{marketplaces:n.map(e=>({name:e,status:`pending`})),plugins:[]}}})),n.length===0)return;X(`Installing ${n.length} marketplace(s) in background`);let r=await Ep({onProgress:t=>{switch(t.type){case`installing`:vE(e,t.name,`installing`);break;case`installed`:vE(e,t.name,`installed`);break;case`failed`:vE(e,t.name,`failed`,t.error);break}}});if(Ke(`info`,`tengu_marketplace_background_install`,{installed_count:r.installed.length,updated_count:r.updated.length,failed_count:r.failed.length,up_to_date_count:r.upToDate.length}),r.installed.length>0){Jc(),X(`Auto-refreshing plugins after ${r.installed.length} new marketplace(s) installed`);try{await Op(e)}catch(t){Hu(t),X(`Auto-refresh failed, falling back to needsRefresh: ${t}`,{level:`warn`}),Hr(`performBackgroundPluginInstallations: auto-refresh failed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})}}else r.updated.length>0&&(Jc(),Hr(`performBackgroundPluginInstallations: marketplaces reconciled`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}}))}catch(e){Hu(e)}}Au(),Du(),ts(),or();async function bE(e){if(X(`performStartupChecks called`),!Nu()){X(`Trust not accepted for current directory - skipping plugin installations`);return}try{X(`Starting background plugin installations`),await ro()&&(Jc(),Hr(`performStartupChecks: seed marketplaces changed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})),await yE(e)}catch(e){X(`Error initiating background plugin installations: ${e}`)}}tf(),H(),fn();function xE(e){let{addNotification:t}=ef(),n=hb(),r=(0,Q.useMemo)(()=>Co(n,e),[n,e]),i=(0,Q.useMemo)(()=>Bs(n),[n]),a=(0,Q.useRef)(null),o=Iw(),[s,c]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{n.isUsingOverage&&!s&&o?(t({key:`limit-reached`,text:i,priority:`immediate`}),c(!0)):!n.isUsingOverage&&s&&c(!1)},[n.isUsingOverage,i,s,t,o]),(0,Q.useEffect)(()=>{r&&r!==a.current&&(a.current=r,t({key:`rate-limit-warning`,jsx:(0,$.jsx)(b,{children:(0,$.jsx)(b,{color:`warning`,children:r})}),priority:`high`}))},[r,t])}tf();function SE(e){let{addNotification:t}=ef(),n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let r=eh(e);r&&r!==n.current&&(n.current=r,t({key:`model-deprecation-warning`,text:r,color:`warning`,priority:`high`})),r||(n.current=null)},[e,t])}a();var CE=``;function wE(){xT(async()=>qu()||i(process.env.DISABLE_INSTALLATION_CHECKS)||await tm()===`development`?null:{timeoutMs:15e3,key:`npm-deprecation-warning`,text:CE,color:`warning`,priority:`high`})}Au();var TE=[e=>{if(DE(e.sonnet45To46MigrationTimestamp))return{key:`sonnet-46-update`,text:`Model updated to Sonnet 4.6`,color:`suggestion`,priority:`high`,timeoutMs:3e3}},e=>{let t=!!e.legacyOpusMigrationTimestamp;if(DE(e.legacyOpusMigrationTimestamp??e.opusProMigrationTimestamp))return{key:`opus-pro-update`,text:t?`Model updated to Opus 4.7 · Set WORKMATE_DISABLE_LEGACY_MODEL_REMAP=1 to opt out`:`Model updated to Opus 4.7`,color:`suggestion`,priority:`high`,timeoutMs:t?8e3:3e3}}];function EE(){xT(()=>{let e=Mu(),t=[];for(let n of TE){let r=n(e);r&&t.push(r)}return t.length>0?t:null})}function DE(e){return e!==void 0&&Date.now()-e<3e3}tf(),Y(),Vr(),rd();var OE=`fast-mode-cooldown-started`,kE=`fast-mode-cooldown-expired`,AE=`fast-mode-org-changed`,jE=`fast-mode-overage-rejected`;function ME(){let{addNotification:e}=ef(),t=J(e=>e.fastMode),n=xa();(0,Q.useEffect)(()=>{if(Nn())return sn(r=>{r?e({key:AE,color:`fastMode`,priority:`immediate`,text:`Fast mode is now available · /fast to turn on`}):t&&(n(e=>({...e,fastMode:!1})),e({key:AE,color:`warning`,priority:`immediate`,text:`Fast mode has been disabled by your organization`}))})},[e,t,n]),(0,Q.useEffect)(()=>{if(Nn())return iu(t=>{n(e=>({...e,fastMode:!1})),e({key:jE,color:`warning`,priority:`immediate`,text:t})})},[e,n]),(0,Q.useEffect)(()=>{if(!t)return;let n=ji((t,n)=>{let r=NE(n,od(t-Date.now(),{hideTrailingZeros:!0}));e({key:OE,invalidates:[kE],text:r,color:`warning`,priority:`immediate`})}),r=Mr(()=>{e({key:kE,invalidates:[OE],color:`fastMode`,text:`Fast limit reset · now using fast mode`,priority:`immediate`})});return()=>{n(),r()}},[e,t])}function NE(e,t){switch(e){case`overloaded`:return`Fast mode overloaded and is temporarily unavailable · resets in ${t}`;case`rate_limit`:return`Fast limit reached and temporarily disabled · resets in ${t}`}}Lm(),H(),Au(),hp();function PE(e,t,n){let r=(0,Q.useRef)(!1),i=(0,Q.useRef)(n);i.current=n,(0,Q.useEffect)(()=>{if(t)return e.subscribe(()=>{let t=e.getState(),n=e.hasSelection();if(t?.isDragging){r.current=!1;return}if(!n){r.current=!1;return}if(r.current||!(Mu().copyOnSelect??!0))return;let a=e.copySelectionNoClear();if(!a?.trim()){r.current=!0;return}r.current=!0,i.current?.(a)})},[t,e])}function FE(e){let[t]=h();(0,Q.useEffect)(()=>{e.setSelectionBgColor(mp(t).selectionBg)},[e,t])}tf(),H(),Ic(),Du();var IE=40,LE=.3,RE=6,zE=200,BE=15,VE=15,HE=3,UE=1500,WE=150,GE=5,KE=5,qE=80,JE=3,YE=6,XE=500;function ZE(e){return!(e.wheelUp||e.wheelDown||(e.leftArrow||e.rightArrow||e.upArrow||e.downArrow||e.home||e.end||e.pageUp||e.pageDown)&&(e.shift||e.meta||e.super))}function QE(e){return!e.shift||e.meta?null:e.leftArrow?`left`:e.rightArrow?`right`:e.upArrow?`up`:e.downArrow?`down`:e.home?`lineStart`:e.end?`lineEnd`:null}function $E(e,t,n){if(!e.xtermJs){if(e.wheelMode&&n-e.time>UE&&(e.wheelMode=!1,e.burstCount=0,e.mult=e.base),e.pendingFlip){if(e.pendingFlip=!1,t!==e.dir||n-e.time>zE)return e.dir=t,e.time=n,e.mult=e.base,Math.floor(e.mult);e.wheelMode=!0}let r=n-e.time;if(t!==e.dir&&e.dir!==0)return e.pendingFlip=!0,e.time=n,0;if(e.dir=t,e.time=n,e.wheelMode)if(r<KE)if(++e.burstCount>=5)e.wheelMode=!1,e.burstCount=0,e.mult=e.base;else return 1;else e.burstCount=0;if(e.wheelMode){let t=.5**(r/WE),n=Math.max(VE,e.base*2),i=1+(e.mult-1)*t+BE*t;return e.mult=Math.min(n,i,e.mult+HE),Math.floor(e.mult)}if(r>IE)e.mult=e.base;else{let t=Math.max(RE,e.base*2);e.mult=Math.min(t,e.mult+LE)}return Math.floor(e.mult)}let r=n-e.time,i=t===e.dir;if(e.time=n,e.dir=t,i&&r<KE)return 1;if(!i||r>XE)e.mult=2,e.frac=0;else{let t=.5**(r/WE);e.mult=Math.min(r>=qE?JE:YE,1+(e.mult-1)*t+GE*t)}let a=e.mult+e.frac,o=Math.floor(a);return e.frac=a-o,o}function eD(){let e=process.env.WORKMATE_SCROLL_SPEED;if(!e)return 1;let t=parseFloat(e);return Number.isNaN(t)||t<=0?1:Math.min(t,20)}function tD(e=!1,t=1){return{time:0,mult:t,dir:0,xtermJs:e,frac:0,base:t,pendingFlip:!1,wheelMode:!1,burstCount:0}}function nD(){let e=z(),t=eD();return X(`wheel accel: ${e?`decay (xterm.js)`:`window (native)`} · base=${t} · TERM_PROGRAM=${process.env.TERM_PROGRAM??`unset`}`),tD(e,t)}var rD=2,iD=50,aD=200;function oD({scrollRef:e,isActive:t,onScroll:n,isModal:r=!1}){let i=V(),{addNotification:a}=ef(),o=(0,Q.useRef)(null);function s(e){let t=re(),n=e.length,r;switch(t){case`native`:r=`copied ${n} chars to clipboard`;break;case`tmux-buffer`:r=`copied ${n} chars to tmux buffer · paste with prefix + ]`;break;case`osc52`:r=`sent ${n} chars via OSC 52 · check terminal clipboard settings if paste fails`;break}a({key:`selection-copied`,text:r,color:`suggestion`,priority:`immediate`,timeoutMs:t===`native`?2e3:4e3})}function c(){let e=i.copySelection();e&&s(e)}function l(e,t){let n=i.getState();if(!n?.anchor||!n.focus)return;let r=e.getViewportTop(),a=r+e.getViewportHeight()-1;if(n.anchor.row<r||n.anchor.row>a||n.focus.row<r||n.focus.row>a)return;let o=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),s=e.getScrollTop()+e.getPendingDelta(),c=Math.max(0,Math.min(o,s+t))-s;if(c!==0)if(c>0)i.captureScrolledRows(r,r+c-1,`above`),i.shiftSelection(-c,r,a);else{let e=-c;i.captureScrolledRows(a-e+1,a,`below`),i.shiftSelection(e,r,a)}}return m({"scroll:pageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=lD(t,r);n?.(i,t)},"scroll:pageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=lD(t,r);n?.(i,t)},"scroll:lineUp":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=nD()),dD(t,$E(o.current,-1,performance.now())),n?.(!1,t)},"scroll:lineDown":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=nD());let r=uD(t,$E(o.current,1,performance.now()));n?.(r,t)},"scroll:top":()=>{let t=e.current;t&&(l(t,-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(0),n?.(!1,t))},"scroll:bottom":()=>{let t=e.current;if(!t)return;let r=Math.max(0,t.getScrollHeight()-t.getViewportHeight());l(t,r-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(r),t.scrollToBottom(),n?.(!0,t)},"selection:copy":c},{context:`Scroll`,isActive:t}),m({"scroll:halfPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=lD(t,r);n?.(i,t)},"scroll:halfPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=lD(t,r);n?.(i,t)},"scroll:fullPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,t.getViewportHeight());l(t,r);let i=lD(t,r);n?.(i,t)},"scroll:fullPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,t.getViewportHeight());l(t,r);let i=lD(t,r);n?.(i,t)}},{context:`Scroll`,isActive:t}),ne((t,r,i)=>{let a=e.current;if(!a)return;let o=pD(a,fD(t,r),e=>l(a,e));o!==null&&(n?.(o,a),i.stopImmediatePropagation())},{isActive:t&&r}),ne((e,t,n)=>{if(!i.hasSelection())return;if(t.escape){i.clearSelection(),n.stopImmediatePropagation();return}if(t.ctrl&&!t.shift&&!t.meta&&e===`c`){c(),n.stopImmediatePropagation();return}let r=QE(t);if(r){i.moveFocus(r),n.stopImmediatePropagation();return}ZE(t)&&i.clearSelection()},{isActive:t}),sD(e,i,t,n),PE(i,t,s),FE(i),null}function sD(e,t,n,r){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o=(0,Q.useRef)(0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(r);c.current=r,(0,Q.useEffect)(()=>{if(!n)return;function r(){a.current=0,i.current&&(clearInterval(i.current),i.current=null)}function l(){let n=t.getState(),i=e.current,o=a.current;if(!n?.isDragging||!n.focus||!i||o===0||++s.current>aD){r();return}if(i.getPendingDelta()!==0)return;let l=i.getViewportTop(),u=l+i.getViewportHeight()-1;if(o<0){if(i.getScrollTop()<=0){r();return}let e=Math.min(rD,i.getScrollTop());t.captureScrolledRows(u-e+1,u,`below`),t.shiftAnchor(e,0,u),i.scrollBy(-2)}else{let e=Math.max(0,i.getScrollHeight()-i.getViewportHeight());if(i.getScrollTop()>=e){r();return}let n=Math.min(rD,e-i.getScrollTop());t.captureScrolledRows(l,l+n-1,`above`),t.shiftAnchor(-n,l,u),i.scrollBy(rD)}c.current?.(!1,i)}function u(e){o.current=e,a.current!==e&&(r(),a.current=e,s.current=0,l(),a.current===e&&(i.current=setInterval(l,iD)))}function d(){let n=e.current;if(!n){r();return}let i=n.getViewportTop(),a=i+n.getViewportHeight()-1,s=t.getState();(!s?.isDragging||s.scrolledOffAbove.length===0&&s.scrolledOffBelow.length===0)&&(o.current=0);let c=cD(s,i,a,o.current);if(c===0){if(o.current!==0&&s?.focus){let e=s.focus.row<i?-1:+(s.focus.row>a);e!==0&&e!==o.current&&(s.scrolledOffAbove=[],s.scrolledOffBelow=[],s.scrolledOffAboveSW=[],s.scrolledOffBelowSW=[],o.current=0)}r()}else u(c)}let f=t.subscribe(d);return()=>{f(),r(),o.current=0}},[n,e,t])}function cD(e,t,n,r=0){if(!e?.isDragging||!e.anchor||!e.focus)return 0;let i=e.focus.row,a=i<t?-1:+(i>n);return r===0?e.anchor.row<t||e.anchor.row>n?0:a:a===r?a:0}function lD(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),r=e.getScrollTop()+e.getPendingDelta()+t;return r>=n?(e.scrollTo(n),e.scrollToBottom(),!0):(e.scrollTo(Math.max(0,r)),!1)}function uD(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return e.getScrollTop()+e.getPendingDelta()+t>=n?(e.scrollToBottom(),!0):(e.scrollBy(t),!1)}function dD(e,t){if(e.getScrollTop()+e.getPendingDelta()-t<=0){e.scrollTo(0);return}e.scrollBy(-t)}function fD(e,t){if(t.meta)return null;if(!t.ctrl&&!t.shift){if(t.upArrow)return`lineUp`;if(t.downArrow)return`lineDown`;if(t.home)return`top`;if(t.end)return`bottom`}if(t.ctrl){if(t.shift)return null;switch(e){case`u`:return`halfPageUp`;case`d`:return`halfPageDown`;case`b`:return`fullPageUp`;case`f`:return`fullPageDown`;case`n`:return`lineDown`;case`p`:return`lineUp`;default:return null}}let n=e[0];if(!n||e!==n.repeat(e.length))return null;if(n===`G`||n===`g`&&t.shift)return`bottom`;if(t.shift)return null;switch(n){case`g`:return`top`;case`j`:return`lineDown`;case`k`:return`lineUp`;case` `:return`fullPageDown`;case`b`:return`fullPageUp`;default:return null}}function pD(e,t,n){switch(t){case null:return null;case`lineUp`:case`lineDown`:{let r=t===`lineDown`?1:-1;return n(r),lD(e,r)}case`halfPageUp`:case`halfPageDown`:{let r=Math.max(1,Math.floor(e.getViewportHeight()/2)),i=t===`halfPageDown`?r:-r;return n(i),lD(e,i)}case`fullPageUp`:case`fullPageDown`:{let r=Math.max(1,e.getViewportHeight()),i=t===`fullPageDown`?r:-r;return n(i),lD(e,i)}case`top`:return n(-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(0),!1;case`bottom`:{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return n(t-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(t),e.scrollToBottom(),!0}}}ht(),Lc(),fe(),c(),H(),zs(),Rp(),tf(),Du(),a(),rd(),hs(),gi(),pf(),Dc(),Xf(),vf(),bs(),So(),vu(),mi(),uo(),no(),Au(),Zu(),ka(),Vu(),yl(),Jl(),Vm(),up(),ss(),Gp(),Y(),ml(),Sl(),Gc(),wr(),Al(),Jr(),Vl(),nr(),Rs(),$r();var mD=3e3;function hD({showAllInTranscript:e,virtualScroll:t,searchBadge:n,suppressShowAll:r=!1,status:i}){let a=oo(`app:toggleTranscript`,`Global`,`ctrl+o`),o=oo(`transcript:toggleShowAll`,`Transcript`,`ctrl+e`);return(0,$.jsxs)(g,{noSelect:!0,alignItems:`center`,alignSelf:`center`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,children:[(0,$.jsxs)(b,{dimColor:!0,children:[`Showing detailed transcript · `,a,` to toggle`,n?` · n/N to navigate`:t?` · ${l.arrowUp}${l.arrowDown} scroll · home/end top/bottom`:r?``:` · ${o} to ${e?`collapse`:`show all`}`]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{flexGrow:1}),(0,$.jsxs)(b,{children:[i,` `]})]}):n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{flexGrow:1}),(0,$.jsxs)(b,{dimColor:!0,children:[n.current,`/`,n.count,` `]})]}):null]})}function gD({jumpRef:e,count:t,current:n,onClose:r,onCancel:i,setHighlight:a,initialQuery:o}){let{query:s,cursorOffset:c}=um({isActive:!0,initialQuery:o,onExit:()=>r(s),onCancel:i}),[l,u]=Q.useState(`building`);Q.useEffect(()=>{let t=!0,n,r=e.current?.warmSearchIndex;if(!r){u(null);return}return u(`building`),r().then(e=>{t&&(e<20?u(null):(u({ms:e}),n=setTimeout(()=>t&&u(null),2e3)))}),()=>{t=!1,n&&clearTimeout(n)}},[e]);let d=l!==`building`;(0,Q.useEffect)(()=>{d&&(e.current?.setSearchQuery(s),a(s))},[e,s,a,d]);let f=c,p=f<s.length?s[f]:` `;return(0,$.jsxs)(g,{borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,noSelect:!0,children:[(0,$.jsx)(b,{children:`/`}),(0,$.jsx)(b,{children:s.slice(0,f)}),(0,$.jsx)(b,{inverse:!0,children:p}),f<s.length&&(0,$.jsx)(b,{children:s.slice(f+1)}),(0,$.jsx)(g,{flexGrow:1}),l===`building`?(0,$.jsx)(b,{dimColor:!0,children:`indexing… `}):l?(0,$.jsxs)(b,{dimColor:!0,children:[`indexed in `,l.ms,`ms `]}):t===0&&s?(0,$.jsx)(b,{color:`error`,children:`no matches `}):t>0?(0,$.jsxs)(b,{dimColor:!0,children:[n,`/`,t,` `]}):null]})}var _D=[`⠂`,`⠐`],vD=`✳`,yD=960;function bD({isAnimating:e,title:t,disabled:n,noPrefix:r}){let i=D(),[a,o]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(n||r||!e||!i)return;let t=setInterval(e=>e(e=>(e+1)%_D.length),yD,o);return()=>clearInterval(t)},[n,r,e,i]);let s=e?_D[a]??vD:vD;return k(n?null:r?t:`${s} ${t}`),null}var xD=`<${zu}>`;function SD(e){return e.type===`text`&&typeof e.text==`string`&&e.text.includes(xD)}function CD({commands:t,debug:n,initialTools:r,initialMessages:a,pendingHookMessages:o,initialFileHistorySnapshots:s,initialContentReplacements:c,initialAgentName:l,initialAgentColor:u,mcpClients:d,dynamicMcpConfig:f,strictMcpConfig:p=!1,systemPrompt:m,appendSystemPrompt:_,onBeforeQuery:v,onTurnComplete:y,disabled:S=!1,mainThreadAgentDefinition:C,disableSlashCommands:w=!1,taskListId:E,thinkingConfig:O}){let k=(0,Q.useMemo)(()=>i(process.env.WORKMATE_DISABLE_TERMINAL_TITLE),[]),A=(0,Q.useMemo)(()=>i(process.env.WORKMATE_DISABLE_VIRTUAL_SCROLL),[]);(0,Q.useMemo)(()=>i(process.env.WORKMATE_DISABLE_MESSAGE_ACTIONS),[]),(0,Q.useEffect)(()=>(X(`[REPL:mount] REPL mounted, disabled=${S}`),()=>X(`[REPL:unmount] REPL unmounting`)),[S]);let[M,P]=(0,Q.useState)(C),F=J(e=>e.toolPermissionContext),I=J(e=>e.verbose),L=J(e=>e.mcp),ee=J(e=>e.plugins),te=J(e=>e.agentDefinitions),z=J(e=>e.fileHistory),B=J(e=>e.initialMessage),re=mb(),V=J(e=>e.spinnerTip),oe=J(e=>e.expandedView)===`tasks`,H=J(e=>e.tasks),ce=J(e=>e.elicitation),le=J(e=>e.viewingAgentTaskId),U=xa(),ue=le?H[le]:void 0,de=cs(ue)&&ue.retain&&!ue.diskLoaded;(0,Q.useEffect)(()=>{if(!le||!de)return;let e=le;qt(Tl(e)).then(t=>{U(n=>{let r=n.tasks[e];if(!cs(r)||r.diskLoaded||!r.retain)return n;let i=r.messages??[],a=new Set(i.map(e=>e.uuid)),o=t?t.messages.filter(e=>!a.has(e.uuid)):[];return{...n,tasks:{...n.tasks,[e]:{...r,messages:[...o,...i],diskLoaded:!0}}}})})},[le,de,U]);let fe=oa(),pe=x(),me=Wp(),[he,ge]=(0,Q.useState)(t);cT(Ct(),ge);let _e=Q.useSyncExternalStore(fc,gr),ve=Q.useSyncExternalStore(fc,Wn),ye=(0,Q.useMemo)(()=>si(F),[F,_e]);PT();let[be,xe]=(0,Q.useState)(f),Se=(0,Q.useCallback)(e=>{xe(e)},[xe]),[Ce,we]=(0,Q.useState)(`prompt`),[Te,Ee]=(0,Q.useState)(!1),[De,Oe]=(0,Q.useState)(!1),[Ae,je]=(0,Q.useState)(``),Me=(0,Q.useRef)(0),Ne=(0,Q.useRef)(void 0),Pe=(0,Q.useRef)(!1),{addNotification:Fe,removeNotification:Ie}=ef(),Le=oT(d,L.clients);EE(),BT({mcpClients:Le}),gE(),_E(),mm(),xE(me),ME(),SE(me),wE(),ST(),kT(),UT();let{recommendation:Re,handleResponse:ze}=aE(),{recommendation:Be,handleResponse:Ve}=cE(),He=hE(),Ue=(0,Q.useMemo)(()=>[...ye,...r],[ye,r]);nf({enabled:!0});let We=ip();(0,Q.useEffect)(()=>{bE(U)},[U]);let Ge=Ip(Ue,L.tools,F),{tools:Ke,allowedAgentTypes:qe}=(0,Q.useMemo)(()=>{if(!M)return{tools:Ge,allowedAgentTypes:void 0};let e=vo(M,Ge,!1,!0);return{tools:e.resolvedTools,allowedAgentTypes:e.allowedAgentTypes}},[M,Ge]),Je=sT(sT(he,ee.commands),L.commands),Ye=(0,Q.useMemo)(()=>w?[]:Je,[w,Je]),[Xe,Ze]=(0,Q.useState)(`responding`),Qe=(0,Q.useRef)(Xe);Qe.current=Xe;let[$e,et]=(0,Q.useState)([]),[tt,nt]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(tt&&!tt.isStreaming&&tt.streamingEndedAt){let e=3e4-(Date.now()-tt.streamingEndedAt);if(e>0){let t=setTimeout(nt,e,null);return()=>clearTimeout(t)}else nt(null)}},[tt]);let[rt,it]=(0,Q.useState)(null),at=(0,Q.useRef)(null);at.current=rt;let ot=(0,Q.useRef)(0),[st,ct]=(0,Q.useState)(!1),lt=(0,Q.useRef)(()=>{}),ft=(0,Q.useRef)(null),pt=(0,Q.useRef)(null),ht=(0,Q.useRef)(0),xt=Q.useRef(new C_).current,wt=Q.useSyncExternalStore(xt.subscribe,xt.getSnapshot),[Tt,Dt]=Q.useState(!1),G=wt||Tt,[kt,At]=Q.useState(void 0),jt=Q.useRef(0),Nt=Q.useRef(!1),It=Q.useRef(0),Lt=Q.useRef(0),zt=Q.useRef(null),Vt=Q.useCallback(()=>{It.current=Date.now(),Lt.current=0,zt.current=null},[]),Ut=Q.useRef(!1);wt&&!Ut.current&&Vt(),Ut.current=wt;let Gt=Q.useCallback(e=>{Dt(e),e&&Vt()},[Vt]),Kt=Q.useRef(void 0),[Jt,Xt]=Q.useState(!1),[Qt,$t]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{Qt?.notifications&&Qt.notifications.forEach(e=>{Fe({key:`auto-updater-notification`,text:e,priority:`low`})})},[Qt,Fe]),(0,Q.useEffect)(()=>{hi()&&lr().then(e=>{e&&Fe({key:`tmux-mouse-hint`,text:e,priority:`low`})})},[]);let[en,tn]=(0,Q.useState)(null),nn=(0,Q.useRef)(null),rn=(0,Q.useCallback)(e=>{if(e?.isLocalJSXCommand){let{clearLocalJSX:t,...n}=e;nn.current={...n,isLocalJSXCommand:!0},tn(n);return}if(nn.current){if(e?.clearLocalJSX){nn.current=null,tn(null),ot.current=Date.now();return}return}if(e?.clearLocalJSX){tn(null);return}tn(e)},[]),[an,on]=(0,Q.useState)([]),[sn,cn]=(0,Q.useState)(null),[ln,un]=(0,Q.useState)([]),[dn,fn]=(0,Q.useState)([]),pn=J(e=>e.settings.terminalTitleFromRename)===!1?void 0:lc(Et()),[mn,gn]=(0,Q.useState)(),_n=(0,Q.useRef)((a?.length??0)>0),vn=M?.agentType,yn=pn??vn??mn??`Work Mate`,Sn=an.length>0||dn.length>0,wn=en?.isLocalJSXCommand===!0&&en?.jsx!=null,En=G&&!Sn&&!wn;(0,Q.useEffect)(()=>{if(G&&!Sn&&!wn)return g_(),()=>__()},[G,Sn,wn]);let Dn=Sn||wn?`waiting`:G?`busy`:`idle`,On=Dn===`waiting`?an.length>0?`approve ${an[0].tool.name}`:wn?`dialog open`:`input needed`:void 0;(0,Q.useEffect)(()=>{$c({status:Dn,waitingFor:On})},[Dn,On]),j(null);let[K,kn]=(0,Q.useState)(a??[]),An=(0,Q.useRef)(K),jn=(0,Q.useRef)(!1),q=(0,Q.useCallback)(e=>{let t=An.current,n=typeof e==`function`?e(An.current):e;if(An.current=n,n.length<jt.current)jt.current=0;else if(n.length>t.length&&Nt.current){let e=n.length-t.length;(t.length===0||n[0]===t[0]?n.slice(-e):n.slice(0,e)).some(Oo)?Nt.current=!1:jt.current=n.length}kn(n)},[]),Nn=(0,Q.useCallback)(e=>{e===void 0?Nt.current=!1:(jt.current=An.current.length,Nt.current=!0),At(e)},[]),{dividerIndex:Pn,dividerYRef:Rn,onScrollAway:zn,onRepin:Vn,jumpToNew:Hn,shiftDivider:Un}=Hm(K.length);CT(K,q,G);let[Gn,Kn]=(0,Q.useState)(null),qn=(0,Q.useRef)(null),Jn=(0,Q.useMemo)(()=>zm(K,Pn),[Pn,K.length]),Xn=(0,Q.useCallback)(()=>{ft.current?.scrollToBottom(),Vn(),Kn(null)},[Vn,Kn]),Zn=K.at(-1),Qn=Zn!=null&&Oo(Zn);(0,Q.useEffect)(()=>{Qn&&Xn()},[Qn,Zn,Xn]);let $n=(0,Q.useCallback)((e,t)=>{ht.current=Date.now(),e?Vn():zn(t)},[Vn,zn,U]),er=zw(o,q),tr=(0,Q.useDeferredValue)(Q.useMemo(()=>K.length>500?K.slice(-500):K,[K])),nr=K.length-tr.length;nr>0&&X(`[useDeferredValue] Messages deferred by ${nr} (${tr.length}→${K.length})`);let[rr,ir]=(0,Q.useState)(null),[or,sr]=(0,Q.useState)(()=>ih()),cr=(0,Q.useRef)(or);cr.current=or;let ur=(0,Q.useRef)(null),dr=(0,Q.useCallback)(e=>{cr.current===``&&e!==``&&Date.now()-ht.current>=mD&&Xn(),cr.current=e,sr(e),Xt(e.trim().length>0)},[Xt,Xn]);(0,Q.useEffect)(()=>{if(or.trim().length===0)return;let e=setTimeout(Xt,1500,!1);return()=>clearTimeout(e)},[or]);let[fr,pr]=(0,Q.useState)(`prompt`),[hr,_r]=(0,Q.useState)(),[yr,Sr]=(0,Q.useState)(new Set),Cr=(0,Q.useRef)(!1),[wr,Tr]=(0,Q.useState)({}),[Er,Dr]=(0,Q.useState)(0),kr=(0,Q.useRef)(0),Ar=(0,Q.useRef)([]),Mr=(0,Q.useCallback)(e=>{let t=kr.current;if(kr.current=e(t),kr.current>t){let e=Ar.current;if(e.length>0){let t=e.at(-1);t.lastTokenTime=Date.now(),t.endResponseLength=kr.current}}},[]),[Pr,Fr]=(0,Q.useState)(null),Ir=!(J(e=>e.settings.prefersReducedMotion)??!1)&&!se(),Rr=(0,Q.useCallback)(e=>{Ir&&Fr(e)},[Ir]),Br=Pr&&Ir&&Pr.substring(0,Pr.lastIndexOf(`
|
|
120
|
-
`)+1)||null,[Vr,Hr]=(0,Q.useState)(0),[Ur,Gr]=(0,Q.useState)(null),[Kr,qr]=(0,Q.useState)(null),[Jr,Yr]=(0,Q.useState)(null),[Zr,Qr]=(0,Q.useState)(!1),[$r,ei]=(0,Q.useState)(void 0),[ti,ni]=(0,Q.useState)(!1),[ri,ii]=(0,Q.useState)(_h()),[ai,oi]=(0,Q.useState)(null),ci=(0,Q.useRef)(!1),li=(0,Q.useRef)(Vr);li.current=Vr;let[di]=(0,Q.useState)(()=>({current:Xa(a,c)}));fl(()=>{di.current=Ys()});let[fi,pi]=(0,Q.useState)(Mu().hasAcknowledgedCostThreshold),[mi,gi]=(0,Q.useState)(`INSERT`),[_i,vi]=(0,Q.useState)(!1),[yi,bi]=(0,Q.useState)(!1),[xi,Si]=(0,Q.useState)(!1),Ci=D(),Ti=(0,Q.useRef)(Ci);Ti.current=Ci;let[Di]=h(),Oi=Q.useRef(!1),Ai=(0,Q.useCallback)(()=>{if(Oi.current)return;Oi.current=!0;let e=An.current.slice(qi.current);for(let t of Gi(e))Ki.current.add(t);qi.current=An.current.length,jT({theme:Di,readFileState:Wi.current,bashTools:Ki.current}).then(async e=>{if(e){let t=await e.content({theme:Di});U(e=>({...e,spinnerTip:t})),MT(e)}else U(e=>e.spinnerTip===void 0?e:{...e,spinnerTip:void 0})})},[U,Di]),ji=(0,Q.useCallback)(()=>{Gt(!1),Nn(void 0),kr.current=0,Ar.current=[],Fr(null),et([]),Gr(null),qr(null),Yr(null),Ai(),Jd(),Qs()},[Ai]),Mi=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(F.mode!==`auto`){Mi.current=!1;return}if(Mi.current||(Mu().autoPermissionsNotificationCount??0)>=3)return;let e=setTimeout((e,t)=>{e.current=!0,ju(e=>{let t=e.autoPermissionsNotificationCount??0;return t>=3?e:{...e,autoPermissionsNotificationCount:t+1}}),t(e=>[...e,ki(VT,`warning`)])},800,Mi,q);return()=>clearTimeout(e)},[F.mode,q]);let Ni=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(Ni.current)return;let e=Hl();if(!e?.creationDurationMs||e.usedSparsePaths||e.creationDurationMs<15e3)return;Ni.current=!0;let t=Math.round(e.creationDurationMs/1e3);q(e=>[...e,ki(`Worktree creation took ${t}s. For large repos, set \`worktree.sparsePaths\` in .workmate/settings.json to check out only the directories you need — e.g. \`{"worktree": {"sparsePaths": ["src", "packages/foo"]}}\`.`,`info`)])},[q]);let Pi=(0,Q.useMemo)(()=>{let e=K.findLast(e=>e.type===`assistant`);if(e?.type!==`assistant`)return!1;let t=e.message?.content,n=(Array.isArray(t)?t:[]).filter(e=>e.type===`tool_use`&&yr.has(e.id));return n.length>0&&n.every(e=>e.type===`tool_use`&&e.name===`Sleep`)},[K,yr]),{onBeforeQuery:Li,onTurnComplete:Ri,render:zi}=Pw({enabled:!1,setMessages:q,inputValue:or,setInputValue:dr,setToolJSX:rn}),Vi=(!en||en.showSpinner===!0)&&an.length===0&&dn.length===0&&(G||kt||ui()>0)&&!Pi&&!Br;an.length>0||dn.length>0||ln.length>0||ce.queue.length,FT(s,z,e=>U(t=>({...t,fileHistory:e})));let Hi=(0,Q.useCallback)(async(t,n,r)=>{let i=performance.now();try{let a=lf(n.messages),o=Eo();await Va(`resume`,{getAppState:()=>fe.getState(),setAppState:U,signal:AbortSignal.timeout(o),timeoutMs:o});let s=await ys(`resume`,{sessionId:t,agentType:M?.agentType,model:me});a.push(...s),r===`fork`?ws(n,Xi(t)):co(n,Xi(t)),Sp(n,U),n.fileHistorySnapshots&&Wt(n);let{agentDefinition:c}=bp(n.agentSetting,C,te);P(c),U(e=>({...e,agent:c?.agentType})),U(e=>({...e,standaloneAgentContext:xp(n.agentName,n.agentColor)})),ac(n.agentName),Qi(a,n.projectPath??Mt()),ji(),it(null),ii(t);let l=rs(t);if(vs(),yt(),dt(Xi(t),n.fullPath?lh(n.fullPath):null),await Ja(),Or(),Ei(n),n.goal){let{hydrateGoalFromTranscript:r}=(tl(),e(Go)),i=new Map;i.set(t,n.goal),r(i,t)}if(_n.current=!0,gn(void 0),r!==`fork`)Cp(),wp(n.worktreeSession),Ii();else{let e=Hl();e&&Kc(e)}l&>(l),di.current&&r!==`fork`&&(di.current=_l(a,n.contentReplacements??[])),q(()=>a),rn(null),dr(``),Math.round(performance.now()-i)}catch(e){throw e}},[ji,U]),[Ui]=(0,Q.useState)(()=>jr(100)),Wi=(0,Q.useRef)(Ui),Ki=(0,Q.useRef)(new Set),qi=(0,Q.useRef)(0),Ji=(0,Q.useRef)(new Set),Zi=(0,Q.useRef)(new Set),Qi=(0,Q.useCallback)((e,t)=>{let n=xn(e,t,100);Wi.current=br(Wi.current,n);for(let t of Gi(e))Ki.current.add(t)},[]);(0,Q.useEffect)(()=>{a&&a.length>0&&Qi(a,Mt())},[]);let{status:$i,reverify:ea}=Bw(),[ta,na]=(0,Q.useState)(null),[ra,ia]=(0,Q.useState)(!1),aa=!G&&ti;function sa(){if(ra||ta)return;if(Zr)return`message-selector`;if(Jt)return;if(ln[0])return`sandbox-permission`;let e=!en||en.shouldContinueAnimation;if(e&&an[0])return`tool-permission`;if(e&&dn[0])return`prompt`;if(e&&ce.queue[0])return`elicitation`;if(e&&aa)return`cost`;if(e&&ai)return`idle-return`;if(e&&Re)return`lsp-recommendation`;if(e&&Be)return`plugin-hint`;if(e&&He.visible)return`search-extra-tools-hint`}let ca=sa(),da=Jt&&(ln[0]||an[0]||dn[0]||ce.queue[0]||aa);Kt.current=ca,(0,Q.useEffect)(()=>{if(!G)return;let e=ca===`tool-permission`,t=Date.now();e&&zt.current===null?zt.current=t:!e&&zt.current!==null&&(Lt.current+=t-zt.current,zt.current=null)},[ca,G]);let fa=(0,Q.useRef)(ca);(0,Q.useLayoutEffect)(()=>{fa.current===`tool-permission`!=(ca===`tool-permission`)&&Xn(),fa.current=ca},[ca,Xn]);function pa(){if(ca!==`elicitation`){if(ot.current!==0&&Date.now()-ot.current<500){ot.current=0,X(`[onCancel] suppressed: local-jsx panel just dismissed`);return}if(ot.current=0,X(`[onCancel] focusedInputDialog=${ca} streamMode=${Xe}`),Da(),xt.getSnapshot()){let{getGoal:t,pauseGoal:n}=(es(),e(dl)),{persistCurrentGoal:r}=(tl(),e(Go));t()?.status===`active`&&(n(),r())}if(ct(!0),xt.forceEnd(),ci.current=!1,Pr?.trim()&&q(e=>[...e,Nc({content:Pr})]),ji(),bt(null),ca===`tool-permission`)an[0]?.onAbort(),on([]);else if(ca===`prompt`){for(let e of dn)e.reject(Error(`Prompt cancelled by user`));fn([]),rt?.abort(`user-cancel`)}else rt?.abort(`user-cancel`);it(null),Ri(An.current,!0)}}let Y=(0,Q.useCallback)(()=>{let e=mr(or,0);e&&(dr(e.text),pr(`prompt`),e.images.length>0&&Tr(t=>{let n={...t};for(let t of e.images)n[t.id]=t;return n}))},[dr,pr,or,Tr]),ma={setToolUseConfirmQueue:on,onCancel:pa,onAgentsKilled:()=>q(e=>[...e,Yn()]),isMessageSelectorVisible:Zr||!!_i,screen:Ce,abortSignal:rt?.signal,popCommandFromQueue:Y,vimMode:mi,isLocalJSXCommand:en?.isLocalJSXCommand,isSearchingHistory:yi,isHelpOpen:xi,inputMode:fr,inputValue:or,streamMode:Xe};(0,Q.useEffect)(()=>{Ot()>=5&&!ti&&!fi&&(pi(!0),Fw()&&ni(!0))},[K,ti,fi]);let ha=(0,Q.useCallback)(async e=>new Promise(t=>{let n=!1;function r(e){n||(n=!0,t(e))}un(t=>[...t,{hostPattern:e,resolvePromise:r}])}),[U,fe]);(0,Q.useEffect)(()=>{let e=Uc.getSandboxUnavailableReason();if(e){if(Uc.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${e}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),eo(1,`other`);return}X(`sandbox disabled: ${e}`,{level:`warn`}),Fe({key:`sandbox-unavailable`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{color:`warning`,children:`sandbox disabled`}),(0,$.jsx)(b,{dimColor:!0,children:` · /sandbox`})]}),priority:`medium`})}},[Fe]),Uc.isSandboxingEnabled()&&Uc.initialize(ha).catch(e=>{process.stderr.write(`\n❌ Sandbox Error: ${yu(e)}\n`),eo(1,`other`)});let ga=(0,Q.useCallback)((e,t)=>{U(n=>({...n,toolPermissionContext:{...e,mode:t?.preserveMode?n.toolPermissionContext.mode:e.mode}})),setImmediate(e=>{e(e=>(e.forEach(e=>{e.recheckPermission()}),e))},on)},[U,on]),va=Qw(on,ga),ba=(0,Q.useCallback)((e,t,r,i)=>{let a=fe.getState(),o=()=>{let e=fe.getState(),t=Yi(e.toolPermissionContext,e.mcp.tools),n=sf(Ue,t,e.toolPermissionContext.mode);return M?vo(M,n,!1,!0).resolvedTools:n};return{abortController:r,options:{commands:Ye,tools:o(),debug:n,verbose:a.verbose,mainLoopModel:i,thinkingConfig:a.thinkingEnabled===!1?{type:`disabled`}:O,mcpClients:aT(d,a.mcp.clients),mcpResources:a.mcp.resources,isNonInteractiveSession:!1,dynamicMcpConfig:be,theme:Di,agentDefinitions:qe?{...a.agentDefinitions,allowedAgentTypes:qe}:a.agentDefinitions,customSystemPrompt:m,appendSystemPrompt:_,refreshTools:o},getAppState:()=>fe.getState(),setAppState:U,messages:e,setMessages:q,updateFileHistoryState(e){U(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState(e){U(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},openMessageSelector:()=>{S||Qr(!0)},onChangeAPIKey:ea,readFileState:Wi.current,setToolJSX:rn,addNotification:Fe,appendSystemMessage:e=>q(t=>[...t,e]),sendOSNotification:e=>{i_(e,pe)},onChangeDynamicMcpConfig:Se,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:Zi.current,dynamicSkillDirTriggers:new Set,discoveredSkillNames:Ji.current,setResponseLength:Mr,pushApiMetricsEntry:void 0,setStreamMode:Ze,onCompactProgress:e=>{switch(e.type){case`hooks_start`:qr(`workmateBlue_FOR_SYSTEM_SPINNER`),Yr(`workmateBlueShimmer_FOR_SYSTEM_SPINNER`),Gr(e.hookType===`pre_compact`?`Running PreCompact hooks…`:e.hookType===`post_compact`?`Running PostCompact hooks…`:`Running SessionStart hooks…`);break;case`compact_start`:Gr(`Compacting conversation`);break;case`compact_end`:Gr(null),qr(null),Yr(null);break}},setInProgressToolUseIDs:Sr,setHasInterruptibleToolInProgress:e=>{Cr.current=e},resume:Hi,setConversationId:ii,requestPrompt:void 0,contentReplacementState:di.current}},[Ye,Ue,M,n,d,be,Di,qe,fe,U,ea,Fe,q,Se,Hi,(0,Q.useCallback)((e,t)=>n=>new Promise((r,i)=>{fn(a=>[...a,{request:n,title:e,toolInputSummary:t,resolve:r,reject:i}])}),[]),S,m,_,ii]),{handleBackgroundSession:Sa}=bT({setMessages:q,setIsLoading:Gt,resetLoadingState:ji,setAbortController:it,onBackgroundQuery:(0,Q.useCallback)(()=>{rt?.abort(`background`);let e=zr(e=>e.mode===`task-notification`);(async()=>{let t=ba(An.current,[],new AbortController,me),[n,r,i]=await Promise.all([ko(t.options.tools,me,Array.from(F.additionalWorkingDirectories.keys()),t.options.mcpClients),Nr(),ar()]),a=Xr({mainThreadAgentDefinition:M,toolUseContext:t,customSystemPrompt:m,defaultSystemPrompt:n,appendSystemPrompt:_});t.renderedSystemPrompt=a;let o=(await uc(e).catch(()=>[])).map(qo),s=new Set;for(let e of An.current)e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode===`task-notification`&&typeof e.attachment.prompt==`string`&&s.add(e.attachment.prompt);let c=o.filter(e=>e.attachment.type===`queued_command`&&(typeof e.attachment.prompt!=`string`||!s.has(e.attachment.prompt)));Ll({messages:[...An.current,...c],queryParams:{systemPrompt:a,userContext:r,systemContext:i,canUseTool:va,toolUseContext:t,querySource:Bn()},description:yn,setAppState:U,agentDefinition:M})})()},[rt,me,F,M,ba,m,_,va,U])}),Ca=(0,Q.useCallback)(t=>{Ga(t,t=>{if(ua(t)?(hi()?q(e=>{let n=hn(e,{includeSnipped:!0});return[...n.length>500?n.slice(-500):n,t]}):q(()=>[t]),ii(_h()),Ht(!1)):t.type===`progress`&&Bl(t.data?.type)?q(e=>{let n=t.data;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.type!==`progress`)break;let a=i.data;if(i.parentToolUseID===t.parentToolUseID&&a?.type===n.type){let n=e.slice();return n[r]=t,n}}return[...e,t]}):q(e=>[...e,t]),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage?Ht(!0):t.type===`assistant`&&Ht(!1),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage){let n=(Bi(t.message?.content??``)??``).toLowerCase();if(n.includes(`connection error`)||n.includes(`fetch failed`)||n.includes(`network error`)||n.includes(`enotfound`)||n.includes(`econnreset`)||n.includes(`etimedout`)){let{getGoal:t,pauseGoal:n}=(es(),e(dl)),{persistCurrentGoal:r}=(tl(),e(Go));t()?.status===`active`&&(n(),r(),Fe({key:`goal-auto-paused-connectivity-error`,text:`Detected connection error. Active goal was auto-paused. Run /goal resume after network recovers.`,priority:`immediate`}))}}},e=>{Mr(t=>t+e.length)},Ze,et,e=>{q(t=>t.filter(t=>t!==e)),vr(e.uuid)},nt,e=>{let t=Date.now(),n=kr.current;Ar.current.push({...e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})},Rr)},[q,Mr,Ze,et,nt,Rr]),Ta=(0,Q.useCallback)(async(e,t,n,r,i,a)=>{if(r){let e=aT(d,fe.getState().mcp.clients);Cn.handleQueryStart(e)}if(Ld(),!k&&!pn&&!vn&&!_n.current){let e=t.find(e=>e.type===`user`&&!e.isMeta),n=e?.type===`user`?Bi(e.message.content):null;n&&!n.startsWith(`<local-command-stdout>`)&&!n.startsWith(`<command-message>`)&&!n.startsWith(`<command-name>`)&&!n.startsWith(`<bash-input>`)&&(_n.current=!0,gp(n,new AbortController().signal).then(e=>{e?gn(e):_n.current=!1},()=>{_n.current=!1}))}if(fe.setState(e=>{let t=e.toolPermissionContext.alwaysAllowRules.command;return t===i||t?.length===i.length&&t.every((e,t)=>e===i[t])?e:{...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:i}}}}),!r){t.some(ua)&&(ii(_h()),Ht(!1)),ji(),it(null);return}let o=ba(e,t,n,a),{tools:s,mcpClients:c}=o.options;Il(`query_context_loading_start`);let[,,l,u,f]=await Promise.all([void 0,NT(F,U,fe.getState().fastMode),ko(s,a,Array.from(F.additionalWorkingDirectories.keys()),c),Nr(),ar()]),p={...u,...gr()&&!Ti.current?{terminalFocus:`The terminal is unfocused — the user is not actively watching.`}:{}};Il(`query_context_loading_end`);let h=Xr({mainThreadAgentDefinition:M,toolUseContext:o,customSystemPrompt:m,defaultSystemPrompt:l,appendSystemPrompt:_});o.renderedSystemPrompt=h,Il(`query_query_start`),ut(),mt(),St();for await(let t of Ma({messages:e,systemPrompt:h,userContext:p,systemContext:f,canUseTool:va,toolUseContext:o,querySource:Bn()}))Ca(t);Il(`query_end`),ji(),mo(),await y?.(An.current)},[d,ji,ba,F,U,m,y,_,va,M,Ca,pn,k]),Ea=(0,Q.useCallback)(async(e,t,n,r,i,a,o)=>{let s=xt.tryStart();if(s===null)return e.filter(e=>e.type===`user`&&!e.isMeta).map(e=>Bi(e.message.content)).filter(e=>e!==null).forEach((e,t)=>{Mn({value:e,mode:`prompt`})}),!1;try{ct(!1),Vt(),q(t=>[...t,...e]),kr.current=0,bt((o?xs(o):null)??Ft()),Ar.current=[],et([]),Fr(null);let s=An.current;if(o&&await Li(o,s,e.length),a&&o&&!await a(o,s))return!0;await Ta(s,e,t,n,r,i)}finally{if(xt.end(s)){ct(t.signal.aborted),Hr(Date.now()),ci.current=!1,ji(),await Ri(An.current,t.signal.aborted);let e;Ft()!==null&&Ft()>0&&!t.signal.aborted&&(e={tokens:_t(),limit:Ft(),nudges:Rt()}),bt(null);let n=Date.now()-It.current-Lt.current;(n>3e4||e!==void 0)&&!t.signal.aborted&&!_e&&q(t=>[...t,Zt(n,e,ke(t,bn))]),it(null)}if(t.signal.reason===`user-cancel`&&!xt.isActive&&cr.current===``&&ui()===0&&!fe.getState().viewingAgentTaskId){let e=An.current,t=e.findLast(uf);t&&df(e,e.lastIndexOf(t))&&(Qf(),lt.current(t))}}return!0},[Ta,U,ji,xt,Li,Ri]),Oa=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=B;if(!e||G||Oa.current)return;Oa.current=!0;async function t(e){if(e.clearContext){let t=e.message.planContent?Ao():void 0,{clearConversation:n}=await import(`./conversation-CCV0BYD_.js`);await n({setMessages:q,readFileState:Wi.current,discoveredSkillNames:Ji.current,loadedNestedMemoryPaths:Zi.current,getAppState:()=>fe.getState(),setAppState:U,setConversationId:ii}),_n.current=!1,gn(void 0),Ki.current.clear(),qi.current=0,t&&Ho(Et(),t)}U(t=>{let n=e.mode?Wr(t.toolPermissionContext,_y(e.mode,e.allowedPrompts)):t.toolPermissionContext;return e.mode===`auto`&&(n=Ms({...n,mode:`auto`,prePlanMode:void 0})),{...t,initialMessage:null,toolPermissionContext:n}}),el()&&Cs(e=>{U(t=>({...t,fileHistory:e(t.fileHistory)}))},e.message.uuid),await er();let t=e.message.message.content;if(typeof t==`string`&&!e.message.planContent)ka(t,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}});else{let t=_a();it(t),Ea([e.message],t,!0,[],me)}setTimeout(e=>{e.current=!1},100,Oa)}t(e)},[B,G,q,U,Ea,me,Ke]);let ka=(0,Q.useCallback)(async(e,t,n,r)=>{if(Xn(),wi(),!n&&e.trim().startsWith(`/`)){let n=qf(e,wr).trim(),i=n.indexOf(` `),a=i===-1?n.slice(1):n.slice(1,i),o=i===-1?``:n.slice(i+1).trim(),s=Ye.find(e=>Lr(e)&&(e.name===a||e.aliases?.includes(a)||In(e)===a));s?.name===`clear`&&jn.current&&(jn.current,Math.round((Date.now()-li.current)/6e4),An.current.length,Pt(),jn.current=!1);let c=xt.isActive&&(s?.immediate||r?.fromKeybinding);if(s&&c&&s.type===`local-jsx`){e.trim()===cr.current.trim()&&(dr(``),t.setCursorOffset(0),t.clearBuffer(),Tr({}));let n=Kf(e).filter(e=>wr[e.id]?.type===`text`);n.length,n.reduce((e,t)=>e+(wr[t.id]?.content.length??0),0),s.name,r?.fromKeybinding,(async()=>{let e=!1,n=(n,r)=>{e=!0,rn({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0});let i=[];if(n&&r?.display!==`skip`&&(Fe({key:`immediate-${s.name}`,text:n,priority:`immediate`}),!hi())){let e=r?.displayArgs??o;i.push(xr(rc(In(s),e)),xr(`<${Fu}>${Tn(n)}</${Fu}>`))}r?.metaMessages?.length&&i.push(...r.metaMessages.map(e=>Qc({content:e,isMeta:!0}))),i.length&&q(e=>[...e,...i]),hr!==void 0&&(dr(hr.text),t.setCursorOffset(hr.cursorOffset),Tr(hr.pastedContents),_r(void 0))},r=ba(An.current,[],_a(),me),i=await(await s.load()).call(n,r,o);i&&!e&&rn({jsx:i,shouldHidePromptInput:!1,isLocalJSXCommand:!0})})();return}}Number(process.env.WORKMATE_IDLE_THRESHOLD_MINUTES??75),Number(process.env.WORKMATE_IDLE_TOKEN_THRESHOLD??1e5),r?.fromKeybinding||(Zf({display:n?e:Lf(e,fr),pastedContents:n?{}:wr}),fr===`bash`&&ux(e.trim()));let i=!n&&e.trim().startsWith(`/`),a=!G||n;if(hr!==void 0&&!i&&a?(dr(hr.text),t.setCursorOffset(hr.cursorOffset),Tr(hr.pastedContents),_r(void 0)):a&&(r?.fromKeybinding||(dr(``),t.setCursorOffset(0)),Tr({})),a&&(pr(`prompt`),Dr(e=>e+1),t.clearBuffer(),Oi.current=!1,!i&&fr===`prompt`&&!n&&(Nn(e),Vt()),U(e=>({...e,attribution:Zs(e.attribution,e=>{lu(e).catch(e=>{X(`Attribution: Failed to save snapshot: ${e}`)})})}))),n){let{queryRequired:t}=await yo(n.state,n.speculationSessionTimeSavedMs,n.setAppState,e,{setMessages:q,readFileState:Wi,cwd:Mt()});if(t){let e=_a();it(e),Ea([],e,!0,[],me)}return}await er(),await eT({input:e,helpers:t,queryGuard:xt,isExternalLoading:Tt,mode:fr,commands:Ye,onInputChange:dr,setPastedContents:Tr,setToolJSX:rn,getToolUseContext:ba,messages:An.current,mainLoopModel:me,pastedContents:wr,setUserInputOnProcessing:Nn,setAbortController:it,abortController:rt,onQuery:Ea,setAppState:U,querySource:Bn(),onBeforeQuery:v,canUseTool:va,addNotification:Fe,setMessages:q,streamMode:Qe.current,hasInterruptibleToolInProgress:Cr.current}),(i||G)&&hr!==void 0&&(dr(hr.text),t.setCursorOffset(hr.cursorOffset),Tr(hr.pastedContents),_r(void 0))},[xt,G,Tt,fr,Ye,dr,pr,Tr,Dr,rn,ba,me,wr,Nn,it,Fe,Ea,hr,_r,U,v,va,q,er,Xn]),Aa=(0,Q.useRef)(ka);Aa.current=ka;let ja=(0,Q.useCallback)(async()=>{if(ia(!0),Yt()){bh(`tmux`,[`detach-client`],{stdio:`ignore`}),ia(!1);return}if(Hl()!==null){na((0,$.jsx)(ym,{showWorktree:!0,onDone:()=>{},onCancel:()=>{na(null),ia(!1)}}));return}let e=await(await Fi.load()).call(()=>{});na(e),e===null&&ia(!1)},[]),Na=(0,Q.useCallback)(()=>{Qr(e=>!e)},[]),Fa=(0,Q.useCallback)(e=>{let t=An.current,n=t.lastIndexOf(e);if(n===-1)return;t.length,t.length-n,q(t.slice(0,n)),ii(_h()),ya();let r=e.permissionMode;U(e=>({...e,toolPermissionContext:r&&e.toolPermissionContext.mode!==r?{...e.toolPermissionContext,mode:r}:e.toolPermissionContext,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null}}))},[q,U]),Ia=(0,Q.useCallback)(e=>{Fa(e);let t=wa(e);if(t&&(dr(t.text),pr(t.mode)),Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`image`)){let t=e.message.content.filter(e=>e.type===`image`);if(t.length>0){let n={};t.forEach((t,r)=>{if(t.source.type===`base64`){let i=e.imagePasteIds?.[r]??r+1;n[i]={id:i,type:`image`,content:t.source.data,mediaType:t.source.media_type}}}),Tr(n)}}},[Fa,dr]);lt.current=Ia;let La=(0,Q.useCallback)(async e=>{setImmediate((e,t)=>e(t),Ia,e)},[Ia]),Ra=e=>{let t=e.slice(0,24);return K.findIndex(e=>e.uuid.slice(0,24)===t)},{enter:za,handlers:Ba}=ic(Gn,Kn,qn,{copy:e=>void R(e).then(e=>{e&&process.stdout.write(e),Fe({key:`selection-copied`,text:`copied`,color:`success`,priority:`immediate`,timeoutMs:2e3})}),edit:async e=>{let t=Ra(e.uuid),n=t>=0?K[t]:void 0;if(!n||!uf(n))return;let r=!await zc(z,n.uuid),i=df(K,t);r&&i?(pa(),La(n)):(ei(n),Qr(!0))}});async function Ha(){ea();let e=await Ls();if(e.length>0){let t=e.map(e=>` [${e.type}] ${e.path} (${e.content.length} chars)${e.parent?` (included by ${e.parent})`:``}`).join(`
|
|
120
|
+
`)+1)||null,[Vr,Hr]=(0,Q.useState)(0),[Ur,Gr]=(0,Q.useState)(null),[Kr,qr]=(0,Q.useState)(null),[Jr,Yr]=(0,Q.useState)(null),[Zr,Qr]=(0,Q.useState)(!1),[$r,ei]=(0,Q.useState)(void 0),[ti,ni]=(0,Q.useState)(!1),[ri,ii]=(0,Q.useState)(_h()),[ai,oi]=(0,Q.useState)(null),ci=(0,Q.useRef)(!1),li=(0,Q.useRef)(Vr);li.current=Vr;let[di]=(0,Q.useState)(()=>({current:Xa(a,c)}));fl(()=>{di.current=Ys()});let[fi,pi]=(0,Q.useState)(Mu().hasAcknowledgedCostThreshold),[mi,gi]=(0,Q.useState)(`INSERT`),[_i,vi]=(0,Q.useState)(!1),[yi,bi]=(0,Q.useState)(!1),[xi,Si]=(0,Q.useState)(!1),Ci=D(),Ti=(0,Q.useRef)(Ci);Ti.current=Ci;let[Di]=h(),Oi=Q.useRef(!1),Ai=(0,Q.useCallback)(()=>{if(Oi.current)return;Oi.current=!0;let e=An.current.slice(qi.current);for(let t of Gi(e))Ki.current.add(t);qi.current=An.current.length,jT({theme:Di,readFileState:Wi.current,bashTools:Ki.current}).then(async e=>{if(e){let t=await e.content({theme:Di});U(e=>({...e,spinnerTip:t})),MT(e)}else U(e=>e.spinnerTip===void 0?e:{...e,spinnerTip:void 0})})},[U,Di]),ji=(0,Q.useCallback)(()=>{Gt(!1),Nn(void 0),kr.current=0,Ar.current=[],Fr(null),et([]),Gr(null),qr(null),Yr(null),Ai(),Jd(),Qs()},[Ai]),Mi=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(F.mode!==`auto`){Mi.current=!1;return}if(Mi.current||(Mu().autoPermissionsNotificationCount??0)>=3)return;let e=setTimeout((e,t)=>{e.current=!0,ju(e=>{let t=e.autoPermissionsNotificationCount??0;return t>=3?e:{...e,autoPermissionsNotificationCount:t+1}}),t(e=>[...e,ki(VT,`warning`)])},800,Mi,q);return()=>clearTimeout(e)},[F.mode,q]);let Ni=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(Ni.current)return;let e=Hl();if(!e?.creationDurationMs||e.usedSparsePaths||e.creationDurationMs<15e3)return;Ni.current=!0;let t=Math.round(e.creationDurationMs/1e3);q(e=>[...e,ki(`Worktree creation took ${t}s. For large repos, set \`worktree.sparsePaths\` in .workmate/settings.json to check out only the directories you need — e.g. \`{"worktree": {"sparsePaths": ["src", "packages/foo"]}}\`.`,`info`)])},[q]);let Pi=(0,Q.useMemo)(()=>{let e=K.findLast(e=>e.type===`assistant`);if(e?.type!==`assistant`)return!1;let t=e.message?.content,n=(Array.isArray(t)?t:[]).filter(e=>e.type===`tool_use`&&yr.has(e.id));return n.length>0&&n.every(e=>e.type===`tool_use`&&e.name===`Sleep`)},[K,yr]),{onBeforeQuery:Li,onTurnComplete:Ri,render:zi}=Pw({enabled:!1,setMessages:q,inputValue:or,setInputValue:dr,setToolJSX:rn}),Vi=(!en||en.showSpinner===!0)&&an.length===0&&dn.length===0&&(G||kt||ui()>0)&&!Pi&&!Br;an.length>0||dn.length>0||ln.length>0||ce.queue.length,FT(s,z,e=>U(t=>({...t,fileHistory:e})));let Hi=(0,Q.useCallback)(async(t,n,r)=>{let i=performance.now();try{let a=lf(n.messages),o=Eo();await Va(`resume`,{getAppState:()=>fe.getState(),setAppState:U,signal:AbortSignal.timeout(o),timeoutMs:o});let s=await ys(`resume`,{sessionId:t,agentType:M?.agentType,model:me});a.push(...s),r===`fork`?ws(n,Xi(t)):co(n,Xi(t)),Sp(n,U),n.fileHistorySnapshots&&Wt(n);let{agentDefinition:c}=bp(n.agentSetting,C,te);P(c),U(e=>({...e,agent:c?.agentType})),U(e=>({...e,standaloneAgentContext:xp(n.agentName,n.agentColor)})),ac(n.agentName),Qi(a,n.projectPath??Mt()),ji(),it(null),ii(t);let l=rs(t);if(vs(),yt(),dt(Xi(t),n.fullPath?lh(n.fullPath):null),await Ja(),Or(),Ei(n),n.goal){let{hydrateGoalFromTranscript:r}=(tl(),e(Go)),i=new Map;i.set(t,n.goal),r(i,t)}if(_n.current=!0,gn(void 0),r!==`fork`)Cp(),wp(n.worktreeSession),Ii();else{let e=Hl();e&&Kc(e)}l&>(l),di.current&&r!==`fork`&&(di.current=_l(a,n.contentReplacements??[])),q(()=>a),rn(null),dr(``),Math.round(performance.now()-i)}catch(e){throw e}},[ji,U]),[Ui]=(0,Q.useState)(()=>jr(100)),Wi=(0,Q.useRef)(Ui),Ki=(0,Q.useRef)(new Set),qi=(0,Q.useRef)(0),Ji=(0,Q.useRef)(new Set),Zi=(0,Q.useRef)(new Set),Qi=(0,Q.useCallback)((e,t)=>{let n=xn(e,t,100);Wi.current=br(Wi.current,n);for(let t of Gi(e))Ki.current.add(t)},[]);(0,Q.useEffect)(()=>{a&&a.length>0&&Qi(a,Mt())},[]);let{status:$i,reverify:ea}=Bw(),[ta,na]=(0,Q.useState)(null),[ra,ia]=(0,Q.useState)(!1),aa=!G&&ti;function sa(){if(ra||ta)return;if(Zr)return`message-selector`;if(Jt)return;if(ln[0])return`sandbox-permission`;let e=!en||en.shouldContinueAnimation;if(e&&an[0])return`tool-permission`;if(e&&dn[0])return`prompt`;if(e&&ce.queue[0])return`elicitation`;if(e&&aa)return`cost`;if(e&&ai)return`idle-return`;if(e&&Re)return`lsp-recommendation`;if(e&&Be)return`plugin-hint`;if(e&&He.visible)return`search-extra-tools-hint`}let ca=sa(),da=Jt&&(ln[0]||an[0]||dn[0]||ce.queue[0]||aa);Kt.current=ca,(0,Q.useEffect)(()=>{if(!G)return;let e=ca===`tool-permission`,t=Date.now();e&&zt.current===null?zt.current=t:!e&&zt.current!==null&&(Lt.current+=t-zt.current,zt.current=null)},[ca,G]);let fa=(0,Q.useRef)(ca);(0,Q.useLayoutEffect)(()=>{fa.current===`tool-permission`!=(ca===`tool-permission`)&&Xn(),fa.current=ca},[ca,Xn]);function pa(){if(ca!==`elicitation`){if(ot.current!==0&&Date.now()-ot.current<500){ot.current=0,X(`[onCancel] suppressed: local-jsx panel just dismissed`);return}if(ot.current=0,X(`[onCancel] focusedInputDialog=${ca} streamMode=${Xe}`),Da(),xt.getSnapshot()){let{getGoal:t,pauseGoal:n}=(es(),e(dl)),{persistCurrentGoal:r}=(tl(),e(Go));t()?.status===`active`&&(n(),r())}if(ct(!0),xt.forceEnd(),ci.current=!1,Pr?.trim()&&q(e=>[...e,Nc({content:Pr})]),ji(),bt(null),ca===`tool-permission`)an[0]?.onAbort(),on([]);else if(ca===`prompt`){for(let e of dn)e.reject(Error(`Prompt cancelled by user`));fn([]),rt?.abort(`user-cancel`)}else rt?.abort(`user-cancel`);it(null),Ri(An.current,!0)}}let Y=(0,Q.useCallback)(()=>{let e=mr(or,0);e&&(dr(e.text),pr(`prompt`),e.images.length>0&&Tr(t=>{let n={...t};for(let t of e.images)n[t.id]=t;return n}))},[dr,pr,or,Tr]),ma={setToolUseConfirmQueue:on,onCancel:pa,onAgentsKilled:()=>q(e=>[...e,Yn()]),isMessageSelectorVisible:Zr||!!_i,screen:Ce,abortSignal:rt?.signal,popCommandFromQueue:Y,vimMode:mi,isLocalJSXCommand:en?.isLocalJSXCommand,isSearchingHistory:yi,isHelpOpen:xi,inputMode:fr,inputValue:or,streamMode:Xe};(0,Q.useEffect)(()=>{Ot()>=5&&!ti&&!fi&&(pi(!0),Fw()&&ni(!0))},[K,ti,fi]);let ha=(0,Q.useCallback)(async e=>new Promise(t=>{let n=!1;function r(e){n||(n=!0,t(e))}un(t=>[...t,{hostPattern:e,resolvePromise:r}])}),[U,fe]);(0,Q.useEffect)(()=>{let e=Uc.getSandboxUnavailableReason();if(e){if(Uc.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${e}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),eo(1,`other`);return}X(`sandbox disabled: ${e}`,{level:`warn`}),Fe({key:`sandbox-unavailable`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{color:`warning`,children:`sandbox disabled`}),(0,$.jsx)(b,{dimColor:!0,children:` · /sandbox`})]}),priority:`medium`})}},[Fe]),Uc.isSandboxingEnabled()&&Uc.initialize(ha).catch(e=>{process.stderr.write(`\n❌ Sandbox Error: ${yu(e)}\n`),eo(1,`other`)});let ga=(0,Q.useCallback)((e,t)=>{U(n=>({...n,toolPermissionContext:{...e,mode:t?.preserveMode?n.toolPermissionContext.mode:e.mode}})),setImmediate(e=>{e(e=>(e.forEach(e=>{e.recheckPermission()}),e))},on)},[U,on]),va=Qw(on,ga),ba=(0,Q.useCallback)((e,t,r,i)=>{let a=fe.getState(),o=()=>{let e=fe.getState(),t=Yi(e.toolPermissionContext,e.mcp.tools),n=sf(Ue,t,e.toolPermissionContext.mode);return M?vo(M,n,!1,!0).resolvedTools:n};return{abortController:r,options:{commands:Ye,tools:o(),debug:n,verbose:a.verbose,mainLoopModel:i,thinkingConfig:a.thinkingEnabled===!1?{type:`disabled`}:O,mcpClients:aT(d,a.mcp.clients),mcpResources:a.mcp.resources,isNonInteractiveSession:!1,dynamicMcpConfig:be,theme:Di,agentDefinitions:qe?{...a.agentDefinitions,allowedAgentTypes:qe}:a.agentDefinitions,customSystemPrompt:m,appendSystemPrompt:_,refreshTools:o},getAppState:()=>fe.getState(),setAppState:U,messages:e,setMessages:q,updateFileHistoryState(e){U(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState(e){U(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},openMessageSelector:()=>{S||Qr(!0)},onChangeAPIKey:ea,readFileState:Wi.current,setToolJSX:rn,addNotification:Fe,appendSystemMessage:e=>q(t=>[...t,e]),sendOSNotification:e=>{i_(e,pe)},onChangeDynamicMcpConfig:Se,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:Zi.current,dynamicSkillDirTriggers:new Set,discoveredSkillNames:Ji.current,setResponseLength:Mr,pushApiMetricsEntry:void 0,setStreamMode:Ze,onCompactProgress:e=>{switch(e.type){case`hooks_start`:qr(`workmateBlue_FOR_SYSTEM_SPINNER`),Yr(`workmateBlueShimmer_FOR_SYSTEM_SPINNER`),Gr(e.hookType===`pre_compact`?`Running PreCompact hooks…`:e.hookType===`post_compact`?`Running PostCompact hooks…`:`Running SessionStart hooks…`);break;case`compact_start`:Gr(`Compacting conversation`);break;case`compact_end`:Gr(null),qr(null),Yr(null);break}},setInProgressToolUseIDs:Sr,setHasInterruptibleToolInProgress:e=>{Cr.current=e},resume:Hi,setConversationId:ii,requestPrompt:void 0,contentReplacementState:di.current}},[Ye,Ue,M,n,d,be,Di,qe,fe,U,ea,Fe,q,Se,Hi,(0,Q.useCallback)((e,t)=>n=>new Promise((r,i)=>{fn(a=>[...a,{request:n,title:e,toolInputSummary:t,resolve:r,reject:i}])}),[]),S,m,_,ii]),{handleBackgroundSession:Sa}=bT({setMessages:q,setIsLoading:Gt,resetLoadingState:ji,setAbortController:it,onBackgroundQuery:(0,Q.useCallback)(()=>{rt?.abort(`background`);let e=zr(e=>e.mode===`task-notification`);(async()=>{let t=ba(An.current,[],new AbortController,me),[n,r,i]=await Promise.all([ko(t.options.tools,me,Array.from(F.additionalWorkingDirectories.keys()),t.options.mcpClients),Nr(),ar()]),a=Xr({mainThreadAgentDefinition:M,toolUseContext:t,customSystemPrompt:m,defaultSystemPrompt:n,appendSystemPrompt:_});t.renderedSystemPrompt=a;let o=(await uc(e).catch(()=>[])).map(qo),s=new Set;for(let e of An.current)e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode===`task-notification`&&typeof e.attachment.prompt==`string`&&s.add(e.attachment.prompt);let c=o.filter(e=>e.attachment.type===`queued_command`&&(typeof e.attachment.prompt!=`string`||!s.has(e.attachment.prompt)));Ll({messages:[...An.current,...c],queryParams:{systemPrompt:a,userContext:r,systemContext:i,canUseTool:va,toolUseContext:t,querySource:Bn()},description:yn,setAppState:U,agentDefinition:M})})()},[rt,me,F,M,ba,m,_,va,U])}),Ca=(0,Q.useCallback)(t=>{Ga(t,t=>{if(ua(t)?(hi()?q(e=>{let n=hn(e,{includeSnipped:!0});return[...n.length>500?n.slice(-500):n,t]}):q(()=>[t]),ii(_h()),Ht(!1)):t.type===`progress`&&Bl(t.data?.type)?q(e=>{let n=t.data;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.type!==`progress`)break;let a=i.data;if(i.parentToolUseID===t.parentToolUseID&&a?.type===n.type){let n=e.slice();return n[r]=t,n}}return[...e,t]}):q(e=>[...e,t]),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage?Ht(!0):t.type===`assistant`&&Ht(!1),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage){let n=(Bi(t.message?.content??``)??``).toLowerCase();if(n.includes(`connection error`)||n.includes(`fetch failed`)||n.includes(`network error`)||n.includes(`enotfound`)||n.includes(`econnreset`)||n.includes(`etimedout`)){let{getGoal:t,pauseGoal:n}=(es(),e(dl)),{persistCurrentGoal:r}=(tl(),e(Go));t()?.status===`active`&&(n(),r(),Fe({key:`goal-auto-paused-connectivity-error`,text:`Detected connection error. Active goal was auto-paused. Run /goal resume after network recovers.`,priority:`immediate`}))}}},e=>{Mr(t=>t+e.length)},Ze,et,e=>{q(t=>t.filter(t=>t!==e)),vr(e.uuid)},nt,e=>{let t=Date.now(),n=kr.current;Ar.current.push({...e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})},Rr)},[q,Mr,Ze,et,nt,Rr]),Ta=(0,Q.useCallback)(async(e,t,n,r,i,a)=>{if(r){let e=aT(d,fe.getState().mcp.clients);Cn.handleQueryStart(e)}if(Ld(),!k&&!pn&&!vn&&!_n.current){let e=t.find(e=>e.type===`user`&&!e.isMeta),n=e?.type===`user`?Bi(e.message.content):null;n&&!n.startsWith(`<local-command-stdout>`)&&!n.startsWith(`<command-message>`)&&!n.startsWith(`<command-name>`)&&!n.startsWith(`<bash-input>`)&&(_n.current=!0,gp(n,new AbortController().signal).then(e=>{e?gn(e):_n.current=!1},()=>{_n.current=!1}))}if(fe.setState(e=>{let t=e.toolPermissionContext.alwaysAllowRules.command;return t===i||t?.length===i.length&&t.every((e,t)=>e===i[t])?e:{...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:i}}}}),!r){t.some(ua)&&(ii(_h()),Ht(!1)),ji(),it(null);return}let o=ba(e,t,n,a),{tools:s,mcpClients:c}=o.options;Il(`query_context_loading_start`);let[,,l,u,f]=await Promise.all([void 0,NT(F,U,fe.getState().fastMode),ko(s,a,Array.from(F.additionalWorkingDirectories.keys()),c),Nr(),ar()]),p={...u,...gr()&&!Ti.current?{terminalFocus:`The terminal is unfocused — the user is not actively watching.`}:{}};Il(`query_context_loading_end`);let h=Xr({mainThreadAgentDefinition:M,toolUseContext:o,customSystemPrompt:m,defaultSystemPrompt:l,appendSystemPrompt:_});o.renderedSystemPrompt=h,Il(`query_query_start`),ut(),mt(),St();for await(let t of Ma({messages:e,systemPrompt:h,userContext:p,systemContext:f,canUseTool:va,toolUseContext:o,querySource:Bn()}))Ca(t);Il(`query_end`),ji(),mo(),await y?.(An.current)},[d,ji,ba,F,U,m,y,_,va,M,Ca,pn,k]),Ea=(0,Q.useCallback)(async(e,t,n,r,i,a,o)=>{let s=xt.tryStart();if(s===null)return e.filter(e=>e.type===`user`&&!e.isMeta).map(e=>Bi(e.message.content)).filter(e=>e!==null).forEach((e,t)=>{Mn({value:e,mode:`prompt`})}),!1;try{ct(!1),Vt(),q(t=>[...t,...e]),kr.current=0,bt((o?xs(o):null)??Ft()),Ar.current=[],et([]),Fr(null);let s=An.current;if(o&&await Li(o,s,e.length),a&&o&&!await a(o,s))return!0;await Ta(s,e,t,n,r,i)}finally{if(xt.end(s)){ct(t.signal.aborted),Hr(Date.now()),ci.current=!1,ji(),await Ri(An.current,t.signal.aborted);let e;Ft()!==null&&Ft()>0&&!t.signal.aborted&&(e={tokens:_t(),limit:Ft(),nudges:Rt()}),bt(null);let n=Date.now()-It.current-Lt.current;(n>3e4||e!==void 0)&&!t.signal.aborted&&!_e&&q(t=>[...t,Zt(n,e,ke(t,bn))]),it(null)}if(t.signal.reason===`user-cancel`&&!xt.isActive&&cr.current===``&&ui()===0&&!fe.getState().viewingAgentTaskId){let e=An.current,t=e.findLast(uf);t&&df(e,e.lastIndexOf(t))&&(Qf(),lt.current(t))}}return!0},[Ta,U,ji,xt,Li,Ri]),Oa=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=B;if(!e||G||Oa.current)return;Oa.current=!0;async function t(e){if(e.clearContext){let t=e.message.planContent?Ao():void 0,{clearConversation:n}=await import(`./conversation-CSnPSTPX.js`);await n({setMessages:q,readFileState:Wi.current,discoveredSkillNames:Ji.current,loadedNestedMemoryPaths:Zi.current,getAppState:()=>fe.getState(),setAppState:U,setConversationId:ii}),_n.current=!1,gn(void 0),Ki.current.clear(),qi.current=0,t&&Ho(Et(),t)}U(t=>{let n=e.mode?Wr(t.toolPermissionContext,_y(e.mode,e.allowedPrompts)):t.toolPermissionContext;return e.mode===`auto`&&(n=Ms({...n,mode:`auto`,prePlanMode:void 0})),{...t,initialMessage:null,toolPermissionContext:n}}),el()&&Cs(e=>{U(t=>({...t,fileHistory:e(t.fileHistory)}))},e.message.uuid),await er();let t=e.message.message.content;if(typeof t==`string`&&!e.message.planContent)ka(t,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}});else{let t=_a();it(t),Ea([e.message],t,!0,[],me)}setTimeout(e=>{e.current=!1},100,Oa)}t(e)},[B,G,q,U,Ea,me,Ke]);let ka=(0,Q.useCallback)(async(e,t,n,r)=>{if(Xn(),wi(),!n&&e.trim().startsWith(`/`)){let n=qf(e,wr).trim(),i=n.indexOf(` `),a=i===-1?n.slice(1):n.slice(1,i),o=i===-1?``:n.slice(i+1).trim(),s=Ye.find(e=>Lr(e)&&(e.name===a||e.aliases?.includes(a)||In(e)===a));s?.name===`clear`&&jn.current&&(jn.current,Math.round((Date.now()-li.current)/6e4),An.current.length,Pt(),jn.current=!1);let c=xt.isActive&&(s?.immediate||r?.fromKeybinding);if(s&&c&&s.type===`local-jsx`){e.trim()===cr.current.trim()&&(dr(``),t.setCursorOffset(0),t.clearBuffer(),Tr({}));let n=Kf(e).filter(e=>wr[e.id]?.type===`text`);n.length,n.reduce((e,t)=>e+(wr[t.id]?.content.length??0),0),s.name,r?.fromKeybinding,(async()=>{let e=!1,n=(n,r)=>{e=!0,rn({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0});let i=[];if(n&&r?.display!==`skip`&&(Fe({key:`immediate-${s.name}`,text:n,priority:`immediate`}),!hi())){let e=r?.displayArgs??o;i.push(xr(rc(In(s),e)),xr(`<${Fu}>${Tn(n)}</${Fu}>`))}r?.metaMessages?.length&&i.push(...r.metaMessages.map(e=>Qc({content:e,isMeta:!0}))),i.length&&q(e=>[...e,...i]),hr!==void 0&&(dr(hr.text),t.setCursorOffset(hr.cursorOffset),Tr(hr.pastedContents),_r(void 0))},r=ba(An.current,[],_a(),me),i=await(await s.load()).call(n,r,o);i&&!e&&rn({jsx:i,shouldHidePromptInput:!1,isLocalJSXCommand:!0})})();return}}Number(process.env.WORKMATE_IDLE_THRESHOLD_MINUTES??75),Number(process.env.WORKMATE_IDLE_TOKEN_THRESHOLD??1e5),r?.fromKeybinding||(Zf({display:n?e:Lf(e,fr),pastedContents:n?{}:wr}),fr===`bash`&&ux(e.trim()));let i=!n&&e.trim().startsWith(`/`),a=!G||n;if(hr!==void 0&&!i&&a?(dr(hr.text),t.setCursorOffset(hr.cursorOffset),Tr(hr.pastedContents),_r(void 0)):a&&(r?.fromKeybinding||(dr(``),t.setCursorOffset(0)),Tr({})),a&&(pr(`prompt`),Dr(e=>e+1),t.clearBuffer(),Oi.current=!1,!i&&fr===`prompt`&&!n&&(Nn(e),Vt()),U(e=>({...e,attribution:Zs(e.attribution,e=>{lu(e).catch(e=>{X(`Attribution: Failed to save snapshot: ${e}`)})})}))),n){let{queryRequired:t}=await yo(n.state,n.speculationSessionTimeSavedMs,n.setAppState,e,{setMessages:q,readFileState:Wi,cwd:Mt()});if(t){let e=_a();it(e),Ea([],e,!0,[],me)}return}await er(),await eT({input:e,helpers:t,queryGuard:xt,isExternalLoading:Tt,mode:fr,commands:Ye,onInputChange:dr,setPastedContents:Tr,setToolJSX:rn,getToolUseContext:ba,messages:An.current,mainLoopModel:me,pastedContents:wr,setUserInputOnProcessing:Nn,setAbortController:it,abortController:rt,onQuery:Ea,setAppState:U,querySource:Bn(),onBeforeQuery:v,canUseTool:va,addNotification:Fe,setMessages:q,streamMode:Qe.current,hasInterruptibleToolInProgress:Cr.current}),(i||G)&&hr!==void 0&&(dr(hr.text),t.setCursorOffset(hr.cursorOffset),Tr(hr.pastedContents),_r(void 0))},[xt,G,Tt,fr,Ye,dr,pr,Tr,Dr,rn,ba,me,wr,Nn,it,Fe,Ea,hr,_r,U,v,va,q,er,Xn]),Aa=(0,Q.useRef)(ka);Aa.current=ka;let ja=(0,Q.useCallback)(async()=>{if(ia(!0),Yt()){bh(`tmux`,[`detach-client`],{stdio:`ignore`}),ia(!1);return}if(Hl()!==null){na((0,$.jsx)(ym,{showWorktree:!0,onDone:()=>{},onCancel:()=>{na(null),ia(!1)}}));return}let e=await(await Fi.load()).call(()=>{});na(e),e===null&&ia(!1)},[]),Na=(0,Q.useCallback)(()=>{Qr(e=>!e)},[]),Fa=(0,Q.useCallback)(e=>{let t=An.current,n=t.lastIndexOf(e);if(n===-1)return;t.length,t.length-n,q(t.slice(0,n)),ii(_h()),ya();let r=e.permissionMode;U(e=>({...e,toolPermissionContext:r&&e.toolPermissionContext.mode!==r?{...e.toolPermissionContext,mode:r}:e.toolPermissionContext,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null}}))},[q,U]),Ia=(0,Q.useCallback)(e=>{Fa(e);let t=wa(e);if(t&&(dr(t.text),pr(t.mode)),Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`image`)){let t=e.message.content.filter(e=>e.type===`image`);if(t.length>0){let n={};t.forEach((t,r)=>{if(t.source.type===`base64`){let i=e.imagePasteIds?.[r]??r+1;n[i]={id:i,type:`image`,content:t.source.data,mediaType:t.source.media_type}}}),Tr(n)}}},[Fa,dr]);lt.current=Ia;let La=(0,Q.useCallback)(async e=>{setImmediate((e,t)=>e(t),Ia,e)},[Ia]),Ra=e=>{let t=e.slice(0,24);return K.findIndex(e=>e.uuid.slice(0,24)===t)},{enter:za,handlers:Ba}=ic(Gn,Kn,qn,{copy:e=>void R(e).then(e=>{e&&process.stdout.write(e),Fe({key:`selection-copied`,text:`copied`,color:`success`,priority:`immediate`,timeoutMs:2e3})}),edit:async e=>{let t=Ra(e.uuid),n=t>=0?K[t]:void 0;if(!n||!uf(n))return;let r=!await zc(z,n.uuid),i=df(K,t);r&&i?(pa(),La(n)):(ei(n),Qr(!0))}});async function Ha(){ea();let e=await Ls();if(e.length>0){let t=e.map(e=>` [${e.type}] ${e.path} (${e.content.length} chars)${e.parent?` (included by ${e.parent})`:``}`).join(`
|
|
121
121
|
`);X(`Loaded ${e.length} AGENTS.md/rules files:\n${t}`)}else X(`No AGENTS.md/rules files found`);for(let t of e)Wi.current.set(t.path,{content:t.contentDiffersFromDisk?t.rawContent??t.content:t.content,timestamp:Date.now(),offset:void 0,limit:void 0,isPartialView:t.contentDiffersFromDisk})}Lw(Qm()),w_(K,K.length===a?.length),Rw();let Ua=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(re.length<1){Ua.current=!1;return}Ua.current||(Ua.current=!0,ju(e=>({...e,promptQueueUseCount:(e.promptQueueUseCount??0)+1})))},[re.length]),iT({executeQueuedInput:(0,Q.useCallback)(async e=>{await eT({helpers:{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}},queryGuard:xt,commands:Ye,onInputChange:()=>{},setPastedContents:()=>{},setToolJSX:rn,getToolUseContext:ba,messages:K,mainLoopModel:me,setUserInputOnProcessing:Nn,setAbortController:it,onQuery:Ea,setAppState:U,querySource:Bn(),onBeforeQuery:v,canUseTool:va,addNotification:Fe,setMessages:q,queuedCommands:e})},[xt,Ye,rn,ba,K,me,Nn,va,it,Ea,Fe,U,v]),hasActiveLocalJsxUI:wn,queryGuard:xt}),(0,Q.useEffect)(()=>{ap.recordUserActivity(),vt(!0)},[or,Er]),(0,Q.useEffect)(()=>{Er===1&&ah()},[Er]),(0,Q.useEffect)(()=>{if(G||Er===0||Vr===0)return;let e=setTimeout((e,t,n,r,i)=>{if(Bt()>e)return;let a=Date.now()-e;!t&&!n&&r.current===void 0&&a>=Mu().messageIdleNotifThresholdMs&&i_({message:`Work Mate is waiting for your input`,notificationType:`idle_prompt`},i)},Mu().messageIdleNotifThresholdMs,Vr,G,en,Kt,pe);return()=>clearTimeout(e)},[G,en,Er,Vr,pe]),(0,Q.useEffect)(()=>{},[Vr,G,Fe,Ie]),pT({isLoading:G||B!==null,queuedCommandsLength:re.length,hasActiveLocalJsxUI:wn,isInPlanMode:F.mode===`plan`,onQueueTick:e=>Mn(e)}),vT({isLoading:G||B!==null,wasAborted:st,queuedCommandsLength:re.length,hasActiveLocalJsxUI:wn,isInPlanMode:F.mode===`plan`,isQueryActiveNow:xt.getSnapshot,onContinuationEnqueued:({turn:e,objective:t})=>{let n=`Goal auto-continue (${e}/1): continue advancing "${t}".`;q(e=>[...e,Qc({content:n,isVisibleInTranscriptOnly:!0})])},onMaxTurnsReached:()=>{Fe({key:`goal-max-turns-reached`,text:`Goal reached max continuation turns (1). Run /goal continue to reset turn counter and continue.`,priority:`immediate`})}}),(0,Q.useEffect)(()=>{if(!_e){Ln(null);return}if(!G){if(ve!==null&&re.length===0&&!wn&&F.mode!==`plan`&&B===null){Ln({enabled:!0,phase:`standby`,next_tick_at:ve,sleep_until:null});return}Ln({enabled:!0,phase:null,next_tick_at:null,sleep_until:null})}},[B,G,wn,_e,ve,re.length,F.mode]),(0,Q.useEffect)(()=>{re.some(e=>e.priority===`now`)&&at.current?.abort(`interrupt`)},[re]);let Wa=(0,Q.useRef)(Ha);Wa.current=Ha;let Ka=(0,Q.useRef)(Cn);Ka.current=Cn,(0,Q.useEffect)(()=>(Wa.current(),()=>{Ka.current.shutdown()}),[]);let{internal_eventEmitter:qa}=N(),[Ya,Za]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{process.stdout.write(`
|
|
122
122
|
Work Mate has been suspended. Run \`fg\` to bring Work Mate back.
|
|
123
123
|
Note: ctrl + z now suspends Work Mate, ctrl + _ undoes input.
|
|
124
|
-
`)},t=()=>{Za(e=>e+1)};return qa?.on(`suspend`,e),qa?.on(`resume`,t),()=>{qa?.off(`suspend`,e),qa?.off(`resume`,t)}},[qa]);let Qa=(0,Q.useMemo)(()=>{if(!G)return null;let e=K.filter(e=>{if(e.type!==`progress`)return!1;let t=e.data;return t.type===`hook_progress`&&(t.hookEvent===`Stop`||t.hookEvent===`SubagentStop`)});if(e.length===0)return null;let t=e.at(-1)?.toolUseID;if(!t||K.some(e=>e.type===`system`&&e.subtype===`stop_hook_summary`&&e.toolUseID===t))return null;let n=e.filter(e=>e.toolUseID===t),r=n.length,i=ke(K,e=>{if(e.type!==`attachment`)return!1;let n=e.attachment;return`hookEvent`in n&&(n.hookEvent===`Stop`||n.hookEvent===`SubagentStop`)&&`toolUseID`in n&&n.toolUseID===t}),a=n.find(e=>e.data.statusMessage)?.data.statusMessage;if(a)return r===1?`${a}…`:`${a}… ${i}/${r}`;let o=n[0]?.data.hookEvent===`SubagentStop`?`subagent stop`:`stop`;return r===1?`running ${o} hook`:`running stop hooks… ${i}/${r}`},[K,G]),$a=(0,Q.useCallback)(()=>{ir({messagesLength:K.length,streamingToolUsesLength:$e.length})},[K.length,$e.length]),to=(0,Q.useCallback)(()=>{ir(null)},[]),no=hi()&&!A,ro=(0,Q.useRef)(null),[io,ao]=(0,Q.useState)(!1),[oo,so]=(0,Q.useState)(``),[lo,uo]=(0,Q.useState)(0),[fo,po]=(0,Q.useState)(0),ho=(0,Q.useCallback)((e,t)=>{uo(e),po(t)},[]);ne((e,t,n)=>{if(t.ctrl||t.meta)return;if(e===`/`){ro.current?.setAnchor(),ao(!0),n.stopImmediatePropagation();return}let r=e[0];if((r===`n`||r===`N`)&&e===r.repeat(e.length)&&lo>0){let t=r===`n`?ro.current?.nextMatch:ro.current?.prevMatch;if(t)for(let n=0;n<e.length;n++)t();n.stopImmediatePropagation()}},{isActive:Ce===`transcript`&&no&&!io&&!De});let{setQuery:go,scanElement:_o,setPositions:bo}=ae(),xo=ie().columns,So=Q.useRef(xo);Q.useEffect(()=>{So.current!==xo&&(So.current=xo,(oo||io)&&(ao(!1),so(``),uo(0),po(0),ro.current?.disarmSearch(),go(``)))},[xo,oo,io,go]),ne((e,t,n)=>{if(!(t.ctrl||t.meta)){if(e===`q`){to(),n.stopImmediatePropagation();return}if(e===`[`&&!De)Oe(!0),Ee(!0),n.stopImmediatePropagation();else if(e===`v`){if(n.stopImmediatePropagation(),Pe.current)return;Pe.current=!0;let e=Me.current,t=t=>{e===Me.current&&(clearTimeout(Ne.current),je(t))};t(`rendering ${tr.length} messages…`),(async()=>{try{let e=Math.max(80,(process.stdout.columns??80)-6),n=(await e_(tr,Ke,e)).replace(/[ \t]+$/gm,``),r=dh(sh(),`cc-transcript-${Date.now()}.txt`);await vh(r,n);let i=Vp(r);t(i?`opening ${r}`:`wrote ${r} · no $VISUAL/$EDITOR set`)}catch(e){t(`render failed: ${e instanceof Error?e.message:String(e)}`)}Pe.current=!1,e===Me.current&&(Ne.current=setTimeout(e=>e(``),4e3,je))})()}}},{isActive:Ce===`transcript`&&no&&!io});let Co=Ce===`transcript`&&no;(0,Q.useEffect)(()=>{Co||(so(``),uo(0),po(0),ao(!1),Me.current++,clearTimeout(Ne.current),Oe(!1),je(``))},[Co]),(0,Q.useEffect)(()=>{go(Co?oo:``),Co||bo(null)},[Co,oo,go,bo]);let wo={screen:Ce,setScreen:we,showAllInTranscript:Te,setShowAllInTranscript:Ee,messageCount:K.length,onEnterTranscript:$a,onExitTranscript:to,virtualScrollActive:no,searchBarOpen:io},To=rr?tr.slice(0,rr.messagesLength):tr,Do=rr?$e.slice(0,rr.streamingToolUsesLength):$e,{handleKeyDown:jo}=Kw({onOpenBackgroundTasks:wn?void 0:()=>vi(!0)});ne((e,t,n)=>{jo(new T(n.keypress))});let Mo=le?H[le]:void 0,No=Mo&&cs(Mo)?Mo:void 0,Po=Ir||!G,Fo=No?.messages,Io=(0,Q.useMemo)(()=>{if(!No)return;let e=Fo??[];if(!cs(No)||No.agentType!==`fork`||!No.prompt)return e;let t=No.prompt.trim(),n=-1,r=-1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o.type===`user`&&Array.isArray(o.message?.content)){if(o.message.content.some(SD))n=a;else if(!i){let e=o.message.content.find(e=>e.type===`text`&&typeof e.text==`string`);e&&e.text.trim()===t&&(i=!0)}continue}o.type===`assistant`&&Array.isArray(o.message?.content)&&o.message.content.some(e=>e.type===`tool_use`)&&(r=a)}let a=n===-1?e:e.map((e,t)=>t!==n||!Array.isArray(e.message?.content)?e:{...e,message:{...e.message,content:e.message.content.filter(e=>!SD(e))}});if(i)return a;let o=n===-1?r+1:n+1,s=Qc({content:No.prompt,timestamp:new Date(No.startTime).toISOString()});return[...a.slice(0,o),s,...a.slice(o)]},[No,Fo]),Lo=No?Io??[]:Po?K:tr;if(Ce===`transcript`){let e=hi()&&!A&&!De?ft:void 0,t=(0,$.jsx)(Gm,{messages:To,tools:Ke,commands:Ye,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:yr,isMessageSelectorVisible:!1,conversationId:ri,screen:Ce,agentDefinitions:te,streamingToolUses:Do,showAllInTranscript:Te,isLoading:G,hidePastThinking:!0,streamingThinking:tt,scrollRef:e,jumpRef:ro,onSearchMatchesChange:ho,scanElement:_o,setPositions:bo,disableRenderCap:De}),n=en&&(0,$.jsx)(g,{flexDirection:`column`,width:`100%`,children:en.jsx}),r=(0,$.jsxs)(rf,{children:[(0,$.jsx)(bD,{isAnimating:En,title:yn,disabled:k,noPrefix:!1}),(0,$.jsx)(Vw,{...wo}),(0,$.jsx)(Uw,{onSubmit:ka,isActive:!en?.isLocalJSXCommand}),e?(0,$.jsx)(oD,{scrollRef:ft,isActive:!0,isModal:!io,onScroll:()=>ro.current?.disarmSearch()}):null,(0,$.jsx)(Gw,{...ma}),e?(0,$.jsx)(Um,{scrollRef:ft,scrollable:(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(RT,{})]}),bottom:io?(0,$.jsx)(gD,{jumpRef:ro,initialQuery:``,count:lo,current:fo,onClose:e=>{so(lo>0?e:``),ao(!1),e||(uo(0),po(0),ro.current?.setSearchQuery(``))},onCancel:()=>{ao(!1),ro.current?.setSearchQuery(``),ro.current?.setSearchQuery(oo),go(oo)},setHighlight:go}):(0,$.jsx)(hD,{showAllInTranscript:Te,virtualScroll:!0,status:Ae||void 0,searchBadge:oo&&lo>0?{current:fo,count:lo}:void 0})}):(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(RT,{}),(0,$.jsx)(hD,{showAllInTranscript:Te,virtualScroll:!1,suppressShowAll:De,status:Ae||void 0})]})]});return e?(0,$.jsx)(W,{mouseTracking:Fn(),children:r}):r}let zo=kt&&!No&&Lo.length<=jt.current?kt:void 0,Bo=ca===`tool-permission`?(0,$.jsx)(Uy,{onDone:()=>on(([e,...t])=>t),onReject:Y,toolUseConfirm:an[0],toolUseContext:ba(K,K,rt??_a(),me),verbose:I,setStickyFooter:hi()?cn:void 0},an[0]?.toolUseID):null,Vo=hi()&&en?.isLocalJSXCommand===!0,Uo=Vo?en.jsx:null,Ko=(0,$.jsxs)(rf,{children:[(0,$.jsx)(bD,{isAnimating:En,title:yn,disabled:k,noPrefix:!1}),(0,$.jsx)(Vw,{...wo}),(0,$.jsx)(Uw,{onSubmit:ka,isActive:!en?.isLocalJSXCommand}),(0,$.jsx)(oD,{scrollRef:ft,isActive:hi()&&(Uo!=null||!ca||ca===`tool-permission`),onScroll:$n}),null,(0,$.jsx)(Gw,{...ma}),(0,$.jsx)(of,{dynamicMcpConfig:be,isStrictMcpConfig:p,children:(0,$.jsx)(Um,{scrollRef:ft,overlay:Bo,modal:Uo,modalScrollRef:pt,dividerYRef:Rn,hidePill:!!No,newMessageCount:Jn?.count??0,onPillClick:()=>{Kn(null),Hn(ft.current)},scrollable:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Gm,{messages:Lo,tools:Ke,commands:Ye,verbose:I,toolJSX:en,toolUseConfirmQueue:an,inProgressToolUseIDs:yr,isMessageSelectorVisible:Zr,conversationId:ri,screen:Ce,streamingToolUses:$e,showAllInTranscript:Te,agentDefinitions:te,isLoading:G,streamingText:G&&!No?Br:null,unseenDivider:No?void 0:Jn,scrollRef:hi()?ft:void 0,trackStickyPrompt:hi()?!0:void 0,cursor:Gn,setCursor:Kn,cursorNavRef:qn}),!S&&zo&&!Uo&&(0,$.jsx)(la,{param:{text:zo,type:`text`},addMargin:!0,verbose:I}),en&&!(en.isLocalJSXCommand&&en.isImmediate)&&!Vo&&(0,$.jsx)(g,{flexDirection:`column`,width:`100%`,children:en.jsx}),(0,$.jsx)(g,{flexGrow:1}),Vi&&(0,$.jsx)(lp,{mode:Xe,spinnerTip:V,responseLengthRef:kr,apiMetricsRef:Ar,overrideMessage:Ur,spinnerSuffix:Qa,verbose:I,loadingStartTimeRef:It,totalPausedMsRef:Lt,pauseStartTimeRef:zt,overrideColor:Kr,overrideShimmerColor:Jr,hasActiveTools:yr.size>0,leaderIsIdle:!G})]}),bottom:(0,$.jsx)(g,{flexDirection:`row`,width:`100%`,alignItems:`flex-end`,children:(0,$.jsxs)(g,{flexDirection:`column`,flexGrow:1,children:[hi()&&(0,$.jsx)(hw,{}),sn,en?.isLocalJSXCommand&&en.isImmediate&&!Vo&&(0,$.jsx)(g,{flexDirection:`column`,width:`100%`,children:en.jsx}),!Vi&&!en?.isLocalJSXCommand&&oe&&We&&We.length>0&&(0,$.jsx)(g,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(cp,{tasks:We,isStandalone:!0})}),ca===`sandbox-permission`&&(0,$.jsx)(IT,{hostPattern:ln[0].hostPattern,onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=ln[0];if(!r)return;let i=r.hostPattern.host;un(e=>(e.filter(e=>e.hostPattern.host===i).forEach(e=>e.resolvePromise(t)),e.filter(e=>e.hostPattern.host!==i)))}},ln[0].hostPattern.host),ca===`prompt`&&(0,$.jsx)(pb,{title:dn[0].title,toolInputSummary:dn[0].toolInputSummary,request:dn[0].request,onRespond:e=>{let t=dn[0];t&&(t.resolve({prompt_response:t.request.prompt,selected:e}),fn(([,...e])=>e))},onAbort:()=>{let e=dn[0];e&&(e.reject(Error(`Prompt cancelled by user`)),fn(([,...e])=>e))}},dn[0].request.prompt),ca===`elicitation`&&(0,$.jsx)(ub,{event:ce.queue[0],onResponse:(e,t)=>{let n=ce.queue[0];n&&(n.respond({action:e,content:t}),n.params.mode===`url`&&e===`accept`||U(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})))},onWaitingDismiss:e=>{let t=ce.queue[0];U(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})),t?.onWaitingDismiss?.(e)}},`${ce.queue[0].serverName}:${String(ce.queue[0].requestId)}`),ca===`cost`&&(0,$.jsx)(t_,{onDone:()=>{ni(!1),pi(!0),ju(e=>({...e,hasAcknowledgedCostThreshold:!0}))}}),ca===`idle-return`&&ai&&(0,$.jsx)(n_,{idleMinutes:ai.idleMinutes,totalInputTokens:Pt(),onDone:async e=>{let t=ai;if(oi(null),Math.round(t.idleMinutes),An.current.length,Pt(),e===`dismiss`){dr(t.input);return}if(e===`never`&&ju(e=>e.idleReturnDismissed?e:{...e,idleReturnDismissed:!0}),e===`clear`){let{clearConversation:e}=await import(`./conversation-CCV0BYD_.js`);await e({setMessages:q,readFileState:Wi.current,discoveredSkillNames:Ji.current,loadedNestedMemoryPaths:Zi.current,getAppState:()=>fe.getState(),setAppState:U,setConversationId:ii}),_n.current=!1,gn(void 0),Ki.current.clear(),qi.current=0}ci.current=!0,Aa.current(t.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}}),ta,ca===`plugin-hint`&&Be&&(0,$.jsx)(uE,{pluginName:Be.pluginName,pluginDescription:Be.pluginDescription,marketplaceName:Be.marketplaceName,sourceCommand:Be.sourceCommand,onResponse:Ve}),ca===`search-extra-tools-hint`&&He.visible&&(0,$.jsx)(fE,{tools:He.tools,onSelect:He.handleSelect,onDismiss:He.handleDismiss}),ca===`lsp-recommendation`&&Re&&(0,$.jsx)(sE,{pluginName:Re.pluginName,pluginDescription:Re.pluginDescription,fileExtension:Re.fileExtension,onResponse:ze}),zi(),!en?.shouldHidePromptInput&&!ca&&!ra&&!S&&!Gn&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Nw,{debug:n,hasSuppressedDialogs:!!da,isLocalJSXCommandActive:wn,getToolUseContext:ba,toolPermissionContext:F,setToolPermissionContext:ga,apiKeyStatus:$i,commands:Ye,agents:te.activeAgents,isLoading:G,onExit:ja,verbose:I,messages:K,onAutoUpdaterResult:$t,autoUpdaterResult:Qt,input:or,onInputChange:dr,mode:fr,onModeChange:pr,stashedPrompt:hr,setStashedPrompt:_r,submitCount:Er,onShowMessageSelector:Na,onMessageActionsEnter:void 0,mcpClients:Le,pastedContents:wr,setPastedContents:Tr,vimMode:mi,setVimMode:gi,showBashesDialog:_i,setShowBashesDialog:vi,onSubmit:ka,isSearchingHistory:yi,setIsSearchingHistory:bi,helpOpen:xi,setHelpOpen:Si,insertTextRef:ur}),(0,$.jsx)(yT,{onBackgroundSession:Sa,isLoading:G}),(0,$.jsx)(dT,{})]}),Gn&&(0,$.jsx)(Pa,{cursor:Gn}),ca===`message-selector`&&(0,$.jsx)(mf,{messages:K,preselectedMessage:$r,onPreRestore:pa,onRestoreCode:async e=>{await hc(e=>{U(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)},onSummarize:async(e,t,n=`from`)=>{let r=hn(K),i=r.indexOf(e);if(i===-1){q(e=>[...e,ki(`That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.`,`warning`)]);return}let a=_a(),o=ba(r,[],a,me),s=o.getAppState(),c=await ko(o.options.tools,o.options.mainLoopModel,Array.from(s.toolPermissionContext.additionalWorkingDirectories.keys()),o.options.mcpClients),l=Xr({mainThreadAgentDefinition:void 0,toolUseContext:o,customSystemPrompt:o.options.customSystemPrompt,defaultSystemPrompt:c,appendSystemPrompt:o.options.appendSystemPrompt}),[u,d]=await Promise.all([Nr(),ar()]),f=await Wo(r,i,o,{systemPrompt:l,userContext:u,systemContext:d,toolUseContext:o,forkContextMessages:r},t,n),p=f.messagesToKeep??[],m=n===`up_to`?[...f.summaryMessages,...p]:[...p,...f.summaryMessages],h=[f.boundaryMarker,...m,...f.attachments,...f.hookResults];if(hi()&&n===`from`?q(t=>{let n=t.findIndex(t=>t.uuid===e.uuid);return[...t.slice(0,n===-1?0:n),...h]}):q(h),Ht(!1),ii(_h()),Ro(o.options.querySource),n===`from`){let t=wa(e);t&&(dr(t.text),pr(t.mode))}let g=Wc(`app:toggleTranscript`,`Global`,`ctrl+o`);Fe({key:`summarize-ctrl-o-hint`,text:`Conversation summarized (${g} for history)`,priority:`medium`,timeoutMs:8e3})},onRestoreMessage:La,onClose:()=>{Qr(!1),ei(void 0)}})]})})})},Ya)]});return hi()?(0,$.jsx)(W,{mouseTracking:Fn(),children:Ko}):Ko}export{CD as t};
|
|
124
|
+
`)},t=()=>{Za(e=>e+1)};return qa?.on(`suspend`,e),qa?.on(`resume`,t),()=>{qa?.off(`suspend`,e),qa?.off(`resume`,t)}},[qa]);let Qa=(0,Q.useMemo)(()=>{if(!G)return null;let e=K.filter(e=>{if(e.type!==`progress`)return!1;let t=e.data;return t.type===`hook_progress`&&(t.hookEvent===`Stop`||t.hookEvent===`SubagentStop`)});if(e.length===0)return null;let t=e.at(-1)?.toolUseID;if(!t||K.some(e=>e.type===`system`&&e.subtype===`stop_hook_summary`&&e.toolUseID===t))return null;let n=e.filter(e=>e.toolUseID===t),r=n.length,i=ke(K,e=>{if(e.type!==`attachment`)return!1;let n=e.attachment;return`hookEvent`in n&&(n.hookEvent===`Stop`||n.hookEvent===`SubagentStop`)&&`toolUseID`in n&&n.toolUseID===t}),a=n.find(e=>e.data.statusMessage)?.data.statusMessage;if(a)return r===1?`${a}…`:`${a}… ${i}/${r}`;let o=n[0]?.data.hookEvent===`SubagentStop`?`subagent stop`:`stop`;return r===1?`running ${o} hook`:`running stop hooks… ${i}/${r}`},[K,G]),$a=(0,Q.useCallback)(()=>{ir({messagesLength:K.length,streamingToolUsesLength:$e.length})},[K.length,$e.length]),to=(0,Q.useCallback)(()=>{ir(null)},[]),no=hi()&&!A,ro=(0,Q.useRef)(null),[io,ao]=(0,Q.useState)(!1),[oo,so]=(0,Q.useState)(``),[lo,uo]=(0,Q.useState)(0),[fo,po]=(0,Q.useState)(0),ho=(0,Q.useCallback)((e,t)=>{uo(e),po(t)},[]);ne((e,t,n)=>{if(t.ctrl||t.meta)return;if(e===`/`){ro.current?.setAnchor(),ao(!0),n.stopImmediatePropagation();return}let r=e[0];if((r===`n`||r===`N`)&&e===r.repeat(e.length)&&lo>0){let t=r===`n`?ro.current?.nextMatch:ro.current?.prevMatch;if(t)for(let n=0;n<e.length;n++)t();n.stopImmediatePropagation()}},{isActive:Ce===`transcript`&&no&&!io&&!De});let{setQuery:go,scanElement:_o,setPositions:bo}=ae(),xo=ie().columns,So=Q.useRef(xo);Q.useEffect(()=>{So.current!==xo&&(So.current=xo,(oo||io)&&(ao(!1),so(``),uo(0),po(0),ro.current?.disarmSearch(),go(``)))},[xo,oo,io,go]),ne((e,t,n)=>{if(!(t.ctrl||t.meta)){if(e===`q`){to(),n.stopImmediatePropagation();return}if(e===`[`&&!De)Oe(!0),Ee(!0),n.stopImmediatePropagation();else if(e===`v`){if(n.stopImmediatePropagation(),Pe.current)return;Pe.current=!0;let e=Me.current,t=t=>{e===Me.current&&(clearTimeout(Ne.current),je(t))};t(`rendering ${tr.length} messages…`),(async()=>{try{let e=Math.max(80,(process.stdout.columns??80)-6),n=(await e_(tr,Ke,e)).replace(/[ \t]+$/gm,``),r=dh(sh(),`cc-transcript-${Date.now()}.txt`);await vh(r,n);let i=Vp(r);t(i?`opening ${r}`:`wrote ${r} · no $VISUAL/$EDITOR set`)}catch(e){t(`render failed: ${e instanceof Error?e.message:String(e)}`)}Pe.current=!1,e===Me.current&&(Ne.current=setTimeout(e=>e(``),4e3,je))})()}}},{isActive:Ce===`transcript`&&no&&!io});let Co=Ce===`transcript`&&no;(0,Q.useEffect)(()=>{Co||(so(``),uo(0),po(0),ao(!1),Me.current++,clearTimeout(Ne.current),Oe(!1),je(``))},[Co]),(0,Q.useEffect)(()=>{go(Co?oo:``),Co||bo(null)},[Co,oo,go,bo]);let wo={screen:Ce,setScreen:we,showAllInTranscript:Te,setShowAllInTranscript:Ee,messageCount:K.length,onEnterTranscript:$a,onExitTranscript:to,virtualScrollActive:no,searchBarOpen:io},To=rr?tr.slice(0,rr.messagesLength):tr,Do=rr?$e.slice(0,rr.streamingToolUsesLength):$e,{handleKeyDown:jo}=Kw({onOpenBackgroundTasks:wn?void 0:()=>vi(!0)});ne((e,t,n)=>{jo(new T(n.keypress))});let Mo=le?H[le]:void 0,No=Mo&&cs(Mo)?Mo:void 0,Po=Ir||!G,Fo=No?.messages,Io=(0,Q.useMemo)(()=>{if(!No)return;let e=Fo??[];if(!cs(No)||No.agentType!==`fork`||!No.prompt)return e;let t=No.prompt.trim(),n=-1,r=-1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o.type===`user`&&Array.isArray(o.message?.content)){if(o.message.content.some(SD))n=a;else if(!i){let e=o.message.content.find(e=>e.type===`text`&&typeof e.text==`string`);e&&e.text.trim()===t&&(i=!0)}continue}o.type===`assistant`&&Array.isArray(o.message?.content)&&o.message.content.some(e=>e.type===`tool_use`)&&(r=a)}let a=n===-1?e:e.map((e,t)=>t!==n||!Array.isArray(e.message?.content)?e:{...e,message:{...e.message,content:e.message.content.filter(e=>!SD(e))}});if(i)return a;let o=n===-1?r+1:n+1,s=Qc({content:No.prompt,timestamp:new Date(No.startTime).toISOString()});return[...a.slice(0,o),s,...a.slice(o)]},[No,Fo]),Lo=No?Io??[]:Po?K:tr;if(Ce===`transcript`){let e=hi()&&!A&&!De?ft:void 0,t=(0,$.jsx)(Gm,{messages:To,tools:Ke,commands:Ye,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:yr,isMessageSelectorVisible:!1,conversationId:ri,screen:Ce,agentDefinitions:te,streamingToolUses:Do,showAllInTranscript:Te,isLoading:G,hidePastThinking:!0,streamingThinking:tt,scrollRef:e,jumpRef:ro,onSearchMatchesChange:ho,scanElement:_o,setPositions:bo,disableRenderCap:De}),n=en&&(0,$.jsx)(g,{flexDirection:`column`,width:`100%`,children:en.jsx}),r=(0,$.jsxs)(rf,{children:[(0,$.jsx)(bD,{isAnimating:En,title:yn,disabled:k,noPrefix:!1}),(0,$.jsx)(Vw,{...wo}),(0,$.jsx)(Uw,{onSubmit:ka,isActive:!en?.isLocalJSXCommand}),e?(0,$.jsx)(oD,{scrollRef:ft,isActive:!0,isModal:!io,onScroll:()=>ro.current?.disarmSearch()}):null,(0,$.jsx)(Gw,{...ma}),e?(0,$.jsx)(Um,{scrollRef:ft,scrollable:(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(RT,{})]}),bottom:io?(0,$.jsx)(gD,{jumpRef:ro,initialQuery:``,count:lo,current:fo,onClose:e=>{so(lo>0?e:``),ao(!1),e||(uo(0),po(0),ro.current?.setSearchQuery(``))},onCancel:()=>{ao(!1),ro.current?.setSearchQuery(``),ro.current?.setSearchQuery(oo),go(oo)},setHighlight:go}):(0,$.jsx)(hD,{showAllInTranscript:Te,virtualScroll:!0,status:Ae||void 0,searchBadge:oo&&lo>0?{current:fo,count:lo}:void 0})}):(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(RT,{}),(0,$.jsx)(hD,{showAllInTranscript:Te,virtualScroll:!1,suppressShowAll:De,status:Ae||void 0})]})]});return e?(0,$.jsx)(W,{mouseTracking:Fn(),children:r}):r}let zo=kt&&!No&&Lo.length<=jt.current?kt:void 0,Bo=ca===`tool-permission`?(0,$.jsx)(Uy,{onDone:()=>on(([e,...t])=>t),onReject:Y,toolUseConfirm:an[0],toolUseContext:ba(K,K,rt??_a(),me),verbose:I,setStickyFooter:hi()?cn:void 0},an[0]?.toolUseID):null,Vo=hi()&&en?.isLocalJSXCommand===!0,Uo=Vo?en.jsx:null,Ko=(0,$.jsxs)(rf,{children:[(0,$.jsx)(bD,{isAnimating:En,title:yn,disabled:k,noPrefix:!1}),(0,$.jsx)(Vw,{...wo}),(0,$.jsx)(Uw,{onSubmit:ka,isActive:!en?.isLocalJSXCommand}),(0,$.jsx)(oD,{scrollRef:ft,isActive:hi()&&(Uo!=null||!ca||ca===`tool-permission`),onScroll:$n}),null,(0,$.jsx)(Gw,{...ma}),(0,$.jsx)(of,{dynamicMcpConfig:be,isStrictMcpConfig:p,children:(0,$.jsx)(Um,{scrollRef:ft,overlay:Bo,modal:Uo,modalScrollRef:pt,dividerYRef:Rn,hidePill:!!No,newMessageCount:Jn?.count??0,onPillClick:()=>{Kn(null),Hn(ft.current)},scrollable:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Gm,{messages:Lo,tools:Ke,commands:Ye,verbose:I,toolJSX:en,toolUseConfirmQueue:an,inProgressToolUseIDs:yr,isMessageSelectorVisible:Zr,conversationId:ri,screen:Ce,streamingToolUses:$e,showAllInTranscript:Te,agentDefinitions:te,isLoading:G,streamingText:G&&!No?Br:null,unseenDivider:No?void 0:Jn,scrollRef:hi()?ft:void 0,trackStickyPrompt:hi()?!0:void 0,cursor:Gn,setCursor:Kn,cursorNavRef:qn}),!S&&zo&&!Uo&&(0,$.jsx)(la,{param:{text:zo,type:`text`},addMargin:!0,verbose:I}),en&&!(en.isLocalJSXCommand&&en.isImmediate)&&!Vo&&(0,$.jsx)(g,{flexDirection:`column`,width:`100%`,children:en.jsx}),(0,$.jsx)(g,{flexGrow:1}),Vi&&(0,$.jsx)(lp,{mode:Xe,spinnerTip:V,responseLengthRef:kr,apiMetricsRef:Ar,overrideMessage:Ur,spinnerSuffix:Qa,verbose:I,loadingStartTimeRef:It,totalPausedMsRef:Lt,pauseStartTimeRef:zt,overrideColor:Kr,overrideShimmerColor:Jr,hasActiveTools:yr.size>0,leaderIsIdle:!G})]}),bottom:(0,$.jsx)(g,{flexDirection:`row`,width:`100%`,alignItems:`flex-end`,children:(0,$.jsxs)(g,{flexDirection:`column`,flexGrow:1,children:[hi()&&(0,$.jsx)(hw,{}),sn,en?.isLocalJSXCommand&&en.isImmediate&&!Vo&&(0,$.jsx)(g,{flexDirection:`column`,width:`100%`,children:en.jsx}),!Vi&&!en?.isLocalJSXCommand&&oe&&We&&We.length>0&&(0,$.jsx)(g,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(cp,{tasks:We,isStandalone:!0})}),ca===`sandbox-permission`&&(0,$.jsx)(IT,{hostPattern:ln[0].hostPattern,onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=ln[0];if(!r)return;let i=r.hostPattern.host;un(e=>(e.filter(e=>e.hostPattern.host===i).forEach(e=>e.resolvePromise(t)),e.filter(e=>e.hostPattern.host!==i)))}},ln[0].hostPattern.host),ca===`prompt`&&(0,$.jsx)(pb,{title:dn[0].title,toolInputSummary:dn[0].toolInputSummary,request:dn[0].request,onRespond:e=>{let t=dn[0];t&&(t.resolve({prompt_response:t.request.prompt,selected:e}),fn(([,...e])=>e))},onAbort:()=>{let e=dn[0];e&&(e.reject(Error(`Prompt cancelled by user`)),fn(([,...e])=>e))}},dn[0].request.prompt),ca===`elicitation`&&(0,$.jsx)(ub,{event:ce.queue[0],onResponse:(e,t)=>{let n=ce.queue[0];n&&(n.respond({action:e,content:t}),n.params.mode===`url`&&e===`accept`||U(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})))},onWaitingDismiss:e=>{let t=ce.queue[0];U(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})),t?.onWaitingDismiss?.(e)}},`${ce.queue[0].serverName}:${String(ce.queue[0].requestId)}`),ca===`cost`&&(0,$.jsx)(t_,{onDone:()=>{ni(!1),pi(!0),ju(e=>({...e,hasAcknowledgedCostThreshold:!0}))}}),ca===`idle-return`&&ai&&(0,$.jsx)(n_,{idleMinutes:ai.idleMinutes,totalInputTokens:Pt(),onDone:async e=>{let t=ai;if(oi(null),Math.round(t.idleMinutes),An.current.length,Pt(),e===`dismiss`){dr(t.input);return}if(e===`never`&&ju(e=>e.idleReturnDismissed?e:{...e,idleReturnDismissed:!0}),e===`clear`){let{clearConversation:e}=await import(`./conversation-CSnPSTPX.js`);await e({setMessages:q,readFileState:Wi.current,discoveredSkillNames:Ji.current,loadedNestedMemoryPaths:Zi.current,getAppState:()=>fe.getState(),setAppState:U,setConversationId:ii}),_n.current=!1,gn(void 0),Ki.current.clear(),qi.current=0}ci.current=!0,Aa.current(t.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}}),ta,ca===`plugin-hint`&&Be&&(0,$.jsx)(uE,{pluginName:Be.pluginName,pluginDescription:Be.pluginDescription,marketplaceName:Be.marketplaceName,sourceCommand:Be.sourceCommand,onResponse:Ve}),ca===`search-extra-tools-hint`&&He.visible&&(0,$.jsx)(fE,{tools:He.tools,onSelect:He.handleSelect,onDismiss:He.handleDismiss}),ca===`lsp-recommendation`&&Re&&(0,$.jsx)(sE,{pluginName:Re.pluginName,pluginDescription:Re.pluginDescription,fileExtension:Re.fileExtension,onResponse:ze}),zi(),!en?.shouldHidePromptInput&&!ca&&!ra&&!S&&!Gn&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Nw,{debug:n,hasSuppressedDialogs:!!da,isLocalJSXCommandActive:wn,getToolUseContext:ba,toolPermissionContext:F,setToolPermissionContext:ga,apiKeyStatus:$i,commands:Ye,agents:te.activeAgents,isLoading:G,onExit:ja,verbose:I,messages:K,onAutoUpdaterResult:$t,autoUpdaterResult:Qt,input:or,onInputChange:dr,mode:fr,onModeChange:pr,stashedPrompt:hr,setStashedPrompt:_r,submitCount:Er,onShowMessageSelector:Na,onMessageActionsEnter:void 0,mcpClients:Le,pastedContents:wr,setPastedContents:Tr,vimMode:mi,setVimMode:gi,showBashesDialog:_i,setShowBashesDialog:vi,onSubmit:ka,isSearchingHistory:yi,setIsSearchingHistory:bi,helpOpen:xi,setHelpOpen:Si,insertTextRef:ur}),(0,$.jsx)(yT,{onBackgroundSession:Sa,isLoading:G}),(0,$.jsx)(dT,{})]}),Gn&&(0,$.jsx)(Pa,{cursor:Gn}),ca===`message-selector`&&(0,$.jsx)(mf,{messages:K,preselectedMessage:$r,onPreRestore:pa,onRestoreCode:async e=>{await hc(e=>{U(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)},onSummarize:async(e,t,n=`from`)=>{let r=hn(K),i=r.indexOf(e);if(i===-1){q(e=>[...e,ki(`That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.`,`warning`)]);return}let a=_a(),o=ba(r,[],a,me),s=o.getAppState(),c=await ko(o.options.tools,o.options.mainLoopModel,Array.from(s.toolPermissionContext.additionalWorkingDirectories.keys()),o.options.mcpClients),l=Xr({mainThreadAgentDefinition:void 0,toolUseContext:o,customSystemPrompt:o.options.customSystemPrompt,defaultSystemPrompt:c,appendSystemPrompt:o.options.appendSystemPrompt}),[u,d]=await Promise.all([Nr(),ar()]),f=await Wo(r,i,o,{systemPrompt:l,userContext:u,systemContext:d,toolUseContext:o,forkContextMessages:r},t,n),p=f.messagesToKeep??[],m=n===`up_to`?[...f.summaryMessages,...p]:[...p,...f.summaryMessages],h=[f.boundaryMarker,...m,...f.attachments,...f.hookResults];if(hi()&&n===`from`?q(t=>{let n=t.findIndex(t=>t.uuid===e.uuid);return[...t.slice(0,n===-1?0:n),...h]}):q(h),Ht(!1),ii(_h()),Ro(o.options.querySource),n===`from`){let t=wa(e);t&&(dr(t.text),pr(t.mode))}let g=Wc(`app:toggleTranscript`,`Global`,`ctrl+o`);Fe({key:`summarize-ctrl-o-hint`,text:`Conversation summarized (${g} for history)`,priority:`medium`,timeoutMs:8e3})},onRestoreMessage:La,onClose:()=>{Qr(!1),ei(void 0)}})]})})})},Ya)]});return hi()?(0,$.jsx)(W,{mouseTracking:Fn(),children:Ko}):Ko}export{CD as t};
|