@readmagic/workmate 0.0.25 → 0.0.26

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 (355) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Y5S_lMjD.js → AddWorkspaceDirectory-mS8iUoWY.js} +1 -1
  2. package/dist/chunks/{AgentsMdExternalIncludesDialog-DVbU-BaD.js → AgentsMdExternalIncludesDialog-BHBkysy0.js} +1 -1
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +1 -0
  4. package/dist/chunks/App-D--vtCyq.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-DjqGAL4C.js → BypassPermissionsModeDialog-DyqI98d2.js} +1 -1
  7. package/dist/chunks/CustomSelect-CpMbxYbt.js +1 -0
  8. package/dist/chunks/DiffDialog-BQAU2pJx.js +6 -0
  9. package/dist/chunks/Doctor-BU69VQzw.js +1 -0
  10. package/dist/chunks/Doctor-DJOMbSDE.js +3 -0
  11. package/dist/chunks/{ExitFlow-Dh9QdaYK.js → ExitFlow-xBOnvhiW.js} +2 -2
  12. package/dist/chunks/{InvalidConfigDialog-C9boykQn.js → InvalidConfigDialog-NiuhcaG5.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-UN5mleCK.js → InvalidSettingsDialog-DrromC1I.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +1 -0
  16. package/dist/chunks/MCPToolListView-BRxjOaOL.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-zkM_lGd0.js → McpParsingWarnings-BYG2yqjO.js} +1 -1
  18. package/dist/chunks/MessageSelector-B7xAQqZI.js +3 -0
  19. package/dist/chunks/Messages-CxMsfjOa.js +10 -0
  20. package/dist/chunks/{Onboarding-BT90cFkn.js → Onboarding-CkATe87e.js} +1 -1
  21. package/dist/chunks/{PermissionDialog-BaibiQae.js → PermissionDialog-tEMMa5-a.js} +1 -1
  22. package/dist/chunks/{PressEnterToContinue-DZc_s_pE.js → PressEnterToContinue-CPOaYnym.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CCTZYbWI.js → PromptInputFooterSuggestions-CwqAsTI2.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +1 -0
  25. package/dist/chunks/{ProviderSetup-yIj8YOKF.js → ProviderSetup-J6Ty-Wj8.js} +1 -1
  26. package/dist/chunks/QueryEngine-Mdi_kUaL.js +1 -0
  27. package/dist/chunks/REPL-BgzQtSFF.js +1 -0
  28. package/dist/chunks/REPL-rirm6s_7.js +124 -0
  29. package/dist/chunks/ResumeConversation-Cmsbo5m7.js +1 -0
  30. package/dist/chunks/{SearchBox-C9xxQzh1.js → SearchBox-DQBLKyzJ.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +1 -0
  32. package/dist/chunks/{SelectMulti-BW7Ffk1G.js → SelectMulti-BpAjjhsn.js} +1 -1
  33. package/dist/chunks/Settings-B6DImvca.js +2 -0
  34. package/dist/chunks/Spinner-DhhSOFcN.js +1 -0
  35. package/dist/chunks/{SpinnerGlyph-CqrOK3Mx.js → SpinnerGlyph-CmVXC-_9.js} +1 -1
  36. package/dist/chunks/{TextInput-Cev5Awdd.js → TextInput-BboKIug2.js} +11 -11
  37. package/dist/chunks/ThemePicker-DTpXbEY0.js +1 -0
  38. package/dist/chunks/{TrustDialog-8Sjmuu0e.js → TrustDialog-CZ8JpySm.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-INwwoerV.js → ValidationErrorsList-C_gDQfm1.js} +1 -1
  40. package/dist/chunks/{_baseEach-DrPH_FGo.js → _baseEach-DGbaIpJA.js} +1 -1
  41. package/dist/chunks/_baseSlice-D67_NpZ1.js +1 -0
  42. package/dist/chunks/{add-dir-D3RMaYxy.js → add-dir-B576wzi9.js} +1 -1
  43. package/dist/chunks/{agentDisplay-B3npXoCS.js → agentDisplay-ZuFoBZYu.js} +1 -1
  44. package/dist/chunks/{agents-2mPGmeq6.js → agents-Dy4_hDic.js} +1 -1
  45. package/dist/chunks/agents-HIOBiw4w.js +101 -0
  46. package/dist/chunks/allErrors-CxPNR2WN.js +1 -0
  47. package/dist/chunks/appleTerminalBackup-C9kjzdM9.js +1 -0
  48. package/dist/chunks/{backgroundHousekeeping-BkFxfjOf.js → backgroundHousekeeping-PyLNnGdw.js} +1 -1
  49. package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +1 -0
  50. package/dist/chunks/{banner-DHpTmEO7.js → banner-DqFectPg.js} +2 -2
  51. package/dist/chunks/{branch-Be_yDFU8.js → branch-B_BL5N9N.js} +2 -2
  52. package/dist/chunks/{break-cache-UUt6Dkf2.js → break-cache-DL95nKZl.js} +2 -2
  53. package/dist/chunks/{btw-DUml5L1w.js → btw-Y44ctueB.js} +1 -1
  54. package/dist/chunks/bundledMode-BxyD5cqq.js +1 -0
  55. package/dist/chunks/caches-5xZ4dSXt.js +1 -0
  56. package/dist/chunks/caches-Be9saXxV.js +1 -0
  57. package/dist/chunks/{claudeDesktop-mBGFDbI6.js → claudeDesktop-g8eUUY2E.js} +1 -1
  58. package/dist/chunks/{clear-CrGjNe6E.js → clear-DtTkA707.js} +1 -1
  59. package/dist/chunks/{client-BDuhbzLD.js → client-Bw_L3lSc.js} +1 -1
  60. package/dist/chunks/{client-BYFVVMcf.js → client-aJ2Nr_sh.js} +1 -1
  61. package/dist/chunks/client-mnUISv_N.js +1 -0
  62. package/dist/chunks/client-wPqIdEVm.js +1 -0
  63. package/dist/chunks/commands-wfE12a4L.js +1 -0
  64. package/dist/chunks/compact-CvNOtu7J.js +2 -0
  65. package/dist/chunks/config-D3K87Mm1.js +3 -0
  66. package/dist/chunks/config-DTga6Ku8.js +1 -0
  67. package/dist/chunks/config-DtmqWusU.js +1 -0
  68. package/dist/chunks/{context-mV5zjqmc.js → context-Opu4E8dL.js} +1 -1
  69. package/dist/chunks/{context-noninteractive-DvfVvmSE.js → context-noninteractive-B1V2Mp26.js} +5 -5
  70. package/dist/chunks/context-noninteractive-eIlneYiL.js +1 -0
  71. package/dist/chunks/conversation-CG_z7TLE.js +1 -0
  72. package/dist/chunks/conversation-CHesBfFZ.js +1 -0
  73. package/dist/chunks/conversationRecovery-OhitW-7g.js +1 -0
  74. package/dist/chunks/crossProjectResume-mmYx8PrZ.js +40 -0
  75. package/dist/chunks/cwd-BH2f3u0o.js +1 -0
  76. package/dist/chunks/{cwd-BvNt_018.js → cwd-DrEEb4f5.js} +1 -1
  77. package/dist/chunks/{debug-CRnGsZOV.js → debug-kBjDaVkQ.js} +3 -3
  78. package/dist/chunks/{detectRepository-CsJLbVEe.js → detectRepository-M6K2wc7h.js} +1 -1
  79. package/dist/chunks/{diff-DUEoNCnJ.js → diff-Cv7tX2-P.js} +1 -1
  80. package/dist/chunks/{directoryCompletion-Bgi8DBT5.js → directoryCompletion-BHyjyKAM.js} +1 -1
  81. package/dist/chunks/doctor-DeBG5SL5.js +1 -0
  82. package/dist/chunks/{entry-D1iD76SW.js → entry-CbhyIWgj.js} +5 -5
  83. package/dist/chunks/envUtils-DZ_SvEVz.js +1 -0
  84. package/dist/chunks/execFileNoThrow-BfZFnCGa.js +1 -0
  85. package/dist/chunks/execa-CBhG1doD.js +34 -0
  86. package/dist/chunks/exit-OKEV_ddw.js +1 -0
  87. package/dist/chunks/{extraUsage-BtHE-SBX.js → extraUsage-BlRL3yeb.js} +1 -1
  88. package/dist/chunks/extractMemories-jnsv-_n_.js +1 -0
  89. package/dist/chunks/fast-4I_qPJCd.js +1 -0
  90. package/dist/chunks/fast-DiolM1M7.js +1 -0
  91. package/dist/chunks/{fetchModelList-Cjow_QGy.js → fetchModelList-BRFTQim4.js} +1 -1
  92. package/dist/chunks/fetchModelList-qPKAuu4m.js +1 -0
  93. package/dist/chunks/{fileSuggestions-C96V9-Ne.js → fileSuggestions-iWVXvvLB.js} +3 -3
  94. package/dist/chunks/{fpsMetrics-wxj9GAsd.js → fpsMetrics-Ixd0J4CH.js} +1 -1
  95. package/dist/chunks/{gemini-4YGElN3H.js → gemini-BfVyavwQ.js} +2 -2
  96. package/dist/chunks/{generateSessionName-BHIKyXpz.js → generateSessionName-CGaTTXCA.js} +1 -1
  97. package/dist/chunks/genericProcessUtils-CVtQOTO2.js +12 -0
  98. package/dist/chunks/{goal-ePK_jLo3.js → goal-BidR-GFa.js} +1 -1
  99. package/dist/chunks/grok-DLcuI-U7.js +1 -0
  100. package/dist/chunks/{help-B7xRle-V.js → help-CZuvYhXj.js} +1 -1
  101. package/dist/chunks/history-BxPGftQw.js +1 -0
  102. package/dist/chunks/hooks-Bg9WIjZQ.js +1 -0
  103. package/dist/chunks/{hooks-BN5f58HY.js → hooks-ehqfAM5F.js} +2 -2
  104. package/dist/chunks/install-ACGY0vhM.js +1 -0
  105. package/dist/chunks/{instrumentation-Oj5xagJG.js → instrumentation-B9bfF2mA.js} +5 -5
  106. package/dist/chunks/{job-D9ypO0cd.js → job-Coztdn6A.js} +1 -1
  107. package/dist/chunks/keybindings-DwSdLpaE.js +1 -0
  108. package/dist/chunks/{launchLocalMemory-DliLezJw.js → launchLocalMemory-DRzfpIOB.js} +1 -1
  109. package/dist/chunks/{launchOnboarding-A-kk-7ID.js → launchOnboarding-D2zFCJf-.js} +1 -1
  110. package/dist/chunks/{loadAgentsDir-DGozQu_6.js → loadAgentsDir-DR5PVAc3.js} +557 -561
  111. package/dist/chunks/loadAgentsDir-DqAbnpB-.js +1 -0
  112. package/dist/chunks/{loadPluginHooks-BiHPKDaY.js → loadPluginHooks-BiQgGfUJ.js} +1 -1
  113. package/dist/chunks/{loader-CtoR-vO-.js → loader-6MqzNGmV.js} +1 -1
  114. package/dist/chunks/{localSearch-BU02Qsv9.js → localSearch-CzkxDuOR.js} +1 -1
  115. package/dist/chunks/localSearch-DW3JT2MA.js +1 -0
  116. package/dist/chunks/lockfile-D_9vif6E.js +1 -0
  117. package/dist/chunks/{log-DoSpAwRP.js → log-DWZny1vM.js} +1 -1
  118. package/dist/chunks/{logoUtils-DLd6JKqW.js → logoUtils-DR5T0pr3.js} +1 -1
  119. package/dist/chunks/{magicDocs-Bj8LYrN2.js → magicDocs-BwBxjfLo.js} +2 -2
  120. package/dist/chunks/main-Ryi27wYq.js +345 -0
  121. package/dist/chunks/managedEnv-DCEJh3z3.js +1 -0
  122. package/dist/chunks/managedEnv-Do9fgLpk.js +1 -0
  123. package/dist/chunks/managedEnvConstants-CWcT7nYr.js +1 -0
  124. package/dist/chunks/mcp-BCpnF6wD.js +1 -0
  125. package/dist/chunks/mcp-CJ6SDJEK.js +6 -0
  126. package/dist/chunks/mcp-CZBTxbhu.js +2 -0
  127. package/dist/chunks/memory-BQO6Y0ak.js +1 -0
  128. package/dist/chunks/{modalContext-DDZdU1J8.js → modalContext-CBE8xuck.js} +1 -1
  129. package/dist/chunks/{mode-CBKawxnD.js → mode-wq70cR44.js} +1 -1
  130. package/dist/chunks/model-D42epddJ.js +1 -0
  131. package/dist/chunks/{model-DwbqvCY2.js → model-DVk9-2dk.js} +1 -1
  132. package/dist/chunks/{modelOptions-CXBfKFXA.js → modelOptions-beLgXORr.js} +1 -1
  133. package/dist/chunks/nativeInstaller-ChGSz1lb.js +1 -0
  134. package/dist/chunks/{notifications-ql0eSo0Y.js → notifications-dGBuNvFj.js} +1 -1
  135. package/dist/chunks/{onChangeAppState-D85b33R5.js → onChangeAppState-B4K-rSaF.js} +1 -1
  136. package/dist/chunks/openai-DAwnAV9K.js +2 -0
  137. package/dist/chunks/{overlayContext-CLjlCFBl.js → overlayContext-B6i_6y_0.js} +1 -1
  138. package/dist/chunks/{panel-DMZkOEiU.js → panel-C0CF3noE.js} +1 -1
  139. package/dist/chunks/parser-BZt0VFd_.js +1 -0
  140. package/dist/chunks/{parser-UqADrvxF.js → parser-DThLwgdM.js} +1 -1
  141. package/dist/chunks/{partition-CwxTlmMd.js → partition-BRQHofxD.js} +1 -1
  142. package/dist/chunks/{pasteStore-ovtxMVR5.js → pasteStore-BmehVo5j.js} +1 -1
  143. package/dist/chunks/{permissions-CgsvWOk_.js → permissions-DkfWKN-B.js} +3 -3
  144. package/dist/chunks/pidLock-YvAaIrIY.js +3 -0
  145. package/dist/chunks/plan-B6U3ioer.js +1 -0
  146. package/dist/chunks/{platform-DsMIk3eq.js → platform-Vl9IynC3.js} +1 -1
  147. package/dist/chunks/plugin-CTA2_-F7.js +17 -0
  148. package/dist/chunks/{pluginAutoupdate-DQqYDPVg.js → pluginAutoupdate-Dy5W3HWE.js} +1 -1
  149. package/dist/chunks/{pluginBlocklist-BAr9WTup.js → pluginBlocklist-DAoUENwc.js} +1 -1
  150. package/dist/chunks/pluginCliCommands-CaHnj0C_.js +1 -0
  151. package/dist/chunks/{pluginFlagging-BO_3qjfs.js → pluginFlagging-BCj9LJP3.js} +1 -1
  152. package/dist/chunks/pluginOperations-ClXNOOG6.js +2 -0
  153. package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +1 -0
  154. package/dist/chunks/{pluginStartupCheck-BX6cv-vs.js → pluginStartupCheck-U8_xk25t.js} +1 -1
  155. package/dist/chunks/{plugins-9crasx2V.js → plugins-D7zyI9c4.js} +4 -4
  156. package/dist/chunks/{poller-CpLBoB-N.js → poller-BeyVwHAf.js} +1 -1
  157. package/dist/chunks/poorMode-DtzWNhsY.js +1 -0
  158. package/dist/chunks/poorMode-Ocff_UT1.js +1 -0
  159. package/dist/chunks/print-BzljdXem.js +13 -0
  160. package/dist/chunks/processBashCommand-RUkmyAl4.js +1 -0
  161. package/dist/chunks/processSlashCommand-DRLO-jNV.js +5 -0
  162. package/dist/chunks/{projectContext-5fmRr6Sd.js → projectContext-COeHKDrk.js} +1 -1
  163. package/dist/chunks/{projectContext-DhtjLv3k.js → projectContext-QN5U3Ggr.js} +1 -1
  164. package/dist/chunks/{projectOnboardingState--L3BKjOE.js → projectOnboardingState-KqcpRXls.js} +1 -1
  165. package/dist/chunks/{prompt-DzO1um1h.js → prompt-CTByhpUI.js} +20 -20
  166. package/dist/chunks/prompt-DTpfW6yP.js +1 -0
  167. package/dist/chunks/prompt-D__eHY_5.js +1 -0
  168. package/dist/chunks/promptEditor-CpUFgGzc.js +4 -0
  169. package/dist/chunks/{protocolHandler-BWgH1jaF.js → protocolHandler-BQSLVGnG.js} +2 -2
  170. package/dist/chunks/{proxy-BjkGlmBu.js → proxy-BtWuysHM.js} +2 -2
  171. package/dist/chunks/{reconciler-CVMmAaCy.js → reconciler-D6BUq8WB.js} +1 -1
  172. package/dist/chunks/refresh-B4pqFp12.js +1 -0
  173. package/dist/chunks/reject-C6IvUvBt.js +1 -0
  174. package/dist/chunks/{reload-plugins-DeyJTx4s.js → reload-plugins-DXQqk7q6.js} +1 -1
  175. package/dist/chunks/rename-D4XBmTBI.js +1 -0
  176. package/dist/chunks/{renderOptions-DRS2EslG.js → renderOptions-DkP98P_d.js} +1 -1
  177. package/dist/chunks/{resume-N4O5YI-S.js → resume-DzIev0JI.js} +2 -2
  178. package/dist/chunks/ripgrep-CYP26Fhg.js +1 -0
  179. package/dist/chunks/ripgrep-D1f1pbCz.js +5 -0
  180. package/dist/chunks/{runtimeObserver-DMSzdFWt.js → runtimeObserver-BPqlbu0B.js} +4 -4
  181. package/dist/chunks/{runtimeObserver-C0CJvA3q.js → runtimeObserver-BUHs3qjs.js} +1 -1
  182. package/dist/chunks/sandbox-adapter-CumL75tU.js +1 -0
  183. package/dist/chunks/{sandbox-toggle-Tbbaw18C.js → sandbox-toggle-CTtET6Xq.js} +1 -1
  184. package/dist/chunks/searchExtraTools-BMCU2zEf.js +1 -0
  185. package/dist/chunks/{select-Fq6g2Ejk.js → select-FrwoTzuc.js} +1 -1
  186. package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +1 -0
  187. package/dist/chunks/{sessionObserver-CRie77tp.js → sessionObserver-B6xzxckA.js} +2 -2
  188. package/dist/chunks/sessionObserver-CBrM4opL.js +1 -0
  189. package/dist/chunks/sessionStorage-C1EAxDWG.js +1 -0
  190. package/dist/chunks/sessionTracing-UFK96PxT.js +11 -0
  191. package/dist/chunks/settings-BK6gCko-.js +1 -0
  192. package/dist/chunks/settings-YIDksG5Z.js +24 -0
  193. package/dist/chunks/setup-BBvZyrfz.js +3 -0
  194. package/dist/chunks/{shadowedRuleDetection-CTnYVrmP.js → shadowedRuleDetection-D6R2OeoH.js} +1 -1
  195. package/dist/chunks/{sideQuestion-Cl8m2qYx.js → sideQuestion-5jcbOMsR.js} +3 -3
  196. package/dist/chunks/{sinks-CiupmfTg.js → sinks-B-kFqjjd.js} +1 -1
  197. package/dist/chunks/sinks-DB_D4lmu.js +1 -0
  198. package/dist/chunks/skillChangeDetector-103-nEle.js +1 -0
  199. package/dist/chunks/{skillGapStore-es3K-aYe.js → skillGapStore-DOz1KCqo.js} +2 -2
  200. package/dist/chunks/{skillLifecycle-BcgoOQBk.js → skillLifecycle-D9NkIwFQ.js} +2 -2
  201. package/dist/chunks/{skillSearchPanel-CuDDb1L-.js → skillSearchPanel-DFiSZaJ4.js} +2 -2
  202. package/dist/chunks/skills-DgeLr52a.js +1 -0
  203. package/dist/chunks/sleep-BbWr_FL1.js +1 -0
  204. package/dist/chunks/{src-9vmGsuSI.js → src-Cy5_qH26.js} +1 -1
  205. package/dist/chunks/{src-DL3w8VPk.js → src-WZ94ZKI3.js} +4 -4
  206. package/dist/chunks/{startupProfiler-DF0AjiDf.js → startupProfiler-DIM_Ihyp.js} +2 -2
  207. package/dist/chunks/startupProfiler-FpGsKWYk.js +1 -0
  208. package/dist/chunks/{state-BQ4BEGin.js → state-CXY-q5gr.js} +1 -1
  209. package/dist/chunks/state-DXt6rahM.js +1 -0
  210. package/dist/chunks/{staticRender-BVWx0IM1.js → staticRender-RHUIg5ln.js} +1 -1
  211. package/dist/chunks/status-CKLecQZV.js +1 -0
  212. package/dist/chunks/{statusNoticeHelpers-BfmIub5L.js → statusNoticeHelpers-DI45AH-c.js} +1 -1
  213. package/dist/chunks/stringUtils-D_xPrwGQ.js +4 -0
  214. package/dist/chunks/switcher-D2Z2ZNQ0.js +1 -0
  215. package/dist/chunks/switcher-DhZCaAun.js +1 -0
  216. package/dist/chunks/{tasks-B6gYXxOx.js → tasks-6suPhqsK.js} +1 -1
  217. package/dist/chunks/{templateJobs-BW6TaqEC.js → templateJobs-BKVEWCsb.js} +1 -1
  218. package/dist/chunks/{terminalSetup-C-g9Xvj3.js → terminalSetup-7PUR4hfo.js} +1 -1
  219. package/dist/chunks/{terminalSetup-BgIXFBpd.js → terminalSetup-Cqy5_PhJ.js} +4 -4
  220. package/dist/chunks/{theme-9AZceq_m.js → theme-B-HG2PUs.js} +1 -1
  221. package/dist/chunks/tipRegistry-BR_lSGRw.js +2 -0
  222. package/dist/chunks/{toolEventObserver-DTuJcREC.js → toolEventObserver-BY3QVnr6.js} +1 -1
  223. package/dist/chunks/toolPool-BcwIF8Q_.js +1 -0
  224. package/dist/chunks/{types-97nL3naE.js → types-CD25a50S.js} +1 -1
  225. package/dist/chunks/udsClient-CCxgLiZy.js +1 -0
  226. package/dist/chunks/urlHandler-BNsQKqba.js +1 -0
  227. package/dist/chunks/{use-select-navigation-BStVRvcX.js → use-select-navigation-CW5alA9r.js} +1 -1
  228. package/dist/chunks/{useDoublePress-C9xxQzh1.js → useDoublePress-DQBLKyzJ.js} +1 -1
  229. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DWRFdFoU.js → useExitOnCtrlCDWithKeybindings-BgJrnuDl.js} +1 -1
  230. package/dist/chunks/useMainLoopModel-BVgJo4hN.js +1 -0
  231. package/dist/chunks/useManagePlugins-CrWjzESW.js +1 -0
  232. package/dist/chunks/useMergedTools-r6GQq5mI.js +1 -0
  233. package/dist/chunks/{useSearchInput-B_mY9wBq.js → useSearchInput-BITV_Txn.js} +1 -1
  234. package/dist/chunks/{useSettingsErrors-CM7tThcp.js → useSettingsErrors-CO0fTNzn.js} +1 -1
  235. package/dist/chunks/{util-Bb2S6g9N.js → util-_zo3I1y8.js} +1 -1
  236. package/dist/chunks/validatePlugin-DFGdRhA-.js +1 -0
  237. package/dist/chunks/{vim-Dpnhgoz_.js → vim-qgMS88ss.js} +1 -1
  238. package/dist/chunks/worktree-CR_M6Qfy.js +1 -0
  239. package/dist/cli.js +1 -1
  240. package/package.json +1 -1
  241. package/scripts/postinstall.cjs +16 -16
  242. package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +0 -1
  243. package/dist/chunks/App-B8q8PV77.js +0 -1
  244. package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +0 -2
  245. package/dist/chunks/CustomSelect-BvTftqEH.js +0 -1
  246. package/dist/chunks/DiffDialog-v5r8cBKW.js +0 -6
  247. package/dist/chunks/Doctor-DKpBnbuI.js +0 -1
  248. package/dist/chunks/Doctor-uvO6NM5m.js +0 -3
  249. package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +0 -1
  250. package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +0 -1
  251. package/dist/chunks/MCPToolListView-De1W4jpj.js +0 -1
  252. package/dist/chunks/MessageSelector-DW_itlX-.js +0 -3
  253. package/dist/chunks/Messages-BFsCpACq.js +0 -10
  254. package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +0 -1
  255. package/dist/chunks/QueryEngine-egz5mbaW.js +0 -1
  256. package/dist/chunks/REPL-D27CE4WN.js +0 -124
  257. package/dist/chunks/REPL-e8wAT1wN.js +0 -1
  258. package/dist/chunks/ResumeConversation-CWA27Lke.js +0 -1
  259. package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +0 -1
  260. package/dist/chunks/Settings-axHLvYIy.js +0 -3
  261. package/dist/chunks/Spinner-VjwI7m_g.js +0 -1
  262. package/dist/chunks/ThemePicker-CtQYHmOr.js +0 -1
  263. package/dist/chunks/agents-DEnmg8Xo.js +0 -101
  264. package/dist/chunks/allErrors-C9kx6lnk.js +0 -1
  265. package/dist/chunks/appleTerminalBackup-CT7g8yOs.js +0 -1
  266. package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +0 -1
  267. package/dist/chunks/caches-DWjwe-DN.js +0 -1
  268. package/dist/chunks/caches-VLs1tQkZ.js +0 -1
  269. package/dist/chunks/client-CO_6v4yl.js +0 -1
  270. package/dist/chunks/client-DO-O441l.js +0 -1
  271. package/dist/chunks/commands-Cn1P7Tms.js +0 -1
  272. package/dist/chunks/compact-DGUhdXcc.js +0 -2
  273. package/dist/chunks/config-C7GTF4iI.js +0 -1
  274. package/dist/chunks/config-CWPHVTic.js +0 -3
  275. package/dist/chunks/config-Cox0TM2Z.js +0 -1
  276. package/dist/chunks/context-noninteractive--OuiZUzL.js +0 -1
  277. package/dist/chunks/conversation--y8PD2Lk.js +0 -1
  278. package/dist/chunks/conversation-BIPJEOwO.js +0 -1
  279. package/dist/chunks/conversationRecovery-BBJzrA0g.js +0 -1
  280. package/dist/chunks/crossProjectResume-CwZb3cEU.js +0 -40
  281. package/dist/chunks/cwd-BZMp3CZ8.js +0 -1
  282. package/dist/chunks/doctor-4NiE46ZG.js +0 -1
  283. package/dist/chunks/envUtils-DfkgIdYf.js +0 -1
  284. package/dist/chunks/execFileNoThrow-BgRsj_SW.js +0 -34
  285. package/dist/chunks/exit-CrsQsjbx.js +0 -1
  286. package/dist/chunks/extractMemories-kogJzpit.js +0 -1
  287. package/dist/chunks/fast-CuNVwVTr.js +0 -1
  288. package/dist/chunks/fast-RlFnwGRV.js +0 -1
  289. package/dist/chunks/fetchModelList-uiCPVqbJ.js +0 -1
  290. package/dist/chunks/genericProcessUtils-BNlr-QxM.js +0 -23
  291. package/dist/chunks/grok-DnmklTrm.js +0 -1
  292. package/dist/chunks/history-kOw3CcLT.js +0 -1
  293. package/dist/chunks/hooks-BDY1jMbS.js +0 -1
  294. package/dist/chunks/install-DrMiHa2Q.js +0 -1
  295. package/dist/chunks/keybindings-BRRN_eap.js +0 -1
  296. package/dist/chunks/loadAgentsDir-CJAK4kif.js +0 -1
  297. package/dist/chunks/localSearch-DyaB2Rm-.js +0 -1
  298. package/dist/chunks/main-B_09WbaG.js +0 -345
  299. package/dist/chunks/managedEnv-BJGfe3m7.js +0 -1
  300. package/dist/chunks/managedEnv-CIWJsuty.js +0 -1
  301. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +0 -1
  302. package/dist/chunks/mcp-1nBvcNxw.js +0 -1
  303. package/dist/chunks/mcp-7DXpXMdT.js +0 -2
  304. package/dist/chunks/mcp-kw99WVi2.js +0 -6
  305. package/dist/chunks/memory-CjWvzR_9.js +0 -1
  306. package/dist/chunks/model-DpZaKZMb.js +0 -1
  307. package/dist/chunks/nativeInstaller-SmPeEisk.js +0 -1
  308. package/dist/chunks/openai-D_j7-KW6.js +0 -2
  309. package/dist/chunks/parser-2usBI4G-.js +0 -1
  310. package/dist/chunks/pidLock-B-SW3Nhx.js +0 -3
  311. package/dist/chunks/plan-BJrWtXEh.js +0 -1
  312. package/dist/chunks/plugin-D97VJAxW.js +0 -17
  313. package/dist/chunks/pluginCliCommands-CUGPc853.js +0 -1
  314. package/dist/chunks/pluginOperations-rTrzu6Vg.js +0 -2
  315. package/dist/chunks/pluginStartupCheck-BRHnXlym.js +0 -1
  316. package/dist/chunks/poorMode-BaS0DBUO.js +0 -1
  317. package/dist/chunks/poorMode-DmvzFAz_.js +0 -1
  318. package/dist/chunks/print-Bi3xVdB3.js +0 -13
  319. package/dist/chunks/processBashCommand-BBtnCx-7.js +0 -1
  320. package/dist/chunks/processSlashCommand-jzF0GmLO.js +0 -5
  321. package/dist/chunks/prompt-CmijKW7G.js +0 -1
  322. package/dist/chunks/prompt-DYBx_D0H.js +0 -1
  323. package/dist/chunks/promptEditor-B6S_Rzcu.js +0 -4
  324. package/dist/chunks/refresh-CAGv8BJY.js +0 -1
  325. package/dist/chunks/reject-CEUkoI2G.js +0 -1
  326. package/dist/chunks/rename-DPFis9g_.js +0 -1
  327. package/dist/chunks/ripgrep-3omwGI-l.js +0 -1
  328. package/dist/chunks/ripgrep-CgQrN3XX.js +0 -5
  329. package/dist/chunks/sandbox-adapter-D15jjHJR.js +0 -1
  330. package/dist/chunks/searchExtraTools-BoFc__Eg.js +0 -1
  331. package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +0 -1
  332. package/dist/chunks/sessionObserver-PcaVCVkX.js +0 -1
  333. package/dist/chunks/sessionStorage-Dkf7FRgA.js +0 -1
  334. package/dist/chunks/sessionTracing-D7rekMdW.js +0 -11
  335. package/dist/chunks/settings-8fwIkMDV.js +0 -1
  336. package/dist/chunks/settings-CodSADx8.js +0 -24
  337. package/dist/chunks/setup-DBiIrXrh.js +0 -3
  338. package/dist/chunks/sinks-DH83d_kd.js +0 -1
  339. package/dist/chunks/skillChangeDetector-BrrZaFkT.js +0 -1
  340. package/dist/chunks/skills-BRtgqnLz.js +0 -1
  341. package/dist/chunks/startupProfiler-D1NRu2nj.js +0 -1
  342. package/dist/chunks/state-D3gvDiu8.js +0 -1
  343. package/dist/chunks/status-WXA16wIM.js +0 -1
  344. package/dist/chunks/stringUtils-Bu_lJH5c.js +0 -4
  345. package/dist/chunks/switcher-5gilU5_R.js +0 -1
  346. package/dist/chunks/switcher-DMfuKuw_.js +0 -1
  347. package/dist/chunks/tipRegistry-DtO1H_Wo.js +0 -2
  348. package/dist/chunks/toolPool-DHS8jWaL.js +0 -1
  349. package/dist/chunks/udsClient-CmYHFiBD.js +0 -1
  350. package/dist/chunks/urlHandler-DLz3FZm1.js +0 -1
  351. package/dist/chunks/useMainLoopModel-DSN5HjV1.js +0 -1
  352. package/dist/chunks/useManagePlugins-ntnOf5OU.js +0 -1
  353. package/dist/chunks/useMergedTools-C5Yns9Ij.js +0 -1
  354. package/dist/chunks/validatePlugin-D8WQ5z4W.js +0 -1
  355. package/dist/chunks/worktree-a5oOPSYl.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,a as o,j as s,n as c,r as l,t as u,x as d}from"./src-DL3w8VPk.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as p,T as m}from"./state-BQ4BEGin.js";import{AC as h,Cb as g,DC as _,OC as v,kC as y}from"./loadAgentsDir-DGozQu_6.js";import{d as b,h as x,o as S}from"./settings-CodSADx8.js";import{i as C,n as w}from"./platform-DsMIk3eq.js";import{n as T,t as E}from"./select-Fq6g2Ejk.js";import{relative as D}from"path";function O(){let e=_.isSandboxingEnabled(),t=_.checkDependencies(),n=t.warnings.length>0?(0,k.jsx)(r,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,k.jsx)(a,{dimColor:!0,children:e},t))}):null;if(!e)return(0,k.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,k.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let i=_.getFsReadConfig(),o=_.getFsWriteConfig(),s=_.getNetworkRestrictionConfig(),c=_.getAllowUnixSockets(),l=_.getExcludedCommands(),u=_.getLinuxGlobPatternWarnings();return(0,k.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,k.jsxs)(r,{flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,k.jsx)(a,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,k.jsxs)(a,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),o.allowOnly.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,k.jsxs)(a,{dimColor:!0,children:[`Allowed: `,o.allowOnly.join(`, `)]}),o.denyWithinAllow.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Denied within allowed: `,o.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsxs)(a,{bold:!0,color:`permission`,children:[`Network Restrictions`,h()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,k.jsx)(a,{dimColor:!0,children:c.join(`, `)})]}),u.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,k.jsxs)(a,{dimColor:!0,children:[`The following patterns will be ignored: `,u.slice(0,3).join(`, `),u.length>3&&` (${u.length-3} more)`]})]}),n]})}var k,A=e((()=>{u(),y(),k=f()}));function j({depCheck:e}){let t=w()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),i=e.errors.some(e=>e.includes(`bwrap`)),o=e.errors.some(e=>e.includes(`socat`)),s=e.warnings.length>0,c=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,M.jsxs)(r,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,M.jsx)(r,{flexDirection:`column`,children:(0,M.jsxs)(a,{children:[`seatbelt: `,(0,M.jsx)(a,{color:`success`,children:`built-in (macOS)`})]})}),(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`ripgrep (rg): `,n?(0,M.jsx)(a,{color:`error`,children:`not found`}):(0,M.jsx)(a,{color:`success`,children:`found`})]}),n&&(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`bubblewrap (bwrap):`,` `,i?(0,M.jsx)(a,{color:`error`,children:`not installed`}):(0,M.jsx)(a,{color:`success`,children:`installed`})]}),i&&(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`socat: `,o?(0,M.jsx)(a,{color:`error`,children:`not installed`}):(0,M.jsx)(a,{color:`success`,children:`installed`})]}),o&&(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`seccomp filter:`,` `,s?(0,M.jsx)(a,{color:`warning`,children:`not installed`}):(0,M.jsx)(a,{color:`success`,children:`installed`}),s&&(0,M.jsx)(a,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),s&&(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,M.jsxs)(a,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),c.map(e=>(0,M.jsx)(a,{color:`error`,children:e},e))]})}var M,N=e((()=>{u(),C(),M=f()}));function P({onComplete:e}){let t=_.isSandboxingEnabled(),n=_.areSandboxSettingsLockedByPolicy(),i=_.areUnsandboxedCommandsAllowed();return t?n?(0,I.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(a,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,I.jsx)(r,{marginTop:1,children:(0,I.jsxs)(a,{dimColor:!0,children:[`Current setting: `,i?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,I.jsx)(F,{onComplete:e,currentMode:i?`open`:`closed`}):(0,I.jsx)(r,{flexDirection:`column`,paddingY:1,children:(0,I.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function F({onComplete:e,currentMode:t}){let[c]=n(),{headerFocused:l,focusHeader:u}=o(),d=s(`success`,c)(`(current)`),f=[{label:t===`open`?`Allow unsandboxed fallback ${d}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${d}`:`Strict sandbox mode`,value:`closed`}];async function p(t){let n=t;await _.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,I.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(r,{marginBottom:1,children:(0,I.jsx)(a,{bold:!0,children:`Configure Overrides:`})}),(0,I.jsx)(E,{options:f,onChange:p,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:u,isDisabled:l}),(0,I.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,I.jsxs)(a,{dimColor:!0,children:[(0,I.jsx)(a,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Work Mate can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,I.jsxs)(a,{dimColor:!0,children:[(0,I.jsx)(a,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,I.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,I.jsx)(i,{url:`https://code.workmate.com/docs/en/sandboxing#configure-sandboxing`,children:`code.workmate.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var I,L=e((()=>{u(),y(),T(),I=f()}));function R({onComplete:e,depCheck:r}){let[i]=n(),a=_.isSandboxingEnabled(),o=_.isAutoAllowBashIfSandboxedEnabled(),u=r.warnings.length>0,f=b().sandbox?.network?.allowAllUnixSockets,p=u&&!f,m=a?o?`auto-allow`:`regular`:`disabled`,h=s(`success`,i)(`(current)`),g=[{label:m===`auto-allow`?`Sandbox BashTool, with auto-allow ${h}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:m===`regular`?`Sandbox BashTool, with regular permissions ${h}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:m===`disabled`?`No Sandbox ${h}`:`No Sandbox`,value:`disabled`}];async function v(t){switch(t){case`auto-allow`:await _.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await _.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await _.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}t({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,B.jsx)(c,{title:`Mode`,children:(0,B.jsx)(z,{showSocketWarning:p,options:g,onSelect:v,onComplete:e})},`mode`),x=(0,B.jsx)(c,{title:`Overrides`,children:(0,B.jsx)(P,{onComplete:e})},`overrides`),S=(0,B.jsx)(c,{title:`Config`,children:(0,B.jsx)(O,{})},`config`);return(0,B.jsx)(d,{color:`permission`,children:(0,B.jsx)(l,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:r.errors.length>0?[(0,B.jsx)(c,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:r})},`dependencies`)]:[y,...u?[(0,B.jsx)(c,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:r})},`dependencies`)]:[],x,S]})})}function z({showSocketWarning:e,options:t,onSelect:n,onComplete:s}){let{headerFocused:c,focusHeader:l}=o();return(0,B.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[e&&(0,B.jsx)(r,{marginBottom:1,children:(0,B.jsx)(a,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,B.jsx)(r,{marginBottom:1,children:(0,B.jsx)(a,{bold:!0,children:`Configure Mode:`})}),(0,B.jsx)(E,{options:t,onChange:n,onCancel:()=>s(void 0,{display:`skip`}),onUpFromFirstItem:l,isDisabled:c}),(0,B.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,B.jsxs)(a,{dimColor:!0,children:[(0,B.jsx)(a,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,B.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,B.jsx)(i,{url:`https://code.workmate.com/docs/en/sandboxing`,children:`code.workmate.com/docs/en/sandboxing`})]})]})]})}var B,V=e((()=>{u(),g(),y(),x(),T(),A(),N(),L(),B=f()}));async function H(e,t,n){let r=b().theme||`light`,i=w();if(!_.isSupportedPlatform()){let t=i===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(s(`error`,r)(t)),null}let a=_.checkDependencies();if(!_.isPlatformInEnabledList())return e(s(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(_.areSandboxSettingsLockedByPolicy())return e(s(`error`,r)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let o=n?.trim()||``;if(!o)return(0,U.jsx)(R,{onComplete:e,depCheck:a});if(o){let t=o.split(` `)[0];if(t===`exclude`){let t=o.slice(8).trim();if(!t)return e(s(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);v(n);let i=S(`localSettings`),a=i?D(m(),i):`.workmate/settings.local.json`;return e(s(`success`,r)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(s(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var U;e((()=>{p(),V(),u(),C(),y(),x(),U=f()}))();export{H as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,a as o,j as s,n as c,r as l,t as u,x as d}from"./src-WZ94ZKI3.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as p,T as m}from"./state-CXY-q5gr.js";import{aC as h,cC as g,oC as _,sC as v,tb as y}from"./loadAgentsDir-DR5PVAc3.js";import{d as b,m as x,o as S}from"./settings-YIDksG5Z.js";import{i as C,n as w}from"./platform-Vl9IynC3.js";import{n as T,t as E}from"./select-FrwoTzuc.js";import{relative as D}from"path";function O(){let e=h.isSandboxingEnabled(),t=h.checkDependencies(),n=t.warnings.length>0?(0,k.jsx)(r,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,k.jsx)(a,{dimColor:!0,children:e},t))}):null;if(!e)return(0,k.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,k.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let i=h.getFsReadConfig(),o=h.getFsWriteConfig(),s=h.getNetworkRestrictionConfig(),c=h.getAllowUnixSockets(),l=h.getExcludedCommands(),u=h.getLinuxGlobPatternWarnings();return(0,k.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,k.jsxs)(r,{flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,k.jsx)(a,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,k.jsxs)(a,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),o.allowOnly.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,k.jsxs)(a,{dimColor:!0,children:[`Allowed: `,o.allowOnly.join(`, `)]}),o.denyWithinAllow.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Denied within allowed: `,o.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsxs)(a,{bold:!0,color:`permission`,children:[`Network Restrictions`,g()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,k.jsxs)(a,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,k.jsx)(a,{dimColor:!0,children:c.join(`, `)})]}),u.length>0&&(0,k.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,k.jsx)(a,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,k.jsxs)(a,{dimColor:!0,children:[`The following patterns will be ignored: `,u.slice(0,3).join(`, `),u.length>3&&` (${u.length-3} more)`]})]}),n]})}var k,A=e((()=>{u(),v(),k=f()}));function j({depCheck:e}){let t=w()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),i=e.errors.some(e=>e.includes(`bwrap`)),o=e.errors.some(e=>e.includes(`socat`)),s=e.warnings.length>0,c=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,M.jsxs)(r,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,M.jsx)(r,{flexDirection:`column`,children:(0,M.jsxs)(a,{children:[`seatbelt: `,(0,M.jsx)(a,{color:`success`,children:`built-in (macOS)`})]})}),(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`ripgrep (rg): `,n?(0,M.jsx)(a,{color:`error`,children:`not found`}):(0,M.jsx)(a,{color:`success`,children:`found`})]}),n&&(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`bubblewrap (bwrap):`,` `,i?(0,M.jsx)(a,{color:`error`,children:`not installed`}):(0,M.jsx)(a,{color:`success`,children:`installed`})]}),i&&(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`socat: `,o?(0,M.jsx)(a,{color:`error`,children:`not installed`}):(0,M.jsx)(a,{color:`success`,children:`installed`})]}),o&&(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{children:[`seccomp filter:`,` `,s?(0,M.jsx)(a,{color:`warning`,children:`not installed`}):(0,M.jsx)(a,{color:`success`,children:`installed`}),s&&(0,M.jsx)(a,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),s&&(0,M.jsxs)(r,{flexDirection:`column`,children:[(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,M.jsxs)(a,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,M.jsxs)(a,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),c.map(e=>(0,M.jsx)(a,{color:`error`,children:e},e))]})}var M,N=e((()=>{u(),C(),M=f()}));function P({onComplete:e}){let t=h.isSandboxingEnabled(),n=h.areSandboxSettingsLockedByPolicy(),i=h.areUnsandboxedCommandsAllowed();return t?n?(0,I.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(a,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,I.jsx)(r,{marginTop:1,children:(0,I.jsxs)(a,{dimColor:!0,children:[`Current setting: `,i?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,I.jsx)(F,{onComplete:e,currentMode:i?`open`:`closed`}):(0,I.jsx)(r,{flexDirection:`column`,paddingY:1,children:(0,I.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function F({onComplete:e,currentMode:t}){let[c]=n(),{headerFocused:l,focusHeader:u}=o(),d=s(`success`,c)(`(current)`),f=[{label:t===`open`?`Allow unsandboxed fallback ${d}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${d}`:`Strict sandbox mode`,value:`closed`}];async function p(t){let n=t;await h.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,I.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,I.jsx)(r,{marginBottom:1,children:(0,I.jsx)(a,{bold:!0,children:`Configure Overrides:`})}),(0,I.jsx)(E,{options:f,onChange:p,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:u,isDisabled:l}),(0,I.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,I.jsxs)(a,{dimColor:!0,children:[(0,I.jsx)(a,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Work Mate can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,I.jsxs)(a,{dimColor:!0,children:[(0,I.jsx)(a,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,I.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,I.jsx)(i,{url:`https://code.workmate.com/docs/en/sandboxing#configure-sandboxing`,children:`code.workmate.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var I,L=e((()=>{u(),v(),T(),I=f()}));function R({onComplete:e,depCheck:r}){let[i]=n(),a=h.isSandboxingEnabled(),o=h.isAutoAllowBashIfSandboxedEnabled(),u=r.warnings.length>0,f=b().sandbox?.network?.allowAllUnixSockets,p=u&&!f,m=a?o?`auto-allow`:`regular`:`disabled`,g=s(`success`,i)(`(current)`),_=[{label:m===`auto-allow`?`Sandbox BashTool, with auto-allow ${g}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:m===`regular`?`Sandbox BashTool, with regular permissions ${g}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:m===`disabled`?`No Sandbox ${g}`:`No Sandbox`,value:`disabled`}];async function v(t){switch(t){case`auto-allow`:await h.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await h.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await h.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}t({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,B.jsx)(c,{title:`Mode`,children:(0,B.jsx)(z,{showSocketWarning:p,options:_,onSelect:v,onComplete:e})},`mode`),x=(0,B.jsx)(c,{title:`Overrides`,children:(0,B.jsx)(P,{onComplete:e})},`overrides`),S=(0,B.jsx)(c,{title:`Config`,children:(0,B.jsx)(O,{})},`config`);return(0,B.jsx)(d,{color:`permission`,children:(0,B.jsx)(l,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:r.errors.length>0?[(0,B.jsx)(c,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:r})},`dependencies`)]:[y,...u?[(0,B.jsx)(c,{title:`Dependencies`,children:(0,B.jsx)(j,{depCheck:r})},`dependencies`)]:[],x,S]})})}function z({showSocketWarning:e,options:t,onSelect:n,onComplete:s}){let{headerFocused:c,focusHeader:l}=o();return(0,B.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[e&&(0,B.jsx)(r,{marginBottom:1,children:(0,B.jsx)(a,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,B.jsx)(r,{marginBottom:1,children:(0,B.jsx)(a,{bold:!0,children:`Configure Mode:`})}),(0,B.jsx)(E,{options:t,onChange:n,onCancel:()=>s(void 0,{display:`skip`}),onUpFromFirstItem:l,isDisabled:c}),(0,B.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,B.jsxs)(a,{dimColor:!0,children:[(0,B.jsx)(a,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,B.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,B.jsx)(i,{url:`https://code.workmate.com/docs/en/sandboxing`,children:`code.workmate.com/docs/en/sandboxing`})]})]})]})}var B,V=e((()=>{u(),y(),v(),x(),T(),A(),N(),L(),B=f()}));async function H(e,t,n){let r=b().theme||`light`,i=w();if(!h.isSupportedPlatform()){let t=i===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(s(`error`,r)(t)),null}let a=h.checkDependencies();if(!h.isPlatformInEnabledList())return e(s(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(h.areSandboxSettingsLockedByPolicy())return e(s(`error`,r)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let o=n?.trim()||``;if(!o)return(0,U.jsx)(R,{onComplete:e,depCheck:a});if(o){let t=o.split(` `)[0];if(t===`exclude`){let t=o.slice(8).trim();if(!t)return e(s(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);_(n);let i=S(`localSettings`),a=i?D(m(),i):`.workmate/settings.local.json`;return e(s(`success`,r)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(s(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var U;e((()=>{p(),V(),u(),C(),v(),x(),U=f()}))();export{H as call};
@@ -0,0 +1 @@
1
+ import{S_ as e,b_ as t}from"./loadAgentsDir-DR5PVAc3.js";t();export{e as isSearchExtraToolsEnabled};
@@ -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{Ft as i,G as a,Gr as o,Gt as s,I as c,P as l,ai as u,hn as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Cb as m}from"./loadAgentsDir-DGozQu_6.js";import{Hn as h,Vn as g}from"./settings-CodSADx8.js";import{c as _,o as v,s as y}from"./stringUtils-Bu_lJH5c.js";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./use-select-navigation-BStVRvcX.js";import{i as E,t as D}from"./overlayContext-CLjlCFBl.js";var O,k,A=e((()=>{O=t(u(),1),D(),f(),m(),v(),k=({isDisabled:e=!1,disableSelection:t=!1,state:n,options:r,isMultiSelect:i=!1,onUpFromFirstItem:a,onDownFromLastItem:o,onInputModeToggle:c,inputValues:l,imagesSelected:u=!1,onEnterImageSelection:f})=>{E(`select`,!!n.onCancel);let p=(0,O.useMemo)(()=>r.find(e=>e.value===n.focusedValue)?.type===`input`,[r,n.focusedValue]);s((0,O.useMemo)(()=>{let e={};return p||(e[`select:next`]=()=>{if(o){let e=r[r.length-1];if(e&&n.focusedValue===e.value){o();return}}n.focusNextOption()},e[`select:previous`]=()=>{if(a&&n.visibleFromIndex===0){let e=r[0];if(e&&n.focusedValue===e.value){a();return}}n.focusPreviousOption()},e[`select:accept`]=()=>{t!==!0&&n.focusedValue!==void 0&&r.find(e=>e.value===n.focusedValue)?.disabled!==!0&&(n.selectFocusedOption?.(),n.onChange?.(n.focusedValue))}),n.onCancel&&(e[`select:cancel`]=()=>{n.onCancel()}),e},[r,n,o,a,p,t]),{context:`Select`,isActive:!e}),d((e,s,d)=>{let p=y(e),m=r.find(e=>e.value===n.focusedValue),h=m?.type===`input`;if(s.tab&&c&&n.focusedValue!==void 0){c(n.focusedValue);return}if(h){if(u)return;if(s.downArrow&&f?.()){d.stopImmediatePropagation();return}if(s.downArrow||s.ctrl&&e===`n`){if(o){let e=r[r.length-1];if(e&&n.focusedValue===e.value){o(),d.stopImmediatePropagation();return}}n.focusNextOption(),d.stopImmediatePropagation();return}if(s.upArrow||s.ctrl&&e===`p`){if(a&&n.visibleFromIndex===0){let e=r[0];if(e&&n.focusedValue===e.value){a(),d.stopImmediatePropagation();return}}n.focusPreviousOption(),d.stopImmediatePropagation();return}return}if(s.pageDown&&n.focusNextPage(),s.pageUp&&n.focusPreviousPage(),t!==!0&&(i&&_(e)===` `&&n.focusedValue!==void 0&&m?.disabled!==!0&&(n.selectFocusedOption?.(),n.onChange?.(n.focusedValue)),t!==`numeric`&&/^[0-9]+$/.test(p))){let e=parseInt(p,10)-1;if(e>=0&&e<n.options.length){let t=n.options[e];if(t.disabled===!0)return;if(t.type===`input`){if((l?.get(t.value)??``).trim()){n.onChange?.(t.value);return}if(t.allowEmptySubmitToCancel){n.onChange?.(t.value);return}n.focusOption(t.value);return}n.onChange?.(t.value);return}}},{isActive:!e})}}));function j({visibleOptionCount:e=5,options:t,defaultValue:n,onChange:r,onCancel:i,onFocus:a,focusValue:o}){let[s,c]=(0,M.useState)(n),l=S({visibleOptionCount:e,options:t,initialFocusValue:void 0,onFocus:a,focusValue:o}),u=(0,M.useCallback)(()=>{c(l.focusedValue)},[l.focusedValue]);return{...l,value:s,selectFocusedOption:u,onChange:r,onCancel:i}}var M,N=e((()=>{M=t(u(),1),T()}));function P(e){return typeof e==`string`?e:typeof e==`number`?String(e):e?Array.isArray(e)?e.map(P).join(``):L.isValidElement(e)?P(e.props.children):``:``}function F({isDisabled:e=!1,hideIndexes:t=!1,visibleOptionCount:n=5,highlightText:a,options:s,defaultValue:u,onCancel:d,onChange:f,onFocus:p,defaultFocusValue:m,layout:h=`compact`,disableSelection:_=!1,inlineDescriptions:v=!1,onUpFromFirstItem:y,onDownFromLastItem:x,onInputModeToggle:S,onOpenEditor:C,onImagePaste:T,pastedContents:E,onRemoveImage:D}){let[O,A]=(0,L.useState)(!1),[M,N]=(0,L.useState)(0),[F,z]=(0,L.useState)(()=>{let e=new Map;return s.forEach(t=>{t.type===`input`&&t.initialValue&&e.set(t.value,t.initialValue)}),e}),B=(0,L.useRef)(new Map);(0,L.useEffect)(()=>{for(let e of s)if(e.type===`input`&&e.initialValue!==void 0){let t=B.current.get(e.value)??``,n=F.get(e.value)??``,r=e.initialValue;r!==t&&n===t&&z(t=>{let n=new Map(t);return n.set(e.value,r),n}),B.current.set(e.value,r)}},[s,F]);let V=j({visibleOptionCount:n,options:s,defaultValue:u,onChange:f,onCancel:d,onFocus:p,focusValue:m});k({isDisabled:e,disableSelection:_||(t?`numeric`:!1),state:V,options:s,isMultiSelect:!1,onUpFromFirstItem:y,onDownFromLastItem:x,onInputModeToggle:S,inputValues:F,imagesSelected:O,onEnterImageSelection:()=>{if(E&&Object.values(E).some(e=>e.type===`image`)){let e=g(Object.values(E),e=>e.type===`image`);return A(!0),N(e-1),!0}return!1}});let H={container:()=>({flexDirection:`column`}),highlightedText:()=>({bold:!0})};if(h===`expanded`){let t=V.options.length.toString().length;return(0,R.jsx)(c,{...H.container(),children:V.visibleOptions.map((n,r)=>{let o=n.index===V.visibleFromIndex,u=n.index===V.visibleToIndex-1,p=V.visibleToIndex<s.length,m=V.visibleFromIndex>0,h=V.visibleFromIndex+r+1,g=!e&&V.focusedValue===n.value,_=V.value===n.value;if(n.type===`input`){let e=F.has(n.value)?F.get(n.value):n.initialValue||``;return(0,R.jsx)(w,{option:n,isFocused:g,isSelected:_,shouldShowDownArrow:p&&u,shouldShowUpArrow:m&&o,maxIndexWidth:t,index:h,inputValue:e,onInputChange:e=>{z(t=>{let r=new Map(t);return r.set(n.value,e),r})},onSubmit:e=>{let t=E&&Object.values(E).some(e=>e.type===`image`);e.trim()||t||n.allowEmptySubmitToCancel?f?.(n.value):d?.()},onExit:d,layout:`expanded`,showLabel:v,onOpenEditor:C,resetCursorOnUpdate:n.resetCursorOnUpdate,onImagePaste:T,pastedContents:E,onRemoveImage:D,imagesSelected:O,selectedImageIndex:M,onImagesSelectedChange:A,onSelectedImageIndexChange:N},String(n.value))}let y=n.label;if(typeof n.label==`string`&&a&&n.label.includes(a)){let e=n.label,t=e.indexOf(a);y=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,t),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(t+a.length)]})}let x=n.disabled===!0,S=x?void 0:_?`success`:g?`suggestion`:void 0;return(0,R.jsxs)(c,{flexDirection:`column`,flexShrink:0,children:[(0,R.jsx)(b,{isFocused:g,isSelected:_,shouldShowDownArrow:p&&u,shouldShowUpArrow:m&&o,children:(0,R.jsx)(l,{dimColor:x,color:S,children:y})}),n.description&&(0,R.jsx)(c,{paddingLeft:2,children:(0,R.jsx)(l,{dimColor:x||n.dimDescription!==!1,color:S,children:(0,R.jsx)(i,{children:n.description})})}),(0,R.jsx)(l,{children:` `})]},String(n.value))})})}if(h===`compact-vertical`){let n=t?0:V.options.length.toString().length;return(0,R.jsx)(c,{...H.container(),children:V.visibleOptions.map((r,o)=>{let u=r.index===V.visibleFromIndex,p=r.index===V.visibleToIndex-1,m=V.visibleToIndex<s.length,h=V.visibleFromIndex>0,g=V.visibleFromIndex+o+1,_=!e&&V.focusedValue===r.value,y=V.value===r.value;if(r.type===`input`){let e=F.has(r.value)?F.get(r.value):r.initialValue||``;return(0,R.jsx)(w,{option:r,isFocused:_,isSelected:y,shouldShowDownArrow:m&&p,shouldShowUpArrow:h&&u,maxIndexWidth:n,index:g,inputValue:e,onInputChange:e=>{z(t=>{let n=new Map(t);return n.set(r.value,e),n})},onSubmit:e=>{let t=E&&Object.values(E).some(e=>e.type===`image`);e.trim()||t||r.allowEmptySubmitToCancel?f?.(r.value):d?.()},onExit:d,layout:`compact`,showLabel:v,onOpenEditor:C,resetCursorOnUpdate:r.resetCursorOnUpdate,onImagePaste:T,pastedContents:E,onRemoveImage:D,imagesSelected:O,selectedImageIndex:M,onImagesSelectedChange:A,onSelectedImageIndexChange:N},String(r.value))}let x=r.label;if(typeof r.label==`string`&&a&&r.label.includes(a)){let e=r.label,t=e.indexOf(a);x=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,t),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(t+a.length)]})}let S=r.disabled===!0;return(0,R.jsxs)(c,{flexDirection:`column`,flexShrink:0,children:[(0,R.jsxs)(b,{isFocused:_,isSelected:y,shouldShowDownArrow:m&&p,shouldShowUpArrow:h&&u,children:[!t&&(0,R.jsx)(l,{dimColor:!0,children:`${g}.`.padEnd(n+1)}),(0,R.jsx)(l,{dimColor:S,color:S?void 0:y?`success`:_?`suggestion`:void 0,children:x})]}),r.description&&(0,R.jsx)(c,{paddingLeft:t?4:n+4,children:(0,R.jsx)(l,{dimColor:S||r.dimDescription!==!1,color:S?void 0:y?`success`:_?`suggestion`:void 0,children:(0,R.jsx)(i,{children:r.description})})})]},String(r.value))})})}let U=t?0:V.options.length.toString().length,W=V.visibleOptions.some(e=>e.type===`input`),G=!v&&!W&&V.visibleOptions.some(e=>e.description),K=V.visibleOptions.map((t,n)=>{let r=t.index===V.visibleFromIndex,i=t.index===V.visibleToIndex-1,o=V.visibleToIndex<s.length,c=V.visibleFromIndex>0,u=V.visibleFromIndex+n+1,d=!e&&V.focusedValue===t.value,f=V.value===t.value,p=t.disabled===!0,m=t.label;if(typeof t.label==`string`&&a&&t.label.includes(a)){let e=t.label,n=e.indexOf(a);m=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,n),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(n+a.length)]})}return{option:t,index:u,label:m,isFocused:d,isSelected:f,isOptionDisabled:p,shouldShowDownArrow:o&&i,shouldShowUpArrow:c&&r}});if(G){let e=Math.max(...K.map(e=>{if(e.option.type===`input`)return 0;let n=P(e.option.label),r=t?0:U+2,i=e.isSelected?2:0;return 2+r+o(n)+i}));return(0,R.jsx)(c,{...H.container(),children:K.map(n=>{if(n.option.type===`input`)return null;let a=P(n.option.label),s=t?0:U+2,u=n.isSelected?2:0,d=2+s+o(a)+u,f=e-d;return(0,R.jsxs)(I,{isFocused:n.isFocused,children:[(0,R.jsxs)(c,{flexDirection:`row`,flexShrink:0,children:[n.isFocused?(0,R.jsx)(l,{color:`suggestion`,children:r.pointer}):n.shouldShowDownArrow?(0,R.jsx)(l,{dimColor:!0,children:r.arrowDown}):n.shouldShowUpArrow?(0,R.jsx)(l,{dimColor:!0,children:r.arrowUp}):(0,R.jsx)(l,{children:` `}),(0,R.jsx)(l,{children:` `}),(0,R.jsxs)(l,{dimColor:n.isOptionDisabled,color:n.isOptionDisabled?void 0:n.isSelected?`success`:n.isFocused?`suggestion`:void 0,children:[!t&&(0,R.jsx)(l,{dimColor:!0,children:`${n.index}.`.padEnd(U+2)}),n.label]}),n.isSelected&&(0,R.jsxs)(l,{color:`success`,children:[` `,r.tick]}),f>0&&(0,R.jsx)(l,{children:` `.repeat(f)})]}),(0,R.jsx)(c,{flexGrow:1,marginLeft:2,children:(0,R.jsx)(l,{wrap:`wrap`,dimColor:n.isOptionDisabled||n.option.dimDescription!==!1,color:n.isOptionDisabled?void 0:n.isSelected?`success`:n.isFocused?`suggestion`:void 0,children:(0,R.jsx)(i,{children:n.option.description||` `})})})]},String(n.option.value))})})}return(0,R.jsx)(c,{...H.container(),children:V.visibleOptions.map((n,r)=>{if(n.type===`input`){let t=F.has(n.value)?F.get(n.value):n.initialValue||``,i=n.index===V.visibleFromIndex,a=n.index===V.visibleToIndex-1,o=V.visibleToIndex<s.length,c=V.visibleFromIndex>0,l=V.visibleFromIndex+r+1;return(0,R.jsx)(w,{option:n,isFocused:!e&&V.focusedValue===n.value,isSelected:V.value===n.value,shouldShowDownArrow:o&&a,shouldShowUpArrow:c&&i,maxIndexWidth:U,index:l,inputValue:t,onInputChange:e=>{z(t=>{let r=new Map(t);return r.set(n.value,e),r})},onSubmit:e=>{let t=E&&Object.values(E).some(e=>e.type===`image`);e.trim()||t||n.allowEmptySubmitToCancel?f?.(n.value):d?.()},onExit:d,layout:`compact`,showLabel:v,onOpenEditor:C,resetCursorOnUpdate:n.resetCursorOnUpdate,onImagePaste:T,pastedContents:E,onRemoveImage:D,imagesSelected:O,selectedImageIndex:M,onImagesSelectedChange:A,onSelectedImageIndexChange:N},String(n.value))}let o=n.label;if(typeof n.label==`string`&&a&&n.label.includes(a)){let e=n.label,t=e.indexOf(a);o=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,t),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(t+a.length)]})}let u=n.index===V.visibleFromIndex,p=n.index===V.visibleToIndex-1,m=V.visibleToIndex<s.length,h=V.visibleFromIndex>0,g=V.visibleFromIndex+r+1,_=!e&&V.focusedValue===n.value,y=V.value===n.value,x=n.disabled===!0;return(0,R.jsxs)(b,{isFocused:_,isSelected:y,shouldShowDownArrow:m&&p,shouldShowUpArrow:h&&u,children:[(0,R.jsxs)(c,{flexDirection:`row`,flexShrink:0,children:[!t&&(0,R.jsx)(l,{dimColor:!0,children:`${g}.`.padEnd(U+2)}),(0,R.jsxs)(l,{dimColor:x,color:x?void 0:y?`success`:_?`suggestion`:void 0,children:[o,v&&n.description&&(0,R.jsxs)(l,{dimColor:x||n.dimDescription!==!1,children:[` `,n.description]})]})]}),!v&&n.description&&(0,R.jsx)(c,{flexShrink:99,marginLeft:2,children:(0,R.jsx)(l,{wrap:`wrap-trim`,dimColor:x||n.dimDescription!==!1,color:x?void 0:y?`success`:_?`suggestion`:void 0,children:(0,R.jsx)(i,{children:n.description})})})]},String(n.value))})})}function I({isFocused:e,children:t}){return(0,R.jsx)(c,{ref:a({line:0,column:0,active:e}),flexDirection:`row`,children:t})}var L,R,z=e((()=>{n(),L=t(u(),1),f(),h(),x(),C(),A(),N(),R=p()}));export{z as n,F as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Ft as i,G as a,Gr as o,Gt as s,I as c,P as l,ai as u,hn as d,t as f}from"./src-WZ94ZKI3.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{tb as m}from"./loadAgentsDir-DR5PVAc3.js";import{Bn as h,zn as g}from"./settings-YIDksG5Z.js";import{c as _,o as v,s as y}from"./stringUtils-D_xPrwGQ.js";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./use-select-navigation-CW5alA9r.js";import{i as E,t as D}from"./overlayContext-B6i_6y_0.js";var O,k,A=e((()=>{O=t(u(),1),D(),f(),m(),v(),k=({isDisabled:e=!1,disableSelection:t=!1,state:n,options:r,isMultiSelect:i=!1,onUpFromFirstItem:a,onDownFromLastItem:o,onInputModeToggle:c,inputValues:l,imagesSelected:u=!1,onEnterImageSelection:f})=>{E(`select`,!!n.onCancel);let p=(0,O.useMemo)(()=>r.find(e=>e.value===n.focusedValue)?.type===`input`,[r,n.focusedValue]);s((0,O.useMemo)(()=>{let e={};return p||(e[`select:next`]=()=>{if(o){let e=r[r.length-1];if(e&&n.focusedValue===e.value){o();return}}n.focusNextOption()},e[`select:previous`]=()=>{if(a&&n.visibleFromIndex===0){let e=r[0];if(e&&n.focusedValue===e.value){a();return}}n.focusPreviousOption()},e[`select:accept`]=()=>{t!==!0&&n.focusedValue!==void 0&&r.find(e=>e.value===n.focusedValue)?.disabled!==!0&&(n.selectFocusedOption?.(),n.onChange?.(n.focusedValue))}),n.onCancel&&(e[`select:cancel`]=()=>{n.onCancel()}),e},[r,n,o,a,p,t]),{context:`Select`,isActive:!e}),d((e,s,d)=>{let p=y(e),m=r.find(e=>e.value===n.focusedValue),h=m?.type===`input`;if(s.tab&&c&&n.focusedValue!==void 0){c(n.focusedValue);return}if(h){if(u)return;if(s.downArrow&&f?.()){d.stopImmediatePropagation();return}if(s.downArrow||s.ctrl&&e===`n`){if(o){let e=r[r.length-1];if(e&&n.focusedValue===e.value){o(),d.stopImmediatePropagation();return}}n.focusNextOption(),d.stopImmediatePropagation();return}if(s.upArrow||s.ctrl&&e===`p`){if(a&&n.visibleFromIndex===0){let e=r[0];if(e&&n.focusedValue===e.value){a(),d.stopImmediatePropagation();return}}n.focusPreviousOption(),d.stopImmediatePropagation();return}return}if(s.pageDown&&n.focusNextPage(),s.pageUp&&n.focusPreviousPage(),t!==!0&&(i&&_(e)===` `&&n.focusedValue!==void 0&&m?.disabled!==!0&&(n.selectFocusedOption?.(),n.onChange?.(n.focusedValue)),t!==`numeric`&&/^[0-9]+$/.test(p))){let e=parseInt(p,10)-1;if(e>=0&&e<n.options.length){let t=n.options[e];if(t.disabled===!0)return;if(t.type===`input`){if((l?.get(t.value)??``).trim()){n.onChange?.(t.value);return}if(t.allowEmptySubmitToCancel){n.onChange?.(t.value);return}n.focusOption(t.value);return}n.onChange?.(t.value);return}}},{isActive:!e})}}));function j({visibleOptionCount:e=5,options:t,defaultValue:n,onChange:r,onCancel:i,onFocus:a,focusValue:o}){let[s,c]=(0,M.useState)(n),l=S({visibleOptionCount:e,options:t,initialFocusValue:void 0,onFocus:a,focusValue:o}),u=(0,M.useCallback)(()=>{c(l.focusedValue)},[l.focusedValue]);return{...l,value:s,selectFocusedOption:u,onChange:r,onCancel:i}}var M,N=e((()=>{M=t(u(),1),T()}));function P(e){return typeof e==`string`?e:typeof e==`number`?String(e):e?Array.isArray(e)?e.map(P).join(``):L.isValidElement(e)?P(e.props.children):``:``}function F({isDisabled:e=!1,hideIndexes:t=!1,visibleOptionCount:n=5,highlightText:a,options:s,defaultValue:u,onCancel:d,onChange:f,onFocus:p,defaultFocusValue:m,layout:h=`compact`,disableSelection:_=!1,inlineDescriptions:v=!1,onUpFromFirstItem:y,onDownFromLastItem:x,onInputModeToggle:S,onOpenEditor:C,onImagePaste:T,pastedContents:E,onRemoveImage:D}){let[O,A]=(0,L.useState)(!1),[M,N]=(0,L.useState)(0),[F,z]=(0,L.useState)(()=>{let e=new Map;return s.forEach(t=>{t.type===`input`&&t.initialValue&&e.set(t.value,t.initialValue)}),e}),B=(0,L.useRef)(new Map);(0,L.useEffect)(()=>{for(let e of s)if(e.type===`input`&&e.initialValue!==void 0){let t=B.current.get(e.value)??``,n=F.get(e.value)??``,r=e.initialValue;r!==t&&n===t&&z(t=>{let n=new Map(t);return n.set(e.value,r),n}),B.current.set(e.value,r)}},[s,F]);let V=j({visibleOptionCount:n,options:s,defaultValue:u,onChange:f,onCancel:d,onFocus:p,focusValue:m});k({isDisabled:e,disableSelection:_||(t?`numeric`:!1),state:V,options:s,isMultiSelect:!1,onUpFromFirstItem:y,onDownFromLastItem:x,onInputModeToggle:S,inputValues:F,imagesSelected:O,onEnterImageSelection:()=>{if(E&&Object.values(E).some(e=>e.type===`image`)){let e=g(Object.values(E),e=>e.type===`image`);return A(!0),N(e-1),!0}return!1}});let H={container:()=>({flexDirection:`column`}),highlightedText:()=>({bold:!0})};if(h===`expanded`){let t=V.options.length.toString().length;return(0,R.jsx)(c,{...H.container(),children:V.visibleOptions.map((n,r)=>{let o=n.index===V.visibleFromIndex,u=n.index===V.visibleToIndex-1,p=V.visibleToIndex<s.length,m=V.visibleFromIndex>0,h=V.visibleFromIndex+r+1,g=!e&&V.focusedValue===n.value,_=V.value===n.value;if(n.type===`input`){let e=F.has(n.value)?F.get(n.value):n.initialValue||``;return(0,R.jsx)(w,{option:n,isFocused:g,isSelected:_,shouldShowDownArrow:p&&u,shouldShowUpArrow:m&&o,maxIndexWidth:t,index:h,inputValue:e,onInputChange:e=>{z(t=>{let r=new Map(t);return r.set(n.value,e),r})},onSubmit:e=>{let t=E&&Object.values(E).some(e=>e.type===`image`);e.trim()||t||n.allowEmptySubmitToCancel?f?.(n.value):d?.()},onExit:d,layout:`expanded`,showLabel:v,onOpenEditor:C,resetCursorOnUpdate:n.resetCursorOnUpdate,onImagePaste:T,pastedContents:E,onRemoveImage:D,imagesSelected:O,selectedImageIndex:M,onImagesSelectedChange:A,onSelectedImageIndexChange:N},String(n.value))}let y=n.label;if(typeof n.label==`string`&&a&&n.label.includes(a)){let e=n.label,t=e.indexOf(a);y=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,t),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(t+a.length)]})}let x=n.disabled===!0,S=x?void 0:_?`success`:g?`suggestion`:void 0;return(0,R.jsxs)(c,{flexDirection:`column`,flexShrink:0,children:[(0,R.jsx)(b,{isFocused:g,isSelected:_,shouldShowDownArrow:p&&u,shouldShowUpArrow:m&&o,children:(0,R.jsx)(l,{dimColor:x,color:S,children:y})}),n.description&&(0,R.jsx)(c,{paddingLeft:2,children:(0,R.jsx)(l,{dimColor:x||n.dimDescription!==!1,color:S,children:(0,R.jsx)(i,{children:n.description})})}),(0,R.jsx)(l,{children:` `})]},String(n.value))})})}if(h===`compact-vertical`){let n=t?0:V.options.length.toString().length;return(0,R.jsx)(c,{...H.container(),children:V.visibleOptions.map((r,o)=>{let u=r.index===V.visibleFromIndex,p=r.index===V.visibleToIndex-1,m=V.visibleToIndex<s.length,h=V.visibleFromIndex>0,g=V.visibleFromIndex+o+1,_=!e&&V.focusedValue===r.value,y=V.value===r.value;if(r.type===`input`){let e=F.has(r.value)?F.get(r.value):r.initialValue||``;return(0,R.jsx)(w,{option:r,isFocused:_,isSelected:y,shouldShowDownArrow:m&&p,shouldShowUpArrow:h&&u,maxIndexWidth:n,index:g,inputValue:e,onInputChange:e=>{z(t=>{let n=new Map(t);return n.set(r.value,e),n})},onSubmit:e=>{let t=E&&Object.values(E).some(e=>e.type===`image`);e.trim()||t||r.allowEmptySubmitToCancel?f?.(r.value):d?.()},onExit:d,layout:`compact`,showLabel:v,onOpenEditor:C,resetCursorOnUpdate:r.resetCursorOnUpdate,onImagePaste:T,pastedContents:E,onRemoveImage:D,imagesSelected:O,selectedImageIndex:M,onImagesSelectedChange:A,onSelectedImageIndexChange:N},String(r.value))}let x=r.label;if(typeof r.label==`string`&&a&&r.label.includes(a)){let e=r.label,t=e.indexOf(a);x=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,t),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(t+a.length)]})}let S=r.disabled===!0;return(0,R.jsxs)(c,{flexDirection:`column`,flexShrink:0,children:[(0,R.jsxs)(b,{isFocused:_,isSelected:y,shouldShowDownArrow:m&&p,shouldShowUpArrow:h&&u,children:[!t&&(0,R.jsx)(l,{dimColor:!0,children:`${g}.`.padEnd(n+1)}),(0,R.jsx)(l,{dimColor:S,color:S?void 0:y?`success`:_?`suggestion`:void 0,children:x})]}),r.description&&(0,R.jsx)(c,{paddingLeft:t?4:n+4,children:(0,R.jsx)(l,{dimColor:S||r.dimDescription!==!1,color:S?void 0:y?`success`:_?`suggestion`:void 0,children:(0,R.jsx)(i,{children:r.description})})})]},String(r.value))})})}let U=t?0:V.options.length.toString().length,W=V.visibleOptions.some(e=>e.type===`input`),G=!v&&!W&&V.visibleOptions.some(e=>e.description),K=V.visibleOptions.map((t,n)=>{let r=t.index===V.visibleFromIndex,i=t.index===V.visibleToIndex-1,o=V.visibleToIndex<s.length,c=V.visibleFromIndex>0,u=V.visibleFromIndex+n+1,d=!e&&V.focusedValue===t.value,f=V.value===t.value,p=t.disabled===!0,m=t.label;if(typeof t.label==`string`&&a&&t.label.includes(a)){let e=t.label,n=e.indexOf(a);m=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,n),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(n+a.length)]})}return{option:t,index:u,label:m,isFocused:d,isSelected:f,isOptionDisabled:p,shouldShowDownArrow:o&&i,shouldShowUpArrow:c&&r}});if(G){let e=Math.max(...K.map(e=>{if(e.option.type===`input`)return 0;let n=P(e.option.label),r=t?0:U+2,i=e.isSelected?2:0;return 2+r+o(n)+i}));return(0,R.jsx)(c,{...H.container(),children:K.map(n=>{if(n.option.type===`input`)return null;let a=P(n.option.label),s=t?0:U+2,u=n.isSelected?2:0,d=2+s+o(a)+u,f=e-d;return(0,R.jsxs)(I,{isFocused:n.isFocused,children:[(0,R.jsxs)(c,{flexDirection:`row`,flexShrink:0,children:[n.isFocused?(0,R.jsx)(l,{color:`suggestion`,children:r.pointer}):n.shouldShowDownArrow?(0,R.jsx)(l,{dimColor:!0,children:r.arrowDown}):n.shouldShowUpArrow?(0,R.jsx)(l,{dimColor:!0,children:r.arrowUp}):(0,R.jsx)(l,{children:` `}),(0,R.jsx)(l,{children:` `}),(0,R.jsxs)(l,{dimColor:n.isOptionDisabled,color:n.isOptionDisabled?void 0:n.isSelected?`success`:n.isFocused?`suggestion`:void 0,children:[!t&&(0,R.jsx)(l,{dimColor:!0,children:`${n.index}.`.padEnd(U+2)}),n.label]}),n.isSelected&&(0,R.jsxs)(l,{color:`success`,children:[` `,r.tick]}),f>0&&(0,R.jsx)(l,{children:` `.repeat(f)})]}),(0,R.jsx)(c,{flexGrow:1,marginLeft:2,children:(0,R.jsx)(l,{wrap:`wrap`,dimColor:n.isOptionDisabled||n.option.dimDescription!==!1,color:n.isOptionDisabled?void 0:n.isSelected?`success`:n.isFocused?`suggestion`:void 0,children:(0,R.jsx)(i,{children:n.option.description||` `})})})]},String(n.option.value))})})}return(0,R.jsx)(c,{...H.container(),children:V.visibleOptions.map((n,r)=>{if(n.type===`input`){let t=F.has(n.value)?F.get(n.value):n.initialValue||``,i=n.index===V.visibleFromIndex,a=n.index===V.visibleToIndex-1,o=V.visibleToIndex<s.length,c=V.visibleFromIndex>0,l=V.visibleFromIndex+r+1;return(0,R.jsx)(w,{option:n,isFocused:!e&&V.focusedValue===n.value,isSelected:V.value===n.value,shouldShowDownArrow:o&&a,shouldShowUpArrow:c&&i,maxIndexWidth:U,index:l,inputValue:t,onInputChange:e=>{z(t=>{let r=new Map(t);return r.set(n.value,e),r})},onSubmit:e=>{let t=E&&Object.values(E).some(e=>e.type===`image`);e.trim()||t||n.allowEmptySubmitToCancel?f?.(n.value):d?.()},onExit:d,layout:`compact`,showLabel:v,onOpenEditor:C,resetCursorOnUpdate:n.resetCursorOnUpdate,onImagePaste:T,pastedContents:E,onRemoveImage:D,imagesSelected:O,selectedImageIndex:M,onImagesSelectedChange:A,onSelectedImageIndexChange:N},String(n.value))}let o=n.label;if(typeof n.label==`string`&&a&&n.label.includes(a)){let e=n.label,t=e.indexOf(a);o=(0,R.jsxs)(R.Fragment,{children:[e.slice(0,t),(0,R.jsx)(l,{...H.highlightedText(),children:a}),e.slice(t+a.length)]})}let u=n.index===V.visibleFromIndex,p=n.index===V.visibleToIndex-1,m=V.visibleToIndex<s.length,h=V.visibleFromIndex>0,g=V.visibleFromIndex+r+1,_=!e&&V.focusedValue===n.value,y=V.value===n.value,x=n.disabled===!0;return(0,R.jsxs)(b,{isFocused:_,isSelected:y,shouldShowDownArrow:m&&p,shouldShowUpArrow:h&&u,children:[(0,R.jsxs)(c,{flexDirection:`row`,flexShrink:0,children:[!t&&(0,R.jsx)(l,{dimColor:!0,children:`${g}.`.padEnd(U+2)}),(0,R.jsxs)(l,{dimColor:x,color:x?void 0:y?`success`:_?`suggestion`:void 0,children:[o,v&&n.description&&(0,R.jsxs)(l,{dimColor:x||n.dimDescription!==!1,children:[` `,n.description]})]})]}),!v&&n.description&&(0,R.jsx)(c,{flexShrink:99,marginLeft:2,children:(0,R.jsx)(l,{wrap:`wrap-trim`,dimColor:x||n.dimDescription!==!1,color:x?void 0:y?`success`:_?`suggestion`:void 0,children:(0,R.jsx)(i,{children:n.description})})})]},String(n.value))})})}function I({isFocused:e,children:t}){return(0,R.jsx)(c,{ref:a({line:0,column:0,active:e}),flexDirection:`row`,children:t})}var L,R,z=e((()=>{n(),L=t(u(),1),f(),h(),x(),C(),A(),N(),R=p()}));export{z as n,F as t};
@@ -0,0 +1 @@
1
+ import{Am as e,km as t}from"./loadAgentsDir-DR5PVAc3.js";t();export{e as registerSessionFileAccessHooks};
@@ -1,5 +1,5 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$g as t,X as n,Z as r,pC as i}from"./loadAgentsDir-DGozQu_6.js";import{i as a,l as o,t as s,u as c}from"./instinctParser-Dt-lqnDe.js";function l(e){h.set(e.name,e),g||(g=e.name)}function u(e){if(!h.has(e))throw Error(`Observer backend "${e}" is not registered`);g=e}function d(){let e=g?h.get(g):void 0;if(!e)throw Error(`No observer backend is active — register one before analyzing observations`);return e}async function f(e,t){return Promise.resolve(d().analyze(e,t))}function p(){let e=process.env.SKILL_LEARNING_OBSERVER_BACKEND?.trim();return e&&h.has(e)?e:void 0}function m(){let e=p();return e&&u(e),d()}var h,g,_=e((()=>{h=new Map})),v,y=e((()=>{v=[`workflow`,`testing`,`debugging`,`code-style`,`security`,`git`,`project`]}));async function b(e,t){if(e.length===0)return[];if(Date.now()<L)return x(e,t);let n=e.slice(-30),a=S(n),s=P(o().llm.timeoutMs),c;try{let e=await r({systemPrompt:i([R]),userPrompt:a,signal:s,options:{querySource:`skill_learning_observer`,enablePromptCaching:!0,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[]}});I=0,c=T(e.message?.content)}catch{return I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,t)}let l=E(c,t,n);return l.length===0?(I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,t)):l}async function x(e,t){try{let{heuristicObserverBackend:n}=await import(`./sessionObserver-PcaVCVkX.js`),r=n.analyze(e,t);return Array.isArray(r)?r:await r}catch{return[]}}function S(e){return`Observations (chronological, newest last):\n${e.map((e,t)=>C(e,t)).join(`
2
- `)}\n\nExtract up to ${F} atomic instincts. JSON array only.`}function C(e,t){let n=[`#${t+1}`,`event=${e.event}`];return e.toolName&&n.push(`tool=${e.toolName}`),e.outcome&&n.push(`outcome=${e.outcome}`),e.messageText&&n.push(`text=${JSON.stringify(w(e.messageText,200))}`),e.toolInput&&n.push(`in=${JSON.stringify(w(e.toolInput,120))}`),e.toolOutput&&n.push(`out=${JSON.stringify(w(e.toolOutput,120))}`),n.join(` | `)}function w(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function T(e){if(!Array.isArray(e))return``;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;e.type===`text`&&typeof e.text==`string`&&t.push(e.text)}return t.join(``).trim()}function E(e,t,n){let r=D(e);if(!r)return[];let i;try{i=JSON.parse(r)}catch{return[]}if(!Array.isArray(i))return[];let a=n.map(e=>e.id),o=[];for(let e of i.slice(0,F)){let n=O(e,t,a);n&&o.push(n)}return o}function D(e){if(!e)return;let t=e.indexOf(`[`),n=e.lastIndexOf(`]`);if(!(t<0||n<=t))return e.slice(t,n+1)}function O(e,t,n){if(!e||typeof e!=`object`)return;let r=e,i=k(r.trigger,80),a=k(r.action,120);if(!i||!a)return;let o=N(r.evidence);if(o.length!==0)return{trigger:i,action:a,confidence:A(r.confidence),domain:j(r.domain),source:`session-observation`,scope:M(r.scope),projectId:t?.project?.projectId,projectName:t?.project?.projectName,evidence:o,observationIds:n}}function k(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)return n.length>t?n.slice(0,t):n}function A(e){return typeof e!=`number`||!Number.isFinite(e)?.5:e<0?0:e>1?1:e}function j(e){return typeof e==`string`&&v.includes(e)?e:`project`}function M(e){return e===`global`?`global`:`project`}function N(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e&&(t.push(e.length>200?`${e.slice(0,200)}…`:e),t.length===3))break}return t}function P(e){return AbortSignal.timeout(e)}var F,I,L,R,z,B=e((()=>{n(),t(),c(),y(),F=3,I=0,L=0,R=`You analyse a short sequence of observations from a coding-assistant session (user messages, tool invocations with outcomes, assistant messages) and extract atomic, reusable "instincts" — behavioural patterns that would help the assistant act correctly in future similar situations.
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{GS as t,X as n,Z as r,ty as i}from"./loadAgentsDir-DR5PVAc3.js";import{i as a,l as o,t as s,u as c}from"./instinctParser-Dt-lqnDe.js";function l(e){h.set(e.name,e),g||(g=e.name)}function u(e){if(!h.has(e))throw Error(`Observer backend "${e}" is not registered`);g=e}function d(){let e=g?h.get(g):void 0;if(!e)throw Error(`No observer backend is active — register one before analyzing observations`);return e}async function f(e,t){return Promise.resolve(d().analyze(e,t))}function p(){let e=process.env.SKILL_LEARNING_OBSERVER_BACKEND?.trim();return e&&h.has(e)?e:void 0}function m(){let e=p();return e&&u(e),d()}var h,g,_=e((()=>{h=new Map})),v,y=e((()=>{v=[`workflow`,`testing`,`debugging`,`code-style`,`security`,`git`,`project`]}));async function b(e,n){if(e.length===0)return[];if(Date.now()<L)return x(e,n);let i=e.slice(-30),a=S(i),s=P(o().llm.timeoutMs),c;try{let e=await r({systemPrompt:t([R]),userPrompt:a,signal:s,options:{querySource:`skill_learning_observer`,enablePromptCaching:!0,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[]}});I=0,c=T(e.message?.content)}catch{return I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,n)}let l=E(c,n,i);return l.length===0?(I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),x(e,n)):l}async function x(e,t){try{let{heuristicObserverBackend:n}=await import(`./sessionObserver-CBrM4opL.js`),r=n.analyze(e,t);return Array.isArray(r)?r:await r}catch{return[]}}function S(e){return`Observations (chronological, newest last):\n${e.map((e,t)=>C(e,t)).join(`
2
+ `)}\n\nExtract up to ${F} atomic instincts. JSON array only.`}function C(e,t){let n=[`#${t+1}`,`event=${e.event}`];return e.toolName&&n.push(`tool=${e.toolName}`),e.outcome&&n.push(`outcome=${e.outcome}`),e.messageText&&n.push(`text=${JSON.stringify(w(e.messageText,200))}`),e.toolInput&&n.push(`in=${JSON.stringify(w(e.toolInput,120))}`),e.toolOutput&&n.push(`out=${JSON.stringify(w(e.toolOutput,120))}`),n.join(` | `)}function w(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function T(e){if(!Array.isArray(e))return``;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;e.type===`text`&&typeof e.text==`string`&&t.push(e.text)}return t.join(``).trim()}function E(e,t,n){let r=D(e);if(!r)return[];let i;try{i=JSON.parse(r)}catch{return[]}if(!Array.isArray(i))return[];let a=n.map(e=>e.id),o=[];for(let e of i.slice(0,F)){let n=O(e,t,a);n&&o.push(n)}return o}function D(e){if(!e)return;let t=e.indexOf(`[`),n=e.lastIndexOf(`]`);if(!(t<0||n<=t))return e.slice(t,n+1)}function O(e,t,n){if(!e||typeof e!=`object`)return;let r=e,i=k(r.trigger,80),a=k(r.action,120);if(!i||!a)return;let o=N(r.evidence);if(o.length!==0)return{trigger:i,action:a,confidence:A(r.confidence),domain:j(r.domain),source:`session-observation`,scope:M(r.scope),projectId:t?.project?.projectId,projectName:t?.project?.projectName,evidence:o,observationIds:n}}function k(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)return n.length>t?n.slice(0,t):n}function A(e){return typeof e!=`number`||!Number.isFinite(e)?.5:e<0?0:e>1?1:e}function j(e){return typeof e==`string`&&v.includes(e)?e:`project`}function M(e){return e===`global`?`global`:`project`}function N(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e&&(t.push(e.length>200?`${e.slice(0,200)}…`:e),t.length===3))break}return t}function P(e){return AbortSignal.timeout(e)}var F,I,L,R,z,B=e((()=>{n(),i(),c(),y(),F=3,I=0,L=0,R=`You analyse a short sequence of observations from a coding-assistant session (user messages, tool invocations with outcomes, assistant messages) and extract atomic, reusable "instincts" — behavioural patterns that would help the assistant act correctly in future similar situations.
3
3
 
4
4
  Respond with ONLY a JSON array (no prose, no code fences, no commentary). Each item must match this schema:
5
5
 
@@ -0,0 +1 @@
1
+ import{n as e,r as t}from"./sessionObserver-B6xzxckA.js";t();export{e as heuristicObserverBackend};
@@ -0,0 +1 @@
1
+ import{Cr as e,Wr as t,gr as n}from"./loadAgentsDir-DR5PVAc3.js";n();export{e as linkSessionToPR,t as recordTranscript};
@@ -0,0 +1,11 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{l as r,o as i}from"./envUtils-DZ_SvEVz.js";import{i as a,l as o,n as s}from"./esm-lWlUmoUA.js";import{$ as c,E as l,F as u,Pt as d,at as f}from"./state-CXY-q5gr.js";import{C as p,I as ee,S as te,c as m,i as h,x as g}from"./debug-kBjDaVkQ.js";import{Ht as ne,Kt as re,Ut as _}from"./settings-YIDksG5Z.js";import{d as ie,l as ae}from"./config-D3K87Mm1.js";import{i as oe,t as se}from"./execFileNoThrow-BfZFnCGa.js";import{r as ce,t as le}from"./genericProcessUtils-CVtQOTO2.js";import{extname as ue}from"path";import"fs";import{createHash as de}from"crypto";import{stat as fe}from"fs/promises";import{AsyncLocalStorage as v}from"async_hooks";function pe(e){return!1}var me=e((()=>{}));function y(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function he(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function ge(e,t){return!!(process.env.WORKMATE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&pe(t))}function _e(e,t,n){let r=b(e);return!r||!xe.has(r.serverName)&&!ge(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function b(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function ve(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function x(e,t=0){if(typeof e==`string`)return e.length>Se?`${e.slice(0,Ce)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=we)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,w).map(e=>x(e,t+1));return e.length>w&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,w).map(([e,n])=>[e,x(n,t+1)]);return n.length>w&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function ye(e){if(!he())return;let t=p(x(e));return t.length>C&&(t=`${t.slice(0,C)}…[truncated]`),t}function S(e){let t=ue(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>Te?`other`:n}function be(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=S(t);e&&(r.add(e),n=e)}for(let t of e.split(De)){if(!t)continue;let e=t.split(Oe);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(Ee.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=S(i);a&&!r.has(a)&&(r.add(a),n=n?`${n},${a}`:a)}}if(n)return n}var xe,Se,Ce,C,w,we,Te,Ee,De,Oe,ke=e((()=>{i(),me(),g(),xe=new Set,Se=512,Ce=128,C=4*1024,w=20,we=2,Te=10,Ee=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),De=/\s*(?:&&|\|\||[;|])\s*/,Oe=/\s+/}));function Ae(){return process.platform===`linux`&&r(process.env.WORKMATE_BUBBLEWRAP)}function je(){return process.platform===`linux`?O??!1:!1}async function T(){if(k!==void 0)return k;if(process.platform===`darwin`)return k=null,null;try{let e=await le(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of ne)if(e.includes(t))return k=t,t}}catch{}return k=null,null}async function Me(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&_.platform!==`darwin`?await T()||`pycharm`:_.terminal}function Ne(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&_.platform!==`darwin`?k===void 0?`pycharm`:k||`pycharm`:_.terminal}async function E(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await T()}var D,O,k,A,j=e((()=>{n(),re(),i(),oe(),ce(),D=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await se(`test`,[`-f`,`/.dockerenv`]);return e===0}),O=null,process.platform===`linux`&&fe(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{O=!0},()=>{O=!1}),A={..._,terminal:Ne(),getIsDocker:D,getIsBubblewrapSandbox:Ae,isMuslEnvironment:je,getTerminalWithJetBrainsDetectionAsync:Me,initJetBrainsDetection:E}}));function M(e){let t=Pe[e],n=process.env[e];return n===void 0?t:r(n)}function N(){let e=ae(),t=f(),n={"user.id":e};return M(`OTEL_METRICS_INCLUDE_SESSION_ID`)&&(n[`session.id`]=t),M(`OTEL_METRICS_INCLUDE_VERSION`)&&(n[`app.version`]=`0.0.26`),A.terminal&&(n[`terminal.type`]=A.terminal),n}var Pe,P=e((()=>{d(),ie(),j(),i(),Pe={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}}));function Fe(){return r(process.env.OTEL_LOG_USER_PROMPTS)}function Ie(e){return Fe()?e:`<REDACTED>`}async function F(e,t={}){let n=l();if(!n){I||(I=!0,m(`[3P telemetry] Event dropped (no event logger initialized): ${e}`,{level:`warn`}));return}let r={...N(),"event.name":e,"event.timestamp":new Date().toISOString(),"event.sequence":Le++},i=c();i&&(r[`prompt.id`]=i);let a=process.env.WORKMATE_WORKSPACE_HOST_PATHS;a&&(r[`workspace.host_paths`]=a.split(`|`));for(let[e,n]of Object.entries(t))n!==void 0&&(r[e]=n);n.emit({body:`workmate.${e}`,attributes:r})}var Le,I,Re=e((()=>{d(),h(),i(),P(),Le=0,I=!1}));function ze(){V.clear(),H.clear()}function L(){return r(process.env.ENABLE_BETA_TRACING_DETAILED)&&process.env.BETA_TRACING_ENDPOINT&&u()||!1}function R(e,t=Je){return e.length<=t?{content:e,truncated:!1}:{content:e.slice(0,t)+`
2
+
3
+ [TRUNCATED - Content exceeds 60KB limit]`,truncated:!0}}function z(e){return de(`sha256`).update(e).digest(`hex`).slice(0,12)}function Be(e){return`sp_${z(e)}`}function Ve(e){return`msg_${z(p(e.message.content))}`}function B(e){let t=e.trim().match(Ye);return t?.[1]?t[1].trim():null}function He(e){let t=[],n=[];for(let r of e){let e=r.message.content;if(typeof e==`string`){let r=B(e);r?n.push(r):t.push(`[USER]\n${e}`)}else if(Array.isArray(e)){for(let r of e)if(r.type===`text`){let e=B(r.text);e?n.push(e):t.push(`[USER]\n${r.text}`)}else if(r.type===`tool_result`){let e=typeof r.content==`string`?r.content:p(r.content),i=B(e);i?n.push(i):t.push(`[TOOL RESULT: ${r.tool_use_id}]\n${e}`)}}}return{contextParts:t,systemReminders:n}}function Ue(e,t){if(!L())return;let{content:n,truncated:r}=R(`[USER PROMPT]\n${t}`);e.setAttributes({new_context:n,...r&&{new_context_truncated:!0,new_context_original_length:t.length}})}function We(e,t,n){if(L()){if(t?.systemPrompt){let n=Be(t.systemPrompt),r=t.systemPrompt.slice(0,500);if(e.setAttribute(`system_prompt_hash`,n),e.setAttribute(`system_prompt_preview`,r),e.setAttribute(`system_prompt_length`,t.systemPrompt.length),!V.has(n)){V.add(n);let{content:e,truncated:r}=R(t.systemPrompt);F(`system_prompt`,{system_prompt_hash:n,system_prompt:e,system_prompt_length:String(t.systemPrompt.length),...r&&{system_prompt_truncated:`true`}})}}if(t?.tools)try{let n=te(t.tools).map(e=>{let t=p(e),n=z(t);return{name:typeof e.name==`string`?e.name:`unknown`,hash:n,json:t}});e.setAttribute(`tools`,p(n.map(({name:e,hash:t})=>({name:e,hash:t})))),e.setAttribute(`tools_count`,n.length);for(let{name:e,hash:t,json:r}of n)if(!V.has(`tool_${t}`)){V.add(`tool_${t}`);let{content:n,truncated:i}=R(r);F(`tool`,{tool_name:y(e),tool_hash:t,tool:n,...i&&{tool_truncated:`true`}})}}catch{e.setAttribute(`tools_parse_error`,!0)}if(n&&n.length>0&&t?.querySource){let r=t.querySource,i=H.get(r),a=0;if(i)for(let e=0;e<n.length;e++){let t=n[e];if(t&&Ve(t)===i){a=e+1;break}}let o=n.slice(a).filter(e=>e.type===`user`);if(o.length>0){let{contextParts:t,systemReminders:i}=He(o);if(t.length>0){let n=t.join(`
4
+
5
+ ---
6
+
7
+ `),{content:r,truncated:i}=R(n);e.setAttributes({new_context:r,new_context_message_count:o.length,...i&&{new_context_truncated:!0,new_context_original_length:n.length}})}if(i.length>0){let t=i.join(`
8
+
9
+ ---
10
+
11
+ `),{content:n,truncated:r}=R(t);e.setAttributes({system_reminders:n,system_reminders_count:i.length,...r&&{system_reminders_truncated:!0,system_reminders_original_length:t.length}})}let a=n[n.length-1];a&&H.set(r,Ve(a))}}}}function Ge(e,t){if(!(!L()||!t)&&t.modelOutput!==void 0){let{content:n,truncated:r}=R(t.modelOutput);e[`response.model_output`]=n,r&&(e[`response.model_output_truncated`]=!0,e[`response.model_output_original_length`]=t.modelOutput.length)}}function Ke(e,t,n){if(!L())return;let{content:r,truncated:i}=R(`[TOOL INPUT: ${t}]\n${n}`);e.setAttributes({tool_input:r,...i&&{tool_input_truncated:!0,tool_input_original_length:n.length}})}function qe(e,t,n){if(!L())return;let{content:r,truncated:i}=R(`[TOOL RESULT: ${t}]\n${n}`);e.new_context=r,i&&(e.new_context_truncated=!0,e.new_context_original_length=n.length)}var V,H,Je,Ye,Xe=e((()=>{d(),ke(),i(),g(),Re(),V=new Set,H=new Map,Je=60*1024,Ye=/^<system-reminder>\n?([\s\S]*?)\n?<\/system-reminder>$/}));function Ze(){let e=process.env.WORKMATE_PERFETTO_TRACE;m(`[Perfetto] initializePerfettoTracing called, env value: ${e}`)}function U(){return it}function Qe(e,t,n){}function $e(e){}function et(e){return``}function tt(e,t){return``}function nt(e){return``}function rt(e){return``}var it,at=e((()=>{d(),h(),i(),ee(),g(),it=!1}));function W(e){return e.spanContext().spanId||``}function ot(){if($)return;$=!0;let e=setInterval(()=>{let e=Date.now()-St;for(let[t,n]of X){let r=n.deref();r===void 0?(X.delete(t),Z.delete(t)):r.startTime<e&&(r.ended||r.span.end(),X.delete(t),Z.delete(t))}},6e4);typeof e.unref==`function`&&e.unref()}function st(){return!1}function G(){return st()||L()}function K(){return a.getTracer(`com.workmate.tracing`,`1.0.0`)}function q(e,t={}){return{...N(),"span.type":e,...t}}function ct(e){ot();let t=U()?rt(e):void 0;if(!G()){if(t){let e=a.getActiveSpan()||K().startSpan(`dummy`),n=W(e),r={span:e,startTime:Date.now(),attributes:{},perfettoSpanId:t};return X.set(n,new WeakRef(r)),J.enterWith(r),e}return a.getActiveSpan()||K().startSpan(`dummy`)}let n=K(),i=r(process.env.OTEL_LOG_USER_PROMPTS)?e:`<REDACTED>`;Q++;let o=q(`interaction`,{user_prompt:i,user_prompt_length:e.length,"interaction.sequence":Q}),s=n.startSpan(`workmate.interaction`,{attributes:o});Ue(s,e);let c=W(s),l={span:s,startTime:Date.now(),attributes:o,perfettoSpanId:t};return X.set(c,new WeakRef(l)),J.enterWith(l),s}function lt(){let e=J.getStore();if(!e||e.ended)return;if(e.perfettoSpanId&&e.perfettoSpanId,!G()){e.ended=!0,X.delete(W(e.span)),J.enterWith(void 0);return}let t=Date.now()-e.startTime;e.span.setAttributes({"interaction.duration_ms":t}),e.span.end(),e.ended=!0,X.delete(W(e.span)),J.enterWith(void 0)}function ut(e,t,n,r){let i=U()?et({model:e,querySource:t?.querySource,messageId:void 0}):void 0;if(!G()){if(i){let t=a.getActiveSpan()||K().startSpan(`dummy`),n=W(t),r={span:t,startTime:Date.now(),attributes:{model:e},perfettoSpanId:i};return X.set(n,new WeakRef(r)),Z.set(n,r),t}return a.getActiveSpan()||K().startSpan(`dummy`)}let s=K(),c=J.getStore(),l=q(`llm_request`,{model:e,"llm_request.context":c?`interaction`:`standalone`,speed:r?`fast`:`normal`}),u=c?a.setSpan(o.active(),c.span):o.active(),d=s.startSpan(`workmate.llm_request`,{attributes:l},u);t?.querySource&&d.setAttribute(`query_source`,t.querySource),We(d,t,n);let f=W(d),p={span:d,startTime:Date.now(),attributes:l,perfettoSpanId:i};return X.set(f,new WeakRef(p)),Z.set(f,p),d}function dt(e,t){let n;if(e){let t=W(e);n=X.get(t)?.deref()}else n=Array.from(X.values()).findLast(e=>{let t=e.deref();return t?.attributes[`span.type`]===`llm_request`||t?.attributes.model})?.deref();if(!n)return;let r=Date.now()-n.startTime;if(n.perfettoSpanId&&(n.perfettoSpanId,t?.ttftMs,t?.inputTokens,t?.outputTokens,t?.cacheReadTokens,t?.cacheCreationTokens,t?.success,t?.error,t?.requestSetupMs,t?.attemptStartTimes),!G()){let e=W(n.span);X.delete(e),Z.delete(e);return}let i={duration_ms:r};t&&(t.inputTokens!==void 0&&(i.input_tokens=t.inputTokens),t.outputTokens!==void 0&&(i.output_tokens=t.outputTokens),t.cacheReadTokens!==void 0&&(i.cache_read_tokens=t.cacheReadTokens),t.cacheCreationTokens!==void 0&&(i.cache_creation_tokens=t.cacheCreationTokens),t.success!==void 0&&(i.success=t.success),t.statusCode!==void 0&&(i.status_code=t.statusCode),t.error!==void 0&&(i.error=t.error),t.attempt!==void 0&&(i.attempt=t.attempt),t.hasToolCall!==void 0&&(i[`response.has_tool_call`]=t.hasToolCall),t.ttftMs!==void 0&&(i.ttft_ms=t.ttftMs),Ge(i,t)),n.span.setAttributes(i),n.span.end();let a=W(n.span);X.delete(a),Z.delete(a)}function ft(e,t,n){let r=U()?tt(e,t):void 0;if(!G()){if(r){let t=a.getActiveSpan()||K().startSpan(`dummy`),n=W(t),i={span:t,startTime:Date.now(),attributes:{"span.type":`tool`,tool_name:e},perfettoSpanId:r};return X.set(n,new WeakRef(i)),Y.enterWith(i),t}return a.getActiveSpan()||K().startSpan(`dummy`)}let i=K(),s=J.getStore(),c=q(`tool`,{tool_name:e,...t}),l=s?a.setSpan(o.active(),s.span):o.active(),u=i.startSpan(`workmate.tool`,{attributes:c},l);n&&Ke(u,e,n);let d=W(u),f={span:u,startTime:Date.now(),attributes:c,perfettoSpanId:r};return X.set(d,new WeakRef(f)),Y.enterWith(f),u}function pt(){let e=U()?nt(`tool_permission`):void 0;if(!G()){if(e){let t=a.getActiveSpan()||K().startSpan(`dummy`),n=W(t),r={span:t,startTime:Date.now(),attributes:{"span.type":`tool.blocked_on_user`},perfettoSpanId:e};return X.set(n,new WeakRef(r)),Z.set(n,r),t}return a.getActiveSpan()||K().startSpan(`dummy`)}let t=K(),n=Y.getStore(),r=q(`tool.blocked_on_user`),i=n?a.setSpan(o.active(),n.span):o.active(),s=t.startSpan(`workmate.tool.blocked_on_user`,{attributes:r},i),c=W(s),l={span:s,startTime:Date.now(),attributes:r,perfettoSpanId:e};return X.set(c,new WeakRef(l)),Z.set(c,l),s}function mt(e,t){let n=Array.from(X.values()).findLast(e=>e.deref()?.attributes[`span.type`]===`tool.blocked_on_user`)?.deref();if(!n)return;if(n.perfettoSpanId&&n.perfettoSpanId,!G()){let e=W(n.span);X.delete(e),Z.delete(e);return}let r={duration_ms:Date.now()-n.startTime};e&&(r.decision=e),t&&(r.source=t),n.span.setAttributes(r),n.span.end();let i=W(n.span);X.delete(i),Z.delete(i)}function ht(){if(!G())return a.getActiveSpan()||K().startSpan(`dummy`);let e=K(),t=Y.getStore(),n=q(`tool.execution`),r=t?a.setSpan(o.active(),t.span):o.active(),i=e.startSpan(`workmate.tool.execution`,{attributes:n},r),s=W(i),c={span:i,startTime:Date.now(),attributes:n};return X.set(s,new WeakRef(c)),Z.set(s,c),i}function gt(e){if(!G())return;let t=Array.from(X.values()).findLast(e=>e.deref()?.attributes[`span.type`]===`tool.execution`)?.deref();if(!t)return;let n={duration_ms:Date.now()-t.startTime};e&&(e.success!==void 0&&(n.success=e.success),e.error!==void 0&&(n.error=e.error)),t.span.setAttributes(n),t.span.end();let r=W(t.span);X.delete(r),Z.delete(r)}function _t(e,t){let n=Y.getStore();if(!n)return;if(n.perfettoSpanId&&n.perfettoSpanId,!G()){let e=W(n.span);X.delete(e),Y.enterWith(void 0);return}let r={duration_ms:Date.now()-n.startTime};e&&qe(r,n.attributes.tool_name||`unknown`,e),t!==void 0&&(r.result_tokens=t),n.span.setAttributes(r),n.span.end();let i=W(n.span);X.delete(i),Y.enterWith(void 0)}function vt(){return r(process.env.OTEL_LOG_TOOL_CONTENT)}function yt(e,t){if(!G()||!vt())return;let n=Y.getStore();if(!n)return;let r={};for(let[e,n]of Object.entries(t))if(typeof n==`string`){let{content:t,truncated:i}=R(n);r[e]=t,i&&(r[`${e}_truncated`]=!0,r[`${e}_original_length`]=n.length)}else r[e]=n;n.span.addEvent(e,r)}function bt(e,t,n,r){if(!L())return a.getActiveSpan()||K().startSpan(`dummy`);let i=K(),s=Y.getStore()??J.getStore(),c=q(`hook`,{hook_event:e,hook_name:t,num_hooks:n,hook_definitions:r}),l=s?a.setSpan(o.active(),s.span):o.active(),u=i.startSpan(`workmate.hook`,{attributes:c},l),d=W(u),f={span:u,startTime:Date.now(),attributes:c};return X.set(d,new WeakRef(f)),Z.set(d,f),u}function xt(e,t){if(!L())return;let n=W(e),r=X.get(n)?.deref();if(!r)return;let i={duration_ms:Date.now()-r.startTime};t&&(t.numSuccess!==void 0&&(i.num_success=t.numSuccess),t.numBlocking!==void 0&&(i.num_blocking=t.numBlocking),t.numNonBlockingError!==void 0&&(i.num_non_blocking_error=t.numNonBlockingError),t.numCancelled!==void 0&&(i.num_cancelled=t.numCancelled)),r.span.setAttributes(i),r.span.end(),X.delete(n),Z.delete(n)}var J,Y,X,Z,Q,$,St,Ct=e((()=>{s(),i(),P(),Xe(),at(),J=new v,Y=new v,X=new Map,Z=new Map,Q=0,$=!1,St=1800*1e3}));export{E as A,y as B,L as C,N as D,Ie as E,S as F,be as I,ke as L,b as M,ve as N,P as O,ye as P,he as R,Xe as S,F as T,Ze as _,mt as a,$e as b,Ct as c,ct as d,ut as f,at as g,ft as h,dt as i,j,A as k,st as l,ht as m,xt as n,gt as o,pt as p,lt as r,_t as s,yt as t,bt as u,U as v,Re as w,ze as x,Qe as y,_e as z};
@@ -0,0 +1 @@
1
+ import{m as e,s as t,y as n}from"./settings-YIDksG5Z.js";e();export{t as getSettingsForSource,n as updateSettingsForSource};
@@ -0,0 +1,24 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n,n as r,r as i,s as a,t as o}from"./isObject-C6qM3WEW.js";import{d as s,f as c,g as l,h as u,l as ee,n as d,t as f,u as te}from"./memoize-BK3gG5ob.js";import{i as p,l as m,o as ne}from"./envUtils-DZ_SvEVz.js";import{n as re,t as h}from"./defineProperty-C-QyHrDq.js";import{i as ie,r as ae}from"./isSymbol-BO6cdPI7.js";import{B as g,D as oe,E as se,I as ce,J as _,K as le,N as v,P as y,Q as ue,U as b,W as x,X as S,Y as de,Z as C,a as fe,b as w,d as pe,g as me,h as he,j as ge,k as T,l as _e,o as ve,ot as ye,q as be,r as xe,s as E,x as Se,z as Ce}from"./types-CD25a50S.js";import{$n as we,Ar as Te,Dt as Ee,Fr as De,Gr as Oe,Hr as ke,Ir as Ae,Jn as je,Kr as Me,Lr as Ne,Mr as Pe,Nr as Fe,O as Ie,Or as Le,Pr as Re,Pt as ze,Qn as Be,Ur as Ve,Wn as He,Wr as Ue,Xn as We,Yn as Ge,Zn as Ke,ci as qe,er as Je,hi as Ye,jr as Xe,k as Ze,kr as Qe,li as $e,mi as et,ni as tt,or as nt,q as rt,qr as it,ri as at,rr as ot,sr as st,tr as ct,v as lt}from"./state-CXY-q5gr.js";import{n as ut,t as D}from"./cwd-DrEEb4f5.js";import{$ as dt,C as ft,I as pt,N as mt,R as ht,S as gt,b as _t,c as O,et as vt,f as k,g as yt,i as bt,u as A,x as xt,z as St}from"./debug-kBjDaVkQ.js";import{S as Ct,o as wt,s as j,y as Tt}from"./log-DWZny1vM.js";import{i as Et,n as Dt}from"./execFileNoThrow-BfZFnCGa.js";import{a as Ot,c as kt,i as At,o as jt,r as Mt,s as Nt,t as Pt}from"./bundledMode-BxyD5cqq.js";import{i as Ft,n as M}from"./platform-Vl9IynC3.js";import{n as It}from"./analytics-COpjZpvd.js";import{n as Lt,r as Rt}from"./startupProfiler-DIM_Ihyp.js";import{f as zt,l as Bt,n as Vt,o as Ht,p as Ut}from"./stringUtils-D_xPrwGQ.js";import{homedir as Wt,userInfo as Gt}from"os";import{basename as Kt,dirname as N,extname as qt,isAbsolute as Jt,join as P,normalize as Yt,posix as Xt,relative as Zt,resolve as F,sep as I}from"path";import{chmodSync as Qt,existsSync as $t,readFileSync as en,realpathSync as tn,statSync as nn,unwatchFile as rn,watchFile as an,writeFileSync as on}from"fs";import"crypto";import{appendFile as sn,mkdir as cn,open as ln,readFile as L,readdir as un,realpath as dn,stat as fn,writeFile as pn}from"fs/promises";import{promisify as mn}from"util";import{execFile as hn}from"child_process";import*as R from"path/win32";var gn,_n=e((()=>{c(),gn=function(){try{var e=s(Object,`defineProperty`);return e({},``,{}),e}catch{}}()}));function vn(e,t,n){t==`__proto__`&&gn?gn(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var yn=e((()=>{_n()}));function bn(e,t,n){var r=e[t];(!(xn.call(e,t)&&ee(r,n))||n===void 0&&!(t in e))&&vn(e,t,n)}var xn,Sn=e((()=>{yn(),te(),xn=Object.prototype.hasOwnProperty}));function Cn(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?vn(n,s,c):bn(n,s,c)}return n}var wn=e((()=>{Sn(),yn()}));function Tn(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var En=e((()=>{}));function Dn(e){if(!r(e))return Tn(e);var t=Fe(e),n=[];for(var i in e)i==`constructor`&&(t||!On.call(e,i))||n.push(i);return n}var On,kn=e((()=>{o(),Pe(),En(),On=Object.prototype.hasOwnProperty}));function An(e){return Qe(e)?Re(e,!0):Dn(e)}var jn=e((()=>{De(),kn(),Le()}));function Mn(e,t){if(t)return e.slice();var n=e.length,r=In?In(n):new e.constructor(n);return e.copy(r),r}var Nn,Pn,Fn,In,Ln=e((()=>{a(),Nn=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Pn=Nn&&typeof module==`object`&&module&&!module.nodeType&&module,Fn=Pn&&Pn.exports===Nn?t.Buffer:void 0,In=Fn?Fn.allocUnsafe:void 0}));function Rn(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var zn=e((()=>{})),Bn,Vn=e((()=>{Te(),Bn=Xe(Object.getPrototypeOf,Object)}));function Hn(e){var t=new e.constructor(e.byteLength);return new qe(t).set(new qe(e)),t}var Un=e((()=>{$e()}));function Wn(e,t){var n=t?Hn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Gn=e((()=>{Un()})),Kn,qn,Jn=e((()=>{o(),Kn=Object.create,qn=function(){function e(){}return function(t){if(!r(t))return{};if(Kn)return Kn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}()}));function Yn(e){return typeof e.constructor==`function`&&!Fe(e)?qn(Bn(e)):{}}var Xn=e((()=>{Jn(),Vn(),Pe()}));function z(e,t,n){let r=Zn();if(!r)return;let i={timestamp:new Date().toISOString(),level:e,event:t,data:n??{}},a=A(),o=`${ft(i)}\n`;try{a.appendFileSync(r,o)}catch{try{a.mkdirSync(N(r)),a.appendFileSync(r,o)}catch{}}}function Zn(){return process.env.WORKMATE_DIAGNOSTICS_FILE}async function Qn(e,t,n){let r=Date.now();z(`info`,`${e}_started`);try{let i=await t(),a=n?n(i):{};return z(`info`,`${e}_completed`,{duration_ms:Date.now()-r,...a}),i}catch(t){throw z(`error`,`${e}_failed`,{duration_ms:Date.now()-r}),t}}var $n=e((()=>{k(),xt()}));async function er(e,t,n,r){try{return tr(await L(P(e,`config`),`utf-8`),t,n,r)}catch{return null}}function tr(e,t,n,r){let i=e.split(`
2
+ `),a=t.toLowerCase(),o=r.toLowerCase(),s=!1;for(let e of i){let t=e.trim();if(t.length===0||t[0]===`#`||t[0]===`;`)continue;if(t[0]===`[`){s=ar(t,a,n);continue}if(!s)continue;let r=nr(t);if(r&&r.key.toLowerCase()===o)return r.value}return null}function nr(e){let t=0;for(;t<e.length&&or(e[t]);)t++;if(t===0)return null;let n=e.slice(0,t);for(;t<e.length&&(e[t]===` `||e[t]===` `);)t++;if(t>=e.length||e[t]!==`=`)return null;for(t++;t<e.length&&(e[t]===` `||e[t]===` `);)t++;return{key:n,value:rr(e,t)}}function rr(e,t){let n=``,r=!1,i=t;for(;i<e.length;){let t=e[i];if(!r&&(t===`#`||t===`;`))break;if(t===`"`){r=!r,i++;continue}if(t===`\\`&&i+1<e.length){let t=e[i+1];if(r){switch(t){case`n`:n+=`
3
+ `;break;case`t`:n+=` `;break;case`b`:n+=`\b`;break;case`"`:n+=`"`;break;case`\\`:n+=`\\`;break;default:n+=t;break}i+=2;continue}if(t===`\\`){n+=`\\`,i+=2;continue}}n+=t,i++}return r||(n=ir(n)),n}function ir(e){let t=e.length;for(;t>0&&(e[t-1]===` `||e[t-1]===` `);)t--;return e.slice(0,t)}function ar(e,t,n){let r=1;for(;r<e.length&&e[r]!==`]`&&e[r]!==` `&&e[r]!==` `&&e[r]!==`"`;)r++;if(e.slice(1,r).toLowerCase()!==t)return!1;if(n===null)return r<e.length&&e[r]===`]`;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r>=e.length||e[r]!==`"`)return!1;r++;let i=``;for(;r<e.length&&e[r]!==`"`;){if(e[r]===`\\`&&r+1<e.length){let t=e[r+1];if(t===`\\`||t===`"`){i+=t,r+=2;continue}i+=t,r+=2;continue}i+=e[r],r++}return r>=e.length||e[r]!==`"`||(r++,r>=e.length||e[r]!==`]`)?!1:i===n}function or(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`-`}var sr=e((()=>{}));function cr(){H.clear()}async function B(e){let t=F(e??D()),n=H.get(t);if(n!==void 0)return n;let r=Fr(t);if(!r)return H.set(t,null),null;let i=P(r,`.git`);try{if((await fn(i)).isFile()){let e=(await L(i,`utf-8`)).trim();if(e.startsWith(`gitdir:`)){let n=F(r,e.slice(7).trim());return H.set(t,n),n}}return H.set(t,i),i}catch{return H.set(t,null),null}}function lr(e){return!(!e||e.startsWith(`-`)||e.startsWith(`/`)||e.includes(`..`)||e.split(`/`).some(e=>e===`.`||e===``)||!/^[a-zA-Z0-9/._+@-]+$/.test(e))}function ur(e){return/^[0-9a-f]{40}$/.test(e)||/^[0-9a-f]{64}$/.test(e)}async function dr(e){try{let t=(await L(P(e,`HEAD`),`utf-8`)).trim();if(t.startsWith(`ref:`)){let n=t.slice(4).trim();if(n.startsWith(`refs/heads/`)){let e=n.slice(11);return lr(e)?{type:`branch`,name:e}:null}if(!lr(n))return null;let r=await fr(e,n);return r?{type:`detached`,sha:r}:{type:`detached`,sha:``}}return ur(t)?{type:`detached`,sha:t}:null}catch{return null}}async function fr(e,t){let n=await pr(e,t);if(n)return n;let r=await V(e);return r&&r!==e?pr(r,t):null}async function pr(e,t){try{let n=(await L(P(e,t),`utf-8`)).trim();if(n.startsWith(`ref:`)){let t=n.slice(4).trim();return lr(t)?fr(e,t):null}return ur(n)?n:null}catch{}try{let n=await L(P(e,`packed-refs`),`utf-8`);for(let e of n.split(`
4
+ `)){if(e.startsWith(`#`)||e.startsWith(`^`))continue;let n=e.indexOf(` `);if(n!==-1&&e.slice(n+1)===t){let t=e.slice(0,n);return ur(t)?t:null}}}catch{}return null}async function V(e){try{return F(e,(await L(P(e,`commondir`),`utf-8`)).trim())}catch{return null}}async function mr(e,t,n){try{let r=(await L(P(e,t),`utf-8`)).trim();if(r.startsWith(`ref:`)){let e=r.slice(4).trim();if(e.startsWith(n)){let t=e.slice(n.length);return lr(t)?t:null}}}catch{}return null}async function hr(){let e=await B();if(!e)return`HEAD`;let t=await dr(e);return t&&t.type===`branch`?t.name:`HEAD`}async function gr(){let e=await B();if(!e)return null;let t=await er(e,`remote`,`origin`,`url`);if(t)return t;let n=await V(e);return n&&n!==e?er(n,`remote`,`origin`,`url`):null}async function _r(){let e=await B();if(!e)return`main`;let t=await V(e)??e,n=await mr(t,`refs/remotes/origin/HEAD`,`refs/remotes/origin/`);if(n)return n;for(let e of[`main`,`master`])if(await fr(t,`refs/remotes/origin/${e}`))return e;return`main`}function vr(){return Dr.get(`branch`,hr)}function yr(){return Dr.get(`remoteUrl`,gr)}function br(){return Dr.get(`defaultBranch`,_r)}async function xr(e){let t=await B(e);if(!t)return null;let n=await dr(t);return n?n.type===`branch`?fr(t,`refs/heads/${n.name}`):n.sha:null}async function Sr(e){let t;try{let n=(await L(P(e,`.git`),`utf-8`)).trim();if(!n.startsWith(`gitdir:`))return null;t=F(e,n.slice(7).trim())}catch{return null}let n=await dr(t);return n?n.type===`branch`?fr(t,`refs/heads/${n.name}`):n.sha:null}async function Cr(e){let t=await B(e);if(!t)return null;let n=await er(t,`remote`,`origin`,`url`);if(n)return n;let r=await V(t);return r&&r!==t?er(r,`remote`,`origin`,`url`):null}async function wr(){try{let e=await B();return e?(await un(P(await V(e)??e,`worktrees`))).length+1:0}catch{return 1}}var H,Tr,Er,Dr,Or=e((()=>{ze(),dt(),ut(),Gr(),sr(),re(),H=new Map,Tr=1e3,Er=class{constructor(){h(this,`gitDir`,null),h(this,`commonDir`,null),h(this,`initialized`,!1),h(this,`initPromise`,null),h(this,`watchedPaths`,[]),h(this,`branchRefPath`,null),h(this,`cache`,new Map)}async ensureStarted(){if(!this.initialized)return this.initPromise||(this.initPromise=this.start()),this.initPromise}async start(){this.gitDir=await B(),this.initialized=!0,this.gitDir&&(this.commonDir=await V(this.gitDir),this.watchPath(P(this.gitDir,`HEAD`),()=>{this.onHeadChanged()}),this.watchPath(P(this.commonDir??this.gitDir,`config`),()=>{this.invalidate()}),await this.watchCurrentBranchRef(),vt(async()=>{this.stopWatching()}))}watchPath(e,t){this.watchedPaths.push(e),an(e,{interval:Tr},t)}async watchCurrentBranchRef(){if(!this.gitDir)return;let e=await dr(this.gitDir),t=this.commonDir??this.gitDir,n=e?.type===`branch`?P(t,`refs`,`heads`,e.name):null;n!==this.branchRefPath&&(this.branchRefPath&&(rn(this.branchRefPath),this.watchedPaths=this.watchedPaths.filter(e=>e!==this.branchRefPath)),this.branchRefPath=n,n&&this.watchPath(n,()=>{this.invalidate()}))}async onHeadChanged(){this.invalidate(),await He(),await this.watchCurrentBranchRef()}invalidate(){for(let e of this.cache.values())e.dirty=!0}stopWatching(){for(let e of this.watchedPaths)rn(e);this.watchedPaths=[],this.branchRefPath=null}async get(e,t){await this.ensureStarted();let n=this.cache.get(e);if(n&&!n.dirty)return n.value;n&&(n.dirty=!1);let r=await t(),i=this.cache.get(e);return i&&!i.dirty&&(i.value=r),i||this.cache.set(e,{value:r,dirty:!1,compute:t}),r}reset(){this.stopWatching(),this.cache.clear(),this.initialized=!1,this.initPromise=null,this.gitDir=null,this.commonDir=null}},Dr=new Er}));function kr(){function e(e){let t=Pr(e);return t===Nr?null:t}return e.cache=Pr.cache,e}function Ar(){function e(e){let t=Fr(e);return t?Ir(t):null}return e.cache=Ir.cache,e}function jr(e){return B(e)}function Mr(){let e=A(),t=D(),n=P(t,`.git`);try{let t=e.statSync(n);if(t.isFile())return!1;if(t.isDirectory()){let t=P(n,`HEAD`);try{if(e.statSync(t).isFile())return!1}catch{}}}catch{}try{if(e.statSync(P(t,`HEAD`)).isFile())return!0}catch{}try{if(e.statSync(P(t,`objects`)).isDirectory())return!0}catch{}try{if(e.statSync(P(t,`refs`)).isDirectory())return!0}catch{}return!1}var Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr=e((()=>{f(),ut(),bt(),$n(),Et(),k(),Or(),he(),At(),Nr=Symbol(`git-root-not-found`),Pr=me(e=>{let t=Date.now();z(`info`,`find_git_root_started`);let n=F(e),r=n.substring(0,n.indexOf(I)+1)||I,i=0;for(;n!==r;){try{let e=P(n,`.git`);i++;let r=nn(e);if(r.isDirectory()||r.isFile())return z(`info`,`find_git_root_completed`,{duration_ms:Date.now()-t,stat_count:i,found:!0}),n.normalize(`NFC`)}catch{}let e=N(n);if(e===n)break;n=e}try{let e=P(r,`.git`);i++;let n=nn(e);if(n.isDirectory()||n.isFile())return z(`info`,`find_git_root_completed`,{duration_ms:Date.now()-t,stat_count:i,found:!0}),r.normalize(`NFC`)}catch{}return z(`info`,`find_git_root_completed`,{duration_ms:Date.now()-t,stat_count:i,found:!1}),Nr},e=>e,50),Fr=kr(),Ir=me(e=>{try{let t=en(P(e,`.git`),`utf-8`).trim();if(!t.startsWith(`gitdir:`))return e;let n=F(e,t.slice(7).trim()),r=F(n,en(P(n,`commondir`),`utf-8`).trim());return F(N(n))!==P(r,`worktrees`)||tn(en(P(n,`gitdir`),`utf-8`).trim())!==P(tn(e),`.git`)?e:Kt(r)===`.git`?N(r).normalize(`NFC`):r.normalize(`NFC`)}catch{return e}},e=>e,50),Lr=Ar(),Rr=d(()=>jt(`git`)||`git`),zr=d(async()=>{let e=Date.now();z(`info`,`is_git_check_started`);let t=Fr(D())!==null;return z(`info`,`is_git_check_completed`,{duration_ms:Date.now()-e,is_git:t}),t}),Br=async e=>Fr(e)!==null,Vr=async()=>vr(),Hr=async()=>br(),Ur=async()=>yr(),Wr=async()=>wr()}));function Kr(){if(M()===`windows`){let e=Xr();process.env.SHELL=e,process.env.WORKMATE_GIT_BASH_PATH=e,O(`Using bash path: "${e}"`)}}function qr(e,t){let n=[`C:\\Program Files\\Git\\bin\\bash.exe`,`C:\\Program Files\\Git\\usr\\bin\\bash.exe`,`C:\\Program Files (x86)\\Git\\bin\\bash.exe`,`C:\\Program Files (x86)\\Git\\usr\\bin\\bash.exe`];t&&n.push(`${t}\\scoop\\apps\\git\\current\\usr\\bin\\bash.exe`);for(let t of n)if(e(t))return t;return null}function Jr(e,t){if(e===`git`){for(let e of[`C:\\Program Files\\Git\\cmd\\git.exe`,`C:\\Program Files (x86)\\Git\\cmd\\git.exe`])if(t.checkExists(e))return e}try{let n=t.execCommand(`where.exe ${e}`).split(/\r?\n/).map(e=>e.trim()).filter(Boolean),r=R.resolve(t.cwdFn()).toLowerCase();for(let e of n){let t=R.resolve(e).toLowerCase(),n=R.dirname(t).toLowerCase(),i=R.relative(r,n);if(i===``||!i.startsWith(`..`)&&!R.isAbsolute(i)){O(`Skipping potentially malicious executable in current directory: ${e}`);continue}return e}return null}catch{return null}}function Yr(e=Zr){let t=e.envOverride??process.env.WORKMATE_GIT_BASH_PATH;if(t)return e.checkExists(t)?t:null;let n=Jr(`bash`,e);if(n&&e.checkExists(n))return n;let r=Jr(`git`,e);if(r){let t=[R.join(r,`..`,`..`,`bin`,`bash.exe`),R.join(r,`..`,`..`,`usr`,`bin`,`bash.exe`),R.join(r,`..`,`bash.exe`)];for(let n of t)if(e.checkExists(n))return n}return qr(e.checkExists,e.userProfile)}function Xr(){let e=Qr();if(e!==null)return e;let t=process.env.WORKMATE_GIT_BASH_PATH;console.error(t?`Work Mate was unable to find WORKMATE_GIT_BASH_PATH path "${t}"`:`Work Mate on Windows requires git-bash (https://git-scm.com/downloads/win). If installed but not in PATH, set environment variable pointing to your bash.exe, similar to: WORKMATE_GIT_BASH_PATH=C:\\Program Files\\Git\\bin\\bash.exe`),process.exit(1)}var Zr,Qr,$r,ei,ti=e((()=>{f(),ut(),bt(),kt(),he(),Ft(),Zr={checkExists:$t,execCommand:e=>Nt(e,{stdio:`pipe`,encoding:`utf8`}).trim(),cwdFn:D,userProfile:process.env.USERPROFILE,envOverride:void 0},Qr=d(()=>Yr()),$r=me(e=>{if(e.startsWith(`\\\\`))return e.replace(/\\/g,`/`);let t=e.match(/^([A-Za-z]):[/\\]/);return t?`/${t[1].toLowerCase()}${e.slice(2).replace(/\\/g,`/`)}`:e.replace(/\\/g,`/`)},e=>e,500),ei=me(e=>{if(e.startsWith(`//`))return e.replace(/\//g,`\\`);let t=e.match(/^\/cygdrive\/([A-Za-z])(\/|$)/);if(t)return`${t[1].toUpperCase()}:${(e.slice(`/cygdrive/${t[1]}`.length)||`\\`).replace(/\//g,`\\`)}`;let n=e.match(/^\/([A-Za-z])(\/|$)/);return n?`${n[1].toUpperCase()}:${(e.slice(2)||`\\`).replace(/\//g,`\\`)}`:e.replace(/\//g,`\\`)},e=>e,500)}));async function ni(e){try{let{stdout:t}=await ri(`git`,[`worktree`,`list`,`--porcelain`],{cwd:e,timeout:5e3});return t?t.split(`
5
+ `).filter(e=>e.startsWith(`worktree `)).map(e=>e.slice(9).normalize(`NFC`)):[]}catch{return[]}}var ri,ii=e((()=>{ri=mn(hn)}));function ai(e){return typeof e==`string`&&Oi.test(e)?e:null}function oi(e){if(!e.includes(`\\`))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function si(e,t){let n=[`"${t}":"`,`"${t}": "`];for(let t of n){let n=e.indexOf(t);if(n<0)continue;let r=n+t.length,i=r;for(;i<e.length;){if(e[i]===`\\`){i+=2;continue}if(e[i]===`"`)return oi(e.slice(r,i));i++}}}function ci(e,t){let n=[`"${t}":"`,`"${t}": "`],r;for(let t of n){let n=0;for(;;){let i=e.indexOf(t,n);if(i<0)break;let a=i+t.length,o=a;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]===`"`){r=oi(e.slice(a,o));break}o++}n=o+1}}return r}function li(e){let t=0,n=``;for(;t<e.length;){let r=e.indexOf(`
6
+ `,t),i=r>=0?e.slice(t,r):e.slice(t);if(t=r>=0?r+1:e.length,!(!i.includes(`"type":"user"`)&&!i.includes(`"type": "user"`))&&!i.includes(`"tool_result"`)&&!(i.includes(`"isMeta":true`)||i.includes(`"isMeta": true`))&&!(i.includes(`"isCompactSummary":true`)||i.includes(`"isCompactSummary": true`)))try{let e=JSON.parse(i);if(e.type!==`user`)continue;let t=e.message;if(!t)continue;let r=t.content,a=[];if(typeof r==`string`)a.push(r);else if(Array.isArray(r))for(let e of r)e.type===`text`&&typeof e.text==`string`&&a.push(e.text);for(let e of a){let t=e.replace(/\n/g,` `).trim();if(!t)continue;let r=Ai.exec(t);if(r){n||(n=r[1]);continue}let i=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(t);if(i)return`! ${i[1].trim()}`;if(!ki.test(t))return t.length>200&&(t=`${t.slice(0,200).trim()}\u2026`),t}}catch{}}return n||``}async function ui(e,t,n){try{let r=await ln(e,`r`);try{let e=await r.read(n,0,W,0);if(e.bytesRead===0)return{head:``,tail:``};let i=n.toString(`utf8`,0,e.bytesRead),a=Math.max(0,t-W),o=i;if(a>0){let e=await r.read(n,0,W,a);o=n.toString(`utf8`,0,e.bytesRead)}return{head:i,tail:o}}finally{await r.close()}}catch{return{head:``,tail:``}}}async function di(e){try{let t=await ln(e,`r`);try{let e=await t.stat(),n=Buffer.allocUnsafe(W),r=await t.read(n,0,W,0);if(r.bytesRead===0)return null;let i=n.toString(`utf8`,0,r.bytesRead),a=Math.max(0,e.size-W),o=i;if(a>0){let e=await t.read(n,0,W,a);o=n.toString(`utf8`,0,e.bytesRead)}return{mtime:e.mtime.getTime(),size:e.size,head:i,tail:o}}finally{await t.close()}}catch{return null}}function fi(e){return Math.abs(Tt(e)).toString(36)}function pi(e){let t=e.replace(/[^a-zA-Z0-9]/g,`-`);if(t.length<=200)return t;let n=typeof Bun<`u`?Bun.hash(e).toString(36):fi(e);return`${t.slice(0,200)}-${n}`}function mi(){return P(p(),`projects`)}function hi(e){return P(mi(),pi(e))}async function gi(e){try{return(await dn(e)).normalize(`NFC`)}catch{return e.normalize(`NFC`)}}async function _i(e){let t=hi(e);try{return await un(t),t}catch{let t=pi(e);if(t.length<=200)return;let n=t.slice(0,200),r=mi();try{let e=(await un(r,{withFileTypes:!0})).find(e=>e.isDirectory()&&e.name.startsWith(`${n}-`));return e?P(r,e.name):void 0}catch{return}}}async function vi(e,t){let n=`${e}.jsonl`;if(t){let e=await gi(t),r=await _i(e);if(r){let t=P(r,n);try{let n=await fn(t);if(n.size>0)return{filePath:t,projectPath:e,fileSize:n.size}}catch{}}let i;try{i=await ni(e)}catch{i=[]}for(let t of i){if(t===e)continue;let r=await _i(t);if(!r)continue;let i=P(r,n);try{let e=await fn(i);if(e.size>0)return{filePath:i,projectPath:t,fileSize:e.size}}catch{}}return}let r=mi(),i;try{i=await un(r)}catch{return}for(let e of i){let t=P(r,e,n);try{let e=await fn(t);if(e.size>0)return{filePath:t,projectPath:void 0,fileSize:e.size}}catch{}}}function yi(){return Ni??(Ni=Buffer.from(`"compact_boundary"`))}function bi(e){try{let t=JSON.parse(e);return t.type!==`system`||t.subtype!==`compact_boundary`?null:{hasPreservedSegment:!!t.compactMetadata?.preservedSegment}}catch{return null}}function U(e,t,n,r){let i=r-n;if(!(i<=0)){if(e.len+i>e.buf.length){let t=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+i),e.cap));e.buf.copy(t,0,0,e.len),e.buf=t}t.copy(e.buf,e.len,n,r),e.len+=i}}function xi(e,t,n,r){return r-n>=t.length&&e.compare(t,0,t.length,n,n+t.length)===0}function Si(e,t,n){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let r=e.carryBuf,i=t.indexOf(Ii);if(i===-1||i>=n)return 0;let a=i+1;if(xi(r,Pi,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=a,e.lastSnapSrc=null;else if(e.carryLen<Pi.length)return 0;else{if(xi(r,Fi,0,e.carryLen)){let n=bi(r.toString(`utf-8`,0,e.carryLen)+t.toString(`utf-8`,0,i));n?.hasPreservedSegment?e.hasPreservedSegment=!0:n&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null)}U(e.out,r,0,e.carryLen),U(e.out,t,0,a)}return e.bufFileOff+=e.carryLen+a,e.carryLen=0,a}function Ci(e,t,n){let r=t.indexOf(n),i=0,a=0,o=-1,s=-1,c=t.indexOf(Ii);for(;c!==-1;){let l=c+1;if(r!==-1&&r<a&&(r=t.indexOf(n,a)),xi(t,Pi,a,l))U(e.out,t,i,a),o=a,s=l,i=l;else if(r>=a&&r<Math.min(a+Ri,l)){let s=bi(t.toString(`utf-8`,a,c));s?.hasPreservedSegment?e.hasPreservedSegment=!0:s&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff+a,e.hasPreservedSegment=!1,e.lastSnapSrc=null,o=-1,e.straddleSnapCarryLen=0,i=a),r=t.indexOf(n,r+n.length)}a=l,c=t.indexOf(Ii,a)}return U(e.out,t,i,a),{lastSnapStart:o,lastSnapEnd:s,trailStart:a}}function wi(e,t,n,r,i){r===-1?e.straddleSnapCarryLen>0&&(e.lastSnapLen=e.straddleSnapCarryLen+e.straddleSnapTailEnd,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),e.carryBuf.copy(e.lastSnapBuf,0,0,e.straddleSnapCarryLen),n.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf):(e.lastSnapLen=i-r,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),t.copy(e.lastSnapBuf,0,r,i),e.lastSnapSrc=e.lastSnapBuf)}function Ti(e,t,n){e.carryLen=t.length-n,e.carryLen>0&&((e.carryBuf===void 0||e.carryLen>e.carryBuf.length)&&(e.carryBuf=Buffer.allocUnsafe(e.carryLen)),t.copy(e.carryBuf,0,n,t.length))}function Ei(e){if(e.carryLen>0){let t=e.carryBuf;xi(t,Pi,0,e.carryLen)?(e.lastSnapSrc=t,e.lastSnapLen=e.carryLen):U(e.out,t,0,e.carryLen)}e.lastSnapSrc&&(e.out.len>0&&e.out.buf[e.out.len-1]!==Ii&&U(e.out,Li,0,1),U(e.out,e.lastSnapSrc,0,e.lastSnapLen))}async function Di(e,t){let n=yi(),r=ji,i={out:{buf:Buffer.allocUnsafe(Math.min(t,8*1024*1024)),len:0,cap:t+1},boundaryStartOffset:0,hasPreservedSegment:!1,lastSnapSrc:null,lastSnapLen:0,lastSnapBuf:void 0,bufFileOff:0,carryLen:0,carryBuf:void 0,straddleSnapCarryLen:0,straddleSnapTailEnd:0},a=Buffer.allocUnsafe(r),o=await ln(e,`r`);try{let e=0;for(;e<t;){let{bytesRead:s}=await o.read(a,0,Math.min(r,t-e),e);if(s===0)break;e+=s;let c=Si(i,a,s),l;if(i.carryLen>0){let e=i.carryLen+(s-c);l=Buffer.allocUnsafe(e),i.carryBuf.copy(l,0,0,i.carryLen),a.copy(l,i.carryLen,c,s)}else l=a.subarray(c,s);let u=Ci(i,l,n);wi(i,l,a,u.lastSnapStart,u.lastSnapEnd),Ti(i,l,u.trailStart),i.bufFileOff+=u.trailStart}Ei(i)}finally{await o.close()}return{boundaryStartOffset:i.boundaryStartOffset,postBoundaryBuf:i.out.buf.subarray(0,i.out.len),hasPreservedSegment:i.hasPreservedSegment}}var W,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi=e((()=>{ne(),ii(),Ct(),W=65536,Oi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ki=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,Ai=/<command-name>(.*?)<\/command-name>/,ji=1024*1024,Mi=5*1024*1024,Pi=Buffer.from(`{"type":"attribution-snapshot"`),Fi=Buffer.from(`{"type":"system"`),Ii=10,Li=Buffer.from([Ii]),Ri=256}));function Bi(e,t){let n=t??D()??A().cwd();if(typeof e!=`string`)throw TypeError(`Path must be a string, received ${typeof e}`);if(typeof n!=`string`)throw TypeError(`Base directory must be a string, received ${typeof n}`);if(e.includes(`\0`)||n.includes(`\0`))throw Error(`Path contains null bytes`);let r=e=>e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e),i=e.trim();if(!i)return M()===`windows`&&r(n)?Xt.normalize(n).normalize(`NFC`):Yt(n).normalize(`NFC`);if(i===`~`)return Wt().normalize(`NFC`);if(i.startsWith(`~/`))return P(Wt(),i.slice(2)).normalize(`NFC`);let a=i;if(M()===`windows`&&i.match(/^\/[a-z]\//i))try{a=ei(i)}catch{a=i}return Jt(a)?M()===`windows`&&r(a)?Xt.normalize(a).normalize(`NFC`):Yt(a).normalize(`NFC`):M()===`windows`&&r(n)&&!/^[A-Za-z]:/.test(a)&&!a.startsWith(`\\\\`)?Xt.resolve(n,a).normalize(`NFC`):F(n,a).normalize(`NFC`)}function Vi(e){let t=Zt(D(),e);return t.startsWith(`..`)?e:t}function Hi(e){let t=Bi(e);if(t.startsWith(`\\\\`)||t.startsWith(`//`))return N(t);try{if(A().statSync(t).isDirectory())return t}catch{}return N(t)}function Ui(e){return/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(e)}function Wi(e){return Yt(e).replace(/\\/g,`/`)}var Gi=e((()=>{ut(),k(),Ft(),ti(),zi()}));function Ki(e,t,n){(n!==void 0&&!ee(e[t],n)||n===void 0&&!(t in e))&&vn(e,t,n)}var qi=e((()=>{yn(),te()}));function Ji(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var Yi=e((()=>{})),Xi,Zi=e((()=>{Yi(),Xi=Ji()}));function Qi(e){return ie(e)&&Qe(e)}var $i=e((()=>{Le(),ae()}));function ea(e){if(!ie(e)||i(e)!=ta)return!1;var t=Bn(e);if(t===null)return!0;var n=aa.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ia.call(n)==oa}var ta,na,ra,ia,aa,oa,sa=e((()=>{n(),Vn(),ae(),ta=`[object Object]`,na=Function.prototype,ra=Object.prototype,ia=na.toString,aa=ra.hasOwnProperty,oa=ia.call(Object)}));function ca(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var la=e((()=>{}));function ua(e){return Cn(e,An(e))}var da=e((()=>{wn(),jn()}));function fa(e,t,n,i,a,o,s){var c=ca(e,n),u=ca(t,n),ee=s.get(u);if(ee){Ki(e,n,ee);return}var d=o?o(c,u,n+``,e,t,s):void 0,f=d===void 0;if(f){var te=at(u),p=!te&&Oe(u),m=!te&&!p&&Ne(u);d=u,te||p||m?at(c)?d=c:Qi(c)?d=Rn(c):p?(f=!1,d=Mn(u,!0)):m?(f=!1,d=Wn(u,!0)):d=[]:ea(u)||it(u)?(d=c,it(c)?d=ua(c):(!r(c)||l(c))&&(d=Yn(u))):f=!1}f&&(s.set(u,d),a(d,u,i,o,s),s.delete(u)),Ki(e,n,d)}var pa=e((()=>{qi(),Ln(),Gn(),zn(),Xn(),Me(),tt(),$i(),Ue(),u(),o(),sa(),Ae(),la(),da()}));function ma(e,t,n,i,a){e!==t&&Xi(t,function(o,s){if(a||(a=new et),r(o))fa(e,t,s,n,ma,i,a);else{var c=i?i(ca(e,s),o,s+``,e,t,a):void 0;c===void 0&&(c=o),Ki(e,s,c)}},An)}var ha=e((()=>{Ye(),qi(),Zi(),pa(),o(),jn(),la()}));function ga(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var _a=e((()=>{}));function va(e,t,n){return t=ya(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=ya(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),ga(e,this,s)}}var ya,ba=e((()=>{_a(),ya=Math.max}));function xa(e){return function(){return e}}var Sa=e((()=>{})),Ca,wa=e((()=>{Sa(),_n(),st(),Ca=gn?function(e,t){return gn(e,`toString`,{configurable:!0,enumerable:!1,value:xa(t),writable:!0})}:nt}));function Ta(e){var t=0,n=0;return function(){var r=Oa(),i=Da-(r-n);if(n=r,i>0){if(++t>=Ea)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Ea,Da,Oa,ka=e((()=>{Ea=800,Da=16,Oa=Date.now})),Aa,ja=e((()=>{wa(),ka(),Aa=Ta(Ca)}));function Ma(e,t){return Aa(va(e,t,nt),e+``)}var Na=e((()=>{st(),ba(),ja()}));function Pa(e,t,n){if(!r(n))return!1;var i=typeof t;return(i==`number`?Qe(n)&&Ve(t,n.length):i==`string`&&t in n)?ee(n[t],e):!1}var Fa=e((()=>{te(),Le(),ke(),o()}));function Ia(e){return Ma(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Pa(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var La=e((()=>{Na(),Fa()})),G,Ra=e((()=>{ha(),La(),G=Ia(function(e,t,n,r){ma(e,t,n,r)})}));function za(e,t){return e.flatMap((e,n)=>n?[t(n),e]:[e])}function Ba(e,t){let n=0;for(let r of e)n+=+!!t(r);return n}function Va(e){return[...new Set(e)]}var Ha=e((()=>{}));function Ua(e){let{buffer:t,bytesRead:n}=A().readSync(e,{length:4096});return n===0?`utf8`:n>=2&&t[0]===255&&t[1]===254?`utf16le`:(n>=3&&t[0]===239&&t[1]===187&&t[2],`utf8`)}function Wa(e){let t=0,n=0;for(let r=0;r<e.length;r++)e[r]===`
7
+ `&&(r>0&&e[r-1]===`\r`?t++:n++);return t>n?`CRLF`:`LF`}function Ga(e){let t=A(),{resolvedPath:n,isSymlink:r}=yt(t,e);r&&O(`Reading through symlink: ${e} -> ${n}`);let i=Ua(n),a=t.readFileSync(n,{encoding:i}),o=Wa(a.slice(0,4096));return{content:a.replaceAll(`\r
8
+ `,`
9
+ `),encoding:i,lineEndings:o}}function Ka(e){return Ga(e).content}var qa=e((()=>{bt(),k()})),Ja,Ya,Xa=e((()=>{bo(),k(),re(),Ja=class{constructor(){h(this,`cache`,new Map),h(this,`maxCacheSize`,1e3)}readFile(e){let t=A(),n;try{n=t.statSync(e)}catch(t){throw this.cache.delete(e),t}let r=e,i=this.cache.get(r);if(i&&i.mtime===n.mtimeMs)return{content:i.content,encoding:i.encoding};let a=no(e),o=t.readFileSync(e,{encoding:a}).replaceAll(`\r
10
+ `,`
11
+ `);if(this.cache.set(r,{content:o,encoding:a,mtime:n.mtimeMs}),this.cache.size>this.maxCacheSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}return{content:o,encoding:a}}clear(){this.cache.clear()}invalidate(e){this.cache.delete(e)}getStats(){return{size:this.cache.size,entries:Array.from(this.cache.keys())}}},Ya=new Ja}));async function Za(e){try{return await fn(e),!0}catch{return!1}}function Qa(e){try{return A().readFileSync(e,{encoding:`utf8`})}catch(e){return j(e),null}}function $a(e){let t=A();return Math.floor(t.statSync(e).mtimeMs)}async function eo(e){let t=await A().stat(e);return Math.floor(t.mtimeMs)}function to(e,t,n,r){let i=t;r===`CRLF`&&(i=t.replaceAll(`\r
12
+ `,`
13
+ `).split(`
14
+ `).join(`\r
15
+ `)),ho(e,i,{encoding:n})}function no(e){try{let{resolvedPath:t}=yt(A(),e);return Ua(t)}catch(e){return St(e)?O(`detectFileEncoding failed for expected reason: ${e.code}`,{level:`debug`}):j(e),`utf8`}}function ro(e,t=`utf8`){try{let n=A(),{resolvedPath:r}=yt(n,e),{buffer:i,bytesRead:a}=n.readSync(r,{length:4096});return Wa(i.toString(t,0,a))}catch(e){return j(e),`LF`}}function io(e){return e.includes(` `)?e.replace(/^\t+/gm,e=>` `.repeat(e.length)):e}function ao(e){let t=e?Bi(e):void 0;return{absolutePath:t,relativePath:t?Zt(D(),t):void 0}}function oo(e){let{relativePath:t}=ao(e);if(t&&!t.startsWith(`..`))return t;let n=Wt();return e.startsWith(n+I)?`~${e.slice(n.length)}`:e}function so(e){let t=A();try{let n=N(e),r=Kt(e,qt(e)),i=t.readdirSync(n).filter(t=>Kt(t.name,qt(t.name))===r&&P(n,t.name)!==e)[0];return i?i.name:void 0}catch(e){ht(e)||j(e);return}}async function co(e){let t=D(),n=N(t),r=e;try{r=P(await dn(N(e)),Kt(e))}catch{}let i=n===I?I:n+I;if(!r.startsWith(i)||r.startsWith(t+I)||r===t)return;let a=P(t,Zt(n,r));try{return await fn(a),a}catch{return}}function lo(){return!0}function uo({content:e,startLine:t}){if(!e)return``;let n=e.split(/\r?\n/);return lo()?n.map((e,n)=>`${n+t}\t${e}`).join(`
16
+ `):n.map((e,n)=>{let r=String(n+t);return r.length>=6?`${r}→${e}`:`${r.padStart(6,` `)}→${e}`}).join(`
17
+ `)}function fo(e){return e.match(/^\s*\d+[\u2192\t](.*)$/)?.[1]??e}function po(e){try{return A().isDirEmptySync(e)}catch(e){return ht(e)}}function mo(e){let{content:t}=Ya.readFile(e);return t}function ho(e,t,n={encoding:`utf-8`}){let r=A(),i=e;try{let t=r.readlinkSync(e);i=Jt(t)?t:F(N(e),t),O(`Writing through symlink: ${e} -> ${i}`)}catch{}let a=`${i}.tmp.${process.pid}.${Date.now()}`,o,s=!1;try{o=r.statSync(i).mode,s=!0,O(`Preserving file permissions: ${o.toString(8)}`)}catch(e){if(!ht(e))throw e;n.mode!==void 0&&(o=n.mode,O(`Setting permissions for new file: ${o.toString(8)}`))}try{O(`Writing to temp file: ${a}`);let e={encoding:n.encoding,flush:!0};!s&&n.mode!==void 0&&(e.mode=n.mode),on(a,t,e),O(`Temp file written successfully, size: ${t.length} bytes`),s&&o!==void 0&&(Qt(a,o),O(`Applied original permissions to temp file`)),O(`Renaming ${a} to ${i}`),r.renameSync(a,i),O(`File ${i} written atomically`)}catch(e){O(`Failed to write file atomically: ${e}`,{level:`error`});try{O(`Cleaning up temp file: ${a}`),r.unlinkSync(a)}catch(e){O(`Failed to clean up temp file: ${e}`)}O(`Falling back to non-atomic write for ${i}`);try{let e={encoding:n.encoding,flush:!0};!s&&n.mode!==void 0&&(e.mode=n.mode),on(i,t,e),O(`File ${i} written successfully with non-atomic fallback`)}catch(e){throw O(`Non-atomic write also failed: ${e}`),e}}}function go(e,t=vo){try{return A().statSync(e).size<=t}catch{return!1}}function _o(e){let t=Yt(e);return t=t.replace(/\\/g,`/`),M()===`windows`&&(t=t.toLowerCase()),t}var vo,yo,bo=e((()=>{It(),ut(),bt(),pt(),qa(),Xa(),k(),wt(),Gi(),Ft(),vo=.25*1024*1024,yo=`Note: your current working directory is`}));async function xo(e,t){let{code:n}=await Dt(`git`,[`check-ignore`,e],{preserveOutputOnError:!1,cwd:t});return n===0}function So(){return P(Wt(),`.config`,`git`,`ignore`)}async function Co(e,t=D()){try{if(!await Br(t))return;let n=`**/${e}`;if(await xo(e.endsWith(`/`)?`${e}sample-file.txt`:e,t))return;let r=So();await cn(N(r),{recursive:!0});try{if((await L(r,{encoding:`utf-8`})).includes(n))return;await sn(r,`\n${n}\n`)}catch(e){if(mt(e)===`ENOENT`)await pn(r,`${n}\n`,`utf-8`);else throw e}}catch(e){j(e)}}var wo=e((()=>{ut(),pt(),Et(),Gr(),wt()}));function To(e){return No[e]}function Eo(e){return Po[e]}function Do(e){return Fo[e]}function Oo(e){return Io[e]}function ko(e){if(e===``)return[];let t=e.split(`,`).map(e=>e.trim()),n=[];for(let e of t)switch(e){case`user`:n.push(`userSettings`);break;case`project`:n.push(`projectSettings`);break;case`local`:n.push(`localSettings`);break;default:throw Error(`Invalid setting source: ${e}. Valid options are: user, project, local`)}return n}function Ao(){let e=lt(),t=new Set(e);return t.add(`policySettings`),t.add(`flagSettings`),Array.from(t)}function jo(e){return Ao().includes(e)}var Mo,No,Po,Fo,Io,Lo,Ro=e((()=>{ze(),Mo=[`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`],No={userSettings:`user`,projectSettings:`project`,localSettings:`project, gitignored`,flagSettings:`cli flag`,policySettings:`managed`},Po={userSettings:`User`,projectSettings:`Project`,localSettings:`Local`,flagSettings:`Flag`,policySettings:`Managed`,plugin:`Plugin`,"built-in":`Built-in`},Fo={userSettings:`user settings`,projectSettings:`shared project settings`,localSettings:`project local settings`,flagSettings:`command line arguments`,policySettings:`enterprise managed settings`,cliArg:`CLI argument`,command:`command configuration`,session:`current session`},Io={userSettings:`User settings`,projectSettings:`Shared project settings`,localSettings:`Project local settings`,flagSettings:`Command line arguments`,policySettings:`Enterprise managed settings`,cliArg:`CLI argument`,command:`Command configuration`,session:`Current session`},Lo=[`localSettings`,`projectSettings`,`userSettings`]}));function zo(e){Ho.set(e,Date.now())}function Bo(e,t){let n=Ho.get(e);return n!==void 0&&Date.now()-n<t?(Ho.delete(e),!0):!1}function Vo(){Ho.clear()}var Ho,Uo=e((()=>{Ho=new Map})),Wo,Go,Ko=e((()=>{f(),Ft(),Wo=d(()=>{switch(M()){case`macos`:return`/Library/Application Support/WorkMate`;case`windows`:return`C:\\Program Files\\WorkMate`;default:return`/etc/workmate`}}),Go=d(()=>P(Wo(),`managed-settings.d`))})),qo,Jo,Yo,Xo=e((()=>{w(),ve(),qo=E(()=>x({allowedDomains:v(S()).optional(),allowManagedDomainsOnly:y().optional().describe(`When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources.`),allowUnixSockets:v(S()).optional().describe(`macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path).`),allowAllUnixSockets:y().optional().describe(`If true, allow all Unix sockets (disables blocking on both platforms).`),allowLocalBinding:y().optional(),httpProxyPort:b().optional(),socksProxyPort:b().optional()}).optional()),Jo=E(()=>x({allowWrite:v(S()).optional().describe(`Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules.`),denyWrite:v(S()).optional().describe(`Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules.`),denyRead:v(S()).optional().describe(`Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules.`),allowRead:v(S()).optional().describe(`Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths.`),allowManagedReadPathsOnly:y().optional().describe(`When true (set in managed settings), only allowRead paths from policySettings are used.`)}).optional()),Yo=E(()=>x({enabled:y().optional(),failIfUnavailable:y().optional().describe(`Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies, unsupported platform, or platform not in enabledPlatforms). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate.`),autoAllowBashIfSandboxed:y().optional(),allowUnsandboxedCommands:y().optional().describe(`Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true.`),network:qo(),filesystem:Jo(),ignoreViolations:_(S(),v(S())).optional(),enableWeakerNestedSandbox:y().optional(),enableWeakerNetworkIsolation:y().optional().describe(`macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. **Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false`),excludedCommands:v(S()).optional(),ripgrep:x({command:S(),args:v(S()).optional()}).optional().describe(`Custom ripgrep configuration for bundled ripgrep support`)}).passthrough())}));function Zo(){let e=process.env.WORKMATE_CUSTOM_OAUTH_URL;return e?{BASE_API_URL:e.replace(/\/$/,``),OAUTH_FILE_SUFFIX:`-custom-oauth`}:$o}function Qo(){return process.env.WORKMATE_CUSTOM_OAUTH_URL?`-custom-oauth`:``}var $o,es=e((()=>{$o={BASE_API_URL:`https://api.anthropic.com`,OAUTH_FILE_SUFFIX:``}}));async function ts(e){try{return!!await Ot(e)}catch{return!1}}function ns(){return process.env.__CFBundleIdentifier===`com.conductor.app`}function rs(){if(process.env.CURSOR_TRACE_ID||process.env.VSCODE_GIT_ASKPASS_MAIN?.includes(`cursor`))return`cursor`;if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes(`windsurf`))return`windsurf`;if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes(`antigravity`))return`antigravity`;let e=process.env.__CFBundleIdentifier?.toLowerCase();if(e?.includes(`vscodium`))return`codium`;if(e?.includes(`windsurf`))return`windsurf`;if(e?.includes(`com.google.android.studio`))return`androidstudio`;if(e){for(let t of fs)if(e.includes(t))return t}if(process.env.VisualStudioVersion)return`visualstudio`;if(process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`)return process.platform,`pycharm`;if(process.env.TERM===`xterm-ghostty`)return`ghostty`;if(process.env.TERM?.includes(`kitty`))return`kitty`;if(process.env.TERM_PROGRAM)return process.env.TERM_PROGRAM;if(process.env.TMUX)return`tmux`;if(process.env.STY)return`screen`;if(process.env.KONSOLE_VERSION)return`konsole`;if(process.env.GNOME_TERMINAL_SERVICE)return`gnome-terminal`;if(process.env.XTERM_VERSION)return`xterm`;if(process.env.VTE_VERSION)return`vte-based`;if(process.env.TERMINATOR_UUID)return`terminator`;if(process.env.KITTY_WINDOW_ID)return`kitty`;if(process.env.ALACRITTY_LOG)return`alacritty`;if(process.env.TILIX_ID)return`tilix`;if(process.env.WT_SESSION)return`windows-terminal`;if(process.env.SESSIONNAME&&process.env.TERM===`cygwin`)return`cygwin`;if(process.env.MSYSTEM)return process.env.MSYSTEM.toLowerCase();if(process.env.ConEmuANSI||process.env.ConEmuPID||process.env.ConEmuTask)return`conemu`;if(process.env.WSL_DISTRO_NAME)return`wsl-${process.env.WSL_DISTRO_NAME}`;if(is())return`ssh-session`;if(process.env.TERM){let e=process.env.TERM;return e.includes(`alacritty`)?`alacritty`:e.includes(`rxvt`)?`rxvt`:e.includes(`termite`)?`termite`:process.env.TERM}return process.stdout.isTTY?null:`non-interactive`}function is(){return!!(process.env.SSH_CONNECTION||process.env.SSH_CLIENT||process.env.SSH_TTY)}function as(){let e=process.env.WORKMATE_HOST_PLATFORM;return e===`win32`||e===`darwin`||e===`linux`?e:K.platform}var os,ss,cs,ls,us,ds,fs,ps,K,ms=e((()=>{f(),es(),Pt(),ne(),Ut(),k(),At(),os=d(()=>{if(A().existsSync(P(p(),`.config.json`)))return P(p(),`.config.json`);let e=`.workmate${Qo()}.json`;return P(process.env.WORKMATE_CONFIG_DIR||Wt(),e)}),ss=d(async()=>{try{let{default:e}=await import(`./axios-BHBm_hhU.js`);return await e.head(`http://1.1.1.1`,{signal:AbortSignal.timeout(1e3)}),!0}catch{return!1}}),cs=d(async()=>{let e=[];return await ts(`npm`)&&e.push(`npm`),await ts(`yarn`)&&e.push(`yarn`),await ts(`pnpm`)&&e.push(`pnpm`),e}),ls=d(async()=>{let e=[];return await ts(`bun`)&&e.push(`bun`),await ts(`deno`)&&e.push(`deno`),await ts(`node`)&&e.push(`node`),e}),us=d(()=>{try{return A().existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)}catch{return!1}}),ds=d(()=>{try{if(!us())return!1;let{cmd:e}=zt(`npm`,[]);return e.startsWith(`/mnt/c/`)}catch{return!1}}),fs=[`pycharm`,`intellij`,`webstorm`,`phpstorm`,`rubymine`,`clion`,`goland`,`rider`,`datagrip`,`appcode`,`dataspell`,`aqua`,`gateway`,`fleet`,`jetbrains`,`androidstudio`],ps=d(()=>{if(m(process.env.CODESPACES))return`codespaces`;if(process.env.GITPOD_WORKSPACE_ID)return`gitpod`;if(process.env.REPL_ID||process.env.REPL_SLUG)return`replit`;if(process.env.PROJECT_DOMAIN)return`glitch`;if(m(process.env.VERCEL))return`vercel`;if(process.env.RAILWAY_ENVIRONMENT_NAME||process.env.RAILWAY_SERVICE_NAME)return`railway`;if(m(process.env.RENDER))return`render`;if(m(process.env.NETLIFY))return`netlify`;if(process.env.DYNO)return`heroku`;if(process.env.FLY_APP_NAME||process.env.FLY_MACHINE_ID)return`fly.io`;if(m(process.env.CF_PAGES))return`cloudflare-pages`;if(process.env.DENO_DEPLOYMENT_ID)return`deno-deploy`;if(process.env.AWS_LAMBDA_FUNCTION_NAME)return`aws-lambda`;if(process.env.AWS_EXECUTION_ENV===`AWS_ECS_FARGATE`)return`aws-fargate`;if(process.env.AWS_EXECUTION_ENV===`AWS_ECS_EC2`)return`aws-ecs`;try{if(A().readFileSync(`/sys/hypervisor/uuid`,{encoding:`utf8`}).trim().toLowerCase().startsWith(`ec2`))return`aws-ec2`}catch{}if(process.env.K_SERVICE)return`gcp-cloud-run`;if(process.env.GOOGLE_CLOUD_PROJECT)return`gcp`;if(process.env.WEBSITE_SITE_NAME||process.env.WEBSITE_SKU)return`azure-app-service`;if(process.env.AZURE_FUNCTIONS_ENVIRONMENT)return`azure-functions`;if(process.env.APP_URL?.includes(`ondigitalocean.app`))return`digitalocean-app-platform`;if(process.env.SPACE_CREATOR_USER_ID)return`huggingface-spaces`;if(m(process.env.GITHUB_ACTIONS))return`github-actions`;if(m(process.env.GITLAB_CI))return`gitlab-ci`;if(process.env.CIRCLECI)return`circleci`;if(process.env.BUILDKITE)return`buildkite`;if(m(process.env.CI))return`ci`;if(process.env.KUBERNETES_SERVICE_HOST)return`kubernetes`;try{if(A().existsSync(`/.dockerenv`))return`docker`}catch{}return K.platform===`darwin`?`unknown-darwin`:K.platform===`linux`?`unknown-linux`:K.platform===`win32`?`unknown-win32`:`unknown`}),K={hasInternetAccess:ss,isCI:m(process.env.CI),platform:[`win32`,`darwin`].includes(process.platform)?process.platform:`linux`,arch:process.arch,nodeVersion:process.version,terminal:rs(),isSSH:is,getPackageManagers:cs,getRuntimes:ls,isRunningWithBun:d(Mt),isWslEnvironment:us,isNpmFromWindowsPath:ds,isConductor:ns,detectDeploymentEnvironment:ps}})),hs,gs=e((()=>{ms(),hs=K.platform===`darwin`?`⏺`:`●`})),_s,vs,ys,bs=e((()=>{_s=[`acceptEdits`,`bypassPermissions`,`default`,`dontAsk`,`plan`],vs=[..._s,`auto`],ys=vs}));function xs(e){return!0}function Ss(e){return js[e]??js.default}function Cs(e){return Ss(e).external}function ws(e){return ys.includes(e)?e:`default`}function Ts(e){return Ss(e).title}function Es(e){return e==="default"||e===void 0}function Ds(e){return Ss(e).shortTitle}function Os(e){return Ss(e).symbol}function ks(e){return Ss(e).color}var As,js,Ms=e((()=>{w(),gs(),bs(),ve(),E(()=>Se.enum(ys)),As=E(()=>Se.enum(_s)),js={default:{title:`Default`,shortTitle:`Default`,symbol:``,color:`text`,external:`default`},plan:{title:`Plan Mode`,shortTitle:`Plan`,symbol:`⏸`,color:`planMode`,external:`plan`},acceptEdits:{title:`Accept edits`,shortTitle:`Accept`,symbol:`⏵⏵`,color:`autoAccept`,external:`acceptEdits`},bypassPermissions:{title:`Bypass`,shortTitle:`Bypass`,symbol:`⏵⏵`,color:`error`,external:`bypassPermissions`},dontAsk:{title:`Don't Ask`,shortTitle:`DontAsk`,symbol:`⏵⏵`,color:`error`,external:`dontAsk`},auto:{title:`Auto`,shortTitle:`Auto`,symbol:`⏵⏵`,color:`warning`,external:`default`}}})),Ns=e((()=>{})),Ps,Fs=e((()=>{Ns(),Ps=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`)})),Is=e((()=>{})),Ls=e((()=>{})),Rs=e((()=>{Fs(),Is(),Ls()})),zs,Bs,Vs=e((()=>{zs=[`bash`,`powershell`],Bs=`bash`}));function Hs(){return{BashCommandHookSchema:x({type:g(`command`).describe(`Shell command hook type`),command:S().describe(`Shell command to execute`),if:Us(),shell:T(zs).optional().describe(`Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash.`),timeout:b().positive().optional().describe(`Timeout in seconds for this specific command`),statusMessage:S().optional().describe(`Custom status message to display in spinner while hook runs`),once:y().optional().describe(`If true, hook runs once and is removed after execution`),async:y().optional().describe(`If true, hook runs in background without blocking`),asyncRewake:y().optional().describe(`If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async.`)}),PromptHookSchema:x({type:g(`prompt`).describe(`LLM prompt hook type`),prompt:S().describe(`Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.`),if:Us(),timeout:b().positive().optional().describe(`Timeout in seconds for this specific prompt evaluation`),model:S().optional().describe(`Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.`),statusMessage:S().optional().describe(`Custom status message to display in spinner while hook runs`),once:y().optional().describe(`If true, hook runs once and is removed after execution`)}),HttpHookSchema:x({type:g(`http`).describe(`HTTP hook type`),url:S().url().describe(`URL to POST the hook input JSON to`),if:Us(),timeout:b().positive().optional().describe(`Timeout in seconds for this specific request`),headers:_(S(),S()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:v(S()).optional().describe(`Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work.`),statusMessage:S().optional().describe(`Custom status message to display in spinner while hook runs`),once:y().optional().describe(`If true, hook runs once and is removed after execution`)}),AgentHookSchema:x({type:g(`agent`).describe(`Agentic verifier hook type`),prompt:S().describe(`Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.`),if:Us(),timeout:b().positive().optional().describe(`Timeout in seconds for agent execution (default 60)`),model:S().optional().describe(`Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.`),statusMessage:S().optional().describe(`Custom status message to display in spinner while hook runs`),once:y().optional().describe(`If true, hook runs once and is removed after execution`)})}}var Us,Ws,Gs,Ks,qs=e((()=>{Rs(),w(),ve(),Vs(),Us=E(()=>S().optional().describe(`Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.`)),Ws=E(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:r}=Hs();return ce(`type`,[e,t,n,r])}),Gs=E(()=>x({matcher:S().optional().describe(`String pattern to match (e.g. tool names like "Write")`),hooks:v(Ws()).describe(`List of hooks to execute when the matcher matches`)})),Ks=E(()=>le(T(Ps),v(Gs())))}));function Js(e,t){let n=e.toLowerCase();return t.autoUpdate??($s.has(n)&&!ec.has(n))}function Ys(e){return $s.has(e.toLowerCase())?!1:nc.test(e)?!0:tc.test(e)}function Xs(e,t){let n=e.toLowerCase();if(!$s.has(n))return null;if(t.source===`github`)return(t.repo||``).toLowerCase().startsWith(`${rc}/`)?null:`The name '${e}' is reserved for official marketplaces. Only repositories from 'github.com/${rc}/' can use this name.`;if(t.source===`git`&&t.url){let n=t.url.toLowerCase(),r=n.includes(`github.com/anthropics/`),i=n.includes(`git@github.com:anthropics/`);return r||i?null:`The name '${e}' is reserved for official marketplaces. Only repositories from 'github.com/${rc}/' can use this name.`}return`The name '${e}' is reserved for official marketplaces and can only be used with GitHub sources from the '${rc}' organization.`}function Zs(e){return typeof e==`string`&&e.startsWith(`./`)}function Qs(e){return e.source===`file`||e.source===`directory`}var $s,ec,tc,nc,rc,q,J,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc=e((()=>{w(),qs(),fe(),ve(),$s=new Set([`workmate-marketplace`,`workmate-plugins`,`claude-plugins-official`,`anthropic-marketplace`,`anthropic-plugins`,`agent-skills`,`life-sciences`,`knowledge-work-plugins`]),ec=new Set([`knowledge-work-plugins`]),tc=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,nc=/[^\u0020-\u007E]/,rc=`anthropics`,q=E(()=>S().startsWith(`./`)),J=E(()=>q().endsWith(`.json`)),ic=E(()=>C([q().refine(e=>e.endsWith(`.mcpb`)||e.endsWith(`.dxt`),{message:`MCPB file path must end with .mcpb or .dxt`}).describe(`Path to MCPB file relative to plugin root`),S().url().refine(e=>e.endsWith(`.mcpb`)||e.endsWith(`.dxt`),{message:`MCPB URL must end with .mcpb or .dxt`}).describe(`URL to MCPB file`)])),ac=E(()=>q().endsWith(`.md`)),oc=E(()=>C([ac(),q()])),sc=E(()=>S().min(1,`Marketplace must have a name`).refine(e=>!e.includes(` `),{message:`Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")`}).refine(e=>!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`..`)&&e!==`.`,{message:`Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."`}).refine(e=>!Ys(e),{message:`Marketplace name impersonates an official marketplace`}).refine(e=>e.toLowerCase()!==`inline`,{message:`Marketplace name "inline" is reserved for --plugin-dir session plugins`}).refine(e=>e.toLowerCase()!==`builtin`,{message:`Marketplace name "builtin" is reserved for built-in plugins`})),cc=E(()=>x({name:S().min(1,`Author name cannot be empty`).describe(`Display name of the plugin author or organization`),email:S().optional().describe(`Contact email for support or feedback`),url:S().optional().describe(`Website, GitHub profile, or organization URL`)})),lc=E(()=>x({name:S().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Unique identifier for the plugin, used for namespacing (prefer kebab-case)`),version:S().optional().describe(`Semantic version (e.g., 1.2.3) following semver.org specification`),description:S().optional().describe(`Brief, user-facing explanation of what the plugin provides`),author:cc().optional().describe(`Information about the plugin creator or maintainer`),homepage:S().url().optional().describe(`Plugin homepage or documentation URL`),repository:S().optional().describe(`Source code repository URL`),license:S().optional().describe(`SPDX license identifier (e.g., MIT, Apache-2.0)`),keywords:v(S()).optional().describe(`Tags for plugin discovery and categorization`),dependencies:v(Ic()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),uc=E(()=>x({description:S().optional().describe(`Brief, user-facing explanation of what these hooks provide`),hooks:Ce(()=>Ks()).describe(`The hooks provided by the plugin, in the same format as the one used for settings`)})),dc=E(()=>x({hooks:C([J().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),Ce(()=>Ks()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`),v(C([J().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),Ce(()=>Ks()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`)]))])})),fc=E(()=>x({source:oc().optional().describe(`Path to command markdown file, relative to plugin root`),content:S().optional().describe(`Inline markdown content for the command`),description:S().optional().describe(`Command description override`),argumentHint:S().optional().describe(`Hint for command arguments (e.g., "[file]")`),model:S().optional().describe(`Default model for this command`),allowedTools:v(S()).optional().describe(`Tools allowed when command runs`)}).refine(e=>e.source&&!e.content||!e.source&&e.content,{message:`Command must have either "source" (file path) or "content" (inline markdown), but not both`})),pc=E(()=>x({commands:C([oc().describe(`Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root`),v(oc().describe(`Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional command files or skill directories`),_(S(),fc()).describe(`Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")`)])})),mc=E(()=>x({agents:C([ac().describe(`Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root`),v(ac().describe(`Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional agent files`)])})),hc=E(()=>x({skills:C([q().describe(`Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root`),v(q().describe(`Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional skill directories`)])})),gc=E(()=>x({outputStyles:C([q().describe(`Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root`),v(q().describe(`Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional output styles directories or files`)])})),_c=E(()=>S().min(1)),vc=E(()=>S().min(2).refine(e=>e.startsWith(`.`),{message:`File extensions must start with dot (e.g., ".ts", not "ts")`})),yc=E(()=>x({mcpServers:C([J().describe(`MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)`),ic().describe(`Path or URL to MCPB file containing MCP server configuration`),_(S(),xe()).describe(`MCP server configurations keyed by server name`),v(C([J().describe(`Path to MCP servers configuration file`),ic().describe(`Path or URL to MCPB file`),_(S(),xe()).describe(`Inline MCP server configurations`)])).describe(`Array of MCP server configurations (paths, MCPB files, or inline definitions)`)])})),bc=E(()=>x({type:T([`string`,`number`,`boolean`,`directory`,`file`]).describe(`Type of the configuration value`),title:S().describe(`Human-readable label shown in the config dialog`),description:S().describe(`Help text shown beneath the field in the config dialog`),required:y().optional().describe(`If true, validation fails when this field is empty`),default:C([S(),b(),y(),v(S())]).optional().describe(`Default value used when the user provides nothing`),multiple:y().optional().describe(`For string type: allow an array of strings`),sensitive:y().optional().describe(`If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json`),min:b().optional().describe(`Minimum value (number type only)`),max:b().optional().describe(`Maximum value (number type only)`)}).strict()),xc=E(()=>x({userConfig:_(S().regex(/^[A-Za-z_]\w*$/,`Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks`),bc()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage (macOS keychain or .credentials.json). Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Note: sensitive values share a single keychain entry with OAuth tokens — keep secret counts small to stay under the ~2KB stdin-safe limit (see INC-3028).")})),Sc=E(()=>x({channels:v(x({server:S().min(1).describe(`Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers.`),displayName:S().optional().describe(`Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.`),userConfig:_(S(),bc()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe(`Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.`)})),Cc=E(()=>de({command:S().min(1).refine(e=>!(e.includes(` `)&&!e.startsWith(`/`)),{message:`Command should not contain spaces. Use args array for arguments.`}).describe(`Command to execute the LSP server (e.g., "typescript-language-server")`),args:v(_c()).optional().describe(`Command-line arguments to pass to the server`),extensionToLanguage:_(vc(),_c()).refine(e=>Object.keys(e).length>0,{message:`extensionToLanguage must have at least one mapping`}).describe(`Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping.`),transport:T([`stdio`,`socket`]).default(`stdio`).describe(`Communication transport mechanism`),env:_(S(),S()).optional().describe(`Environment variables to set when starting the server`),initializationOptions:ue().optional().describe(`Initialization options passed to the server during initialization`),settings:ue().optional().describe(`Settings passed to the server via workspace/didChangeConfiguration`),workspaceFolder:S().optional().describe(`Workspace folder path to use for the server`),startupTimeout:b().int().positive().optional().describe(`Maximum time to wait for server startup (milliseconds)`),shutdownTimeout:b().int().positive().optional().describe(`Maximum time to wait for graceful shutdown (milliseconds)`),restartOnCrash:y().optional().describe(`Whether to restart the server if it crashes`),maxRestarts:b().int().nonnegative().optional().describe(`Maximum number of restart attempts before giving up`)})),wc=E(()=>x({lspServers:C([J().describe(`Path to .lsp.json configuration file relative to plugin root`),_(S(),Cc()).describe(`LSP server configurations keyed by server name`),v(C([J().describe(`Path to LSP configuration file`),_(S(),Cc()).describe(`Inline LSP server configurations`)])).describe(`Array of LSP server configurations (paths or inline definitions)`)])})),Tc=E(()=>S().refine(e=>!e.includes(`..`)&&!e.includes(`//`),`Package name cannot contain path traversal patterns`).refine(e=>/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/.test(e)||/^[a-z0-9][a-z0-9-._]*$/.test(e),`Invalid npm package name format`)),Ec=E(()=>x({settings:_(S(),ue()).optional().describe(`Settings to merge when plugin is enabled. Only allowlisted keys are kept (currently: agent)`)})),Dc=E(()=>x({...lc().shape,...dc().partial().shape,...pc().partial().shape,...mc().partial().shape,...hc().partial().shape,...gc().partial().shape,...Sc().partial().shape,...yc().partial().shape,...wc().partial().shape,...Ec().partial().shape,...xc().partial().shape})),Oc=E(()=>ce(`source`,[x({source:g(`url`),url:S().url().describe(`Direct URL to marketplace.json file`),headers:_(S(),S()).optional().describe(`Custom HTTP headers (e.g., for authentication)`)}),x({source:g(`github`),repo:S().describe(`GitHub repository in owner/repo format`),ref:S().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),path:S().optional().describe(`Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)`),sparsePaths:v(S()).optional().describe(`Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.`)}),x({source:g(`git`),url:S().describe(`Full git repository URL`),ref:S().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),path:S().optional().describe(`Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)`),sparsePaths:v(S()).optional().describe(`Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.`)}),x({source:g(`npm`),package:Tc().describe(`NPM package containing marketplace.json`)}),x({source:g(`file`),path:S().describe(`Local file path to marketplace.json`)}),x({source:g(`directory`),path:S().describe(`Local directory containing .claude-plugin/marketplace.json`)}),x({source:g(`hostPattern`),hostPattern:S().describe(`Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against "github.com". For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").`)}),x({source:g(`pathPattern`),pathPattern:S().describe(`Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.`)}),x({source:g(`settings`),name:sc().refine(e=>!$s.has(e.toLowerCase()),{message:`Reserved official marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false.`}).describe(`Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation as PluginMarketplaceSchema plus reserved-name rejection — validateOfficialNameSource runs after the disk write, too late to clean up.`),plugins:v(jc()).describe(`Plugin entries declared inline in settings.json`),owner:cc().optional()}).describe(`Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).`)])),kc=E(()=>S().length(40).regex(/^[a-f0-9]{40}$/,`Must be a full 40-character lowercase git commit SHA`)),Ac=E(()=>C([q().describe(`Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)`),x({source:g(`npm`),package:Tc().or(S()).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:S().optional().describe(`Specific version or version range (e.g., ^1.0.0, ~2.1.0)`),registry:S().url().optional().describe(`Custom NPM registry URL (defaults to using system default, likely npmjs.org)`)}).describe(`NPM package as plugin source`),x({source:g(`pip`),package:S().describe(`Python package name as it appears on PyPI`),version:S().optional().describe(`Version specifier (e.g., ==1.0.0, >=2.0.0, <3.0.0)`),registry:S().url().optional().describe(`Custom PyPI registry URL (defaults to using system default, likely pypi.org)`)}).describe(`Python package as plugin source`),x({source:g(`url`),url:S().describe(`Full git repository URL (https:// or git@)`),ref:S().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:kc().optional().describe(`Specific commit SHA to use`)}),x({source:g(`github`),repo:S().describe(`GitHub repository in owner/repo format`),ref:S().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:kc().optional().describe(`Specific commit SHA to use`)}),x({source:g(`git-subdir`),url:S().describe(`Git repository: GitHub owner/repo shorthand, https://, or git@ URL`),path:S().min(1).describe(`Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.`),ref:S().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:kc().optional().describe(`Specific commit SHA to use`)}).describe(`Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded.`)])),jc=E(()=>x({name:S().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Plugin name as it appears in the target repository`),source:Ac().describe(`Where to fetch the plugin from. Must be a remote source — relative paths have no marketplace repository to resolve against.`),description:S().optional(),version:S().optional(),strict:y().optional()}).refine(e=>typeof e.source!=`string`,{message:`Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url, pip). Relative-path sources like "./foo" have no marketplace repository to resolve against.`})),Mc=E(()=>Dc().partial().extend({name:S().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Unique identifier matching the plugin name`),source:Ac().describe(`Where to fetch the plugin from`),category:S().optional().describe(`Category for organizing plugins (e.g., "productivity", "development")`),tags:v(S()).optional().describe(`Tags for searchability and discovery`),strict:y().optional().default(!0).describe(`Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest.`)})),Nc=E(()=>x({name:sc(),owner:cc().describe(`Marketplace maintainer or curator information`),plugins:v(Mc()).describe(`Collection of available plugins in this marketplace`),forceRemoveDeletedPlugins:y().optional().describe(`When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users`),metadata:x({pluginRoot:S().optional().describe(`Base path for relative plugin sources`),version:S().optional().describe(`Marketplace version`),description:S().optional().describe(`Marketplace description`)}).optional().describe(`Optional marketplace metadata`),allowCrossMarketplaceDependenciesOn:v(S()).optional().describe(`Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust.`)})),Pc=E(()=>S().regex(/^[a-z0-9][-a-z0-9._]*@[a-z0-9][-a-z0-9._]*$/i,`Plugin ID must be in format: plugin@marketplace`)),Fc=/^[a-z0-9][-a-z0-9._]*(@[a-z0-9][-a-z0-9._]*)?(@\^[^@]*)?$/i,Ic=E(()=>C([S().regex(Fc,`Dependency must be a plugin name, optionally qualified with @marketplace`).transform(e=>e.replace(/@\^[^@]*$/,``)),x({name:S().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i),marketplace:S().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i).optional()}).loose().transform(e=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),Lc=E(()=>x({version:S().describe(`Currently installed version`),installedAt:S().describe(`ISO 8601 timestamp of installation`),lastUpdated:S().optional().describe(`ISO 8601 timestamp of last update`),installPath:S().describe(`Absolute path to the installed plugin directory`),gitCommitSha:S().optional().describe(`Git commit SHA for git-based plugins (for version tracking)`)})),Rc=E(()=>x({version:g(1).describe(`Schema version 1`),plugins:_(Pc(),Lc()).describe(`Map of plugin IDs to their installation metadata`)})),zc=E(()=>T([`managed`,`user`,`project`,`local`])),Bc=E(()=>x({scope:zc().describe(`Installation scope`),projectPath:S().optional().describe(`Project path (required for project/local scopes)`),installPath:S().describe(`Absolute path to the versioned plugin directory`),version:S().optional().describe(`Currently installed version`),installedAt:S().optional().describe(`ISO 8601 timestamp of installation`),lastUpdated:S().optional().describe(`ISO 8601 timestamp of last update`),gitCommitSha:S().optional().describe(`Git commit SHA for git-based plugins`)})),Vc=E(()=>x({version:g(2).describe(`Schema version 2`),plugins:_(Pc(),v(Bc())).describe(`Map of plugin IDs to arrays of installation entries`)})),Hc=E(()=>x({source:Oc().describe(`Where to fetch the marketplace from`),installLocation:S().describe(`Local cache path where marketplace manifest is stored`),lastUpdated:S().describe(`ISO 8601 timestamp of last marketplace refresh`),autoUpdate:y().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),Uc=E(()=>_(S(),Hc()))}));function Gc(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,`_`);return e.startsWith(Kc)&&(t=t.replace(/_+/g,`_`).replace(/^_|_$/g,``)),t}var Kc,qc=e((()=>{Kc=`claude.ai `}));function Jc(e){let[t,n,...r]=e.split(`__`);return t!==`mcp`||!n?null:{serverName:n,toolName:r.length>0?r.join(`__`):void 0}}function Yc(e){return`mcp__${Gc(e)}__`}function Xc(e,t){return`${Yc(e)}${Gc(t)}`}function Zc(e){return e.mcpInfo?Xc(e.mcpInfo.serverName,e.mcpInfo.toolName):e.name}function Qc(e,t){let n=`mcp__${Gc(t)}__`;return e.replace(n,``)}function $c(e){let t=e.replace(/\s*\(MCP\)\s*$/,``);t=t.trim();let n=t.indexOf(` - `);return n===-1?t:t.substring(n+3).trim()}var el=e((()=>{qc()})),tl,nl,rl,il,al=e((()=>{tl=`Agent`,nl=`Task`,rl=`verification`,il=new Set([`Explore`,`Plan`])})),ol,sl=e((()=>{ol=`TaskOutput`})),cl,ll,ul=e((()=>{cl=`TaskStop`,ll=`
18
+ - Stops a running background task by its ID
19
+ - Takes a task_id parameter identifying the task to stop
20
+ - Returns a success or failure status
21
+ - Use this tool when you need to terminate a long-running task
22
+ `}));function dl(e){return yl[e]??e}function fl(e){let t=[];for(let[n,r]of Object.entries(yl))r===e&&t.push(n);return t}function pl(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)}function ml(e){return e.replace(/\\\(/g,`(`).replace(/\\\)/g,`)`).replace(/\\\\/g,`\\`)}function hl(e){let t=_l(e,`(`);if(t===-1)return{toolName:dl(e)};let n=vl(e,`)`);if(n===-1||n<=t||n!==e.length-1)return{toolName:dl(e)};let r=e.substring(0,t),i=e.substring(t+1,n);if(!r)return{toolName:dl(e)};if(i===``||i===`*`)return{toolName:dl(r)};let a=ml(i);return{toolName:dl(r),ruleContent:a}}function gl(e){if(!e.ruleContent)return e.toolName;let t=pl(e.ruleContent);return`${e.toolName}(${t})`}function _l(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}function vl(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}var yl,bl=e((()=>{al(),sl(),ul(),yl={Task:tl,KillShell:cl,AgentOutputTool:ol,BashOutputTool:ol}}));function xl(e){return wl.filePatternTools.includes(e)}function Sl(e){return wl.bashPrefixTools.includes(e)}function Cl(e){return wl.customValidation[e]}var wl,Tl=e((()=>{wl={filePatternTools:[`Read`,`Write`,`Edit`,`Glob`,`NotebookRead`,`NotebookEdit`],bashPrefixTools:[`Bash`],customValidation:{WebSearch:e=>e.includes(`*`)||e.includes(`?`)?{valid:!1,error:`WebSearch does not support wildcards`,suggestion:`Use exact search terms without * or ?`,examples:[`WebSearch(claude ai)`,`WebSearch(typescript tutorial)`]}:{valid:!0},WebFetch:e=>e.includes(`://`)||e.startsWith(`http`)?{valid:!1,error:`WebFetch permissions use domain format, not URLs`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:github.com)`]}:e.startsWith(`domain:`)?{valid:!0}:{valid:!1,error:`WebFetch permissions must use "domain:" prefix`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:*.google.com)`]}}}}));function El(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function Dl(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!El(e,r)&&n++;return n}function Ol(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!El(e,t))return!0;return!1}function kl(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(Dl(e,`(`)!==Dl(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(Ol(e)){let t=e.substring(0,e.indexOf(`(`));return t?{valid:!1,error:`Empty parentheses`,suggestion:`Either specify a pattern or use just "${t}" without parentheses`,examples:[`${t}`,`${t}(some-pattern)`]}:{valid:!1,error:`Empty parentheses with no tool name`,suggestion:`Specify a tool name before the parentheses`}}let n=hl(e),r=Jc(n.toolName);if(r)return n.ruleContent!==void 0||Dl(e,`(`)>0?{valid:!1,error:`MCP rules do not support patterns in parentheses`,suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${r.serverName}__*" for all tools`,examples:[`mcp__${r.serverName}`,`mcp__${r.serverName}__*`,r.toolName&&r.toolName!==`*`?`mcp__${r.serverName}__${r.toolName}`:void 0].filter(Boolean)}:{valid:!0};if(!n.toolName||n.toolName.length===0)return{valid:!1,error:`Tool name cannot be empty`};if(n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:`Tool names must start with uppercase`,suggestion:`Use "${Vt(String(n.toolName))}"`};let i=Cl(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(Sl(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`)&&!e.endsWith(`:*`))return{valid:!1,error:`The :* pattern must be at the end`,suggestion:`Move :* to the end for prefix matching, or use * for wildcard matching`,examples:[`Bash(npm run:*) - prefix matching (legacy)`,`Bash(npm run *) - wildcard matching`]};if(e===`:*`)return{valid:!1,error:`Prefix cannot be empty before :*`,suggestion:`Specify a command prefix before :*`,examples:[`Bash(npm:*)`,`Bash(git:*)`]}}if(xl(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`))return{valid:!1,error:`The ":*" syntax is only for Bash prefix rules`,suggestion:`Use glob patterns like "*" or "**" for file matching`,examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(e.includes(`*`)&&!e.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!e.includes(`**`))return{valid:!1,error:`Wildcard placement might be incorrect`,suggestion:`Wildcards are typically used at path boundaries`,examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}return{valid:!0}}var Al,jl=e((()=>{w(),el(),ve(),bl(),Ht(),Tl(),Al=E(()=>S().superRefine((e,t)=>{let n=kl(e);if(!n.valid){let r=n.error;n.suggestion&&(r+=`. ${n.suggestion}`),n.examples&&n.examples.length>0&&(r+=`. Examples: ${n.examples.join(`, `)}`),t.addIssue({code:oe.custom,message:r,params:{received:e}})}}))}));function Ml(e){return E(()=>x({serverName:S().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(e.serverName),serverCommand:v(S()).min(1,`Server command must have at least one element (the command)`).optional().describe(e.serverCommand),serverUrl:S().optional().describe(e.serverUrl)}).refine(e=>Ba([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`}))}function Nl(e){return`serverName`in e&&e.serverName!==void 0}function Pl(e){return`serverCommand`in e&&e.serverCommand!==void 0}function Fl(e){return`serverUrl`in e&&e.serverUrl!==void 0}var Il,Ll,Rl,zl,Bl,Vl,Y,Hl=e((()=>{w(),Xo(),ve(),Ms(),Wc(),jl(),qs(),Ha(),Il=E(()=>_(S(),se())),Ll=E(()=>x({allow:v(Al()).optional().describe(`List of permission rules for allowed operations`),deny:v(Al()).optional().describe(`List of permission rules for denied operations`),ask:v(Al()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:T(ys).optional().describe(`Default permission mode when Work Mate needs access`),disableBypassPermissionsMode:T([`disable`]).optional().describe(`Disable the ability to bypass permission prompts`),disableAutoMode:T([`disable`]).optional().describe(`Disable auto mode`),additionalDirectories:v(S()).optional().describe(`Additional directories to include in the permission scope`)}).passthrough()),Rl=E(()=>x({source:Oc().describe(`Where to fetch the marketplace from`),installLocation:S().optional().describe(`Local cache path where marketplace manifest is stored (auto-generated if not provided)`),autoUpdate:y().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),zl=Ml({serverName:`Name of the MCP server that users are allowed to configure`,serverCommand:`Command array [command, ...args] to match exactly for allowed stdio servers`,serverUrl:`URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers`}),Bl=Ml({serverName:`Name of the MCP server that is explicitly blocked`,serverCommand:`Command array [command, ...args] to match exactly for blocked stdio servers`,serverUrl:`URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers`}),Vl=[`skills`,`agents`,`hooks`,`mcp`],Y=E(()=>x({$schema:S().optional().describe(`JSON Schema URL for editor validation`),fileSuggestion:x({type:g(`command`),command:S()}).optional().describe(`Custom file suggestion configuration for @ mentions`),respectGitignore:y().optional().describe(`Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected.`),cleanupPeriodDays:b().nonnegative().int().optional().describe(`Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`),env:Il().optional().describe(`Environment variables to set for Work Mate sessions`),attribution:x({commit:S().optional().describe(`Attribution text for git commits, including any trailers. Empty string hides attribution.`),pr:S().optional().describe(`Attribution text for pull request descriptions. Empty string hides attribution.`)}).optional().describe(`Customize attribution text for commits and PRs. Each field defaults to the standard Work Mate attribution if not set.`),includeCoAuthoredBy:y().optional().describe(`Deprecated: Use attribution instead. Whether to include Work Mate's co-authored by attribution in commits and PRs (defaults to true)`),includeGitInstructions:y().optional().describe(`Include built-in commit and PR workflow instructions in Work Mate's system prompt (default: true)`),permissions:Ll().optional().describe(`Tool usage permissions configuration`),modelType:T([`anthropic`,`openai`,`gemini`,`grok`]).optional().describe(`API provider type. "anthropic" uses the first-party API (default), "openai" uses the OpenAI Chat Completions API, "gemini" uses the Gemini API, and "grok" uses the xAI Grok API (OpenAI-compatible). When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL. When set to "gemini", configure GEMINI_API_KEY and optional GEMINI_BASE_URL. When set to "grok", configure GROK_API_KEY (or XAI_API_KEY), optional GROK_BASE_URL, GROK_MODEL, and GROK_MODEL_MAP.`),activeProviderId:S().optional().describe(`Currently active API provider id (set by /provider use <id>). Authoritative source for the active-provider marker in /provider list.`),model:S().optional().describe(`Override the default model used by Work Mate`),availableModels:v(S()).optional().describe(`Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.`),modelOverrides:_(S(),S()).optional().describe(`Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.`),enableAllProjectMcpServers:y().optional().describe(`Whether to automatically approve all MCP servers in the project`),enabledMcpjsonServers:v(S()).optional().describe(`List of approved MCP servers from .mcp.json`),disabledMcpjsonServers:v(S()).optional().describe(`List of rejected MCP servers from .mcp.json`),allowedMcpServers:v(zl()).optional().describe(`Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied.`),deniedMcpServers:v(Bl()).optional().describe(`Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied.`),hooks:Ks().optional().describe(`Custom commands to run before/after tool executions`),worktree:x({symlinkDirectories:v(S()).optional().describe(`Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"`),sparsePaths:v(S()).optional().describe(`Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.`)}).optional().describe(`Git worktree configuration for --worktree flag.`),disableAllHooks:y().optional().describe(`Disable all hooks and statusLine execution`),defaultShell:T([`bash`,`powershell`]).optional().describe(`Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip).`),allowManagedHooksOnly:y().optional().describe(`When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored.`),allowedHttpHookUrls:v(S()).optional().describe(`Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).`),httpHookAllowedEnvVars:v(S()).optional().describe(`Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers).`),allowManagedPermissionRulesOnly:y().optional().describe(`When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored.`),allowManagedMcpServersOnly:y().optional().describe(`When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies.`),strictPluginOnlyCustomization:be(e=>Array.isArray(e)?e.filter(e=>Vl.includes(e)):e,C([y(),v(T(Vl))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.workmate/{surface}/, .workmate/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:x({type:g(`command`),command:S(),padding:b().optional(),refreshInterval:b().optional()}).optional().describe(`Custom status line display configuration`),statusLineEnabled:y().optional().describe(`Whether to render the fork built-in status line (model + ctx + 5h/7d limits + cost + cache pill). Toggled with /statusline.`),enabledPlugins:_(S(),C([v(S()),y(),ge()])).optional().describe(`Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.`),extraKnownMarketplaces:_(S(),Rl()).check(e=>{for(let[t,n]of Object.entries(e.value))n.source.source===`settings`&&n.source.name!==t&&e.issues.push({code:`custom`,input:n.source.name,path:[t,`source`,`name`],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${t}" but source.name "${n.source.name}")`})}).optional().describe(`Additional marketplaces to make available for this repository. Typically used in repository .workmate/settings.json to ensure team members have required plugin sources.`),strictKnownMarketplaces:v(Oc()).optional().describe(`Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces.`),blockedMarketplaces:v(Oc()).optional().describe(`Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem.`),outputStyle:S().optional().describe(`Controls the output style for assistant responses`),language:S().optional().describe(`Preferred language for Work Mate responses (e.g., "japanese", "spanish")`),skipWebFetchPreflight:y().optional().describe(`Skip the WebFetch blocklist check for enterprise environments with restrictive security policies`),webSearchAdapter:T([`api`,`bing`,`brave`,`exa`,`tavily`]).optional().describe(`Web search backend adapter. "tavily" uses Tavily Search API (default), "api" uses Anthropic server-side search, "bing" scrapes Bing HTML, "brave" uses Brave Search API, "exa" uses Exa AI.`),webFetchAdapter:T([`tavily`,`http`]).optional().describe(`Web fetch backend. "tavily" uses Tavily Extract API which returns Markdown directly (default), "http" fetches the URL directly via HTTP.`),tavilyEndpointUrl:S().optional().describe(`Custom Tavily API endpoint URL. Defaults to https://tavily.readmagic.workmate.win. Used by both WebSearch and WebFetch when tavily adapter is selected.`),braveApiKey:S().optional().describe(`Brave Search API key. Required when using the brave web search adapter.`),webFetchHttpTimeoutMs:b().int().positive().optional().describe(`HTTP timeout in milliseconds for the HTTP direct web fetch backend. Defaults to 60000 (60s).`),exaApiKey:S().optional().describe(`Exa AI API key. Required when using the exa web search adapter.`),exaEndpointUrl:S().optional().describe(`Custom Exa AI MCP endpoint URL. Defaults to https://mcp.exa.ai/mcp.`),sandbox:Yo().optional(),feedbackSurveyRate:b().min(0).max(1).optional().describe(`Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.`),spinnerTipsEnabled:y().optional().describe(`Whether to show tips in the spinner`),spinnerVerbs:x({mode:T([`append`,`replace`]),verbs:v(S())}).optional().describe(`Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.`),spinnerTipsOverride:x({excludeDefault:y().optional(),tips:v(S())}).optional().describe(`Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false).`),syntaxHighlightingDisabled:y().optional().describe(`Whether to disable syntax highlighting in diffs`),terminalTitleFromRename:y().optional().describe(`Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.`),alwaysThinkingEnabled:y().optional().describe(`When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.`),advisorModel:S().optional().describe(`Advisor model for the server-side advisor tool.`),fastMode:y().optional().describe(`When true, fast mode is enabled. When absent or false, fast mode is off.`),fastModePerSessionOptIn:y().optional().describe(`When true, fast mode does not persist across sessions. Each session starts with fast mode off.`),promptSuggestionEnabled:y().optional().describe(`When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled.`),poorMode:y().optional().describe(`When true, poor mode is active — extract_memories and prompt_suggestion are disabled to save tokens.`),showClearContextOnPlanAccept:y().optional().describe(`When true, the plan-approval dialog offers a "clear context" option. Defaults to false.`),agent:S().optional().describe(`Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model.`),companyAnnouncements:v(S()).optional().describe(`Company announcements to display at startup (one will be randomly selected if multiple are provided)`),pluginConfigs:_(S(),x({mcpServers:_(S(),_(S(),C([S(),b(),y(),v(S())]))).optional().describe(`User configuration values for MCP servers keyed by server name`),options:_(S(),C([S(),b(),y(),v(S())])).optional().describe(`Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.`)})).optional().describe(`Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)`),autoUpdatesChannel:T([`latest`,`stable`]).optional().describe(`Release channel for auto-updates (latest or stable)`),disableDeepLinkRegistration:T([`disable`]).optional().describe(`Prevent claude-cli:// protocol handler registration with the OS`),minimumVersion:S().optional().describe(`Minimum version to stay on - prevents downgrades when switching to stable channel`),plansDirectory:S().optional().describe(`Custom directory for plan files, relative to project root. If not set, defaults to ~/.workmate/plans/`),minSleepDurationMs:b().nonnegative().int().optional().describe(`Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency.`),maxSleepDurationMs:b().int().min(-1).optional().describe(`Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.`),channelsEnabled:y().optional().describe(`Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels.`),allowedChannelPlugins:v(x({marketplace:S(),plugin:S()})).optional().describe(`Teams/Enterprise allowlist of channel plugins. When set, replaces the default allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true.`),prefersReducedMotion:y().optional().describe(`Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)`),autoMemoryEnabled:y().optional().describe(`Enable auto-memory for this project. When false, Work Mate will not read from or write to the auto-memory directory.`),autoMemoryDirectory:S().optional().describe(`Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .workmate/settings.json) for security. When unset, defaults to ~/.workmate/projects/<sanitized-cwd>/memory/.`),autoDreamEnabled:y().optional().describe(`Enable background memory consolidation (auto-dream). When set, overrides the server-side default.`),showThinkingSummaries:y().optional().describe(`Show thinking summaries in the transcript view (ctrl+o). Default: false.`),skipDangerousModePermissionPrompt:y().optional().describe(`Whether the user has accepted the bypass permissions mode dialog`),skipAutoPermissionPrompt:y().optional().describe(`Whether the user has accepted the auto mode opt-in dialog`),useAutoModeDuringPlan:y().optional().describe(`Whether plan mode uses auto mode semantics when auto mode is available (default: true)`),autoMode:x({allow:v(S()).optional().describe(`Rules for the auto mode classifier allow section`),soft_deny:v(S()).optional().describe(`Rules for the auto mode classifier deny section`),environment:v(S()).optional().describe(`Entries for the auto mode classifier environment section`)}).optional().describe(`Auto mode classifier prompt customization`),disableAutoMode:T([`disable`]).optional().describe(`Disable auto mode`),agentsMdExcludes:v(S()).optional().describe(`Glob patterns or absolute paths of AGENTS.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/AGENTS.md", "**/code/AGENTS.md", "**/some-dir/.workmate/rules/**"`),cacheThreshold:b().int().min(0).max(100).optional().describe(`Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 80.`),cacheWarningEnabled:y().optional().describe(`Whether to show cache hit rate warnings in the message flow when the rate falls below cacheThreshold. Default: true.`),pluginTrustMessage:S().optional().describe(`Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").`)}).passthrough())}));function Ul(){return ft(ye(Y(),{unrepresentable:`any`}),null,2)}var Wl=e((()=>{w(),xt(),Hl()}));function Gl(e){let t=Kl.find(t=>t.matches(e));if(!t)return null;let n={...t.tip};if(e.code===`invalid_value`&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(e=>`"${e}"`).join(`, `)}`),!n.docLink&&e.path){let t=e.path.split(`.`)[0];t&&(n.docLink=ql[t])}return n}var X,Kl,ql,Jl=e((()=>{X=`https://code.workmate.com/docs/en`,Kl=[{matches:e=>e.path===`permissions.defaultMode`&&e.code===`invalid_value`,tip:{suggestion:`Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)`,docLink:`${X}/iam#permission-modes`}},{matches:e=>e.path===`cleanupPeriodDays`&&e.code===`too_small`&&e.expected===`0`,tip:{suggestion:`Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`}},{matches:e=>e.path.startsWith(`env.`)&&e.code===`invalid_type`,tip:{suggestion:`Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"`,docLink:`${X}/settings#environment-variables`}},{matches:e=>(e.path===`permissions.allow`||e.path===`permissions.deny`)&&e.code===`invalid_type`&&e.expected===`array`,tip:{suggestion:`Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.`}},{matches:e=>e.path.includes(`hooks`)&&e.code===`invalid_type`,tip:{suggestion:`Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}`}},{matches:e=>e.code===`invalid_type`&&e.expected===`boolean`,tip:{suggestion:`Use true or false without quotes. Example: "includeCoAuthoredBy": true`}},{matches:e=>e.code===`unrecognized_keys`,tip:{suggestion:`Check for typos or refer to the documentation for valid fields`,docLink:`${X}/settings`}},{matches:e=>e.code===`invalid_value`&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code===`invalid_type`&&e.expected===`object`&&e.received===null&&e.path===``,tip:{suggestion:`Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error.`}},{matches:e=>e.path===`permissions.additionalDirectories`&&e.code===`invalid_type`,tip:{suggestion:`Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command`,docLink:`${X}/iam#working-directories`}}],ql={permissions:`${X}/iam#configuring-permissions`,env:`${X}/settings#environment-variables`,hooks:`${X}/hooks`}}));function Yl(e){return e.code===`invalid_type`}function Xl(e){return e.code===`invalid_value`}function Zl(e){return e.code===`unrecognized_keys`}function Ql(e){return e.code===`too_small`}function $l(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function eu(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function tu(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if(Xl(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(Yl(e)){o=e.expected;let t=eu(e.message);s=t??$l(e.input),c=t??$l(e.input)}else Ql(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let l=Gl({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if(Xl(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(Yl(e)){let t=eu(e.message)??$l(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(Zl(e)){let t=e.keys.join(`, `);r=`Unrecognized ${Bt(e.keys.length,`field`)}: ${t}`}else Ql(e)&&(r=`Number must be greater than or equal to ${e.minimum}`,i=String(e.minimum));return{file:t,path:n,message:r,expected:i,invalidValue:c,suggestion:l?.suggestion,docLink:l?.docLink}})}function nu(e){try{let t=gt(e),n=Y().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
23
+ `+tu(n.error,`settings`).map(e=>`- ${e.path}: ${e.message}`).join(`
24
+ `),fullSchema:Ul()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:`Unknown parsing error`}`,fullSchema:Ul()}}}function ru(e,t){if(!e||typeof e!=`object`)return[];let n=e;if(!n.permissions||typeof n.permissions!=`object`)return[];let r=n.permissions,i=[];for(let e of[`allow`,`deny`,`ask`]){let n=r[e];Array.isArray(n)&&(r[e]=n.filter(n=>{if(typeof n!=`string`)return i.push({file:t,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:n}),!1;let r=kl(n,e);if(!r.valid){let a=`Invalid permission rule "${n}" was skipped`;return r.error&&(a+=`: ${r.error}`),r.suggestion&&(a+=`. ${r.suggestion}`),i.push({file:t,path:`permissions.${e}`,message:a,invalidValue:n}),!1}return!0}))}return i}var iu=e((()=>{xt(),Ht(),jl(),Wl(),Hl(),Jl()}));function au(){let e=``;try{e=Gt().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${ou}.plist`,label:`per-user managed preferences`}),t.push({path:`/Library/Managed Preferences/${ou}.plist`,label:`device-level managed preferences`}),t}var ou,su,cu,lu,uu,du,fu,pu=e((()=>{ou=`com.workmate`,su=`HKLM\\SOFTWARE\\Policies\\WorkMate`,cu=`HKCU\\SOFTWARE\\Policies\\WorkMate`,lu=`Settings`,uu=`/usr/bin/plutil`,du=[`-convert`,`json`,`-o`,`-`,`--`],fu=5e3}));function mu(e,t){return new Promise(n=>{hn(e,t,{encoding:`utf-8`,timeout:fu},(e,t)=>{n({stdout:t??``,code:+!!e})})})}function hu(){return(async()=>{if(process.platform===`darwin`){let e=au(),t=(await Promise.all(e.map(async({path:e,label:t})=>{if(!$t(e))return{stdout:``,label:t,ok:!1};let{stdout:n,code:r}=await mu(uu,[...du,e]);return{stdout:n,label:t,ok:r===0&&!!n}}))).find(e=>e.ok);return{plistStdouts:t?[{stdout:t.stdout,label:t.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform===`win32`){let[e,t]=await Promise.all([mu(`reg`,[`query`,su,`/v`,lu]),mu(`reg`,[`query`,cu,`/v`,lu])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function gu(){vu||(vu=hu())}function _u(){return vu}var vu,yu=e((()=>{pu(),vu=null}));function bu(){Mu||(Mu=(async()=>{Rt(`mdm_load_start`);let e=Date.now(),{mdm:t,hkcu:n}=Ou(await(_u()??hu()));Au=t,ju=n,Rt(`mdm_load_end`);let r=Date.now()-e;if(O(`MDM settings load completed in ${r}ms`),Object.keys(t.settings).length>0){O(`MDM settings found: ${Object.keys(t.settings).join(`, `)}`);try{z(`info`,`mdm_settings_loaded`,{duration_ms:r,key_count:Object.keys(t.settings).length,error_count:t.errors.length})}catch{}}})())}async function xu(){Mu||bu(),await Mu}function Su(){return Au??Z}function Cu(){return ju??Z}function wu(e,t){Au=e,ju=t}async function Tu(){return Ou(await hu())}function Eu(e,t){let n=pe(e,!1);if(!n||typeof n!=`object`)return{settings:{},errors:[]};let r=ru(n,t),i=Y().safeParse(n);if(!i.success){let e=tu(i.error,t);return{settings:{},errors:[...r,...e]}}return{settings:i.data,errors:r}}function Du(e,t=`Settings`){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,`i`);for(let e of n){let t=e.match(i);if(t?.[1])return t[1].trimEnd()}return null}function Ou(e){if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:t,label:n}=e.plistStdouts[0],r=Eu(t,n);if(Object.keys(r.settings).length>0)return{mdm:r,hkcu:Z}}if(e.hklmStdout){let t=Du(e.hklmStdout);if(t){let e=Eu(t,`Registry: ${su}\\${lu}`);if(Object.keys(e.settings).length>0)return{mdm:e,hkcu:Z}}}if(ku())return{mdm:Z,hkcu:Z};if(e.hkcuStdout){let t=Du(e.hkcuStdout);if(t){let e=Eu(t,`Registry: ${cu}\\${lu}`);return{mdm:Z,hkcu:e}}}return{mdm:Z,hkcu:Z}}function ku(){try{let e=pe(Ka(P(Wo(),`managed-settings.json`)),!1);if(e&&typeof e==`object`&&Object.keys(e).length>0)return!0}catch{}try{let e=Go(),t=A().readdirSync(e);for(let n of t)if(!(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(`.json`)||n.name.startsWith(`.`)))try{let t=pe(Ka(P(e,n.name)),!1);if(t&&typeof t==`object`&&Object.keys(t).length>0)return!0}catch{}}catch{}return!1}var Z,Au,ju,Mu,Nu=e((()=>{bt(),$n(),qa(),k(),_e(),Lt(),Ko(),Hl(),iu(),pu(),yu(),Z=Object.freeze({settings:{},errors:[]}),Au=null,ju=null,Mu=null}));function Pu(){return P(Wo(),`managed-settings.json`)}function Fu(){let e=[],t={},n=!1,{settings:r,errors:i}=Ru(Pu());e.push(...i),r&&Object.keys(r).length>0&&(t=G(t,r,$),n=!0);let a=Go();try{let r=A().readdirSync(a).filter(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`)).map(e=>e.name).sort();for(let i of r){let{settings:r,errors:o}=Ru(P(a,i));e.push(...o),r&&Object.keys(r).length>0&&(t=G(t,r,$),n=!0)}}catch(e){let t=mt(e);t!==`ENOENT`&&t!==`ENOTDIR`&&j(e)}return{settings:n?t:null,errors:e}}function Iu(){let{settings:e}=Ru(Pu()),t=!!e&&Object.keys(e).length>0,n=!1,r=Go();try{n=A().readdirSync(r).some(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`))}catch{}return{hasBase:t,hasDropIns:n}}function Lu(e,t){typeof e==`object`&&e&&`code`in e&&e.code===`ENOENT`?O(`Broken symlink or missing file encountered for settings.json at path: ${t}`):j(e)}function Ru(e){let t=je(e);if(t)return{settings:t.settings?_t(t.settings):null,errors:t.errors};let n=zu(e);return Je(e,n),{settings:n.settings?_t(n.settings):null,errors:n.errors}}function zu(e){try{let{resolvedPath:t}=yt(A(),e),n=Ka(t);if(n.trim()===``)return{settings:{},errors:[]};let r=pe(n,!1),i=ru(r,e),a=Y().safeParse(r);if(!a.success){let t=tu(a.error,e);return{settings:null,errors:[...i,...t]}}return{settings:a.data,errors:i}}catch(t){return Lu(t,e),{settings:null,errors:[]}}}function Bu(e){switch(e){case`userSettings`:return F(p());case`policySettings`:case`projectSettings`:case`localSettings`:return F(rt());case`flagSettings`:{let e=Ze();return e?N(F(e)):F(rt())}}}function Vu(){return Ee()||m(process.env.WORKMATE_USE_COWORK_PLUGINS)?`cowork_settings.json`:`settings.json`}function Hu(e){switch(e){case`userSettings`:return P(Bu(e),Vu());case`projectSettings`:case`localSettings`:return P(Bu(e),Uu(e));case`policySettings`:return Pu();case`flagSettings`:return Ze()}}function Uu(e){switch(e){case`projectSettings`:return P(`.workmate`,`settings.json`);case`localSettings`:return P(`.workmate`,`settings.local.json`)}}function Q(e){let t=Ge(e);if(t!==void 0)return t;let n=Wu(e);return ct(e,n),n}function Wu(e){if(e===`policySettings`){let e=Su();if(Object.keys(e.settings).length>0)return e.settings;let{settings:t}=Fu();if(t)return t;let n=Cu();return Object.keys(n.settings).length>0?n.settings:null}let t=Hu(e),{settings:n}=t?Ru(t):{settings:null};if(e===`flagSettings`){let e=Ie();if(e){let t=Y().safeParse(e);if(t.success)return G(n||{},t.data,$)}}return n}function Gu(){let e=Su();if(Object.keys(e.settings).length>0)return M()===`macos`?`plist`:`hklm`;let{settings:t}=Fu();if(t)return`file`;let n=Cu();return Object.keys(n.settings).length>0?`hkcu`:null}function Ku(e,t){if(e===`policySettings`||e===`flagSettings`)return{error:null};let n=Hu(e);if(!n)return{error:null};try{A().mkdirSync(N(n));let r=Wu(e);if(!r){let e=null;try{e=Ka(n)}catch(e){if(!ht(e))throw e}if(e!==null){let t=pe(e);if(t===null)return{error:Error(`Invalid JSON syntax in settings file at ${n}`)};t&&typeof t==`object`&&(r=t,O(`Using raw settings from ${n} due to validation failure`))}}let i=G(r||{},t,(e,t,n,r)=>{if(t===void 0&&r&&typeof n==`string`){delete r[n];return}if(Array.isArray(t))return t});zo(n),ho(n,`${ft(i,null,2)}\n`),we(),e===`localSettings`&&Co(Uu(`localSettings`),rt())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return j(t),{error:t}}return{error:null}}function qu(e,t){return Va([...e,...t])}function $(e,t){if(Array.isArray(e)&&Array.isArray(t))return qu(e,t)}function Ju(e){let t=Y().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,`disableAutoMode`,`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function Yu(){if(nd)return{settings:{},errors:[]};let e=Date.now();Rt(`loadSettingsFromDisk_start`),z(`info`,`settings_load_started`),nd=!0;try{let t=We(),n={};t&&(n=G(n,t,$));let r=[],i=new Set,a=new Set;for(let e of Ao()){if(e===`policySettings`){let e=null,t=[];{let n=Su();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=Fu();n&&(e=n),t.push(...r)}if(!e){let n=Cu();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=G(n,e,$));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=Hu(e);if(t){let e=F(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=Ru(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=G(n,o,$))}}if(e===`flagSettings`){let e=Ie();if(e){let t=Y().safeParse(e);t.success&&(n=G(n,t.data,$))}}}return z(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{nd=!1}}function Xu(){let{settings:e}=Qu();return e||{}}function Zu(){we();let e=[];for(let t of Ao()){let n=Q(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:Xu(),sources:e}}function Qu(){let e=Ke();if(e!==null)return e;let t=Yu();return Rt(`loadSettingsFromDisk_end`),ot(t),t}function $u(){return!!(Q(`userSettings`)?.skipDangerousModePermissionPrompt||Q(`localSettings`)?.skipDangerousModePermissionPrompt||Q(`flagSettings`)?.skipDangerousModePermissionPrompt||Q(`policySettings`)?.skipDangerousModePermissionPrompt)}function ed(){return Q(`policySettings`)?.useAutoModeDuringPlan!==!1&&Q(`flagSettings`)?.useAutoModeDuringPlan!==!1&&Q(`userSettings`)?.useAutoModeDuringPlan!==!1&&Q(`localSettings`)?.useAutoModeDuringPlan!==!1}function td(e){for(let t of Ao()){if(t===`policySettings`)continue;let n=Hu(t);if(n)try{let{resolvedPath:t}=yt(A(),n),r=Ka(t);if(!r.trim())continue;let i=pe(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){Lu(e,n)}}return!1}var nd,rd,id=e((()=>{Ra(),ze(),Ha(),bt(),$n(),ne(),pt(),bo(),qa(),k(),wo(),_e(),wt(),Ft(),xt(),Lt(),Ro(),Uo(),Ko(),Nu(),Be(),Hl(),iu(),nd=!1,rd=Xu}));export{Qc as $,Hi as $n,Hn as $r,Bo as $t,Vl as A,mo as An,zr as Ar,Ms as At,gl as B,Ha as Bn,Or as Br,hs as Bt,Nu as C,bo as Cn,Kr as Cr,Bs as Ct,gu as D,_o as Dn,Vr as Dr,Fs as Dt,yu as E,go as En,Fr as Er,Ps as Et,Fl as F,Ua as Fn,Mr as Fr,Os as Ft,sl as G,ba as Gn,er as Gr,os as Gt,cl as H,Va as Hn,B as Hr,fs as Ht,fl as I,qa as In,cr as Ir,Ts as It,il as J,ea as Jn,Qn as Jr,es as Jt,tl as K,va as Kn,$n as Kr,ms as Kt,bl as L,Ka as Ln,V as Lr,Cs as Lt,Hl as M,co as Mn,Wr as Mr,xs as Mt,Pl as N,ho as Nn,Rr as Nr,ws as Nt,iu as O,Za as On,Hr as Or,As as Ot,Nl as P,to as Pn,Gr as Pr,Ds as Pt,$c as Q,Bi as Qn,Gn as Qr,Vo as Qt,dl as R,Ga as Rn,xr as Rr,ys as Rt,Su as S,eo as Sn,ei as Sr,qs as St,wu as T,po as Tn,Lr as Tr,Rs as Tt,ul as U,ja as Un,fr as Ur,K as Ut,ll as V,za as Vn,Sr as Vr,gs as Vt,ol as W,Aa as Wn,sr as Wr,as as Wt,al as X,Zi as Xn,Xn as Xr,Go as Xt,rl as Y,Xi as Yn,Yn as Yr,Wo as Yt,Xc as Z,Ui as Zn,Wn as Zr,Ko as Zt,td as _,no as _n,ai as _r,Qs as _t,Uu as a,Mn as ai,Do as an,gi as ar,Gc as at,xu as b,oo as bn,Xr as br,Xs as bt,Bu as c,An as ci,Ro as cn,ci as cr,Vc as ct,rd as d,bn as di,wo as dn,zi as dr,uc as dt,Un as ei,Uo as en,Gi as er,Yc as et,ed as f,Sn as fi,xo as fn,ui as fr,Pc as ft,Ru as g,io as gn,pi as gr,Wc as gt,Fu as h,uo as hn,vi as hr,Nc as ht,Gu as i,zn as ii,Oo as in,Mi as ir,qc as it,Y as j,fo as jn,Ur as jr,Es as jt,nu as k,Qa as kn,jr as kr,ks as kt,Qu as l,Cn as li,jo as ln,_i as lr,Uc as lt,id as m,yn as mi,vo as mn,Di as mr,Mc as mt,Iu as n,Vn as ni,Lo as nn,Vi as nr,el as nt,Hu as o,Ln as oi,To as on,li as or,$s as ot,$u as p,vn as pi,yo as pn,di as pr,Dc as pt,nl as q,sa as qn,z as qr,Zo as qt,Ju as r,Rn as ri,Ao as rn,W as rr,Jc as rt,Q as s,jn as si,Eo as sn,si as sr,Rc as st,Xu as t,Bn as ti,Mo as tn,Wi as tr,Zc as tt,Zu as u,wn as ui,ko as un,mi as ur,Cc as ut,$ as v,ro as vn,ni as vr,Zs as vt,Tu as w,lo as wn,$r as wr,Vs as wt,Cu as x,$a as xn,ti as xr,Ks as xt,Ku as y,so as yn,ii as yr,Js as yt,hl as z,Ba as zn,Cr as zr,bs as zt};
@@ -0,0 +1,3 @@
1
+ import{n as e,t}from"./memoize-BK3gG5ob.js";import{l as n,o as r,s as i}from"./envUtils-DZ_SvEVz.js";import{di as a,fi as o}from"./src-WZ94ZKI3.js";import{Dn as s,F as c,Hn as l,Pt as u,Tn as ee,X as te,at as ne}from"./state-CXY-q5gr.js";import{$_ as d,$x as f,Ab as re,An as p,At as m,Bs as h,By as g,Cg as ie,Db as _,Di as ae,J_ as v,Ji as oe,Ks as se,Lp as ce,Mb as le,Mi as ue,Ob as de,Q_ as fe,Rp as pe,St as me,Vs as y,Ws as b,X_ as x,Y_ as S,Z_ as C,ai as w,am as T,av as E,bb as D,cw as O,dv as k,em as A,ev as j,gr as M,gt as N,ht as P,im as F,iv as I,jb as L,jn as R,kn as z,ky as he,mn as ge,nv as _e,om as ve,ov as ye,ow as be,pn as xe,pv as B,rv as Se,tm as Ce,tv as we,uv as Te,vt as V,wg as Ee,wy as De,xb as H,ya as U,zy as Oe}from"./loadAgentsDir-DR5PVAc3.js";import{n as ke,t as W}from"./cwd-DrEEb4f5.js";import{I as G,M as Ae,N as je,f as Me,u as Ne}from"./debug-kBjDaVkQ.js";import{Ar as Pe,Bn as Fe,Er as Ie,Kr as Le,Kt as Re,Pr as ze,Tr as Be,Ut as Ve,qr as K,zn as He}from"./settings-YIDksG5Z.js";import{a as Ue,d as We}from"./config-D3K87Mm1.js";import{o as Ge,s as Ke}from"./log-DWZny1vM.js";import{n as q}from"./analytics-COpjZpvd.js";import{n as qe,r as J}from"./startupProfiler-DIM_Ihyp.js";import{X as Je,Y as Ye}from"./model-D42epddJ.js";import{pn as Xe,un as Y}from"./prompt-CTByhpUI.js";import{a as Ze,r as Qe}from"./projectOnboardingState-KqcpRXls.js";import{j as $e,k as X}from"./sessionTracing-UFK96PxT.js";import{i as et,n as tt}from"./appleTerminalBackup-C9kjzdM9.js";import{c as nt,t as rt}from"./nativeInstaller-ChGSz1lb.js";import{l as Z,s as it}from"./logoUtils-DR5T0pr3.js";import{i as at,r as ot}from"./runtimeObserver-BPqlbu0B.js";import{t as st}from"./sinks-B-kFqjjd.js";import{writeFile as Q}from"fs/promises";r(),o(),u(),ke(),Le(),Ge(),ze(),Re(),We(),O(),L(),_(),D(),Ee(),ue(),M(),ge(),t(),Xe(),g(),Fe(),b(),Me(),ce(),oe(),R(),Ye(),k(),q(),A(),T(),d(),G();function ct(){return!1}function lt(){return{}}var $;function ut(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=He(e,e=>e.type===`tool_use`))}}return n}function dt(e){let t=B(e);if(!j()){if(!C(t))return!1;Se()}let n=fe(t),r=ut(e,$)>=x(),i=U(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&($=t.uuid),!0}return!1}async function ft(e){let t=Ne(),n=z();await t.mkdir(n,{mode:448});let r=p();try{await Q(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await Q(r,await ve(),{encoding:`utf-8`,mode:384})}catch(e){if(je(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await Oe.call({file_path:r},e),a=``,o=i.data;return o.type===`text`&&(a=o.file.content),a.length,{memoryPath:r,currentMemory:a}}var pt=e(()=>{let e=lt();ye({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:v.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:v.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:v.toolCallsBetweenUpdates})}),mt=Je(async e=>{let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`||!ct()||(pt(),!dt(t)))return;_e();let i=y(n),{memoryPath:a,currentMemory:o}=await ft(i);await se({promptMessages:[f({content:await F(o,a)})],cacheSafeParams:h(e),canUseTool:gt(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let s=t[t.length-1],c=s?Te(s):void 0,l=S();c?.input_tokens,c?.output_tokens,c?.cache_read_input_tokens,c?.cache_creation_input_tokens,l.minimumMessageTokensToInit,l.minimumTokensBetweenUpdate,l.toolCallsBetweenUpdates,I(B(t)),_t(t),we()});function ht(){Ce()&&pe(mt)}function gt(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${Y} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${Y} on ${e} is allowed`}}}}function _t(e){if(!U(e)){let t=e[e.length-1];t?.uuid&&E(t.uuid)}}q(),at(),et(),he(),$e(),G(),Z(),rt(),Qe(),qe(),me();async function vt(e,t,r,o,u,d,f,p){K(`info`,`setup_started`);let h=process.version.match(/^v(\d+)\./)?.[1];if((!h||parseInt(h,10)<18)&&(console.error(a.bold.red(`Error: Work Mate requires Node.js version 18 or higher.`)),process.exit(1)),f&&l(ie(f)),!c())try{let e=await tt();e.status===`restored`?console.log(a.yellow(`Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect.`)):e.status===`failed`&&console.error(a.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){Ke(e)}H(e);let g=Date.now();if(re(),K(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-g}),de(e),o){let t=xe(),n=await Pe();!t&&!n&&(process.stderr.write(a.red(`Error: Can only use --worktree in a git repository, but ${a.bold(e)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.\n`)),process.exit(1));let r=p?`pr-${p}`:u??be(),i;if(n){let e=Be(W());e||(process.stderr.write(a.red(`Error: Could not determine the main git repository root.
2
+ `)),process.exit(1)),e!==(Ie(W())??W())&&(K(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),H(e)),i=d?V(e,m(r)):void 0}else i=d?V(W(),m(r)):void 0;let o;try{o=await N(ne(),r,i,p?{prNumber:p}:void 0)}catch(e){process.stderr.write(a.red(`Error creating worktree: ${Ae(e)}\n`)),process.exit(1)}if(d&&i){let e=await P(i,o.worktreePath);e.created?console.log(a.green(`Created tmux session: ${a.bold(i)}\nTo attach: ${a.bold(`tmux attach -t ${i}`)}`)):console.error(a.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(o.worktreePath),H(o.worktreePath),ee(W()),s(W()),w(o),De(),le()}K(`info`,`setup_background_jobs_starting`),i()||(ht(),ot()),nt(),K(`info`,`setup_background_jobs_launched`),J(`setup_before_prefetch`),K(`info`,`setup_prefetch_starting`);let _=c()&&n(process.env.WORKMATE_SYNC_PLUGIN_INSTALL)||i();if(_||ae(te()),import(`./loadPluginHooks-BiQgGfUJ.js`).then(e=>{_||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),i()||import(`./sessionFileAccessHooks-WO8WTdT9.js`).then(e=>e.registerSessionFileAccessHooks()),st(),J(`setup_after_prefetch`),!i()&&Ze()&&await it(),t===`bypassPermissions`||r){if(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!n(process.env.WORKMATE_BUBBLEWRAP))if(process.stdin.isTTY){console.error(a.bold.red(`WARNING: Running as root/sudo with bypass permissions mode is dangerous.`)),console.error(a.yellow(`Bypass mode skips ALL permission checks. Combined with root, any command (rm -rf /, chmod, dd) executes without review.`));let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout}),t=await new Promise(t=>{e.question(`
3
+ I understand the risks. Continue? [y/N] `,t)});e.close(),t.trim().toLowerCase()!==`y`&&(console.error(`Aborted.`),process.exit(1))}else console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1);if(process.env.WORKMATE_ENTRYPOINT!==`local-agent`&&process.env.WORKMATE_ENTRYPOINT!==`claude-desktop`){let[e,t]=await Promise.all([X.getIsDocker(),Ve.hasInternetAccess()]),n=X.getIsBubblewrapSandbox(),r=process.env.IS_SANDBOX===`1`;(!(e||n||r)||t)&&(console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${e}, Bubblewrap: ${n}, IS_SANDBOX: ${r}, hasInternet: ${t}`),process.exit(1))}}let v=Ue();v.lastCost!==void 0&&v.lastDuration!==void 0&&(v.lastCost,v.lastAPIDuration,v.lastToolDuration,v.lastDuration,v.lastLinesAdded,v.lastLinesRemoved,v.lastTotalInputTokens,v.lastTotalOutputTokens,v.lastTotalCacheCreationInputTokens,v.lastTotalCacheReadInputTokens,v.lastFpsAverage,v.lastFpsLow1Pct,v.lastSessionId,{...v.lastSessionMetrics})}export{vt as setup};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,L as n,R as r,V as i,z as a}from"./loadAgentsDir-DGozQu_6.js";import{in as o}from"./prompt-DzO1um1h.js";function s(e){return e===`projectSettings`||e===`policySettings`||e===`command`}function c(e){return t(e)}function l(e,t,n){let r=c(t.source),i=c(n.source),a=t.ruleValue.toolName;return e===`deny`?`Remove the "${a}" deny rule from ${r}, or remove the specific allow rule from ${i}`:`Remove the "${a}" ask rule from ${r}, or remove the specific allow rule from ${i}`}function u(e,t,n){let{toolName:r,ruleContent:i}=e.ruleValue;if(i===void 0)return{shadowed:!1};let a=t.find(e=>e.ruleValue.toolName===r&&e.ruleValue.ruleContent===void 0);return!a||r===`Bash`&&n.sandboxAutoAllowEnabled&&!s(a.source)?{shadowed:!1}:{shadowed:!0,shadowedBy:a,shadowType:`ask`}}function d(e,t){let{toolName:n,ruleContent:r}=e.ruleValue;if(r===void 0)return{shadowed:!1};let i=t.find(e=>e.ruleValue.toolName===n&&e.ruleValue.ruleContent===void 0);return i?{shadowed:!0,shadowedBy:i,shadowType:`deny`}:{shadowed:!1}}function f(e,t){let i=[],o=n(e),s=r(e),f=a(e);for(let e of o){let n=d(e,f);if(n.shadowed){let t=c(n.shadowedBy.source);i.push({rule:e,reason:`Blocked by "${n.shadowedBy.ruleValue.toolName}" deny rule (from ${t})`,shadowedBy:n.shadowedBy,shadowType:`deny`,fix:l(`deny`,n.shadowedBy,e)});continue}let r=u(e,s,t);if(r.shadowed){let t=c(r.shadowedBy.source);i.push({rule:e,reason:`Shadowed by "${r.shadowedBy.ruleValue.toolName}" ask rule (from ${t})`,shadowedBy:r.shadowedBy,shadowType:`ask`,fix:l(`ask`,r.shadowedBy,e)})}}return i}var p=e((()=>{o(),i()}));export{p as n,f as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,L as n,R as r,V as i,z as a}from"./loadAgentsDir-DR5PVAc3.js";import{in as o}from"./prompt-CTByhpUI.js";function s(e){return e===`projectSettings`||e===`policySettings`||e===`command`}function c(e){return t(e)}function l(e,t,n){let r=c(t.source),i=c(n.source),a=t.ruleValue.toolName;return e===`deny`?`Remove the "${a}" deny rule from ${r}, or remove the specific allow rule from ${i}`:`Remove the "${a}" ask rule from ${r}, or remove the specific allow rule from ${i}`}function u(e,t,n){let{toolName:r,ruleContent:i}=e.ruleValue;if(i===void 0)return{shadowed:!1};let a=t.find(e=>e.ruleValue.toolName===r&&e.ruleValue.ruleContent===void 0);return!a||r===`Bash`&&n.sandboxAutoAllowEnabled&&!s(a.source)?{shadowed:!1}:{shadowed:!0,shadowedBy:a,shadowType:`ask`}}function d(e,t){let{toolName:n,ruleContent:r}=e.ruleValue;if(r===void 0)return{shadowed:!1};let i=t.find(e=>e.ruleValue.toolName===n&&e.ruleValue.ruleContent===void 0);return i?{shadowed:!0,shadowedBy:i,shadowType:`deny`}:{shadowed:!1}}function f(e,t){let i=[],o=n(e),s=r(e),f=a(e);for(let e of o){let n=d(e,f);if(n.shadowed){let t=c(n.shadowedBy.source);i.push({rule:e,reason:`Blocked by "${n.shadowedBy.ruleValue.toolName}" deny rule (from ${t})`,shadowedBy:n.shadowedBy,shadowType:`deny`,fix:l(`deny`,n.shadowedBy,e)});continue}let r=u(e,s,t);if(r.shadowed){let t=c(r.shadowedBy.source);i.push({rule:e,reason:`Shadowed by "${r.shadowedBy.ruleValue.toolName}" ask rule (from ${t})`,shadowedBy:r.shadowedBy,shadowType:`ask`,fix:l(`ask`,r.shadowedBy,e)})}}return i}var p=e((()=>{o(),i()}));export{p as n,f as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{HS as t,Ji as n,Ks as r,Ws as i,XS as a,rS as o,xS as s}from"./loadAgentsDir-DGozQu_6.js";function c(e){let t=[],n=e.matchAll(d);for(let e of n)e.index!==void 0&&t.push({word:e[0],start:e.index,end:e.index+e[0].length});return t}async function l({question:e,cacheSafeParams:t}){let n=await r({promptMessages:[s({content:`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$x as t,Fx as n,Ji as r,Ks as i,OS as a,Ws as o,bS as s}from"./loadAgentsDir-DR5PVAc3.js";function c(e){let t=[],n=e.matchAll(d);for(let e of n)e.index!==void 0&&t.push({word:e[0],start:e.index,end:e.index+e[0].length});return t}async function l({question:e,cacheSafeParams:n}){let r=await i({promptMessages:[t({content:`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
2
2
 
3
3
  IMPORTANT CONTEXT:
4
4
  - You are a separate, lightweight agent spawned to answer this one question
@@ -15,6 +15,6 @@ CRITICAL CONSTRAINTS:
15
15
 
16
16
  Simply answer the question with the information you have.</system-reminder>
17
17
 
18
- ${e}`})],cacheSafeParams:t,canUseTool:async()=>({behavior:`deny`,message:`Side questions cannot use tools`,decisionReason:{type:`other`,reason:`side_question`}}),querySource:`side_question`,forkLabel:`side_question`,maxTurns:1,skipCacheWrite:!0});return{response:u(n.messages),usage:n.totalUsage}}function u(e){let t=e.flatMap(e=>e.type===`assistant`?e.message.content:[]);if(t.length>0){let e=o(t,`
18
+ ${e}`})],cacheSafeParams:n,canUseTool:async()=>({behavior:`deny`,message:`Side questions cannot use tools`,decisionReason:{type:`other`,reason:`side_question`}}),querySource:`side_question`,forkLabel:`side_question`,maxTurns:1,skipCacheWrite:!0});return{response:u(r.messages),usage:r.totalUsage}}function u(e){let t=e.flatMap(e=>e.type===`assistant`?e.message.content:[]);if(t.length>0){let e=n(t,`
19
19
 
20
- `).trim();if(e)return e;let n=t.find(e=>e.type===`tool_use`);if(n)return`(The model tried to call ${`name`in n?n.name:`a tool`} instead of answering directly. Try rephrasing or ask in the main conversation.)`}let n=e.find(e=>e.type===`system`&&`subtype`in e&&e.subtype===`api_error`);return n?`(API error: ${a(n.error)})`:null}var d,f=e((()=>{t(),i(),n(),d=/^\/btw\b/gi}));export{f as n,l as r,c as t};
20
+ `).trim();if(e)return e;let r=t.find(e=>e.type===`tool_use`);if(r)return`(The model tried to call ${`name`in r?r.name:`a tool`} instead of answering directly. Try rephrasing or ask in the main conversation.)`}let r=e.find(e=>e.type===`system`&&`subtype`in e&&e.subtype===`api_error`);return r?`(API error: ${a(r.error)})`:null}var d,f=e((()=>{s(),o(),r(),d=/^\/btw\b/gi}));export{f as n,l as r,c as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./axios-DaWTGg7G.js";import{Pt as n,at as r}from"./state-BQ4BEGin.js";import{$ as i,C as a,c as o,et as s,f as c,i as l,nt as u,rt as d,u as f,x as p}from"./debug-CRnGsZOV.js";import{_ as m,o as h,r as g,t as _,v}from"./log-DoSpAwRP.js";import{n as y}from"./analytics-COpjZpvd.js";import{dirname as b,join as x}from"path";t(),n(),d(),v(),i(),l(),c(),h(),p();var S=g(new Date);function C(){return x(m.errors(),`${S}.jsonl`)}function w(e){return x(m.mcpLogs(e),`${S}.jsonl`)}function T(e){let t=u(e);return{write(e){t.write(`${a(e)}\n`)},flush:t.flush,dispose:t.dispose}}var E=new Map;function D(e){let t=E.get(e);if(!t){let n=b(e);t=T({writeFn:t=>{try{f().appendFileSync(e,t)}catch{f().mkdirSync(n),f().appendFileSync(e,t)}},flushIntervalMs:1e3,maxBufferSize:50}),E.set(e,t),s(async()=>t?.dispose())}return t}function O(e,t){let n={timestamp:new Date().toISOString(),...t,cwd:f().cwd(),userType:process.env.USER_TYPE,sessionId:r(),version:`0.0.25`};D(e).write(n)}function k(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`)return t.message;if(typeof t.error==`object`&&t.error&&`message`in t.error&&typeof t.error.message==`string`)return t.error.message}}function A(t){let n=t.stack||t.message,r=``;if(e.isAxiosError(t)&&t.config?.url){let e=[`url=${t.config.url}`];t.response?.status!==void 0&&e.push(`status=${t.response.status}`);let n=k(t.response?.data);n&&e.push(`body=${n}`),r=`[${e.join(`,`)}] `}o(`${t.name}: ${r}${n}`,{level:`error`}),O(C(),{error:`${r}${n}`})}function j(e,t){o(`MCP server "${e}" ${t}`,{level:`error`});let n=w(e),i={error:t instanceof Error?t.stack||t.message:String(t),timestamp:new Date().toISOString(),sessionId:r(),cwd:f().cwd()};D(n).write(i)}function M(e,t){o(`MCP server "${e}": ${t}`);let n=w(e),i={debug:t,timestamp:new Date().toISOString(),sessionId:r(),cwd:f().cwd()};D(n).write(i)}function N(){_({logError:A,logMCPError:j,logMCPDebug:M,getErrorsPath:C,getMCPLogsPath:w}),o(`Error log sink initialized`)}y();function P(){N()}export{P as t};
1
+ import{n as e,t}from"./axios-DaWTGg7G.js";import{Pt as n,at as r}from"./state-CXY-q5gr.js";import{$ as i,C as a,c as o,et as s,f as c,i as l,nt as u,rt as d,u as f,x as p}from"./debug-kBjDaVkQ.js";import{_ as m,o as h,r as g,t as _,v}from"./log-DWZny1vM.js";import{n as y}from"./analytics-COpjZpvd.js";import{dirname as b,join as x}from"path";t(),n(),d(),v(),i(),l(),c(),h(),p();var S=g(new Date);function C(){return x(m.errors(),`${S}.jsonl`)}function w(e){return x(m.mcpLogs(e),`${S}.jsonl`)}function T(e){let t=u(e);return{write(e){t.write(`${a(e)}\n`)},flush:t.flush,dispose:t.dispose}}var E=new Map;function D(e){let t=E.get(e);if(!t){let n=b(e);t=T({writeFn:t=>{try{f().appendFileSync(e,t)}catch{f().mkdirSync(n),f().appendFileSync(e,t)}},flushIntervalMs:1e3,maxBufferSize:50}),E.set(e,t),s(async()=>t?.dispose())}return t}function O(e,t){let n={timestamp:new Date().toISOString(),...t,cwd:f().cwd(),userType:process.env.USER_TYPE,sessionId:r(),version:`0.0.26`};D(e).write(n)}function k(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`)return t.message;if(typeof t.error==`object`&&t.error&&`message`in t.error&&typeof t.error.message==`string`)return t.error.message}}function A(t){let n=t.stack||t.message,r=``;if(e.isAxiosError(t)&&t.config?.url){let e=[`url=${t.config.url}`];t.response?.status!==void 0&&e.push(`status=${t.response.status}`);let n=k(t.response?.data);n&&e.push(`body=${n}`),r=`[${e.join(`,`)}] `}o(`${t.name}: ${r}${n}`,{level:`error`}),O(C(),{error:`${r}${n}`})}function j(e,t){o(`MCP server "${e}" ${t}`,{level:`error`});let n=w(e),i={error:t instanceof Error?t.stack||t.message:String(t),timestamp:new Date().toISOString(),sessionId:r(),cwd:f().cwd()};D(n).write(i)}function M(e,t){o(`MCP server "${e}": ${t}`);let n=w(e),i={debug:t,timestamp:new Date().toISOString(),sessionId:r(),cwd:f().cwd()};D(n).write(i)}function N(){_({logError:A,logMCPError:j,logMCPDebug:M,getErrorsPath:C,getMCPLogsPath:w}),o(`Error log sink initialized`)}y();function P(){N()}export{P as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./sinks-B-kFqjjd.js";export{e as initSinks};