@readmagic/workmate 0.0.26 → 0.0.27

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 (335) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-mS8iUoWY.js → AddWorkspaceDirectory-DqlPtsVK.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-BHBkysy0.js → AgentsMdExternalIncludesDialog-rJS5l6yk.js} +1 -1
  4. package/dist/chunks/{App-D--vtCyq.js → App-DzRQpRKr.js} +1 -1
  5. package/dist/chunks/BackgroundTasksDialog-CBhSmdz_.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-DyqI98d2.js → BypassPermissionsModeDialog-zz-lnmJt.js} +1 -1
  7. package/dist/chunks/CustomSelect-CYmc4vRh.js +1 -0
  8. package/dist/chunks/{DiffDialog-BQAU2pJx.js → DiffDialog-CTUIAcEE.js} +6 -6
  9. package/dist/chunks/{Doctor-DJOMbSDE.js → Doctor-CLOYkPRR.js} +2 -2
  10. package/dist/chunks/Doctor-CiZNe_qx.js +1 -0
  11. package/dist/chunks/{ExitFlow-xBOnvhiW.js → ExitFlow-CATwJC4c.js} +1 -1
  12. package/dist/chunks/{InvalidConfigDialog-NiuhcaG5.js → InvalidConfigDialog-B-9Z58oD.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-DrromC1I.js → InvalidSettingsDialog-B4EWjbp7.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-Dzg77_Xn.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +1 -0
  16. package/dist/chunks/MCPToolListView-C7HT6rrl.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-BYG2yqjO.js → McpParsingWarnings-Dj_Fu5o-.js} +1 -1
  18. package/dist/chunks/MessageSelector-Dw_ERK_Z.js +3 -0
  19. package/dist/chunks/Messages-RBfRELKn.js +10 -0
  20. package/dist/chunks/Onboarding-BRSXxc2E.js +1 -0
  21. package/dist/chunks/{PermissionDialog-tEMMa5-a.js → PermissionDialog-DjCRuzSm.js} +1 -1
  22. package/dist/chunks/{PressEnterToContinue-CPOaYnym.js → PressEnterToContinue-DE1RxMX_.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CwqAsTI2.js → PromptInputFooterSuggestions-ChpyD9B7.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-CrTT8MKE.js +1 -0
  25. package/dist/chunks/{ProviderSetup-J6Ty-Wj8.js → ProviderSetup-BEV95bnz.js} +1 -1
  26. package/dist/chunks/QueryEngine-BBBkZWu2.js +1 -0
  27. package/dist/chunks/REPL-BDnZnm__.js +124 -0
  28. package/dist/chunks/REPL-BHk0vZDf.js +1 -0
  29. package/dist/chunks/{ResumeConversation-Cmsbo5m7.js → ResumeConversation-BuSqBrm1.js} +1 -1
  30. package/dist/chunks/{SearchBox-DQBLKyzJ.js → SearchBox-zA5QwIpO.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +1 -0
  32. package/dist/chunks/Settings-DYKmPdbd.js +2 -0
  33. package/dist/chunks/Spinner-DOI8qqZi.js +1 -0
  34. package/dist/chunks/SpinnerGlyph-BR_SiV9L.js +1 -0
  35. package/dist/chunks/{TextInput-BboKIug2.js → TextInput-ZKU-x_FD.js} +7 -7
  36. package/dist/chunks/{ThemePicker-DTpXbEY0.js → ThemePicker-B69oDgXN.js} +1 -1
  37. package/dist/chunks/TrustDialog-BSG8Ibh8.js +1 -0
  38. package/dist/chunks/{ValidationErrorsList-C_gDQfm1.js → ValidationErrorsList-BUYHEft4.js} +1 -1
  39. package/dist/chunks/{_baseEach-DGbaIpJA.js → _baseEach-P0u1zIx6.js} +1 -1
  40. package/dist/chunks/{add-dir-B576wzi9.js → add-dir-C8RmmyQK.js} +1 -1
  41. package/dist/chunks/{agentDisplay-ZuFoBZYu.js → agentDisplay-np7CH47m.js} +1 -1
  42. package/dist/chunks/{agents-Dy4_hDic.js → agents-DRQlR5M1.js} +1 -1
  43. package/dist/chunks/agents-DedoH0Q4.js +101 -0
  44. package/dist/chunks/allErrors-DvcU0w0F.js +1 -0
  45. package/dist/chunks/{appleTerminalBackup-C9kjzdM9.js → appleTerminalBackup-Bemd4RXh.js} +1 -1
  46. package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +1 -0
  47. package/dist/chunks/{backgroundHousekeeping-PyLNnGdw.js → backgroundHousekeeping-BtEJ6TeC.js} +1 -1
  48. package/dist/chunks/banner-CuoceXzz.js +2 -0
  49. package/dist/chunks/branch-ClhlS7f8.js +2 -0
  50. package/dist/chunks/{break-cache-DL95nKZl.js → break-cache-B1nuWtD_.js} +2 -2
  51. package/dist/chunks/{btw-Y44ctueB.js → btw-B-FLxlx-.js} +1 -1
  52. package/dist/chunks/bundledMode-D9omqD3L.js +2 -0
  53. package/dist/chunks/caches-D7arwhaa.js +1 -0
  54. package/dist/chunks/caches-Dn8yrJmL.js +1 -0
  55. package/dist/chunks/{clear-DtTkA707.js → clear-BnWv0i65.js} +1 -1
  56. package/dist/chunks/{client-aJ2Nr_sh.js → client-2w-g5kMx.js} +1 -1
  57. package/dist/chunks/client-B0ngS4Uu.js +1 -0
  58. package/dist/chunks/client-BP4DOH3K.js +1 -0
  59. package/dist/chunks/{client-Bw_L3lSc.js → client-pA7fKk0-.js} +1 -1
  60. package/dist/chunks/commands-AcfFLgl5.js +1 -0
  61. package/dist/chunks/{compact-CvNOtu7J.js → compact-Banc-SNk.js} +1 -1
  62. package/dist/chunks/config-BDn2YIjC.js +3 -0
  63. package/dist/chunks/config-BhBcadjZ.js +1 -0
  64. package/dist/chunks/config-Bm5pVdCq.js +1 -0
  65. package/dist/chunks/{context-Opu4E8dL.js → context-BvDBAyJ9.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BK2IDLSS.js +1 -0
  67. package/dist/chunks/{context-noninteractive-B1V2Mp26.js → context-noninteractive-CuHHniJn.js} +9 -9
  68. package/dist/chunks/conversation-B2dX3X4Z.js +1 -0
  69. package/dist/chunks/{conversation-CG_z7TLE.js → conversation-Cjaftrrw.js} +1 -1
  70. package/dist/chunks/conversationRecovery-NL05oJb1.js +1 -0
  71. package/dist/chunks/crossProjectResume-BzltC4NJ.js +40 -0
  72. package/dist/chunks/{debug-kBjDaVkQ.js → debug-2pVES-2G.js} +1 -1
  73. package/dist/chunks/detectRepository--luIRv5H.js +1 -0
  74. package/dist/chunks/{diff-Cv7tX2-P.js → diff--6gQCx_x.js} +1 -1
  75. package/dist/chunks/directoryCompletion-BC0qRmrz.js +1 -0
  76. package/dist/chunks/doctor-CQf8xPZH.js +1 -0
  77. package/dist/chunks/entry-DWYOrkFS.js +13 -0
  78. package/dist/chunks/{envUtils-DZ_SvEVz.js → envUtils-QyzA_cFM.js} +1 -1
  79. package/dist/chunks/{execFileNoThrow-BfZFnCGa.js → execFileNoThrow-DXSEj8ZO.js} +1 -1
  80. package/dist/chunks/{exit-OKEV_ddw.js → exit-uKtXb5U3.js} +1 -1
  81. package/dist/chunks/{extraUsage-BlRL3yeb.js → extraUsage-Dr0YXm1w.js} +1 -1
  82. package/dist/chunks/extractMemories-8yvMGZ1J.js +1 -0
  83. package/dist/chunks/fast-C5-lNCQi.js +1 -0
  84. package/dist/chunks/fast-aNkj6WvB.js +1 -0
  85. package/dist/chunks/fetchModelList-9w1E4Ue8.js +1 -0
  86. package/dist/chunks/fetchModelList-D2quBF6M.js +1 -0
  87. package/dist/chunks/fileSuggestions-BYD78vcF.js +3 -0
  88. package/dist/chunks/{fpsMetrics-Ixd0J4CH.js → fpsMetrics-DIpm2-xw.js} +1 -1
  89. package/dist/chunks/{gemini-BfVyavwQ.js → gemini-BNBptTET.js} +1 -1
  90. package/dist/chunks/generateSessionName-CO2484aJ.js +1 -0
  91. package/dist/chunks/{genericProcessUtils-CVtQOTO2.js → genericProcessUtils-GqURdVAv.js} +1 -1
  92. package/dist/chunks/{goal-BidR-GFa.js → goal-j0wdadwM.js} +1 -1
  93. package/dist/chunks/{grok-DLcuI-U7.js → grok-BpO1ZwK_.js} +1 -1
  94. package/dist/chunks/{help-CZuvYhXj.js → help-DwhA0qQ6.js} +1 -1
  95. package/dist/chunks/{history-BxPGftQw.js → history-CUrqO9rV.js} +1 -1
  96. package/dist/chunks/hooks-B5Wq-KxE.js +1 -0
  97. package/dist/chunks/{hooks-ehqfAM5F.js → hooks-DG4_WdZ2.js} +2 -2
  98. package/dist/chunks/install-BbmCNCuM.js +1 -0
  99. package/dist/chunks/{instrumentation-B9bfF2mA.js → instrumentation-DpPmDyNF.js} +4 -4
  100. package/dist/chunks/{job-Coztdn6A.js → job-GcmX1ALd.js} +1 -1
  101. package/dist/chunks/{keybindings-DwSdLpaE.js → keybindings-CxgQqQJe.js} +1 -1
  102. package/dist/chunks/{launchLocalMemory-DRzfpIOB.js → launchLocalMemory-CDgT5lst.js} +1 -1
  103. package/dist/chunks/{launchOnboarding-D2zFCJf-.js → launchOnboarding-uQ_ux9sS.js} +1 -1
  104. package/dist/chunks/loadAgentsDir-BBbIAiay.js +1 -0
  105. package/dist/chunks/{loadAgentsDir-DR5PVAc3.js → loadAgentsDir-uuZYOgKn.js} +392 -392
  106. package/dist/chunks/{loadPluginHooks-BiQgGfUJ.js → loadPluginHooks-QoVXsBjy.js} +1 -1
  107. package/dist/chunks/loader-BMAtuwRa.js +1 -0
  108. package/dist/chunks/localSearch-D6MhwvnR.js +1 -0
  109. package/dist/chunks/{localSearch-CzkxDuOR.js → localSearch-yVCDrVrf.js} +1 -1
  110. package/dist/chunks/{log-DWZny1vM.js → log-L1kqxa_P.js} +1 -1
  111. package/dist/chunks/{logoUtils-DR5T0pr3.js → logoUtils-B4wCDKs9.js} +1 -1
  112. package/dist/chunks/{magicDocs-BwBxjfLo.js → magicDocs-D53lV8b5.js} +2 -2
  113. package/dist/chunks/{main-Ryi27wYq.js → main-fy_XSXGj.js} +34 -34
  114. package/dist/chunks/{managedEnv-Do9fgLpk.js → managedEnv-B8YWmM4A.js} +1 -1
  115. package/dist/chunks/managedEnv-ulQBH73B.js +1 -0
  116. package/dist/chunks/{managedEnvConstants-CWcT7nYr.js → managedEnvConstants-BPY8yF1A.js} +1 -1
  117. package/dist/chunks/{mcp-BCpnF6wD.js → mcp--LmEVBRg.js} +1 -1
  118. package/dist/chunks/mcp-CZUVaPb3.js +5 -0
  119. package/dist/chunks/{mcp-CZBTxbhu.js → mcp-DCl-Tz-C.js} +1 -1
  120. package/dist/chunks/memory-Bu5ku7y9.js +1 -0
  121. package/dist/chunks/{modalContext-CBE8xuck.js → modalContext-sU2lfR08.js} +1 -1
  122. package/dist/chunks/{mode-wq70cR44.js → mode-Bteqe2QG.js} +1 -1
  123. package/dist/chunks/{model-DVk9-2dk.js → model-CHDU5yqH.js} +1 -1
  124. package/dist/chunks/model-CcHyMyBv.js +1 -0
  125. package/dist/chunks/modelOptions-CJV1R3Jt.js +1 -0
  126. package/dist/chunks/nativeInstaller-CIUYh1aD.js +1 -0
  127. package/dist/chunks/{notifications-dGBuNvFj.js → notifications-GLnjirCl.js} +1 -1
  128. package/dist/chunks/{observationStore-D0rm3GhP.js → observationStore-pnSSxec_.js} +1 -1
  129. package/dist/chunks/{onChangeAppState-B4K-rSaF.js → onChangeAppState-CxGW2d-l.js} +1 -1
  130. package/dist/chunks/{openai-DAwnAV9K.js → openai-BpGQT2Iv.js} +1 -1
  131. package/dist/chunks/{overlayContext-B6i_6y_0.js → overlayContext-7wgLio1O.js} +1 -1
  132. package/dist/chunks/{panel-C0CF3noE.js → panel-DNiXDhBX.js} +1 -1
  133. package/dist/chunks/{parser-DThLwgdM.js → parser-CTnaXFVJ.js} +1 -1
  134. package/dist/chunks/parser-Diihup2V.js +1 -0
  135. package/dist/chunks/{partition-BRQHofxD.js → partition-djFY9gGI.js} +1 -1
  136. package/dist/chunks/{pasteStore-BmehVo5j.js → pasteStore-njJCBMKr.js} +1 -1
  137. package/dist/chunks/permissions-DNedQyLg.js +3 -0
  138. package/dist/chunks/pidLock-CFUBtZck.js +3 -0
  139. package/dist/chunks/{plan-B6U3ioer.js → plan-DI0n7LIV.js} +1 -1
  140. package/dist/chunks/plugin-BQ8gRVYF.js +17 -0
  141. package/dist/chunks/pluginAutoupdate-CNrHb4RJ.js +1 -0
  142. package/dist/chunks/{pluginBlocklist-DAoUENwc.js → pluginBlocklist-CKCsgWdY.js} +1 -1
  143. package/dist/chunks/{pluginCliCommands-CaHnj0C_.js → pluginCliCommands-CACeyIwz.js} +1 -1
  144. package/dist/chunks/{pluginFlagging-BCj9LJP3.js → pluginFlagging-CUvkKGOB.js} +1 -1
  145. package/dist/chunks/pluginOperations-Ca_T-HYn.js +2 -0
  146. package/dist/chunks/pluginStartupCheck-DftTiXct.js +1 -0
  147. package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +1 -0
  148. package/dist/chunks/{plugins-D7zyI9c4.js → plugins-Divl-P-X.js} +1 -1
  149. package/dist/chunks/{poorMode-Ocff_UT1.js → poorMode-CG2JNTD0.js} +1 -1
  150. package/dist/chunks/poorMode-eMIFCAC_.js +1 -0
  151. package/dist/chunks/print-DSHypGJa.js +13 -0
  152. package/dist/chunks/processBashCommand-BLcFmbyG.js +1 -0
  153. package/dist/chunks/processSlashCommand-Caif46Gi.js +5 -0
  154. package/dist/chunks/{projectContext-QN5U3Ggr.js → projectContext-BFfHgAMh.js} +1 -1
  155. package/dist/chunks/{projectContext-COeHKDrk.js → projectContext-DnJHynXv.js} +1 -1
  156. package/dist/chunks/{projectOnboardingState-KqcpRXls.js → projectOnboardingState-nTCycGCD.js} +1 -1
  157. package/dist/chunks/prompt-BZmu5CeK.js +1 -0
  158. package/dist/chunks/{prompt-CTByhpUI.js → prompt-BfXryFt-.js} +8 -8
  159. package/dist/chunks/prompt-Cogr_WZr.js +1 -0
  160. package/dist/chunks/promptEditor-14TB3MYt.js +4 -0
  161. package/dist/chunks/protocolHandler-VigBkAQQ.js +13 -0
  162. package/dist/chunks/{proxy-BtWuysHM.js → proxy--_NfbJhm.js} +1 -1
  163. package/dist/chunks/reconciler-B9XFdL4f.js +1 -0
  164. package/dist/chunks/{refresh-B4pqFp12.js → refresh-CBHbWTGg.js} +1 -1
  165. package/dist/chunks/reject-CBxnwckZ.js +1 -0
  166. package/dist/chunks/{reload-plugins-DXQqk7q6.js → reload-plugins-5eFWrQlL.js} +1 -1
  167. package/dist/chunks/{rename-D4XBmTBI.js → rename-Cw7cMerG.js} +1 -1
  168. package/dist/chunks/{renderOptions-DkP98P_d.js → renderOptions-B0RFpjRI.js} +1 -1
  169. package/dist/chunks/{resume-DzIev0JI.js → resume-U2D0ybfU.js} +1 -1
  170. package/dist/chunks/ripgrep-67m14ImZ.js +5 -0
  171. package/dist/chunks/ripgrep-DB7KB8RZ.js +1 -0
  172. package/dist/chunks/{runtimeObserver-BPqlbu0B.js → runtimeObserver-CWaYMJG8.js} +2 -2
  173. package/dist/chunks/{runtimeObserver-BUHs3qjs.js → runtimeObserver-DOYlxx9H.js} +1 -1
  174. package/dist/chunks/sandbox-adapter-Df7Wpt77.js +1 -0
  175. package/dist/chunks/sandbox-toggle-BtiPyjT3.js +1 -0
  176. package/dist/chunks/searchExtraTools-CbJVb_Zk.js +1 -0
  177. package/dist/chunks/select-BuTJbu_Q.js +1 -0
  178. package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +1 -0
  179. package/dist/chunks/sessionObserver-BZVgzp3W.js +1 -0
  180. package/dist/chunks/{sessionObserver-B6xzxckA.js → sessionObserver-cfwD8pV8.js} +1 -1
  181. package/dist/chunks/sessionStorage-SC5RfnUP.js +1 -0
  182. package/dist/chunks/sessionTracing-DsdcOqvc.js +11 -0
  183. package/dist/chunks/settings-D4M13toi.js +104 -0
  184. package/dist/chunks/settings-Dfit5gGT.js +1 -0
  185. package/dist/chunks/setup-DR-KEmxL.js +3 -0
  186. package/dist/chunks/{shadowedRuleDetection-D6R2OeoH.js → shadowedRuleDetection-DiZUDzxU.js} +1 -1
  187. package/dist/chunks/{sideQuestion-5jcbOMsR.js → sideQuestion-CdgUarC2.js} +1 -1
  188. package/dist/chunks/{sinks-B-kFqjjd.js → sinks-Cy3NqVbk.js} +1 -1
  189. package/dist/chunks/sinks-D41OiGE4.js +1 -0
  190. package/dist/chunks/{skillChangeDetector-103-nEle.js → skillChangeDetector-CVFCJcG7.js} +1 -1
  191. package/dist/chunks/{skillGapStore-DOz1KCqo.js → skillGapStore-BJV8ZIB1.js} +2 -2
  192. package/dist/chunks/{skillLifecycle-D9NkIwFQ.js → skillLifecycle-iO_3s9Ff.js} +2 -2
  193. package/dist/chunks/{skillSearchPanel-DFiSZaJ4.js → skillSearchPanel-BL5gXTHU.js} +2 -2
  194. package/dist/chunks/skills-BEp3_RyT.js +1 -0
  195. package/dist/chunks/sleep-xKMbXTJe.js +1 -0
  196. package/dist/chunks/{src-WZ94ZKI3.js → src-BX54x08P.js} +1 -1
  197. package/dist/chunks/{src-Cy5_qH26.js → src-HB5wLari.js} +1 -1
  198. package/dist/chunks/{startupProfiler-DIM_Ihyp.js → startupProfiler-B9Qv2QGH.js} +1 -1
  199. package/dist/chunks/startupProfiler-DWcM4QBl.js +1 -0
  200. package/dist/chunks/{staticRender-RHUIg5ln.js → staticRender-Bt82RvGc.js} +1 -1
  201. package/dist/chunks/status-6JMz8jmM.js +1 -0
  202. package/dist/chunks/{statusNoticeHelpers-DI45AH-c.js → statusNoticeHelpers-BoloSeXY.js} +1 -1
  203. package/dist/chunks/{stringUtils-D_xPrwGQ.js → stringUtils-Cs6E5f-B.js} +1 -1
  204. package/dist/chunks/switcher-95d4TrQH.js +1 -0
  205. package/dist/chunks/{switcher-DhZCaAun.js → switcher-DSt2cVjA.js} +1 -1
  206. package/dist/chunks/{tasks-6suPhqsK.js → tasks-DyBUXnQb.js} +1 -1
  207. package/dist/chunks/{templateJobs-BKVEWCsb.js → templateJobs-BBnReWWj.js} +7 -7
  208. package/dist/chunks/{terminalSetup-7PUR4hfo.js → terminalSetup-CDpFfqqV.js} +1 -1
  209. package/dist/chunks/{terminalSetup-Cqy5_PhJ.js → terminalSetup-DedaY1P7.js} +4 -4
  210. package/dist/chunks/{theme-B-HG2PUs.js → theme-BZOy9Iqh.js} +1 -1
  211. package/dist/chunks/tipRegistry-Cl5sdLRX.js +2 -0
  212. package/dist/chunks/{toolEventObserver-BY3QVnr6.js → toolEventObserver-ClwWmVbH.js} +1 -1
  213. package/dist/chunks/{toolPool-BcwIF8Q_.js → toolPool-DSTbgGmX.js} +1 -1
  214. package/dist/chunks/{udsClient-CCxgLiZy.js → udsClient-CWeoNrm3.js} +1 -1
  215. package/dist/chunks/{useDoublePress-DQBLKyzJ.js → useDoublePress-zA5QwIpO.js} +1 -1
  216. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BgJrnuDl.js → useExitOnCtrlCDWithKeybindings-ClN4NJnB.js} +1 -1
  217. package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +1 -0
  218. package/dist/chunks/useManagePlugins-CxHz-gUP.js +1 -0
  219. package/dist/chunks/useMergedTools-BUuWew0-.js +1 -0
  220. package/dist/chunks/{useSearchInput-BITV_Txn.js → useSearchInput-BIQN_-Hm.js} +1 -1
  221. package/dist/chunks/{useSettingsErrors-CO0fTNzn.js → useSettingsErrors-BDJCLei_.js} +1 -1
  222. package/dist/chunks/util-BHr5l6Bx.js +1 -0
  223. package/dist/chunks/validatePlugin-fx1Y8vam.js +1 -0
  224. package/dist/chunks/{vim-qgMS88ss.js → vim-CYjMtnwH.js} +1 -1
  225. package/dist/chunks/worktree-CGu_58ue.js +1 -0
  226. package/dist/cli.js +1 -1
  227. package/package.json +2 -2
  228. package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +0 -1
  229. package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +0 -2
  230. package/dist/chunks/CustomSelect-CpMbxYbt.js +0 -1
  231. package/dist/chunks/Doctor-BU69VQzw.js +0 -1
  232. package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +0 -1
  233. package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +0 -1
  234. package/dist/chunks/MCPToolListView-BRxjOaOL.js +0 -1
  235. package/dist/chunks/MessageSelector-B7xAQqZI.js +0 -3
  236. package/dist/chunks/Messages-CxMsfjOa.js +0 -10
  237. package/dist/chunks/Onboarding-CkATe87e.js +0 -1
  238. package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +0 -1
  239. package/dist/chunks/QueryEngine-Mdi_kUaL.js +0 -1
  240. package/dist/chunks/REPL-BgzQtSFF.js +0 -1
  241. package/dist/chunks/REPL-rirm6s_7.js +0 -124
  242. package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +0 -1
  243. package/dist/chunks/SelectMulti-BpAjjhsn.js +0 -1
  244. package/dist/chunks/Settings-B6DImvca.js +0 -2
  245. package/dist/chunks/Spinner-DhhSOFcN.js +0 -1
  246. package/dist/chunks/SpinnerGlyph-CmVXC-_9.js +0 -1
  247. package/dist/chunks/TrustDialog-CZ8JpySm.js +0 -1
  248. package/dist/chunks/agents-HIOBiw4w.js +0 -101
  249. package/dist/chunks/allErrors-CxPNR2WN.js +0 -1
  250. package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +0 -1
  251. package/dist/chunks/banner-DqFectPg.js +0 -2
  252. package/dist/chunks/branch-B_BL5N9N.js +0 -2
  253. package/dist/chunks/bundledMode-BxyD5cqq.js +0 -1
  254. package/dist/chunks/caches-5xZ4dSXt.js +0 -1
  255. package/dist/chunks/caches-Be9saXxV.js +0 -1
  256. package/dist/chunks/claudeDesktop-g8eUUY2E.js +0 -1
  257. package/dist/chunks/client-mnUISv_N.js +0 -1
  258. package/dist/chunks/client-wPqIdEVm.js +0 -1
  259. package/dist/chunks/commands-wfE12a4L.js +0 -1
  260. package/dist/chunks/config-D3K87Mm1.js +0 -3
  261. package/dist/chunks/config-DTga6Ku8.js +0 -1
  262. package/dist/chunks/config-DtmqWusU.js +0 -1
  263. package/dist/chunks/context-noninteractive-eIlneYiL.js +0 -1
  264. package/dist/chunks/conversation-CHesBfFZ.js +0 -1
  265. package/dist/chunks/conversationRecovery-OhitW-7g.js +0 -1
  266. package/dist/chunks/crossProjectResume-mmYx8PrZ.js +0 -40
  267. package/dist/chunks/detectRepository-M6K2wc7h.js +0 -1
  268. package/dist/chunks/directoryCompletion-BHyjyKAM.js +0 -1
  269. package/dist/chunks/doctor-DeBG5SL5.js +0 -1
  270. package/dist/chunks/entry-CbhyIWgj.js +0 -13
  271. package/dist/chunks/extractMemories-jnsv-_n_.js +0 -1
  272. package/dist/chunks/fast-4I_qPJCd.js +0 -1
  273. package/dist/chunks/fast-DiolM1M7.js +0 -1
  274. package/dist/chunks/fetchModelList-BRFTQim4.js +0 -1
  275. package/dist/chunks/fetchModelList-qPKAuu4m.js +0 -1
  276. package/dist/chunks/fileSuggestions-iWVXvvLB.js +0 -3
  277. package/dist/chunks/generateSessionName-CGaTTXCA.js +0 -1
  278. package/dist/chunks/hooks-Bg9WIjZQ.js +0 -1
  279. package/dist/chunks/install-ACGY0vhM.js +0 -1
  280. package/dist/chunks/loadAgentsDir-DqAbnpB-.js +0 -1
  281. package/dist/chunks/loader-6MqzNGmV.js +0 -1
  282. package/dist/chunks/localSearch-DW3JT2MA.js +0 -1
  283. package/dist/chunks/managedEnv-DCEJh3z3.js +0 -1
  284. package/dist/chunks/mcp-CJ6SDJEK.js +0 -6
  285. package/dist/chunks/memory-BQO6Y0ak.js +0 -1
  286. package/dist/chunks/model-D42epddJ.js +0 -1
  287. package/dist/chunks/modelOptions-beLgXORr.js +0 -1
  288. package/dist/chunks/nativeInstaller-ChGSz1lb.js +0 -1
  289. package/dist/chunks/parser-BZt0VFd_.js +0 -1
  290. package/dist/chunks/permissions-DkfWKN-B.js +0 -3
  291. package/dist/chunks/pidLock-YvAaIrIY.js +0 -3
  292. package/dist/chunks/platform-Vl9IynC3.js +0 -2
  293. package/dist/chunks/plugin-CTA2_-F7.js +0 -17
  294. package/dist/chunks/pluginAutoupdate-Dy5W3HWE.js +0 -1
  295. package/dist/chunks/pluginOperations-ClXNOOG6.js +0 -2
  296. package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +0 -1
  297. package/dist/chunks/pluginStartupCheck-U8_xk25t.js +0 -1
  298. package/dist/chunks/poorMode-DtzWNhsY.js +0 -1
  299. package/dist/chunks/print-BzljdXem.js +0 -13
  300. package/dist/chunks/processBashCommand-RUkmyAl4.js +0 -1
  301. package/dist/chunks/processSlashCommand-DRLO-jNV.js +0 -5
  302. package/dist/chunks/prompt-DTpfW6yP.js +0 -1
  303. package/dist/chunks/prompt-D__eHY_5.js +0 -1
  304. package/dist/chunks/promptEditor-CpUFgGzc.js +0 -4
  305. package/dist/chunks/protocolHandler-BQSLVGnG.js +0 -13
  306. package/dist/chunks/reconciler-D6BUq8WB.js +0 -1
  307. package/dist/chunks/reject-C6IvUvBt.js +0 -1
  308. package/dist/chunks/ripgrep-CYP26Fhg.js +0 -1
  309. package/dist/chunks/ripgrep-D1f1pbCz.js +0 -5
  310. package/dist/chunks/sandbox-adapter-CumL75tU.js +0 -1
  311. package/dist/chunks/sandbox-toggle-CTtET6Xq.js +0 -1
  312. package/dist/chunks/searchExtraTools-BMCU2zEf.js +0 -1
  313. package/dist/chunks/select-FrwoTzuc.js +0 -1
  314. package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +0 -1
  315. package/dist/chunks/sessionObserver-CBrM4opL.js +0 -1
  316. package/dist/chunks/sessionStorage-C1EAxDWG.js +0 -1
  317. package/dist/chunks/sessionTracing-UFK96PxT.js +0 -11
  318. package/dist/chunks/settings-BK6gCko-.js +0 -1
  319. package/dist/chunks/settings-YIDksG5Z.js +0 -24
  320. package/dist/chunks/setup-BBvZyrfz.js +0 -3
  321. package/dist/chunks/sinks-DB_D4lmu.js +0 -1
  322. package/dist/chunks/skills-DgeLr52a.js +0 -1
  323. package/dist/chunks/sleep-BbWr_FL1.js +0 -1
  324. package/dist/chunks/startupProfiler-FpGsKWYk.js +0 -1
  325. package/dist/chunks/status-CKLecQZV.js +0 -1
  326. package/dist/chunks/switcher-D2Z2ZNQ0.js +0 -1
  327. package/dist/chunks/tipRegistry-BR_lSGRw.js +0 -2
  328. package/dist/chunks/types-CD25a50S.js +0 -81
  329. package/dist/chunks/use-select-navigation-CW5alA9r.js +0 -1
  330. package/dist/chunks/useMainLoopModel-BVgJo4hN.js +0 -1
  331. package/dist/chunks/useManagePlugins-CrWjzESW.js +0 -1
  332. package/dist/chunks/useMergedTools-r6GQq5mI.js +0 -1
  333. package/dist/chunks/util-_zo3I1y8.js +0 -1
  334. package/dist/chunks/validatePlugin-DFGdRhA-.js +0 -1
  335. package/dist/chunks/worktree-CR_M6Qfy.js +0 -1
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DZ_SvEVz.js";import{Ci as r,Lp as i,Mi as a,Rp as o}from"./loadAgentsDir-DR5PVAc3.js";import{n as s,t as c}from"./featureCheck-D6FjD-nt.js";import{a as l,s as u}from"./projectContext-QN5U3Ggr.js";import{a as d,c as ee,i as f,l as p,n as m,o as h,r as te,s as ne,u as g}from"./instinctParser-Dt-lqnDe.js";import{a as re,i as ie,n as _,o as v,r as y,t as ae}from"./observationStore-D0rm3GhP.js";import{a as oe,i as se,o as ce,r as le}from"./sessionObserver-B6xzxckA.js";import{a as ue,d as b,i as de,l as x,n as S,r as fe,s as C,t as pe,u as w}from"./skillLifecycle-D9NkIwFQ.js";import{join as T}from"node:path";import{existsSync as E}from"node:fs";import{randomBytes as me}from"node:crypto";import{mkdir as D,readFile as he,readdir as O,rename as ge,unlink as _e,writeFile as k}from"node:fs/promises";function A(e){let t=_(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?T(t,`global`,`instincts`,`personal`):T(t,`projects`,n.projectId,`instincts`,`personal`)}async function j(e,t){let n=h(e);await D(A(t),{recursive:!0});let r=N(n.id,t),i=`${r}.${me(6).toString(`hex`)}.tmp`;return await k(i,ee(n)),await ge(i,r),n}async function M(e){let t=A(e),n=[];try{n=await O(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await he(T(t,e),`utf8`);r.push(ne(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function ve(e,t){let n=P.then(()=>ye(e,t));return P=n.catch(()=>{}),n}async function ye(e,t){let n=await M(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&d(t,e)),i=new Date().toISOString();if(!r)return j(e,t);let a=d(r,e),o=a?-.1:Se(e.evidenceOutcome),s=m(r.confidence+o),c=be(r.status,s,a);return j(h({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function be(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function xe(e){let t=await M(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/F);if(a<1)continue;let o=-.02*a,s=m(i.confidence+o);s!==i.confidence&&(await j(h({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function Se(e){return e===`failure`?-.05:.05}async function Ce(e,t){let n=await M(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await _e(N(e.id,t)),i.push(e));return i}function N(e,t){return T(A(t),`${e}.json`)}var P,F,I=e((()=>{y(),f(),P=Promise.resolve(),F=10080*60*1e3}));function we(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=w(t?.name??De(e)),i=Ae(e),a=t?.description??Oe(e),o=Ee(r,n,t),s=ke({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function Te(e){await D(e.outputPath,{recursive:!0});let t=T(e.outputPath,`${e.name}.md`);return E(t)?t:(await k(t,e.content,`utf8`),r(),t)}function Ee(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?T(r?.cwd??process.cwd(),`.workmate`,`commands`):r?.globalCommandsDir??T(t(),`commands`)}function De(e){return w([`learned`,...je(e,4)].join(`-`))||`learned-command`}function Oe(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function ke(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-QyzA_cFM.js";import{Ci as r,Lp as i,Mi as a,Rp as o}from"./loadAgentsDir-uuZYOgKn.js";import{n as s,t as c}from"./featureCheck-D6FjD-nt.js";import{a as l,s as u}from"./projectContext-BFfHgAMh.js";import{a as d,c as ee,i as f,l as p,n as m,o as h,r as te,s as ne,u as g}from"./instinctParser-Dt-lqnDe.js";import{a as re,i as ie,n as _,o as v,r as y,t as ae}from"./observationStore-pnSSxec_.js";import{a as oe,i as se,o as ce,r as le}from"./sessionObserver-cfwD8pV8.js";import{a as ue,d as b,i as de,l as x,n as S,r as fe,s as C,t as pe,u as w}from"./skillLifecycle-iO_3s9Ff.js";import{join as T}from"node:path";import{existsSync as E}from"node:fs";import{randomBytes as me}from"node:crypto";import{mkdir as D,readFile as he,readdir as O,rename as ge,unlink as _e,writeFile as k}from"node:fs/promises";function A(e){let t=_(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?T(t,`global`,`instincts`,`personal`):T(t,`projects`,n.projectId,`instincts`,`personal`)}async function j(e,t){let n=h(e);await D(A(t),{recursive:!0});let r=N(n.id,t),i=`${r}.${me(6).toString(`hex`)}.tmp`;return await k(i,ee(n)),await ge(i,r),n}async function M(e){let t=A(e),n=[];try{n=await O(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await he(T(t,e),`utf8`);r.push(ne(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function ve(e,t){let n=P.then(()=>ye(e,t));return P=n.catch(()=>{}),n}async function ye(e,t){let n=await M(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&d(t,e)),i=new Date().toISOString();if(!r)return j(e,t);let a=d(r,e),o=a?-.1:Se(e.evidenceOutcome),s=m(r.confidence+o),c=be(r.status,s,a);return j(h({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function be(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function xe(e){let t=await M(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/F);if(a<1)continue;let o=-.02*a,s=m(i.confidence+o);s!==i.confidence&&(await j(h({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function Se(e){return e===`failure`?-.05:.05}async function Ce(e,t){let n=await M(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await _e(N(e.id,t)),i.push(e));return i}function N(e,t){return T(A(t),`${e}.json`)}var P,F,I=e((()=>{y(),f(),P=Promise.resolve(),F=10080*60*1e3}));function we(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=w(t?.name??De(e)),i=Ae(e),a=t?.description??Oe(e),o=Ee(r,n,t),s=ke({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function Te(e){await D(e.outputPath,{recursive:!0});let t=T(e.outputPath,`${e.name}.md`);return E(t)?t:(await k(t,e.content,`utf8`),r(),t)}function Ee(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?T(r?.cwd??process.cwd(),`.workmate`,`commands`):r?.globalCommandsDir??T(t(),`commands`)}function De(e){return w([`learned`,...je(e,4)].join(`-`))||`learned-command`}function Oe(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function ke(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
2
2
  `),``,`## Steps`,``,i.map(e=>`- ${e.action}`).join(`
3
3
  `),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).join(`
4
4
  `),``].join(`
@@ -6,5 +6,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./e
6
6
  `),``,`## Playbook`,``,i.map(e=>`- ${e.action}`).join(`
7
7
  `),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).slice(0,20).join(`
8
8
  `),``].join(`
9
- `)}function Re(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function ze(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var R=e((()=>{n(),a(),x()}));function z(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Ue(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=p().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:Be(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function Be(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ve(e,t){return z(e).filter(e=>e.target===`command`&&b(e.instincts)).map(e=>we(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function He(e,t){return z(e).filter(e=>e.target===`agent`&&b(e.instincts)).map(e=>Me(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Ue(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var We=e((()=>{x(),C(),L(),R(),g()}));function Ge(e){if(H.add(e),H.size>B){let e=H.size-V,t=H.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;H.delete(e.value)}}}function Ke(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function qe(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await Je(e.rootDir),i=Ke(r,t,n),a=[];for(let t of i){if(H.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await j({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Ye(e.rootDir)}),Ge(t.instinctId),a.push(t))}return a}async function Je(e){let t=T(_(e?{rootDir:e}:void 0),`projects`);if(!E(t))return[];let n=await O(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await M({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:T(t,i.name)},scope:`project`});r.push(...n)}return r}function Ye(e){let t=_(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:T(t,`global`)}}var B,V,H,Xe=e((()=>{I(),y(),B=256,V=192,H=new Set}));function U(){X=0,Z=0,Q.clear()}function Ze(){return J}function Qe(){if(!q){q=!0;try{ce()}catch{}o(W),$e().catch(()=>{})}}async function $e(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:u(process.cwd())};await Promise.allSettled([xe(e),ie(e),Ce(30,e)])}function et(e){try{let t=_();return e.startsWith(t)}catch{return!1}}async function W(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(et(t))return;let n=u(t),r={project:n};++J;let i=[];for(let t of rt(e.messages,n))i.push(await ae(t,r));let a=(await re(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=p(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,d;if(l)X++,Z=o,d=await se(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-CBrM4opL.js`),t=e.analyze(i,{project:n});d=Array.isArray(t)?t:await t}for(let e of d)await ve(te(e),r);await nt(r)}function tt(){J=0,Y=``,U()}async function nt(e){let n=await M(e),r=process.cwd(),i=[T(r,`.workmate`,`skills`),T(t(),`skills`)],a=z(n).filter(e=>e.target===`skill`&&b(e.instincts));for(let e of a){let t=await ue(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;E(T(n.outputPath,`SKILL.md`))||await pe(fe(n,await S(`skill`,n,i)))}let o=Ve(n,{cwd:r});for(let e of o)(await S(`command`,e,[T(r,`.workmate`,`commands`),T(t(),`commands`)])).length>0||await Te(e);let s=He(n,{cwd:r});for(let e of s)(await S(`agent`,e,[T(r,`.workmate`,`agents`),T(t(),`agents`)])).length>0||await Ne(e);await qe()}function rt(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>$){let e=Q.size-ot,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=at(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=G(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=it(e.message?.content),n=G(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function G(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
9
+ `)}function Re(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function ze(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var R=e((()=>{n(),a(),x()}));function z(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Ue(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=p().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:Be(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function Be(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ve(e,t){return z(e).filter(e=>e.target===`command`&&b(e.instincts)).map(e=>we(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function He(e,t){return z(e).filter(e=>e.target===`agent`&&b(e.instincts)).map(e=>Me(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Ue(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var We=e((()=>{x(),C(),L(),R(),g()}));function Ge(e){if(H.add(e),H.size>B){let e=H.size-V,t=H.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;H.delete(e.value)}}}function Ke(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function qe(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await Je(e.rootDir),i=Ke(r,t,n),a=[];for(let t of i){if(H.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await j({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Ye(e.rootDir)}),Ge(t.instinctId),a.push(t))}return a}async function Je(e){let t=T(_(e?{rootDir:e}:void 0),`projects`);if(!E(t))return[];let n=await O(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await M({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:T(t,i.name)},scope:`project`});r.push(...n)}return r}function Ye(e){let t=_(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:T(t,`global`)}}var B,V,H,Xe=e((()=>{I(),y(),B=256,V=192,H=new Set}));function U(){X=0,Z=0,Q.clear()}function Ze(){return J}function Qe(){if(!q){q=!0;try{ce()}catch{}o(W),$e().catch(()=>{})}}async function $e(){if(!s()||process.env.WORKMATE_SKILL_LEARNING_DISABLE)return;let e={project:u(process.cwd())};await Promise.allSettled([xe(e),ie(e),Ce(30,e)])}function et(e){try{let t=_();return e.startsWith(t)}catch{return!1}}async function W(e){if(!s()||process.env.WORKMATE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(et(t))return;let n=u(t),r={project:n};++J;let i=[];for(let t of rt(e.messages,n))i.push(await ae(t,r));let a=(await re(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=p(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,d;if(l)X++,Z=o,d=await se(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-BZVgzp3W.js`),t=e.analyze(i,{project:n});d=Array.isArray(t)?t:await t}for(let e of d)await ve(te(e),r);await nt(r)}function tt(){J=0,Y=``,U()}async function nt(e){let n=await M(e),r=process.cwd(),i=[T(r,`.workmate`,`skills`),T(t(),`skills`)],a=z(n).filter(e=>e.target===`skill`&&b(e.instincts));for(let e of a){let t=await ue(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;E(T(n.outputPath,`SKILL.md`))||await pe(fe(n,await S(`skill`,n,i)))}let o=Ve(n,{cwd:r});for(let e of o)(await S(`command`,e,[T(r,`.workmate`,`commands`),T(t(),`commands`)])).length>0||await Te(e);let s=He(n,{cwd:r});for(let e of s)(await S(`agent`,e,[T(r,`.workmate`,`agents`),T(t(),`agents`)])).length>0||await Ne(e);await qe()}function rt(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>$){let e=Q.size-ot,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=at(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=G(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=it(e.message?.content),n=G(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function G(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
10
10
  `):``}function it(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_use`?[{toolName:String(t.name??`unknown_tool`),input:v(t.input)}]:[]}):[]}function at(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_result`?[{toolName:String(t.name??t.tool_name??`unknown_tool`),output:v(t.content),isError:t.is_error===!0}]:[]}):[]}var K,q,J,Y,X,Z,Q,$,ot,st=e((()=>{i(),g(),c(),y(),l(),le(),f(),oe(),I(),de(),We(),C(),x(),L(),R(),Xe(),n(),K=`runtime-session`,q=!1,J=0,Y=``,X=0,Z=0,Q=new Set,$=1e3,ot=500}));export{U as a,st as i,Ze as n,tt as o,Qe as r,W as s,K as t};
@@ -1 +1 @@
1
- import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-BPqlbu0B.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
1
+ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-CWaYMJG8.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
@@ -0,0 +1 @@
1
+ import{aC as e,sC as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as SandboxManager};
@@ -0,0 +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-BX54x08P.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{d as p,m,o as h}from"./settings-D4M13toi.js";import{Pt as g,T as _}from"./state-CXY-q5gr.js";import{aC as v,cC as y,oC as b,sC as x,tb as S}from"./loadAgentsDir-uuZYOgKn.js";import{i as C,o as w}from"./bundledMode-D9omqD3L.js";import{n as T,t as E}from"./select-BuTJbu_Q.js";import{relative as D}from"path";function O(){let e=v.isSandboxingEnabled(),t=v.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=v.getFsReadConfig(),o=v.getFsWriteConfig(),s=v.getNetworkRestrictionConfig(),c=v.getAllowUnixSockets(),l=v.getExcludedCommands(),u=v.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`,y()?` (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(),x(),k=f()}));function j({depCheck:e}){let t=C()===`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(),w(),M=f()}));function P({onComplete:e}){let t=v.isSandboxingEnabled(),n=v.areSandboxSettingsLockedByPolicy(),i=v.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 v.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(),x(),T(),I=f()}));function R({onComplete:e,depCheck:r}){let[i]=n(),a=v.isSandboxingEnabled(),o=v.isAutoAllowBashIfSandboxedEnabled(),u=r.warnings.length>0,f=p().sandbox?.network?.allowAllUnixSockets,m=u&&!f,h=a?o?`auto-allow`:`regular`:`disabled`,g=s(`success`,i)(`(current)`),_=[{label:h===`auto-allow`?`Sandbox BashTool, with auto-allow ${g}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:h===`regular`?`Sandbox BashTool, with regular permissions ${g}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:h===`disabled`?`No Sandbox ${g}`:`No Sandbox`,value:`disabled`}];async function y(t){switch(t){case`auto-allow`:await v.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await v.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await v.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}t({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let b=(0,B.jsx)(c,{title:`Mode`,children:(0,B.jsx)(z,{showSocketWarning:m,options:_,onSelect:y,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`)]:[b,...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(),S(),x(),m(),T(),A(),N(),L(),B=f()}));async function H(e,t,n){let r=p().theme||`light`,i=C();if(!v.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=v.checkDependencies();if(!v.isPlatformInEnabledList())return e(s(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(v.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,``);b(n);let i=h(`localSettings`),a=i?D(_(),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((()=>{g(),V(),u(),w(),x(),m(),U=f()}))();export{H as call};
@@ -0,0 +1 @@
1
+ import{S_ as e,b_ as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as isSearchExtraToolsEnabled};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Bt as o,Ft as s,G as c,Gr as l,Gt as u,I as d,Lt as f,P as p,T as m,Wt as h,_ as g,ai as _,hn as v,t as y}from"./src-BX54x08P.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as x,Qn as S}from"./settings-D4M13toi.js";import{Lu as C,Ru as w,hd as T,md as E,tb as D}from"./loadAgentsDir-uuZYOgKn.js";import{c as O,o as k,s as A}from"./stringUtils-Cs6E5f-B.js";import{D as j,O as M,n as N,t as P}from"./TextInput-ZKU-x_FD.js";import{i as F,t as I}from"./overlayContext-7wgLio1O.js";import{isDeepStrictEqual as L}from"util";import{pathToFileURL as R}from"url";function ee({imageId:e,backgroundColor:t,isSelected:n=!1}){let r=C(e),i=`[Image #${e}]`;if(r&&o()){let e=R(r).href;return(0,z.jsx)(f,{url:e,fallback:(0,z.jsx)(p,{backgroundColor:t,inverse:n,children:i}),children:(0,z.jsx)(p,{backgroundColor:t,inverse:n,bold:n,children:i})})}return(0,z.jsx)(p,{backgroundColor:t,inverse:n,children:i})}var z,te=e((()=>{y(),w(),z=b()}));function B({isFocused:e,isSelected:t,children:n,description:r,shouldShowDownArrow:i,shouldShowUpArrow:a,declareCursor:o}){return(0,ne.jsx)(g,{isFocused:e,isSelected:t,description:r,showScrollDown:i,showScrollUp:a,styled:!1,declareCursor:o,children:n})}var ne,V=e((()=>{y(),ne=b()}));function H({option:e,isFocused:t,isSelected:n,shouldShowDownArrow:r,shouldShowUpArrow:i,maxIndexWidth:a,index:o,inputValue:s,onInputChange:c,onSubmit:l,onExit:f,layout:g,children:_,showLabel:y=!1,onOpenEditor:b,resetCursorOnUpdate:x=!1,onImagePaste:S,pastedContents:C,onRemoveImage:w,imagesSelected:T,selectedImageIndex:D=0,onImagesSelectedChange:O,onSelectedImageIndexChange:k}){let A=C?Object.values(C).filter(e=>e.type===`image`):[],M=y||e.showLabelWithValue===!0,[N,F]=(0,U.useState)(s.length),I=(0,U.useRef)(!1);(0,U.useEffect)(()=>{x&&t&&(I.current?I.current=!1:F(s.length))},[x,t,s]),h(`chat:externalEditor`,()=>{b?.(s,c)},{context:`Chat`,isActive:t&&!!b}),h(`chat:imagePaste`,()=>{S&&j().then(e=>{e&&S(e.base64,e.mediaType,void 0,e.dimensions)})},{context:`Chat`,isActive:t&&!!S}),h(`attachments:remove`,()=>{A.length>0&&w&&w(A.at(-1).id)},{context:`Attachments`,isActive:t&&!T&&s===``&&A.length>0&&!!w}),u({"attachments:next":()=>{A.length>1&&k?.((D+1)%A.length)},"attachments:previous":()=>{A.length>1&&k?.((D-1+A.length)%A.length)},"attachments:remove":()=>{let e=A[D];e&&w&&(w(e.id),A.length<=1?O?.(!1):k?.(Math.min(D,A.length-2)))},"attachments:exit":()=>{O?.(!1)}},{context:`Attachments`,isActive:t&&!!T}),v((e,t)=>{t.upArrow&&O?.(!1)},{isActive:t&&!!T}),(0,U.useEffect)(()=>{!t&&T&&O?.(!1)},[t,T,O]);let L=g===`expanded`?a+3:a+4;return(0,W.jsxs)(d,{flexDirection:`column`,flexShrink:0,children:[(0,W.jsx)(B,{isFocused:t,isSelected:n,shouldShowDownArrow:r,shouldShowUpArrow:i,declareCursor:!1,children:(0,W.jsxs)(d,{flexDirection:`row`,flexShrink:g===`compact`?0:void 0,children:[(0,W.jsx)(p,{dimColor:!0,children:`${o}.`.padEnd(a+2)}),_,M?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(p,{color:t?`suggestion`:void 0,children:e.label}),t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(p,{color:`suggestion`,children:e.labelValueSeparator??`, `}),(0,W.jsx)(P,{value:s,onChange:t=>{I.current=!0,c(t),e.onChange(t)},onSubmit:l,onExit:f,placeholder:e.placeholder,focus:!T,showCursor:!0,multiline:!0,cursorOffset:N,onChangeCursorOffset:F,columns:80,onImagePaste:S,onPaste:t=>{I.current=!0;let n=s.slice(0,N),r=s.slice(N),i=n+t+r;c(i),e.onChange(i),F(n.length+t.length)}})]}):s&&(0,W.jsxs)(p,{children:[e.labelValueSeparator??`, `,s]})]}):t?(0,W.jsx)(P,{value:s,onChange:t=>{I.current=!0,c(t),e.onChange(t)},onSubmit:l,onExit:f,placeholder:e.placeholder||(typeof e.label==`string`?e.label:void 0),focus:!T,showCursor:!0,multiline:!0,cursorOffset:N,onChangeCursorOffset:F,columns:80,onImagePaste:S,onPaste:t=>{I.current=!0;let n=s.slice(0,N),r=s.slice(N),i=n+t+r;c(i),e.onChange(i),F(n.length+t.length)}}):(0,W.jsx)(p,{color:s?void 0:`inactive`,children:s||e.placeholder||e.label})]})}),e.description&&(0,W.jsx)(d,{paddingLeft:L,children:(0,W.jsx)(p,{dimColor:e.dimDescription!==!1,color:n?`success`:t?`suggestion`:void 0,children:e.description})}),A.length>0&&(0,W.jsxs)(d,{flexDirection:`row`,gap:1,paddingLeft:L,children:[A.map((e,t)=>(0,W.jsx)(ee,{imageId:e.id,isSelected:!!T&&t===D},e.id)),(0,W.jsx)(d,{flexGrow:1,justifyContent:`flex-start`,flexDirection:`row`,children:(0,W.jsx)(p,{dimColor:!0,children:T?(0,W.jsxs)(m,{children:[A.length>1&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{action:`attachments:next`,context:`Attachments`,fallback:`→`,description:`next`}),(0,W.jsx)(E,{action:`attachments:previous`,context:`Attachments`,fallback:`←`,description:`prev`})]}),(0,W.jsx)(E,{action:`attachments:remove`,context:`Attachments`,fallback:`backspace`,description:`remove`}),(0,W.jsx)(E,{action:`attachments:exit`,context:`Attachments`,fallback:`esc`,description:`cancel`})]}):t?`(↓ to select)`:null})})]}),g===`expanded`&&(0,W.jsx)(p,{children:` `})]})}var U,W,G=e((()=>{U=t(_(),1),y(),D(),M(),te(),T(),N(),V(),W=b()})),K,q,re=e((()=>{K=t(_(),1),I(),y(),D(),k(),q=({isDisabled:e=!1,disableSelection:t=!1,state:n,options:r,isMultiSelect:i=!1,onUpFromFirstItem:a,onDownFromLastItem:o,onInputModeToggle:s,inputValues:c,imagesSelected:l=!1,onEnterImageSelection:d})=>{F(`select`,!!n.onCancel);let f=(0,K.useMemo)(()=>r.find(e=>e.value===n.focusedValue)?.type===`input`,[r,n.focusedValue]);u((0,K.useMemo)(()=>{let e={};return f||(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,f,t]),{context:`Select`,isActive:!e}),v((e,u,f)=>{let p=A(e),m=r.find(e=>e.value===n.focusedValue),h=m?.type===`input`;if(u.tab&&s&&n.focusedValue!==void 0){s(n.focusedValue);return}if(h){if(l)return;if(u.downArrow&&d?.()){f.stopImmediatePropagation();return}if(u.downArrow||u.ctrl&&e===`n`){if(o){let e=r[r.length-1];if(e&&n.focusedValue===e.value){o(),f.stopImmediatePropagation();return}}n.focusNextOption(),f.stopImmediatePropagation();return}if(u.upArrow||u.ctrl&&e===`p`){if(a&&n.visibleFromIndex===0){let e=r[0];if(e&&n.focusedValue===e.value){a(),f.stopImmediatePropagation();return}}n.focusPreviousOption(),f.stopImmediatePropagation();return}return}if(u.pageDown&&n.focusNextPage(),u.pageUp&&n.focusPreviousPage(),t!==!0&&(i&&O(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((c?.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})}})),ie,ae=e((()=>{n(),ie=class extends Map{constructor(e){let t=[],n,i,a,o=0;for(let r of e){let e={label:r.label,value:r.value,description:r.description,previous:a,next:void 0,index:o};a&&(a.next=e),n||(n=e),i=e,t.push([r.value,e]),o++,a=e}super(t),r(this,`first`,void 0),r(this,`last`,void 0),this.first=n,this.last=i}}}));function oe({visibleOptionCount:e=5,options:t,initialFocusValue:n,onFocus:r,focusValue:i}){let[a,o]=(0,J.useReducer)(se,{visibleOptionCount:e,options:t,initialFocusValue:i||n},Y),s=(0,J.useRef)(r);s.current=r;let[c,l]=(0,J.useState)(t);t!==c&&!L(t,c)&&(o({type:`reset`,state:Y({visibleOptionCount:e,options:t,initialFocusValue:i??a.focusedValue??n,currentViewport:{visibleFromIndex:a.visibleFromIndex,visibleToIndex:a.visibleToIndex}})}),l(t));let u=(0,J.useCallback)(()=>{o({type:`focus-next-option`})},[]),d=(0,J.useCallback)(()=>{o({type:`focus-previous-option`})},[]),f=(0,J.useCallback)(()=>{o({type:`focus-next-page`})},[]),p=(0,J.useCallback)(()=>{o({type:`focus-previous-page`})},[]),m=(0,J.useCallback)(e=>{e!==void 0&&o({type:`set-focus`,value:e})},[]),h=(0,J.useMemo)(()=>t.map((e,t)=>({...e,index:t})).slice(a.visibleFromIndex,a.visibleToIndex),[t,a.visibleFromIndex,a.visibleToIndex]),g=(0,J.useMemo)(()=>{if(a.focusedValue!==void 0)return t.some(e=>e.value===a.focusedValue)?a.focusedValue:t[0]?.value},[a.focusedValue,t]),_=(0,J.useMemo)(()=>t.find(e=>e.value===g)?.type===`input`,[g,t]);return(0,J.useEffect)(()=>{g!==void 0&&s.current?.(g)},[g]),(0,J.useEffect)(()=>{i!==void 0&&o({type:`set-focus`,value:i})},[i]),{focusedValue:g,focusedIndex:(0,J.useMemo)(()=>{if(g===void 0)return 0;let e=t.findIndex(e=>e.value===g);return e>=0?e+1:0},[g,t]),visibleFromIndex:a.visibleFromIndex,visibleToIndex:a.visibleToIndex,visibleOptions:h,isInInput:_??!1,focusNextOption:u,focusPreviousOption:d,focusNextPage:f,focusPreviousPage:p,focusOption:m,options:t}}var J,se,Y,ce=e((()=>{J=t(_(),1),ae(),se=(e,t)=>{switch(t.type){case`focus-next-option`:{if(e.focusedValue===void 0)return e;let t=e.optionMap.get(e.focusedValue);if(!t)return e;let n=t.next||e.optionMap.first;if(!n)return e;if(!t.next&&n===e.optionMap.first)return{...e,focusedValue:n.value,visibleFromIndex:0,visibleToIndex:e.visibleOptionCount};if(!(n.index>=e.visibleToIndex))return{...e,focusedValue:n.value};let r=Math.min(e.optionMap.size,e.visibleToIndex+1),i=r-e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:i,visibleToIndex:r}}case`focus-previous-option`:{if(e.focusedValue===void 0)return e;let t=e.optionMap.get(e.focusedValue);if(!t)return e;let n=t.previous||e.optionMap.last;if(!n)return e;if(!t.previous&&n===e.optionMap.last){let t=e.optionMap.size,r=Math.max(0,t-e.visibleOptionCount);return{...e,focusedValue:n.value,visibleFromIndex:r,visibleToIndex:t}}if(!(n.index<=e.visibleFromIndex))return{...e,focusedValue:n.value};let r=Math.max(0,e.visibleFromIndex-1),i=r+e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:r,visibleToIndex:i}}case`focus-next-page`:{if(e.focusedValue===void 0)return e;let t=e.optionMap.get(e.focusedValue);if(!t)return e;let n=Math.min(e.optionMap.size-1,t.index+e.visibleOptionCount),r=e.optionMap.first;for(;r&&r.index<n&&r.next;)r=r.next;if(!r)return e;let i=Math.min(e.optionMap.size,r.index+1),a=Math.max(0,i-e.visibleOptionCount);return{...e,focusedValue:r.value,visibleFromIndex:a,visibleToIndex:i}}case`focus-previous-page`:{if(e.focusedValue===void 0)return e;let t=e.optionMap.get(e.focusedValue);if(!t)return e;let n=Math.max(0,t.index-e.visibleOptionCount),r=e.optionMap.first;for(;r&&r.index<n&&r.next;)r=r.next;if(!r)return e;let i=Math.max(0,r.index),a=Math.min(e.optionMap.size,i+e.visibleOptionCount);return{...e,focusedValue:r.value,visibleFromIndex:i,visibleToIndex:a}}case`reset`:return t.state;case`set-focus`:{if(e.focusedValue===t.value)return e;let n=e.optionMap.get(t.value);if(!n)return e;if(n.index>=e.visibleFromIndex&&n.index<e.visibleToIndex)return{...e,focusedValue:t.value};let r,i;return n.index<e.visibleFromIndex?(r=n.index,i=Math.min(e.optionMap.size,r+e.visibleOptionCount)):(i=Math.min(e.optionMap.size,n.index+1),r=Math.max(0,i-e.visibleOptionCount)),{...e,focusedValue:t.value,visibleFromIndex:r,visibleToIndex:i}}}},Y=({visibleOptionCount:e,options:t,initialFocusValue:n,currentViewport:r})=>{let i=typeof e==`number`?Math.min(e,t.length):t.length,a=new ie(t),o=n!==void 0&&a.get(n),s=o?n:a.first?.value,c=0,l=i;if(o){let e=o.index;r?e>=r.visibleFromIndex&&e<r.visibleToIndex?(c=r.visibleFromIndex,l=Math.min(a.size,r.visibleToIndex)):e<r.visibleFromIndex?(c=e,l=Math.min(a.size,c+i)):(l=Math.min(a.size,e+1),c=Math.max(0,l-i)):e>=i&&(l=Math.min(a.size,e+1),c=Math.max(0,l-i)),c=Math.max(0,Math.min(c,a.size-1)),l=Math.min(a.size,Math.max(i,l))}return{optionMap:a,visibleOptionCount:i,focusedValue:s,visibleFromIndex:c,visibleToIndex:l}}}));function le({visibleOptionCount:e=5,options:t,defaultValue:n,onChange:r,onCancel:i,onFocus:a,focusValue:o}){let[s,c]=(0,X.useState)(n),l=oe({visibleOptionCount:e,options:t,initialFocusValue:void 0,onFocus:a,focusValue:o}),u=(0,X.useCallback)(()=>{c(l.focusedValue)},[l.focusedValue]);return{...l,value:s,selectFocusedOption:u,onChange:r,onCancel:i}}var X,ue=e((()=>{X=t(_(),1),ce()}));function Z(e){return typeof e==`string`?e:typeof e==`number`?String(e):e?Array.isArray(e)?e.map(Z).join(``):Q.isValidElement(e)?Z(e.props.children):``:``}function de({isDisabled:e=!1,hideIndexes:t=!1,visibleOptionCount:n=5,highlightText:r,options:i,defaultValue:o,onCancel:c,onChange:u,onFocus:f,defaultFocusValue:m,layout:h=`compact`,disableSelection:g=!1,inlineDescriptions:_=!1,onUpFromFirstItem:v,onDownFromLastItem:y,onInputModeToggle:b,onOpenEditor:x,onImagePaste:C,pastedContents:w,onRemoveImage:T}){let[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(0),[A,j]=(0,Q.useState)(()=>{let e=new Map;return i.forEach(t=>{t.type===`input`&&t.initialValue&&e.set(t.value,t.initialValue)}),e}),M=(0,Q.useRef)(new Map);(0,Q.useEffect)(()=>{for(let e of i)if(e.type===`input`&&e.initialValue!==void 0){let t=M.current.get(e.value)??``,n=A.get(e.value)??``,r=e.initialValue;r!==t&&n===t&&j(t=>{let n=new Map(t);return n.set(e.value,r),n}),M.current.set(e.value,r)}},[i,A]);let N=le({visibleOptionCount:n,options:i,defaultValue:o,onChange:u,onCancel:c,onFocus:f,focusValue:m});q({isDisabled:e,disableSelection:g||(t?`numeric`:!1),state:N,options:i,isMultiSelect:!1,onUpFromFirstItem:v,onDownFromLastItem:y,onInputModeToggle:b,inputValues:A,imagesSelected:E,onEnterImageSelection:()=>{if(w&&Object.values(w).some(e=>e.type===`image`)){let e=S(Object.values(w),e=>e.type===`image`);return D(!0),k(e-1),!0}return!1}});let P={container:()=>({flexDirection:`column`}),highlightedText:()=>({bold:!0})};if(h===`expanded`){let t=N.options.length.toString().length;return(0,$.jsx)(d,{...P.container(),children:N.visibleOptions.map((n,a)=>{let o=n.index===N.visibleFromIndex,l=n.index===N.visibleToIndex-1,f=N.visibleToIndex<i.length,m=N.visibleFromIndex>0,h=N.visibleFromIndex+a+1,g=!e&&N.focusedValue===n.value,v=N.value===n.value;if(n.type===`input`){let e=A.has(n.value)?A.get(n.value):n.initialValue||``;return(0,$.jsx)(H,{option:n,isFocused:g,isSelected:v,shouldShowDownArrow:f&&l,shouldShowUpArrow:m&&o,maxIndexWidth:t,index:h,inputValue:e,onInputChange:e=>{j(t=>{let r=new Map(t);return r.set(n.value,e),r})},onSubmit:e=>{let t=w&&Object.values(w).some(e=>e.type===`image`);e.trim()||t||n.allowEmptySubmitToCancel?u?.(n.value):c?.()},onExit:c,layout:`expanded`,showLabel:_,onOpenEditor:x,resetCursorOnUpdate:n.resetCursorOnUpdate,onImagePaste:C,pastedContents:w,onRemoveImage:T,imagesSelected:E,selectedImageIndex:O,onImagesSelectedChange:D,onSelectedImageIndexChange:k},String(n.value))}let y=n.label;if(typeof n.label==`string`&&r&&n.label.includes(r)){let e=n.label,t=e.indexOf(r);y=(0,$.jsxs)($.Fragment,{children:[e.slice(0,t),(0,$.jsx)(p,{...P.highlightedText(),children:r}),e.slice(t+r.length)]})}let b=n.disabled===!0,S=b?void 0:v?`success`:g?`suggestion`:void 0;return(0,$.jsxs)(d,{flexDirection:`column`,flexShrink:0,children:[(0,$.jsx)(B,{isFocused:g,isSelected:v,shouldShowDownArrow:f&&l,shouldShowUpArrow:m&&o,children:(0,$.jsx)(p,{dimColor:b,color:S,children:y})}),n.description&&(0,$.jsx)(d,{paddingLeft:2,children:(0,$.jsx)(p,{dimColor:b||n.dimDescription!==!1,color:S,children:(0,$.jsx)(s,{children:n.description})})}),(0,$.jsx)(p,{children:` `})]},String(n.value))})})}if(h===`compact-vertical`){let n=t?0:N.options.length.toString().length;return(0,$.jsx)(d,{...P.container(),children:N.visibleOptions.map((a,o)=>{let l=a.index===N.visibleFromIndex,f=a.index===N.visibleToIndex-1,m=N.visibleToIndex<i.length,h=N.visibleFromIndex>0,g=N.visibleFromIndex+o+1,v=!e&&N.focusedValue===a.value,y=N.value===a.value;if(a.type===`input`){let e=A.has(a.value)?A.get(a.value):a.initialValue||``;return(0,$.jsx)(H,{option:a,isFocused:v,isSelected:y,shouldShowDownArrow:m&&f,shouldShowUpArrow:h&&l,maxIndexWidth:n,index:g,inputValue:e,onInputChange:e=>{j(t=>{let n=new Map(t);return n.set(a.value,e),n})},onSubmit:e=>{let t=w&&Object.values(w).some(e=>e.type===`image`);e.trim()||t||a.allowEmptySubmitToCancel?u?.(a.value):c?.()},onExit:c,layout:`compact`,showLabel:_,onOpenEditor:x,resetCursorOnUpdate:a.resetCursorOnUpdate,onImagePaste:C,pastedContents:w,onRemoveImage:T,imagesSelected:E,selectedImageIndex:O,onImagesSelectedChange:D,onSelectedImageIndexChange:k},String(a.value))}let b=a.label;if(typeof a.label==`string`&&r&&a.label.includes(r)){let e=a.label,t=e.indexOf(r);b=(0,$.jsxs)($.Fragment,{children:[e.slice(0,t),(0,$.jsx)(p,{...P.highlightedText(),children:r}),e.slice(t+r.length)]})}let S=a.disabled===!0;return(0,$.jsxs)(d,{flexDirection:`column`,flexShrink:0,children:[(0,$.jsxs)(B,{isFocused:v,isSelected:y,shouldShowDownArrow:m&&f,shouldShowUpArrow:h&&l,children:[!t&&(0,$.jsx)(p,{dimColor:!0,children:`${g}.`.padEnd(n+1)}),(0,$.jsx)(p,{dimColor:S,color:S?void 0:y?`success`:v?`suggestion`:void 0,children:b})]}),a.description&&(0,$.jsx)(d,{paddingLeft:t?4:n+4,children:(0,$.jsx)(p,{dimColor:S||a.dimDescription!==!1,color:S?void 0:y?`success`:v?`suggestion`:void 0,children:(0,$.jsx)(s,{children:a.description})})})]},String(a.value))})})}let F=t?0:N.options.length.toString().length,I=N.visibleOptions.some(e=>e.type===`input`),L=!_&&!I&&N.visibleOptions.some(e=>e.description),R=N.visibleOptions.map((t,n)=>{let a=t.index===N.visibleFromIndex,o=t.index===N.visibleToIndex-1,s=N.visibleToIndex<i.length,c=N.visibleFromIndex>0,l=N.visibleFromIndex+n+1,u=!e&&N.focusedValue===t.value,d=N.value===t.value,f=t.disabled===!0,m=t.label;if(typeof t.label==`string`&&r&&t.label.includes(r)){let e=t.label,n=e.indexOf(r);m=(0,$.jsxs)($.Fragment,{children:[e.slice(0,n),(0,$.jsx)(p,{...P.highlightedText(),children:r}),e.slice(n+r.length)]})}return{option:t,index:l,label:m,isFocused:u,isSelected:d,isOptionDisabled:f,shouldShowDownArrow:s&&o,shouldShowUpArrow:c&&a}});if(L){let e=Math.max(...R.map(e=>{if(e.option.type===`input`)return 0;let n=Z(e.option.label),r=t?0:F+2,i=e.isSelected?2:0;return 2+r+l(n)+i}));return(0,$.jsx)(d,{...P.container(),children:R.map(n=>{if(n.option.type===`input`)return null;let r=Z(n.option.label),i=t?0:F+2,o=n.isSelected?2:0,c=2+i+l(r)+o,u=e-c;return(0,$.jsxs)(fe,{isFocused:n.isFocused,children:[(0,$.jsxs)(d,{flexDirection:`row`,flexShrink:0,children:[n.isFocused?(0,$.jsx)(p,{color:`suggestion`,children:a.pointer}):n.shouldShowDownArrow?(0,$.jsx)(p,{dimColor:!0,children:a.arrowDown}):n.shouldShowUpArrow?(0,$.jsx)(p,{dimColor:!0,children:a.arrowUp}):(0,$.jsx)(p,{children:` `}),(0,$.jsx)(p,{children:` `}),(0,$.jsxs)(p,{dimColor:n.isOptionDisabled,color:n.isOptionDisabled?void 0:n.isSelected?`success`:n.isFocused?`suggestion`:void 0,children:[!t&&(0,$.jsx)(p,{dimColor:!0,children:`${n.index}.`.padEnd(F+2)}),n.label]}),n.isSelected&&(0,$.jsxs)(p,{color:`success`,children:[` `,a.tick]}),u>0&&(0,$.jsx)(p,{children:` `.repeat(u)})]}),(0,$.jsx)(d,{flexGrow:1,marginLeft:2,children:(0,$.jsx)(p,{wrap:`wrap`,dimColor:n.isOptionDisabled||n.option.dimDescription!==!1,color:n.isOptionDisabled?void 0:n.isSelected?`success`:n.isFocused?`suggestion`:void 0,children:(0,$.jsx)(s,{children:n.option.description||` `})})})]},String(n.option.value))})})}return(0,$.jsx)(d,{...P.container(),children:N.visibleOptions.map((n,a)=>{if(n.type===`input`){let t=A.has(n.value)?A.get(n.value):n.initialValue||``,r=n.index===N.visibleFromIndex,o=n.index===N.visibleToIndex-1,s=N.visibleToIndex<i.length,l=N.visibleFromIndex>0,d=N.visibleFromIndex+a+1;return(0,$.jsx)(H,{option:n,isFocused:!e&&N.focusedValue===n.value,isSelected:N.value===n.value,shouldShowDownArrow:s&&o,shouldShowUpArrow:l&&r,maxIndexWidth:F,index:d,inputValue:t,onInputChange:e=>{j(t=>{let r=new Map(t);return r.set(n.value,e),r})},onSubmit:e=>{let t=w&&Object.values(w).some(e=>e.type===`image`);e.trim()||t||n.allowEmptySubmitToCancel?u?.(n.value):c?.()},onExit:c,layout:`compact`,showLabel:_,onOpenEditor:x,resetCursorOnUpdate:n.resetCursorOnUpdate,onImagePaste:C,pastedContents:w,onRemoveImage:T,imagesSelected:E,selectedImageIndex:O,onImagesSelectedChange:D,onSelectedImageIndexChange:k},String(n.value))}let o=n.label;if(typeof n.label==`string`&&r&&n.label.includes(r)){let e=n.label,t=e.indexOf(r);o=(0,$.jsxs)($.Fragment,{children:[e.slice(0,t),(0,$.jsx)(p,{...P.highlightedText(),children:r}),e.slice(t+r.length)]})}let l=n.index===N.visibleFromIndex,f=n.index===N.visibleToIndex-1,m=N.visibleToIndex<i.length,h=N.visibleFromIndex>0,g=N.visibleFromIndex+a+1,v=!e&&N.focusedValue===n.value,y=N.value===n.value,b=n.disabled===!0;return(0,$.jsxs)(B,{isFocused:v,isSelected:y,shouldShowDownArrow:m&&f,shouldShowUpArrow:h&&l,children:[(0,$.jsxs)(d,{flexDirection:`row`,flexShrink:0,children:[!t&&(0,$.jsx)(p,{dimColor:!0,children:`${g}.`.padEnd(F+2)}),(0,$.jsxs)(p,{dimColor:b,color:b?void 0:y?`success`:v?`suggestion`:void 0,children:[o,_&&n.description&&(0,$.jsxs)(p,{dimColor:b||n.dimDescription!==!1,children:[` `,n.description]})]})]}),!_&&n.description&&(0,$.jsx)(d,{flexShrink:99,marginLeft:2,children:(0,$.jsx)(p,{wrap:`wrap-trim`,dimColor:b||n.dimDescription!==!1,color:b?void 0:y?`success`:v?`suggestion`:void 0,children:(0,$.jsx)(s,{children:n.description})})})]},String(n.value))})})}function fe({isFocused:e,children:t}){return(0,$.jsx)(d,{ref:c({line:0,column:0,active:e}),flexDirection:`row`,children:t})}var Q,$,pe=e((()=>{i(),Q=t(_(),1),y(),x(),G(),V(),re(),ue(),$=b()}));export{H as a,V as c,oe as i,pe as n,G as o,ce as r,B as s,de as t};
@@ -0,0 +1 @@
1
+ import{Am as e,km as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as registerSessionFileAccessHooks};
@@ -0,0 +1 @@
1
+ import{n as e,r as t}from"./sessionObserver-cfwD8pV8.js";t();export{e as heuristicObserverBackend};
@@ -1,4 +1,4 @@
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(`
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-uuZYOgKn.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-BZVgzp3W.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
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:
@@ -0,0 +1 @@
1
+ import{Cr as e,Wr as t,gr as n}from"./loadAgentsDir-uuZYOgKn.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-QyzA_cFM.js";import{i as a,l as o,n as s}from"./esm-lWlUmoUA.js";import{Kt as c,Xt as l,qt as u}from"./settings-D4M13toi.js";import{$ as d,E as f,F as p,Pt as m,at as ee}from"./state-CXY-q5gr.js";import{C as h,I as te,S as ne,c as re,i as ie,x as g}from"./debug-2pVES-2G.js";import{d as ae,l as oe}from"./config-BDn2YIjC.js";import{i as se,t as ce}from"./execFileNoThrow-DXSEj8ZO.js";import{r as le,t as ue}from"./genericProcessUtils-GqURdVAv.js";import{extname as de}from"path";import"fs";import{createHash as fe}from"crypto";import{stat as pe}from"fs/promises";import{AsyncLocalStorage as _}from"async_hooks";function me(e){return!1}var he=e((()=>{}));function ge(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function v(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function _e(e,t){return!!(process.env.WORKMATE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&me(t))}function ve(e,t,n){let r=ye(e);return!r||!x.has(r.serverName)&&!_e(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function ye(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 be(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function y(e,t=0){if(typeof e==`string`)return e.length>Ce?`${e.slice(0,we)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=Te)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,C).map(e=>y(e,t+1));return e.length>C&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,C).map(([e,n])=>[e,y(n,t+1)]);return n.length>C&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function xe(e){if(!v())return;let t=h(y(e));return t.length>S&&(t=`${t.slice(0,S)}…[truncated]`),t}function b(e){let t=de(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>Ee?`other`:n}function Se(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=b(t);e&&(r.add(e),n=e)}for(let t of e.split(Oe)){if(!t)continue;let e=t.split(ke);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(De.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=b(i);a&&!r.has(a)&&(r.add(a),n=n?`${n},${a}`:a)}}if(n)return n}var x,Ce,we,S,C,Te,Ee,De,Oe,ke,Ae=e((()=>{i(),he(),g(),x=new Set,Ce=512,we=128,S=4*1024,C=20,Te=2,Ee=10,De=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),Oe=/\s*(?:&&|\|\||[;|])\s*/,ke=/\s+/}));function je(){return process.platform===`linux`&&r(process.env.WORKMATE_BUBBLEWRAP)}function Me(){return process.platform===`linux`?D??!1:!1}async function w(){if(O!==void 0)return O;if(process.platform===`darwin`)return O=null,null;try{let e=await ue(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of c)if(e.includes(t))return O=t,t}}catch{}return O=null,null}async function Ne(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&u.platform!==`darwin`?await w()||`pycharm`:u.terminal}function Pe(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&u.platform!==`darwin`?O===void 0?`pycharm`:O||`pycharm`:u.terminal}async function T(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await w()}var E,D,O,k,A=e((()=>{n(),l(),i(),se(),le(),E=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ce(`test`,[`-f`,`/.dockerenv`]);return e===0}),D=null,process.platform===`linux`&&pe(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{D=!0},()=>{D=!1}),k={...u,terminal:Pe(),getIsDocker:E,getIsBubblewrapSandbox:je,isMuslEnvironment:Me,getTerminalWithJetBrainsDetectionAsync:Ne,initJetBrainsDetection:T}}));function j(e){let t=Fe[e],n=process.env[e];return n===void 0?t:r(n)}function M(){let e=oe(),t=ee(),n={"user.id":e};return j(`OTEL_METRICS_INCLUDE_SESSION_ID`)&&(n[`session.id`]=t),j(`OTEL_METRICS_INCLUDE_VERSION`)&&(n[`app.version`]=`0.0.27`),k.terminal&&(n[`terminal.type`]=k.terminal),n}var Fe,N=e((()=>{m(),ae(),A(),i(),Fe={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}}));function Ie(){return r(process.env.OTEL_LOG_USER_PROMPTS)}function Le(e){return Ie()?e:`<REDACTED>`}async function P(e,t={}){let n=f();if(!n){F||(F=!0,re(`[3P telemetry] Event dropped (no event logger initialized): ${e}`,{level:`warn`}));return}let r={...M(),"event.name":e,"event.timestamp":new Date().toISOString(),"event.sequence":Re++},i=d();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 Re,F,ze=e((()=>{m(),ie(),i(),N(),Re=0,F=!1}));function Be(){B.clear(),V.clear()}function I(){return r(process.env.ENABLE_BETA_TRACING_DETAILED)&&process.env.BETA_TRACING_ENDPOINT&&p()||!1}function L(e,t=Ye){return e.length<=t?{content:e,truncated:!1}:{content:e.slice(0,t)+`
2
+
3
+ [TRUNCATED - Content exceeds 60KB limit]`,truncated:!0}}function R(e){return fe(`sha256`).update(e).digest(`hex`).slice(0,12)}function Ve(e){return`sp_${R(e)}`}function He(e){return`msg_${R(h(e.message.content))}`}function z(e){let t=e.trim().match(Xe);return t?.[1]?t[1].trim():null}function Ue(e){let t=[],n=[];for(let r of e){let e=r.message.content;if(typeof e==`string`){let r=z(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=z(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:h(r.content),i=z(e);i?n.push(i):t.push(`[TOOL RESULT: ${r.tool_use_id}]\n${e}`)}}}return{contextParts:t,systemReminders:n}}function We(e,t){if(!I())return;let{content:n,truncated:r}=L(`[USER PROMPT]\n${t}`);e.setAttributes({new_context:n,...r&&{new_context_truncated:!0,new_context_original_length:t.length}})}function Ge(e,t,n){if(I()){if(t?.systemPrompt){let n=Ve(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),!B.has(n)){B.add(n);let{content:e,truncated:r}=L(t.systemPrompt);P(`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=ne(t.tools).map(e=>{let t=h(e),n=R(t);return{name:typeof e.name==`string`?e.name:`unknown`,hash:n,json:t}});e.setAttribute(`tools`,h(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(!B.has(`tool_${t}`)){B.add(`tool_${t}`);let{content:n,truncated:i}=L(r);P(`tool`,{tool_name:ge(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=V.get(r),a=0;if(i)for(let e=0;e<n.length;e++){let t=n[e];if(t&&He(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}=Ue(o);if(t.length>0){let n=t.join(`
4
+
5
+ ---
6
+
7
+ `),{content:r,truncated:i}=L(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}=L(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&&V.set(r,He(a))}}}}function Ke(e,t){if(!(!I()||!t)&&t.modelOutput!==void 0){let{content:n,truncated:r}=L(t.modelOutput);e[`response.model_output`]=n,r&&(e[`response.model_output_truncated`]=!0,e[`response.model_output_original_length`]=t.modelOutput.length)}}function qe(e,t,n){if(!I())return;let{content:r,truncated:i}=L(`[TOOL INPUT: ${t}]\n${n}`);e.setAttributes({tool_input:r,...i&&{tool_input_truncated:!0,tool_input_original_length:n.length}})}function Je(e,t,n){if(!I())return;let{content:r,truncated:i}=L(`[TOOL RESULT: ${t}]\n${n}`);e.new_context=r,i&&(e.new_context_truncated=!0,e.new_context_original_length=n.length)}var B,V,Ye,Xe,Ze=e((()=>{m(),Ae(),i(),g(),ze(),B=new Set,V=new Map,Ye=60*1024,Xe=/^<system-reminder>\n?([\s\S]*?)\n?<\/system-reminder>$/}));function Qe(){let e=process.env.WORKMATE_PERFETTO_TRACE;re(`[Perfetto] initializePerfettoTracing called, env value: ${e}`)}function H(){return at}function $e(e,t,n){}function et(e){}function tt(e){return``}function nt(e,t){return``}function rt(e){return``}function it(e){return``}var at,ot=e((()=>{m(),ie(),i(),te(),g(),at=!1}));function U(e){return e.spanContext().spanId||``}function st(){if(Q)return;Q=!0;let e=setInterval(()=>{let e=Date.now()-$;for(let[t,n]of Y){let r=n.deref();r===void 0?(Y.delete(t),X.delete(t)):r.startTime<e&&(r.ended||r.span.end(),Y.delete(t),X.delete(t))}},6e4);typeof e.unref==`function`&&e.unref()}function ct(){return!1}function W(){return ct()||I()}function G(){return a.getTracer(`com.workmate.tracing`,`1.0.0`)}function K(e,t={}){return{...M(),"span.type":e,...t}}function lt(e){st();let t=H()?it(e):void 0;if(!W()){if(t){let e=a.getActiveSpan()||G().startSpan(`dummy`),n=U(e),r={span:e,startTime:Date.now(),attributes:{},perfettoSpanId:t};return Y.set(n,new WeakRef(r)),q.enterWith(r),e}return a.getActiveSpan()||G().startSpan(`dummy`)}let n=G(),i=r(process.env.OTEL_LOG_USER_PROMPTS)?e:`<REDACTED>`;Z++;let o=K(`interaction`,{user_prompt:i,user_prompt_length:e.length,"interaction.sequence":Z}),s=n.startSpan(`workmate.interaction`,{attributes:o});We(s,e);let c=U(s),l={span:s,startTime:Date.now(),attributes:o,perfettoSpanId:t};return Y.set(c,new WeakRef(l)),q.enterWith(l),s}function ut(){let e=q.getStore();if(!e||e.ended)return;if(e.perfettoSpanId&&e.perfettoSpanId,!W()){e.ended=!0,Y.delete(U(e.span)),q.enterWith(void 0);return}let t=Date.now()-e.startTime;e.span.setAttributes({"interaction.duration_ms":t}),e.span.end(),e.ended=!0,Y.delete(U(e.span)),q.enterWith(void 0)}function dt(e,t,n,r){let i=H()?tt({model:e,querySource:t?.querySource,messageId:void 0}):void 0;if(!W()){if(i){let t=a.getActiveSpan()||G().startSpan(`dummy`),n=U(t),r={span:t,startTime:Date.now(),attributes:{model:e},perfettoSpanId:i};return Y.set(n,new WeakRef(r)),X.set(n,r),t}return a.getActiveSpan()||G().startSpan(`dummy`)}let s=G(),c=q.getStore(),l=K(`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),Ge(d,t,n);let f=U(d),p={span:d,startTime:Date.now(),attributes:l,perfettoSpanId:i};return Y.set(f,new WeakRef(p)),X.set(f,p),d}function ft(e,t){let n;if(e){let t=U(e);n=Y.get(t)?.deref()}else n=Array.from(Y.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),!W()){let e=U(n.span);Y.delete(e),X.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),Ke(i,t)),n.span.setAttributes(i),n.span.end();let a=U(n.span);Y.delete(a),X.delete(a)}function pt(e,t,n){let r=H()?nt(e,t):void 0;if(!W()){if(r){let t=a.getActiveSpan()||G().startSpan(`dummy`),n=U(t),i={span:t,startTime:Date.now(),attributes:{"span.type":`tool`,tool_name:e},perfettoSpanId:r};return Y.set(n,new WeakRef(i)),J.enterWith(i),t}return a.getActiveSpan()||G().startSpan(`dummy`)}let i=G(),s=q.getStore(),c=K(`tool`,{tool_name:e,...t}),l=s?a.setSpan(o.active(),s.span):o.active(),u=i.startSpan(`workmate.tool`,{attributes:c},l);n&&qe(u,e,n);let d=U(u),f={span:u,startTime:Date.now(),attributes:c,perfettoSpanId:r};return Y.set(d,new WeakRef(f)),J.enterWith(f),u}function mt(){let e=H()?rt(`tool_permission`):void 0;if(!W()){if(e){let t=a.getActiveSpan()||G().startSpan(`dummy`),n=U(t),r={span:t,startTime:Date.now(),attributes:{"span.type":`tool.blocked_on_user`},perfettoSpanId:e};return Y.set(n,new WeakRef(r)),X.set(n,r),t}return a.getActiveSpan()||G().startSpan(`dummy`)}let t=G(),n=J.getStore(),r=K(`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=U(s),l={span:s,startTime:Date.now(),attributes:r,perfettoSpanId:e};return Y.set(c,new WeakRef(l)),X.set(c,l),s}function ht(e,t){let n=Array.from(Y.values()).findLast(e=>e.deref()?.attributes[`span.type`]===`tool.blocked_on_user`)?.deref();if(!n)return;if(n.perfettoSpanId&&n.perfettoSpanId,!W()){let e=U(n.span);Y.delete(e),X.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=U(n.span);Y.delete(i),X.delete(i)}function gt(){if(!W())return a.getActiveSpan()||G().startSpan(`dummy`);let e=G(),t=J.getStore(),n=K(`tool.execution`),r=t?a.setSpan(o.active(),t.span):o.active(),i=e.startSpan(`workmate.tool.execution`,{attributes:n},r),s=U(i),c={span:i,startTime:Date.now(),attributes:n};return Y.set(s,new WeakRef(c)),X.set(s,c),i}function _t(e){if(!W())return;let t=Array.from(Y.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=U(t.span);Y.delete(r),X.delete(r)}function vt(e,t){let n=J.getStore();if(!n)return;if(n.perfettoSpanId&&n.perfettoSpanId,!W()){let e=U(n.span);Y.delete(e),J.enterWith(void 0);return}let r={duration_ms:Date.now()-n.startTime};e&&Je(r,n.attributes.tool_name||`unknown`,e),t!==void 0&&(r.result_tokens=t),n.span.setAttributes(r),n.span.end();let i=U(n.span);Y.delete(i),J.enterWith(void 0)}function yt(){return r(process.env.OTEL_LOG_TOOL_CONTENT)}function bt(e,t){if(!W()||!yt())return;let n=J.getStore();if(!n)return;let r={};for(let[e,n]of Object.entries(t))if(typeof n==`string`){let{content:t,truncated:i}=L(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 xt(e,t,n,r){if(!I())return a.getActiveSpan()||G().startSpan(`dummy`);let i=G(),s=J.getStore()??q.getStore(),c=K(`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=U(u),f={span:u,startTime:Date.now(),attributes:c};return Y.set(d,new WeakRef(f)),X.set(d,f),u}function St(e,t){if(!I())return;let n=U(e),r=Y.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(),Y.delete(n),X.delete(n)}var q,J,Y,X,Z,Q,$,Ct=e((()=>{s(),i(),N(),Ze(),ot(),q=new _,J=new _,Y=new Map,X=new Map,Z=0,Q=!1,$=1800*1e3}));export{T as A,ge as B,I as C,M as D,Le as E,b as F,Se as I,Ae as L,ye as M,be as N,N as O,xe as P,v as R,Ze as S,P as T,Qe as _,ht as a,et as b,Ct as c,lt as d,dt as f,ot as g,pt as h,ft as i,A as j,k,ct as l,gt as m,St as n,_t as o,mt as p,ut as r,vt as s,bt as t,xt as u,H as v,ze as w,Be as x,$e as y,ve as z};