@readmagic/workmate 0.0.16 → 0.0.18

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.
Files changed (339) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DAtfMH4o.js → AddWorkspaceDirectory-Wa6Q24nu.js} +1 -1
  2. package/dist/chunks/{AgentsMdExternalIncludesDialog-BTYgjY5c.js → AgentsMdExternalIncludesDialog-3I_KlOLv.js} +1 -1
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-h150UBir.js +1 -0
  4. package/dist/chunks/{App-HF0bvxi_.js → App-BgPs1Bu8.js} +1 -1
  5. package/dist/chunks/{ApproveApiKey-BBFLw2B7.js → ApproveApiKey-BxpapUq0.js} +1 -1
  6. package/dist/chunks/ApproveApiKey-DIIIi6U8.js +1 -0
  7. package/dist/chunks/{BackgroundTasksDialog-Coc0ecUd.js → BackgroundTasksDialog-nfRmiGl3.js} +1 -1
  8. package/dist/chunks/{BypassPermissionsModeDialog--Gx9ARd4.js → BypassPermissionsModeDialog-8Cq982M0.js} +1 -1
  9. package/dist/chunks/{DiffDialog-tlINuFS1.js → DiffDialog-DwQTDWYh.js} +1 -1
  10. package/dist/chunks/Doctor-Beo5yEMD.js +1 -0
  11. package/dist/chunks/{Doctor-Wh7z6CnF.js → Doctor-BxXAGr-Z.js} +1 -1
  12. package/dist/chunks/{ExitFlow-B1zHTqQt.js → ExitFlow-CVIuvrHT.js} +1 -1
  13. package/dist/chunks/{Grove-1Kf7xxIV.js → Grove-_QX_wR9C.js} +1 -1
  14. package/dist/chunks/{HybridTransport-DWqWUZCH.js → HybridTransport-BG2VIIBC.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-OZPFQSnC.js → InvalidConfigDialog-BDdMkuaL.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-BNCm-eyC.js → InvalidSettingsDialog-DSCqbVER.js} +1 -1
  17. package/dist/chunks/{MCPConnectionManager-7H84oi5n.js → MCPConnectionManager-Cer1UawR.js} +1 -1
  18. package/dist/chunks/{MCPToolListView-CVgtg3Iq.js → MCPToolListView-DndNWDr1.js} +1 -1
  19. package/dist/chunks/{McpParsingWarnings-CN8f449l.js → McpParsingWarnings-Cr_n2QR6.js} +1 -1
  20. package/dist/chunks/{MessageSelector-B9j6zZ5w.js → MessageSelector-BfmbAG8E.js} +1 -1
  21. package/dist/chunks/{Messages-yz1m39eI.js → Messages-CUJJ6nHV.js} +1 -1
  22. package/dist/chunks/{Onboarding-bFbgae8m.js → Onboarding-Cz3CfOTl.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CE_yVun1.js → PromptInputFooterSuggestions-GhA5Qa1I.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-TPWuGwAy.js → PromptInputHelpMenu-sX_yHORM.js} +1 -1
  25. package/dist/chunks/{QueryEngine-CRobcENE.js → QueryEngine-C6Dx_-U8.js} +1 -1
  26. package/dist/chunks/{REPL-C33mMf_q.js → REPL-BPig-OIh.js} +38 -38
  27. package/dist/chunks/REPL-e5wWV2Sl.js +1 -0
  28. package/dist/chunks/{RemoteSessionManager-BjVD918g.js → RemoteSessionManager-Cax4g0GH.js} +1 -1
  29. package/dist/chunks/{ResumeConversation-CXd8d8po.js → ResumeConversation-e5sISbWn.js} +1 -1
  30. package/dist/chunks/{SSETransport-BSilVN9e.js → SSETransport-BuDKErlN.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-B_z74zwG.js +1 -0
  32. package/dist/chunks/{Settings-ClcLl0C1.js → Settings-B9rxF2wR.js} +2 -2
  33. package/dist/chunks/{TeleportProgress-DonJUoPc.js → TeleportProgress-BUtze4qa.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-ByOuSVVz.js → TeleportRepoMismatchDialog-Dp7rzrrz.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-BBtELwF1.js → TeleportResumeWrapper-Ch2osY21.js} +1 -1
  36. package/dist/chunks/{ThemePicker-1QQJFOEv.js → ThemePicker-AA-0hjpq.js} +1 -1
  37. package/dist/chunks/{TrustDialog-DwJ9L_u4.js → TrustDialog-rO5dZ8G-.js} +1 -1
  38. package/dist/chunks/{ValidationErrorsList-Cuq6W2yc.js → ValidationErrorsList-DayOwxq9.js} +1 -1
  39. package/dist/chunks/{add-dir-DOKdPFT2.js → add-dir-Cz33IGht.js} +1 -1
  40. package/dist/chunks/{agentDisplay-TX1bh-lX.js → agentDisplay-nVTmC7tL.js} +1 -1
  41. package/dist/chunks/{agents-C58tRxpi.js → agents-BQwi-6GV.js} +1 -1
  42. package/dist/chunks/{agents-CbRjX9Pj.js → agents-rfuJUSSc.js} +1 -1
  43. package/dist/chunks/{allErrors-DRiW7i6Y.js → allErrors-YIRWFBD9.js} +1 -1
  44. package/dist/chunks/api-CGk-0H2x.js +1 -0
  45. package/dist/chunks/{api-CazVavfB.js → api-DAyhTxgY.js} +1 -1
  46. package/dist/chunks/{auth-CfrCl9BZ.js → auth-BzrroWLq.js} +1 -1
  47. package/dist/chunks/auth-DWWb8STf.js +1 -0
  48. package/dist/chunks/auth-DsqlBO-Q.js +1 -0
  49. package/dist/chunks/{backgroundHousekeeping-CPLlaWcV.js → backgroundHousekeeping-CXv_Pm5h.js} +2 -2
  50. package/dist/chunks/backgroundHousekeeping-Crx3oXIu.js +1 -0
  51. package/dist/chunks/{banner-HfMnBd03.js → banner-BfIcVEUU.js} +1 -1
  52. package/dist/chunks/{bg-DltfF1_K.js → bg-C15c_rMK.js} +2 -2
  53. package/dist/chunks/{branch-pAa0oBaj.js → branch-BEaujq-M.js} +1 -1
  54. package/dist/chunks/{break-cache-Cd1yQ-0h.js → break-cache-XKbOAw-u.js} +2 -2
  55. package/dist/chunks/{bridgeConfig-DnFfCpGd.js → bridgeConfig-Bxkrv8ZL.js} +1 -1
  56. package/dist/chunks/bridgeConfig-Ctl7I_RR.js +1 -0
  57. package/dist/chunks/{bridgeMessaging-B_hnuUHb.js → bridgeMessaging-BcSjIPCZ.js} +1 -1
  58. package/dist/chunks/bridgePointer-CGhOBNMg.js +1 -0
  59. package/dist/chunks/bridgeStatusUtil-DBWBTU31.js +1 -0
  60. package/dist/chunks/{btw-CkVkYeRr.js → btw-8JqSG3o7.js} +1 -1
  61. package/dist/chunks/caches-dnO4Ae_m.js +1 -0
  62. package/dist/chunks/caches-lPzD_yGv.js +1 -0
  63. package/dist/chunks/{capacityWake-LRiPhPeM.js → capacityWake-C24_KT1x.js} +1 -1
  64. package/dist/chunks/{ccrClient-AfdUbWzY.js → ccrClient-CH6PsxJJ.js} +1 -1
  65. package/dist/chunks/{claudeDesktop-CB3UCt7U.js → claudeDesktop-CovdLe-b.js} +1 -1
  66. package/dist/chunks/{clear-Ac3qYi_-.js → clear-D72LxXA6.js} +1 -1
  67. package/dist/chunks/{cliLaunch-xIVvtPZy.js → cliLaunch-DDA65zeR.js} +1 -1
  68. package/dist/chunks/client-BFjMSlp7.js +1 -0
  69. package/dist/chunks/client-Byat5HpG.js +1 -0
  70. package/dist/chunks/client-Dzx24jGZ.js +1 -0
  71. package/dist/chunks/{client-Bb2eZnuq.js → client-eLOYyeES.js} +1 -1
  72. package/dist/chunks/{client-DNEVh6Wu.js → client-o5_awagP.js} +1 -1
  73. package/dist/chunks/commands-D3lQbt9p.js +1 -0
  74. package/dist/chunks/{compact-CXuDr5qM.js → compact--fnu8Zd-.js} +1 -1
  75. package/dist/chunks/{config-D78R57VA.js → config-BlQhL9Bh.js} +1 -1
  76. package/dist/chunks/{config-BSkuQZNf.js → config-BybjRr09.js} +1 -1
  77. package/dist/chunks/config-CPGSP_1Z.js +1 -0
  78. package/dist/chunks/{context-C2plOqH4.js → context-D6PaqwrR.js} +1 -1
  79. package/dist/chunks/context-noninteractive-CwlOID3q.js +1 -0
  80. package/dist/chunks/{context-noninteractive-fVQtwEkw.js → context-noninteractive-CxoMCfR4.js} +1 -1
  81. package/dist/chunks/conversation-BLEWB1BE.js +1 -0
  82. package/dist/chunks/{conversation-DQpS6nvg.js → conversation-Bos7yTIv.js} +1 -1
  83. package/dist/chunks/{createSSHSession-CfyFuJMH.js → createSSHSession-B3FdForb.js} +1 -1
  84. package/dist/chunks/createSession-B4wkDNam.js +1 -0
  85. package/dist/chunks/{createSession-qk9C66lK.js → createSession-C0e_DHsW.js} +1 -1
  86. package/dist/chunks/{crossProjectResume-DY1ZBO5P.js → crossProjectResume-C5QtstD6.js} +1 -1
  87. package/dist/chunks/cwd-BfiQQAqr.js +1 -0
  88. package/dist/chunks/{cwd-Besi3Os3.js → cwd-Dj2ynhWd.js} +1 -1
  89. package/dist/chunks/{datadog-Cr0VKbct.js → datadog-ZxeaKwKd.js} +1 -1
  90. package/dist/chunks/{debug-BQj6h99Q.js → debug-D7OBvqC2.js} +1 -1
  91. package/dist/chunks/{debugUtils-B86DM1Sp.js → debugUtils-B-GMBTBk.js} +1 -1
  92. package/dist/chunks/{detached--wGwkuHX.js → detached-uMuMcLsV.js} +1 -1
  93. package/dist/chunks/{detectRepository-Qy3zKoyn.js → detectRepository-AVEUw4lk.js} +1 -1
  94. package/dist/chunks/detectRepository-CWI2xcdR.js +1 -0
  95. package/dist/chunks/{diff-BNjcCXDr.js → diff-BA2vN7sD.js} +1 -1
  96. package/dist/chunks/{directoryCompletion-i2oWpaUe.js → directoryCompletion-CLcmLin8.js} +1 -1
  97. package/dist/chunks/doctor-BV6zhneX.js +1 -0
  98. package/dist/chunks/{entry-o9IZPS4g.js → entry-cou5DS53.js} +2 -2
  99. package/dist/chunks/{esm-BI3tFLyy.js → esm-D9-9wS1F.js} +1 -1
  100. package/dist/chunks/{execFileNoThrow-DYm1GeGn.js → execFileNoThrow-BHDSgTpZ.js} +1 -1
  101. package/dist/chunks/{execSyncWrapper-CqvQqke-.js → execSyncWrapper-pYxQXqb-.js} +1 -1
  102. package/dist/chunks/{exit-Dlyj7nY8.js → exit-DdZJHhy2.js} +1 -1
  103. package/dist/chunks/{extraUsage-5Ueiyw6W.js → extraUsage-CHnG6JNH.js} +1 -1
  104. package/dist/chunks/extractMemories-DxGHxoNO.js +1 -0
  105. package/dist/chunks/fast-Bf-g-wR6.js +1 -0
  106. package/dist/chunks/{fast-ClOKONyD.js → fast-Bl_0cs9e.js} +1 -1
  107. package/dist/chunks/{fetchModelList-gh_jFYai.js → fetchModelList-CheIBH5f.js} +1 -1
  108. package/dist/chunks/fetchModelList-vk-RMDfG.js +1 -0
  109. package/dist/chunks/{fileSuggestions-DK7W8kLF.js → fileSuggestions-Dl87JhBr.js} +1 -1
  110. package/dist/chunks/{firstPartyEventLogger-BMnXb9cv.js → firstPartyEventLogger-Cw9Bc3on.js} +2 -2
  111. package/dist/chunks/firstPartyEventLogger-DvsZdBy2.js +1 -0
  112. package/dist/chunks/flushGate-BD3Tk3_k.js +1 -0
  113. package/dist/chunks/{gemini-C8-QHnsC.js → gemini-BARUjH_t.js} +1 -1
  114. package/dist/chunks/{generateSessionName-C8DnAVaa.js → generateSessionName-CHaK44K-.js} +1 -1
  115. package/dist/chunks/{genericProcessUtils-Bbcbi11g.js → genericProcessUtils-D5hCZ2ho.js} +1 -1
  116. package/dist/chunks/git-Bujlb5tq.js +1 -0
  117. package/dist/chunks/{git-DplvjXEY.js → git-CNhyfMtb.js} +1 -1
  118. package/dist/chunks/{githubRepoPathMapping-Px3_GeD1.js → githubRepoPathMapping-Dhz4cvw2.js} +1 -1
  119. package/dist/chunks/{goal-DMmzlZOF.js → goal-fTQFogdl.js} +1 -1
  120. package/dist/chunks/{grok-LLjpAwP_.js → grok-D0J4IiCe.js} +1 -1
  121. package/dist/chunks/{grove-CQBCzeHf.js → grove-mDH4wkhM.js} +1 -1
  122. package/dist/chunks/{help-JH7WzjZP.js → help-Dr7st1Yv.js} +1 -1
  123. package/dist/chunks/hooks-C5YSYzSl.js +1 -0
  124. package/dist/chunks/{hooks-DD2jpRfx.js → hooks-DCfpFhl2.js} +1 -1
  125. package/dist/chunks/{initReplBridge-BDaN0hpY.js → initReplBridge-BFYTAFlT.js} +1 -1
  126. package/dist/chunks/{install-CD4or0vj.js → install-CjacxFXg.js} +1 -1
  127. package/dist/chunks/{instrumentation-n-otwpYf.js → instrumentation-DS2S1m1a.js} +3 -3
  128. package/dist/chunks/{job-B-pEWgXI.js → job-Dry-GMc5.js} +1 -1
  129. package/dist/chunks/{jwtUtils-YCoZL0FW.js → jwtUtils-ClCcC8lO.js} +1 -1
  130. package/dist/chunks/{keybindings-qed9q9tx.js → keybindings-D01jzjKu.js} +1 -1
  131. package/dist/chunks/{launchLocalMemory-cBovdGMT.js → launchLocalMemory-_T0oHfh9.js} +1 -1
  132. package/dist/chunks/{launchOnboarding-B__wtt7p.js → launchOnboarding-D4fS6pLc.js} +1 -1
  133. package/dist/chunks/{external-CEp-aPkt.js → lazySchema-DULtBUCI.js} +1 -1
  134. package/dist/chunks/{loadAgentsDir-PPiD2Mfq.js → loadAgentsDir-DnsldjYU.js} +560 -560
  135. package/dist/chunks/loadAgentsDir-xG1HswS_.js +1 -0
  136. package/dist/chunks/{loadPluginHooks-DUCuU3_8.js → loadPluginHooks-CRoYa_il.js} +1 -1
  137. package/dist/chunks/loader-C-PQ3onD.js +1 -0
  138. package/dist/chunks/localSearch-B17Mzd84.js +1 -0
  139. package/dist/chunks/{localSearch-Cvs9WfoX.js → localSearch-nuNjYVKq.js} +1 -1
  140. package/dist/chunks/{log-BlJ7CcKG.js → log-CR0v5KUR.js} +1 -1
  141. package/dist/chunks/{logoV2Utils-Bkj74dtY.js → logoV2Utils-CZwL_VX1.js} +1 -1
  142. package/dist/chunks/{magicDocs-3U6peChg.js → magicDocs-D0rjtxup.js} +1 -1
  143. package/dist/chunks/{main-DkjxhBIC.js → main-C8n_p7yX.js} +11 -11
  144. package/dist/chunks/{main-Zh18lf2J.js → main-DKqCPH3G.js} +2 -2
  145. package/dist/chunks/managedEnv-C7bVtcgA.js +1 -0
  146. package/dist/chunks/managedEnv-d7HliQYg.js +1 -0
  147. package/dist/chunks/{mappers-ZGgwqDOK.js → mappers-BIDALdjB.js} +1 -1
  148. package/dist/chunks/{mcp-CysOyBIn.js → mcp-BcEApfqn.js} +1 -1
  149. package/dist/chunks/{mcp-CdyNeNzh.js → mcp-CBbVcOTy.js} +1 -1
  150. package/dist/chunks/{mcp-COZxwgJZ.js → mcp-DYtfHeRa.js} +3 -3
  151. package/dist/chunks/{memoize-_2f7NWDv.js → memoize-C7xmvAQ0.js} +1 -1
  152. package/dist/chunks/{memory-B5h2TTSS.js → memory-CijapyZk.js} +1 -1
  153. package/dist/chunks/{mode-D3yY1fdK.js → mode-CajUX4Uz.js} +1 -1
  154. package/dist/chunks/model-CyF5u3zH.js +1 -0
  155. package/dist/chunks/model-DaYZWYJe.js +1 -0
  156. package/dist/chunks/model-xI2MbgRj.js +1 -0
  157. package/dist/chunks/{modelOptions-DYQqTLPi.js → modelOptions-Ct80yABl.js} +1 -1
  158. package/dist/chunks/{nativeInstaller-N1xiUpCP.js → nativeInstaller-C6aWHxve.js} +1 -1
  159. package/dist/chunks/{omit-BOILu8jW.js → omit-BhPlISSj.js} +1 -1
  160. package/dist/chunks/{onChangeAppState-COFFZAXb.js → onChangeAppState-BOJd4Yce.js} +1 -1
  161. package/dist/chunks/{openai-BHM5kEFo.js → openai-wsPCDwGL.js} +1 -1
  162. package/dist/chunks/{panel-Bg_0PHE6.js → panel-BKMLX5AR.js} +1 -1
  163. package/dist/chunks/parser-B-QFQfSO.js +1 -0
  164. package/dist/chunks/{parser-a2S_eFyE.js → parser-Dy-RMf4a.js} +1 -1
  165. package/dist/chunks/{partition-C1SFDk_L.js → partition-_qZZlGjS.js} +1 -1
  166. package/dist/chunks/{permissions-uy_NFbfy.js → permissions-CcjGscyg.js} +1 -1
  167. package/dist/chunks/{pidLock-DuMVSwnN.js → pidLock-Cm9FWa4w.js} +2 -2
  168. package/dist/chunks/{plan-DF9YSB5M.js → plan-CTiLy_c4.js} +1 -1
  169. package/dist/chunks/{platform-DVeTi9mp.js → platform-BZm4WVLM.js} +1 -1
  170. package/dist/chunks/{plugin-GRPzqgTr.js → plugin-D7vjs6Hu.js} +1 -1
  171. package/dist/chunks/{pluginAutoupdate-AMD-FvKB.js → pluginAutoupdate-DzK-fXJC.js} +1 -1
  172. package/dist/chunks/{pluginBlocklist-DNxkAxH6.js → pluginBlocklist-B3JVl1h2.js} +1 -1
  173. package/dist/chunks/{pluginCliCommands-BFoR1ZXx.js → pluginCliCommands-CubOvlhc.js} +1 -1
  174. package/dist/chunks/{pluginFlagging-CW2IZWSI.js → pluginFlagging-Dp7W2eL8.js} +1 -1
  175. package/dist/chunks/{pluginOperations-DlWE0idP.js → pluginOperations-BxHoy0pC.js} +1 -1
  176. package/dist/chunks/{pluginStartupCheck-AQGV0DCS.js → pluginStartupCheck-CL24_zVV.js} +1 -1
  177. package/dist/chunks/pluginStartupCheck-CtX6QkdO.js +1 -0
  178. package/dist/chunks/{plugins-CwUSTE4E.js → plugins-DA3lpRU4.js} +1 -1
  179. package/dist/chunks/pollConfig-2nFzv6Hy.js +1 -0
  180. package/dist/chunks/poorMode-DyAWNRRM.js +1 -0
  181. package/dist/chunks/{poorMode-wm2WkPF0.js → poorMode-aMzKXz6G.js} +1 -1
  182. package/dist/chunks/{print-9wR_ijrL.js → print-BrqZ3AgP.js} +5 -5
  183. package/dist/chunks/{processBashCommand-Deqwq1IE.js → processBashCommand-C6mBgRVz.js} +1 -1
  184. package/dist/chunks/{processSlashCommand-U9LJ4Keq.js → processSlashCommand-t0-BVku8.js} +1 -1
  185. package/dist/chunks/prompt-BJ3xYAvE.js +1 -0
  186. package/dist/chunks/{prompt-CQmEvnKN.js → prompt-CzQkcxfg.js} +3 -3
  187. package/dist/chunks/prompt-Di2lNwYp.js +1 -0
  188. package/dist/chunks/{promptEditor-Bf72KNF-.js → promptEditor-C6w1vT5E.js} +1 -1
  189. package/dist/chunks/{protocolHandler--eQQuSyx.js → protocolHandler-B3bQyB6W.js} +1 -1
  190. package/dist/chunks/{proxy-C0j74LqT.js → proxy-DFIxRT0i.js} +1 -1
  191. package/dist/chunks/{reconciler-Css9bs07.js → reconciler-p4lAu9ft.js} +1 -1
  192. package/dist/chunks/{refresh-B87z39Zs.js → refresh-DCQChX5A.js} +1 -1
  193. package/dist/chunks/{registerProtocol-DrWIX3Lb.js → registerProtocol-CrzdmgCD.js} +1 -1
  194. package/dist/chunks/{reload-plugins-BpmUIkfm.js → reload-plugins-BnZzcRcd.js} +1 -1
  195. package/dist/chunks/{remoteBridgeCore-BCLIIygk.js → remoteBridgeCore-DAK9KSWp.js} +1 -1
  196. package/dist/chunks/remoteManagedSettings-DkLfclxa.js +1 -0
  197. package/dist/chunks/{rename-BUt3PliQ.js → rename-OSN3Ua2J.js} +1 -1
  198. package/dist/chunks/{renderOptions-CkqTbz6d.js → renderOptions-XgkOdKCJ.js} +1 -1
  199. package/dist/chunks/{resume-uZI9p_FE.js → resume-K9q5B1li.js} +1 -1
  200. package/dist/chunks/{ripgrep-DsLUmulz.js → ripgrep-C_XuTqp3.js} +1 -1
  201. package/dist/chunks/ripgrep-DLPH9MP9.js +1 -0
  202. package/dist/chunks/{runtimeObserver-AKOWfdZ_.js → runtimeObserver-CuTsWhhF.js} +1 -1
  203. package/dist/chunks/{runtimeObserver-By59MZKJ.js → runtimeObserver-D9sujsqj.js} +2 -2
  204. package/dist/chunks/sandbox-adapter-CRxZBMAP.js +1 -0
  205. package/dist/chunks/{sandbox-toggle-BdvylnWS.js → sandbox-toggle-oasrWfbj.js} +1 -1
  206. package/dist/chunks/searchExtraTools-BAYzzTE8.js +1 -0
  207. package/dist/chunks/{session-Tm2-rzBY.js → session-c46jULDV.js} +1 -1
  208. package/dist/chunks/sessionFileAccessHooks-CwnjOk6S.js +1 -0
  209. package/dist/chunks/{sessionObserver-BAr8AWeL.js → sessionObserver-Cu7vykWp.js} +1 -1
  210. package/dist/chunks/sessionObserver-DNjDoJmy.js +1 -0
  211. package/dist/chunks/{sessionState-BTFowSpR.js → sessionState-B3tFm9SC.js} +1 -1
  212. package/dist/chunks/sessionStorage-CVZ0MUSE.js +1 -0
  213. package/dist/chunks/sessionTitle-k4wpUS5l.js +2 -0
  214. package/dist/chunks/{sessionTracing-CvY4udYI.js → sessionTracing-BRp_Ej-e.js} +1 -1
  215. package/dist/chunks/{settings-CvhsRFaT.js → settings-DUyIag_5.js} +4 -4
  216. package/dist/chunks/settings-DsqFBv6J.js +1 -0
  217. package/dist/chunks/settingsSync-yE43qjMS.js +1 -0
  218. package/dist/chunks/{setup-D4FPeBnM.js → setup-CFOc-hPM.js} +2 -2
  219. package/dist/chunks/{shadowedRuleDetection-Co8m1q1D.js → shadowedRuleDetection-ChoqK1Iq.js} +1 -1
  220. package/dist/chunks/{shellQuote-D3Ocv_U-.js → shellQuote-C-7PluUY.js} +1 -1
  221. package/dist/chunks/{sideQuestion-4TJYn-Az.js → sideQuestion-CkC27Pf3.js} +1 -1
  222. package/dist/chunks/sinks-B64r_OBE.js +1 -0
  223. package/dist/chunks/{sinks-Bb2i50kz.js → sinks-C9qCsi94.js} +1 -1
  224. package/dist/chunks/{skillChangeDetector-BU9AFG0i.js → skillChangeDetector-CLnn22Jo.js} +1 -1
  225. package/dist/chunks/{skillGapStore-BcVP3ZUb.js → skillGapStore-DC8s2Whn.js} +2 -2
  226. package/dist/chunks/{skillLifecycle-CG2XmS8f.js → skillLifecycle-BaqH5lw_.js} +2 -2
  227. package/dist/chunks/{skillSearchPanel-DOJmUBXB.js → skillSearchPanel-Dtvyo2Dk.js} +2 -2
  228. package/dist/chunks/{skills-DIgCWvzX.js → skills-DXW57WeY.js} +1 -1
  229. package/dist/chunks/{startupProfiler-2sjXZkIP.js → startupProfiler-BqUlQEaV.js} +1 -1
  230. package/dist/chunks/startupProfiler-yBU6FaAV.js +1 -0
  231. package/dist/chunks/{state-BPFYBqm1.js → state-B3zvBu4R.js} +1 -1
  232. package/dist/chunks/state-mHtumqEo.js +1 -0
  233. package/dist/chunks/{stats-Dq-5qizS.js → stats-vvwEVnon.js} +1 -1
  234. package/dist/chunks/status--Ql7l0VG.js +1 -0
  235. package/dist/chunks/{status-Ber2xOXc.js → status-g_dhM6Ep.js} +1 -1
  236. package/dist/chunks/{statusNoticeHelpers-CYkrPUpN.js → statusNoticeHelpers-B235FWru.js} +1 -1
  237. package/dist/chunks/{stringUtils-BjnclTLB.js → stringUtils-CGZoOfer.js} +1 -1
  238. package/dist/chunks/switcher-Cb9R9247.js +1 -0
  239. package/dist/chunks/switcher-OAeeTHHt.js +1 -0
  240. package/dist/chunks/{syncCache-AMQMQ_HR.js → syncCache-BiqQEess.js} +1 -1
  241. package/dist/chunks/{tasks-BKERIO4G.js → tasks--7yJk7MD.js} +1 -1
  242. package/dist/chunks/{teleport-DOXbf2sQ.js → teleport-ja50aVy3.js} +1 -1
  243. package/dist/chunks/{templateJobs-dg2F45ZJ.js → templateJobs-DSM3tNDS.js} +1 -1
  244. package/dist/chunks/{terminalSetup-JJiXmszo.js → terminalSetup-BpZXqE_G.js} +1 -1
  245. package/dist/chunks/{terminalSetup-DDvQ0K5e.js → terminalSetup-C735-5lZ.js} +1 -1
  246. package/dist/chunks/{theme-BGxytGjA.js → theme-BX54e0r7.js} +1 -1
  247. package/dist/chunks/{tmux-g0cQ0Buz.js → tmux-BIdWN33b.js} +1 -1
  248. package/dist/chunks/{toolEventObserver-CJhg_p3P.js → toolEventObserver-O6ljakS9.js} +1 -1
  249. package/dist/chunks/{toolPool-C0d7Bznl.js → toolPool-H_kXc8vo.js} +1 -1
  250. package/dist/chunks/trustedDevice-Dm_SY3Ko.js +1 -0
  251. package/dist/chunks/{trustedDevice-BtXHXu-T.js → trustedDevice-Kyid5Fuy.js} +1 -1
  252. package/dist/chunks/{types-BomO8WUz.js → types-DDku8UKF.js} +2 -2
  253. package/dist/chunks/{udsClient-DSvRPCvR.js → udsClient-B2yCKNgT.js} +1 -1
  254. package/dist/chunks/{upstreamproxy-DYoLvdM9.js → upstreamproxy--RTAcgrE.js} +1 -1
  255. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-C9orgrub.js → useExitOnCtrlCDWithKeybindings-BnmDpMkm.js} +1 -1
  256. package/dist/chunks/useMainLoopModel-DG8pghH7.js +1 -0
  257. package/dist/chunks/{useManagePlugins-Bt-DYAnX.js → useManagePlugins-HMHtjIY-.js} +1 -1
  258. package/dist/chunks/{useMergedTools-CZeQBdky.js → useMergedTools-ChLA8dsy.js} +1 -1
  259. package/dist/chunks/{useSearchInput-DdKrVHJS.js → useSearchInput-DqymtQhH.js} +1 -1
  260. package/dist/chunks/{useSettingsErrors-BR9Wws7D.js → useSettingsErrors-Bs9uyzW4.js} +1 -1
  261. package/dist/chunks/{userAgent-DUt0q-Vl.js → userAgent-D8vvjitA.js} +1 -1
  262. package/dist/chunks/{util-h-Hmdke_.js → util-CC-NRn16.js} +1 -1
  263. package/dist/chunks/validatePlugin-yCb8gsVF.js +1 -0
  264. package/dist/chunks/{vim-s-wmybpU.js → vim-CIK2DjfK.js} +1 -1
  265. package/dist/chunks/{which-BR8YVCCW.js → which-3MmqfsNV.js} +1 -1
  266. package/dist/chunks/windowsPaths-Dd_S96Bq.js +1 -0
  267. package/dist/chunks/{windowsPaths-BmXyrasP.js → windowsPaths-x-CxdtFP.js} +1 -1
  268. package/dist/chunks/{workSecret-BUd8cQ6-.js → workSecret-BsolC5S7.js} +1 -1
  269. package/dist/chunks/{workerRegistry-dlfqtySm.js → workerRegistry-DE4Ghp-n.js} +2 -2
  270. package/dist/chunks/worktree-D-CgffvU.js +1 -0
  271. package/dist/cli.js +1 -1
  272. package/package.json +1 -1
  273. package/dist/chunks/AgentsMdExternalIncludesDialog-C6VH6JG6.js +0 -1
  274. package/dist/chunks/ApproveApiKey-B7mKgSqY.js +0 -1
  275. package/dist/chunks/Doctor-BJf49FWX.js +0 -1
  276. package/dist/chunks/REPL-BhCC0JP6.js +0 -1
  277. package/dist/chunks/SearchExtraToolsTool-DoiCI2uJ.js +0 -1
  278. package/dist/chunks/api-C8uOHD-v.js +0 -1
  279. package/dist/chunks/auth-BL238vgr.js +0 -1
  280. package/dist/chunks/auth-D3GkU6d7.js +0 -1
  281. package/dist/chunks/backgroundHousekeeping-Du2tN2WE.js +0 -1
  282. package/dist/chunks/bridgeConfig-joBqeK0j.js +0 -1
  283. package/dist/chunks/bridgePointer-CiHy2tTN.js +0 -1
  284. package/dist/chunks/bridgeStatusUtil-Dwz4YHNA.js +0 -1
  285. package/dist/chunks/caches-BLQUkrIG.js +0 -1
  286. package/dist/chunks/caches-DsFl83sh.js +0 -1
  287. package/dist/chunks/client-BX0r6K3I.js +0 -1
  288. package/dist/chunks/client-Pap_HyZZ.js +0 -1
  289. package/dist/chunks/client-zhozU2ws.js +0 -1
  290. package/dist/chunks/commands-BKLsl6gK.js +0 -1
  291. package/dist/chunks/config-DrY1SvhQ.js +0 -1
  292. package/dist/chunks/context-noninteractive-DpVlZ-wP.js +0 -1
  293. package/dist/chunks/conversation-C0yysXds.js +0 -1
  294. package/dist/chunks/createSession-CmBawnsh.js +0 -1
  295. package/dist/chunks/cwd-DpqwaYHw.js +0 -1
  296. package/dist/chunks/detectRepository-tRUoPOKy.js +0 -1
  297. package/dist/chunks/doctor-BkCtT7H1.js +0 -1
  298. package/dist/chunks/extractMemories-DnTBWFOW.js +0 -1
  299. package/dist/chunks/fast-B3fRp1xO.js +0 -1
  300. package/dist/chunks/fetchModelList-B8KG79EK.js +0 -1
  301. package/dist/chunks/firstPartyEventLogger-YYOb8aIo.js +0 -1
  302. package/dist/chunks/flushGate-n4kK6H1U.js +0 -1
  303. package/dist/chunks/git-BaSq69E7.js +0 -1
  304. package/dist/chunks/hooks-COhKt_pF.js +0 -1
  305. package/dist/chunks/lazySchema-B4D4qJVE.js +0 -1
  306. package/dist/chunks/loadAgentsDir-qvqrTVuS.js +0 -1
  307. package/dist/chunks/localSearch-CDk_stXJ.js +0 -1
  308. package/dist/chunks/managedEnv-BUrzwaD3.js +0 -1
  309. package/dist/chunks/managedEnv-XOUMOtEF.js +0 -1
  310. package/dist/chunks/model-Bz4JHoU0.js +0 -1
  311. package/dist/chunks/model-g6XBcNAG.js +0 -1
  312. package/dist/chunks/model-sviY1inu.js +0 -1
  313. package/dist/chunks/parser-x-w3ikxt.js +0 -1
  314. package/dist/chunks/pluginStartupCheck-DWpquqxx.js +0 -1
  315. package/dist/chunks/pollConfig-BgpfHQPJ.js +0 -1
  316. package/dist/chunks/poorMode-DD88nPJ4.js +0 -1
  317. package/dist/chunks/prompt-BBeDQXIs.js +0 -1
  318. package/dist/chunks/prompt-CXhdqgB7.js +0 -1
  319. package/dist/chunks/remoteManagedSettings-Ahgn2e80.js +0 -1
  320. package/dist/chunks/ripgrep-Di-2j8Ws.js +0 -1
  321. package/dist/chunks/sandbox-adapter-D4Uho1vF.js +0 -1
  322. package/dist/chunks/searchExtraTools-BHMkqGBf.js +0 -1
  323. package/dist/chunks/sessionFileAccessHooks-BaWZ8sqn.js +0 -1
  324. package/dist/chunks/sessionObserver-KB1UL_n2.js +0 -1
  325. package/dist/chunks/sessionStorage-D6nlmaI-.js +0 -1
  326. package/dist/chunks/sessionTitle-SCqmSDYM.js +0 -14
  327. package/dist/chunks/settings-BgHApyGL.js +0 -1
  328. package/dist/chunks/settingsSync-nxeaGM2-.js +0 -1
  329. package/dist/chunks/sinks-D1opmy_x.js +0 -1
  330. package/dist/chunks/startupProfiler-B2fyaBEa.js +0 -1
  331. package/dist/chunks/state-CsdHk8n-.js +0 -1
  332. package/dist/chunks/status-CVcXPoOZ.js +0 -1
  333. package/dist/chunks/switcher-BIP3rbQn.js +0 -1
  334. package/dist/chunks/switcher-zbG6T9dN.js +0 -1
  335. package/dist/chunks/trustedDevice-hw3iq84W.js +0 -1
  336. package/dist/chunks/useMainLoopModel-BigVcn2T.js +0 -1
  337. package/dist/chunks/validatePlugin-mWVKNtJa.js +0 -1
  338. package/dist/chunks/windowsPaths-BybjGW7e.js +0 -1
  339. package/dist/chunks/worktree-IxcFe7g-.js +0 -1
@@ -0,0 +1 @@
1
+ import{t as e}from"./REPL-BPig-OIh.js";export{e as REPL};
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"./memoize-BK3gG5ob.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{$y as i,Dw as a,Io as o,Ro as s,Sr as c,To as l,Xy as ee,_T as te,bC as ne,bg as re,br as ie,db as u,gb as d,hb as f,kw as p,lb as m,mb as h,mg as g,pb as _,rb as v,sb as y,vT as b,xo as ae,yC as x}from"./loadAgentsDir-PPiD2Mfq.js";import{di as oe,fi as se,j as S,t as ce}from"./src-DL3w8VPk2.js";import{n as le,t as C}from"./cwd-Besi3Os3.js";import{C as w,P as ue,R as de,S as fe,c as T,i as E,x as D}from"./debug-BQj6h99Q.js";import{Kt as O,Yt as k,f as A,g as j,n as M}from"./settings-CvhsRFaT.js";import{c as N,h as P,o as F,v as I,y as L}from"./config-BSkuQZNf.js";import{f as R,l as z,m as B,p as V}from"./git-DplvjXEY.js";import{n as H,r as pe}from"./execFileNoThrow-DYm1GeGn.js";import{o as U,s as W}from"./log-BlJ7CcKG.js";import{i as G,o as me}from"./platform-DVeTi9mp.js";import{l as he,u as ge}from"./oauth-D38aRTUb.js";import{$r as _e,Ft as ve,Pt as ye,_ as be,g as xe,ti as Se}from"./model-sviY1inu.js";import{c as Ce,h as we,l as Te,m as K,s as Ee}from"./proxy-C0j74LqT.js";import{c as De,i as Oe}from"./terminalSetup-JJiXmszo.js";import{l as ke,o as Ae}from"./api-CazVavfB.js";import{c as je,u as Me}from"./firstPartyEventLogger-BMnXb9cv.js";import{randomUUID as Ne}from"crypto";t(),te(),le(),P(),k(),pe(),B(),U(),Me();var Pe=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function Fe(e){return!Pe.some(t=>t.test(e))}function Ie(e,t){let n=[],r=new Set,i=new Map;for(let a=1;n.length<t&&a<=t;a++)for(let o of e){if(n.length>=t)break;if(!Fe(o))continue;let e=Math.max(o.lastIndexOf(`/`),o.lastIndexOf(`\\`)),s=e>=0?o.slice(e+1):o;if(!s||r.has(s))continue;let c=e>=0?o.slice(0,e):`.`;(i.get(c)??0)>=a||(n.push(s),r.add(s),i.set(c,(i.get(c)??0)+1))}return n.length>=t?n:[]}async function Le(){if(O.platform===`win32`||!await z())return[];try{let e=await je(),t=[`log`,`-n`,`1000`,`--pretty=format:`,`--name-only`,`--diff-filter=M`],n=new Map,r=e=>{for(let t of e.split(`
1
+ import{n as e,t}from"./memoize-BK3gG5ob.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{$y as i,Dw as a,Io as o,Ro as s,Sr as c,To as l,Xy as ee,_T as te,bC as ne,bg as re,br as ie,db as u,gb as d,hb as f,kw as p,lb as m,mb as h,mg as g,pb as _,rb as v,sb as y,vT as b,xo as ae,yC as x}from"./loadAgentsDir-DnsldjYU.js";import{di as oe,fi as se,j as S,t as ce}from"./src-DL3w8VPk2.js";import{n as le,t as C}from"./cwd-Dj2ynhWd.js";import{C as w,P as ue,R as de,S as fe,c as T,i as E,x as D}from"./debug-D7OBvqC2.js";import{Kt as O,Yt as k,f as A,g as j,n as M}from"./settings-DUyIag_5.js";import{c as N,h as P,o as F,v as I,y as L}from"./config-BybjRr09.js";import{f as R,l as z,m as B,p as V}from"./git-CNhyfMtb.js";import{n as H,r as pe}from"./execFileNoThrow-BHDSgTpZ.js";import{o as U,s as W}from"./log-CR0v5KUR.js";import{i as G,o as me}from"./platform-BZm4WVLM.js";import{l as he,u as ge}from"./oauth-D38aRTUb.js";import{$r as _e,Ft as ve,Pt as ye,_ as be,g as xe,ti as Se}from"./model-xI2MbgRj.js";import{c as Ce,h as we,l as Te,m as K,s as Ee}from"./proxy-DFIxRT0i.js";import{c as De,i as Oe}from"./terminalSetup-BpZXqE_G.js";import{l as ke,o as Ae}from"./api-DAyhTxgY.js";import{c as je,u as Me}from"./firstPartyEventLogger-Cw9Bc3on.js";import{randomUUID as Ne}from"crypto";t(),te(),le(),P(),k(),pe(),B(),U(),Me();var Pe=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function Fe(e){return!Pe.some(t=>t.test(e))}function Ie(e,t){let n=[],r=new Set,i=new Map;for(let a=1;n.length<t&&a<=t;a++)for(let o of e){if(n.length>=t)break;if(!Fe(o))continue;let e=Math.max(o.lastIndexOf(`/`),o.lastIndexOf(`\\`)),s=e>=0?o.slice(e+1):o;if(!s||r.has(s))continue;let c=e>=0?o.slice(0,e):`.`;(i.get(c)??0)>=a||(n.push(s),r.add(s),i.set(c,(i.get(c)??0)+1))}return n.length>=t?n:[]}async function Le(){if(O.platform===`win32`||!await z())return[];try{let e=await je(),t=[`log`,`-n`,`1000`,`--pretty=format:`,`--name-only`,`--diff-filter=M`],n=new Map,r=e=>{for(let t of e.split(`
2
2
  `)){let e=t.trim();e&&n.set(e,(n.get(e)??0)+1)}};if(e){let{stdout:n}=await H(`git`,[...t,`--author=${e}`],{cwd:C()});r(n)}if(n.size<10){let{stdout:e}=await H(V(),t,{cwd:C()});r(e)}return Ie(Array.from(n.entries()).sort((e,t)=>t[1]-e[1]).map(([e])=>e),5)}catch(e){return W(e),[]}}var Re=10080*60*1e3,ze=e(()=>{let e=F(),t=e.exampleFiles?.length?b(e.exampleFiles):`<filepath>`;return`Try "${b([`fix lint errors`,`fix typecheck errors`,`how does ${t} work?`,`refactor ${t}`,`how do I log an error?`,`edit ${t} to...`,`write a test for ${t}`,`create a util logging.py that...`])}"`}),Be=e(async()=>{let e=F();Date.now()-(e.exampleFilesGeneratedAt??0)>Re&&(e.exampleFiles=[]),e.exampleFiles?.length||Le().then(e=>{e.length&&I(t=>({...t,exampleFiles:e,exampleFilesGeneratedAt:Date.now()}))})});Se();var Ve={"claude-3-opus":{modelName:`Work Mate 3 Opus`,retirementDates:{firstParty:`January 5, 2026`,bedrock:`January 15, 2026`,vertex:`January 5, 2026`,foundry:`January 5, 2026`}},"claude-3-7-sonnet":{modelName:`Work Mate 3.7 Sonnet`,retirementDates:{firstParty:`February 19, 2026`,bedrock:`April 28, 2026`,vertex:`May 11, 2026`,foundry:`February 19, 2026`}},"claude-3-5-haiku":{modelName:`Work Mate 3.5 Haiku`,retirementDates:{firstParty:`February 19, 2026`,bedrock:null,vertex:null,foundry:null}}};function He(e){let t=e.toLowerCase(),n=_e();for(let[e,r]of Object.entries(Ve)){let i=r.retirementDates[n];if(!(!t.includes(e)||!i))return{isDeprecated:!0,modelName:r.modelName,retirementDate:i}}return{isDeprecated:!1}}function Ue(e){if(!e)return null;let t=He(e);return t.isDeprecated?`⚠ ${t.modelName} will be retired on ${t.retirementDate}. Consider switching to a newer model.`:null}n(),se(),ce(),de(),D(),E(),me(),ge(),j(),ye(),be(),p(),ne(),m(),i(),re(),Oe(),o(),ae(),ie(),P();function We(e){let t=N().numStartups;L(n=>{let r=n.tipsHistory??{};return r[e]===t?n:{...n,tipsHistory:{...r,[e]:t}}})}function q(e){let t=N(),n=t.tipsHistory?.[e];return n?t.numStartups-n:1/0}P(),k(),B();var J;async function Ge(){return J===void 0&&(J=a in await s()),J}async function Y(e,t,n){if(!await Ge()||l(`${e}@claude-plugins-official`))return!1;let{bashTools:r}=t??{};return!!(n.cli&&r?.size&&n.cli.some(e=>r.has(e))||n.filePath&&t?.readFileState&&ee(t.readFileState).some(e=>n.filePath.test(e)))}var Ke=[{id:`new-user-warmup`,content:async()=>`Start with small features or bug fixes, tell Work Mate to propose a plan, and verify its suggested edits`,cooldownSessions:3,async isRelevant(){return N().numStartups<10}},{id:`plan-mode-for-complex-tasks`,content:async()=>`Use Plan Mode to prepare for a complex request before making changes. Press ${x(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to enable.`,cooldownSessions:5,isRelevant:async()=>{let e=N();return(e.lastPlanModeUse?(Date.now()-e.lastPlanModeUse)/(1e3*60*60*24):1/0)>7}},{id:`default-permission-mode-config`,content:async()=>`Use /config to change your default permission mode (including Plan Mode)`,cooldownSessions:10,isRelevant:async()=>{try{let e=N(),t=A(),n=!!e.lastPlanModeUse,r=!!t?.permissions?.defaultMode;return n&&!r}catch(e){return T(`Failed to check default-permission-mode-config tip relevance: ${e}`,{level:`warn`}),!1}}},{id:`git-worktrees`,content:async()=>`Use git worktrees to run multiple Work Mate sessions in parallel.`,cooldownSessions:10,isRelevant:async()=>{try{let e=N();return await R()<=1&&e.numStartups>50}catch{return!1}}},{id:`terminal-setup`,content:async()=>O.terminal===`Apple_Terminal`?`Run /terminal-setup to enable convenient terminal integration like Option + Enter for new line and more`:`Run /terminal-setup to enable convenient terminal integration like Shift + Enter for new line and more`,cooldownSessions:10,async isRelevant(){let e=N();return O.terminal===`Apple_Terminal`?!e.optionAsMetaKeyInstalled:!e.shiftEnterKeyBindingInstalled}},{id:`shift-enter`,content:async()=>O.terminal===`Apple_Terminal`?`Press Option+Enter to send a multi-line message`:`Press Shift+Enter to send a multi-line message`,cooldownSessions:10,async isRelevant(){let e=N();return!!((O.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)&&e.numStartups>3)}},{id:`shift-enter-setup`,content:async()=>O.terminal===`Apple_Terminal`?`Run /terminal-setup to enable Option+Enter for new lines`:`Run /terminal-setup to enable Shift+Enter for new lines`,cooldownSessions:10,async isRelevant(){if(!De())return!1;let e=N();return!(O.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)}},{id:`memory-command`,content:async()=>`Use /memory to view and manage Work Mate memory`,cooldownSessions:15,async isRelevant(){return N().memoryUsageCount<=0}},{id:`theme-command`,content:async()=>`Use /theme to change the color theme`,cooldownSessions:20,isRelevant:async()=>!0},{id:`colorterm-truecolor`,content:async()=>`Try setting environment variable COLORTERM=truecolor for richer colors`,cooldownSessions:30,isRelevant:async()=>!process.env.COLORTERM&&oe.level<3},{id:`powershell-tool-env`,content:async()=>`Set CLAUDE_CODE_USE_POWERSHELL_TOOL=1 to enable the PowerShell tool (preview)`,cooldownSessions:10,isRelevant:async()=>G()===`windows`&&process.env.CLAUDE_CODE_USE_POWERSHELL_TOOL===void 0},{id:`status-line`,content:async()=>`Use /statusline to set up a custom status line that will display beneath the input box`,cooldownSessions:25,isRelevant:async()=>A().statusLine===void 0},{id:`prompt-queue`,content:async()=>`Hit Enter to queue up additional messages while Work Mate is working.`,cooldownSessions:5,async isRelevant(){return N().promptQueueUseCount<=3}},{id:`enter-to-steer-in-relatime`,content:async()=>`Send messages to Work Mate while it works to steer Work Mate in real-time`,cooldownSessions:20,isRelevant:async()=>!0},{id:`todo-list`,content:async()=>`Ask Work Mate to create a todo list when working on complex tasks to track progress and remain on track`,cooldownSessions:20,isRelevant:async()=>!0},{id:`vscode-command-install`,content:async()=>`Open the Command Palette (Cmd+Shift+P) and run "Shell Command: Install '${O.terminal===`vscode`?`code`:O.terminal}' command in PATH" to enable IDE integration`,cooldownSessions:0,async isRelevant(){if(!h()||G()!==`macos`)return!1;switch(O.terminal){case`vscode`:return!await f();case`cursor`:return!await u();case`windsurf`:return!await d();default:return!1}}},{id:`ide-upsell-external-terminal`,content:async()=>`Connect Work Mate to your IDE · /ide`,cooldownSessions:4,async isRelevant(){return _()||(await y()).length!==0?!1:(await v()).length>0}},{id:`permissions`,content:async()=>`Use /permissions to pre-approve and pre-deny bash, edit, and MCP tools`,cooldownSessions:10,async isRelevant(){return N().numStartups>10}},{id:`drag-and-drop-images`,content:async()=>`Did you know you can drag and drop image files into your terminal?`,cooldownSessions:10,isRelevant:async()=>!O.isSSH()},{id:`paste-images-mac`,content:async()=>`Paste images into Work Mate using control+v (not cmd+v!)`,cooldownSessions:10,isRelevant:async()=>G()===`macos`},{id:`double-esc`,content:async()=>`Double-tap esc to rewind the conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>!g()},{id:`double-esc-code-restore`,content:async()=>`Double-tap esc to rewind the code and/or conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>g()},{id:`continue`,content:async()=>`Run claude --continue or claude --resume to resume a conversation`,cooldownSessions:10,isRelevant:async()=>!0},{id:`rename-conversation`,content:async()=>`Name your conversations with /rename to find them easily in /resume later`,cooldownSessions:15,isRelevant:async()=>c()&&N().numStartups>10},{id:`custom-commands`,content:async()=>`Create skills by adding .md files to .workmate/skills/ in your project or ~/.workmate/skills/ for skills that work in any project`,cooldownSessions:15,async isRelevant(){return N().numStartups>10}},{id:`shift-tab`,content:async()=>`Hit ${x(`chat:cycleMode`,`Chat`,`shift+tab`)} to cycle between default, accept edits, plan, auto, and bypass modes`,cooldownSessions:10,isRelevant:async()=>!0},{id:`image-paste`,content:async()=>`Use ${x(`chat:imagePaste`,`Chat`,`ctrl+v`)} to paste images from your clipboard`,cooldownSessions:20,isRelevant:async()=>!0},{id:`custom-agents`,content:async()=>`Use /agents to optimize specific tasks. Eg. Software Architect, Code Writer, Code Reviewer`,cooldownSessions:15,async isRelevant(){return N().numStartups>5}},{id:`agent-flag`,content:async()=>`Use --agent <agent_name> to directly start a conversation with a subagent`,cooldownSessions:15,async isRelevant(){return N().numStartups>5}},{id:`web-app`,content:async()=>`Run tasks in the cloud while you keep coding locally · clau.de/web`,cooldownSessions:15,isRelevant:async()=>!0},{id:`opusplan-mode-reminder`,content:async()=>`Your default model setting is Opus Plan Mode. Press ${x(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to activate Plan Mode and plan with Claude Opus.`,cooldownSessions:2,async isRelevant(){let e=N(),t=xe()===`opusplan`,n=e.lastPlanModeUse?(Date.now()-e.lastPlanModeUse)/(1e3*60*60*24):1/0;return t&&n>3}},{id:`frontend-design-plugin`,content:async e=>`Working with HTML/CSS? Install the frontend-design plugin:\n${S(`suggestion`,e?.theme??`dark`)(`/plugin install frontend-design@${a}`)}`,cooldownSessions:3,isRelevant:async e=>Y(`frontend-design`,e,{filePath:/\.(html|css|htm)$/i})},{id:`vercel-plugin`,content:async e=>`Working with Vercel? Install the vercel plugin:\n${S(`suggestion`,e?.theme??`dark`)(`/plugin install vercel@${a}`)}`,cooldownSessions:3,isRelevant:async e=>Y(`vercel`,e,{filePath:/(?:^|[/\\])vercel\.json$/i,cli:[`vercel`]})},{id:`subagent-fanout-nudge`,content:async e=>`Say ${S(`suggestion`,e?.theme??`dark`)(`"fan out subagents"`)} and Work Mate sends a team. Each one digs deep so nothing gets missed.`,cooldownSessions:3,isRelevant:async()=>(ve(),!1)}],qe=[];function X(){let e=M().spinnerTipsOverride;return e?.tips?.length?e.tips.map((e,t)=>({id:`custom-tip-${t}`,content:async()=>e,cooldownSessions:0,isRelevant:async()=>!0})):[]}async function Je(e){let t=M().spinnerTipsOverride,n=X();if(t?.excludeDefault&&n.length>0)return n;let r=[...Ke,...qe],i=await Promise.all(r.map(t=>t.isRelevant?.(e)??Promise.resolve(!0)));return[...r.filter((e,t)=>i[t]).filter(e=>q(e.id)>=e.cooldownSessions),...n]}Ae(),E(),U(),we(),Te();var Z=2e3,Q=5,Ye=3e4,$=3,Xe=new Set([4003]);function Ze(e){return typeof e!=`object`||!e||!(`type`in e)?!1:typeof e.type==`string`}var Qe=class{constructor(e,t,n,i){r(this,`sessionId`,void 0),r(this,`orgUuid`,void 0),r(this,`getAccessToken`,void 0),r(this,`callbacks`,void 0),r(this,`ws`,null),r(this,`state`,`closed`),r(this,`reconnectAttempts`,0),r(this,`sessionNotFoundRetries`,0),r(this,`pingInterval`,null),r(this,`reconnectTimer`,null),this.sessionId=e,this.orgUuid=t,this.getAccessToken=n,this.callbacks=i}async connect(){if(this.state===`connecting`){T(`[SessionsWebSocket] Already connecting`);return}this.state=`connecting`;let e=`${he().BASE_API_URL.replace(`http`,`ws`)}/v1/sessions/ws/${this.sessionId}/subscribe?organization_uuid=${this.orgUuid}`;T(`[SessionsWebSocket] Connecting to ${e}`);let t={Authorization:`Bearer ${this.getAccessToken()}`,"anthropic-version":`2023-06-01`};if(typeof Bun<`u`){let n=new globalThis.WebSocket(e,{headers:t,proxy:Ce(e),tls:K()||void 0});this.ws=n,n.addEventListener(`open`,()=>{T(`[SessionsWebSocket] Connection opened, authenticated via headers`),this.state=`connected`,this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.startPingInterval(),this.callbacks.onConnected?.()}),n.addEventListener(`message`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.handleMessage(t)}),n.addEventListener(`error`,()=>{let e=Error(`[SessionsWebSocket] WebSocket error`);W(e),this.callbacks.onError?.(e)}),n.addEventListener(`close`,e=>{T(`[SessionsWebSocket] Closed: code=${e.code} reason=${e.reason}`),this.handleClose(e.code)}),n.addEventListener(`pong`,()=>{T(`[SessionsWebSocket] Pong received`)})}else{let{default:n}=await import(`./wrapper-K8ZapJVu.js`),r=new n(e,{headers:t,agent:Ee(e),...K()});this.ws=r,r.on(`open`,()=>{T(`[SessionsWebSocket] Connection opened, authenticated via headers`),this.state=`connected`,this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.startPingInterval(),this.callbacks.onConnected?.()}),r.on(`message`,e=>{this.handleMessage(e.toString())}),r.on(`error`,e=>{W(Error(`[SessionsWebSocket] Error: ${e.message}`)),this.callbacks.onError?.(e)}),r.on(`close`,(e,t)=>{T(`[SessionsWebSocket] Closed: code=${e} reason=${t.toString()}`),this.handleClose(e)}),r.on(`pong`,()=>{T(`[SessionsWebSocket] Pong received`)})}}handleMessage(e){try{let t=fe(e);Ze(t)?this.callbacks.onMessage(t):T(`[SessionsWebSocket] Ignoring message type: ${typeof t==`object`&&t&&`type`in t?String(t.type):`unknown`}`)}catch(e){W(Error(`[SessionsWebSocket] Failed to parse message: ${ue(e)}`))}}handleClose(e){if(this.stopPingInterval(),this.state===`closed`)return;this.ws=null;let t=this.state;if(this.state=`closed`,Xe.has(e)){T(`[SessionsWebSocket] Permanent close code ${e}, not reconnecting`),this.callbacks.onClose?.();return}if(e===4001){if(this.sessionNotFoundRetries++,this.sessionNotFoundRetries>$){T(`[SessionsWebSocket] 4001 retry budget exhausted (${$}), not reconnecting`),this.callbacks.onClose?.();return}this.scheduleReconnect(Z*this.sessionNotFoundRetries,`4001 attempt ${this.sessionNotFoundRetries}/${$}`);return}t===`connected`&&this.reconnectAttempts<Q?(this.reconnectAttempts++,this.scheduleReconnect(Z,`attempt ${this.reconnectAttempts}/${Q}`)):(T(`[SessionsWebSocket] Not reconnecting`),this.callbacks.onClose?.())}scheduleReconnect(e,t){this.callbacks.onReconnecting?.(),T(`[SessionsWebSocket] Scheduling reconnect (${t}) in ${e}ms`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}startPingInterval(){this.stopPingInterval(),this.pingInterval=setInterval(()=>{if(this.ws&&this.state===`connected`)try{this.ws.ping?.()}catch{}},Ye)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}sendControlResponse(e){if(!this.ws||this.state!==`connected`){W(Error(`[SessionsWebSocket] Cannot send: not connected`));return}T(`[SessionsWebSocket] Sending control response`),this.ws.send(w(e))}sendControlRequest(e){if(!this.ws||this.state!==`connected`){W(Error(`[SessionsWebSocket] Cannot send: not connected`));return}let t={type:`control_request`,request_id:Ne(),request:e};T(`[SessionsWebSocket] Sending control request: ${e.subtype}`),this.ws.send(w(t))}isConnected(){return this.state===`connected`}close(){T(`[SessionsWebSocket] Closing connection`),this.state=`closed`,this.stopPingInterval(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null)}reconnect(){T(`[SessionsWebSocket] Force reconnecting`),this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.close(),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},500)}};E(),U(),n();function $e(e){return e.type!==`control_request`&&e.type!==`control_response`&&e.type!==`control_cancel_request`}var et=class{constructor(e,t){r(this,`config`,void 0),r(this,`callbacks`,void 0),r(this,`websocket`,null),r(this,`pendingPermissionRequests`,new Map),this.config=e,this.callbacks=t}connect(){T(`[RemoteSessionManager] Connecting to session ${this.config.sessionId}`);let e={onMessage:e=>this.handleMessage(e),onConnected:()=>{T(`[RemoteSessionManager] Connected`),this.callbacks.onConnected?.()},onClose:()=>{T(`[RemoteSessionManager] Disconnected`),this.callbacks.onDisconnected?.()},onReconnecting:()=>{T(`[RemoteSessionManager] Reconnecting`),this.callbacks.onReconnecting?.()},onError:e=>{W(e),this.callbacks.onError?.(e)}};this.websocket=new Qe(this.config.sessionId,this.config.orgUuid,this.config.getAccessToken,e),this.websocket.connect()}handleMessage(e){if(e.type===`control_request`){this.handleControlRequest(e);return}if(e.type===`control_cancel_request`){let{request_id:t}=e,n=this.pendingPermissionRequests.get(t);T(`[RemoteSessionManager] Permission request cancelled: ${t}`),this.pendingPermissionRequests.delete(t),this.callbacks.onPermissionCancelled?.(t,n?.tool_use_id);return}if(e.type===`control_response`){T(`[RemoteSessionManager] Received control response`);return}$e(e)&&this.callbacks.onMessage(e)}handleControlRequest(e){let t=e.request_id,n=e.request;if(n.subtype===`can_use_tool`)T(`[RemoteSessionManager] Permission request for tool: ${n.tool_name}`),this.pendingPermissionRequests.set(t,n),this.callbacks.onPermissionRequest(n,t);else{T(`[RemoteSessionManager] Unsupported control request subtype: ${n.subtype}`);let e={type:`control_response`,response:{subtype:`error`,request_id:t,error:`Unsupported control request subtype: ${n.subtype}`}};this.websocket?.sendControlResponse(e)}}async sendMessage(e,t){T(`[RemoteSessionManager] Sending message to session ${this.config.sessionId}`);let n=await ke(this.config.sessionId,e,t);return n||W(Error(`[RemoteSessionManager] Failed to send message to session ${this.config.sessionId}`)),n}respondToPermissionRequest(e,t){if(!this.pendingPermissionRequests.get(e)){W(Error(`[RemoteSessionManager] No pending permission request with ID: ${e}`));return}this.pendingPermissionRequests.delete(e);let n={type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}};T(`[RemoteSessionManager] Sending permission response: ${t.behavior}`),this.websocket?.sendControlResponse(n)}isConnected(){return this.websocket?.isConnected()??!1}cancelSession(){T(`[RemoteSessionManager] Sending interrupt signal`),this.websocket?.sendControlRequest({subtype:`interrupt`})}getSessionId(){return this.config.sessionId}disconnect(){T(`[RemoteSessionManager] Disconnecting`),this.websocket?.close(),this.websocket=null,this.pendingPermissionRequests.clear()}reconnect(){T(`[RemoteSessionManager] Reconnecting WebSocket`),this.websocket?.reconnect()}};function tt(e,t,n,r=!1,i=!1){return{sessionId:e,getAccessToken:t,orgUuid:n,hasInitialPrompt:r,viewerOnly:i}}export{We as a,Be as c,q as i,tt as n,Ue as o,Je as r,ze as s,et as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as t,Ig as n,Ir as r,Lg as i,Mu as a,Ny as o,Pu as s,Py as ee,Rn as c,Sr as te,Tu as ne,Wr as re,Xh as l,Yn as u,Zh as d,bc as f,br as p,hC as m,hc as h,jr as ie,ni as ae,ti as oe,wu as g,xC as _}from"./loadAgentsDir-PPiD2Mfq.js";import{I as v,P as y,Wt as b,ai as x,dr as S,ot as C,t as w}from"./src-DL3w8VPk2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as E,or as se}from"./state-BPFYBqm1.js";import{o as D,s as O}from"./log-BlJ7CcKG.js";import{n as k,r as A}from"./analytics-DJobLaWP.js";import{a as ce,n as le,s as ue}from"./skillChangeDetector-BU9AFG0i.js";import{t as de}from"./REPL-C33mMf_q.js";import{a as fe,i as j,n as M,o as N,r as P,t as F}from"./crossProjectResume-DY1ZBO5P.js";import{dirname as I}from"path";var L=e(x(),1);_(),E(),N(),s(),o(),w(),m(),k(),l(),i(),j(),h(),g(),M(),D(),p();var R=T();function z(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function B({commands:e,worktreePaths:i,initialTools:o,mcpClients:s,dynamicMcpConfig:l,debug:p,mainThreadAgentDefinition:m,autoConnectIdeFlag:h,strictMcpConfig:g=!1,systemPrompt:_,appendSystemPrompt:b,initialSearchQuery:x,disableSlashCommands:w=!1,forkSession:T,taskListId:E,filterByPr:D,thinkingConfig:k,onTurnComplete:j}){let{rows:M}=C(),N=d(e=>e.agentDefinitions),B=t(),[H,U]=L.useState([]),[me,W]=L.useState(!0),[he,ge]=L.useState(!1),[G,_e]=L.useState(!1),[K,ve]=L.useState(null),[q,J]=L.useState(null),Y=L.useRef(null),X=L.useRef(0),Z=L.useMemo(()=>{let e=H.filter(e=>!e.isSidechain);if(D!==void 0){if(D===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof D==`number`)e=e.filter(e=>e.prNumber===D);else if(typeof D==`string`){let t=z(D);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[H,D]),ye=te();L.useEffect(()=>{r(i).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs),W(!1)}).catch(e=>{O(e),W(!1)})},[i]);let Q=L.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||u(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),U(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=L.useCallback(e=>{W(!0),(e?ie():r(i)).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs)}).catch(e=>{O(e)}).finally(()=>{W(!1)})},[i]),be=L.useCallback(()=>{let e=!G;_e(e),$(e)},[G,$]);function xe(){process.exit(1)}async function Se(e){ge(!0);let t=performance.now(),r=F(e,G);if(r.isCrossProject&&!r.isSameRepoWorktree){let e=r.command,t=await S(e);t&&process.stdout.write(t),J(e);return}try{let r=await ne(e,void 0);if(!r)throw Error(`Failed to load conversation`);r.sessionId&&!T?(se(n(r.sessionId),e.fullPath?I(e.fullPath):null),await oe(),ee(r.sessionId)):T&&r.contentReplacements?.length&&await re(r.contentReplacements);let{agentDefinition:i}=ce(r.agentSetting,m,N);B(e=>({...e,agent:i?.agentType}));let a=le(r.agentName,r.agentColor);a&&B(e=>({...e,standaloneAgentContext:a})),f(r.agentName),ae(T?{...r,worktreeSession:void 0}:r),T||(ue(r.worktreeSession),r.sessionId&&c()),A(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-t)}),U([]),ve({messages:r.messages,fileHistorySnapshots:r.fileHistorySnapshots,contentReplacements:r.contentReplacements,agentName:r.agentName,agentColor:r.agentColor==="default"?void 0:r.agentColor,mainThreadAgentDefinition:i})}catch(e){throw A(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),O(e),e}}return q?(0,R.jsx)(pe,{command:q}):K?(0,R.jsx)(de,{debug:p,commands:e,initialTools:o,initialMessages:K.messages,initialFileHistorySnapshots:K.fileHistorySnapshots,initialContentReplacements:K.contentReplacements,initialAgentName:K.agentName,initialAgentColor:K.agentColor,mcpClients:s,dynamicMcpConfig:l,strictMcpConfig:g,systemPrompt:_,appendSystemPrompt:b,mainThreadAgentDefinition:K.mainThreadAgentDefinition,autoConnectIdeFlag:h,disableSlashCommands:w,taskListId:E,thinkingConfig:k,onTurnComplete:j}):me?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Loading conversations…`})]}):he?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Resuming conversation…`})]}):Z.length===0?(0,R.jsx)(V,{}):(0,R.jsx)(fe,{logs:Z,maxHeight:M,onCancel:xe,onSelect:Se,onLogsChanged:ye?()=>$(G):void 0,onLoadMore:Q,initialSearchQuery:x,showAllProjects:G,onToggleAllProjects:be,onAgenticSearch:P})}function V(){return b(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`No conversations found to resume.`}),(0,R.jsx)(y,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function pe({command:e}){return L.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,R.jsxs)(v,{flexDirection:`column`,gap:1,children:[(0,R.jsx)(y,{children:`This conversation is from a different directory.`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`To resume, run:`}),(0,R.jsxs)(y,{children:[` `,e]})]}),(0,R.jsx)(y,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{B as ResumeConversation};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as t,Ig as n,Ir as r,Lg as i,Mu as a,Ny as o,Pu as s,Py as ee,Rn as c,Sr as te,Tu as ne,Wr as re,Xh as l,Yn as u,Zh as d,bc as f,br as p,hC as m,hc as h,jr as ie,ni as ae,ti as oe,wu as g,xC as _}from"./loadAgentsDir-DnsldjYU.js";import{I as v,P as y,Wt as b,ai as x,dr as S,ot as C,t as w}from"./src-DL3w8VPk2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as E,or as se}from"./state-B3zvBu4R.js";import{o as D,s as O}from"./log-CR0v5KUR.js";import{n as k,r as A}from"./analytics-DJobLaWP.js";import{a as ce,n as le,s as ue}from"./skillChangeDetector-CLnn22Jo.js";import{t as de}from"./REPL-BPig-OIh.js";import{a as fe,i as j,n as M,o as N,r as P,t as F}from"./crossProjectResume-C5QtstD6.js";import{dirname as I}from"path";var L=e(x(),1);_(),E(),N(),s(),o(),w(),m(),k(),l(),i(),j(),h(),g(),M(),D(),p();var R=T();function z(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function B({commands:e,worktreePaths:i,initialTools:o,mcpClients:s,dynamicMcpConfig:l,debug:p,mainThreadAgentDefinition:m,autoConnectIdeFlag:h,strictMcpConfig:g=!1,systemPrompt:_,appendSystemPrompt:b,initialSearchQuery:x,disableSlashCommands:w=!1,forkSession:T,taskListId:E,filterByPr:D,thinkingConfig:k,onTurnComplete:j}){let{rows:M}=C(),N=d(e=>e.agentDefinitions),B=t(),[H,U]=L.useState([]),[me,W]=L.useState(!0),[he,ge]=L.useState(!1),[G,_e]=L.useState(!1),[K,ve]=L.useState(null),[q,J]=L.useState(null),Y=L.useRef(null),X=L.useRef(0),Z=L.useMemo(()=>{let e=H.filter(e=>!e.isSidechain);if(D!==void 0){if(D===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof D==`number`)e=e.filter(e=>e.prNumber===D);else if(typeof D==`string`){let t=z(D);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[H,D]),ye=te();L.useEffect(()=>{r(i).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs),W(!1)}).catch(e=>{O(e),W(!1)})},[i]);let Q=L.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||u(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),U(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=L.useCallback(e=>{W(!0),(e?ie():r(i)).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs)}).catch(e=>{O(e)}).finally(()=>{W(!1)})},[i]),be=L.useCallback(()=>{let e=!G;_e(e),$(e)},[G,$]);function xe(){process.exit(1)}async function Se(e){ge(!0);let t=performance.now(),r=F(e,G);if(r.isCrossProject&&!r.isSameRepoWorktree){let e=r.command,t=await S(e);t&&process.stdout.write(t),J(e);return}try{let r=await ne(e,void 0);if(!r)throw Error(`Failed to load conversation`);r.sessionId&&!T?(se(n(r.sessionId),e.fullPath?I(e.fullPath):null),await oe(),ee(r.sessionId)):T&&r.contentReplacements?.length&&await re(r.contentReplacements);let{agentDefinition:i}=ce(r.agentSetting,m,N);B(e=>({...e,agent:i?.agentType}));let a=le(r.agentName,r.agentColor);a&&B(e=>({...e,standaloneAgentContext:a})),f(r.agentName),ae(T?{...r,worktreeSession:void 0}:r),T||(ue(r.worktreeSession),r.sessionId&&c()),A(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-t)}),U([]),ve({messages:r.messages,fileHistorySnapshots:r.fileHistorySnapshots,contentReplacements:r.contentReplacements,agentName:r.agentName,agentColor:r.agentColor==="default"?void 0:r.agentColor,mainThreadAgentDefinition:i})}catch(e){throw A(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),O(e),e}}return q?(0,R.jsx)(pe,{command:q}):K?(0,R.jsx)(de,{debug:p,commands:e,initialTools:o,initialMessages:K.messages,initialFileHistorySnapshots:K.fileHistorySnapshots,initialContentReplacements:K.contentReplacements,initialAgentName:K.agentName,initialAgentColor:K.agentColor,mcpClients:s,dynamicMcpConfig:l,strictMcpConfig:g,systemPrompt:_,appendSystemPrompt:b,mainThreadAgentDefinition:K.mainThreadAgentDefinition,autoConnectIdeFlag:h,disableSlashCommands:w,taskListId:E,thinkingConfig:k,onTurnComplete:j}):me?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Loading conversations…`})]}):he?(0,R.jsxs)(v,{children:[(0,R.jsx)(a,{}),(0,R.jsx)(y,{children:` Resuming conversation…`})]}):Z.length===0?(0,R.jsx)(V,{}):(0,R.jsx)(fe,{logs:Z,maxHeight:M,onCancel:xe,onSelect:Se,onLogsChanged:ye?()=>$(G):void 0,onLoadMore:Q,initialSearchQuery:x,showAllProjects:G,onToggleAllProjects:be,onAgenticSearch:P})}function V(){return b(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`No conversations found to resume.`}),(0,R.jsx)(y,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function pe({command:e}){return L.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,R.jsxs)(v,{flexDirection:`column`,gap:1,children:[(0,R.jsx)(y,{children:`This conversation is from a different directory.`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`To resume, run:`}),(0,R.jsxs)(y,{children:[` `,e]})]}),(0,R.jsx)(y,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{B as ResumeConversation};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{C as a,P as o,R as s,S as c,c as l,i as u,x as d}from"./debug-BQj6h99Q.js";import{O as f,k as p}from"./git-DplvjXEY.js";import{dn as m,fn as h}from"./model-sviY1inu.js";import{n as g,t as _}from"./userAgent-DUt0q-Vl.js";import{C as v,x as y}from"./sessionState-BTFowSpR.js";import{n as b,t as x}from"./rcDebugLog-DSchf3Hs.js";function S(){return!0}function C(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={},s=!1;for(let e of a.split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{C as a,P as o,R as s,S as c,c as l,i as u,x as d}from"./debug-D7OBvqC2.js";import{O as f,k as p}from"./git-CNhyfMtb.js";import{dn as m,fn as h}from"./model-xI2MbgRj.js";import{n as g,t as _}from"./userAgent-D8vvjitA.js";import{C as v,x as y}from"./sessionState-B3tFm9SC.js";import{n as b,t as x}from"./rcDebugLog-DSchf3Hs.js";function S(){return!0}function C(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={},s=!1;for(let e of a.split(`
2
2
  `)){let t=e[e.length-1]===`\r`?e.slice(0,-1):e;if(t.startsWith(`:`)){s=!0;continue}let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n),i=t[n+1]===` `?t.slice(n+2):t.slice(n+1);switch(r){case`event`:o.event=i;break;case`id`:o.id=i;break;case`data`:o.data=o.data?`${o.data}\n${i}`:i;break}}(o.data||s)&&t.push(o)}return{frames:t,remaining:e.slice(n)}}function w(e){let t=e.pathname;return t.endsWith(`/stream`)&&(t=t.slice(0,-7)),`${e.protocol}//${e.host}${t}`}var T,E,D,O,k,A,j,M,N,P,F=e((()=>{i(),u(),x(),f(),s(),v(),m(),d(),g(),t(),T=1e3,E=3e4,D=6e5,O=45e3,k=new Set([401,403,404]),A=10,j=500,M=8e3,N={stream:!0},P=class{constructor(e,t={},r,i,a,o){n(this,`url`,void 0),n(this,`state`,`idle`),n(this,`onData`,void 0),n(this,`onCloseCallback`,void 0),n(this,`onEventCallback`,void 0),n(this,`headers`,void 0),n(this,`sessionId`,void 0),n(this,`refreshHeaders`,void 0),n(this,`getAuthHeaders`,void 0),n(this,`abortController`,null),n(this,`lastSequenceNum`,0),n(this,`seenSequenceNums`,new Set),n(this,`reconnectAttempts`,0),n(this,`reconnectStartTime`,null),n(this,`reconnectTimer`,null),n(this,`livenessTimer`,null),n(this,`lastActivityTime`,0),n(this,`postUrl`,void 0),n(this,`onLivenessTimeout`,()=>{this.livenessTimer=null,b(`SSE liveness timeout (${O}ms) lastSeqNum=${this.getLastSequenceNum()} state=${this.state}`),l(`SSETransport: Liveness timeout, reconnecting`,{level:`error`}),p(`error`,`cli_sse_liveness_timeout`),this.abortController?.abort(),this.handleConnectionError()}),this.url=e,this.headers=t,this.sessionId=r,this.refreshHeaders=i,this.getAuthHeaders=o??y,this.postUrl=w(e),a!==void 0&&a>0&&(this.lastSequenceNum=a),l(`SSETransport: SSE URL = ${e.href}`),l(`SSETransport: POST URL = ${this.postUrl}`),p(`info`,`cli_sse_transport_initialized`)}getLastSequenceNum(){return this.lastSequenceNum}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){l(`SSETransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_sse_connect_failed`);return}this.state=`reconnecting`;let e=Date.now(),t=new URL(this.url.href);this.lastSequenceNum>0&&t.searchParams.set(`from_sequence_num`,String(this.lastSequenceNum));let n=this.getAuthHeaders(),r={...this.headers,...n,Accept:`text/event-stream`,"anthropic-version":`2023-06-01`,"User-Agent":_()};n.Cookie&&delete r.Authorization,this.lastSequenceNum>0&&(r[`Last-Event-ID`]=String(this.lastSequenceNum)),l(`SSETransport: Opening ${t.href}`),p(`info`,`cli_sse_connect_opening`),this.abortController=new AbortController;try{let n=await fetch(t.href,{headers:r,signal:this.abortController.signal});if(!n.ok){let e=k.has(n.status);if(l(`SSETransport: HTTP ${n.status}${e?` (permanent)`:``}`,{level:`error`}),p(`error`,`cli_sse_connect_http_error`,{status:n.status}),e){this.state=`closed`,this.onCloseCallback?.(n.status);return}this.handleConnectionError();return}if(!n.body){l(`SSETransport: No response body`),this.handleConnectionError();return}let i=Date.now()-e;l(`SSETransport: Connected`),p(`info`,`cli_sse_connect_connected`,{duration_ms:i}),this.state=`connected`,this.reconnectAttempts=0,this.reconnectStartTime=null,this.resetLivenessTimer(),await this.readStream(n.body)}catch(e){if(this.abortController?.signal.aborted)return;l(`SSETransport: Connection error: ${o(e)}`,{level:`error`}),p(`error`,`cli_sse_connect_error`),this.handleConnectionError()}}async readStream(e){let t=e.getReader(),n=new TextDecoder,r=``,i=1024*1024;try{for(;;){let{done:e,value:a}=await t.read();if(e)break;if(r+=n.decode(a,N),r.length>i){l(`SSETransport: Buffer exceeded ${i} bytes — dropping connection`,{level:`error`}),p(`error`,`cli_sse_buffer_overflow`);break}let{frames:o,remaining:s}=C(r);r=s;for(let e of o){if(this.resetLivenessTimer(),e.id){let t=parseInt(e.id,10);if(!isNaN(t)){if(this.seenSequenceNums.has(t))l(`SSETransport: DUPLICATE frame seq=${t} (lastSequenceNum=${this.lastSequenceNum}, seenCount=${this.seenSequenceNums.size})`,{level:`warn`}),p(`warn`,`cli_sse_duplicate_sequence`);else if(this.seenSequenceNums.add(t),this.seenSequenceNums.size>1e3){let e=this.lastSequenceNum-200;for(let t of this.seenSequenceNums)t<e&&this.seenSequenceNums.delete(t)}t>this.lastSequenceNum&&(this.lastSequenceNum=t)}}e.event&&e.data?this.handleSSEFrame(e.event,e.data):e.data&&(l(`SSETransport: Frame has data: but no event: field — dropped`,{level:`warn`}),p(`warn`,`cli_sse_frame_missing_event_field`))}}}catch(e){if(this.abortController?.signal.aborted)return;l(`SSETransport: Stream read error: ${o(e)}`,{level:`error`}),p(`error`,`cli_sse_stream_read_error`)}finally{t.releaseLock()}this.state!==`closing`&&this.state!==`closed`&&(l(`SSETransport: Stream ended, reconnecting`),this.handleConnectionError())}handleSSEFrame(e,t){if(e!==`client_event`){l(`SSETransport: Unexpected SSE event type '${e}' on worker stream`,{level:`warn`}),p(`warn`,`cli_sse_unexpected_event_type`,{event_type:e});return}let n;try{n=c(t)}catch(e){l(`SSETransport: Failed to parse client_event data: ${o(e)}`,{level:`error`});return}let r=n.payload;if(r&&typeof r==`object`&&`type`in r){let e=this.sessionId?` session=${this.sessionId}`:``;l(`SSETransport: Event seq=${n.sequence_num} event_id=${n.event_id} event_type=${n.event_type} payload_type=${String(r.type)}${e}`),p(`info`,`cli_sse_message_received`),this.onData?.(`${a(r)}\n`)}else l(`SSETransport: Ignoring client_event with no type in payload: event_id=${n.event_id}`);this.onEventCallback?.(n)}handleConnectionError(){if(b(`SSE handleConnectionError: state=${this.state} lastSeqNum=${this.getLastSequenceNum()} reconnectAttempts=${this.reconnectAttempts} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1}`),this.clearLivenessTimer(),this.state===`closing`||this.state===`closed`)return;this.abortController?.abort(),this.abortController=null;let e=Date.now();this.reconnectStartTime||(this.reconnectStartTime=e);let t=e-this.reconnectStartTime;if(t<D){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),l(`SSETransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(T*2**(this.reconnectAttempts-1),E),n=Math.max(0,e+e*.25*(2*Math.random()-1));l(`SSETransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(t/1e3)}s elapsed)`),p(`error`,`cli_sse_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else l(`SSETransport: Reconnection time budget exhausted after ${Math.round(t/1e3)}s`,{level:`error`}),p(`error`,`cli_sse_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:t}),this.state=`closed`,this.onCloseCallback?.()}resetLivenessTimer(){this.clearLivenessTimer(),this.livenessTimer=setTimeout(this.onLivenessTimeout,O)}clearLivenessTimer(){this.livenessTimer&&(clearTimeout(this.livenessTimer),this.livenessTimer=null)}async write(e){let t=this.getAuthHeaders();if(Object.keys(t).length===0){l(`SSETransport: No session token available for POST`),p(`warn`,`cli_sse_post_no_token`);return}let n={...t,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":_()};l(`SSETransport: POST body keys=${Object.keys(e).join(`,`)}`);for(let t=1;t<=A;t++){try{let i=await r.post(this.postUrl,e,{headers:n,validateStatus:S});if(i.status===200||i.status===201){l(`SSETransport: POST success type=${e.type}`);return}if(l(`SSETransport: POST ${i.status} body=${a(i.data).slice(0,200)}`),i.status>=400&&i.status<500&&i.status!==429){l(`SSETransport: POST returned ${i.status} (client error), not retrying`),p(`warn`,`cli_sse_post_client_error`,{status:i.status});return}l(`SSETransport: POST returned ${i.status}, attempt ${t}/${A}`),p(`warn`,`cli_sse_post_retryable_error`,{status:i.status,attempt:t})}catch(e){l(`SSETransport: POST error: ${e.message}, attempt ${t}/${A}`),p(`warn`,`cli_sse_post_network_error`,{attempt:t})}if(t===A){l(`SSETransport: POST failed after ${A} attempts, continuing`),p(`warn`,`cli_sse_post_retries_exhausted`);return}await h(Math.min(j*2**(t-1),M))}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnClose(e){this.onCloseCallback=e}setOnEvent(e){this.onEventCallback=e}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.clearLivenessTimer(),this.state=`closing`,this.abortController?.abort(),this.abortController=null}}}));export{F as n,C as r,P as t};
@@ -0,0 +1 @@
1
+ import{E_ as e,T_ as t}from"./loadAgentsDir-DnsldjYU.js";e();export{t as clearSearchExtraToolsDescriptionCache};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{d as n,l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{$h as ee,$u as te,Dp as s,Gy as ne,Hy as re,Ky as c,Op as ie,Qh as ae,Qu as oe,Uh as se,Wh as ce,Wy as le,Xh as l,Zh as u,Zu as d,b as f,br as p,cb as ue,cd as m,eo as h,hC as g,j as de,lb as fe,ld as _,no as pe,pb as me,rr as he,to as v,xC as ge}from"./loadAgentsDir-PPiD2Mfq.js";import{D as y,Gt as _e,H as ve,I as b,P as x,T as S,U as ye,Wt as be,Xn as xe,a as Se,ai as C,di as w,fi as T,k as Ce,n as we,ot as Te,r as E,t as D,x as O,y as Ee}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as De,pt as Oe}from"./state-BPFYBqm1.js";import{n as ke,t as A}from"./cwd-Besi3Os3.js";import{Bt as Ae,Ft as je,It as Me,Mt as j,Pt as Ne,c as Pe,g as Fe,n as Ie,x as M,zt as Le}from"./settings-CvhsRFaT.js";import{a as Re,c as N,h as ze,i as Be,o as Ve,y as P}from"./config-BSkuQZNf.js";import{o as He,s as Ue}from"./log-BlJ7CcKG.js";import{n as We,r as F}from"./analytics-DJobLaWP.js";import{B as Ge,J as I,Q as Ke,V as qe,Y as Je,Z as Ye,_ as Xe,b as Ze,hr as Qe,mr as L,x as $e,z as et}from"./model-sviY1inu.js";import{a as tt,c as nt,d as rt,i as it,l as at,n as ot,o as R,r as st,s as ct,t as z,u as B}from"./status-Ber2xOXc.js";import{n as V,t as lt}from"./useExitOnCtrlCDWithKeybindings-C9orgrub.js";import{i as ut,n as dt,r as ft}from"./modalContext-wY9CeN4G.js";import{n as pt,t as mt}from"./ThemePicker-1QQJFOEv.js";import{i as ht,n as gt,r as _t,t as vt}from"./extraUsage-5Ueiyw6W.js";import{n as yt,t as bt}from"./AgentsMdExternalIncludesDialog-BTYgjY5c.js";import{t as H}from"./SearchBox-CwwV0W-w.js";import{n as xt,t as St}from"./useSearchInput-DdKrVHJS.js";function Ct(){let e=Oe();return[{label:`Version`,value:`0.0.16`},{label:`Session name`,value:he(e)??(0,K.jsx)(x,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:A()},...ot(),...z()]}function wt({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:B(e)},...st(t.clients,r.options.ideInstallationStatus,n),...R(t.clients,n),...nt(),...at()]}async function U(){return[...await it(),...await tt(),...await ct()]}function Tt({value:e}){return Array.isArray(e)?(0,K.jsx)(b,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,K.jsxs)(x,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,K.jsx)(x,{children:e}):e}function Et({context:e,diagnosticsPromise:t}){let n=u(e=>e.mainLoopModel),r=u(e=>e.mcp),[i]=ve(),a=W.useMemo(()=>[Ct(),wt({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=ft()?1:void 0;return(0,K.jsxs)(b,{flexDirection:`column`,flexGrow:o,children:[(0,K.jsxs)(b,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,K.jsx)(b,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,K.jsxs)(x,{bold:!0,children:[e,`:`]}),(0,K.jsx)(Tt,{value:t})]},n))},t)),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Dt,{promise:t})})]}),(0,K.jsx)(x,{dimColor:!0,children:(0,K.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function Dt({promise:e}){let t=(0,G.use)(e);return t.length===0?null:(0,K.jsxs)(b,{flexDirection:`column`,paddingBottom:1,children:[(0,K.jsx)(x,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,K.jsx)(x,{color:`error`,children:o.warning}),typeof e==`string`?(0,K.jsx)(x,{wrap:`wrap`,children:e}):e]},t))]})}var W,G,K,Ot=e((()=>{a(),W=t(C(),1),G=t(C(),1),De(),dt(),D(),l(),ke(),p(),rt(),ie(),K=k()}));function kt({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,At.jsxs)(Ee,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,At.jsxs)(x,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,At.jsx)(x,{dimColor:!0,children:`How would you like to handle this?`}),(0,At.jsx)(oe,{options:[{label:`Allow possible downgrade to stable version`,value:`downgrade`},{label:`Stay on current version (${e}) until stable catches up`,value:`stay`}],onChange:n})]})}var At,jt=e((()=>{D(),d(),At=k()}));function Mt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??Ft,value:e,description:t?.description??It}))}function Nt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,Pt.useState)([]),[o,ee]=(0,Pt.useState)(!0);(0,Pt.useEffect)(()=>{v(A()).then(e=>{let t=Mt(e);a(t),ee(!1)}).catch(()=>{let e=Mt(h);a(e),ee(!1)})},[]);let te=(0,Pt.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(Ee,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(b,{marginTop:1,children:(0,q.jsx)(x,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,q.jsx)(x,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(oe,{options:i,onChange:te,visibleOptionCount:10,defaultValue:e})]})})}var Pt,q,Ft,It,Lt=e((()=>{Pt=t(C(),1),pe(),D(),ke(),te(),q=k(),Ft=`Default`,It=`Work Mate completes coding tasks efficiently and provides concise responses`}));function Rt({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,zt.useState)(e),[a,ee]=(0,zt.useState)((e??``).length);be(`confirm:no`,n,{context:`Settings`});function te(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(x,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(b,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(x,{children:o.pointer}),(0,J.jsx)(m,{value:r??``,onChange:i,onSubmit:te,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${o.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:ee})]}),(0,J.jsx)(x,{dimColor:!0,children:`Leave empty for default (English)`})]})}var zt,J,Bt=e((()=>{a(),zt=t(C(),1),D(),g(),_(),J=k()}));function Vt({onClose:e,context:t,setTabsHidden:i,onIsSearchModeChange:a,contentHeight:te}){let{headerFocused:c,focusHeader:ie}=Se(),se=ft(),[,l]=ve(),d=ye(),[f,p]=(0,X.useState)(N()),m=Y.useRef(N()),[h,g]=(0,X.useState)(Ie()),fe=Y.useRef(Ie()),[_,pe]=(0,X.useState)(h?.outputStyle||`default`),he=Y.useRef(_),[v,ge]=(0,X.useState)(h?.language),C=Y.useRef(v),[T,we]=(0,X.useState)(0),[E,D]=(0,X.useState)(0),[O,k]=(0,X.useState)(!1),De=xe(),{rows:Oe}=Te(),ke=te??Math.min(Math.floor(Oe*.8),30),A=Math.max(5,ke-10),j=u(e=>e.mainLoopModel),Fe=u(e=>e.verbose),ze=u(e=>e.thinkingEnabled),He=u(e=>Ye()?e.fastMode:!1);u(e=>e.promptSuggestionEnabled);let We=je(h?.permissions?.defaultMode??`default`),I=ee(),[Xe,L]=(0,X.useState)({}),tt=Y.useRef(ze),[nt]=(0,X.useState)(()=>Pe(`localSettings`)),[rt]=(0,X.useState)(()=>Pe(`userSettings`)),it=Y.useRef(d),at=ae(),[ot]=(0,X.useState)(()=>{let e=at.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,replBridgeEnabled:e.replBridgeEnabled,replBridgeOutboundOnly:e.replBridgeOutboundOnly,settings:e.settings}}),R=Y.useRef(!1),[st,ct]=(0,X.useState)(!1),[z,B]=(0,X.useState)(null),{query:V,setQuery:lt,cursorOffset:ut}=xt({isActive:O&&z===null&&!c,onExit:()=>k(!1),onExitUp:ie,passthroughCtrlKeys:[`c`,`d`]}),dt=O&&!c;Y.useEffect(()=>{a?.(dt)},[dt,a]);let pt=ue(t.options.mcpClients),ht=!r(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),vt=Y.use(le(!0)),yt=ne(vt),H=Re();function St(e){F(`tengu_config_model_changed`,{from_model:j,to_model:e}),I(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),L(t=>{let n=$e(e)+(gt(e,!1,Ze())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function Ct(e){P(t=>({...t,verbose:e})),p({...N(),verbose:e}),I(t=>({...t,verbose:e})),L(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let wt=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:f.autoCompactEnabled,type:`boolean`,onChange(e){P(t=>({...t,autoCompactEnabled:e})),p({...N(),autoCompactEnabled:e}),F(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:h?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{spinnerTipsEnabled:e}),g(t=>({...t,spinnerTipsEnabled:e})),F(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:h?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{cacheWarningEnabled:e}),g(t=>({...t,cacheWarningEnabled:e})),F(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:h?.prefersReducedMotion??!1,type:`boolean`,onChange(e){M(`localSettings`,{prefersReducedMotion:e}),g(t=>({...t,prefersReducedMotion:e})),I(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}})),F(`tengu_reduce_motion_setting_changed`,{enabled:e})}},{id:`thinkingEnabled`,label:`Thinking mode`,value:ze??!0,type:`boolean`,onChange(e){I(t=>({...t,thinkingEnabled:e})),M(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),F(`tengu_thinking_toggled`,{enabled:e})}},...Ye()&&Je()?[{id:`fastMode`,label:`Fast mode (${et} only)`,value:!!He,type:`boolean`,onChange(e){Ge(),M(`userSettings`,{fastMode:e?!0:void 0}),e?(I(e=>({...e,mainLoopModel:qe(),mainLoopModelForSession:null,fastMode:!0})),L(e=>({...e,model:qe(),"Fast mode":`ON`}))):(I(e=>({...e,fastMode:!1})),L(e=>({...e,"Fast mode":`OFF`})))}}]:[],...ht?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:f.fileCheckpointingEnabled,type:`boolean`,onChange(e){P(t=>({...t,fileCheckpointingEnabled:e})),p({...N(),fileCheckpointingEnabled:e}),F(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Fe,type:`boolean`,onChange:Ct},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:f.terminalProgressBarEnabled,type:`boolean`,onChange(e){P(t=>({...t,terminalProgressBarEnabled:e})),p({...N(),terminalProgressBarEnabled:e}),F(`tengu_terminal_progress_bar_setting_changed`,{enabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:f.showTurnDuration,type:`boolean`,onChange(e){P(t=>({...t,showTurnDuration:e})),p({...N(),showTurnDuration:e}),F(`tengu_show_turn_duration_setting_changed`,{enabled:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:We,options:(()=>{let e=[`default`,`plan`];return[...e,...Ae.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=je(e),n=t===`auto`?t:Ne(t)?Le(t):t,r=M(`userSettings`,{permissions:{...h?.permissions,defaultMode:n}});if(r.error){Ue(r.error);return}g(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),L(t=>({...t,defaultPermissionMode:e})),F(`tengu_config_changed`,{setting:`defaultPermissionMode`,value:e})}},{id:`respectGitignore`,label:`Respect .gitignore in file picker`,value:f.respectGitignore,type:`boolean`,onChange(e){P(t=>({...t,respectGitignore:e})),p({...N(),respectGitignore:e}),F(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...ce()?[{id:`copyOnSelect`,label:`Copy on select`,value:f.copyOnSelect??!0,type:`boolean`,onChange(e){P(t=>({...t,copyOnSelect:e})),p({...N(),copyOnSelect:e}),F(`tengu_config_changed`,{setting:`copyOnSelect`,value:String(e)})}}]:[],H?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:h?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:d,type:`managedEnum`,onChange:l},{id:`notifChannel`,label:`Notifications`,value:f.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){P(t=>({...t,preferredNotifChannel:e})),p({...N(),preferredNotifChannel:e})}},{id:`outputStyle`,label:`Output style`,value:_,type:`managedEnum`,onChange:()=>{}},{id:`language`,label:`Language`,value:v??`Default (English)`,type:`managedEnum`,onChange:()=>{}},{id:`editorMode`,label:`Editor mode`,value:f.editorMode===`emacs`?`normal`:f.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){P(t=>({...t,editorMode:e})),p({...N(),editorMode:e}),F(`tengu_editor_mode_changed`,{mode:e,source:`config_panel`})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:f.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){P(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),p({...N(),prStatusFooterEnabled:e}),F(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:j===null?`Default (recommended)`:j,type:`managedEnum`,onChange:St},...pt?[{id:`diffTool`,label:`Diff tool`,value:f.diffTool??`auto`,options:[`terminal`,`auto`],type:`enum`,onChange(e){P(t=>({...t,diffTool:e})),p({...N(),diffTool:e}),F(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...me()?[]:[{id:`autoConnectIde`,label:`Auto-connect to IDE (external terminal)`,value:f.autoConnectIde??!1,type:`boolean`,onChange(e){P(t=>({...t,autoConnectIde:e})),p({...N(),autoConnectIde:e}),F(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...me()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:f.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){P(t=>({...t,autoInstallIdeExtension:e})),p({...N(),autoInstallIdeExtension:e}),F(`tengu_auto_install_ide_extension_changed`,{enabled:e,source:`config_panel`})}}]:[],...yt?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:Ve().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!n()?[{id:`apiKey`,label:(0,Z.jsxs)(x,{children:[`Use custom API key: `,(0,Z.jsx)(x,{bold:!0,children:Qe(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&f.customApiKeyResponses?.approved?.includes(Qe(process.env.ANTHROPIC_API_KEY))),type:`boolean`,onChange(e){P(t=>{let n={...t};if(n.customApiKeyResponses||(n.customApiKeyResponses={approved:[],rejected:[]}),n.customApiKeyResponses.approved||(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]}),n.customApiKeyResponses.rejected||(n.customApiKeyResponses={...n.customApiKeyResponses,rejected:[]}),process.env.ANTHROPIC_API_KEY){let t=Qe(process.env.ANTHROPIC_API_KEY);e?n.customApiKeyResponses={...n.customApiKeyResponses,approved:[...(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),t],rejected:(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t)}:n.customApiKeyResponses={...n.customApiKeyResponses,approved:(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),rejected:[...(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t),t]}}return n}),p(N())}}]:[]],U=Y.useMemo(()=>{if(!V)return wt;let e=V.toLowerCase();return wt.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[wt,V]);Y.useEffect(()=>{if(T>=U.length){let e=Math.max(0,U.length-1);we(e),D(Math.max(0,e-A+1));return}D(e=>T<e?T:T>=e+A?T-A+1:e)},[U.length,T,A]);let Tt=(0,X.useCallback)(e=>{D(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),Et=(0,X.useCallback)(()=>{if(z!==null)return;let t=Object.entries(Xe).map(([e,t])=>(F(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${w.bold(t)}`)),r=n()?void 0:process.env.ANTHROPIC_API_KEY,i=!!(r&&m.current.customApiKeyResponses?.approved?.includes(Qe(r))),a=!!(r&&f.customApiKeyResponses?.approved?.includes(Qe(r)));if(i!==a&&(t.push(`${a?`Enabled`:`Disabled`} custom API key`),F(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),f.theme!==m.current.theme&&t.push(`Set theme to ${w.bold(f.theme)}`),f.preferredNotifChannel!==m.current.preferredNotifChannel&&t.push(`Set notifications to ${w.bold(f.preferredNotifChannel)}`),_!==he.current&&t.push(`Set output style to ${w.bold(_)}`),v!==C.current&&t.push(`Set response language to ${w.bold(v??`Default (English)`)}`),f.editorMode!==m.current.editorMode&&t.push(`Set editor mode to ${w.bold(f.editorMode||`emacs`)}`),f.diffTool!==m.current.diffTool&&t.push(`Set diff tool to ${w.bold(f.diffTool)}`),f.autoConnectIde!==m.current.autoConnectIde&&t.push(`${f.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),f.autoInstallIdeExtension!==m.current.autoInstallIdeExtension&&t.push(`${f.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),f.autoCompactEnabled!==m.current.autoCompactEnabled&&t.push(`${f.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),f.respectGitignore!==m.current.respectGitignore&&t.push(`${f.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),f.copyOnSelect!==m.current.copyOnSelect&&t.push(`${f.copyOnSelect?`Enabled`:`Disabled`} copy on select`),f.terminalProgressBarEnabled!==m.current.terminalProgressBarEnabled&&t.push(`${f.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),f.showStatusInTerminalTab!==m.current.showStatusInTerminalTab&&t.push(`${f.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),f.showTurnDuration!==m.current.showTurnDuration&&t.push(`${f.showTurnDuration?`Enabled`:`Disabled`} turn duration`),f.remoteControlAtStartup!==m.current.remoteControlAtStartup){let e=f.remoteControlAtStartup===void 0?`Reset Remote Control to default`:`${f.remoteControlAtStartup?`Enabled`:`Disabled`} Remote Control for all sessions`;t.push(e)}h?.autoUpdatesChannel!==fe.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${w.bold(h?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
- `)):e(`Config dialog dismissed`,{display:`system`})},[z,Xe,f,j,_,v,h?.autoUpdatesChannel,Ye()?h?.fastMode:void 0,e]),Dt=(0,X.useCallback)(()=>{d!==it.current&&l(it.current),P(()=>m.current);let e=nt;M(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=rt;M(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=ot;I(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,replBridgeEnabled:n.replBridgeEnabled,replBridgeOutboundOnly:n.replBridgeOutboundOnly,settings:n.settings,toolPermissionContext:de(e.toolPermissionContext)}))},[d,l,nt,rt,ot,I]);be(`confirm:no`,(0,X.useCallback)(()=>{z===null&&(R.current&&Dt(),e(`Config dialog dismissed`,{display:`system`}))},[z,Dt,e]),{context:`Settings`,isActive:z===null&&!O&&!c}),be(`settings:close`,Et,{context:`Settings`,isActive:z===null&&!O&&!c});let W=(0,X.useCallback)(()=>{let e=U[T];if(e?.onChange){if(e.type===`boolean`){R.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===tt.current?ct(!1):t.messages.some(e=>e.type===`assistant`)&&ct(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:B(`Theme`),i(!0);return;case`model`:B(`Model`),i(!0);return;case`showExternalIncludesDialog`:B(`ExternalIncludes`),i(!0);return;case`outputStyle`:B(`OutputStyle`),i(!0);return;case`language`:B(`Language`),i(!0);return}if(e.id===`autoUpdatesChannel`){if(H){B(`EnableAutoUpdates`),i(!0);return}(h?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),i(!0)):(R.current=!0,M(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),g(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})),F(`tengu_autoupdate_channel_changed`,{channel:`latest`}));return}if(e.type===`enum`){R.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[H,U,T,h?.autoUpdatesChannel,i]),G=e=>{ct(!1);let t=Math.max(0,Math.min(U.length-1,T+e));we(t),Tt(t)};return _e({"select:previous":()=>{T===0?(ct(!1),k(!0),D(0)):G(-1)},"select:next":()=>G(1),"scroll:lineUp":()=>G(-1),"scroll:lineDown":()=>G(1),"select:accept":W,"select:previousValue":()=>W(),"select:nextValue":()=>W(),"settings:search":()=>{k(!0),lt(``)}},{context:`Settings`,isActive:z===null&&!O&&!c}),(0,Z.jsx)(b,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!c){if(O){if(e.key===`escape`){e.preventDefault(),V.length>0?lt(``):k(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),k(!1),we(0),D(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),W();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),k(!0),lt(e.key))}},[z,c,O,V,lt,W]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mt,{onThemeSelect:e=>{R.current=!0,l(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(b,{children:(0,Z.jsx)(x,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_t,{initial:j,onSelect:e=>{R.current=!0,St(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},showFastModeNotice:Ye()?He&&Ke(j)&&Je():!1}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bt,{onDone:()=>{B(null),i(!1)},externalIncludes:re(vt)}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):z===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nt,{initialStyle:_,onComplete:e=>{R.current=!0,pe(e??`default`),B(null),i(!1),M(`localSettings`,{outputStyle:e}),F(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{initialLanguage:v,onComplete:e=>{R.current=!0,ge(e),B(null),i(!1),M(`userSettings`,{language:e}),F(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):z===`EnableAutoUpdates`?(0,Z.jsx)(Ee,{title:`Enable Auto-Updates`,onCancel:()=>{B(null),i(!1)},hideBorder:!0,hideInputGuide:!0,children:H?.type===`config`?(0,Z.jsx)(oe,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{R.current=!0,B(null),i(!1),P(e=>({...e,autoUpdates:!0})),p({...N(),autoUpdates:!0}),M(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),g(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0})),F(`tengu_autoupdate_enabled`,{channel:e})}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{children:H?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),H?.type===`env`&&(0,Z.jsxs)(x,{dimColor:!0,children:[`Unset `,H.envVar,` to re-enable auto-updates.`]})]})}):z===`ChannelDowngrade`?(0,Z.jsx)(kt,{currentVersion:`0.0.16`,onChoice:e=>{if(B(null),i(!1),e===`cancel`)return;R.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.16`),M(`userSettings`,t),g(e=>({...e,...t})),F(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,marginY:se?void 0:1,children:[(0,Z.jsx)(Ce,{query:V,isFocused:O&&!c,isTerminalFocused:De,cursorOffset:ut,placeholder:`Search settings…`}),(0,Z.jsx)(b,{flexDirection:`column`,children:U.length===0?(0,Z.jsxs)(x,{dimColor:!0,italic:!0,children:[`No settings match "`,V,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[E>0&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowUp,` `,E,` more above`]}),U.slice(E,E+A).map((e,t)=>{let n=E+t===T&&!c&&!O;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(b,{width:`100%`,children:[(0,Z.jsx)(b,{width:44,children:(0,Z.jsxs)(x,{color:n?`suggestion`:void 0,children:[n?o.pointer:` `,` `,e.label]})}),(0,Z.jsx)(b,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()}),st&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(x,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ut[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(Ht,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Me(e.value)}):e.id===`autoUpdatesChannel`&&H?(0,Z.jsxs)(b,{flexDirection:`column`,children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(x,{dimColor:!0,children:[`(`,Be(H),`)`]})]}):(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),E+A<U.length&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowDown,` `,U.length-E-A,` more below`]})]})}),c?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(y,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):O?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(x,{children:`Type to filter`}),(0,Z.jsx)(y,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(y,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(s,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(s,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(s,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function Ht({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(x,{children:[`iTerm2 `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(x,{children:[`Terminal Bell `,(0,Z.jsx)(x,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(x,{children:[`Kitty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(x,{children:[`Ghostty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var Y,X,Z,Ut,Wt=e((()=>{D(),Y=t(C(),1),X=t(C(),1),g(),a(),ze(),L(),T(),j(),f(),He(),We(),pt(),l(),ht(),Xe(),vt(),yt(),jt(),d(),Lt(),Bt(),c(),ie(),dt(),H(),fe(),Fe(),pe(),i(),St(),ge(),I(),se(),Z=k(),Ut={auto:`Auto (match terminal)`,dark:`Dark mode`,light:`Light mode`,"dark-daltonized":`Dark mode (colorblind-friendly)`,"light-daltonized":`Light mode (colorblind-friendly)`,"dark-ansi":`Dark mode (ANSI colors only)`,"light-ansi":`Light mode (ANSI colors only)`}}));function Gt({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(!1),s=ft(),{rows:ne}=ut(Te()),re=s?ne+1:Math.max(15,Math.min(Math.floor(ne*.8),30)),[c]=(0,Q.useState)(()=>U().catch(()=>[]));return V(),be(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&ee)}),(0,$.jsx)(O,{color:`permission`,children:(0,$.jsx)(E,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||s?void 0:re,children:[(0,$.jsx)(we,{title:`Status`,children:(0,$.jsx)(Et,{context:t,diagnosticsPromise:c})},`status`),(0,$.jsx)(we,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Vt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:te,contentHeight:re})})},`config`)]})})}var Q,$,Kt=e((()=>{Q=t(C(),1),g(),lt(),ge(),dt(),D(),Ot(),Wt(),$=k()}));export{Kt as n,Gt as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{d as n,l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{$h as ee,$u as te,Dp as s,Gy as ne,Hy as re,Ky as c,Op as ie,Qh as ae,Qu as oe,Uh as se,Wh as ce,Wy as le,Xh as l,Zh as u,Zu as d,b as f,br as p,cb as ue,cd as m,eo as h,hC as g,j as de,lb as fe,ld as _,no as pe,pb as me,rr as he,to as v,xC as ge}from"./loadAgentsDir-DnsldjYU.js";import{D as y,Gt as _e,H as ve,I as b,P as x,T as S,U as ye,Wt as be,Xn as xe,a as Se,ai as C,di as w,fi as T,k as Ce,n as we,ot as Te,r as E,t as D,x as O,y as Ee}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as De,pt as Oe}from"./state-B3zvBu4R.js";import{n as ke,t as A}from"./cwd-Dj2ynhWd.js";import{Bt as Ae,Ft as je,It as Me,Mt as j,Pt as Ne,c as Pe,g as Fe,n as Ie,x as M,zt as Le}from"./settings-DUyIag_5.js";import{a as Re,c as N,h as ze,i as Be,o as Ve,y as P}from"./config-BybjRr09.js";import{o as He,s as Ue}from"./log-CR0v5KUR.js";import{n as We,r as F}from"./analytics-DJobLaWP.js";import{B as Ge,J as I,Q as Ke,V as qe,Y as Je,Z as Ye,_ as Xe,b as Ze,hr as Qe,mr as L,x as $e,z as et}from"./model-xI2MbgRj.js";import{a as tt,c as nt,d as rt,i as it,l as at,n as ot,o as R,r as st,s as ct,t as z,u as B}from"./status-g_dhM6Ep.js";import{n as V,t as lt}from"./useExitOnCtrlCDWithKeybindings-BnmDpMkm.js";import{i as ut,n as dt,r as ft}from"./modalContext-wY9CeN4G.js";import{n as pt,t as mt}from"./ThemePicker-AA-0hjpq.js";import{i as ht,n as gt,r as _t,t as vt}from"./extraUsage-CHnG6JNH.js";import{n as yt,t as bt}from"./AgentsMdExternalIncludesDialog-3I_KlOLv.js";import{t as H}from"./SearchBox-CwwV0W-w.js";import{n as xt,t as St}from"./useSearchInput-DqymtQhH.js";function Ct(){let e=Oe();return[{label:`Version`,value:`0.0.18`},{label:`Session name`,value:he(e)??(0,K.jsx)(x,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:A()},...ot(),...z()]}function wt({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:B(e)},...st(t.clients,r.options.ideInstallationStatus,n),...R(t.clients,n),...nt(),...at()]}async function U(){return[...await it(),...await tt(),...await ct()]}function Tt({value:e}){return Array.isArray(e)?(0,K.jsx)(b,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,K.jsxs)(x,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,K.jsx)(x,{children:e}):e}function Et({context:e,diagnosticsPromise:t}){let n=u(e=>e.mainLoopModel),r=u(e=>e.mcp),[i]=ve(),a=W.useMemo(()=>[Ct(),wt({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=ft()?1:void 0;return(0,K.jsxs)(b,{flexDirection:`column`,flexGrow:o,children:[(0,K.jsxs)(b,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,K.jsx)(b,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,K.jsxs)(x,{bold:!0,children:[e,`:`]}),(0,K.jsx)(Tt,{value:t})]},n))},t)),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Dt,{promise:t})})]}),(0,K.jsx)(x,{dimColor:!0,children:(0,K.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function Dt({promise:e}){let t=(0,G.use)(e);return t.length===0?null:(0,K.jsxs)(b,{flexDirection:`column`,paddingBottom:1,children:[(0,K.jsx)(x,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,K.jsx)(x,{color:`error`,children:o.warning}),typeof e==`string`?(0,K.jsx)(x,{wrap:`wrap`,children:e}):e]},t))]})}var W,G,K,Ot=e((()=>{a(),W=t(C(),1),G=t(C(),1),De(),dt(),D(),l(),ke(),p(),rt(),ie(),K=k()}));function kt({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,At.jsxs)(Ee,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,At.jsxs)(x,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,At.jsx)(x,{dimColor:!0,children:`How would you like to handle this?`}),(0,At.jsx)(oe,{options:[{label:`Allow possible downgrade to stable version`,value:`downgrade`},{label:`Stay on current version (${e}) until stable catches up`,value:`stay`}],onChange:n})]})}var At,jt=e((()=>{D(),d(),At=k()}));function Mt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??Ft,value:e,description:t?.description??It}))}function Nt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,Pt.useState)([]),[o,ee]=(0,Pt.useState)(!0);(0,Pt.useEffect)(()=>{v(A()).then(e=>{let t=Mt(e);a(t),ee(!1)}).catch(()=>{let e=Mt(h);a(e),ee(!1)})},[]);let te=(0,Pt.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(Ee,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(b,{marginTop:1,children:(0,q.jsx)(x,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,q.jsx)(x,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(oe,{options:i,onChange:te,visibleOptionCount:10,defaultValue:e})]})})}var Pt,q,Ft,It,Lt=e((()=>{Pt=t(C(),1),pe(),D(),ke(),te(),q=k(),Ft=`Default`,It=`Work Mate completes coding tasks efficiently and provides concise responses`}));function Rt({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,zt.useState)(e),[a,ee]=(0,zt.useState)((e??``).length);be(`confirm:no`,n,{context:`Settings`});function te(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(x,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(b,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(x,{children:o.pointer}),(0,J.jsx)(m,{value:r??``,onChange:i,onSubmit:te,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${o.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:ee})]}),(0,J.jsx)(x,{dimColor:!0,children:`Leave empty for default (English)`})]})}var zt,J,Bt=e((()=>{a(),zt=t(C(),1),D(),g(),_(),J=k()}));function Vt({onClose:e,context:t,setTabsHidden:i,onIsSearchModeChange:a,contentHeight:te}){let{headerFocused:c,focusHeader:ie}=Se(),se=ft(),[,l]=ve(),d=ye(),[f,p]=(0,X.useState)(N()),m=Y.useRef(N()),[h,g]=(0,X.useState)(Ie()),fe=Y.useRef(Ie()),[_,pe]=(0,X.useState)(h?.outputStyle||`default`),he=Y.useRef(_),[v,ge]=(0,X.useState)(h?.language),C=Y.useRef(v),[T,we]=(0,X.useState)(0),[E,D]=(0,X.useState)(0),[O,k]=(0,X.useState)(!1),De=xe(),{rows:Oe}=Te(),ke=te??Math.min(Math.floor(Oe*.8),30),A=Math.max(5,ke-10),j=u(e=>e.mainLoopModel),Fe=u(e=>e.verbose),ze=u(e=>e.thinkingEnabled),He=u(e=>Ye()?e.fastMode:!1);u(e=>e.promptSuggestionEnabled);let We=je(h?.permissions?.defaultMode??`default`),I=ee(),[Xe,L]=(0,X.useState)({}),tt=Y.useRef(ze),[nt]=(0,X.useState)(()=>Pe(`localSettings`)),[rt]=(0,X.useState)(()=>Pe(`userSettings`)),it=Y.useRef(d),at=ae(),[ot]=(0,X.useState)(()=>{let e=at.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,replBridgeEnabled:e.replBridgeEnabled,replBridgeOutboundOnly:e.replBridgeOutboundOnly,settings:e.settings}}),R=Y.useRef(!1),[st,ct]=(0,X.useState)(!1),[z,B]=(0,X.useState)(null),{query:V,setQuery:lt,cursorOffset:ut}=xt({isActive:O&&z===null&&!c,onExit:()=>k(!1),onExitUp:ie,passthroughCtrlKeys:[`c`,`d`]}),dt=O&&!c;Y.useEffect(()=>{a?.(dt)},[dt,a]);let pt=ue(t.options.mcpClients),ht=!r(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),vt=Y.use(le(!0)),yt=ne(vt),H=Re();function St(e){F(`tengu_config_model_changed`,{from_model:j,to_model:e}),I(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),L(t=>{let n=$e(e)+(gt(e,!1,Ze())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function Ct(e){P(t=>({...t,verbose:e})),p({...N(),verbose:e}),I(t=>({...t,verbose:e})),L(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let wt=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:f.autoCompactEnabled,type:`boolean`,onChange(e){P(t=>({...t,autoCompactEnabled:e})),p({...N(),autoCompactEnabled:e}),F(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:h?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{spinnerTipsEnabled:e}),g(t=>({...t,spinnerTipsEnabled:e})),F(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:h?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{cacheWarningEnabled:e}),g(t=>({...t,cacheWarningEnabled:e})),F(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:h?.prefersReducedMotion??!1,type:`boolean`,onChange(e){M(`localSettings`,{prefersReducedMotion:e}),g(t=>({...t,prefersReducedMotion:e})),I(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}})),F(`tengu_reduce_motion_setting_changed`,{enabled:e})}},{id:`thinkingEnabled`,label:`Thinking mode`,value:ze??!0,type:`boolean`,onChange(e){I(t=>({...t,thinkingEnabled:e})),M(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),F(`tengu_thinking_toggled`,{enabled:e})}},...Ye()&&Je()?[{id:`fastMode`,label:`Fast mode (${et} only)`,value:!!He,type:`boolean`,onChange(e){Ge(),M(`userSettings`,{fastMode:e?!0:void 0}),e?(I(e=>({...e,mainLoopModel:qe(),mainLoopModelForSession:null,fastMode:!0})),L(e=>({...e,model:qe(),"Fast mode":`ON`}))):(I(e=>({...e,fastMode:!1})),L(e=>({...e,"Fast mode":`OFF`})))}}]:[],...ht?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:f.fileCheckpointingEnabled,type:`boolean`,onChange(e){P(t=>({...t,fileCheckpointingEnabled:e})),p({...N(),fileCheckpointingEnabled:e}),F(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Fe,type:`boolean`,onChange:Ct},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:f.terminalProgressBarEnabled,type:`boolean`,onChange(e){P(t=>({...t,terminalProgressBarEnabled:e})),p({...N(),terminalProgressBarEnabled:e}),F(`tengu_terminal_progress_bar_setting_changed`,{enabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:f.showTurnDuration,type:`boolean`,onChange(e){P(t=>({...t,showTurnDuration:e})),p({...N(),showTurnDuration:e}),F(`tengu_show_turn_duration_setting_changed`,{enabled:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:We,options:(()=>{let e=[`default`,`plan`];return[...e,...Ae.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=je(e),n=t===`auto`?t:Ne(t)?Le(t):t,r=M(`userSettings`,{permissions:{...h?.permissions,defaultMode:n}});if(r.error){Ue(r.error);return}g(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),L(t=>({...t,defaultPermissionMode:e})),F(`tengu_config_changed`,{setting:`defaultPermissionMode`,value:e})}},{id:`respectGitignore`,label:`Respect .gitignore in file picker`,value:f.respectGitignore,type:`boolean`,onChange(e){P(t=>({...t,respectGitignore:e})),p({...N(),respectGitignore:e}),F(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...ce()?[{id:`copyOnSelect`,label:`Copy on select`,value:f.copyOnSelect??!0,type:`boolean`,onChange(e){P(t=>({...t,copyOnSelect:e})),p({...N(),copyOnSelect:e}),F(`tengu_config_changed`,{setting:`copyOnSelect`,value:String(e)})}}]:[],H?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:h?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:d,type:`managedEnum`,onChange:l},{id:`notifChannel`,label:`Notifications`,value:f.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){P(t=>({...t,preferredNotifChannel:e})),p({...N(),preferredNotifChannel:e})}},{id:`outputStyle`,label:`Output style`,value:_,type:`managedEnum`,onChange:()=>{}},{id:`language`,label:`Language`,value:v??`Default (English)`,type:`managedEnum`,onChange:()=>{}},{id:`editorMode`,label:`Editor mode`,value:f.editorMode===`emacs`?`normal`:f.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){P(t=>({...t,editorMode:e})),p({...N(),editorMode:e}),F(`tengu_editor_mode_changed`,{mode:e,source:`config_panel`})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:f.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){P(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),p({...N(),prStatusFooterEnabled:e}),F(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:j===null?`Default (recommended)`:j,type:`managedEnum`,onChange:St},...pt?[{id:`diffTool`,label:`Diff tool`,value:f.diffTool??`auto`,options:[`terminal`,`auto`],type:`enum`,onChange(e){P(t=>({...t,diffTool:e})),p({...N(),diffTool:e}),F(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...me()?[]:[{id:`autoConnectIde`,label:`Auto-connect to IDE (external terminal)`,value:f.autoConnectIde??!1,type:`boolean`,onChange(e){P(t=>({...t,autoConnectIde:e})),p({...N(),autoConnectIde:e}),F(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...me()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:f.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){P(t=>({...t,autoInstallIdeExtension:e})),p({...N(),autoInstallIdeExtension:e}),F(`tengu_auto_install_ide_extension_changed`,{enabled:e,source:`config_panel`})}}]:[],...yt?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:Ve().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!n()?[{id:`apiKey`,label:(0,Z.jsxs)(x,{children:[`Use custom API key: `,(0,Z.jsx)(x,{bold:!0,children:Qe(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&f.customApiKeyResponses?.approved?.includes(Qe(process.env.ANTHROPIC_API_KEY))),type:`boolean`,onChange(e){P(t=>{let n={...t};if(n.customApiKeyResponses||(n.customApiKeyResponses={approved:[],rejected:[]}),n.customApiKeyResponses.approved||(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]}),n.customApiKeyResponses.rejected||(n.customApiKeyResponses={...n.customApiKeyResponses,rejected:[]}),process.env.ANTHROPIC_API_KEY){let t=Qe(process.env.ANTHROPIC_API_KEY);e?n.customApiKeyResponses={...n.customApiKeyResponses,approved:[...(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),t],rejected:(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t)}:n.customApiKeyResponses={...n.customApiKeyResponses,approved:(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),rejected:[...(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t),t]}}return n}),p(N())}}]:[]],U=Y.useMemo(()=>{if(!V)return wt;let e=V.toLowerCase();return wt.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[wt,V]);Y.useEffect(()=>{if(T>=U.length){let e=Math.max(0,U.length-1);we(e),D(Math.max(0,e-A+1));return}D(e=>T<e?T:T>=e+A?T-A+1:e)},[U.length,T,A]);let Tt=(0,X.useCallback)(e=>{D(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),Et=(0,X.useCallback)(()=>{if(z!==null)return;let t=Object.entries(Xe).map(([e,t])=>(F(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${w.bold(t)}`)),r=n()?void 0:process.env.ANTHROPIC_API_KEY,i=!!(r&&m.current.customApiKeyResponses?.approved?.includes(Qe(r))),a=!!(r&&f.customApiKeyResponses?.approved?.includes(Qe(r)));if(i!==a&&(t.push(`${a?`Enabled`:`Disabled`} custom API key`),F(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),f.theme!==m.current.theme&&t.push(`Set theme to ${w.bold(f.theme)}`),f.preferredNotifChannel!==m.current.preferredNotifChannel&&t.push(`Set notifications to ${w.bold(f.preferredNotifChannel)}`),_!==he.current&&t.push(`Set output style to ${w.bold(_)}`),v!==C.current&&t.push(`Set response language to ${w.bold(v??`Default (English)`)}`),f.editorMode!==m.current.editorMode&&t.push(`Set editor mode to ${w.bold(f.editorMode||`emacs`)}`),f.diffTool!==m.current.diffTool&&t.push(`Set diff tool to ${w.bold(f.diffTool)}`),f.autoConnectIde!==m.current.autoConnectIde&&t.push(`${f.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),f.autoInstallIdeExtension!==m.current.autoInstallIdeExtension&&t.push(`${f.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),f.autoCompactEnabled!==m.current.autoCompactEnabled&&t.push(`${f.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),f.respectGitignore!==m.current.respectGitignore&&t.push(`${f.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),f.copyOnSelect!==m.current.copyOnSelect&&t.push(`${f.copyOnSelect?`Enabled`:`Disabled`} copy on select`),f.terminalProgressBarEnabled!==m.current.terminalProgressBarEnabled&&t.push(`${f.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),f.showStatusInTerminalTab!==m.current.showStatusInTerminalTab&&t.push(`${f.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),f.showTurnDuration!==m.current.showTurnDuration&&t.push(`${f.showTurnDuration?`Enabled`:`Disabled`} turn duration`),f.remoteControlAtStartup!==m.current.remoteControlAtStartup){let e=f.remoteControlAtStartup===void 0?`Reset Remote Control to default`:`${f.remoteControlAtStartup?`Enabled`:`Disabled`} Remote Control for all sessions`;t.push(e)}h?.autoUpdatesChannel!==fe.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${w.bold(h?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
+ `)):e(`Config dialog dismissed`,{display:`system`})},[z,Xe,f,j,_,v,h?.autoUpdatesChannel,Ye()?h?.fastMode:void 0,e]),Dt=(0,X.useCallback)(()=>{d!==it.current&&l(it.current),P(()=>m.current);let e=nt;M(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=rt;M(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=ot;I(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,replBridgeEnabled:n.replBridgeEnabled,replBridgeOutboundOnly:n.replBridgeOutboundOnly,settings:n.settings,toolPermissionContext:de(e.toolPermissionContext)}))},[d,l,nt,rt,ot,I]);be(`confirm:no`,(0,X.useCallback)(()=>{z===null&&(R.current&&Dt(),e(`Config dialog dismissed`,{display:`system`}))},[z,Dt,e]),{context:`Settings`,isActive:z===null&&!O&&!c}),be(`settings:close`,Et,{context:`Settings`,isActive:z===null&&!O&&!c});let W=(0,X.useCallback)(()=>{let e=U[T];if(e?.onChange){if(e.type===`boolean`){R.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===tt.current?ct(!1):t.messages.some(e=>e.type===`assistant`)&&ct(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:B(`Theme`),i(!0);return;case`model`:B(`Model`),i(!0);return;case`showExternalIncludesDialog`:B(`ExternalIncludes`),i(!0);return;case`outputStyle`:B(`OutputStyle`),i(!0);return;case`language`:B(`Language`),i(!0);return}if(e.id===`autoUpdatesChannel`){if(H){B(`EnableAutoUpdates`),i(!0);return}(h?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),i(!0)):(R.current=!0,M(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),g(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})),F(`tengu_autoupdate_channel_changed`,{channel:`latest`}));return}if(e.type===`enum`){R.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[H,U,T,h?.autoUpdatesChannel,i]),G=e=>{ct(!1);let t=Math.max(0,Math.min(U.length-1,T+e));we(t),Tt(t)};return _e({"select:previous":()=>{T===0?(ct(!1),k(!0),D(0)):G(-1)},"select:next":()=>G(1),"scroll:lineUp":()=>G(-1),"scroll:lineDown":()=>G(1),"select:accept":W,"select:previousValue":()=>W(),"select:nextValue":()=>W(),"settings:search":()=>{k(!0),lt(``)}},{context:`Settings`,isActive:z===null&&!O&&!c}),(0,Z.jsx)(b,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!c){if(O){if(e.key===`escape`){e.preventDefault(),V.length>0?lt(``):k(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),k(!1),we(0),D(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),W();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),k(!0),lt(e.key))}},[z,c,O,V,lt,W]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mt,{onThemeSelect:e=>{R.current=!0,l(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(b,{children:(0,Z.jsx)(x,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_t,{initial:j,onSelect:e=>{R.current=!0,St(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},showFastModeNotice:Ye()?He&&Ke(j)&&Je():!1}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bt,{onDone:()=>{B(null),i(!1)},externalIncludes:re(vt)}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):z===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nt,{initialStyle:_,onComplete:e=>{R.current=!0,pe(e??`default`),B(null),i(!1),M(`localSettings`,{outputStyle:e}),F(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{initialLanguage:v,onComplete:e=>{R.current=!0,ge(e),B(null),i(!1),M(`userSettings`,{language:e}),F(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):z===`EnableAutoUpdates`?(0,Z.jsx)(Ee,{title:`Enable Auto-Updates`,onCancel:()=>{B(null),i(!1)},hideBorder:!0,hideInputGuide:!0,children:H?.type===`config`?(0,Z.jsx)(oe,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{R.current=!0,B(null),i(!1),P(e=>({...e,autoUpdates:!0})),p({...N(),autoUpdates:!0}),M(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),g(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0})),F(`tengu_autoupdate_enabled`,{channel:e})}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{children:H?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),H?.type===`env`&&(0,Z.jsxs)(x,{dimColor:!0,children:[`Unset `,H.envVar,` to re-enable auto-updates.`]})]})}):z===`ChannelDowngrade`?(0,Z.jsx)(kt,{currentVersion:`0.0.18`,onChoice:e=>{if(B(null),i(!1),e===`cancel`)return;R.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.18`),M(`userSettings`,t),g(e=>({...e,...t})),F(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,marginY:se?void 0:1,children:[(0,Z.jsx)(Ce,{query:V,isFocused:O&&!c,isTerminalFocused:De,cursorOffset:ut,placeholder:`Search settings…`}),(0,Z.jsx)(b,{flexDirection:`column`,children:U.length===0?(0,Z.jsxs)(x,{dimColor:!0,italic:!0,children:[`No settings match "`,V,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[E>0&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowUp,` `,E,` more above`]}),U.slice(E,E+A).map((e,t)=>{let n=E+t===T&&!c&&!O;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(b,{width:`100%`,children:[(0,Z.jsx)(b,{width:44,children:(0,Z.jsxs)(x,{color:n?`suggestion`:void 0,children:[n?o.pointer:` `,` `,e.label]})}),(0,Z.jsx)(b,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()}),st&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(x,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ut[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(Ht,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Me(e.value)}):e.id===`autoUpdatesChannel`&&H?(0,Z.jsxs)(b,{flexDirection:`column`,children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(x,{dimColor:!0,children:[`(`,Be(H),`)`]})]}):(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),E+A<U.length&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowDown,` `,U.length-E-A,` more below`]})]})}),c?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(y,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):O?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(x,{children:`Type to filter`}),(0,Z.jsx)(y,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(y,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(s,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(s,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(s,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function Ht({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(x,{children:[`iTerm2 `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(x,{children:[`Terminal Bell `,(0,Z.jsx)(x,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(x,{children:[`Kitty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(x,{children:[`Ghostty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var Y,X,Z,Ut,Wt=e((()=>{D(),Y=t(C(),1),X=t(C(),1),g(),a(),ze(),L(),T(),j(),f(),He(),We(),pt(),l(),ht(),Xe(),vt(),yt(),jt(),d(),Lt(),Bt(),c(),ie(),dt(),H(),fe(),Fe(),pe(),i(),St(),ge(),I(),se(),Z=k(),Ut={auto:`Auto (match terminal)`,dark:`Dark mode`,light:`Light mode`,"dark-daltonized":`Dark mode (colorblind-friendly)`,"light-daltonized":`Light mode (colorblind-friendly)`,"dark-ansi":`Dark mode (ANSI colors only)`,"light-ansi":`Light mode (ANSI colors only)`}}));function Gt({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(!1),s=ft(),{rows:ne}=ut(Te()),re=s?ne+1:Math.max(15,Math.min(Math.floor(ne*.8),30)),[c]=(0,Q.useState)(()=>U().catch(()=>[]));return V(),be(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&ee)}),(0,$.jsx)(O,{color:`permission`,children:(0,$.jsx)(E,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||s?void 0:re,children:[(0,$.jsx)(we,{title:`Status`,children:(0,$.jsx)(Et,{context:t,diagnosticsPromise:c})},`status`),(0,$.jsx)(we,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Vt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:te,contentHeight:re})})},`config`)]})})}var Q,$,Kt=e((()=>{Q=t(C(),1),g(),lt(),ge(),dt(),D(),Ot(),Wt(),$=k()}));export{Kt as n,Gt as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Xh as r,Yh as i,cu as a,du as o,lu as s,pu as c}from"./loadAgentsDir-PPiD2Mfq.js";import{I as l,P as u,ai as d,mt as f,t as p}from"./src-DL3w8VPk2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";t();var h=e(d(),1);p(),r(),s();var g=m(),_=[`◐`,`◓`,`◑`,`◒`],v=[{key:`validating`,label:`Validating session`},{key:`fetching_logs`,label:`Fetching session logs`},{key:`fetching_branch`,label:`Getting branch info`},{key:`checking_out`,label:`Checking out branch`}];function y({currentStep:e,sessionId:t}){let[r,i]=f(100),a=Math.floor(i/100)%_.length,o=v.findIndex(t=>t.key===e);return(0,g.jsxs)(l,{ref:r,flexDirection:`column`,paddingX:1,paddingY:1,children:[(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsxs)(u,{bold:!0,color:`claude`,children:[_[a],` Teleporting session…`]})}),t&&(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsx)(u,{dimColor:!0,children:t})}),(0,g.jsx)(l,{flexDirection:`column`,marginLeft:2,children:v.map((e,t)=>{let r=t<o,i=t===o,s=t>o,c,d;return r?(c=n.tick,d=`green`):i?(c=_[a],d=`claude`):(c=n.circle,d=void 0),(0,g.jsxs)(l,{flexDirection:`row`,children:[(0,g.jsx)(l,{width:2,children:(0,g.jsx)(u,{color:d,dimColor:s,children:c})}),(0,g.jsx)(u,{dimColor:s,bold:i,children:e.label})]},e.key)})})]})}async function b(e,t){let n=()=>{};function r(){let[e,r]=(0,h.useState)(`validating`);return n=r,(0,g.jsx)(y,{currentStep:e,sessionId:t})}e.render((0,g.jsx)(i,{children:(0,g.jsx)(r,{})}));let s=await c(t,n);n(`checking_out`);let{branchName:l,branchError:u}=await a(s.branch);return{messages:o(s.log,u),branchName:l}}export{b as teleportWithProgress};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Xh as r,Yh as i,cu as a,du as o,lu as s,pu as c}from"./loadAgentsDir-DnsldjYU.js";import{I as l,P as u,ai as d,mt as f,t as p}from"./src-DL3w8VPk2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";t();var h=e(d(),1);p(),r(),s();var g=m(),_=[`◐`,`◓`,`◑`,`◒`],v=[{key:`validating`,label:`Validating session`},{key:`fetching_logs`,label:`Fetching session logs`},{key:`fetching_branch`,label:`Getting branch info`},{key:`checking_out`,label:`Checking out branch`}];function y({currentStep:e,sessionId:t}){let[r,i]=f(100),a=Math.floor(i/100)%_.length,o=v.findIndex(t=>t.key===e);return(0,g.jsxs)(l,{ref:r,flexDirection:`column`,paddingX:1,paddingY:1,children:[(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsxs)(u,{bold:!0,color:`claude`,children:[_[a],` Teleporting session…`]})}),t&&(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsx)(u,{dimColor:!0,children:t})}),(0,g.jsx)(l,{flexDirection:`column`,marginLeft:2,children:v.map((e,t)=>{let r=t<o,i=t===o,s=t>o,c,d;return r?(c=n.tick,d=`green`):i?(c=_[a],d=`claude`):(c=n.circle,d=void 0),(0,g.jsxs)(l,{flexDirection:`row`,children:[(0,g.jsx)(l,{width:2,children:(0,g.jsx)(u,{color:d,dimColor:s,children:c})}),(0,g.jsx)(u,{dimColor:s,bold:i,children:e.label})]},e.key)})})]})}async function b(e,t){let n=()=>{};function r(){let[e,r]=(0,h.useState)(`validating`);return n=r,(0,g.jsx)(y,{currentStep:e,sessionId:t})}e.render((0,g.jsx)(i,{children:(0,g.jsx)(r,{})}));let s=await c(t,n);n(`checking_out`);let{branchName:l,branchError:u}=await a(s.branch);return{messages:o(s.log,u),branchName:l}}export{b as teleportWithProgress};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Mu as t,Pu as n,Qu as r,Zu as i}from"./loadAgentsDir-PPiD2Mfq.js";import{I as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{wn as d,xn as f}from"./settings-CvhsRFaT.js";import{a as p,r as m}from"./githubRepoPathMapping-Px3_GeD1.js";var h=e(s(),1);c(),d(),i(),n();var g=u();function _({targetRepo:e,initialPaths:n,onSelectPath:i,onCancel:s}){let[c,u]=(0,h.useState)(n),[d,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),b=(0,h.useCallback)(async t=>{if(t===`cancel`){s();return}if(y(!0),_(null),await p(t,e)){i(t);return}m(e,t);let n=c.filter(e=>e!==t);u(n),y(!1),_(`${f(t)} no longer contains the correct repository. Select another path.`)},[e,c,i,s]),x=[...c.map(e=>({label:(0,g.jsxs)(o,{children:[`Use `,(0,g.jsx)(o,{bold:!0,children:f(e)})]}),value:e})),{label:`Cancel`,value:`cancel`}];return(0,g.jsx)(l,{title:`Teleport to Repo`,onCancel:s,color:`background`,children:c.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{children:[`Open Work Mate in `,(0,g.jsx)(o,{bold:!0,children:e}),`:`]})]}),v?(0,g.jsxs)(a,{children:[(0,g.jsx)(t,{}),(0,g.jsx)(o,{children:` Validating repository…`})]}):(0,g.jsx)(r,{options:x,onChange:e=>void b(e)})]}):(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{dimColor:!0,children:[`Run claude --teleport from a checkout of `,e]})]})})}export{_ as TeleportRepoMismatchDialog};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Mu as t,Pu as n,Qu as r,Zu as i}from"./loadAgentsDir-DnsldjYU.js";import{I as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{wn as d,xn as f}from"./settings-DUyIag_5.js";import{a as p,r as m}from"./githubRepoPathMapping-Dhz4cvw2.js";var h=e(s(),1);c(),d(),i(),n();var g=u();function _({targetRepo:e,initialPaths:n,onSelectPath:i,onCancel:s}){let[c,u]=(0,h.useState)(n),[d,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),b=(0,h.useCallback)(async t=>{if(t===`cancel`){s();return}if(y(!0),_(null),await p(t,e)){i(t);return}m(e,t);let n=c.filter(e=>e!==t);u(n),y(!1),_(`${f(t)} no longer contains the correct repository. Select another path.`)},[e,c,i,s]),x=[...c.map(e=>({label:(0,g.jsxs)(o,{children:[`Use `,(0,g.jsx)(o,{bold:!0,children:f(e)})]}),value:e})),{label:`Cancel`,value:`cancel`}];return(0,g.jsx)(l,{title:`Teleport to Repo`,onCancel:s,color:`background`,children:c.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{children:[`Open Work Mate in `,(0,g.jsx)(o,{bold:!0,children:e}),`:`]})]}),v?(0,g.jsxs)(a,{children:[(0,g.jsx)(t,{}),(0,g.jsx)(o,{children:` Validating repository…`})]}):(0,g.jsx)(r,{options:x,onChange:e=>void b(e)})]}):(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{dimColor:!0,children:[`Run claude --teleport from a checkout of `,e]})]})})}export{_ as TeleportRepoMismatchDialog};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Au as t,Dp as n,Mu as r,Op as i,Pu as a,Qu as o,Zu as s,_C as c,gC as l,hC as u,ju as d,lu as f,pu as p,xC as m}from"./loadAgentsDir-PPiD2Mfq.js";import{D as h,I as g,P as _,T as v,Wt as y,ai as b,hn as x,ot as S,t as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as T,nr as E}from"./state-BPFYBqm1.js";import{M as D,P as O,R as k,c as A,i as j}from"./debug-BQj6h99Q.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";import{p as P,v as F}from"./startupProfiler-2sjXZkIP.js";import{i as I,n as L}from"./detectRepository-Qy3zKoyn.js";import{n as R,o as z}from"./api-CazVavfB.js";var B=e(b(),1);T(),M(),k(),f();function V(e){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null);return{resumeSession:(0,B.useCallback)(async t=>{n(!0),i(null),o(t),N(`tengu_teleport_resume_session`,{source:e,session_id:t.id});try{let e=await p(t.id);return E({sessionId:t.id}),n(!1),e}catch(e){let t={message:e instanceof D?e.message:O(e),formattedMessage:e instanceof D?e.formattedMessage:void 0,isOperationError:e instanceof D};return i(t),n(!1),null}},[e]),isResuming:t,error:r,selectedSession:a,clearError:(0,B.useCallback)(()=>{i(null)},[])}}m(),z(),C(),u(),l(),j(),I(),F(),i(),s(),a(),d();var H=w(),U=`Updated`,W=` `;function G({onSelect:e,onCancel:i,isEmbedded:a=!1}){let{rows:s}=S(),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!0),[b,C]=(0,B.useState)(null),[w,T]=(0,B.useState)(!1),[E,D]=(0,B.useState)(!1),[O,k]=(0,B.useState)(1),j=c(`confirm:no`,`Confirmation`,`Esc`),M=(0,B.useCallback)(async()=>{try{m(!0),C(null);let e=await L();f(e),A(`Current repository: ${e||`not detected`}`);let t=await R(),n=t;e&&(n=t.filter(t=>t.repo?`${t.repo.owner.login}/${t.repo.name}`===e:!1),A(`Filtered ${n.length} sessions for repo ${e} from ${t.length} total`));let r=[...n].sort((e,t)=>{let n=new Date(e.updated_at);return new Date(t.updated_at).getTime()-n.getTime()});u(r)}catch(e){let t=e instanceof Error?e.message:String(e);A(`Error loading code sessions: ${t}`),C(K(t))}finally{m(!1),T(!1)}},[]),N=()=>{T(!0),M()};y(`confirm:no`,i,{context:`Confirmation`}),x((e,t)=>{if(t.ctrl&&e===`c`){i();return}if(t.ctrl&&e===`r`&&b){N();return}if(b!==null&&t.return){i();return}});let F=(0,B.useCallback)(()=>{D(!0),M()},[D,M]);if(!E)return(0,H.jsx)(t,{onComplete:F});if(p)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Loading Work Mate sessions…`})]}),(0,H.jsx)(_,{dimColor:!0,children:w?`Retrying…`:`Fetching your Work Mate sessions…`})]});if(b)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Error loading Work Mate sessions`}),q(b),(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Ctrl+R`}),` to retry · Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})]});if(l.length===0)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(_,{bold:!0,children:[`No Work Mate sessions found`,d&&(0,H.jsxs)(_,{children:[` for `,d]})]}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})})]});let I=l.map(e=>({...e,timeString:P(new Date(e.updated_at))})),z=Math.max(7,...I.map(e=>e.timeString.length)),V=I.map(({timeString:e,title:t,id:n})=>({label:`${e.padEnd(z,` `)} ${t}`,value:n})),G=Math.max(1,a?Math.min(l.length,5,s-6-7):Math.min(l.length,s-1-7));return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,height:G+7,children:[(0,H.jsxs)(_,{bold:!0,children:[`Select a session to resume`,l.length>G&&(0,H.jsxs)(_,{dimColor:!0,children:[` `,`(`,O,` of `,l.length,`)`]}),d&&(0,H.jsxs)(_,{dimColor:!0,children:[` (`,d,`)`]}),`:`]}),(0,H.jsxs)(g,{flexDirection:`column`,marginTop:1,flexGrow:1,children:[(0,H.jsx)(g,{marginLeft:2,children:(0,H.jsxs)(_,{bold:!0,children:[U.padEnd(z,` `),W,`Session Title`]})}),(0,H.jsx)(o,{visibleOptionCount:G,options:V,onChange:t=>{let n=l.find(e=>e.id===t);n&&e(n)},onFocus:e=>{let t=V.findIndex(t=>t.value===e);t>=0&&k(t+1)}})]}),(0,H.jsx)(g,{flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:(0,H.jsxs)(v,{children:[(0,H.jsx)(h,{shortcut:`↑/↓`,action:`select`}),(0,H.jsx)(h,{shortcut:`Enter`,action:`confirm`}),(0,H.jsx)(n,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}function K(e){let t=e.toLowerCase();return t.includes(`fetch`)||t.includes(`network`)||t.includes(`timeout`)?`network`:t.includes(`auth`)||t.includes(`token`)||t.includes(`permission`)||t.includes(`oauth`)||t.includes(`not authenticated`)||t.includes(`/login`)||t.includes(`console account`)||t.includes(`403`)?`auth`:t.includes(`api`)||t.includes(`rate limit`)||t.includes(`500`)||t.includes(`529`)?`api`:`other`}function q(e){switch(e){case`network`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Check your internet connection`})});case`auth`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Teleport requires a Work Mate account`})});case`api`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})});case`other`:return(0,H.jsx)(g,{marginY:1,flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})})}}M(),C(),u(),a();function J({onComplete:e,onCancel:t,onError:n,isEmbedded:i=!1,source:a}){let{resumeSession:o,isResuming:s,error:c,selectedSession:l}=V(a);(0,B.useEffect)(()=>{N(`tengu_teleport_started`,{source:a})},[a]);let u=async t=>{let r=await o(t);r?e(r):c&&n&&n(c.message,c.formattedMessage)},d=()=>{N(`tengu_teleport_cancelled`,{}),t()};return y(`app:interrupt`,d,{context:`Global`,isActive:!!c&&!n}),s&&l?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Resuming session…`})]}),(0,H.jsxs)(_,{dimColor:!0,children:[`Loading "`,l.title,`"…`]})]}):c&&!n?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Failed to resume session`}),(0,H.jsx)(_,{dimColor:!0,children:c.message}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Esc`}),` to cancel`]})})]}):(0,H.jsx)(G,{onSelect:u,onCancel:d,isEmbedded:i})}export{J as TeleportResumeWrapper};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Au as t,Dp as n,Mu as r,Op as i,Pu as a,Qu as o,Zu as s,_C as c,gC as l,hC as u,ju as d,lu as f,pu as p,xC as m}from"./loadAgentsDir-DnsldjYU.js";import{D as h,I as g,P as _,T as v,Wt as y,ai as b,hn as x,ot as S,t as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as T,nr as E}from"./state-B3zvBu4R.js";import{M as D,P as O,R as k,c as A,i as j}from"./debug-D7OBvqC2.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";import{p as P,v as F}from"./startupProfiler-BqUlQEaV.js";import{i as I,n as L}from"./detectRepository-AVEUw4lk.js";import{n as R,o as z}from"./api-DAyhTxgY.js";var B=e(b(),1);T(),M(),k(),f();function V(e){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null);return{resumeSession:(0,B.useCallback)(async t=>{n(!0),i(null),o(t),N(`tengu_teleport_resume_session`,{source:e,session_id:t.id});try{let e=await p(t.id);return E({sessionId:t.id}),n(!1),e}catch(e){let t={message:e instanceof D?e.message:O(e),formattedMessage:e instanceof D?e.formattedMessage:void 0,isOperationError:e instanceof D};return i(t),n(!1),null}},[e]),isResuming:t,error:r,selectedSession:a,clearError:(0,B.useCallback)(()=>{i(null)},[])}}m(),z(),C(),u(),l(),j(),I(),F(),i(),s(),a(),d();var H=w(),U=`Updated`,W=` `;function G({onSelect:e,onCancel:i,isEmbedded:a=!1}){let{rows:s}=S(),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!0),[b,C]=(0,B.useState)(null),[w,T]=(0,B.useState)(!1),[E,D]=(0,B.useState)(!1),[O,k]=(0,B.useState)(1),j=c(`confirm:no`,`Confirmation`,`Esc`),M=(0,B.useCallback)(async()=>{try{m(!0),C(null);let e=await L();f(e),A(`Current repository: ${e||`not detected`}`);let t=await R(),n=t;e&&(n=t.filter(t=>t.repo?`${t.repo.owner.login}/${t.repo.name}`===e:!1),A(`Filtered ${n.length} sessions for repo ${e} from ${t.length} total`));let r=[...n].sort((e,t)=>{let n=new Date(e.updated_at);return new Date(t.updated_at).getTime()-n.getTime()});u(r)}catch(e){let t=e instanceof Error?e.message:String(e);A(`Error loading code sessions: ${t}`),C(K(t))}finally{m(!1),T(!1)}},[]),N=()=>{T(!0),M()};y(`confirm:no`,i,{context:`Confirmation`}),x((e,t)=>{if(t.ctrl&&e===`c`){i();return}if(t.ctrl&&e===`r`&&b){N();return}if(b!==null&&t.return){i();return}});let F=(0,B.useCallback)(()=>{D(!0),M()},[D,M]);if(!E)return(0,H.jsx)(t,{onComplete:F});if(p)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Loading Work Mate sessions…`})]}),(0,H.jsx)(_,{dimColor:!0,children:w?`Retrying…`:`Fetching your Work Mate sessions…`})]});if(b)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Error loading Work Mate sessions`}),q(b),(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Ctrl+R`}),` to retry · Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})]});if(l.length===0)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(_,{bold:!0,children:[`No Work Mate sessions found`,d&&(0,H.jsxs)(_,{children:[` for `,d]})]}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})})]});let I=l.map(e=>({...e,timeString:P(new Date(e.updated_at))})),z=Math.max(7,...I.map(e=>e.timeString.length)),V=I.map(({timeString:e,title:t,id:n})=>({label:`${e.padEnd(z,` `)} ${t}`,value:n})),G=Math.max(1,a?Math.min(l.length,5,s-6-7):Math.min(l.length,s-1-7));return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,height:G+7,children:[(0,H.jsxs)(_,{bold:!0,children:[`Select a session to resume`,l.length>G&&(0,H.jsxs)(_,{dimColor:!0,children:[` `,`(`,O,` of `,l.length,`)`]}),d&&(0,H.jsxs)(_,{dimColor:!0,children:[` (`,d,`)`]}),`:`]}),(0,H.jsxs)(g,{flexDirection:`column`,marginTop:1,flexGrow:1,children:[(0,H.jsx)(g,{marginLeft:2,children:(0,H.jsxs)(_,{bold:!0,children:[U.padEnd(z,` `),W,`Session Title`]})}),(0,H.jsx)(o,{visibleOptionCount:G,options:V,onChange:t=>{let n=l.find(e=>e.id===t);n&&e(n)},onFocus:e=>{let t=V.findIndex(t=>t.value===e);t>=0&&k(t+1)}})]}),(0,H.jsx)(g,{flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:(0,H.jsxs)(v,{children:[(0,H.jsx)(h,{shortcut:`↑/↓`,action:`select`}),(0,H.jsx)(h,{shortcut:`Enter`,action:`confirm`}),(0,H.jsx)(n,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}function K(e){let t=e.toLowerCase();return t.includes(`fetch`)||t.includes(`network`)||t.includes(`timeout`)?`network`:t.includes(`auth`)||t.includes(`token`)||t.includes(`permission`)||t.includes(`oauth`)||t.includes(`not authenticated`)||t.includes(`/login`)||t.includes(`console account`)||t.includes(`403`)?`auth`:t.includes(`api`)||t.includes(`rate limit`)||t.includes(`500`)||t.includes(`529`)?`api`:`other`}function q(e){switch(e){case`network`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Check your internet connection`})});case`auth`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Teleport requires a Work Mate account`})});case`api`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})});case`other`:return(0,H.jsx)(g,{marginY:1,flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})})}}M(),C(),u(),a();function J({onComplete:e,onCancel:t,onError:n,isEmbedded:i=!1,source:a}){let{resumeSession:o,isResuming:s,error:c,selectedSession:l}=V(a);(0,B.useEffect)(()=>{N(`tengu_teleport_started`,{source:a})},[a]);let u=async t=>{let r=await o(t);r?e(r):c&&n&&n(c.message,c.formattedMessage)},d=()=>{N(`tengu_teleport_cancelled`,{}),t()};return y(`app:interrupt`,d,{context:`Global`,isActive:!!c&&!n}),s&&l?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Resuming session…`})]}),(0,H.jsxs)(_,{dimColor:!0,children:[`Loading "`,l.title,`"…`]})]}):c&&!n?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Failed to resume session`}),(0,H.jsx)(_,{dimColor:!0,children:c.message}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Esc`}),` to cancel`]})})]}):(0,H.jsx)(G,{onSelect:u,onCancel:d,isEmbedded:i})}export{J as TeleportResumeWrapper};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,$h as n,Lh as r,Nh as i,Ph as a,Qu as o,Rh as s,Xh as c,Zd as l,Zh as u,Zu as d,_C as f,gC as p,hC as m,vC as h,xC as g,zh as _}from"./loadAgentsDir-PPiD2Mfq.js";import{D as v,H as y,I as b,P as x,T as S,U as C,V as w,Wt as T,Xt as E,ot as D,t as O}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{g as A,x as j}from"./settings-CvhsRFaT.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-C9orgrub.js";function P({onThemeSelect:e,showIntroText:t=!1,helpText:a=``,showHelpTextBelow:c=!1,hideEscToCancel:d=!1,skipExitHandling:p=!1,onCancel:m}){let[h]=y(),g=C(),{columns:_}=D(),O=r(),k=O===null?s(h):null,{setPreviewTheme:A,savePreview:N,cancelPreview:P}=w(),I=u(e=>e.settings.syntaxHighlightingDisabled)??!1,L=n();E(`ThemePicker`);let R=f(`theme:toggleSyntaxHighlighting`,`ThemePicker`,`ctrl+t`);T(`theme:toggleSyntaxHighlighting`,()=>{if(O===null){let e=!I;j(`userSettings`,{syntaxHighlightingDisabled:e}),L(t=>({...t,settings:{...t.settings,syntaxHighlightingDisabled:e}}))}},{context:`ThemePicker`});let z=M(p?()=>{}:void 0),B=[{label:`Dark mode`,value:`dark`},{label:`Light mode`,value:`light`},{label:`Dark mode (colorblind-friendly)`,value:`dark-daltonized`},{label:`Light mode (colorblind-friendly)`,value:`light-daltonized`},{label:`Dark mode (ANSI colors only)`,value:`dark-ansi`},{label:`Light mode (ANSI colors only)`,value:`light-ansi`}],V=(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[t?(0,F.jsx)(x,{children:`Let's get started.`}):(0,F.jsx)(x,{bold:!0,color:`permission`,children:`Theme`}),(0,F.jsxs)(b,{flexDirection:`column`,children:[(0,F.jsx)(x,{bold:!0,children:`Choose the text style that looks best with your terminal`}),a&&!c&&(0,F.jsx)(x,{dimColor:!0,children:a})]}),(0,F.jsx)(o,{options:B,onFocus:e=>{A(e)},onChange:t=>{N(),e(t)},onCancel:p?()=>{P(),m?.()}:async()=>{P(),await l(0)},visibleOptionCount:B.length,defaultValue:g,defaultFocusValue:g})]}),(0,F.jsxs)(b,{flexDirection:`column`,width:`100%`,children:[(0,F.jsx)(b,{flexDirection:`column`,borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:`dashed`,borderColor:`subtle`,children:(0,F.jsx)(i,{patch:{oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[` function greet() {`,`- console.log("Hello, World!");`,`+ console.log("Hello, Work Mate!");`,` }`]},dim:!1,filePath:`demo.js`,firstLine:null,width:_})}),(0,F.jsxs)(x,{dimColor:!0,children:[` `,O===`env`?`Syntax highlighting disabled (via CLAUDE_CODE_SYNTAX_HIGHLIGHT=${process.env.CLAUDE_CODE_SYNTAX_HIGHLIGHT})`:I?`Syntax highlighting disabled (${R} to enable)`:k?`Syntax theme: ${k.theme}${k.source?` (from ${k.source})`:``} (${R} to disable)`:`Syntax highlighting enabled (${R} to disable)`]})]})]});return t?V:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(b,{flexDirection:`column`,children:V}),(0,F.jsxs)(b,{marginTop:1,children:[c&&a&&(0,F.jsx)(b,{marginLeft:3,children:(0,F.jsx)(x,{dimColor:!0,children:a})}),!d&&(0,F.jsx)(b,{children:(0,F.jsx)(x,{dimColor:!0,italic:!0,children:z.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):(0,F.jsxs)(S,{children:[(0,F.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,F.jsx)(v,{shortcut:`Esc`,action:`cancel`})]})})})]})]})}var F,I=e((()=>{N(),g(),O(),h(),m(),p(),c(),t(),A(),d(),_(),a(),F=k()}));export{I as n,P as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,$h as n,Lh as r,Nh as i,Ph as a,Qu as o,Rh as s,Xh as c,Zd as l,Zh as u,Zu as d,_C as f,gC as p,hC as m,vC as h,xC as g,zh as _}from"./loadAgentsDir-DnsldjYU.js";import{D as v,H as y,I as b,P as x,T as S,U as C,V as w,Wt as T,Xt as E,ot as D,t as O}from"./src-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{g as A,x as j}from"./settings-DUyIag_5.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-BnmDpMkm.js";function P({onThemeSelect:e,showIntroText:t=!1,helpText:a=``,showHelpTextBelow:c=!1,hideEscToCancel:d=!1,skipExitHandling:p=!1,onCancel:m}){let[h]=y(),g=C(),{columns:_}=D(),O=r(),k=O===null?s(h):null,{setPreviewTheme:A,savePreview:N,cancelPreview:P}=w(),I=u(e=>e.settings.syntaxHighlightingDisabled)??!1,L=n();E(`ThemePicker`);let R=f(`theme:toggleSyntaxHighlighting`,`ThemePicker`,`ctrl+t`);T(`theme:toggleSyntaxHighlighting`,()=>{if(O===null){let e=!I;j(`userSettings`,{syntaxHighlightingDisabled:e}),L(t=>({...t,settings:{...t.settings,syntaxHighlightingDisabled:e}}))}},{context:`ThemePicker`});let z=M(p?()=>{}:void 0),B=[{label:`Dark mode`,value:`dark`},{label:`Light mode`,value:`light`},{label:`Dark mode (colorblind-friendly)`,value:`dark-daltonized`},{label:`Light mode (colorblind-friendly)`,value:`light-daltonized`},{label:`Dark mode (ANSI colors only)`,value:`dark-ansi`},{label:`Light mode (ANSI colors only)`,value:`light-ansi`}],V=(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[t?(0,F.jsx)(x,{children:`Let's get started.`}):(0,F.jsx)(x,{bold:!0,color:`permission`,children:`Theme`}),(0,F.jsxs)(b,{flexDirection:`column`,children:[(0,F.jsx)(x,{bold:!0,children:`Choose the text style that looks best with your terminal`}),a&&!c&&(0,F.jsx)(x,{dimColor:!0,children:a})]}),(0,F.jsx)(o,{options:B,onFocus:e=>{A(e)},onChange:t=>{N(),e(t)},onCancel:p?()=>{P(),m?.()}:async()=>{P(),await l(0)},visibleOptionCount:B.length,defaultValue:g,defaultFocusValue:g})]}),(0,F.jsxs)(b,{flexDirection:`column`,width:`100%`,children:[(0,F.jsx)(b,{flexDirection:`column`,borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:`dashed`,borderColor:`subtle`,children:(0,F.jsx)(i,{patch:{oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[` function greet() {`,`- console.log("Hello, World!");`,`+ console.log("Hello, Work Mate!");`,` }`]},dim:!1,filePath:`demo.js`,firstLine:null,width:_})}),(0,F.jsxs)(x,{dimColor:!0,children:[` `,O===`env`?`Syntax highlighting disabled (via CLAUDE_CODE_SYNTAX_HIGHLIGHT=${process.env.CLAUDE_CODE_SYNTAX_HIGHLIGHT})`:I?`Syntax highlighting disabled (${R} to enable)`:k?`Syntax theme: ${k.theme}${k.source?` (from ${k.source})`:``} (${R} to disable)`:`Syntax highlighting enabled (${R} to disable)`]})]})]});return t?V:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(b,{flexDirection:`column`,children:V}),(0,F.jsxs)(b,{marginTop:1,children:[c&&a&&(0,F.jsx)(b,{marginLeft:3,children:(0,F.jsx)(x,{dimColor:!0,children:a})}),!d&&(0,F.jsx)(b,{children:(0,F.jsx)(x,{dimColor:!0,italic:!0,children:z.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):(0,F.jsxs)(S,{children:[(0,F.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,F.jsx)(v,{shortcut:`Esc`,action:`cancel`})]})})})]})]})}var F,I=e((()=>{N(),g(),O(),h(),m(),p(),c(),t(),A(),d(),_(),a(),F=k()}));export{I as n,P as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Ix as n,Nx as r,Qd as i,Qu as a,Xg as o,Yg as s,Zu as c,hC as l}from"./loadAgentsDir-PPiD2Mfq.js";import{I as u,P as d,Wt as f,ai as p,t as m}from"./src-DL3w8VPk2.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as g,Wt as _}from"./state-BPFYBqm1.js";import{n as v,t as y}from"./cwd-Besi3Os3.js";import{f as b,u as x}from"./debug-BQj6h99Q.js";import{c as S,g as C}from"./settings-CvhsRFaT.js";import{h as w,n as T,v as E}from"./config-BSkuQZNf.js";import{n as D,r as O}from"./analytics-DJobLaWP.js";import{an as k}from"./prompt-CQmEvnKN.js";import{n as A,t as j}from"./managedEnvConstants-BPwL2aWI.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-C9orgrub.js";import{n as P,t as F}from"./PermissionDialog-BPhvs5xH.js";import{homedir as I}from"os";var L=e(p(),1),R=h();m(),_(),v(),b(),D(),w(),l(),n(),t(),c(),N(),P(),C(),k(),A(),o();function z(e){if(e===null||e.disableAllHooks)return!1;if(e.statusLine||e.fileSuggestion)return!0;if(!e.hooks)return!1;for(let t of Object.values(e.hooks))if(t.length>0)return!0;return!1}function B(){let e=[];return z(S(`projectSettings`))&&e.push(`.workmate/settings.json`),z(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function V(e){return e.some(e=>e.ruleBehavior===`allow`&&(e.ruleValue.toolName===`Bash`||e.ruleValue.toolName.startsWith(`Bash(`)))}function H(){let e=[];return V(s(`projectSettings`))&&e.push(`.workmate/settings.json`),V(s(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function U(e){return!!e?.otelHeadersHelper}function W(){let e=[];return U(S(`projectSettings`))&&e.push(`.workmate/settings.json`),U(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function G(e){return!!e?.apiKeyHelper}function K(){let e=[];return G(S(`projectSettings`))&&e.push(`.workmate/settings.json`),G(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function q(e){return!!(e?.awsAuthRefresh||e?.awsCredentialExport)}function J(){let e=[];return q(S(`projectSettings`))&&e.push(`.workmate/settings.json`),q(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Y(e){return!!e?.gcpAuthRefresh}function X(){let e=[];return Y(S(`projectSettings`))&&e.push(`.workmate/settings.json`),Y(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Z(e){return e?.env?Object.keys(e.env).some(e=>!j.has(e.toUpperCase())):!1}function Q(){let e=[];return Z(S(`projectSettings`))&&e.push(`.workmate/settings.json`),Z(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}k();function $({onDone:e,commands:t}){let{servers:n}=r(`project`),o=Object.keys(n).length>0,s=B().length>0,c=H(),l=K().length>0,p=J().length>0,m=X().length>0,h=W().length>0,_=Q().length>0,v=t?.some(e=>e.type===`prompt`&&e.loadedFrom===`commands_DEPRECATED`&&(e.source===`projectSettings`||e.source===`localSettings`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,b=t?.some(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`)&&(e.source===`projectSettings`||e.source===`localSettings`||e.source===`plugin`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,S=c.length>0||v||b,C=T(),[w,D]=L.useState(null);L.useEffect(()=>{if(w!==null){let e=w,t=setTimeout(()=>i(e));return()=>clearTimeout(t)}},[w]),L.useEffect(()=>{O(`tengu_trust_dialog_shown`,{isHomeDir:I()===y(),hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_})},[o,s,S,l,p,m,h,_]);function k(t){if(t===`exit`){D(1);return}let n=I()===y();O(`tengu_trust_dialog_accept`,{isHomeDir:n,hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_}),n?g(!0):E(e=>({...e,hasTrustDialogAccepted:!0})),e()}let A=M(()=>D(1));return f(`confirm:no`,()=>{D(0)},{context:`Confirmation`}),w===null?C?(setTimeout(e),null):(0,R.jsx)(F,{color:`warning`,titleColor:`warning`,title:`Accessing workspace:`,children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,paddingTop:1,children:[(0,R.jsx)(d,{bold:!0,children:x().cwd()}),(0,R.jsx)(d,{children:`Is this a project you trust? (Your own code, a well-known open source project, or work from your team).`}),(0,R.jsx)(d,{children:`Once trusted, Work Mate can read, edit, and run commands in this folder.`}),(0,R.jsx)(a,{options:[{label:`Yes, I trust this folder`,value:`enable_all`},{label:`No, exit`,value:`exit`}],onChange:e=>k(e),onCancel:()=>k(`exit`)}),(0,R.jsx)(d,{dimColor:!0,children:A.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,A.keyName,` again to exit`]}):(0,R.jsx)(R.Fragment,{children:`Enter to confirm · Esc to cancel`})})]})}):null}export{$ as TrustDialog};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Ix as n,Nx as r,Qd as i,Qu as a,Xg as o,Yg as s,Zu as c,hC as l}from"./loadAgentsDir-DnsldjYU.js";import{I as u,P as d,Wt as f,ai as p,t as m}from"./src-DL3w8VPk2.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as g,Wt as _}from"./state-B3zvBu4R.js";import{n as v,t as y}from"./cwd-Dj2ynhWd.js";import{f as b,u as x}from"./debug-D7OBvqC2.js";import{c as S,g as C}from"./settings-DUyIag_5.js";import{h as w,n as T,v as E}from"./config-BybjRr09.js";import{n as D,r as O}from"./analytics-DJobLaWP.js";import{an as k}from"./prompt-CzQkcxfg.js";import{n as A,t as j}from"./managedEnvConstants-BPwL2aWI.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-BnmDpMkm.js";import{n as P,t as F}from"./PermissionDialog-BPhvs5xH.js";import{homedir as I}from"os";var L=e(p(),1),R=h();m(),_(),v(),b(),D(),w(),l(),n(),t(),c(),N(),P(),C(),k(),A(),o();function z(e){if(e===null||e.disableAllHooks)return!1;if(e.statusLine||e.fileSuggestion)return!0;if(!e.hooks)return!1;for(let t of Object.values(e.hooks))if(t.length>0)return!0;return!1}function B(){let e=[];return z(S(`projectSettings`))&&e.push(`.workmate/settings.json`),z(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function V(e){return e.some(e=>e.ruleBehavior===`allow`&&(e.ruleValue.toolName===`Bash`||e.ruleValue.toolName.startsWith(`Bash(`)))}function H(){let e=[];return V(s(`projectSettings`))&&e.push(`.workmate/settings.json`),V(s(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function U(e){return!!e?.otelHeadersHelper}function W(){let e=[];return U(S(`projectSettings`))&&e.push(`.workmate/settings.json`),U(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function G(e){return!!e?.apiKeyHelper}function K(){let e=[];return G(S(`projectSettings`))&&e.push(`.workmate/settings.json`),G(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function q(e){return!!(e?.awsAuthRefresh||e?.awsCredentialExport)}function J(){let e=[];return q(S(`projectSettings`))&&e.push(`.workmate/settings.json`),q(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Y(e){return!!e?.gcpAuthRefresh}function X(){let e=[];return Y(S(`projectSettings`))&&e.push(`.workmate/settings.json`),Y(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Z(e){return e?.env?Object.keys(e.env).some(e=>!j.has(e.toUpperCase())):!1}function Q(){let e=[];return Z(S(`projectSettings`))&&e.push(`.workmate/settings.json`),Z(S(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}k();function $({onDone:e,commands:t}){let{servers:n}=r(`project`),o=Object.keys(n).length>0,s=B().length>0,c=H(),l=K().length>0,p=J().length>0,m=X().length>0,h=W().length>0,_=Q().length>0,v=t?.some(e=>e.type===`prompt`&&e.loadedFrom===`commands_DEPRECATED`&&(e.source===`projectSettings`||e.source===`localSettings`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,b=t?.some(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`)&&(e.source===`projectSettings`||e.source===`localSettings`||e.source===`plugin`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,S=c.length>0||v||b,C=T(),[w,D]=L.useState(null);L.useEffect(()=>{if(w!==null){let e=w,t=setTimeout(()=>i(e));return()=>clearTimeout(t)}},[w]),L.useEffect(()=>{O(`tengu_trust_dialog_shown`,{isHomeDir:I()===y(),hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_})},[o,s,S,l,p,m,h,_]);function k(t){if(t===`exit`){D(1);return}let n=I()===y();O(`tengu_trust_dialog_accept`,{isHomeDir:n,hasMcpServers:o,hasHooks:s,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_}),n?g(!0):E(e=>({...e,hasTrustDialogAccepted:!0})),e()}let A=M(()=>D(1));return f(`confirm:no`,()=>{D(0)},{context:`Confirmation`}),w===null?C?(setTimeout(e),null):(0,R.jsx)(F,{color:`warning`,titleColor:`warning`,title:`Accessing workspace:`,children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,paddingTop:1,children:[(0,R.jsx)(d,{bold:!0,children:x().cwd()}),(0,R.jsx)(d,{children:`Is this a project you trust? (Your own code, a well-known open source project, or work from your team).`}),(0,R.jsx)(d,{children:`Once trusted, Work Mate can read, edit, and run commands in this folder.`}),(0,R.jsx)(a,{options:[{label:`Yes, I trust this folder`,value:`enable_all`},{label:`No, exit`,value:`exit`}],onChange:e=>k(e),onCancel:()=>k(`exit`)}),(0,R.jsx)(d,{dimColor:!0,children:A.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,A.keyName,` again to exit`]}):(0,R.jsx)(R.Fragment,{children:`Enter to confirm · Esc to cancel`})})]})}):null}export{$ as TrustDialog};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{H as r,I as i,P as a,j as o,t as s}from"./src-DL3w8VPk2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{D as l,E as u}from"./config-BSkuQZNf.js";function d(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:u(e,t,n,r)}var f=e((()=>{l()}));function p(e,t={}){let{showValues:n=!0,hideFunctions:r=!1,themeName:i=`dark`,treeCharColors:a={}}=t,s=[],c=new WeakSet;function l(e,t){return t?o(t,i)(e):e}function u(e,t,i,o=0){if(typeof e==`string`){s.push(t+l(e,a.value));return}if(typeof e!=`object`||!e){if(n){let n=String(e);s.push(t+l(n,a.value))}return}if(c.has(e)){s.push(t+l(`[Circular]`,a.value));return}c.add(e);let d=Object.keys(e).filter(t=>{let n=e[t];return!(r&&typeof n==`function`)});d.forEach((r,i)=>{let f=e[r],p=i===d.length-1,h=o===0&&i===0?``:t,g=l(p?m.lastBranch:m.branch,a.treeChar),_=r.trim()===``?``:l(r,a.key),v=h+g+(_?` ${_}`:``),y=r.trim()!==``;if(f&&typeof f==`object`&&c.has(f)){let e=l(`[Circular]`,a.value);s.push(v+(y?`: `:v?` `:``)+e)}else if(f&&typeof f==`object`&&!Array.isArray(f))s.push(v),u(f,`${h+l(p?m.empty:m.line,a.treeChar)} `,p,o+1);else if(Array.isArray(f))s.push(v+(y?`: `:v?` `:``)+`[Array(`+f.length+`)]`);else if(n){let e=l(typeof f==`function`?`[Function]`:String(f),a.value);v+=(y?`: `:v?` `:``)+e,s.push(v)}else s.push(v)})}let d=Object.keys(e);if(d.length===0)return l(`(empty)`,a.value);if(d.length===1&&d[0]!==void 0&&d[0].trim()===``&&typeof e[d[0]]==`string`){let t=d[0];return`${l(m.lastBranch,a.treeChar)} ${l(e[t],a.value)}`}return u(e,``,!0),s.join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{H as r,I as i,P as a,j as o,t as s}from"./src-DL3w8VPk2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{D as l,E as u}from"./config-BybjRr09.js";function d(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:u(e,t,n,r)}var f=e((()=>{l()}));function p(e,t={}){let{showValues:n=!0,hideFunctions:r=!1,themeName:i=`dark`,treeCharColors:a={}}=t,s=[],c=new WeakSet;function l(e,t){return t?o(t,i)(e):e}function u(e,t,i,o=0){if(typeof e==`string`){s.push(t+l(e,a.value));return}if(typeof e!=`object`||!e){if(n){let n=String(e);s.push(t+l(n,a.value))}return}if(c.has(e)){s.push(t+l(`[Circular]`,a.value));return}c.add(e);let d=Object.keys(e).filter(t=>{let n=e[t];return!(r&&typeof n==`function`)});d.forEach((r,i)=>{let f=e[r],p=i===d.length-1,h=o===0&&i===0?``:t,g=l(p?m.lastBranch:m.branch,a.treeChar),_=r.trim()===``?``:l(r,a.key),v=h+g+(_?` ${_}`:``),y=r.trim()!==``;if(f&&typeof f==`object`&&c.has(f)){let e=l(`[Circular]`,a.value);s.push(v+(y?`: `:v?` `:``)+e)}else if(f&&typeof f==`object`&&!Array.isArray(f))s.push(v),u(f,`${h+l(p?m.empty:m.line,a.treeChar)} `,p,o+1);else if(Array.isArray(f))s.push(v+(y?`: `:v?` `:``)+`[Array(`+f.length+`)]`);else if(n){let e=l(typeof f==`function`?`[Function]`:String(f),a.value);v+=(y?`: `:v?` `:``)+e,s.push(v)}else s.push(v)})}let d=Object.keys(e);if(d.length===0)return l(`(empty)`,a.value);if(d.length===1&&d[0]!==void 0&&d[0].trim()===``&&typeof e[d[0]]==`string`){let t=d[0];return`${l(m.lastBranch,a.treeChar)} ${l(e[t],a.value)}`}return u(e,``,!0),s.join(`
2
2
  `)}var m,h=e((()=>{t(),s(),m={branch:n.lineUpDownRight,lastBranch:n.lineUpRight,line:n.lineVertical,empty:` `}}));function g(e){let t={};return e.forEach(e=>{if(!e.path){t[``]=e.message;return}let n=e.path.split(`.`),r=e.path;if(e.invalidValue!==null&&e.invalidValue!==void 0&&n.length>0){let t=[];for(let r=0;r<n.length;r++){let i=n[r];if(i)if(!isNaN(parseInt(i,10))&&r===n.length-1){let n;n=typeof e.invalidValue==`string`?`"${e.invalidValue}"`:e.invalidValue===null?`null`:e.invalidValue===void 0?`undefined`:String(e.invalidValue),t.push(n)}else t.push(i)}r=t.join(`.`)}d(t,r,e.message,Object)}),t}function _({errors:e}){let[t]=r();if(e.length===0)return null;let n=e.reduce((e,t)=>{let n=t.file||`(file not specified)`;return e[n]||(e[n]=[]),e[n].push(t),e},{});return(0,v.jsx)(i,{flexDirection:`column`,children:Object.keys(n).sort().map(e=>{let r=n[e]||[];r.sort((e,t)=>!e.path&&t.path?-1:e.path&&!t.path?1:(e.path||``).localeCompare(t.path||``));let o=g(r),s=new Map;r.forEach(e=>{if(e.suggestion||e.docLink){let t=`${e.suggestion||``}|${e.docLink||``}`;s.has(t)||s.set(t,{suggestion:e.suggestion,docLink:e.docLink})}});let c=p(o,{showValues:!0,themeName:t,treeCharColors:{treeChar:`inactive`,key:`text`,value:`inactive`}});return(0,v.jsxs)(i,{flexDirection:`column`,children:[(0,v.jsx)(a,{children:e}),(0,v.jsx)(i,{marginLeft:1,children:(0,v.jsx)(a,{dimColor:!0,children:c})}),s.size>0&&(0,v.jsx)(i,{flexDirection:`column`,marginTop:1,children:Array.from(s.values()).map((e,t)=>(0,v.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[e.suggestion&&(0,v.jsx)(a,{dimColor:!0,wrap:`wrap`,children:e.suggestion}),e.docLink&&(0,v.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Learn more: `,e.docLink]})]},`suggestion-pair-${t}`))})]},e)})})}var v,y=e((()=>{f(),s(),h(),v=c()}));export{y as n,_ as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{F as i,Gg as a,Hg as o,Kg as s,N as c,P as l,iC as u,oT as d,rC as f,rT as p}from"./loadAgentsDir-PPiD2Mfq.js";import{I as m,P as h,ai as g,di as _,fi as v,t as y}from"./src-DL3w8VPk2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as x,h as S,in as C}from"./state-BPFYBqm1.js";import{n as w,t as T}from"./AddWorkspaceDirectory-DAtfMH4o.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(m,{flexDirection:`column`,children:[(0,k.jsxs)(h,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(f,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),a=t.getAppState(),l=async(n,r=!1)=>{let i={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},a=o(t.getAppState().toolPermissionContext,i);t.setAppState(e=>({...e,toolPermissionContext:a}));let c=S();c.includes(n)||C([...c,n]),p.refreshConfig();let l;if(r)try{s(i),l=`Added ${_.bold(n)} as a working directory and saved to local settings`}catch(e){l=`Added ${_.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else l=`Added ${_.bold(n)} as a working directory for this session`;e(`${l} ${_.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:a.toolPermissionContext,onAddDirectory:l,onCancel:()=>{e(`Did not add a working directory.`)}});let u=await i(r,a.toolPermissionContext);if(u.resultType!==`success`){let t=c(u);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:u.absolutePath,permissionContext:a.toolPermissionContext,onAddDirectory:l,onCancel:()=>{e(`Did not add ${_.bold(u.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{v(),n(),O=t(g(),1),x(),u(),w(),y(),a(),d(),l(),k=b()}))();export{D as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{F as i,Gg as a,Hg as o,Kg as s,N as c,P as l,iC as u,oT as d,rC as f,rT as p}from"./loadAgentsDir-DnsldjYU.js";import{I as m,P as h,ai as g,di as _,fi as v,t as y}from"./src-DL3w8VPk2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as x,h as S,in as C}from"./state-B3zvBu4R.js";import{n as w,t as T}from"./AddWorkspaceDirectory-Wa6Q24nu.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(m,{flexDirection:`column`,children:[(0,k.jsxs)(h,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(f,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),a=t.getAppState(),l=async(n,r=!1)=>{let i={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},a=o(t.getAppState().toolPermissionContext,i);t.setAppState(e=>({...e,toolPermissionContext:a}));let c=S();c.includes(n)||C([...c,n]),p.refreshConfig();let l;if(r)try{s(i),l=`Added ${_.bold(n)} as a working directory and saved to local settings`}catch(e){l=`Added ${_.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else l=`Added ${_.bold(n)} as a working directory for this session`;e(`${l} ${_.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:a.toolPermissionContext,onAddDirectory:l,onCancel:()=>{e(`Did not add a working directory.`)}});let u=await i(r,a.toolPermissionContext);if(u.resultType!==`success`){let t=c(u);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:u.absolutePath,permissionContext:a.toolPermissionContext,onAddDirectory:l,onCancel:()=>{e(`Did not add ${_.bold(u.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{v(),n(),O=t(g(),1),x(),u(),w(),y(),a(),d(),l(),k=b()}))();export{D as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{em as t,tm as n}from"./loadAgentsDir-PPiD2Mfq.js";import{cn as r,ln as i}from"./settings-CvhsRFaT.js";function a(e,t){let n=new Map;for(let e of t)n.set(e.agentType,e);let r=new Set,i=[];for(let t of e){let e=`${t.agentType}:${t.source}`;if(r.has(e))continue;r.add(e);let a=n.get(t.agentType),o=a&&a.source!==t.source?a.source:void 0;i.push({...t,overriddenBy:o})}return i}function o(e){let n=e.model||t();if(n)return n===`inherit`?`inherit`:n}function s(e){return r(e).toLowerCase()}function c(e,t){return e.agentType.localeCompare(t.agentType,void 0,{sensitivity:`base`})}var l,u=e((()=>{n(),i(),l=[{label:`User agents`,source:`userSettings`},{label:`Project agents`,source:`projectSettings`},{label:`Local agents`,source:`localSettings`},{label:`Managed agents`,source:`policySettings`},{label:`Plugin agents`,source:`plugin`},{label:`CLI arg agents`,source:`flagSettings`},{label:`Built-in agents`,source:`built-in`}]}));export{o as a,u as i,c as n,a as o,s as r,l as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{em as t,tm as n}from"./loadAgentsDir-DnsldjYU.js";import{cn as r,ln as i}from"./settings-DUyIag_5.js";function a(e,t){let n=new Map;for(let e of t)n.set(e.agentType,e);let r=new Set,i=[];for(let t of e){let e=`${t.agentType}:${t.source}`;if(r.has(e))continue;r.add(e);let a=n.get(t.agentType),o=a&&a.source!==t.source?a.source:void 0;i.push({...t,overriddenBy:o})}return i}function o(e){let n=e.model||t();if(n)return n===`inherit`?`inherit`:n}function s(e){return r(e).toLowerCase()}function c(e,t){return e.agentType.localeCompare(t.agentType,void 0,{sensitivity:`base`})}var l,u=e((()=>{n(),i(),l=[{label:`User agents`,source:`userSettings`},{label:`Project agents`,source:`projectSettings`},{label:`Local agents`,source:`localSettings`},{label:`Managed agents`,source:`policySettings`},{label:`Plugin agents`,source:`plugin`},{label:`CLI arg agents`,source:`flagSettings`},{label:`Built-in agents`,source:`built-in`}]}));export{o as a,u as i,c as n,a as o,s as r,l as t};
@@ -1,2 +1,2 @@
1
- import{i as e,o as t,r as n}from"./loadAgentsDir-PPiD2Mfq.js";import{n as r,t as i}from"./cwd-Besi3Os3.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-TX1bh-lX.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
1
+ import{i as e,o as t,r as n}from"./loadAgentsDir-DnsldjYU.js";import{n as r,t as i}from"./cwd-Dj2ynhWd.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-nVTmC7tL.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
2
2
  `).trimEnd()))}export{f as agentsHandler};
@@ -1,4 +1,4 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$S as o,$h as s,$m as c,$p as l,$u as u,Bb as d,Cx as f,DT as p,Dp as m,Gl as h,Gp as g,Hb as _,Hp as v,J_ as ee,Jf as y,Jp as b,Ka as te,Kc as ne,Kl as re,Kp as ie,La as ae,Mu as oe,OT as se,Op as x,Pu as ce,Q as le,Ql as ue,Qm as de,Qp as fe,Qu as pe,Sa as me,Sp as he,Um as ge,Up as _e,Vb as ve,Vp as ye,Wl as be,Wm as xe,Wp as Se,X as Ce,Xf as we,Xh as Te,Y_ as Ee,Yf as De,Zh as Oe,Zl as ke,ah as Ae,by as je,c as Me,cE as Ne,cS as Pe,cd as Fe,dh as Ie,eC as Le,fh as Re,hC as S,ih as ze,l as Be,lS as Ve,ld as He,o as Ue,oE as We,oh as Ge,qc as Ke,qf as qe,ql as Je,qp as Ye,r as Xe,rt as Ze,s as Qe,sE as $e,sh as et,t as tt,tm as nt,tt as rt,wp as it,wx as at,zb as ot}from"./loadAgentsDir-PPiD2Mfq.js";import{C as st,D as C,I as w,P as T,T as E,Wt as D,ai as O,di as ct,fi as lt,t as k,y as ut}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{n as dt,t as ft}from"./cwd-Besi3Os3.js";import{F as pt,R as mt,S as ht,U as gt,W as _t,Z as vt,x as yt}from"./debug-BQj6h99Q.js";import{J as bt,Ln as xt,Q as St,Qt as Ct,Rn as wt,Xt as Tt,at as Et,it as Dt,ln as Ot,sn as kt}from"./settings-CvhsRFaT.js";import{M as At,P as jt}from"./config-BSkuQZNf.js";import{o as Mt,s as Nt}from"./log-BlJ7CcKG.js";import{n as Pt,r as Ft}from"./analytics-DJobLaWP.js";import{C as It,v as Lt}from"./startupProfiler-2sjXZkIP.js";import{l as Rt,n as zt,o as Bt}from"./stringUtils-BjnclTLB.js";import{vn as Vt,yn as Ht}from"./prompt-CQmEvnKN.js";import{Q as Ut}from"./sessionState-BTFowSpR.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./agentDisplay-TX1bh-lX.js";import{n as Xt,t as Zt}from"./useExitOnCtrlCDWithKeybindings-C9orgrub.js";import{n as Qt,t as $t}from"./useMergedTools-CZeQBdky.js";import{n as en,r as tn,t as nn}from"./promptEditor-Bf72KNF-.js";import{n as rn,t as an}from"./useMainLoopModel-BigVcn2T.js";import{join as j}from"path";import{mkdir as on,open as sn,unlink as cn}from"fs/promises";var M,ln=e((()=>{M={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function un(e,t,n,r,i,a,o){return`---
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$S as o,$h as s,$m as c,$p as l,$u as u,Bb as d,Cx as f,DT as p,Dp as m,Gl as h,Gp as g,Hb as _,Hp as v,J_ as ee,Jf as y,Jp as b,Ka as te,Kc as ne,Kl as re,Kp as ie,La as ae,Mu as oe,OT as se,Op as x,Pu as ce,Q as le,Ql as ue,Qm as de,Qp as fe,Qu as pe,Sa as me,Sp as he,Um as ge,Up as _e,Vb as ve,Vp as ye,Wl as be,Wm as xe,Wp as Se,X as Ce,Xf as we,Xh as Te,Y_ as Ee,Yf as De,Zh as Oe,Zl as ke,ah as Ae,by as je,c as Me,cE as Ne,cS as Pe,cd as Fe,dh as Ie,eC as Le,fh as Re,hC as S,ih as ze,l as Be,lS as Ve,ld as He,o as Ue,oE as We,oh as Ge,qc as Ke,qf as qe,ql as Je,qp as Ye,r as Xe,rt as Ze,s as Qe,sE as $e,sh as et,t as tt,tm as nt,tt as rt,wp as it,wx as at,zb as ot}from"./loadAgentsDir-DnsldjYU.js";import{C as st,D as C,I as w,P as T,T as E,Wt as D,ai as O,di as ct,fi as lt,t as k,y as ut}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{n as dt,t as ft}from"./cwd-Dj2ynhWd.js";import{F as pt,R as mt,S as ht,U as gt,W as _t,Z as vt,x as yt}from"./debug-D7OBvqC2.js";import{J as bt,Ln as xt,Q as St,Qt as Ct,Rn as wt,Xt as Tt,at as Et,it as Dt,ln as Ot,sn as kt}from"./settings-DUyIag_5.js";import{M as At,P as jt}from"./config-BybjRr09.js";import{o as Mt,s as Nt}from"./log-CR0v5KUR.js";import{n as Pt,r as Ft}from"./analytics-DJobLaWP.js";import{C as It,v as Lt}from"./startupProfiler-BqUlQEaV.js";import{l as Rt,n as zt,o as Bt}from"./stringUtils-CGZoOfer.js";import{vn as Vt,yn as Ht}from"./prompt-CzQkcxfg.js";import{Q as Ut}from"./sessionState-B3tFm9SC.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./agentDisplay-nVTmC7tL.js";import{n as Xt,t as Zt}from"./useExitOnCtrlCDWithKeybindings-BnmDpMkm.js";import{n as Qt,t as $t}from"./useMergedTools-ChLA8dsy.js";import{n as en,r as tn,t as nn}from"./promptEditor-C6w1vT5E.js";import{n as rn,t as an}from"./useMainLoopModel-DG8pghH7.js";import{join as j}from"path";import{mkdir as on,open as sn,unlink as cn}from"fs/promises";var M,ln=e((()=>{M={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function un(e,t,n,r,i,a,o){return`---
2
2
  name: ${e}
3
3
  description: "${t.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\\\n`)}"${n===void 0||n.length===1&&n[0]===`*`?``:`\ntools: ${n.join(`, `)}`}${a?`\nmodel: ${a}`:``}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
4
4
  ---
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ix as t,Nx as n}from"./loadAgentsDir-PPiD2Mfq.js";import{g as r,u as i}from"./settings-CvhsRFaT.js";function a(){let e=i(),t=[`user`,`project`,`local`].flatMap(e=>n(e).errors);return{settings:e.settings,errors:[...e.errors,...t]}}var o=e((()=>{t(),r()}));export{o as n,a as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ix as t,Nx as n}from"./loadAgentsDir-DnsldjYU.js";import{g as r,u as i}from"./settings-DUyIag_5.js";function a(){let e=i(),t=[`user`,`project`,`local`].flatMap(e=>n(e).errors);return{settings:e.settings,errors:[...e.errors,...t]}}var o=e((()=>{t(),r()}));export{o as n,a as t};
@@ -0,0 +1 @@
1
+ import{a as e,o as t}from"./api-DAyhTxgY.js";t();export{e as getOAuthHeaders};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{i as r,n as i,r as a,t as o}from"./lazySchema-B4D4qJVE.js";import{C as s,P as c,R as l,U as u,c as d,i as f,x as p}from"./debug-BQj6h99Q.js";import{h as m}from"./config-BSkuQZNf.js";import{o as h,s as g}from"./log-BlJ7CcKG.js";import{l as _,u as v}from"./oauth-D38aRTUb.js";import{Dr as y,Or as b,Pt as x,St as S,dn as C,fn as w}from"./model-sviY1inu.js";import{a as T,i as E}from"./detectRepository-Qy3zKoyn.js";import{randomUUID as D}from"crypto";function O(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function k(e,n){let r;for(let i=0;i<=R;i++)try{return await t.get(e,n)}catch(e){if(r=e,!O(e))throw e;if(i>=R)throw d(`Teleport request failed after ${i+1} attempts: ${c(e)}`),e;let t=L[i]??2e3;d(`Teleport request failed (attempt ${i+1}/${R+1}), retrying in ${t}ms: ${c(e)}`),await w(t)}throw r}async function A(){let e=S()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient.`);let t=await y();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function j(){let{accessToken:e,orgUUID:t}=await A(),n=`${_().BASE_API_URL}/v1/sessions`;try{let r=await k(n,{headers:{...M(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=T(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw g(u(e)),e}}function M(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function N(e){let{accessToken:n,orgUUID:r}=await A(),i=`${_().BASE_API_URL}/v1/sessions/${e}`,a={...M(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function P(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function F(e,n,r){try{let{accessToken:i,orgUUID:a}=await A(),o=`${_().BASE_API_URL}/v1/sessions/${e}/events`,c={...M(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},l={events:[{uuid:r?.uuid??D(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};d(`[sendEventToRemoteSession] Sending event to session ${e}`);let u=await t.post(o,l,{headers:c,validateStatus:e=>e<500,timeout:3e4});return u.status===200||u.status===201?(d(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(d(`[sendEventToRemoteSession] Failed with status ${u.status}: ${s(u.data)}`),!1)}catch(e){return d(`[sendEventToRemoteSession] Error: ${c(e)}`),!1}}async function I(e,n){try{let{accessToken:r,orgUUID:i}=await A(),a=`${_().BASE_API_URL}/v1/sessions/${e}`,o={...M(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};d(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let c=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return c.status===200?(d(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(d(`[updateSessionTitle] Failed with status ${c.status}: ${s(c.data)}`),!1)}catch(e){return d(`[updateSessionTitle] Error: ${c(e)}`),!1}}var L,R,z=e((()=>{n(),v(),b(),a(),x(),m(),f(),E(),l(),o(),h(),C(),p(),L=[2e3,4e3,8e3,16e3],R=L.length,i(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{M as a,A as c,P as i,F as l,j as n,z as o,N as r,O as s,k as t,I as u};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{i as r,n as i,r as a,t as o}from"./lazySchema-DULtBUCI.js";import{C as s,P as c,R as l,U as u,c as d,i as f,x as p}from"./debug-D7OBvqC2.js";import{h as m}from"./config-BybjRr09.js";import{o as h,s as g}from"./log-CR0v5KUR.js";import{l as _,u as v}from"./oauth-D38aRTUb.js";import{Dr as y,Or as b,Pt as x,St as S,dn as C,fn as w}from"./model-xI2MbgRj.js";import{a as T,i as E}from"./detectRepository-AVEUw4lk.js";import{randomUUID as D}from"crypto";function O(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function k(e,n){let r;for(let i=0;i<=R;i++)try{return await t.get(e,n)}catch(e){if(r=e,!O(e))throw e;if(i>=R)throw d(`Teleport request failed after ${i+1} attempts: ${c(e)}`),e;let t=L[i]??2e3;d(`Teleport request failed (attempt ${i+1}/${R+1}), retrying in ${t}ms: ${c(e)}`),await w(t)}throw r}async function A(){let e=S()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient.`);let t=await y();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function j(){let{accessToken:e,orgUUID:t}=await A(),n=`${_().BASE_API_URL}/v1/sessions`;try{let r=await k(n,{headers:{...M(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=T(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw g(u(e)),e}}function M(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function N(e){let{accessToken:n,orgUUID:r}=await A(),i=`${_().BASE_API_URL}/v1/sessions/${e}`,a={...M(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function P(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function F(e,n,r){try{let{accessToken:i,orgUUID:a}=await A(),o=`${_().BASE_API_URL}/v1/sessions/${e}/events`,c={...M(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},l={events:[{uuid:r?.uuid??D(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};d(`[sendEventToRemoteSession] Sending event to session ${e}`);let u=await t.post(o,l,{headers:c,validateStatus:e=>e<500,timeout:3e4});return u.status===200||u.status===201?(d(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(d(`[sendEventToRemoteSession] Failed with status ${u.status}: ${s(u.data)}`),!1)}catch(e){return d(`[sendEventToRemoteSession] Error: ${c(e)}`),!1}}async function I(e,n){try{let{accessToken:r,orgUUID:i}=await A(),a=`${_().BASE_API_URL}/v1/sessions/${e}`,o={...M(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};d(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let c=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return c.status===200?(d(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(d(`[updateSessionTitle] Failed with status ${c.status}: ${s(c.data)}`),!1)}catch(e){return d(`[updateSessionTitle] Error: ${c(e)}`),!1}}var L,R,z=e((()=>{n(),v(),b(),a(),x(),m(),f(),E(),l(),o(),h(),C(),p(),L=[2e3,4e3,8e3,16e3],R=L.length,i(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{M as a,A as c,P as i,F as l,j as n,z as o,N as r,O as s,k as t,I as u};
@@ -1,4 +1,4 @@
1
- import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{aS as o,nf as s,oS as c,rf as l}from"./loadAgentsDir-PPiD2Mfq.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-BQj6h99Q.js";import{g as p,n as m}from"./settings-CvhsRFaT.js";import{c as h,h as g,y as _}from"./config-BSkuQZNf.js";import{o as v,s as y}from"./log-BlJ7CcKG.js";import{n as b,r as x}from"./analytics-DJobLaWP.js";import{l as S,u as C}from"./oauth-D38aRTUb.js";import{$r as re,Ar as w,Cr as ie,Er as ae,Ir as oe,Lr as se,Mr as ce,Nr as T,Or as E,Pr as D,Pt as O,Sr as k,St as A,Tn as j,Tr as M,Tt as N,Xn as P,Xt as F,_n as I,bn as L,cn as R,gn as z,gt as B,in as V,kt as H,on as U,pt as W,qn as G,sn as K,ti as le,un as ue,wr as de,xt as fe}from"./model-sviY1inu.js";import{n as pe,t as me}from"./userAgent-DUt0q-Vl.js";import{F as q,T as he}from"./sessionState-BTFowSpR.js";import{d as ge,u as _e}from"./firstPartyEventLogger-BMnXb9cv.js";import{n as ve}from"./trustedDevice-BtXHXu-T.js";import{i as ye,r as be}from"./grove-CQBCzeHf.js";import{t as xe}from"./remoteManagedSettings-Ahgn2e80.js";import{d as Se,n as Ce,t as we}from"./status-Ber2xOXc.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";l(),O(),j(),g(),I(),ue(),_e();async function Y(){A.cache?.clear?.(),ve(),L(),R(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await s()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-n-otwpYf.js`);await t(),await V(),z().delete(),await Y(),_(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),te(),f(),ne(),b(),p(),le(),se(),E(),he(),a(),C(),g(),P(),v(),pe();async function Oe(){try{if(h().claudeCodeFirstTokenDate!==void 0)return;let e=G();if(e.error){y(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${S().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":me()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){y(Error(`Received invalid first_token_date from API: ${n}`));return}}_(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){y(e)}}o(),C(),v();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?S().CLAUDEAI_SUCCESS_URL:S().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=S().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){y(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function X(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Z(){return X(J(32))}function Ae(e){let t=Te(`sha256`);return t.update(e),X(t.digest())}function je(){return X(J(32))}b(),E(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Z()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=Ae(this.codeVerifier),r=je(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=k({...i,isManual:!0}),o=k({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await c(o))}),l=this.authCodeListener?.hasPendingResponse()??!1;x(`tengu_oauth_auth_code_received`,{automatic:l});try{let e=await de(s,r,this.codeVerifier,this.port,!l,t?.expiresIn),n=await ae(e.access_token);if(l){let t=w(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw l&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:w(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};b(),E(),O(),g(),v(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await oe(e.accessToken);t?D({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&D({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=U(e);if(W(),n.warning&&x(`tengu_oauth_storage_warning`,{warning:n.warning}),await M(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await ie(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function Me({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
1
+ import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{aS as o,nf as s,oS as c,rf as l}from"./loadAgentsDir-DnsldjYU.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-D7OBvqC2.js";import{g as p,n as m}from"./settings-DUyIag_5.js";import{c as h,h as g,y as _}from"./config-BybjRr09.js";import{o as v,s as y}from"./log-CR0v5KUR.js";import{n as b,r as x}from"./analytics-DJobLaWP.js";import{l as S,u as C}from"./oauth-D38aRTUb.js";import{$r as re,Ar as w,Cr as ie,Er as ae,Ir as oe,Lr as se,Mr as ce,Nr as T,Or as E,Pr as D,Pt as O,Sr as k,St as A,Tn as j,Tr as M,Tt as N,Xn as P,Xt as F,_n as I,bn as L,cn as R,gn as z,gt as B,in as V,kt as H,on as U,pt as W,qn as G,sn as K,ti as le,un as ue,wr as de,xt as fe}from"./model-xI2MbgRj.js";import{n as pe,t as me}from"./userAgent-D8vvjitA.js";import{F as q,T as he}from"./sessionState-B3tFm9SC.js";import{d as ge,u as _e}from"./firstPartyEventLogger-Cw9Bc3on.js";import{n as ve}from"./trustedDevice-Kyid5Fuy.js";import{i as ye,r as be}from"./grove-mDH4wkhM.js";import{t as xe}from"./remoteManagedSettings-DkLfclxa.js";import{d as Se,n as Ce,t as we}from"./status-g_dhM6Ep.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";l(),O(),j(),g(),I(),ue(),_e();async function Y(){A.cache?.clear?.(),ve(),L(),R(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await s()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-DS2S1m1a.js`);await t(),await V(),z().delete(),await Y(),_(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),te(),f(),ne(),b(),p(),le(),se(),E(),he(),a(),C(),g(),P(),v(),pe();async function Oe(){try{if(h().claudeCodeFirstTokenDate!==void 0)return;let e=G();if(e.error){y(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${S().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":me()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){y(Error(`Received invalid first_token_date from API: ${n}`));return}}_(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){y(e)}}o(),C(),v();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?S().CLAUDEAI_SUCCESS_URL:S().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=S().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){y(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function X(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Z(){return X(J(32))}function Ae(e){let t=Te(`sha256`);return t.update(e),X(t.digest())}function je(){return X(J(32))}b(),E(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Z()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=Ae(this.codeVerifier),r=je(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=k({...i,isManual:!0}),o=k({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await c(o))}),l=this.authCodeListener?.hasPendingResponse()??!1;x(`tengu_oauth_auth_code_received`,{automatic:l});try{let e=await de(s,r,this.codeVerifier,this.port,!l,t?.expiresIn),n=await ae(e.access_token);if(l){let t=w(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw l&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:w(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};b(),E(),O(),g(),v(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await oe(e.accessToken);t?D({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&D({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=U(e);if(W(),n.warning&&x(`tengu_oauth_storage_warning`,{warning:n.warning}),await M(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await ie(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function Me({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
2
2
  `),process.exit(1));let i=m(),a=i.forceLoginMethod?i.forceLoginMethod===`claudeai`:!n,o=i.forceLoginOrgUUID,s=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(s){let e=process.env.CLAUDE_CODE_OAUTH_SCOPES;e||(process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
3
3
  Set it to the space-separated scopes the refresh token was issued with
4
4
  (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./auth-BzrroWLq.js";export{t as authLogin,e as authStatus};
@@ -0,0 +1 @@
1
+ import{At as e,Pt as t,St as n,ct as r,pt as i}from"./model-xI2MbgRj.js";t();export{r as checkAndRefreshOAuthTokenIfNeeded,i as clearOAuthTokenCache,n as getClaudeAIOAuthTokens,e as handleOAuth401Error};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{Bb as n,Bd as r,Cc as i,DC as a,La as o,Q as s,Qf as c,Sa as ee,St as l,TC as u,Ta as te,X as d,br as ne,by as f,cm as p,dt as m,ep as h,lr as g,wa as _,wc as v,zb as re,zd as ie}from"./loadAgentsDir-PPiD2Mfq.js";import{R as y,W as b,Wt as x}from"./state-BPFYBqm1.js";import{n as ae,t as oe}from"./cwd-Besi3Os3.js";import{R as S,U as C,c as w,f as T,i as E,u as D,x as O}from"./debug-BQj6h99Q.js";import{f as k,g as A,y as j}from"./settings-CvhsRFaT.js";import{S as M}from"./config-BSkuQZNf.js";import{o as N,s as P,v as F,y as I}from"./log-BlJ7CcKG.js";import{n as L,r as R}from"./analytics-DJobLaWP.js";import{_ as z,h as B}from"./model-sviY1inu.js";import{vn as V,yn as H}from"./prompt-CQmEvnKN.js";import{Q as U}from"./sessionState-BTFowSpR.js";import{i as W,t as G}from"./nativeInstaller-N1xiUpCP.js";import{n as se,t as K}from"./allErrors-DRiW7i6Y.js";import{r as ce}from"./magicDocs-3U6peChg.js";import{n as le,t as ue}from"./pluginAutoupdate-AMD-FvKB.js";import{n as de}from"./registerProtocol-DrWIX3Lb.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ae(),O(),T(),E(),I(),A(),H(),z(),v(),ne(),ce(),d(),N(),S(),o(),f(),d(),n(),S(),N(),o(),f(),p();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(oe(),`.workmate`,`skills`,e,`SKILL.md`),a;try{a=await r.readFile(i,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${i}`));return}let o=t.map(e=>`- ${e.section}: ${e.change}`).join(`
1
+ import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{Bb as n,Bd as r,Cc as i,DC as a,La as o,Q as s,Qf as c,Sa as ee,St as l,TC as u,Ta as te,X as d,br as ne,by as f,cm as p,dt as m,ep as h,lr as g,wa as _,wc as v,zb as re,zd as ie}from"./loadAgentsDir-DnsldjYU.js";import{R as y,W as b,Wt as x}from"./state-B3zvBu4R.js";import{n as ae,t as oe}from"./cwd-Dj2ynhWd.js";import{R as S,U as C,c as w,f as T,i as E,u as D,x as O}from"./debug-D7OBvqC2.js";import{f as k,g as A,y as j}from"./settings-DUyIag_5.js";import{S as M}from"./config-BybjRr09.js";import{o as N,s as P,v as F,y as I}from"./log-CR0v5KUR.js";import{n as L,r as R}from"./analytics-DJobLaWP.js";import{_ as z,h as B}from"./model-xI2MbgRj.js";import{vn as V,yn as H}from"./prompt-CzQkcxfg.js";import{Q as U}from"./sessionState-B3tFm9SC.js";import{i as W,t as G}from"./nativeInstaller-C6aWHxve.js";import{n as se,t as K}from"./allErrors-YIRWFBD9.js";import{r as ce}from"./magicDocs-D0rjtxup.js";import{n as le,t as ue}from"./pluginAutoupdate-DzK-fXJC.js";import{n as de}from"./registerProtocol-CrzdmgCD.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ae(),O(),T(),E(),I(),A(),H(),z(),v(),ne(),ce(),d(),N(),S(),o(),f(),d(),n(),S(),N(),o(),f(),p();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(oe(),`.workmate`,`skills`,e,`SKILL.md`),a;try{a=await r.readFile(i,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${i}`));return}let o=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
2
  `),c=B(),l=await s({messages:[ee({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
3
 
4
4
  <current_skill_file>
@@ -14,4 +14,4 @@ Rules:
14
14
  - Preserve frontmatter (--- block) exactly as-is
15
15
  - Preserve the overall format and style
16
16
  - Do not remove existing content unless an improvement explicitly replaces it
17
- - Output the complete updated file inside <updated_file> tags`})],systemPrompt:U([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:re().signal,options:{getToolPermissionContext:async()=>V(),model:c,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),u=_(te(Array.isArray(l.message.content)?l.message.content:[]).trim(),`updated_file`);if(!u){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,u,`utf-8`)}catch(e){P(C(e))}}L(),h(),M(),N(),G(),r(),se(),a(),l();var pe=30;function J(){let e=((k()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await D().readdir(e);for(let a of i)try{he(a.name)<t&&(await D().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=D(),t=J(),n=F.errors(),r=F.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=g(),r=D(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,u),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=D(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=D(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=K();if(e.length>0&&j(`cleanupPeriodDays`)){w(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await c(),await ie(J());let t=await m(J());t>0&&R(`tengu_worktree_cleanup`,{removed:t})}x(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-DnTBWFOW.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),i(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
17
+ - Output the complete updated file inside <updated_file> tags`})],systemPrompt:U([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:re().signal,options:{getToolPermissionContext:async()=>V(),model:c,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),u=_(te(Array.isArray(l.message.content)?l.message.content:[]).trim(),`updated_file`);if(!u){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,u,`utf-8`)}catch(e){P(C(e))}}L(),h(),M(),N(),G(),r(),se(),a(),l();var pe=30;function J(){let e=((k()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await D().readdir(e);for(let a of i)try{he(a.name)<t&&(await D().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=D(),t=J(),n=F.errors(),r=F.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=g(),r=D(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,u),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=D(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=D(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=K();if(e.length>0&&j(`cleanupPeriodDays`)){w(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await c(),await ie(J());let t=await m(J());t>0&&R(`tengu_worktree_cleanup`,{removed:t})}x(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-DxGHxoNO.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),i(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-CXv_Pm5h.js";export{e as startBackgroundHousekeeping};