@readmagic/workmate 0.0.3 → 0.0.5

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 (402) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-mANiG0xj.js → AddWorkspaceDirectory-DJRkEz7o.js} +1 -1
  2. package/dist/chunks/{App-aUVaOLeo.js → App-iJu5qyiF.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-CKfn7U1R.js +1 -0
  4. package/dist/chunks/{ApproveApiKey-36iUE5CW.js → ApproveApiKey-CRejTHUw.js} +1 -1
  5. package/dist/chunks/{AssistantSessionChooser-BLcvdkgb.js → AssistantSessionChooser-CBLQ1v-J.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-CyoLEYWH.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-CTlpvTuz.js → BypassPermissionsModeDialog-D1FCKVOi.js} +1 -1
  8. package/dist/chunks/{ClaudeMdExternalIncludesDialog-5pipE8m8.js → ClaudeMdExternalIncludesDialog-CI0yF6sZ.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-TypH-X8e.js +1 -0
  10. package/dist/chunks/ConsoleOAuthFlow-wGQuFt41.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-Blg1TVut.js → DesktopHandoff-D1rrMxeP.js} +1 -1
  12. package/dist/chunks/{DiffDialog-CUEpuocY.js → DiffDialog-BKcfKx7O.js} +2 -2
  13. package/dist/chunks/Doctor-CcJUwSQn.js +1 -0
  14. package/dist/chunks/Doctor-Yco1McrL.js +3 -0
  15. package/dist/chunks/ExitFlow-D3csukbB.js +2 -0
  16. package/dist/chunks/{Feedback-CDTqPqsM.js → Feedback-bEUtrHia.js} +2 -2
  17. package/dist/chunks/Grove-DPkIjqg8.js +1 -0
  18. package/dist/chunks/{Grove-D9lSG_Lh.js → Grove-Dsd7F39b.js} +1 -1
  19. package/dist/chunks/{HybridTransport-8j0AviF6.js → HybridTransport-9fTBC2Pv.js} +1 -1
  20. package/dist/chunks/{InvalidConfigDialog-I3t-0nU3.js → InvalidConfigDialog-9M-1nfZ6.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-BnthOxGT.js → InvalidSettingsDialog-B2F6pryH.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-MWpKjeZT.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-D0XvLirX.js → McpParsingWarnings-BPBb7Npe.js} +1 -1
  24. package/dist/chunks/MessageSelector-DsQmqFt2.js +3 -0
  25. package/dist/chunks/Messages-B3sGRx5A.js +11 -0
  26. package/dist/chunks/{Onboarding-B1WRpoBI.js → Onboarding-cHcnsBGp.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-BSmgq089.js → OverageCreditUpsell-CWCD_RpM.js} +1 -1
  28. package/dist/chunks/PluginSettings-B0jbwB2M.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-3rjz6zhK.js → PromptInputFooterSuggestions-D5sAO6y-.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-DgDJHZqC.js → PromptInputHelpMenu-n6hAdsto.js} +1 -1
  31. package/dist/chunks/QueryEngine-cwdsr4dr.js +1 -0
  32. package/dist/chunks/REPL-CJzScgbZ.js +142 -0
  33. package/dist/chunks/REPL-DlBJIPCw.js +1 -0
  34. package/dist/chunks/{RemoteCallout-BFzCx_Pn.js → RemoteCallout-CiA4rCEs.js} +1 -1
  35. package/dist/chunks/RemoteSessionManager-zdHfmvfj.js +2 -0
  36. package/dist/chunks/ResumeConversation-Rxwd6HAJ.js +1 -0
  37. package/dist/chunks/{SSETransport-DGIytG74.js → SSETransport-BPbhCa2f.js} +3 -3
  38. package/dist/chunks/SearchExtraToolsTool-VP87ErGx.js +1 -0
  39. package/dist/chunks/Settings-CxI_KHUj.js +2 -0
  40. package/dist/chunks/{TeleportProgress-Bens06DU.js → TeleportProgress-DrulEQ7z.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-BtLBCZUe.js → TeleportRepoMismatchDialog-D3FOLr0P.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-t50LfWyN.js → TeleportResumeWrapper-DI5iRFND.js} +1 -1
  43. package/dist/chunks/{ThemePicker-BTfuZZ7E.js → ThemePicker-CQ7dfFtv.js} +1 -1
  44. package/dist/chunks/{TrustDialog-CgE_pYUK.js → TrustDialog-CnVKrdxQ.js} +1 -1
  45. package/dist/chunks/{ValidationErrorsList-Bl68E-2-.js → ValidationErrorsList-CPYeuppg.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-C93xQYAF.js → WelcomeV2-C-UXdIng.js} +1 -1
  47. package/dist/chunks/{add-dir-C3IhJYVH.js → add-dir-xTz4COgn.js} +1 -1
  48. package/dist/chunks/{agentDisplay-Cju-aXCx.js → agentDisplay-BuSReYxu.js} +1 -1
  49. package/dist/chunks/{agents-Du3FQ82k.js → agents-CiLlKN2I.js} +1 -1
  50. package/dist/chunks/agents-Du9KYHqN.js +103 -0
  51. package/dist/chunks/allErrors-P3utlEeA.js +1 -0
  52. package/dist/chunks/{ant-CVvy4SuO.js → ant-CBIfqmAb.js} +1 -1
  53. package/dist/chunks/api-B-5jqiMg.js +1 -0
  54. package/dist/chunks/api-BiwZmmsh.js +1 -0
  55. package/dist/chunks/{assistant-C_SkUDk_.js → assistant-XOnU01yl.js} +1 -1
  56. package/dist/chunks/auth-BQa4kzQo.js +1 -0
  57. package/dist/chunks/auth-DT2yxy94.js +15 -0
  58. package/dist/chunks/auth-UAJhZNmZ.js +1 -0
  59. package/dist/chunks/{autoMode-CZyb-mMY.js → autoMode-CEMflt3g.js} +1 -1
  60. package/dist/chunks/{autonomy-DJZ25xZp.js → autonomy-Cg5zweUa.js} +7 -7
  61. package/dist/chunks/{autonomy-BpINX4jw.js → autonomy-_N8aDaA8.js} +1 -1
  62. package/dist/chunks/{autonomyPanel-ssoiIOx5.js → autonomyPanel-I4yCy3Fr.js} +1 -1
  63. package/dist/chunks/backgroundHousekeeping-BUUZ7Csq.js +1 -0
  64. package/dist/chunks/backgroundHousekeeping-DhF2lrQ9.js +17 -0
  65. package/dist/chunks/{branch-BXo5z2al.js → branch-BIX-pyHp.js} +1 -1
  66. package/dist/chunks/{bridge-CbKc1HeD.js → bridge-CYskzVt8.js} +2 -2
  67. package/dist/chunks/{bridgeConfig-DbqUHe0H.js → bridgeConfig-5p_w4s5r.js} +1 -1
  68. package/dist/chunks/bridgeConfig-DWEqKbXk.js +1 -0
  69. package/dist/chunks/bridgeEnabled-CjVCMwnq.js +1 -0
  70. package/dist/chunks/bridgeEnabled-DhFrLTbG.js +1 -0
  71. package/dist/chunks/bridgeMain-6lollTtZ.js +1 -0
  72. package/dist/chunks/bridgeMain-BX2AkLPs.js +68 -0
  73. package/dist/chunks/{bridgeMessaging-lfa_v3oi.js → bridgeMessaging-B5Lbzr8e.js} +1 -1
  74. package/dist/chunks/{btw-Cp0whJaJ.js → btw-CWWFO7u8.js} +1 -1
  75. package/dist/chunks/caches-C46fa77L.js +1 -0
  76. package/dist/chunks/{caches-CmW7idg5.js → caches-DPqPIogk.js} +2 -2
  77. package/dist/chunks/{ccrClient-BPXmxWHw.js → ccrClient-CTLnU9Y1.js} +1 -1
  78. package/dist/chunks/{clear-DjGPxX7T.js → clear-DCAgZwc4.js} +1 -1
  79. package/dist/chunks/client-Bup0Sgcn.js +1 -0
  80. package/dist/chunks/{color-DYYBN52b.js → color-CmJGInHL.js} +1 -1
  81. package/dist/chunks/commands-BdB1eFvP.js +1 -0
  82. package/dist/chunks/{commitAttribution-Bmzgtqc6.js → commitAttribution-CGZr7XNO.js} +2 -2
  83. package/dist/chunks/commitAttribution-D6J3NuhB.js +1 -0
  84. package/dist/chunks/compact-C6-lMHgn.js +2 -0
  85. package/dist/chunks/{config-DiT2Z8dY.js → config-3m_9zSrj.js} +1 -1
  86. package/dist/chunks/config-Bxt1UH1T.js +1 -0
  87. package/dist/chunks/config-CjjXZfNi.js +1 -0
  88. package/dist/chunks/{context-Bh_iUj76.js → context-C9V4GF0n.js} +1 -1
  89. package/dist/chunks/{context-noninteractive-Cb3EM2Oz.js → context-noninteractive-BmC4o5xo.js} +2 -2
  90. package/dist/chunks/context-noninteractive-DvGo1l7b.js +1 -0
  91. package/dist/chunks/conversation-CH9ouFai.js +1 -0
  92. package/dist/chunks/conversation-CYqqk0o7.js +1 -0
  93. package/dist/chunks/{createSSHSession-B0s839mX.js → createSSHSession-BL6j0AU5.js} +1 -1
  94. package/dist/chunks/createSession-DUfOAeyE.js +1 -0
  95. package/dist/chunks/{createSession-VMTMXOHu.js → createSession-D_sgO1Xy.js} +1 -1
  96. package/dist/chunks/crossProjectResume-D5hTOfnE.js +40 -0
  97. package/dist/chunks/{datadog-D9rlcN12.js → datadog-UkGdjL8-.js} +1 -1
  98. package/dist/chunks/{desktop-DidI-4N5.js → desktop-HbYKh-VK.js} +1 -1
  99. package/dist/chunks/{diff-CZg5qL2n.js → diff-nTV17iWX.js} +1 -1
  100. package/dist/chunks/doctor-7fgVhEKL.js +1 -0
  101. package/dist/chunks/{entry-dA1UCfC0.js → entry-CCFI6-gM.js} +3 -3
  102. package/dist/chunks/envLessBridgeConfig-B2HYnEKo.js +1 -0
  103. package/dist/chunks/{envLessBridgeConfig-BFjJ8Kt4.js → envLessBridgeConfig-DXd10GXD.js} +1 -1
  104. package/dist/chunks/{esm-DjGYYlQe.js → esm-CGoYrggU.js} +1 -1
  105. package/dist/chunks/exit-ropaQiOr.js +1 -0
  106. package/dist/chunks/extra-usage-CLhv1Z4g.js +1 -0
  107. package/dist/chunks/{extra-usage-core-RZMzaH0L.js → extra-usage-core-DLYHAInT.js} +1 -1
  108. package/dist/chunks/{extra-usage-BTv_OwGN.js → extra-usage-g2Pw4zt_.js} +1 -1
  109. package/dist/chunks/{extra-usage-noninteractive-BB-BQ3kh.js → extra-usage-noninteractive-D8iszH3c.js} +1 -1
  110. package/dist/chunks/extraUsage-C2Ylufhj.js +1 -0
  111. package/dist/chunks/extractMemories-B2IAvbXM.js +1 -0
  112. package/dist/chunks/{fast-CNXgsvnE.js → fast-Dx2fTmWr.js} +1 -1
  113. package/dist/chunks/fast-_G6zcFye.js +1 -0
  114. package/dist/chunks/{feedback-DeJ2gvw2.js → feedback-DCQ4pJ3v.js} +1 -1
  115. package/dist/chunks/{firstPartyEventLogger-CQdJn3LV.js → firstPartyEventLogger-BNGPPBNP.js} +2 -2
  116. package/dist/chunks/firstPartyEventLogger-C9LzVy6y.js +1 -0
  117. package/dist/chunks/{flushGate-CJ73xcaK.js → flushGate-XaheIZZT.js} +1 -1
  118. package/dist/chunks/{gemini-Cn9bMXwP.js → gemini-BCCLHK3K.js} +1 -1
  119. package/dist/chunks/{generateRecap-BO9kzRon.js → generateRecap-BhvbixY2.js} +1 -1
  120. package/dist/chunks/{generateSessionName-CGpL6ATy.js → generateSessionName-CN1oh7Fa.js} +1 -1
  121. package/dist/chunks/{githubRepoPathMapping-C4umZ1oC.js → githubRepoPathMapping-B4AM8luI.js} +1 -1
  122. package/dist/chunks/{goal-C8Qzl7_i.js → goal-Bp6fyGqo.js} +3 -3
  123. package/dist/chunks/{grok-CDT9P_BL.js → grok-ax26ju8y.js} +1 -1
  124. package/dist/chunks/{grove-BGXzEyH9.js → grove-DrBVaZSN.js} +2 -2
  125. package/dist/chunks/{heapdump-CFHvdSZv.js → heapdump-JseysNDr.js} +1 -1
  126. package/dist/chunks/{help-DUZ7Y7Em.js → help-DR9hKneR.js} +1 -1
  127. package/dist/chunks/hooks-BUJLxdFJ.js +1 -0
  128. package/dist/chunks/{hooks-RHwUCXcT.js → hooks-C5n23H1E.js} +2 -2
  129. package/dist/chunks/inboundAttachments-C0nMTtCi.js +1 -0
  130. package/dist/chunks/{inboundAttachments-Cfl4_n0S.js → inboundAttachments-Cp8XvLMZ.js} +1 -1
  131. package/dist/chunks/initReplBridge-DJs28ZkI.js +1 -0
  132. package/dist/chunks/{install-OkuNmjmB.js → install-C7qTB0V5.js} +1 -1
  133. package/dist/chunks/{instrumentation-hrXeo-G4.js → instrumentation-CLZttr_u.js} +4 -4
  134. package/dist/chunks/{job-DjmIpwJl.js → job-BhiazwPH.js} +1 -1
  135. package/dist/chunks/keybindings-CkL8BzUt.js +2 -0
  136. package/dist/chunks/{language-BA5WprZv.js → language-DIw2871r.js} +1 -1
  137. package/dist/chunks/language-DfOAuDFc.js +1 -0
  138. package/dist/chunks/launchAgentsPlatform-j-mWpwW1.js +1 -0
  139. package/dist/chunks/{launchLocalMemory-CgXtGng1.js → launchLocalMemory-DmoXp0Xo.js} +2 -2
  140. package/dist/chunks/{launchLocalVault-Bs6Km3Ua.js → launchLocalVault-1uKe0HjA.js} +3 -3
  141. package/dist/chunks/launchMemoryStores-SxDKjHJ3.js +1 -0
  142. package/dist/chunks/{launchOnboarding-Cn0t_o2k.js → launchOnboarding-CTtpnXcs.js} +1 -1
  143. package/dist/chunks/launchSchedule-BDVnGhaL.js +1 -0
  144. package/dist/chunks/launchSkillStore-SmMLxp4K.js +1 -0
  145. package/dist/chunks/{launchTeleport-Ba_Hj13c.js → launchTeleport-B472ZSGz.js} +3 -3
  146. package/dist/chunks/launchVault-CsyBgxle.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-DrDu5yYy.js → loadAgentsDir-Clu7Uk6a.js} +629 -629
  148. package/dist/chunks/loadAgentsDir-DTbJJff-.js +1 -0
  149. package/dist/chunks/loadPluginHooks-Cvd5VdjQ.js +1 -0
  150. package/dist/chunks/localSearch-DKv8PRLD.js +1 -0
  151. package/dist/chunks/{localSearch-_bQhk9W6.js → localSearch-iA6JTk19.js} +1 -1
  152. package/dist/chunks/{logoV2Utils-CoC4nheD.js → logoV2Utils-YHBJLIrC.js} +1 -1
  153. package/dist/chunks/{magicDocs-kMjYpjCA.js → magicDocs-Bf1fqnHN.js} +3 -3
  154. package/dist/chunks/{main-C_rVSWfm.js → main-gtV_TqXP.js} +84 -84
  155. package/dist/chunks/{mappers-D0CNXG32.js → mappers-C8lYERPX.js} +1 -1
  156. package/dist/chunks/{mcp-DtxIl6aN.js → mcp-CNuhEGP6.js} +4 -4
  157. package/dist/chunks/mcp-Ci0OPVrR.js +1 -0
  158. package/dist/chunks/mcp-CwIYauZl.js +2 -0
  159. package/dist/chunks/memory-DCGqfQ1U.js +1 -0
  160. package/dist/chunks/{mode-B4WIxCMW.js → mode-DO6g7nkX.js} +2 -2
  161. package/dist/chunks/model-BQF64tZx.js +1 -0
  162. package/dist/chunks/model-DLXL0CNu.js +1 -0
  163. package/dist/chunks/model-DvrvG6BB.js +1 -0
  164. package/dist/chunks/{nativeInstaller-DktvrWRd.js → nativeInstaller-OPuO2sm_.js} +1 -1
  165. package/dist/chunks/{onChangeAppState-CGVeNkt7.js → onChangeAppState-CHhRDkM7.js} +1 -1
  166. package/dist/chunks/openai-HOebt-8k.js +10 -0
  167. package/dist/chunks/{overageCreditGrant-BVxlYgeU.js → overageCreditGrant-Bi1CTBAx.js} +1 -1
  168. package/dist/chunks/{panelCall-Cp6fpQeL.js → panelCall-D0eURklm.js} +1 -1
  169. package/dist/chunks/{partition-RjCtgt9J.js → partition-C8RSL3SQ.js} +1 -1
  170. package/dist/chunks/{passes-ByTLy6pj.js → passes-BJci5SM_.js} +1 -1
  171. package/dist/chunks/permissions-JU9CGHgI.js +3 -0
  172. package/dist/chunks/{pidLock-CdNZ0Wfg.js → pidLock-Bd2e6xuT.js} +2 -2
  173. package/dist/chunks/{plan-BxTA-b4l.js → plan-D4gMsK7i.js} +1 -1
  174. package/dist/chunks/{plugin-DOpl5e1t.js → plugin-CwCo5Kik.js} +1 -1
  175. package/dist/chunks/{pluginAutoupdate-L09CQ-ph.js → pluginAutoupdate-CO-n9bqe.js} +1 -1
  176. package/dist/chunks/{pluginBlocklist-B32eWmzn.js → pluginBlocklist-5qbaTRbV.js} +1 -1
  177. package/dist/chunks/pluginCliCommands-I-lsw_us.js +1 -0
  178. package/dist/chunks/{pluginFlagging-3FQGvIfq.js → pluginFlagging-DNPBbJZo.js} +1 -1
  179. package/dist/chunks/{pluginOperations-ClzXYNQe.js → pluginOperations-Cz6eQ0Vu.js} +2 -2
  180. package/dist/chunks/pluginStartupCheck-CoW7073W.js +1 -0
  181. package/dist/chunks/{pluginStartupCheck-BNd2QNzZ.js → pluginStartupCheck-DJ9fslCK.js} +1 -1
  182. package/dist/chunks/plugins-CzJIuPfb.js +4 -0
  183. package/dist/chunks/policyLimits-BkjgMQD0.js +1 -0
  184. package/dist/chunks/{poor-DekfGNT7.js → poor-Dha9p9RF.js} +1 -1
  185. package/dist/chunks/{poorMode-CtcqaiwD.js → poorMode-1NLYiS3Y.js} +1 -1
  186. package/dist/chunks/poorMode-qlxqU8Hm.js +1 -0
  187. package/dist/chunks/print-BL4EUT5Z.js +23 -0
  188. package/dist/chunks/{privacy-settings-ChNsgGUs.js → privacy-settings-6ZWxR4Qt.js} +1 -1
  189. package/dist/chunks/processBashCommand-BZs9wggV.js +1 -0
  190. package/dist/chunks/processSlashCommand-D8lKLNzM.js +5 -0
  191. package/dist/chunks/{prompt-C0nU0VK3.js → prompt-Bg_1U0gO.js} +1 -1
  192. package/dist/chunks/prompt-CN7gBNKS.js +1 -0
  193. package/dist/chunks/prompt-D-zHhqp8.js +1 -0
  194. package/dist/chunks/{promptEditor-Cumef6hJ.js → promptEditor-BhYDmwdS.js} +2 -2
  195. package/dist/chunks/{protocolHandler-z2zxAtB1.js → protocolHandler-Dnb7lITm.js} +1 -1
  196. package/dist/chunks/rate-limit-options-DVzT3eWH.js +1 -0
  197. package/dist/chunks/{rcDebugLog-2-1XSyFV.js → rcDebugLog-VKwMl0yg.js} +1 -1
  198. package/dist/chunks/reconciler-BdRXZTJf.js +4 -0
  199. package/dist/chunks/{referral-DrebVwqx.js → referral-BlrMpBAV.js} +1 -1
  200. package/dist/chunks/{refresh-pFezssA8.js → refresh-jwqnoK2h.js} +1 -1
  201. package/dist/chunks/{registerProtocol-CukLQuxJ.js → registerProtocol-CuKZAiCc.js} +1 -1
  202. package/dist/chunks/{release-notes-D7vrFNXp.js → release-notes-BgP8u7NE.js} +1 -1
  203. package/dist/chunks/{releaseNotes-CDx2P0fb.js → releaseNotes-CunqVlbU.js} +2 -2
  204. package/dist/chunks/{reload-plugins-CltHfg-l.js → reload-plugins-CD9TzvFm.js} +1 -1
  205. package/dist/chunks/{remote-env-SvvSuP0J.js → remote-env-QaP_W_sv.js} +1 -1
  206. package/dist/chunks/{remoteBridgeCore-BOeljn2c.js → remoteBridgeCore-9-HVMo63.js} +1 -1
  207. package/dist/chunks/{remoteManagedSettings-CaY_ZH8r.js → remoteManagedSettings-jZ6u8ZBT.js} +1 -1
  208. package/dist/chunks/{rename-CbqrCCBO.js → rename-29qxHf8W.js} +1 -1
  209. package/dist/chunks/{resume-DockJaY9.js → resume-D-SpOy_1.js} +2 -2
  210. package/dist/chunks/{runtimeObserver-DSUuYKfs.js → runtimeObserver-DOEcrylu.js} +1 -1
  211. package/dist/chunks/{runtimeObserver-XufSllVw.js → runtimeObserver-Dm3LIUMp.js} +3 -3
  212. package/dist/chunks/sandbox-adapter-LzTcKwBp.js +1 -0
  213. package/dist/chunks/{sandbox-toggle-CZI5fuK3.js → sandbox-toggle-B61AeBor.js} +1 -1
  214. package/dist/chunks/searchExtraTools-CbJJQqzH.js +1 -0
  215. package/dist/chunks/{session-B-Z3DU9o.js → session-RwJCIIcs.js} +2 -2
  216. package/dist/chunks/{sessionDiscovery-C3pMZkBM.js → sessionDiscovery-dkFeWcA3.js} +1 -1
  217. package/dist/chunks/sessionFileAccessHooks-B_nNW0zE.js +1 -0
  218. package/dist/chunks/sessionMemory-C4JAUZ6V.js +1 -0
  219. package/dist/chunks/sessionMemory-btARBn8H.js +1 -0
  220. package/dist/chunks/sessionMemoryUtils-BlqAy8oR.js +1 -0
  221. package/dist/chunks/{sessionObserver-B_09FQKV.js → sessionObserver-CSOYgsvH.js} +1 -1
  222. package/dist/chunks/sessionObserver-DMvWci8-.js +1 -0
  223. package/dist/chunks/sessionStorage-Diyuvt20.js +1 -0
  224. package/dist/chunks/{sessionTitle-CmLWNFuX.js → sessionTitle-CLOlPZ_M.js} +1 -1
  225. package/dist/chunks/{sessionTracing-lArOaj9u.js → sessionTracing-D8wr9j4X.js} +1 -1
  226. package/dist/chunks/{settings-DfWP5y6X.js → settings-Dlp5JTa_.js} +1 -1
  227. package/dist/chunks/settingsSync-QWA0VZSu.js +1 -0
  228. package/dist/chunks/setup-UI9uv2-K.js +3 -0
  229. package/dist/chunks/{shadowedRuleDetection-E2wF1UjU.js → shadowedRuleDetection-CXsmUY2o.js} +1 -1
  230. package/dist/chunks/{sideQuestion-BjHCLSR9.js → sideQuestion-CHpOVzY5.js} +1 -1
  231. package/dist/chunks/{sinks-Cb--pqr-.js → sinks-1hFrW9HK.js} +2 -2
  232. package/dist/chunks/sinks-CXq8-7Qn.js +1 -0
  233. package/dist/chunks/{skill-learning-B0dyBT1_.js → skill-learning-Ck17rwH8.js} +1 -1
  234. package/dist/chunks/skillChangeDetector-s0F9Yf9a.js +1 -0
  235. package/dist/chunks/{skillGapStore-D2fqmnKx.js → skillGapStore-BJ1h2LVr.js} +1 -1
  236. package/dist/chunks/{skillGapStore-75ZYlfwi.js → skillGapStore-DyqNKuNy.js} +2 -2
  237. package/dist/chunks/{skillGenerator-CwXUfM4Y.js → skillGenerator-BT8NGzXT.js} +2 -2
  238. package/dist/chunks/skillLearning-1ZfYIzfL.js +1 -0
  239. package/dist/chunks/{skillLearning-CB-5fdMl.js → skillLearning-Cn9Uw0Kd.js} +1 -1
  240. package/dist/chunks/{skillPanel-Bum7xpgo.js → skillPanel-N0GoWjIi.js} +3 -3
  241. package/dist/chunks/{skillSearchPanel-LSPwZIOw.js → skillSearchPanel-CTwtgTzy.js} +3 -3
  242. package/dist/chunks/{skills-G8WBeffd.js → skills-Bv3lH-aA.js} +1 -1
  243. package/dist/chunks/{stats-DmFubHpI.js → stats-C1Ff6w4i.js} +1 -1
  244. package/dist/chunks/{status-ClSsvm1N.js → status-DyXiBa0m.js} +2 -2
  245. package/dist/chunks/{status-i5beKggW.js → status-FD7HVYS7.js} +1 -1
  246. package/dist/chunks/{statusNoticeHelpers-BK-54uGY.js → statusNoticeHelpers-kTp9Rdk6.js} +1 -1
  247. package/dist/chunks/{tag-DYYq4H_i.js → tag-RzOSA5T0.js} +2 -2
  248. package/dist/chunks/{tasks-BySzm_YJ.js → tasks-eJrOcdhB.js} +1 -1
  249. package/dist/chunks/teleport-ABA-hdmP.js +1 -0
  250. package/dist/chunks/{templateJobs-CT5VxeRr.js → templateJobs-BnOBSFtq.js} +1 -1
  251. package/dist/chunks/{terminalSetup-RDKg8dVa.js → terminalSetup-BfvmoJaK.js} +1 -1
  252. package/dist/chunks/{terminalSetup-BNs9nLbT.js → terminalSetup-D_P5iZmq.js} +1 -1
  253. package/dist/chunks/{theme-CVTVsRwt.js → theme-S0kVMVt4.js} +1 -1
  254. package/dist/chunks/thinkback-C6gV2LpU.js +1 -0
  255. package/dist/chunks/thinkback-HyW_R_88.js +1 -0
  256. package/dist/chunks/{thinkback-play-BhfCaIye.js → thinkback-play-H6md4czq.js} +1 -1
  257. package/dist/chunks/{toolEventObserver--4fqXxQZ.js → toolEventObserver--Z6jENks.js} +1 -1
  258. package/dist/chunks/{toolEventObserver-DdhPsAs1.js → toolEventObserver-BAFzvePj.js} +1 -1
  259. package/dist/chunks/toolPool-CR61XXm3.js +1 -0
  260. package/dist/chunks/trustedDevice-DUrFWupL.js +1 -0
  261. package/dist/chunks/{trustedDevice-DvpN4J1F.js → trustedDevice-Dn4rXbxT.js} +1 -1
  262. package/dist/chunks/types-Bh9S_JG5.js +3 -0
  263. package/dist/chunks/types-DHkZVzJe.js +1 -0
  264. package/dist/chunks/{ultrareviewCommand-i3PfFKly.js → ultrareviewCommand-mYDTBCFD.js} +2 -2
  265. package/dist/chunks/{undercover-Q24TWRw0.js → undercover-CdapzvNH.js} +1 -1
  266. package/dist/chunks/undercover-k3JoOKAb.js +1 -0
  267. package/dist/chunks/{updateCCB-CEXA6dax.js → updateCCB-DPShheOr.js} +1 -1
  268. package/dist/chunks/upgrade-BOeakAP6.js +1 -0
  269. package/dist/chunks/upgrade-D7iGU0PQ.js +1 -0
  270. package/dist/chunks/{upload-B-lNHpWe.js → upload-BXQsDtLW.js} +1 -1
  271. package/dist/chunks/usage-DbRdMJog.js +1 -0
  272. package/dist/chunks/usage-iNQzY960.js +1 -0
  273. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CzFtdlnD.js → useExitOnCtrlCDWithKeybindings-CntByfTQ.js} +1 -1
  274. package/dist/chunks/useMainLoopModel-DHkRIgNs.js +1 -0
  275. package/dist/chunks/useManagePlugins-B8HD0RUh.js +1 -0
  276. package/dist/chunks/{useMergedTools-DMGRA1ga.js → useMergedTools-DfchLQZC.js} +1 -1
  277. package/dist/chunks/{useSearchInput-D5VU9IDU.js → useSearchInput-H-8hJeFD.js} +1 -1
  278. package/dist/chunks/useSettingsErrors-BF5i5Xju.js +1 -0
  279. package/dist/chunks/{util-CNa1ib_4.js → util-CoicMvOv.js} +1 -1
  280. package/dist/chunks/validatePlugin-z2fcngf8.js +1 -0
  281. package/dist/chunks/{vim-C0KTnJJs.js → vim-DdvQlLDm.js} +1 -1
  282. package/dist/chunks/{workerRegistry-B2QD2sKq.js → workerRegistry-CzqQwCHC.js} +1 -1
  283. package/dist/chunks/worktree-DMhP5T0p.js +1 -0
  284. package/dist/cli.js +1 -1
  285. package/package.json +2 -6
  286. package/dist/chunks/ApproveApiKey-DPdcp1CQ.js +0 -1
  287. package/dist/chunks/BackgroundTasksDialog-DyjVt81B.js +0 -2
  288. package/dist/chunks/ClaudeMdExternalIncludesDialog-Dn7Le--z.js +0 -1
  289. package/dist/chunks/ConsoleOAuthFlow-BDr1Vx5K.js +0 -1
  290. package/dist/chunks/Doctor-B540I-gq.js +0 -1
  291. package/dist/chunks/Doctor-DlE1Mbb9.js +0 -3
  292. package/dist/chunks/ExitFlow-DCIhnP5h.js +0 -2
  293. package/dist/chunks/Grove-DLYXL8hv.js +0 -1
  294. package/dist/chunks/MCPConnectionManager-zdocEDgk.js +0 -1
  295. package/dist/chunks/MessageSelector-BBhCstBa.js +0 -3
  296. package/dist/chunks/Messages-Dv2VrytX.js +0 -11
  297. package/dist/chunks/PluginSettings-DN9rpwc_.js +0 -17
  298. package/dist/chunks/QueryEngine-BnaHDZVZ.js +0 -1
  299. package/dist/chunks/REPL-B3RbzeV7.js +0 -1
  300. package/dist/chunks/REPL-CA8FEO7J.js +0 -142
  301. package/dist/chunks/RemoteSessionManager-BhUrtejX.js +0 -2
  302. package/dist/chunks/ResumeConversation-BseKUFRI.js +0 -1
  303. package/dist/chunks/SearchExtraToolsTool-h6OunbMd.js +0 -1
  304. package/dist/chunks/Settings-BvhG1XoW.js +0 -2
  305. package/dist/chunks/agents-Bhg0CtXR.js +0 -103
  306. package/dist/chunks/allErrors-DJYCAtab.js +0 -1
  307. package/dist/chunks/api-CI8HXREw.js +0 -1
  308. package/dist/chunks/api-gJBnC8z3.js +0 -1
  309. package/dist/chunks/auth-B9V3i5oZ.js +0 -1
  310. package/dist/chunks/auth-CgEABs3i.js +0 -15
  311. package/dist/chunks/auth-fSFfSKy_.js +0 -1
  312. package/dist/chunks/backgroundHousekeeping-BHncba6e.js +0 -17
  313. package/dist/chunks/backgroundHousekeeping-QK8iEXoI.js +0 -1
  314. package/dist/chunks/bridgeConfig-CLHy-BiF.js +0 -1
  315. package/dist/chunks/bridgeEnabled-BWSUZ7Xg.js +0 -1
  316. package/dist/chunks/bridgeEnabled-CM3SaumJ.js +0 -1
  317. package/dist/chunks/bridgeMain-BESKzpm0.js +0 -1
  318. package/dist/chunks/bridgeMain-CzhBVCsN.js +0 -68
  319. package/dist/chunks/caches-CpqTC0Lb.js +0 -1
  320. package/dist/chunks/client-DPUvQ6Rf.js +0 -1
  321. package/dist/chunks/commands-D7l3P1k9.js +0 -1
  322. package/dist/chunks/commitAttribution-B7NUPJ8E.js +0 -1
  323. package/dist/chunks/compact-D6xqZN4Q.js +0 -2
  324. package/dist/chunks/config-huQaTcNb.js +0 -1
  325. package/dist/chunks/config-qLaiAn7z.js +0 -1
  326. package/dist/chunks/context-noninteractive-CNot6jbs.js +0 -1
  327. package/dist/chunks/conversation-CSpwF3Ha.js +0 -1
  328. package/dist/chunks/conversation-CvCQta8e.js +0 -1
  329. package/dist/chunks/createSession-GNSNbUbN.js +0 -1
  330. package/dist/chunks/crossProjectResume-DGpgCUfk.js +0 -40
  331. package/dist/chunks/doctor-CKUXGCri.js +0 -1
  332. package/dist/chunks/effort-BcvNemuq.js +0 -9
  333. package/dist/chunks/envLessBridgeConfig-bei51W3H.js +0 -1
  334. package/dist/chunks/exit-COMnVxzw.js +0 -1
  335. package/dist/chunks/extra-usage-By33zGLT.js +0 -1
  336. package/dist/chunks/extraUsage-CTn9FWSk.js +0 -1
  337. package/dist/chunks/extractMemories-CXGZGe0h.js +0 -1
  338. package/dist/chunks/fast-BXzdzzXU.js +0 -1
  339. package/dist/chunks/firstPartyEventLogger-CdLshdJY.js +0 -1
  340. package/dist/chunks/hooks-fZ1r0jUF.js +0 -1
  341. package/dist/chunks/inboundAttachments-YMxf4fmR.js +0 -1
  342. package/dist/chunks/initReplBridge-GH3-LHF4.js +0 -1
  343. package/dist/chunks/keybindings-B8U17bhs.js +0 -2
  344. package/dist/chunks/language-BbaOTWm3.js +0 -1
  345. package/dist/chunks/launchAgentsPlatform-DnxH2SAn.js +0 -1
  346. package/dist/chunks/launchMemoryStores-DxVAIJuB.js +0 -1
  347. package/dist/chunks/launchSchedule-Chwr3Nzd.js +0 -1
  348. package/dist/chunks/launchSkillStore-6zxJfWVU.js +0 -1
  349. package/dist/chunks/launchVault-hGVrHy33.js +0 -1
  350. package/dist/chunks/loadAgentsDir-BHOyHxwz.js +0 -1
  351. package/dist/chunks/loadPluginHooks-s7bvGtns.js +0 -1
  352. package/dist/chunks/localSearch-CebU5BA9.js +0 -1
  353. package/dist/chunks/mcp-1ZuFesM9.js +0 -2
  354. package/dist/chunks/mcp-CKvGBEjz.js +0 -1
  355. package/dist/chunks/memory-DE2jtkd_.js +0 -1
  356. package/dist/chunks/model-C4RHNhDQ.js +0 -1
  357. package/dist/chunks/model-fi472PRc.js +0 -1
  358. package/dist/chunks/model-j9GNZDFr.js +0 -1
  359. package/dist/chunks/openai-BSVjSJiF.js +0 -10
  360. package/dist/chunks/permissions-B3df_htx.js +0 -3
  361. package/dist/chunks/pluginCliCommands-CDMWnO3d.js +0 -1
  362. package/dist/chunks/pluginStartupCheck-RiZxW-WU.js +0 -1
  363. package/dist/chunks/plugins-CcDG95Bs.js +0 -4
  364. package/dist/chunks/policyLimits-Bwi9VqDF.js +0 -1
  365. package/dist/chunks/poorMode-AE4WNYZo.js +0 -1
  366. package/dist/chunks/print-Cc_QOSPF.js +0 -23
  367. package/dist/chunks/processBashCommand-Bx6_oZoE.js +0 -1
  368. package/dist/chunks/processSlashCommand-AltWgIFt.js +0 -5
  369. package/dist/chunks/prompt-CYx145pp.js +0 -1
  370. package/dist/chunks/prompt-DH3lKFag.js +0 -1
  371. package/dist/chunks/rate-limit-options-VL7S3SCx.js +0 -1
  372. package/dist/chunks/reconciler-DHRE_gV2.js +0 -4
  373. package/dist/chunks/sandbox-adapter-CEZnHq0U.js +0 -1
  374. package/dist/chunks/searchExtraTools-iQfI39wB.js +0 -1
  375. package/dist/chunks/sessionFileAccessHooks-DyrZmoA7.js +0 -1
  376. package/dist/chunks/sessionMemory-CqRpgwtU.js +0 -1
  377. package/dist/chunks/sessionMemory-D_HQmhj7.js +0 -1
  378. package/dist/chunks/sessionMemoryUtils-CZOIKrn0.js +0 -1
  379. package/dist/chunks/sessionObserver-B400YG3s.js +0 -1
  380. package/dist/chunks/sessionStorage-DRnvtrpU.js +0 -1
  381. package/dist/chunks/settingsSync-BlDk6rsM.js +0 -1
  382. package/dist/chunks/setup-DdbmxSZh.js +0 -3
  383. package/dist/chunks/sinks-DbwDBd-E.js +0 -1
  384. package/dist/chunks/skillChangeDetector-DQof8SUY.js +0 -1
  385. package/dist/chunks/skillLearning-CSY5R5Jn.js +0 -1
  386. package/dist/chunks/teleport-dxtBcM01.js +0 -1
  387. package/dist/chunks/thinkback-B-GpXG9U.js +0 -1
  388. package/dist/chunks/thinkback-CXsRbDYN.js +0 -1
  389. package/dist/chunks/toolPool-DvHECcbN.js +0 -1
  390. package/dist/chunks/trustedDevice-e6iF1X7C.js +0 -1
  391. package/dist/chunks/types-BUyOCzUt.js +0 -1
  392. package/dist/chunks/types-Czs-_G1S.js +0 -3
  393. package/dist/chunks/undercover-CPvoDtJ1.js +0 -1
  394. package/dist/chunks/upgrade-7OrBbrzS.js +0 -1
  395. package/dist/chunks/upgrade-uR7SIVtx.js +0 -1
  396. package/dist/chunks/usage-7jOeIVv9.js +0 -1
  397. package/dist/chunks/usage-CZdPfUqP.js +0 -1
  398. package/dist/chunks/useMainLoopModel-DegH12LZ.js +0 -1
  399. package/dist/chunks/useManagePlugins-BkK1zydO.js +0 -1
  400. package/dist/chunks/useSettingsErrors-B5PSF1va.js +0 -1
  401. package/dist/chunks/validatePlugin-Dw-RGCrm.js +0 -1
  402. package/dist/chunks/worktree-D38cJ23W.js +0 -1
@@ -1,10 +1,10 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{Jw as r,Qi as i,Vi as a,qw as o}from"./loadAgentsDir-DrDu5yYy.js";import{r as s,t as c}from"./featureCheck-HslM03dr.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as ee,s as te,u as ne}from"./instinctParser-Dt-lqnDe.js";import{C as h,S as g,b as _,c as re,f as ie,i as ae,m as oe,o as v,r as se,u as y}from"./skillGenerator-CwXUfM4Y.js";import{a as ce,i as b,l as le,n as x,o as ue,t as de}from"./observationStore-DzCdXq8U.js";import{a as fe,s as pe}from"./projectContext-D9MDwJUF.js";import{d as me,i as he,l as ge,p as _e}from"./sessionObserver-B_09FQKV.js";import{dirname as ve,join as S}from"node:path";import{existsSync as C}from"node:fs";import{randomBytes as ye}from"node:crypto";import{mkdir as w,readFile as be,readdir as T,rename as xe,unlink as Se,writeFile as E}from"node:fs/promises";function D(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Ce(e)),i=Ee(e),a=t?.description??we(e),o=k(r,n,t),s=Te({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 O(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),a(),t)}function k(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`commands`):r?.globalCommandsDir??S(t(),`commands`)}function Ce(e){return g([`learned`,...De(e,4)].join(`-`))||`learned-command`}function we(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function Te(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{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{Qi as r,Vi as i,Xw as a,Yw as o}from"./loadAgentsDir-Clu7Uk6a.js";import{r as s,t as c}from"./featureCheck-HslM03dr.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as ee,s as te,u as ne}from"./instinctParser-Dt-lqnDe.js";import{C as h,S as g,b as _,c as re,f as ie,i as ae,m as oe,o as v,r as se,u as y}from"./skillGenerator-BT8NGzXT.js";import{a as ce,i as b,l as le,n as x,o as ue,t as de}from"./observationStore-DzCdXq8U.js";import{a as fe,s as pe}from"./projectContext-D9MDwJUF.js";import{d as me,i as he,l as ge,p as _e}from"./sessionObserver-CSOYgsvH.js";import{dirname as ve,join as S}from"node:path";import{existsSync as C}from"node:fs";import{randomBytes as ye}from"node:crypto";import{mkdir as w,readFile as be,readdir as T,rename as xe,unlink as Se,writeFile as E}from"node:fs/promises";function D(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Ce(e)),i=Ee(e),a=t?.description??we(e),o=k(r,n,t),s=Te({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 O(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),i(),t)}function k(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`commands`):r?.globalCommandsDir??S(t(),`commands`)}function Ce(e){return g([`learned`,...De(e,4)].join(`-`))||`learned-command`}function we(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function Te(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(`
5
- `)}function Ee(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function De(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`run`,`use`,`prefer`,`avoid`]),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 A=e((()=>{n(),i(),_()}));function j(e,t){if(e.length===0)throw Error(`Cannot generate an agent draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Oe(e)),i=je(e),a=t?.description??ke(e),o=N(r,n,t),s=Ae({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 M(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),a(),t)}function N(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`agents`):r?.globalAgentsDir??S(t(),`agents`)}function Oe(e){return g([`learned`,`agent`,...Me(e,4)].join(`-`))||`learned-agent`}function ke(e){return(e[0]?.trigger??`Run the learned multi-step workflow`).replace(/\s+/g,` `).slice(0,120)}function Ae(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(`, `)}]`,`---`,``,`You are the ${t} learned agent.`,``,`## Triggers`,``,i.map(e=>`- ${e.trigger}`).join(`
5
+ `)}function Ee(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function De(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`run`,`use`,`prefer`,`avoid`]),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 A=e((()=>{n(),r(),_()}));function j(e,t){if(e.length===0)throw Error(`Cannot generate an agent draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Oe(e)),i=je(e),a=t?.description??ke(e),o=N(r,n,t),s=Ae({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 M(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),i(),t)}function N(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`agents`):r?.globalAgentsDir??S(t(),`agents`)}function Oe(e){return g([`learned`,`agent`,...Me(e,4)].join(`-`))||`learned-agent`}function ke(e){return(e[0]?.trigger??`Run the learned multi-step workflow`).replace(/\s+/g,` `).slice(0,120)}function Ae(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(`, `)}]`,`---`,``,`You are the ${t} learned agent.`,``,`## Triggers`,``,i.map(e=>`- ${e.trigger}`).join(`
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 je(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function Me(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 P=e((()=>{n(),i(),_()}));function F(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Pe(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=f().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:I(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 I(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 Ne(e,t){return F(e).filter(e=>e.target===`skill`&&h(e.instincts)).map(e=>ae(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function L(e,t){return F(e).filter(e=>e.target===`command`&&h(e.instincts)).map(e=>D(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function R(e,t){return F(e).filter(e=>e.target===`agent`&&h(e.instincts)).map(e=>j(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Pe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var z=e((()=>{_(),v(),A(),P(),ne()}));function B(e){let t=x(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?S(t,`global`,`instincts`,`personal`):S(t,`projects`,n.projectId,`instincts`,`personal`)}async function V(e,t){let n=m(e);await w(B(t),{recursive:!0});let r=He(n.id,t),i=`${r}.${ye(6).toString(`hex`)}.tmp`;return await E(i,u(n)),await xe(i,r),n}async function H(e){let t=B(e),n=[];try{n=await T(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 be(S(t,e),`utf8`);r.push(te(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function Fe(e,t){let n=U.then(()=>Ie(e,t));return U=n.catch(()=>{}),n}async function Ie(e,t){let n=await H(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&l(t,e)),i=new Date().toISOString();if(!r)return V(e,t);let a=l(r,e),o=a?-.1:ze(e.evidenceOutcome),s=p(r.confidence+o),c=Le(r.status,s,a);return V(m({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function Le(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function Re(e){let t=await H(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)/Ue);if(a<1)continue;let o=-.02*a,s=p(i.confidence+o);s!==i.confidence&&(await V(m({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function ze(e){return e===`failure`?-.05:.05}async function Be(e,t){let n=await H(t);return await w(ve(e),{recursive:!0}),await E(e,`${JSON.stringify(n,null,2)}\n`),n}async function Ve(e,t){let n=await H(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await Se(He(e.id,t)),i.push(e));return i}function He(e,t){return S(B(t),`${e}.json`)}var U,Ue,W=e((()=>{b(),d(),U=Promise.resolve(),Ue=10080*60*1e3}));function We(e){if(G.add(e),G.size>Ye){let e=G.size-Xe,t=G.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;G.delete(e.value)}}}function Ge(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 Ke(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await qe(e.rootDir),i=Ge(r,t,n),a=[];for(let t of i){if(G.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await V({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Je(e.rootDir)}),We(t.instinctId),a.push(t))}return a}async function qe(e){let t=S(x(e?{rootDir:e}:void 0),`projects`);if(!C(t))return[];let n=await T(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await H({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:S(t,i.name)},scope:`project`});r.push(...n)}return r}function Je(e){let t=x(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:S(t,`global`)}}var Ye,Xe,G,Ze=e((()=>{W(),b(),Ye=256,Xe=192,G=new Set}));function Qe(){X=0,Z=0,Q.clear()}function $e(){return J}function et(){if(!q){q=!0;try{_e()}catch{}r(rt),tt().catch(()=>{})}}async function tt(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:pe(process.cwd())};await Promise.allSettled([Re(e),ce(e),Ve(30,e)])}function nt(e){try{let t=x();return e.startsWith(t)}catch{return!1}}async function rt(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(nt(t))return;let n=pe(t),r={project:n};++J;let i=[];for(let t of ot(e.messages,n))i.push(await de(t,r));let a=(await ue(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}=f(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,u;if(l)X++,Z=o,u=await ge(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-B400YG3s.js`),t=e.analyze(i,{project:n});u=Array.isArray(t)?t:await t}for(let e of u)await Fe(ee(e),r);await at(r)}function it(){J=0,Y=``,Qe()}async function at(e){let n=await H(e),r=process.cwd(),i=[S(r,`.claude`,`skills`),S(t(),`skills`)],a=F(n).filter(e=>e.target===`skill`&&h(e.instincts));for(let e of a){let t=await se(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;C(S(n.outputPath,`SKILL.md`))||await re(ie(n,await y(`skill`,n,i)))}let o=L(n,{cwd:r});for(let e of o)(await y(`command`,e,[S(r,`.claude`,`commands`),S(t(),`commands`)])).length>0||await O(e);let s=R(n,{cwd:r});for(let e of s)(await y(`agent`,e,[S(r,`.claude`,`agents`),S(t(),`agents`)])).length>0||await M(e);await Ke()}function ot(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>ut){let e=Q.size-$,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=lt(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=st(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=ct(e.message?.content),n=st(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 st(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 je(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function Me(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 P=e((()=>{n(),r(),_()}));function F(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Pe(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=f().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:I(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 I(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 Ne(e,t){return F(e).filter(e=>e.target===`skill`&&h(e.instincts)).map(e=>ae(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function L(e,t){return F(e).filter(e=>e.target===`command`&&h(e.instincts)).map(e=>D(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function R(e,t){return F(e).filter(e=>e.target===`agent`&&h(e.instincts)).map(e=>j(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Pe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var z=e((()=>{_(),v(),A(),P(),ne()}));function B(e){let t=x(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?S(t,`global`,`instincts`,`personal`):S(t,`projects`,n.projectId,`instincts`,`personal`)}async function V(e,t){let n=m(e);await w(B(t),{recursive:!0});let r=He(n.id,t),i=`${r}.${ye(6).toString(`hex`)}.tmp`;return await E(i,u(n)),await xe(i,r),n}async function H(e){let t=B(e),n=[];try{n=await T(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 be(S(t,e),`utf8`);r.push(te(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function Fe(e,t){let n=U.then(()=>Ie(e,t));return U=n.catch(()=>{}),n}async function Ie(e,t){let n=await H(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&l(t,e)),i=new Date().toISOString();if(!r)return V(e,t);let a=l(r,e),o=a?-.1:ze(e.evidenceOutcome),s=p(r.confidence+o),c=Le(r.status,s,a);return V(m({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function Le(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function Re(e){let t=await H(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)/Ue);if(a<1)continue;let o=-.02*a,s=p(i.confidence+o);s!==i.confidence&&(await V(m({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function ze(e){return e===`failure`?-.05:.05}async function Be(e,t){let n=await H(t);return await w(ve(e),{recursive:!0}),await E(e,`${JSON.stringify(n,null,2)}\n`),n}async function Ve(e,t){let n=await H(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await Se(He(e.id,t)),i.push(e));return i}function He(e,t){return S(B(t),`${e}.json`)}var U,Ue,W=e((()=>{b(),d(),U=Promise.resolve(),Ue=10080*60*1e3}));function We(e){if(G.add(e),G.size>Ye){let e=G.size-Xe,t=G.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;G.delete(e.value)}}}function Ge(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 Ke(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await qe(e.rootDir),i=Ge(r,t,n),a=[];for(let t of i){if(G.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await V({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Je(e.rootDir)}),We(t.instinctId),a.push(t))}return a}async function qe(e){let t=S(x(e?{rootDir:e}:void 0),`projects`);if(!C(t))return[];let n=await T(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await H({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:S(t,i.name)},scope:`project`});r.push(...n)}return r}function Je(e){let t=x(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:S(t,`global`)}}var Ye,Xe,G,Ze=e((()=>{W(),b(),Ye=256,Xe=192,G=new Set}));function Qe(){X=0,Z=0,Q.clear()}function $e(){return J}function et(){if(!q){q=!0;try{_e()}catch{}a(rt),tt().catch(()=>{})}}async function tt(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:pe(process.cwd())};await Promise.allSettled([Re(e),ce(e),Ve(30,e)])}function nt(e){try{let t=x();return e.startsWith(t)}catch{return!1}}async function rt(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(nt(t))return;let n=pe(t),r={project:n};++J;let i=[];for(let t of ot(e.messages,n))i.push(await de(t,r));let a=(await ue(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}=f(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,u;if(l)X++,Z=o,u=await ge(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-DMvWci8-.js`),t=e.analyze(i,{project:n});u=Array.isArray(t)?t:await t}for(let e of u)await Fe(ee(e),r);await at(r)}function it(){J=0,Y=``,Qe()}async function at(e){let n=await H(e),r=process.cwd(),i=[S(r,`.claude`,`skills`),S(t(),`skills`)],a=F(n).filter(e=>e.target===`skill`&&h(e.instincts));for(let e of a){let t=await se(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;C(S(n.outputPath,`SKILL.md`))||await re(ie(n,await y(`skill`,n,i)))}let o=L(n,{cwd:r});for(let e of o)(await y(`command`,e,[S(r,`.claude`,`commands`),S(t(),`commands`)])).length>0||await O(e);let s=R(n,{cwd:r});for(let e of s)(await y(`agent`,e,[S(r,`.claude`,`agents`),S(t(),`agents`)])).length>0||await M(e);await Ke()}function ot(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>ut){let e=Q.size-$,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=lt(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=st(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=ct(e.message?.content),n=st(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 st(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 ct(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:le(t.input)}]:[]}):[]}function lt(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:le(t.content),isError:t.is_error===!0}]:[]}):[]}var K,q,J,Y,X,Z,Q,ut,$,dt=e((()=>{o(),ne(),c(),b(),fe(),he(),d(),me(),W(),oe(),z(),v(),_(),A(),P(),Ze(),n(),K=`runtime-session`,q=!1,J=0,Y=``,X=0,Z=0,Q=new Set,ut=1e3,$=500}));export{O as A,j as C,D,M as E,k as O,z as S,P as T,I as _,Qe as a,L as b,Ke as c,Be as d,W as f,Fe as g,V as h,dt as i,A as k,Ge as l,Ve as m,$e as n,it as o,H as p,et as r,rt as s,K as t,Ze as u,F as v,N as w,Ne as x,R as y};
@@ -0,0 +1 @@
1
+ import{SD as e,yD as t}from"./loadAgentsDir-Clu7Uk6a.js";e();export{t as SandboxManager};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,a as o,fi as s,j as c,n as l,r as u,t as d,x as f}from"./src-CDCSSo0U2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{O as m,en as h}from"./state-ix0xIunV.js";import{CD as g,_D as _,_x as v,bD as y,vD as b,vx as x}from"./loadAgentsDir-DrDu5yYy.js";import{f as S,g as C,s as w}from"./settings-DfWP5y6X.js";import{i as T,o as E}from"./platform-BrYefG_2.js";import{u as D}from"./referral-DrebVwqx.js";import{relative as O}from"path";function k(){let e=_.isSandboxingEnabled(),t=_.checkDependencies(),n=t.warnings.length>0?(0,A.jsx)(r,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,A.jsx)(a,{dimColor:!0,children:e},t))}):null;if(!e)return(0,A.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,A.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let i=_.getFsReadConfig(),o=_.getFsWriteConfig(),s=_.getNetworkRestrictionConfig(),c=_.getAllowUnixSockets(),l=_.getExcludedCommands(),u=_.getLinuxGlobPatternWarnings();return(0,A.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,A.jsxs)(r,{flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,A.jsx)(a,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,A.jsxs)(a,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),o.allowOnly.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed: `,o.allowOnly.join(`, `)]}),o.denyWithinAllow.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Denied within allowed: `,o.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsxs)(a,{bold:!0,color:`permission`,children:[`Network Restrictions`,g()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,A.jsx)(a,{dimColor:!0,children:c.join(`, `)})]}),u.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,A.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 A,j=e((()=>{s(),d(),y(),A=p()}));function M({depCheck:e}){let t=T()===`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,N.jsxs)(r,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,N.jsx)(r,{flexDirection:`column`,children:(0,N.jsxs)(a,{children:[`seatbelt: `,(0,N.jsx)(a,{color:`success`,children:`built-in (macOS)`})]})}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`ripgrep (rg): `,n?(0,N.jsx)(a,{color:`error`,children:`not found`}):(0,N.jsx)(a,{color:`success`,children:`found`})]}),n&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`bubblewrap (bwrap):`,` `,i?(0,N.jsx)(a,{color:`error`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`})]}),i&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`socat: `,o?(0,N.jsx)(a,{color:`error`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`})]}),o&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`seccomp filter:`,` `,s?(0,N.jsx)(a,{color:`warning`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`}),s&&(0,N.jsx)(a,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),s&&(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,N.jsxs)(a,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),c.map(e=>(0,N.jsx)(a,{color:`error`,children:e},e))]})}var N,P=e((()=>{s(),d(),E(),N=p()}));function F({onComplete:e}){let t=_.isSandboxingEnabled(),n=_.areSandboxSettingsLockedByPolicy(),i=_.areUnsandboxedCommandsAllowed();return t?n?(0,L.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(a,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,L.jsx)(r,{marginTop:1,children:(0,L.jsxs)(a,{dimColor:!0,children:[`Current setting: `,i?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,L.jsx)(I,{onComplete:e,currentMode:i?`open`:`closed`}):(0,L.jsx)(r,{flexDirection:`column`,paddingY:1,children:(0,L.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function I({onComplete:e,currentMode:t}){let[s]=n(),{headerFocused:l,focusHeader:u}=o(),d=c(`success`,s)(`(current)`),f=[{label:t===`open`?`Allow unsandboxed fallback ${d}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${d}`:`Strict sandbox mode`,value:`closed`}];async function p(t){let n=t;await _.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,L.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(r,{marginBottom:1,children:(0,L.jsx)(a,{bold:!0,children:`Configure Overrides:`})}),(0,L.jsx)(v,{options:f,onChange:p,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:u,isDisabled:l}),(0,L.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,L.jsxs)(a,{dimColor:!0,children:[(0,L.jsx)(a,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Claude can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,L.jsxs)(a,{dimColor:!0,children:[(0,L.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,L.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,L.jsx)(i,{url:`https://code.claude.com/docs/en/sandboxing#configure-sandboxing`,children:`code.claude.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var L,R=e((()=>{s(),d(),y(),x(),L=p()}));function z({onComplete:e,depCheck:r}){let[i]=n(),a=_.isSandboxingEnabled(),o=_.isAutoAllowBashIfSandboxedEnabled(),s=r.warnings.length>0,d=S().sandbox?.network?.allowAllUnixSockets,p=s&&!d,m=a?o?`auto-allow`:`regular`:`disabled`,h=c(`success`,i)(`(current)`),g=[{label:m===`auto-allow`?`Sandbox BashTool, with auto-allow ${h}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:m===`regular`?`Sandbox BashTool, with regular permissions ${h}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:m===`disabled`?`No Sandbox ${h}`:`No Sandbox`,value:`disabled`}];async function v(t){switch(t){case`auto-allow`:await _.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await _.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await _.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}t({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,V.jsx)(l,{title:`Mode`,children:(0,V.jsx)(B,{showSocketWarning:p,options:g,onSelect:v,onComplete:e})},`mode`),b=(0,V.jsx)(l,{title:`Overrides`,children:(0,V.jsx)(F,{onComplete:e})},`overrides`),x=(0,V.jsx)(l,{title:`Config`,children:(0,V.jsx)(k,{})},`config`);return(0,V.jsx)(f,{color:`permission`,children:(0,V.jsx)(u,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:r.errors.length>0?[(0,V.jsx)(l,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:r})},`dependencies`)]:[y,...s?[(0,V.jsx)(l,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:r})},`dependencies`)]:[],b,x]})})}function B({showSocketWarning:e,options:t,onSelect:n,onComplete:s}){let{headerFocused:c,focusHeader:l}=o();return(0,V.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[e&&(0,V.jsx)(r,{marginBottom:1,children:(0,V.jsx)(a,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,V.jsx)(r,{marginBottom:1,children:(0,V.jsx)(a,{bold:!0,children:`Configure Mode:`})}),(0,V.jsx)(v,{options:t,onChange:n,onCancel:()=>s(void 0,{display:`skip`}),onUpFromFirstItem:l,isDisabled:c}),(0,V.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,V.jsxs)(a,{dimColor:!0,children:[(0,V.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,V.jsxs)(a,{dimColor:!0,children:[`Learn more: `,(0,V.jsx)(i,{url:`https://code.claude.com/docs/en/sandboxing`,children:`code.claude.com/docs/en/sandboxing`})]})]})]})}var V,H=e((()=>{s(),d(),D(),y(),C(),x(),j(),P(),R(),V=p()}));async function U(e,t,n){let r=S().theme||`light`,i=T();if(!_.isSupportedPlatform()){let t=i===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(c(`error`,r)(t)),null}let a=_.checkDependencies();if(!_.isPlatformInEnabledList())return e(c(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(_.areSandboxSettingsLockedByPolicy())return e(c(`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,W.jsx)(z,{onComplete:e,depCheck:a});if(o){let t=o.split(` `)[0];if(t===`exclude`){let t=o.slice(8).trim();if(!t)return e(c(`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=w(`localSettings`),a=i?O(m(),i):`.claude/settings.local.json`;return e(c(`success`,r)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(c(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var W;e((()=>{s(),h(),H(),d(),E(),y(),C(),W=p()}))();export{U as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,a as o,fi as s,j as c,n as l,r as u,t as d,x as f}from"./src-CDCSSo0U2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{O as m,en as h}from"./state-ix0xIunV.js";import{SD as g,TD as _,bD as v,mx as y,px as b,yD as x}from"./loadAgentsDir-Clu7Uk6a.js";import{f as S,g as C,s as w}from"./settings-Dlp5JTa_.js";import{i as T,o as E}from"./platform-BrYefG_2.js";import{u as D}from"./referral-BlrMpBAV.js";import{relative as O}from"path";function k(){let e=x.isSandboxingEnabled(),t=x.checkDependencies(),n=t.warnings.length>0?(0,A.jsx)(r,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,A.jsx)(a,{dimColor:!0,children:e},t))}):null;if(!e)return(0,A.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,A.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let i=x.getFsReadConfig(),o=x.getFsWriteConfig(),s=x.getNetworkRestrictionConfig(),c=x.getAllowUnixSockets(),l=x.getExcludedCommands(),u=x.getLinuxGlobPatternWarnings();return(0,A.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,A.jsxs)(r,{flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,A.jsx)(a,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,A.jsxs)(a,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),o.allowOnly.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed: `,o.allowOnly.join(`, `)]}),o.denyWithinAllow.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Denied within allowed: `,o.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsxs)(a,{bold:!0,color:`permission`,children:[`Network Restrictions`,_()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,A.jsxs)(a,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,A.jsx)(a,{dimColor:!0,children:c.join(`, `)})]}),u.length>0&&(0,A.jsxs)(r,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(a,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,A.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 A,j=e((()=>{s(),d(),g(),A=p()}));function M({depCheck:e}){let t=T()===`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,N.jsxs)(r,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,N.jsx)(r,{flexDirection:`column`,children:(0,N.jsxs)(a,{children:[`seatbelt: `,(0,N.jsx)(a,{color:`success`,children:`built-in (macOS)`})]})}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`ripgrep (rg): `,n?(0,N.jsx)(a,{color:`error`,children:`not found`}):(0,N.jsx)(a,{color:`success`,children:`found`})]}),n&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`bubblewrap (bwrap):`,` `,i?(0,N.jsx)(a,{color:`error`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`})]}),i&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`socat: `,o?(0,N.jsx)(a,{color:`error`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`})]}),o&&(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{children:[`seccomp filter:`,` `,s?(0,N.jsx)(a,{color:`warning`,children:`not installed`}):(0,N.jsx)(a,{color:`success`,children:`installed`}),s&&(0,N.jsx)(a,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),s&&(0,N.jsxs)(r,{flexDirection:`column`,children:[(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,N.jsxs)(a,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,N.jsxs)(a,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),c.map(e=>(0,N.jsx)(a,{color:`error`,children:e},e))]})}var N,P=e((()=>{s(),d(),E(),N=p()}));function F({onComplete:e}){let t=x.isSandboxingEnabled(),n=x.areSandboxSettingsLockedByPolicy(),i=x.areUnsandboxedCommandsAllowed();return t?n?(0,L.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(a,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,L.jsx)(r,{marginTop:1,children:(0,L.jsxs)(a,{dimColor:!0,children:[`Current setting: `,i?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,L.jsx)(I,{onComplete:e,currentMode:i?`open`:`closed`}):(0,L.jsx)(r,{flexDirection:`column`,paddingY:1,children:(0,L.jsx)(a,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function I({onComplete:e,currentMode:t}){let[s]=n(),{headerFocused:l,focusHeader:u}=o(),d=c(`success`,s)(`(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 x.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,L.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(r,{marginBottom:1,children:(0,L.jsx)(a,{bold:!0,children:`Configure Overrides:`})}),(0,L.jsx)(b,{options:f,onChange:p,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:u,isDisabled:l}),(0,L.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,L.jsxs)(a,{dimColor:!0,children:[(0,L.jsx)(a,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Claude can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,L.jsxs)(a,{dimColor:!0,children:[(0,L.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,L.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,L.jsx)(i,{url:`https://code.claude.com/docs/en/sandboxing#configure-sandboxing`,children:`code.claude.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var L,R=e((()=>{s(),d(),g(),y(),L=p()}));function z({onComplete:e,depCheck:r}){let[i]=n(),a=x.isSandboxingEnabled(),o=x.isAutoAllowBashIfSandboxedEnabled(),s=r.warnings.length>0,d=S().sandbox?.network?.allowAllUnixSockets,p=s&&!d,m=a?o?`auto-allow`:`regular`:`disabled`,h=c(`success`,i)(`(current)`),g=[{label:m===`auto-allow`?`Sandbox BashTool, with auto-allow ${h}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:m===`regular`?`Sandbox BashTool, with regular permissions ${h}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:m===`disabled`?`No Sandbox ${h}`:`No Sandbox`,value:`disabled`}];async function _(t){switch(t){case`auto-allow`:await x.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await x.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await x.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}t({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let v=(0,V.jsx)(l,{title:`Mode`,children:(0,V.jsx)(B,{showSocketWarning:p,options:g,onSelect:_,onComplete:e})},`mode`),y=(0,V.jsx)(l,{title:`Overrides`,children:(0,V.jsx)(F,{onComplete:e})},`overrides`),b=(0,V.jsx)(l,{title:`Config`,children:(0,V.jsx)(k,{})},`config`);return(0,V.jsx)(f,{color:`permission`,children:(0,V.jsx)(u,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:r.errors.length>0?[(0,V.jsx)(l,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:r})},`dependencies`)]:[v,...s?[(0,V.jsx)(l,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:r})},`dependencies`)]:[],y,b]})})}function B({showSocketWarning:e,options:t,onSelect:n,onComplete:s}){let{headerFocused:c,focusHeader:l}=o();return(0,V.jsxs)(r,{flexDirection:`column`,paddingY:1,children:[e&&(0,V.jsx)(r,{marginBottom:1,children:(0,V.jsx)(a,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,V.jsx)(r,{marginBottom:1,children:(0,V.jsx)(a,{bold:!0,children:`Configure Mode:`})}),(0,V.jsx)(b,{options:t,onChange:n,onCancel:()=>s(void 0,{display:`skip`}),onUpFromFirstItem:l,isDisabled:c}),(0,V.jsxs)(r,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,V.jsxs)(a,{dimColor:!0,children:[(0,V.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,V.jsxs)(a,{dimColor:!0,children:[`Learn more: `,(0,V.jsx)(i,{url:`https://code.claude.com/docs/en/sandboxing`,children:`code.claude.com/docs/en/sandboxing`})]})]})]})}var V,H=e((()=>{s(),d(),D(),g(),C(),y(),j(),P(),R(),V=p()}));async function U(e,t,n){let r=S().theme||`light`,i=T();if(!x.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(c(`error`,r)(t)),null}let a=x.checkDependencies();if(!x.isPlatformInEnabledList())return e(c(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(x.areSandboxSettingsLockedByPolicy())return e(c(`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,W.jsx)(z,{onComplete:e,depCheck:a});if(o){let t=o.split(` `)[0];if(t===`exclude`){let t=o.slice(8).trim();if(!t)return e(c(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);v(n);let i=w(`localSettings`),a=i?O(m(),i):`.claude/settings.local.json`;return e(c(`success`,r)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(c(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var W;e((()=>{s(),h(),H(),d(),E(),g(),C(),W=p()}))();export{U as call};
@@ -0,0 +1 @@
1
+ import{Yc as e,Zc as t}from"./loadAgentsDir-Clu7Uk6a.js";e();export{t as isSearchExtraToolsEnabled};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,Wt as i,fi as a,t as o,x as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{JS as l,qS as u}from"./loadAgentsDir-DrDu5yYy.js";import{a as d,l as f}from"./debug-BrXObCdR.js";import{u as p}from"./referral-DrebVwqx.js";import{t as m}from"./lib-BlVGipXx.js";function h({onDone:e}){let t=l(e=>e.remoteSessionUrl),[a,o]=(0,_.useState)(``);if((0,_.useEffect)(()=>{if(!t)return;let e=t;async function n(){let t=await(0,g.toString)(e,{type:`utf8`,errorCorrectionLevel:`L`});o(t)}n().catch(e=>{f(`QR code generation failed`,e)})},[t]),i(`confirm:no`,e,{context:`Confirmation`}),!t)return(0,v.jsxs)(s,{children:[(0,v.jsx)(r,{color:`warning`,children:"Not in remote mode. Start with `claude --remote` to use this command."}),(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})]});let c=a.split(`
2
- `).filter(e=>e.length>0),u=c.length===0;return(0,v.jsxs)(s,{children:[(0,v.jsx)(n,{marginBottom:1,children:(0,v.jsx)(r,{bold:!0,children:`Remote session`})}),u?(0,v.jsx)(r,{dimColor:!0,children:`Generating QR code…`}):c.map((e,t)=>(0,v.jsx)(r,{children:e},t)),(0,v.jsxs)(n,{marginTop:1,children:[(0,v.jsx)(r,{dimColor:!0,children:`Open in browser: `}),(0,v.jsx)(r,{color:`ide`,children:t})]}),(0,v.jsx)(n,{marginTop:1,children:(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})})]})}var g,_,v,y;e((()=>{g=m(),a(),_=t(a(),1),o(),p(),u(),d(),v=c(),y=async e=>(0,v.jsx)(h,{onDone:e})}))();export{y as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,Wt as i,fi as a,t as o,x as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{US as l,WS as u}from"./loadAgentsDir-Clu7Uk6a.js";import{a as d,l as f}from"./debug-BrXObCdR.js";import{u as p}from"./referral-BlrMpBAV.js";import{t as m}from"./lib-BlVGipXx.js";function h({onDone:e}){let t=u(e=>e.remoteSessionUrl),[a,o]=(0,_.useState)(``);if((0,_.useEffect)(()=>{if(!t)return;let e=t;async function n(){let t=await(0,g.toString)(e,{type:`utf8`,errorCorrectionLevel:`L`});o(t)}n().catch(e=>{f(`QR code generation failed`,e)})},[t]),i(`confirm:no`,e,{context:`Confirmation`}),!t)return(0,v.jsxs)(s,{children:[(0,v.jsx)(r,{color:`warning`,children:"Not in remote mode. Start with `claude --remote` to use this command."}),(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})]});let c=a.split(`
2
+ `).filter(e=>e.length>0),l=c.length===0;return(0,v.jsxs)(s,{children:[(0,v.jsx)(n,{marginBottom:1,children:(0,v.jsx)(r,{bold:!0,children:`Remote session`})}),l?(0,v.jsx)(r,{dimColor:!0,children:`Generating QR code…`}):c.map((e,t)=>(0,v.jsx)(r,{children:e},t)),(0,v.jsxs)(n,{marginTop:1,children:[(0,v.jsx)(r,{dimColor:!0,children:`Open in browser: `}),(0,v.jsx)(r,{color:`ide`,children:t})]}),(0,v.jsx)(n,{marginTop:1,children:(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})})]})}var g,_,v,y;e((()=>{g=m(),a(),_=t(a(),1),o(),p(),l(),d(),v=c(),y=async e=>(0,v.jsx)(h,{onDone:e})}))();export{y as call};
@@ -1 +1 @@
1
- import{a as e,l as t}from"./debug-BrXObCdR.js";e();async function n(){let{fetchCodeSessionsFromSessionsAPI:e}=await import(`./api-CI8HXREw.js`),n;try{n=await e()}catch(e){throw t(`[assistant:discovery] fetchCodeSessionsFromSessionsAPI failed: ${e}`),e}return n.filter(e=>e.status===`idle`||e.status===`working`||e.status===`waiting`).map(e=>({id:e.id,title:e.title||`Untitled`,status:e.status,created_at:e.created_at??``}))}export{n as discoverAssistantSessions};
1
+ import{a as e,l as t}from"./debug-BrXObCdR.js";e();async function n(){let{fetchCodeSessionsFromSessionsAPI:e}=await import(`./api-BiwZmmsh.js`),n;try{n=await e()}catch(e){throw t(`[assistant:discovery] fetchCodeSessionsFromSessionsAPI failed: ${e}`),e}return n.filter(e=>e.status===`idle`||e.status===`working`||e.status===`waiting`).map(e=>({id:e.id,title:e.title||`Untitled`,status:e.status,created_at:e.created_at??``}))}export{n as discoverAssistantSessions};
@@ -0,0 +1 @@
1
+ import{xu as e,yu as t}from"./loadAgentsDir-Clu7Uk6a.js";t();export{e as registerSessionFileAccessHooks};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./sessionMemory-btARBn8H.js";t();export{e as manuallyExtractSessionMemory};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{B as r,en as i}from"./state-ix0xIunV.js";import{Al as a,Bc as o,DE as s,Dl as c,EE as l,El as u,Fn as d,In as f,Ln as ee,Lo as p,ME as te,Ml as m,NE as ne,So as h,Vc as re,Xw as g,Yw as _,ZT as ie,_E as v,bE as ae,cl as oe,dE as se,fE as ce,fl as y,gE as b,hE as le,jE as ue,kE as x,lE as de,lt as S,mE as C,ml as w,pE as T,pl as E,sE as D,sl as O,ut as k,vE as A,xE as j,yE as M,zo as N}from"./loadAgentsDir-Clu7Uk6a.js";import{F as P,I as F,d as I,p as L,z as R}from"./debug-BrXObCdR.js";import{_n as z,gn as B}from"./settings-Dlp5JTa_.js";import{n as V,r as H}from"./analytics-BotDBGh0.js";import{mi as fe,pi as pe}from"./model-BQF64tZx.js";import{fn as U,hn as me}from"./prompt-Bg_1U0gO.js";import{st as he}from"./rcDebugLog-VKwMl0yg.js";import{writeFile as W}from"fs/promises";function ge(){return!1}function _e(){return{}}function ve(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=B(e,e=>e.type===`tool_use`))}}return n}function G(e){let t=x(e);if(!le()){if(!ce(t))return!1;A()}let n=T(t),r=ve(e,X)>=se(),i=p(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&(X=t.uuid),!0}return!1}async function K(e){let t=I(),n=d();await t.mkdir(n,{mode:448});let r=f();try{await W(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await W(r,await w(),{encoding:`utf-8`,mode:384})}catch(e){if(F(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await o.call({file_path:r},e),a=``,s=i.data;return s.type===`text`&&(a=s.file.content),H(`tengu_session_memory_file_read`,{content_length:a.length}),{memoryPath:r,currentMemory:a}}function ye(){if(r())return;let e=oe();process.env.USER_TYPE===`ant`&&H(`tengu_session_memory_init`,{auto_compact_enabled:e}),e&&g($)}async function q(e,t){if(e.length===0)return{success:!1,error:`No messages to summarize`};v();try{let n=c(t),{memoryPath:r,currentMemory:i}=await K(n),a=await y(i,r),{tools:o,mainLoopModel:s}=t.options,[l,u,d]=await Promise.all([S(o,s),te(),ue()]),f=he(l);return await m({promptMessages:[h({content:a})],cacheSafeParams:{systemPrompt:f,userContext:u,systemContext:d,toolUseContext:n,forkContextMessages:e},canUseTool:J(r),querySource:`session_memory`,forkLabel:`session_memory_manual`,overrides:{readFileState:n.readFileState}}),H(`tengu_session_memory_manual_extraction`,{}),M(x(e)),Y(e),{success:!0,memoryPath:r}}catch(e){return{success:!1,error:P(e)}}finally{b()}}function J(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${U} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${U} on ${e} is allowed`}}}}function Y(e){if(!p(e)){let t=e[e.length-1];t?.uuid&&ae(t.uuid)}}var X,Z,Q,$,be=e((()=>{n(),i(),k(),ne(),me(),re(),z(),a(),L(),_(),N(),ee(),pe(),ie(),s(),V(),O(),E(),C(),R(),Z=t(()=>{let e=_e();j({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:D.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:D.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:D.toolCallsBetweenUpdates})}),Q=!1,$=fe(async function(e){let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`)return;{let{isPoorModeActive:e}=await import(`./poorMode-qlxqU8Hm.js`);if(e())return}if(!ge()){process.env.USER_TYPE===`ant`&&!Q&&(Q=!0,H(`tengu_session_memory_gate_disabled`,{}));return}if(Z(),!G(t))return;v();let i=c(n),{memoryPath:a,currentMemory:o}=await K(i);await m({promptMessages:[h({content:await y(o,a)})],cacheSafeParams:u(e),canUseTool:J(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let s=t[t.length-1],d=s?l(s):void 0,f=de();H(`tengu_session_memory_extraction`,{input_tokens:d?.input_tokens,output_tokens:d?.output_tokens,cache_read_input_tokens:d?.cache_read_input_tokens??void 0,cache_creation_input_tokens:d?.cache_creation_input_tokens??void 0,config_min_message_tokens_to_init:f.minimumMessageTokensToInit,config_min_tokens_between_update:f.minimumTokensBetweenUpdate,config_tool_calls_between_updates:f.toolCallsBetweenUpdates}),M(x(t)),Y(t),b()})}));export{G as a,q as i,ye as n,be as r,J as t};
@@ -0,0 +1 @@
1
+ import{mE as e,uE as t}from"./loadAgentsDir-Clu7Uk6a.js";e();export{t as getSessionMemoryContent};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{YT as t,et as n,tt as r}from"./loadAgentsDir-DrDu5yYy.js";import{st as i}from"./rcDebugLog-2-1XSyFV.js";import{i as a,l as o,r as s,t as c,u as l}from"./instinctParser-Dt-lqnDe.js";function u(e){g.set(e.name,e),_||(_=e.name)}function d(e){if(!g.has(e))throw Error(`Observer backend "${e}" is not registered`);_=e}function f(){let e=_?g.get(_):void 0;if(!e)throw Error(`No observer backend is active — register one before analyzing observations`);return e}async function p(e,t){return Promise.resolve(f().analyze(e,t))}function m(){let e=process.env.SKILL_LEARNING_OBSERVER_BACKEND?.trim();return e&&g.has(e)?e:void 0}function h(){let e=m();return e&&d(e),f()}var g,_,v=e((()=>{g=new Map})),y,b=e((()=>{y=[`workflow`,`testing`,`debugging`,`code-style`,`security`,`git`,`project`]}));async function x(e,t){if(e.length===0)return[];if(Date.now()<L)return S(e,t);let n=e.slice(-30),a=C(n),s=P(o().llm.timeoutMs),c;try{let e=await r({systemPrompt:i([R]),userPrompt:a,signal:s,options:{querySource:`skill_learning_observer`,enablePromptCaching:!0,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[]}});I=0,c=T(e.message?.content)}catch{return I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),S(e,t)}let l=E(c,t,n);return l.length===0?(I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),S(e,t)):l}async function S(e,t){try{let{heuristicObserverBackend:n}=await import(`./sessionObserver-B400YG3s.js`),r=n.analyze(e,t);return Array.isArray(r)?r:await r}catch{return[]}}function C(e){return`Observations (chronological, newest last):\n${e.map((e,t)=>ee(e,t)).join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ZT as t,et as n,tt as r}from"./loadAgentsDir-Clu7Uk6a.js";import{st as i}from"./rcDebugLog-VKwMl0yg.js";import{i as a,l as o,r as s,t as c,u as l}from"./instinctParser-Dt-lqnDe.js";function u(e){g.set(e.name,e),_||(_=e.name)}function d(e){if(!g.has(e))throw Error(`Observer backend "${e}" is not registered`);_=e}function f(){let e=_?g.get(_):void 0;if(!e)throw Error(`No observer backend is active — register one before analyzing observations`);return e}async function p(e,t){return Promise.resolve(f().analyze(e,t))}function m(){let e=process.env.SKILL_LEARNING_OBSERVER_BACKEND?.trim();return e&&g.has(e)?e:void 0}function h(){let e=m();return e&&d(e),f()}var g,_,v=e((()=>{g=new Map})),y,b=e((()=>{y=[`workflow`,`testing`,`debugging`,`code-style`,`security`,`git`,`project`]}));async function x(e,t){if(e.length===0)return[];if(Date.now()<L)return S(e,t);let n=e.slice(-30),a=C(n),s=P(o().llm.timeoutMs),c;try{let e=await r({systemPrompt:i([R]),userPrompt:a,signal:s,options:{querySource:`skill_learning_observer`,enablePromptCaching:!0,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[]}});I=0,c=T(e.message?.content)}catch{return I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),S(e,t)}let l=E(c,t,n);return l.length===0?(I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),S(e,t)):l}async function S(e,t){try{let{heuristicObserverBackend:n}=await import(`./sessionObserver-DMvWci8-.js`),r=n.analyze(e,t);return Array.isArray(r)?r:await r}catch{return[]}}function C(e){return`Observations (chronological, newest last):\n${e.map((e,t)=>ee(e,t)).join(`
2
2
  `)}\n\nExtract up to ${F} atomic instincts. JSON array only.`}function ee(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`&&y.includes(e)?e:`project`}function M(e){return e===`global`?`global`:`project`}function N(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e&&(t.push(e.length>200?`${e.slice(0,200)}…`:e),t.length===3))break}return t}function P(e){return AbortSignal.timeout(e)}var F,I,L,R,z,B=e((()=>{n(),t(),l(),b(),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{i as e,r as t}from"./sessionObserver-CSOYgsvH.js";e();export{t as heuristicObserverBackend};
@@ -0,0 +1 @@
1
+ import{Rr as e,jr as t,si as n}from"./loadAgentsDir-Clu7Uk6a.js";t();export{e as linkSessionToPR,n as recordTranscript};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{E as t,M as n,n as r,r as i,t as a}from"./lazySchema-DcIJE_0i.js";import{en as o,z as s}from"./state-ix0xIunV.js";import{To as c,YT as l,et as u,tt as d,zo as f}from"./loadAgentsDir-DrDu5yYy.js";import{a as p,l as m}from"./debug-BrXObCdR.js";import{s as h,u as g}from"./types-C-MRCL8J.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{st as y}from"./rcDebugLog-2-1XSyFV.js";function b(e){let t=[];for(let n of e){if(n.type!==`user`&&n.type!==`assistant`||`isMeta`in n&&n.isMeta||`origin`in n&&n.origin&&n.origin.kind!==`human`)continue;let e=n.message.content;if(typeof e==`string`)t.push(e);else if(Array.isArray(e))for(let n of e)`type`in n&&n.type===`text`&&`text`in n&&t.push(n.text)}let n=t.join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{E as t,M as n,n as r,r as i,t as a}from"./lazySchema-DcIJE_0i.js";import{en as o,z as s}from"./state-ix0xIunV.js";import{To as c,ZT as l,et as u,tt as d,zo as f}from"./loadAgentsDir-Clu7Uk6a.js";import{a as p,l as m}from"./debug-BrXObCdR.js";import{s as h,u as g}from"./types-C-MRCL8J.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{st as y}from"./rcDebugLog-VKwMl0yg.js";function b(e){let t=[];for(let n of e){if(n.type!==`user`&&n.type!==`assistant`||`isMeta`in n&&n.isMeta||`origin`in n&&n.origin&&n.origin.kind!==`human`)continue;let e=n.message.content;if(typeof e==`string`)t.push(e);else if(Array.isArray(e))for(let n of e)`type`in n&&n.type===`text`&&`text`in n&&t.push(n.text)}let n=t.join(`
2
2
  `);return n.length>S?n.slice(-1e3):n}async function x(e,t){let n=e.trim();if(!n)return null;try{let e=c((await d({systemPrompt:y([C]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{title:{type:`string`}},required:[`title`],additionalProperties:!1}},signal:t,options:{querySource:`generate_session_title`,agents:[],isNonInteractiveSession:s(),hasAppendSystemPrompt:!1,mcpTools:[]}})).message.content),r=w().safeParse(g(e)),i=r.success&&r.data.title.trim()||null;return v(`tengu_session_title_generated`,{success:i!==null}),i}catch(e){return m(`generateSessionTitle failed: ${e}`,{level:`error`}),v(`tengu_session_title_generated`,{success:!1}),null}}var S,C,w,T=e((()=>{i(),o(),_(),u(),p(),h(),a(),f(),l(),S=1e3,C=`Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.
3
3
 
4
4
  Return JSON with a single "title" field.
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{i as r,l as i,n as a}from"./esm-lWlUmoUA.js";import{A as o,en as s,ht as c,lt as l,z as u}from"./state-ix0xIunV.js";import{C as d,S as f,a as p,l as m,w as h,z as ee}from"./debug-BrXObCdR.js";import{f as g,g as te}from"./config-DiT2Z8dY.js";import{i as ne,t as re}from"./hash-Tu-My5Vp.js";import{Mt as ie,Vt as ae}from"./model-fi472PRc.js";import{et as oe,ft as se,rt as ce,ut as le}from"./esm-DjGYYlQe.js";import"path";import"fs";import{createHash as ue}from"crypto";import"fs/promises";import{AsyncLocalStorage as de}from"async_hooks";function fe(e){let t=BigInt(58),n=Array(v).fill(_[0]),r=v-1,i=e;for(;i>0n;){let e=Number(i%t);n[r]=_[e],i/=t,r--}return n.join(``)}function pe(e){let t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Invalid UUID hex length: ${t.length}`);return BigInt(`0x`+t)}function me(e,t){let n=pe(t);return`${e}_${he}${fe(n)}`}var _,he,v,ge=e((()=>{_=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,he=`01`,v=22}));function y(e){let n=_e[e],r=process.env[e];return r===void 0?n:t(r)}function b(){let e=g(),t=c(),n={"user.id":e};y(`OTEL_METRICS_INCLUDE_SESSION_ID`)&&(n[`session.id`]=t),y(`OTEL_METRICS_INCLUDE_VERSION`)&&(n[`app.version`]=`0.0.3`);let r=ie();if(r){let e=r.organizationUuid,t=r.emailAddress,i=r.accountUuid;e&&(n[`organization.id`]=e),t&&(n[`user.email`]=t),i&&y(`OTEL_METRICS_INCLUDE_ACCOUNT_UUID`)&&(n[`user.account_uuid`]=i,n[`user.account_id`]=process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID||me(`user`,i))}return le.terminal&&(n[`terminal.type`]=le.terminal),n}var _e,x=e((()=>{s(),ae(),te(),se(),n(),ge(),_e={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}}));function ve(){return t(process.env.OTEL_LOG_USER_PROMPTS)}function ye(e){return ve()?e:`<REDACTED>`}async function S(e,t={}){let n=o();if(!n){C||(C=!0,m(`[3P telemetry] Event dropped (no event logger initialized): ${e}`,{level:`warn`}));return}let r={...b(),"event.name":e,"event.timestamp":new Date().toISOString(),"event.sequence":be++},i=l();i&&(r[`prompt.id`]=i);let a=process.env.CLAUDE_CODE_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:`claude_code.${e}`,attributes:r})}var be,C,xe=e((()=>{s(),p(),n(),x(),be=0,C=!1}));function Se(e){return Math.abs(re(e))||1}function Ce(e){let t=L.get(e);return t===void 0?(I++,L.set(e,I),I):t}function w(){let e=c(),t=`main`,n=M.get(e);if(n)return n;let r={agentId:e,agentName:t,parentAgentId:void 0,processId:1,threadId:Se(t)};return M.set(e,r),N++,r}function T(){return(Date.now()-P)*1e3}function E(){return`span_${++F}`}function we(){let e=process.env.CLAUDE_CODE_PERFETTO_TRACE;m(`[Perfetto] initializePerfettoTracing called, env value: ${e}`)}function Te(e){O&&(k.push({name:`process_name`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:0,args:{name:e.agentName}}),k.push({name:`thread_name`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:e.threadId,args:{name:e.agentName}}),e.parentAgentId&&k.push({name:`parent_agent`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:0,args:{parent_agent_id:e.parentAgentId}}))}function D(){return O}function Ee(e,t,n){if(!O)return;let r={agentId:e,agentName:t,parentAgentId:n,processId:Ce(e),threadId:Se(t)};M.set(e,r),N++,Te(r)}function De(e){O&&(M.delete(e),L.delete(e))}function Oe(e){if(!O)return``;let t=E(),n=w();return j.set(t,{name:`API Call`,category:`api`,startTime:T(),agentInfo:n,args:{model:e.model,prompt_tokens:e.promptTokens,message_id:e.messageId,is_speculative:e.isSpeculative??!1,query_source:e.querySource}}),A.push({name:`API Call`,cat:`api`,ph:`B`,ts:j.get(t).startTime,pid:n.processId,tid:n.threadId,args:j.get(t).args}),t}function ke(e,t){if(!O||!e)return;let n=j.get(e);if(!n)return;let r=T(),i=r-n.startTime,a=t.promptTokens??n.args.prompt_tokens,o=t.ttftMs,s=t.ttltMs,c=t.outputTokens,l=t.cacheReadTokens,u=o!==void 0&&a!==void 0&&o>0?Math.round(a/(o/1e3)*100)/100:void 0,d=s!==void 0&&o!==void 0?s-o:void 0,f=d!==void 0&&c!==void 0&&d>0?Math.round(c/(d/1e3)*100)/100:void 0,p=l!==void 0&&a!==void 0&&a>0?Math.round(l/a*1e4)/100:void 0,m=t.requestSetupMs,h=t.attemptStartTimes,ee={...n.args,ttft_ms:o,ttlt_ms:s,prompt_tokens:a,output_tokens:c,cache_read_tokens:l,cache_creation_tokens:t.cacheCreationTokens,message_id:t.messageId??n.args.message_id,success:t.success??!0,error:t.error,duration_ms:i/1e3,request_setup_ms:m,itps:u,otps:f,cache_hit_rate_pct:p},g=m!==void 0&&m>0?m*1e3:0;if(g>0){let e=n.startTime+g;if(A.push({name:`Request Setup`,cat:`api,setup`,ph:`B`,ts:n.startTime,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{request_setup_ms:m,attempt_count:h?.length??1}}),h&&h.length>1){let e=h[0];for(let t=0;t<h.length-1;t++){let r=n.startTime+(h[t]-e)*1e3,i=n.startTime+(h[t+1]-e)*1e3;A.push({name:`Attempt ${t+1} (retry)`,cat:`api,retry`,ph:`B`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{attempt:t+1}}),A.push({name:`Attempt ${t+1} (retry)`,cat:`api,retry`,ph:`E`,ts:i,pid:n.agentInfo.processId,tid:n.agentInfo.threadId})}}A.push({name:`Request Setup`,cat:`api,setup`,ph:`E`,ts:e,pid:n.agentInfo.processId,tid:n.agentInfo.threadId})}if(o!==void 0){let e=n.startTime+g,t=e+o*1e3;A.push({name:`First Token`,cat:`api,ttft`,ph:`B`,ts:e,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{ttft_ms:o,prompt_tokens:a,itps:u,cache_hit_rate_pct:p}}),A.push({name:`First Token`,cat:`api,ttft`,ph:`E`,ts:t,pid:n.agentInfo.processId,tid:n.agentInfo.threadId});let r=s===void 0?void 0:s-o-g/1e3;r!==void 0&&r>0&&(A.push({name:`Sampling`,cat:`api,sampling`,ph:`B`,ts:t,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{sampling_ms:r,output_tokens:c,otps:f}}),A.push({name:`Sampling`,cat:`api,sampling`,ph:`E`,ts:t+r*1e3,pid:n.agentInfo.processId,tid:n.agentInfo.threadId}))}A.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:ee}),j.delete(e)}function Ae(e,t){if(!O)return``;let n=E(),r=w();return j.set(n,{name:`Tool: ${e}`,category:`tool`,startTime:T(),agentInfo:r,args:{tool_name:e,...t}}),A.push({name:`Tool: ${e}`,cat:`tool`,ph:`B`,ts:j.get(n).startTime,pid:r.processId,tid:r.threadId,args:j.get(n).args}),n}function je(e,t){if(!O||!e)return;let n=j.get(e);if(!n)return;let r=T(),i=r-n.startTime,a={...n.args,success:t?.success??!0,error:t?.error,result_tokens:t?.resultTokens,duration_ms:i/1e3};A.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:a}),j.delete(e)}function Me(e){if(!O)return``;let t=E(),n=w();return j.set(t,{name:`Waiting for User Input`,category:`user_input`,startTime:T(),agentInfo:n,args:{context:e}}),A.push({name:`Waiting for User Input`,cat:`user_input`,ph:`B`,ts:j.get(t).startTime,pid:n.processId,tid:n.threadId,args:j.get(t).args}),t}function Ne(e,t){if(!O||!e)return;let n=j.get(e);if(!n)return;let r=T(),i=r-n.startTime,a={...n.args,decision:t?.decision,source:t?.source,duration_ms:i/1e3};A.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:a}),j.delete(e)}function Pe(e){if(!O)return``;let t=E(),n=w();return j.set(t,{name:`Interaction`,category:`interaction`,startTime:T(),agentInfo:n,args:{user_prompt_length:e?.length}}),A.push({name:`Interaction`,cat:`interaction`,ph:`B`,ts:j.get(t).startTime,pid:n.processId,tid:n.threadId,args:j.get(t).args}),t}function Fe(e){if(!O||!e)return;let t=j.get(e);if(!t)return;let n=T(),r=n-t.startTime;A.push({name:t.name,cat:t.category,ph:`E`,ts:n,pid:t.agentInfo.processId,tid:t.agentInfo.threadId,args:{...t.args,duration_ms:r/1e3}}),j.delete(e)}var O,k,A,j,M,N,P,F,I,L,Ie=e((()=>{s(),p(),n(),ee(),ne(),f(),O=!1,k=[],A=[],j=new Map,M=new Map,N=0,P=0,F=0,I=1,L=new Map}));function Le(){H.clear(),U.clear()}function R(){return t(process.env.ENABLE_BETA_TRACING_DETAILED)&&process.env.BETA_TRACING_ENDPOINT&&(process.env.USER_TYPE===`ant`||u())||!1}function z(e,t=Ke){return e.length<=t?{content:e,truncated:!1}:{content:e.slice(0,t)+`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{i as r,l as i,n as a}from"./esm-lWlUmoUA.js";import{A as o,en as s,ht as c,lt as l,z as u}from"./state-ix0xIunV.js";import{C as d,S as f,a as p,l as m,w as h,z as ee}from"./debug-BrXObCdR.js";import{f as g,g as te}from"./config-3m_9zSrj.js";import{i as ne,t as re}from"./hash-Tu-My5Vp.js";import{Bt as ie,jt as ae}from"./model-BQF64tZx.js";import{et as oe,ft as se,rt as ce,ut as le}from"./esm-CGoYrggU.js";import"path";import"fs";import{createHash as ue}from"crypto";import"fs/promises";import{AsyncLocalStorage as de}from"async_hooks";function fe(e){let t=BigInt(58),n=Array(v).fill(_[0]),r=v-1,i=e;for(;i>0n;){let e=Number(i%t);n[r]=_[e],i/=t,r--}return n.join(``)}function pe(e){let t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Invalid UUID hex length: ${t.length}`);return BigInt(`0x`+t)}function me(e,t){let n=pe(t);return`${e}_${he}${fe(n)}`}var _,he,v,ge=e((()=>{_=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,he=`01`,v=22}));function y(e){let n=_e[e],r=process.env[e];return r===void 0?n:t(r)}function b(){let e=g(),t=c(),n={"user.id":e};y(`OTEL_METRICS_INCLUDE_SESSION_ID`)&&(n[`session.id`]=t),y(`OTEL_METRICS_INCLUDE_VERSION`)&&(n[`app.version`]=`0.0.5`);let r=ae();if(r){let e=r.organizationUuid,t=r.emailAddress,i=r.accountUuid;e&&(n[`organization.id`]=e),t&&(n[`user.email`]=t),i&&y(`OTEL_METRICS_INCLUDE_ACCOUNT_UUID`)&&(n[`user.account_uuid`]=i,n[`user.account_id`]=process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID||me(`user`,i))}return le.terminal&&(n[`terminal.type`]=le.terminal),n}var _e,x=e((()=>{s(),ie(),te(),se(),n(),ge(),_e={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}}));function ve(){return t(process.env.OTEL_LOG_USER_PROMPTS)}function ye(e){return ve()?e:`<REDACTED>`}async function S(e,t={}){let n=o();if(!n){C||(C=!0,m(`[3P telemetry] Event dropped (no event logger initialized): ${e}`,{level:`warn`}));return}let r={...b(),"event.name":e,"event.timestamp":new Date().toISOString(),"event.sequence":be++},i=l();i&&(r[`prompt.id`]=i);let a=process.env.CLAUDE_CODE_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:`claude_code.${e}`,attributes:r})}var be,C,xe=e((()=>{s(),p(),n(),x(),be=0,C=!1}));function Se(e){return Math.abs(re(e))||1}function Ce(e){let t=L.get(e);return t===void 0?(I++,L.set(e,I),I):t}function w(){let e=c(),t=`main`,n=M.get(e);if(n)return n;let r={agentId:e,agentName:t,parentAgentId:void 0,processId:1,threadId:Se(t)};return M.set(e,r),N++,r}function T(){return(Date.now()-P)*1e3}function E(){return`span_${++F}`}function we(){let e=process.env.CLAUDE_CODE_PERFETTO_TRACE;m(`[Perfetto] initializePerfettoTracing called, env value: ${e}`)}function Te(e){O&&(k.push({name:`process_name`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:0,args:{name:e.agentName}}),k.push({name:`thread_name`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:e.threadId,args:{name:e.agentName}}),e.parentAgentId&&k.push({name:`parent_agent`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:0,args:{parent_agent_id:e.parentAgentId}}))}function D(){return O}function Ee(e,t,n){if(!O)return;let r={agentId:e,agentName:t,parentAgentId:n,processId:Ce(e),threadId:Se(t)};M.set(e,r),N++,Te(r)}function De(e){O&&(M.delete(e),L.delete(e))}function Oe(e){if(!O)return``;let t=E(),n=w();return j.set(t,{name:`API Call`,category:`api`,startTime:T(),agentInfo:n,args:{model:e.model,prompt_tokens:e.promptTokens,message_id:e.messageId,is_speculative:e.isSpeculative??!1,query_source:e.querySource}}),A.push({name:`API Call`,cat:`api`,ph:`B`,ts:j.get(t).startTime,pid:n.processId,tid:n.threadId,args:j.get(t).args}),t}function ke(e,t){if(!O||!e)return;let n=j.get(e);if(!n)return;let r=T(),i=r-n.startTime,a=t.promptTokens??n.args.prompt_tokens,o=t.ttftMs,s=t.ttltMs,c=t.outputTokens,l=t.cacheReadTokens,u=o!==void 0&&a!==void 0&&o>0?Math.round(a/(o/1e3)*100)/100:void 0,d=s!==void 0&&o!==void 0?s-o:void 0,f=d!==void 0&&c!==void 0&&d>0?Math.round(c/(d/1e3)*100)/100:void 0,p=l!==void 0&&a!==void 0&&a>0?Math.round(l/a*1e4)/100:void 0,m=t.requestSetupMs,h=t.attemptStartTimes,ee={...n.args,ttft_ms:o,ttlt_ms:s,prompt_tokens:a,output_tokens:c,cache_read_tokens:l,cache_creation_tokens:t.cacheCreationTokens,message_id:t.messageId??n.args.message_id,success:t.success??!0,error:t.error,duration_ms:i/1e3,request_setup_ms:m,itps:u,otps:f,cache_hit_rate_pct:p},g=m!==void 0&&m>0?m*1e3:0;if(g>0){let e=n.startTime+g;if(A.push({name:`Request Setup`,cat:`api,setup`,ph:`B`,ts:n.startTime,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{request_setup_ms:m,attempt_count:h?.length??1}}),h&&h.length>1){let e=h[0];for(let t=0;t<h.length-1;t++){let r=n.startTime+(h[t]-e)*1e3,i=n.startTime+(h[t+1]-e)*1e3;A.push({name:`Attempt ${t+1} (retry)`,cat:`api,retry`,ph:`B`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{attempt:t+1}}),A.push({name:`Attempt ${t+1} (retry)`,cat:`api,retry`,ph:`E`,ts:i,pid:n.agentInfo.processId,tid:n.agentInfo.threadId})}}A.push({name:`Request Setup`,cat:`api,setup`,ph:`E`,ts:e,pid:n.agentInfo.processId,tid:n.agentInfo.threadId})}if(o!==void 0){let e=n.startTime+g,t=e+o*1e3;A.push({name:`First Token`,cat:`api,ttft`,ph:`B`,ts:e,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{ttft_ms:o,prompt_tokens:a,itps:u,cache_hit_rate_pct:p}}),A.push({name:`First Token`,cat:`api,ttft`,ph:`E`,ts:t,pid:n.agentInfo.processId,tid:n.agentInfo.threadId});let r=s===void 0?void 0:s-o-g/1e3;r!==void 0&&r>0&&(A.push({name:`Sampling`,cat:`api,sampling`,ph:`B`,ts:t,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{sampling_ms:r,output_tokens:c,otps:f}}),A.push({name:`Sampling`,cat:`api,sampling`,ph:`E`,ts:t+r*1e3,pid:n.agentInfo.processId,tid:n.agentInfo.threadId}))}A.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:ee}),j.delete(e)}function Ae(e,t){if(!O)return``;let n=E(),r=w();return j.set(n,{name:`Tool: ${e}`,category:`tool`,startTime:T(),agentInfo:r,args:{tool_name:e,...t}}),A.push({name:`Tool: ${e}`,cat:`tool`,ph:`B`,ts:j.get(n).startTime,pid:r.processId,tid:r.threadId,args:j.get(n).args}),n}function je(e,t){if(!O||!e)return;let n=j.get(e);if(!n)return;let r=T(),i=r-n.startTime,a={...n.args,success:t?.success??!0,error:t?.error,result_tokens:t?.resultTokens,duration_ms:i/1e3};A.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:a}),j.delete(e)}function Me(e){if(!O)return``;let t=E(),n=w();return j.set(t,{name:`Waiting for User Input`,category:`user_input`,startTime:T(),agentInfo:n,args:{context:e}}),A.push({name:`Waiting for User Input`,cat:`user_input`,ph:`B`,ts:j.get(t).startTime,pid:n.processId,tid:n.threadId,args:j.get(t).args}),t}function Ne(e,t){if(!O||!e)return;let n=j.get(e);if(!n)return;let r=T(),i=r-n.startTime,a={...n.args,decision:t?.decision,source:t?.source,duration_ms:i/1e3};A.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:a}),j.delete(e)}function Pe(e){if(!O)return``;let t=E(),n=w();return j.set(t,{name:`Interaction`,category:`interaction`,startTime:T(),agentInfo:n,args:{user_prompt_length:e?.length}}),A.push({name:`Interaction`,cat:`interaction`,ph:`B`,ts:j.get(t).startTime,pid:n.processId,tid:n.threadId,args:j.get(t).args}),t}function Fe(e){if(!O||!e)return;let t=j.get(e);if(!t)return;let n=T(),r=n-t.startTime;A.push({name:t.name,cat:t.category,ph:`E`,ts:n,pid:t.agentInfo.processId,tid:t.agentInfo.threadId,args:{...t.args,duration_ms:r/1e3}}),j.delete(e)}var O,k,A,j,M,N,P,F,I,L,Ie=e((()=>{s(),p(),n(),ee(),ne(),f(),O=!1,k=[],A=[],j=new Map,M=new Map,N=0,P=0,F=0,I=1,L=new Map}));function Le(){H.clear(),U.clear()}function R(){return t(process.env.ENABLE_BETA_TRACING_DETAILED)&&process.env.BETA_TRACING_ENDPOINT&&(process.env.USER_TYPE===`ant`||u())||!1}function z(e,t=Ke){return e.length<=t?{content:e,truncated:!1}:{content:e.slice(0,t)+`
2
2
 
3
3
  [TRUNCATED - Content exceeds 60KB limit]`,truncated:!0}}function B(e){return ue(`sha256`).update(e).digest(`hex`).slice(0,12)}function Re(e){return`sp_${B(e)}`}function ze(e){return`msg_${B(h(e.message.content))}`}function V(e){let t=e.trim().match(qe);return t&&t[1]?t[1].trim():null}function Be(e){let t=[],n=[];for(let r of e){let e=r.message.content;if(typeof e==`string`){let r=V(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=V(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=V(e);i?n.push(i):t.push(`[TOOL RESULT: ${r.tool_use_id}]\n${e}`)}}}return{contextParts:t,systemReminders:n}}function Ve(e,t){if(!R())return;let{content:n,truncated:r}=z(`[USER PROMPT]\n${t}`);e.setAttributes({new_context:n,...r&&{new_context_truncated:!0,new_context_original_length:t.length}})}function He(e,t,n){if(R()){if(t?.systemPrompt){let n=Re(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),!H.has(n)){H.add(n);let{content:e,truncated:r}=z(t.systemPrompt);S(`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=d(t.tools).map(e=>{let t=h(e),n=B(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(!H.has(`tool_${t}`)){H.add(`tool_${t}`);let{content:n,truncated:i}=z(r);S(`tool`,{tool_name:ce(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=U.get(r),a=0;if(i)for(let e=0;e<n.length;e++){let t=n[e];if(t&&ze(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}=Be(o);if(t.length>0){let n=t.join(`
4
4
 
@@ -13,7 +13,7 @@ If you can answer right away, send the answer. If you need to go look — run a
13
13
 
14
14
  For longer work: ack → work → result. Between those, send a checkpoint when something useful happened — a decision you made, a surprise you hit, a phase boundary. Skip the filler ("running tests...") — a checkpoint earns its place by carrying information.
15
15
 
16
- Keep messages tight — the decision, the file:line, the PR number. Second person always ("your config"), never third.`}));function q(e){return Ao[e]??e}function So(e){let t=[];for(let[n,r]of Object.entries(Ao))r===e&&t.push(n);return t}function Co(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)}function wo(e){return e.replace(/\\\(/g,`(`).replace(/\\\)/g,`)`).replace(/\\\\/g,`\\`)}function To(e){let t=Do(e,`(`);if(t===-1)return{toolName:q(e)};let n=Oo(e,`)`);if(n===-1||n<=t||n!==e.length-1)return{toolName:q(e)};let r=e.substring(0,t),i=e.substring(t+1,n);if(!r)return{toolName:q(e)};if(i===``||i===`*`)return{toolName:q(r)};let a=wo(i);return{toolName:q(r),ruleContent:a}}function Eo(e){if(!e.ruleContent)return e.toolName;let t=Co(e.ruleContent);return`${e.toolName}(${t})`}function Do(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}function Oo(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}var ko,Ao,jo=t((()=>{lo(),fo(),ho(),ko=(xo(),e(go)).BRIEF_TOOL_NAME,Ao={Task:ao,KillShell:po,AgentOutputTool:uo,BashOutputTool:uo,...ko?{Brief:ko}:{}}}));function Mo(e){return Fo.filePatternTools.includes(e)}function No(e){return Fo.bashPrefixTools.includes(e)}function Po(e){return Fo.customValidation[e]}var Fo,Io=t((()=>{Fo={filePatternTools:[`Read`,`Write`,`Edit`,`Glob`,`NotebookRead`,`NotebookEdit`],bashPrefixTools:[`Bash`],customValidation:{WebSearch:e=>e.includes(`*`)||e.includes(`?`)?{valid:!1,error:`WebSearch does not support wildcards`,suggestion:`Use exact search terms without * or ?`,examples:[`WebSearch(claude ai)`,`WebSearch(typescript tutorial)`]}:{valid:!0},WebFetch:e=>e.includes(`://`)||e.startsWith(`http`)?{valid:!1,error:`WebFetch permissions use domain format, not URLs`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:github.com)`]}:e.startsWith(`domain:`)?{valid:!0}:{valid:!1,error:`WebFetch permissions must use "domain:" prefix`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:*.google.com)`]}}}}));function Lo(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function Ro(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!Lo(e,r)&&n++;return n}function zo(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!Lo(e,t))return!0;return!1}function Bo(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(Ro(e,`(`)!==Ro(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(zo(e)){let t=e.substring(0,e.indexOf(`(`));return t?{valid:!1,error:`Empty parentheses`,suggestion:`Either specify a pattern or use just "${t}" without parentheses`,examples:[`${t}`,`${t}(some-pattern)`]}:{valid:!1,error:`Empty parentheses with no tool name`,suggestion:`Specify a tool name before the parentheses`}}let n=To(e),r=Qa(n.toolName);if(r)return n.ruleContent!==void 0||Ro(e,`(`)>0?{valid:!1,error:`MCP rules do not support patterns in parentheses`,suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${r.serverName}__*" for all tools`,examples:[`mcp__${r.serverName}`,`mcp__${r.serverName}__*`,r.toolName&&r.toolName!==`*`?`mcp__${r.serverName}__${r.toolName}`:void 0].filter(Boolean)}:{valid:!0};if(!n.toolName||n.toolName.length===0)return{valid:!1,error:`Tool name cannot be empty`};if(n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:`Tool names must start with uppercase`,suggestion:`Use "${Wt(String(n.toolName))}"`};let i=Po(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(No(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`)&&!e.endsWith(`:*`))return{valid:!1,error:`The :* pattern must be at the end`,suggestion:`Move :* to the end for prefix matching, or use * for wildcard matching`,examples:[`Bash(npm run:*) - prefix matching (legacy)`,`Bash(npm run *) - wildcard matching`]};if(e===`:*`)return{valid:!1,error:`Prefix cannot be empty before :*`,suggestion:`Specify a command prefix before :*`,examples:[`Bash(npm:*)`,`Bash(git:*)`]}}if(Mo(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`))return{valid:!1,error:`The ":*" syntax is only for Bash prefix rules`,suggestion:`Use glob patterns like "*" or "**" for file matching`,examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(e.includes(`*`)&&!e.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!e.includes(`**`))return{valid:!1,error:`Wildcard placement might be incorrect`,suggestion:`Wildcards are typically used at path boundaries`,examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}if(n&&n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.length>384)return{valid:!1,error:`VaultHttpFetch rule content is too long (${e.length} chars; max 384)`,suggestion:`Use a shorter key name and host, or use the wildcard form <key>@*`};if(/[\x00-\x1F\x7F]/.test(e))return{valid:!1,error:`VaultHttpFetch rule content contains control characters (only printable ASCII allowed in key@host)`,suggestion:`Remove control characters from the rule content`}}if(n&&n.toolName===`VaultHttpFetch`&&t===`deny`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch deny rule content must be '<key>@<host>' or '<key>@*' (or whole-tool deny without parentheses for kill switch)`,suggestion:`Found '${n.ruleContent}'. Use 'VaultHttpFetch' (no parens) for kill switch, or 'VaultHttpFetch(${n.ruleContent}@*)' for any-host.`,examples:[`VaultHttpFetch — whole-tool kill switch`,`VaultHttpFetch(${n.ruleContent}@api.github.com)`,`VaultHttpFetch(${n.ruleContent}@*)`]};if(t===`allow`&&n){if(n.ruleContent===void 0&&Vo.has(n.toolName))return{valid:!1,error:`Whole-tool allow forbidden for vault tool '${n.toolName}'`,suggestion:`Use per-key + per-host allow: '${n.toolName}(your-key-name@host)'`,examples:[`${n.toolName}(github-token@api.github.com)`,`${n.toolName}(my-api@*) - allow any host (advanced)`]};if(n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch rule content must be '<key>@<host>' or '<key>@*'`,suggestion:`Found '${n.ruleContent}'. Use e.g. 'github-token@api.github.com' or 'admin-key@127.0.0.1:8443' to bind a key to a host.`,examples:[`VaultHttpFetch(github-token@api.github.com)`,`VaultHttpFetch(local-admin@localhost:8443)`,`VaultHttpFetch(stripe-key@*) - any host (advanced)`]}}return{valid:!0}}var Vo,Ho,Uo=t((()=>{T(),io(),E(),jo(),Gt(),Io(),Vo=new Set([`LocalVaultFetch`,`VaultHttpFetch`]),Ho=w(()=>_().superRefine((e,t)=>{let n=Bo(e);if(!n.valid){let r=n.error;n.suggestion&&(r+=`. ${n.suggestion}`),n.examples&&n.examples.length>0&&(r+=`. Examples: ${n.examples.join(`, `)}`),t.addIssue({code:me.custom,message:r,params:{received:e}})}}))}));function Wo(e){return`serverName`in e&&e.serverName!==void 0}function Go(e){return`serverCommand`in e&&e.serverCommand!==void 0}function Ko(e){return`serverUrl`in e&&e.serverUrl!==void 0}var qo,Jo,Yo,Xo,Zo,Qo,J,$o=t((()=>{T(),gi(),ie(),E(),Wi(),Ja(),si(),Uo(),$i(),qr(),qo=w(()=>h(_(),ue())),Jo=w(()=>g({allow:C(Ho()).optional().describe(`List of permission rules for allowed operations`),deny:C(Ho()).optional().describe(`List of permission rules for denied operations`),ask:C(Ho()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:x(Jt).optional().describe(`Default permission mode when Work Mate needs access`),disableBypassPermissionsMode:x([`disable`]).optional().describe(`Disable the ability to bypass permission prompts`),disableAutoMode:x([`disable`]).optional().describe(`Disable auto mode`),additionalDirectories:C(_()).optional().describe(`Additional directories to include in the permission scope`)}).passthrough()),Yo=w(()=>g({source:Na().describe(`Where to fetch the marketplace from`),installLocation:_().optional().describe(`Local cache path where marketplace manifest is stored (auto-generated if not provided)`),autoUpdate:S().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),Xo=w(()=>g({serverName:_().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that users are allowed to configure`),serverCommand:C(_()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for allowed stdio servers`),serverUrl:_().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers`)}).refine(e=>Gr([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Zo=w(()=>g({serverName:_().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that is explicitly blocked`),serverCommand:C(_()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for blocked stdio servers`),serverUrl:_().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers`)}).refine(e=>Gr([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Qo=[`skills`,`agents`,`hooks`,`mcp`],J=w(()=>g({$schema:y(oi).optional().describe(`JSON Schema reference for Work Mate settings`),apiKeyHelper:_().optional().describe(`Path to a script that outputs authentication values`),awsCredentialExport:_().optional().describe(`Path to a script that exports AWS credentials`),awsAuthRefresh:_().optional().describe(`Path to a script that refreshes AWS authentication`),gcpAuthRefresh:_().optional().describe(`Command to refresh GCP authentication (e.g., gcloud auth application-default login)`),...m(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:g({issuer:_().url().describe(`IdP issuer URL for OIDC discovery`),clientId:_().describe(`Work Mate's client_id registered at the IdP`),callbackPort:b().int().positive().optional().describe(`Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.`)}).optional().describe(`XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.`)}:{},fileSuggestion:g({type:y(`command`),command:_()}).optional().describe(`Custom file suggestion configuration for @ mentions`),respectGitignore:S().optional().describe(`Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected.`),cleanupPeriodDays:b().nonnegative().int().optional().describe(`Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`),env:qo().optional().describe(`Environment variables to set for Work Mate sessions`),attribution:g({commit:_().optional().describe(`Attribution text for git commits, including any trailers. Empty string hides attribution.`),pr:_().optional().describe(`Attribution text for pull request descriptions. Empty string hides attribution.`)}).optional().describe(`Customize attribution text for commits and PRs. Each field defaults to the standard Work Mate attribution if not set.`),includeCoAuthoredBy:S().optional().describe(`Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)`),includeGitInstructions:S().optional().describe(`Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)`),permissions:Jo().optional().describe(`Tool usage permissions configuration`),modelType:x([`anthropic`,`openai`,`gemini`,`grok`]).optional().describe(`API provider type. "anthropic" uses the Anthropic API (default), "openai" uses the OpenAI Chat Completions API, "gemini" uses the Gemini API, and "grok" uses the xAI Grok API (OpenAI-compatible). When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL. When set to "gemini", configure GEMINI_API_KEY and optional GEMINI_BASE_URL. When set to "grok", configure GROK_API_KEY (or XAI_API_KEY), optional GROK_BASE_URL, GROK_MODEL, and GROK_MODEL_MAP.`),model:_().optional().describe(`Override the default model used by Work Mate`),availableModels:C(_()).optional().describe(`Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.`),modelOverrides:h(_(),_()).optional().describe(`Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.`),enableAllProjectMcpServers:S().optional().describe(`Whether to automatically approve all MCP servers in the project`),enabledMcpjsonServers:C(_()).optional().describe(`List of approved MCP servers from .mcp.json`),disabledMcpjsonServers:C(_()).optional().describe(`List of rejected MCP servers from .mcp.json`),allowedMcpServers:C(Xo()).optional().describe(`Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied.`),deniedMcpServers:C(Zo()).optional().describe(`Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied.`),hooks:V().optional().describe(`Custom commands to run before/after tool executions`),worktree:g({symlinkDirectories:C(_()).optional().describe(`Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"`),sparsePaths:C(_()).optional().describe(`Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.`)}).optional().describe(`Git worktree configuration for --worktree flag.`),disableAllHooks:S().optional().describe(`Disable all hooks and statusLine execution`),defaultShell:x([`bash`,`powershell`]).optional().describe(`Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip).`),allowManagedHooksOnly:S().optional().describe(`When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored.`),allowedHttpHookUrls:C(_()).optional().describe(`Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).`),httpHookAllowedEnvVars:C(_()).optional().describe(`Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers).`),allowManagedPermissionRulesOnly:S().optional().describe(`When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored.`),allowManagedMcpServersOnly:S().optional().describe(`When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies.`),strictPluginOnlyCustomization:pe(e=>Array.isArray(e)?e.filter(e=>Qo.includes(e)):e,v([S(),C(x(Qo))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:g({type:y(`command`),command:_(),padding:b().optional(),refreshInterval:b().optional()}).optional().describe(`Custom status line display configuration`),statusLineEnabled:S().optional().describe(`Whether to render the fork built-in status line (model + ctx + 5h/7d limits + cost + cache pill). Toggled with /statusline.`),enabledPlugins:h(_(),v([C(_()),S(),he()])).optional().describe(`Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.`),extraKnownMarketplaces:h(_(),Yo()).check(e=>{for(let[t,n]of Object.entries(e.value))n.source.source===`settings`&&n.source.name!==t&&e.issues.push({code:`custom`,input:n.source.name,path:[t,`source`,`name`],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${t}" but source.name "${n.source.name}")`})}).optional().describe(`Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources.`),strictKnownMarketplaces:C(Na()).optional().describe(`Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces.`),blockedMarketplaces:C(Na()).optional().describe(`Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem.`),forceLoginMethod:x([`claudeai`,`console`]).optional().describe(`Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing`),forceLoginOrgUUID:_().optional().describe(`Organization UUID to use for OAuth login`),otelHeadersHelper:_().optional().describe(`Path to a script that outputs OpenTelemetry headers`),outputStyle:_().optional().describe(`Controls the output style for assistant responses`),language:_().optional().describe(`Preferred language for Claude responses (e.g., "japanese", "spanish")`),skipWebFetchPreflight:S().optional().describe(`Skip the WebFetch blocklist check for enterprise environments with restrictive security policies`),webSearchAdapter:x([`api`,`bing`,`brave`,`exa`,`tavily`]).optional().describe(`Web search backend adapter. "tavily" uses Tavily Search API (default), "api" uses Anthropic server-side search, "bing" scrapes Bing HTML, "brave" uses Brave Search API, "exa" uses Exa AI.`),webFetchAdapter:x([`tavily`,`http`]).optional().describe(`Web fetch backend. "tavily" uses Tavily Extract API which returns Markdown directly (default), "http" fetches the URL directly via HTTP.`),tavilyEndpointUrl:_().optional().describe(`Custom Tavily API endpoint URL. Defaults to https://tavily.readmagic.workmate.win. Used by both WebSearch and WebFetch when tavily adapter is selected.`),braveApiKey:_().optional().describe(`Brave Search API key. Required when using the brave web search adapter.`),webFetchHttpTimeoutMs:b().int().positive().optional().describe(`HTTP timeout in milliseconds for the HTTP direct web fetch backend. Defaults to 60000 (60s).`),exaApiKey:_().optional().describe(`Exa AI API key. Required when using the exa web search adapter.`),exaEndpointUrl:_().optional().describe(`Custom Exa AI MCP endpoint URL. Defaults to https://mcp.exa.ai/mcp.`),sandbox:hi().optional(),feedbackSurveyRate:b().min(0).max(1).optional().describe(`Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.`),spinnerTipsEnabled:S().optional().describe(`Whether to show tips in the spinner`),spinnerVerbs:g({mode:x([`append`,`replace`]),verbs:C(_())}).optional().describe(`Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.`),spinnerTipsOverride:g({excludeDefault:S().optional(),tips:C(_())}).optional().describe(`Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false).`),syntaxHighlightingDisabled:S().optional().describe(`Whether to disable syntax highlighting in diffs`),terminalTitleFromRename:S().optional().describe(`Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.`),alwaysThinkingEnabled:S().optional().describe(`When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.`),effortLevel:x(process.env.USER_TYPE===`ant`?[`low`,`medium`,`high`,`xhigh`,`max`]:[`low`,`medium`,`high`,`xhigh`]).optional().catch(void 0).describe(`Persisted effort level for supported models.`),advisorModel:_().optional().describe(`Advisor model for the server-side advisor tool.`),fastMode:S().optional().describe(`When true, fast mode is enabled. When absent or false, fast mode is off.`),fastModePerSessionOptIn:S().optional().describe(`When true, fast mode does not persist across sessions. Each session starts with fast mode off.`),promptSuggestionEnabled:S().optional().describe(`When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled.`),poorMode:S().optional().describe(`When true, poor mode is active — extract_memories and prompt_suggestion are disabled to save tokens.`),showClearContextOnPlanAccept:S().optional().describe(`When true, the plan-approval dialog offers a "clear context" option. Defaults to false.`),agent:_().optional().describe(`Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model.`),companyAnnouncements:C(_()).optional().describe(`Company announcements to display at startup (one will be randomly selected if multiple are provided)`),pluginConfigs:h(_(),g({mcpServers:h(_(),h(_(),v([_(),b(),S(),C(_())]))).optional().describe(`User configuration values for MCP servers keyed by server name`),options:h(_(),v([_(),b(),S(),C(_())])).optional().describe(`Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.`)})).optional().describe(`Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)`),remote:g({defaultEnvironmentId:_().optional().describe(`Default environment ID to use for remote sessions`)}).optional().describe(`Remote session configuration`),autoUpdatesChannel:x([`latest`,`stable`]).optional().describe(`Release channel for auto-updates (latest or stable)`),disableDeepLinkRegistration:x([`disable`]).optional().describe(`Prevent claude-cli:// protocol handler registration with the OS`),minimumVersion:_().optional().describe(`Minimum version to stay on - prevents downgrades when switching to stable channel`),plansDirectory:_().optional().describe(`Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/`),...process.env.USER_TYPE===`ant`?{classifierPermissionsEnabled:S().optional().describe(`Enable AI-based classification for Bash(prompt:...) permission rules`)}:{},minSleepDurationMs:b().nonnegative().int().optional().describe(`Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency.`),maxSleepDurationMs:b().int().min(-1).optional().describe(`Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.`),assistant:S().optional().describe(`Start Claude in assistant mode (custom system prompt, brief view, scheduled check-in skills)`),assistantName:_().optional().describe(`Display name for the assistant, shown in the claude.ai session list`),channelsEnabled:S().optional().describe(`Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels.`),allowedChannelPlugins:C(g({marketplace:_(),plugin:_()})).optional().describe(`Teams/Enterprise allowlist of channel plugins. When set, replaces the default Anthropic allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true.`),defaultView:x([`chat`,`transcript`]).optional().describe(`Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)`),prefersReducedMotion:S().optional().describe(`Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)`),autoMemoryEnabled:S().optional().describe(`Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory.`),autoMemoryDirectory:_().optional().describe(`Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/.`),autoDreamEnabled:S().optional().describe(`Enable background memory consolidation (auto-dream). When set, overrides the server-side default.`),showThinkingSummaries:S().optional().describe(`Show thinking summaries in the transcript view (ctrl+o). Default: false.`),skipDangerousModePermissionPrompt:S().optional().describe(`Whether the user has accepted the bypass permissions mode dialog`),skipAutoPermissionPrompt:S().optional().describe(`Whether the user has accepted the auto mode opt-in dialog`),useAutoModeDuringPlan:S().optional().describe(`Whether plan mode uses auto mode semantics when auto mode is available (default: true)`),autoMode:g({allow:C(_()).optional().describe(`Rules for the auto mode classifier allow section`),soft_deny:C(_()).optional().describe(`Rules for the auto mode classifier deny section`),...process.env.USER_TYPE===`ant`?{deny:C(_()).optional()}:{},environment:C(_()).optional().describe(`Entries for the auto mode classifier environment section`)}).optional().describe(`Auto mode classifier prompt customization`),disableAutoMode:x([`disable`]).optional().describe(`Disable auto mode`),sshConfigs:C(g({id:_().describe(`Unique identifier for this SSH config. Used to match configs across settings sources.`),name:_().describe(`Display name for the SSH connection`),sshHost:_().describe(`SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config`),sshPort:b().int().optional().describe(`SSH port (default: 22)`),sshIdentityFile:_().optional().describe(`Path to SSH identity file (private key)`),startDirectory:_().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe(`SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members.`),claudeMdExcludes:C(_()).optional().describe(`Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"`),cacheThreshold:b().int().min(0).max(100).optional().describe(`Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 80.`),cacheWarningEnabled:S().optional().describe(`Whether to show cache hit rate warnings in the message flow when the rate falls below cacheThreshold. Default: true.`),pluginTrustMessage:_().optional().describe(`Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").`),workspaceApiKey:_().optional().describe(`Workspace API key (sk-ant-api03-*) saved via /login UI. Stored in plaintext — keep this file gitignored and restrict its permissions. ANTHROPIC_API_KEY environment variable takes precedence when both are set.`)}).passthrough())}));function es(){return pt(se(J(),{unrepresentable:`any`}),null,2)}var ts=t((()=>{T(),st(),$o()}));function ns(e){let t=rs.find(t=>t.matches(e));if(!t)return null;let n={...t.tip};if(e.code===`invalid_value`&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(e=>`"${e}"`).join(`, `)}`),!n.docLink&&e.path){let t=e.path.split(`.`)[0];t&&(n.docLink=is[t])}return n}var Y,rs,is,as=t((()=>{Y=`https://code.claude.com/docs/en`,rs=[{matches:e=>e.path===`permissions.defaultMode`&&e.code===`invalid_value`,tip:{suggestion:`Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)`,docLink:`${Y}/iam#permission-modes`}},{matches:e=>e.path===`apiKeyHelper`&&e.code===`invalid_type`,tip:{suggestion:`Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"`}},{matches:e=>e.path===`cleanupPeriodDays`&&e.code===`too_small`&&e.expected===`0`,tip:{suggestion:`Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`}},{matches:e=>e.path.startsWith(`env.`)&&e.code===`invalid_type`,tip:{suggestion:`Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"`,docLink:`${Y}/settings#environment-variables`}},{matches:e=>(e.path===`permissions.allow`||e.path===`permissions.deny`)&&e.code===`invalid_type`&&e.expected===`array`,tip:{suggestion:`Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.`}},{matches:e=>e.path.includes(`hooks`)&&e.code===`invalid_type`,tip:{suggestion:`Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}`}},{matches:e=>e.code===`invalid_type`&&e.expected===`boolean`,tip:{suggestion:`Use true or false without quotes. Example: "includeCoAuthoredBy": true`}},{matches:e=>e.code===`unrecognized_keys`,tip:{suggestion:`Check for typos or refer to the documentation for valid fields`,docLink:`${Y}/settings`}},{matches:e=>e.code===`invalid_value`&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code===`invalid_type`&&e.expected===`object`&&e.received===null&&e.path===``,tip:{suggestion:`Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error.`}},{matches:e=>e.path===`permissions.additionalDirectories`&&e.code===`invalid_type`,tip:{suggestion:`Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command`,docLink:`${Y}/iam#working-directories`}}],is={permissions:`${Y}/iam#configuring-permissions`,env:`${Y}/settings#environment-variables`,hooks:`${Y}/hooks`}}));function os(e){return e.code===`invalid_type`}function ss(e){return e.code===`invalid_value`}function cs(e){return e.code===`unrecognized_keys`}function ls(e){return e.code===`too_small`}function us(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function ds(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function fs(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if(ss(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(os(e)){o=e.expected;let t=ds(e.message);s=t??us(e.input),c=t??us(e.input)}else ls(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let l=ns({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if(ss(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(os(e)){let t=ds(e.message)??us(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(cs(e)){let t=e.keys.join(`, `);r=`Unrecognized ${Ut(e.keys.length,`field`)}: ${t}`}else ls(e)&&(r=`Number must be greater than or equal to ${e.minimum}`,i=String(e.minimum));return{file:t,path:n,message:r,expected:i,invalidValue:c,suggestion:l?.suggestion,docLink:l?.docLink}})}function ps(e){try{let t=at(e),n=J().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
16
+ Keep messages tight — the decision, the file:line, the PR number. Second person always ("your config"), never third.`}));function q(e){return Ao[e]??e}function So(e){let t=[];for(let[n,r]of Object.entries(Ao))r===e&&t.push(n);return t}function Co(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)}function wo(e){return e.replace(/\\\(/g,`(`).replace(/\\\)/g,`)`).replace(/\\\\/g,`\\`)}function To(e){let t=Do(e,`(`);if(t===-1)return{toolName:q(e)};let n=Oo(e,`)`);if(n===-1||n<=t||n!==e.length-1)return{toolName:q(e)};let r=e.substring(0,t),i=e.substring(t+1,n);if(!r)return{toolName:q(e)};if(i===``||i===`*`)return{toolName:q(r)};let a=wo(i);return{toolName:q(r),ruleContent:a}}function Eo(e){if(!e.ruleContent)return e.toolName;let t=Co(e.ruleContent);return`${e.toolName}(${t})`}function Do(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}function Oo(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}var ko,Ao,jo=t((()=>{lo(),fo(),ho(),ko=(xo(),e(go)).BRIEF_TOOL_NAME,Ao={Task:ao,KillShell:po,AgentOutputTool:uo,BashOutputTool:uo,...ko?{Brief:ko}:{}}}));function Mo(e){return Fo.filePatternTools.includes(e)}function No(e){return Fo.bashPrefixTools.includes(e)}function Po(e){return Fo.customValidation[e]}var Fo,Io=t((()=>{Fo={filePatternTools:[`Read`,`Write`,`Edit`,`Glob`,`NotebookRead`,`NotebookEdit`],bashPrefixTools:[`Bash`],customValidation:{WebSearch:e=>e.includes(`*`)||e.includes(`?`)?{valid:!1,error:`WebSearch does not support wildcards`,suggestion:`Use exact search terms without * or ?`,examples:[`WebSearch(claude ai)`,`WebSearch(typescript tutorial)`]}:{valid:!0},WebFetch:e=>e.includes(`://`)||e.startsWith(`http`)?{valid:!1,error:`WebFetch permissions use domain format, not URLs`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:github.com)`]}:e.startsWith(`domain:`)?{valid:!0}:{valid:!1,error:`WebFetch permissions must use "domain:" prefix`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:*.google.com)`]}}}}));function Lo(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function Ro(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!Lo(e,r)&&n++;return n}function zo(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!Lo(e,t))return!0;return!1}function Bo(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(Ro(e,`(`)!==Ro(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(zo(e)){let t=e.substring(0,e.indexOf(`(`));return t?{valid:!1,error:`Empty parentheses`,suggestion:`Either specify a pattern or use just "${t}" without parentheses`,examples:[`${t}`,`${t}(some-pattern)`]}:{valid:!1,error:`Empty parentheses with no tool name`,suggestion:`Specify a tool name before the parentheses`}}let n=To(e),r=Qa(n.toolName);if(r)return n.ruleContent!==void 0||Ro(e,`(`)>0?{valid:!1,error:`MCP rules do not support patterns in parentheses`,suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${r.serverName}__*" for all tools`,examples:[`mcp__${r.serverName}`,`mcp__${r.serverName}__*`,r.toolName&&r.toolName!==`*`?`mcp__${r.serverName}__${r.toolName}`:void 0].filter(Boolean)}:{valid:!0};if(!n.toolName||n.toolName.length===0)return{valid:!1,error:`Tool name cannot be empty`};if(n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:`Tool names must start with uppercase`,suggestion:`Use "${Wt(String(n.toolName))}"`};let i=Po(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(No(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`)&&!e.endsWith(`:*`))return{valid:!1,error:`The :* pattern must be at the end`,suggestion:`Move :* to the end for prefix matching, or use * for wildcard matching`,examples:[`Bash(npm run:*) - prefix matching (legacy)`,`Bash(npm run *) - wildcard matching`]};if(e===`:*`)return{valid:!1,error:`Prefix cannot be empty before :*`,suggestion:`Specify a command prefix before :*`,examples:[`Bash(npm:*)`,`Bash(git:*)`]}}if(Mo(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`))return{valid:!1,error:`The ":*" syntax is only for Bash prefix rules`,suggestion:`Use glob patterns like "*" or "**" for file matching`,examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(e.includes(`*`)&&!e.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!e.includes(`**`))return{valid:!1,error:`Wildcard placement might be incorrect`,suggestion:`Wildcards are typically used at path boundaries`,examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}if(n&&n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.length>384)return{valid:!1,error:`VaultHttpFetch rule content is too long (${e.length} chars; max 384)`,suggestion:`Use a shorter key name and host, or use the wildcard form <key>@*`};if(/[\x00-\x1F\x7F]/.test(e))return{valid:!1,error:`VaultHttpFetch rule content contains control characters (only printable ASCII allowed in key@host)`,suggestion:`Remove control characters from the rule content`}}if(n&&n.toolName===`VaultHttpFetch`&&t===`deny`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch deny rule content must be '<key>@<host>' or '<key>@*' (or whole-tool deny without parentheses for kill switch)`,suggestion:`Found '${n.ruleContent}'. Use 'VaultHttpFetch' (no parens) for kill switch, or 'VaultHttpFetch(${n.ruleContent}@*)' for any-host.`,examples:[`VaultHttpFetch — whole-tool kill switch`,`VaultHttpFetch(${n.ruleContent}@api.github.com)`,`VaultHttpFetch(${n.ruleContent}@*)`]};if(t===`allow`&&n){if(n.ruleContent===void 0&&Vo.has(n.toolName))return{valid:!1,error:`Whole-tool allow forbidden for vault tool '${n.toolName}'`,suggestion:`Use per-key + per-host allow: '${n.toolName}(your-key-name@host)'`,examples:[`${n.toolName}(github-token@api.github.com)`,`${n.toolName}(my-api@*) - allow any host (advanced)`]};if(n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch rule content must be '<key>@<host>' or '<key>@*'`,suggestion:`Found '${n.ruleContent}'. Use e.g. 'github-token@api.github.com' or 'admin-key@127.0.0.1:8443' to bind a key to a host.`,examples:[`VaultHttpFetch(github-token@api.github.com)`,`VaultHttpFetch(local-admin@localhost:8443)`,`VaultHttpFetch(stripe-key@*) - any host (advanced)`]}}return{valid:!0}}var Vo,Ho,Uo=t((()=>{T(),io(),E(),jo(),Gt(),Io(),Vo=new Set([`LocalVaultFetch`,`VaultHttpFetch`]),Ho=w(()=>_().superRefine((e,t)=>{let n=Bo(e);if(!n.valid){let r=n.error;n.suggestion&&(r+=`. ${n.suggestion}`),n.examples&&n.examples.length>0&&(r+=`. Examples: ${n.examples.join(`, `)}`),t.addIssue({code:me.custom,message:r,params:{received:e}})}}))}));function Wo(e){return`serverName`in e&&e.serverName!==void 0}function Go(e){return`serverCommand`in e&&e.serverCommand!==void 0}function Ko(e){return`serverUrl`in e&&e.serverUrl!==void 0}var qo,Jo,Yo,Xo,Zo,Qo,J,$o=t((()=>{T(),gi(),ie(),E(),Wi(),Ja(),si(),Uo(),$i(),qr(),qo=w(()=>h(_(),ue())),Jo=w(()=>g({allow:C(Ho()).optional().describe(`List of permission rules for allowed operations`),deny:C(Ho()).optional().describe(`List of permission rules for denied operations`),ask:C(Ho()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:x(Jt).optional().describe(`Default permission mode when Work Mate needs access`),disableBypassPermissionsMode:x([`disable`]).optional().describe(`Disable the ability to bypass permission prompts`),disableAutoMode:x([`disable`]).optional().describe(`Disable auto mode`),additionalDirectories:C(_()).optional().describe(`Additional directories to include in the permission scope`)}).passthrough()),Yo=w(()=>g({source:Na().describe(`Where to fetch the marketplace from`),installLocation:_().optional().describe(`Local cache path where marketplace manifest is stored (auto-generated if not provided)`),autoUpdate:S().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),Xo=w(()=>g({serverName:_().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that users are allowed to configure`),serverCommand:C(_()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for allowed stdio servers`),serverUrl:_().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers`)}).refine(e=>Gr([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Zo=w(()=>g({serverName:_().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that is explicitly blocked`),serverCommand:C(_()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for blocked stdio servers`),serverUrl:_().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers`)}).refine(e=>Gr([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Qo=[`skills`,`agents`,`hooks`,`mcp`],J=w(()=>g({$schema:y(oi).optional().describe(`JSON Schema reference for Work Mate settings`),apiKeyHelper:_().optional().describe(`Path to a script that outputs authentication values`),awsCredentialExport:_().optional().describe(`Path to a script that exports AWS credentials`),awsAuthRefresh:_().optional().describe(`Path to a script that refreshes AWS authentication`),gcpAuthRefresh:_().optional().describe(`Command to refresh GCP authentication (e.g., gcloud auth application-default login)`),...m(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:g({issuer:_().url().describe(`IdP issuer URL for OIDC discovery`),clientId:_().describe(`Work Mate's client_id registered at the IdP`),callbackPort:b().int().positive().optional().describe(`Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.`)}).optional().describe(`XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.`)}:{},fileSuggestion:g({type:y(`command`),command:_()}).optional().describe(`Custom file suggestion configuration for @ mentions`),respectGitignore:S().optional().describe(`Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected.`),cleanupPeriodDays:b().nonnegative().int().optional().describe(`Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`),env:qo().optional().describe(`Environment variables to set for Work Mate sessions`),attribution:g({commit:_().optional().describe(`Attribution text for git commits, including any trailers. Empty string hides attribution.`),pr:_().optional().describe(`Attribution text for pull request descriptions. Empty string hides attribution.`)}).optional().describe(`Customize attribution text for commits and PRs. Each field defaults to the standard Work Mate attribution if not set.`),includeCoAuthoredBy:S().optional().describe(`Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)`),includeGitInstructions:S().optional().describe(`Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)`),permissions:Jo().optional().describe(`Tool usage permissions configuration`),modelType:x([`anthropic`,`openai`,`gemini`,`grok`]).optional().describe(`API provider type. "anthropic" uses the Anthropic API (default), "openai" uses the OpenAI Chat Completions API, "gemini" uses the Gemini API, and "grok" uses the xAI Grok API (OpenAI-compatible). When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL. When set to "gemini", configure GEMINI_API_KEY and optional GEMINI_BASE_URL. When set to "grok", configure GROK_API_KEY (or XAI_API_KEY), optional GROK_BASE_URL, GROK_MODEL, and GROK_MODEL_MAP.`),model:_().optional().describe(`Override the default model used by Work Mate`),availableModels:C(_()).optional().describe(`Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.`),modelOverrides:h(_(),_()).optional().describe(`Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.`),enableAllProjectMcpServers:S().optional().describe(`Whether to automatically approve all MCP servers in the project`),enabledMcpjsonServers:C(_()).optional().describe(`List of approved MCP servers from .mcp.json`),disabledMcpjsonServers:C(_()).optional().describe(`List of rejected MCP servers from .mcp.json`),allowedMcpServers:C(Xo()).optional().describe(`Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied.`),deniedMcpServers:C(Zo()).optional().describe(`Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied.`),hooks:V().optional().describe(`Custom commands to run before/after tool executions`),worktree:g({symlinkDirectories:C(_()).optional().describe(`Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"`),sparsePaths:C(_()).optional().describe(`Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.`)}).optional().describe(`Git worktree configuration for --worktree flag.`),disableAllHooks:S().optional().describe(`Disable all hooks and statusLine execution`),defaultShell:x([`bash`,`powershell`]).optional().describe(`Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip).`),allowManagedHooksOnly:S().optional().describe(`When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored.`),allowedHttpHookUrls:C(_()).optional().describe(`Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).`),httpHookAllowedEnvVars:C(_()).optional().describe(`Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers).`),allowManagedPermissionRulesOnly:S().optional().describe(`When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored.`),allowManagedMcpServersOnly:S().optional().describe(`When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies.`),strictPluginOnlyCustomization:pe(e=>Array.isArray(e)?e.filter(e=>Qo.includes(e)):e,v([S(),C(x(Qo))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:g({type:y(`command`),command:_(),padding:b().optional(),refreshInterval:b().optional()}).optional().describe(`Custom status line display configuration`),statusLineEnabled:S().optional().describe(`Whether to render the fork built-in status line (model + ctx + 5h/7d limits + cost + cache pill). Toggled with /statusline.`),enabledPlugins:h(_(),v([C(_()),S(),he()])).optional().describe(`Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.`),extraKnownMarketplaces:h(_(),Yo()).check(e=>{for(let[t,n]of Object.entries(e.value))n.source.source===`settings`&&n.source.name!==t&&e.issues.push({code:`custom`,input:n.source.name,path:[t,`source`,`name`],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${t}" but source.name "${n.source.name}")`})}).optional().describe(`Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources.`),strictKnownMarketplaces:C(Na()).optional().describe(`Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces.`),blockedMarketplaces:C(Na()).optional().describe(`Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem.`),forceLoginMethod:x([`claudeai`,`console`]).optional().describe(`Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing`),forceLoginOrgUUID:_().optional().describe(`Organization UUID to use for OAuth login`),otelHeadersHelper:_().optional().describe(`Path to a script that outputs OpenTelemetry headers`),outputStyle:_().optional().describe(`Controls the output style for assistant responses`),language:_().optional().describe(`Preferred language for Claude responses (e.g., "japanese", "spanish")`),skipWebFetchPreflight:S().optional().describe(`Skip the WebFetch blocklist check for enterprise environments with restrictive security policies`),webSearchAdapter:x([`api`,`bing`,`brave`,`exa`,`tavily`]).optional().describe(`Web search backend adapter. "tavily" uses Tavily Search API (default), "api" uses Anthropic server-side search, "bing" scrapes Bing HTML, "brave" uses Brave Search API, "exa" uses Exa AI.`),webFetchAdapter:x([`tavily`,`http`]).optional().describe(`Web fetch backend. "tavily" uses Tavily Extract API which returns Markdown directly (default), "http" fetches the URL directly via HTTP.`),tavilyEndpointUrl:_().optional().describe(`Custom Tavily API endpoint URL. Defaults to https://tavily.readmagic.workmate.win. Used by both WebSearch and WebFetch when tavily adapter is selected.`),braveApiKey:_().optional().describe(`Brave Search API key. Required when using the brave web search adapter.`),webFetchHttpTimeoutMs:b().int().positive().optional().describe(`HTTP timeout in milliseconds for the HTTP direct web fetch backend. Defaults to 60000 (60s).`),exaApiKey:_().optional().describe(`Exa AI API key. Required when using the exa web search adapter.`),exaEndpointUrl:_().optional().describe(`Custom Exa AI MCP endpoint URL. Defaults to https://mcp.exa.ai/mcp.`),sandbox:hi().optional(),feedbackSurveyRate:b().min(0).max(1).optional().describe(`Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.`),spinnerTipsEnabled:S().optional().describe(`Whether to show tips in the spinner`),spinnerVerbs:g({mode:x([`append`,`replace`]),verbs:C(_())}).optional().describe(`Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.`),spinnerTipsOverride:g({excludeDefault:S().optional(),tips:C(_())}).optional().describe(`Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false).`),syntaxHighlightingDisabled:S().optional().describe(`Whether to disable syntax highlighting in diffs`),terminalTitleFromRename:S().optional().describe(`Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.`),alwaysThinkingEnabled:S().optional().describe(`When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.`),advisorModel:_().optional().describe(`Advisor model for the server-side advisor tool.`),fastMode:S().optional().describe(`When true, fast mode is enabled. When absent or false, fast mode is off.`),fastModePerSessionOptIn:S().optional().describe(`When true, fast mode does not persist across sessions. Each session starts with fast mode off.`),promptSuggestionEnabled:S().optional().describe(`When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled.`),poorMode:S().optional().describe(`When true, poor mode is active — extract_memories and prompt_suggestion are disabled to save tokens.`),showClearContextOnPlanAccept:S().optional().describe(`When true, the plan-approval dialog offers a "clear context" option. Defaults to false.`),agent:_().optional().describe(`Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model.`),companyAnnouncements:C(_()).optional().describe(`Company announcements to display at startup (one will be randomly selected if multiple are provided)`),pluginConfigs:h(_(),g({mcpServers:h(_(),h(_(),v([_(),b(),S(),C(_())]))).optional().describe(`User configuration values for MCP servers keyed by server name`),options:h(_(),v([_(),b(),S(),C(_())])).optional().describe(`Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.`)})).optional().describe(`Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)`),remote:g({defaultEnvironmentId:_().optional().describe(`Default environment ID to use for remote sessions`)}).optional().describe(`Remote session configuration`),autoUpdatesChannel:x([`latest`,`stable`]).optional().describe(`Release channel for auto-updates (latest or stable)`),disableDeepLinkRegistration:x([`disable`]).optional().describe(`Prevent claude-cli:// protocol handler registration with the OS`),minimumVersion:_().optional().describe(`Minimum version to stay on - prevents downgrades when switching to stable channel`),plansDirectory:_().optional().describe(`Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/`),...process.env.USER_TYPE===`ant`?{classifierPermissionsEnabled:S().optional().describe(`Enable AI-based classification for Bash(prompt:...) permission rules`)}:{},minSleepDurationMs:b().nonnegative().int().optional().describe(`Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency.`),maxSleepDurationMs:b().int().min(-1).optional().describe(`Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.`),assistant:S().optional().describe(`Start Claude in assistant mode (custom system prompt, brief view, scheduled check-in skills)`),assistantName:_().optional().describe(`Display name for the assistant, shown in the claude.ai session list`),channelsEnabled:S().optional().describe(`Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels.`),allowedChannelPlugins:C(g({marketplace:_(),plugin:_()})).optional().describe(`Teams/Enterprise allowlist of channel plugins. When set, replaces the default Anthropic allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true.`),defaultView:x([`chat`,`transcript`]).optional().describe(`Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)`),prefersReducedMotion:S().optional().describe(`Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)`),autoMemoryEnabled:S().optional().describe(`Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory.`),autoMemoryDirectory:_().optional().describe(`Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/.`),autoDreamEnabled:S().optional().describe(`Enable background memory consolidation (auto-dream). When set, overrides the server-side default.`),showThinkingSummaries:S().optional().describe(`Show thinking summaries in the transcript view (ctrl+o). Default: false.`),skipDangerousModePermissionPrompt:S().optional().describe(`Whether the user has accepted the bypass permissions mode dialog`),skipAutoPermissionPrompt:S().optional().describe(`Whether the user has accepted the auto mode opt-in dialog`),useAutoModeDuringPlan:S().optional().describe(`Whether plan mode uses auto mode semantics when auto mode is available (default: true)`),autoMode:g({allow:C(_()).optional().describe(`Rules for the auto mode classifier allow section`),soft_deny:C(_()).optional().describe(`Rules for the auto mode classifier deny section`),...process.env.USER_TYPE===`ant`?{deny:C(_()).optional()}:{},environment:C(_()).optional().describe(`Entries for the auto mode classifier environment section`)}).optional().describe(`Auto mode classifier prompt customization`),disableAutoMode:x([`disable`]).optional().describe(`Disable auto mode`),sshConfigs:C(g({id:_().describe(`Unique identifier for this SSH config. Used to match configs across settings sources.`),name:_().describe(`Display name for the SSH connection`),sshHost:_().describe(`SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config`),sshPort:b().int().optional().describe(`SSH port (default: 22)`),sshIdentityFile:_().optional().describe(`Path to SSH identity file (private key)`),startDirectory:_().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe(`SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members.`),claudeMdExcludes:C(_()).optional().describe(`Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"`),cacheThreshold:b().int().min(0).max(100).optional().describe(`Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 80.`),cacheWarningEnabled:S().optional().describe(`Whether to show cache hit rate warnings in the message flow when the rate falls below cacheThreshold. Default: true.`),pluginTrustMessage:_().optional().describe(`Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").`),workspaceApiKey:_().optional().describe(`Workspace API key (sk-ant-api03-*) saved via /login UI. Stored in plaintext — keep this file gitignored and restrict its permissions. ANTHROPIC_API_KEY environment variable takes precedence when both are set.`)}).passthrough())}));function es(){return pt(se(J(),{unrepresentable:`any`}),null,2)}var ts=t((()=>{T(),st(),$o()}));function ns(e){let t=rs.find(t=>t.matches(e));if(!t)return null;let n={...t.tip};if(e.code===`invalid_value`&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(e=>`"${e}"`).join(`, `)}`),!n.docLink&&e.path){let t=e.path.split(`.`)[0];t&&(n.docLink=is[t])}return n}var Y,rs,is,as=t((()=>{Y=`https://code.claude.com/docs/en`,rs=[{matches:e=>e.path===`permissions.defaultMode`&&e.code===`invalid_value`,tip:{suggestion:`Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)`,docLink:`${Y}/iam#permission-modes`}},{matches:e=>e.path===`apiKeyHelper`&&e.code===`invalid_type`,tip:{suggestion:`Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"`}},{matches:e=>e.path===`cleanupPeriodDays`&&e.code===`too_small`&&e.expected===`0`,tip:{suggestion:`Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`}},{matches:e=>e.path.startsWith(`env.`)&&e.code===`invalid_type`,tip:{suggestion:`Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"`,docLink:`${Y}/settings#environment-variables`}},{matches:e=>(e.path===`permissions.allow`||e.path===`permissions.deny`)&&e.code===`invalid_type`&&e.expected===`array`,tip:{suggestion:`Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.`}},{matches:e=>e.path.includes(`hooks`)&&e.code===`invalid_type`,tip:{suggestion:`Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}`}},{matches:e=>e.code===`invalid_type`&&e.expected===`boolean`,tip:{suggestion:`Use true or false without quotes. Example: "includeCoAuthoredBy": true`}},{matches:e=>e.code===`unrecognized_keys`,tip:{suggestion:`Check for typos or refer to the documentation for valid fields`,docLink:`${Y}/settings`}},{matches:e=>e.code===`invalid_value`&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code===`invalid_type`&&e.expected===`object`&&e.received===null&&e.path===``,tip:{suggestion:`Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error.`}},{matches:e=>e.path===`permissions.additionalDirectories`&&e.code===`invalid_type`,tip:{suggestion:`Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command`,docLink:`${Y}/iam#working-directories`}}],is={permissions:`${Y}/iam#configuring-permissions`,env:`${Y}/settings#environment-variables`,hooks:`${Y}/hooks`}}));function os(e){return e.code===`invalid_type`}function ss(e){return e.code===`invalid_value`}function cs(e){return e.code===`unrecognized_keys`}function ls(e){return e.code===`too_small`}function us(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function ds(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function fs(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if(ss(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(os(e)){o=e.expected;let t=ds(e.message);s=t??us(e.input),c=t??us(e.input)}else ls(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let l=ns({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if(ss(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(os(e)){let t=ds(e.message)??us(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(cs(e)){let t=e.keys.join(`, `);r=`Unrecognized ${Ut(e.keys.length,`field`)}: ${t}`}else ls(e)&&(r=`Number must be greater than or equal to ${e.minimum}`,i=String(e.minimum));return{file:t,path:n,message:r,expected:i,invalidValue:c,suggestion:l?.suggestion,docLink:l?.docLink}})}function ps(e){try{let t=at(e),n=J().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
17
17
  `+fs(n.error,`settings`).map(e=>`- ${e.path}: ${e.message}`).join(`
18
18
  `),fullSchema:es()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:`Unknown parsing error`}`,fullSchema:es()}}}function ms(e,t){if(!e||typeof e!=`object`)return[];let n=e;if(!n.permissions||typeof n.permissions!=`object`)return[];let r=n.permissions,i=[];for(let e of[`allow`,`deny`,`ask`]){let n=r[e];Array.isArray(n)&&(r[e]=n.filter(n=>{if(typeof n!=`string`)return i.push({file:t,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:n}),!1;let r=Bo(n,e);if(!r.valid){let a=`Invalid permission rule "${n}" was skipped`;return r.error&&(a+=`: ${r.error}`),r.suggestion&&(a+=`. ${r.suggestion}`),i.push({file:t,path:`permissions.${e}`,message:a,invalidValue:n}),!1}return!0}))}return i}var hs=t((()=>{st(),Gt(),Uo(),ts(),$o(),as()}));function gs(){let e=``;try{e=Zt().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${_s}.plist`,label:`per-user managed preferences`}),t.push({path:`/Library/Managed Preferences/${_s}.plist`,label:`device-level managed preferences`}),process.env.USER_TYPE===`ant`&&t.push({path:A(Xt(),`Library`,`Preferences`,`${_s}.plist`),label:`user preferences (ant-only)`}),t}var _s,vs,ys,bs,xs,Ss,Cs,ws=t((()=>{_s=`com.anthropic.claudecode`,vs=`HKLM\\SOFTWARE\\Policies\\ClaudeCode`,ys=`HKCU\\SOFTWARE\\Policies\\ClaudeCode`,bs=`Settings`,xs=`/usr/bin/plutil`,Ss=[`-convert`,`json`,`-o`,`-`,`--`],Cs=5e3}));function Ts(e,t){return new Promise(n=>{on(e,t,{encoding:`utf-8`,timeout:Cs},(e,t)=>{n({stdout:t??``,code:+!!e})})})}function Es(){return(async()=>{if(process.platform===`darwin`){let e=gs(),t=(await Promise.all(e.map(async({path:e,label:t})=>{if(!en(e))return{stdout:``,label:t,ok:!1};let{stdout:n,code:r}=await Ts(xs,[...Ss,e]);return{stdout:n,label:t,ok:r===0&&!!n}}))).find(e=>e.ok);return{plistStdouts:t?[{stdout:t.stdout,label:t.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform===`win32`){let[e,t]=await Promise.all([Ts(`reg`,[`query`,vs,`/v`,bs]),Ts(`reg`,[`query`,ys,`/v`,bs])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function Ds(){ks||(ks=Es())}function Os(){return ks}var ks,As=t((()=>{ws(),ks=null}));function js(){Us||(Us=(async()=>{It(`mdm_load_start`);let e=Date.now(),{mdm:t,hkcu:n}=zs(await(Os()??Es()));Vs=t,Hs=n,It(`mdm_load_end`);let r=Date.now()-e;if(dt(`MDM settings load completed in ${r}ms`),Object.keys(t.settings).length>0){dt(`MDM settings found: ${Object.keys(t.settings).join(`, `)}`);try{gt(`info`,`mdm_settings_loaded`,{duration_ms:r,key_count:Object.keys(t.settings).length,error_count:t.errors.length})}catch{}}})())}async function Ms(){Us||js(),await Us}function Ns(){return Vs??X}function Ps(){return Hs??X}function Fs(e,t){Vs=e,Hs=t}async function Is(){return zs(await Es())}function Ls(e,t){let n=k(e,!1);if(!n||typeof n!=`object`)return{settings:{},errors:[]};let r=ms(n,t),i=J().safeParse(n);if(!i.success){let e=fs(i.error,t);return{settings:{},errors:[...r,...e]}}return{settings:i.data,errors:r}}function Rs(e,t=`Settings`){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,`i`);for(let e of n){let t=e.match(i);if(t&&t[1])return t[1].trimEnd()}return null}function zs(e){if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:t,label:n}=e.plistStdouts[0],r=Ls(t,n);if(Object.keys(r.settings).length>0)return{mdm:r,hkcu:X}}if(e.hklmStdout){let t=Rs(e.hklmStdout);if(t){let e=Ls(t,`Registry: ${vs}\\${bs}`);if(Object.keys(e.settings).length>0)return{mdm:e,hkcu:X}}}if(Bs())return{mdm:X,hkcu:X};if(e.hkcuStdout){let t=Rs(e.hkcuStdout);if(t){let e=Ls(t,`Registry: ${ys}\\${bs}`);return{mdm:X,hkcu:e}}}return{mdm:X,hkcu:X}}function Bs(){try{let e=k(O(A(F(),`managed-settings.json`)),!1);if(e&&typeof e==`object`&&Object.keys(e).length>0)return!0}catch{}try{let e=I(),t=D().readdirSync(e);for(let n of t)if(!(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(`.json`)||n.name.startsWith(`.`)))try{let t=k(O(A(e,n.name)),!1);if(t&&typeof t==`object`&&Object.keys(t).length>0)return!0}catch{}}catch{}return!1}var X,Vs,Hs,Us,Ws=t((()=>{ut(),vt(),kt(),ft(),Ft(),Lt(),fi(),$o(),hs(),ws(),As(),X=Object.freeze({settings:{},errors:[]}),Vs=null,Hs=null,Us=null}));function Gs(){return A(F(),`managed-settings.json`)}function Ks(){let e=[],t={},n=!1,{settings:r,errors:i}=Z(Gs());e.push(...i),r&&Object.keys(r).length>0&&(t=j(t,r,$),n=!0);let a=I();try{let r=D().readdirSync(a).filter(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`)).map(e=>e.name).sort();for(let i of r){let{settings:r,errors:o}=Z(A(a,i));e.push(...o),r&&Object.keys(r).length>0&&(t=j(t,r,$),n=!0)}}catch(e){let t=ot(e);t!==`ENOENT`&&t!==`ENOTDIR`&&Ct(e)}return{settings:n?t:null,errors:e}}function qs(){let{settings:e}=Z(Gs()),t=!!e&&Object.keys(e).length>0,n=!1,r=I();try{n=D().readdirSync(r).some(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`))}catch{}return{hasBase:t,hasDropIns:n}}function Js(e,t){typeof e==`object`&&e&&`code`in e&&e.code===`ENOENT`?dt(`Broken symlink or missing file encountered for settings.json at path: ${t}`):Ct(e)}function Z(e){let t=$e(e);if(t)return{settings:t.settings?mt(t.settings):null,errors:t.errors};let n=Ys(e);return ve(e,n),{settings:n.settings?mt(n.settings):null,errors:n.errors}}function Ys(e){try{let{resolvedPath:t}=lt(D(),e),n=O(t);if(n.trim()===``)return{settings:{},errors:[]};let r=k(n,!1),i=ms(r,e),a=J().safeParse(r);if(!a.success){let t=fs(a.error,e);return{settings:null,errors:[...i,...t]}}return{settings:a.data,errors:i}}catch(t){return Js(t,e),{settings:null,errors:[]}}}function Xs(e){switch(e){case`userSettings`:return $t(re());case`policySettings`:case`projectSettings`:case`localSettings`:return $t(Ke());case`flagSettings`:{let e=Oe();return e?Qt($t(e)):$t(Ke())}}}function Zs(){return we()||m(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS)?`cowork_settings.json`:`settings.json`}function Qs(e){switch(e){case`userSettings`:return A(Xs(e),Zs());case`projectSettings`:case`localSettings`:return A(Xs(e),$s(e));case`policySettings`:return Gs();case`flagSettings`:return Oe()}}function $s(e){switch(e){case`projectSettings`:return A(`.claude`,`settings.json`);case`localSettings`:return A(`.claude`,`settings.local.json`)}}function Q(e){let t=Pe(e);if(t!==void 0)return t;let n=ec(e);return Ue(e,n),n}function ec(e){if(e===`policySettings`){let e=Br();if(e&&Object.keys(e).length>0)return e;let t=Ns();if(Object.keys(t.settings).length>0)return t.settings;let{settings:n}=Ks();if(n)return n;let r=Ps();return Object.keys(r.settings).length>0?r.settings:null}let t=Qs(e),{settings:n}=t?Z(t):{settings:null};if(e===`flagSettings`){let e=Ee();if(e){let t=J().safeParse(e);if(t.success)return j(n||{},t.data,$)}}return n}function tc(){let e=Br();if(e&&Object.keys(e).length>0)return`remote`;let t=Ns();if(Object.keys(t.settings).length>0)return Et()===`macos`?`plist`:`hklm`;let{settings:n}=Ks();if(n)return`file`;let r=Ps();return Object.keys(r.settings).length>0?`hkcu`:null}function nc(e,t){if(e===`policySettings`||e===`flagSettings`)return{error:null};let n=Qs(e);if(!n)return{error:null};try{D().mkdirSync(Qt(n));let r=ec(e);if(!r){let e=null;try{e=O(n)}catch(e){if(!ct(e))throw e}if(e!==null){let t=k(e);if(t===null)return{error:Error(`Invalid JSON syntax in settings file at ${n}`)};t&&typeof t==`object`&&(r=t,dt(`Using raw settings from ${n} due to validation failure`))}}let i=j(r||{},t,(e,t,n,r)=>{if(t===void 0&&r&&typeof n==`string`){delete r[n];return}if(Array.isArray(t))return t});ci(n),Ot(n,pt(i,null,2)+`
19
19
  `),We(),e===`localSettings`&&Xr($s(`localSettings`),Ke())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return Ct(t),{error:t}}return{error:null}}function rc(e,t){return Kr([...e,...t])}function $(e,t){if(Array.isArray(e)&&Array.isArray(t))return rc(e,t)}function ic(e){let t=J().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,`disableAutoMode`,`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function ac(){if(mc)return{settings:{},errors:[]};let e=Date.now();It(`loadSettingsFromDisk_start`),gt(`info`,`settings_load_started`),mc=!0;try{let t=xe(),n={};t&&(n=j(n,t,$));let r=[],i=new Set,a=new Set;for(let e of N()){if(e===`policySettings`){let e=null,t=[],a=Br();if(a&&Object.keys(a).length>0){let n=J().safeParse(a);n.success?e=n.data:t.push(...fs(n.error,`remote managed settings`))}if(!e){let n=Ns();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=Ks();n&&(e=n),t.push(...r)}if(!e){let n=Ps();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=j(n,e,$));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=Qs(e);if(t){let e=$t(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=Z(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=j(n,o,$))}}if(e===`flagSettings`){let e=Ee();if(e){let t=J().safeParse(e);t.success&&(n=j(n,t.data,$))}}}return gt(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{mc=!1}}function oc(){let{settings:e}=cc();return e||{}}function sc(){We();let e=[];for(let t of N()){let n=Q(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:oc(),sources:e}}function cc(){let e=be();if(e!==null)return e;let t=ac();return It(`loadSettingsFromDisk_end`),Ae(t),t}function lc(){return!!(Q(`userSettings`)?.skipDangerousModePermissionPrompt||Q(`localSettings`)?.skipDangerousModePermissionPrompt||Q(`flagSettings`)?.skipDangerousModePermissionPrompt||Q(`policySettings`)?.skipDangerousModePermissionPrompt)}function uc(){return!0}function dc(){return Q(`policySettings`)?.useAutoModeDuringPlan!==!1&&Q(`flagSettings`)?.useAutoModeDuringPlan!==!1&&Q(`userSettings`)?.useAutoModeDuringPlan!==!1&&Q(`localSettings`)?.useAutoModeDuringPlan!==!1}function fc(){{let e=g({allow:C(_()).optional(),soft_deny:C(_()).optional(),deny:C(_()).optional(),environment:C(_()).optional()}),t=[],n=[],r=[];for(let i of[`userSettings`,`localSettings`,`flagSettings`,`policySettings`]){let a=Q(i);if(!a)continue;let o=e.safeParse(a.autoMode);o.success&&(o.data.allow&&t.push(...o.data.allow),o.data.soft_deny&&n.push(...o.data.soft_deny),process.env.USER_TYPE===`ant`&&o.data.deny&&n.push(...o.data.deny),o.data.environment&&r.push(...o.data.environment))}if(t.length>0||n.length>0||r.length>0)return{...t.length>0&&{allow:t},...n.length>0&&{soft_deny:n},...r.length>0&&{environment:r}}}}function pc(e){for(let t of N()){if(t===`policySettings`)continue;let n=Qs(t);if(n)try{let{resolvedPath:t}=lt(D(),n),r=O(t);if(!r.trim())continue;let i=k(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){Js(e,n)}}return!1}var mc,hc,gc=t((()=>{Pr(),T(),Be(),Ur(),qr(),ut(),vt(),ie(),ht(),At(),kt(),ft(),Zr(),Ft(),St(),Dt(),st(),Lt(),si(),di(),fi(),Ws(),je(),$o(),hs(),mc=!1,hc=oc}));export{oo as $,un as $n,I as $t,Qo as A,rr as An,Yi as At,Eo as B,jn as Bn,Bi as Bt,Ws as C,Ir as Cn,ia as Ct,Ds as D,Er as Dn,V as Dt,As as E,Dr as En,na as Et,Ko as F,Vn as Fn,Wi as Ft,xo as G,On as Gn,ji as Gt,yo as H,kn as Hn,Fi as Ht,So as I,Fn as In,Ri as It,po as J,mn as Jn,R as Jt,go as K,Sn as Kn,Ni as Kt,jo as L,In as Ln,Pi as Lt,$o as M,Kn as Mn,Ki as Mt,Go as N,qn as Nn,Hi as Nt,hs as O,gr as On,$i as Ot,Wo as P,Bn as Pn,Vi as Pt,ao as Q,ln as Qn,F as Qt,q as R,Nn as Rn,Ii as Rt,Ns as S,Ur as Sn,Ja as St,Fs as T,Fr as Tn,ea as Tt,vo as U,An as Un,Ai as Ut,K as V,Mn as Vn,Li as Vt,_o as W,Cn as Wn,Mi as Wt,uo as X,dn as Xn,bi as Xt,ho as Y,hn as Yn,xi as Yt,fo as Z,pn as Zn,ki as Zt,Z as _,qr as _n,ha as _t,tc as a,ai as an,no as at,Ms as b,Br as bn,La as bt,Q as c,ei as cn,io as ct,sc as d,si as dn,Ya as dt,fi as en,co as et,hc as f,ri as fn,H as ft,gc as g,Gr as gn,Oa as gt,lc as h,Jr as hn,qa as ht,ic as i,ii as in,ro as it,J as j,Xn as jn,Gi as jt,ps as k,mr as kn,Ji as kt,Xs as l,Qr as ln,Qa as lt,uc as m,Zr as mn,Ga as mt,oc as n,li as nn,lo as nt,$s as o,N as on,$a as ot,dc as p,ni as pn,Ha as pt,mo as q,xn as qn,Di as qt,qs as r,di as rn,eo as rt,Qs as s,ti as sn,to as st,fc as t,ui as tn,so as tt,cc as u,$r as un,Za as ut,pc as v,Wr as vn,G as vt,Is as w,Lr as wn,ra as wt,Ps as x,Rr as xn,Ra as xt,nc as y,Kr as yn,Ma as yt,To as z,Pn as zn,zi as zt};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A as t,E as n,M as r,T as i,n as a,r as o,t as s}from"./lazySchema-DcIJE_0i.js";import{en as c}from"./state-ix0xIunV.js";import{VE as l,Za as u}from"./loadAgentsDir-Clu7Uk6a.js";import{z as d}from"./debug-BrXObCdR.js";import{g as f}from"./settings-Dlp5JTa_.js";import{g as p}from"./config-3m_9zSrj.js";import{_ as m,j as h}from"./git-Do0wJvux.js";import{u as g}from"./oauth-BqJqV-2M.js";import{Bt as _,wi as v}from"./model-BQF64tZx.js";import"path";import"fs/promises";var y,b=e((()=>{o(),s(),y=a(()=>n({entries:t(r(),r())})),a(()=>n({userId:r(),version:i(),lastModified:r(),checksum:r(),content:y()}))})),x=e((()=>{c(),g(),_(),l(),p(),h(),d(),m(),v(),f(),u(),b()}));export{x as t};
@@ -0,0 +1,3 @@
1
+ import{l as e,o as t,s as n}from"./envUtils-DSxRz_kt.js";import{di as r,ui as i}from"./src-CDCSSo0U2.js";import{$n as a,Zn as o,en as s,ht as c,ot as l,vr as u,z as d}from"./state-ix0xIunV.js";import{Ci as f,Et as p,Gp as m,IE as h,Pt as g,Qi as _,RC as v,St as y,VE as b,Wp as x,XS as S,YS as ee,ZS as te,bt as ne,fb as C,jr as w,nb as T,qi as E,rb as D,ub as O,vn as k,yn as A,yt as j,zC as M}from"./loadAgentsDir-Clu7Uk6a.js";import{n as N,t as P}from"./cwd-CYmmnQVS.js";import{F,z as I}from"./debug-BrXObCdR.js";import{Jt as L,Zt as R}from"./settings-Dlp5JTa_.js";import{c as z,g as B,o as V}from"./config-3m_9zSrj.js";import{M as H,_ as U,d as W,j as G,n as K,r as re}from"./git-Do0wJvux.js";import{o as q,s as J}from"./log-BMCygSzM.js";import{n as Y,r as X}from"./analytics-BotDBGh0.js";import{i as Z,n as ie}from"./startupProfiler-xa3NmN7Z.js";import{Bt as ae,rn as oe}from"./model-BQF64tZx.js";import{ft as se,ut as Q}from"./esm-CGoYrggU.js";import{l as ce,u as le}from"./terminalSetup-D_P5iZmq.js";import{c as ue,n as de}from"./releaseNotes-CunqVlbU.js";import{s as fe,u as pe}from"./logoV2Utils-YHBJLIrC.js";import{c as $,t as me}from"./nativeInstaller-OPuO2sm_.js";import{i as he,r as ge}from"./runtimeObserver-Dm3LIUMp.js";import{n as _e,r as ve}from"./sessionMemory-btARBn8H.js";import{t as ye}from"./sinks-1hFrW9HK.js";r(),Y(),N(),ue(),x(),s(),_(),ve(),he(),M(),le(),ae(),b(),B(),G(),R(),se(),t(),I(),U(),T(),S(),A(),q(),pe(),me(),C(),w(),ie(),p();async function be(t,r,s,p,_,b,x,S,C){H(`info`,`setup_started`);let w=process.version.match(/^v(\d+)\./)?.[1];if((!w||parseInt(w,10)<18)&&(console.error(i.bold.red(`Error: Work Mate requires Node.js version 18 or higher.`)),process.exit(1)),x&&u(v(x)),n(),!d())try{let e=await ce();e.status===`restored`?console.log(i.yellow(`Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect.`)):e.status===`failed`&&console.error(i.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){J(e)}m(t);let T=Date.now();if(ee(),H(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-T}),D(t),p){let e=k(),n=await W();!e&&!n&&(process.stderr.write(i.red(`Error: Can only use --worktree in a git repository, but ${i.bold(t)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.\n`)),process.exit(1));let r=S?`pr-${S}`:_??O(),s;if(n){let e=K(P());e||(process.stderr.write(i.red(`Error: Could not determine the main git repository root.
2
+ `)),process.exit(1)),e!==(re(P())??P())&&(H(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),m(e)),s=b?y(e,g(r)):void 0}else s=b?y(P(),g(r)):void 0;let l;try{l=await ne(c(),r,s,S?{prNumber:S}:void 0)}catch(e){process.stderr.write(i.red(`Error creating worktree: ${F(e)}\n`)),process.exit(1)}if(X(`tengu_worktree_created`,{tmux_enabled:b}),b&&s){let e=await j(s,l.worktreePath);e.created?console.log(i.green(`Created tmux session: ${i.bold(s)}\nTo attach: ${i.bold(`tmux attach -t ${s}`)}`)):console.error(i.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(l.worktreePath),m(l.worktreePath),o(P()),a(P()),f(l),h(),te()}H(`info`,`setup_background_jobs_starting`),n()||(_e(),ge()),$(),H(`info`,`setup_background_jobs_launched`),Z(`setup_before_prefetch`),H(`info`,`setup_prefetch_starting`);let A=d()&&e(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)||n();if(A||E(l()),import(`./loadPluginHooks-Cvd5VdjQ.js`).then(e=>{A||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),n()||(process.env.USER_TYPE===`ant`&&import(`./commitAttribution-D6J3NuhB.js`).then(async e=>{if(await e.isInternalModelRepo()){let{clearSystemPromptSections:e}=await import(`./systemPromptSections-CR_AoPIX.js`);e()}}),setImmediate(()=>{import(`./attributionHooks-CUAoGkU6.js`).then(({registerAttributionHooks:e})=>{e()})}),import(`./sessionFileAccessHooks-B_nNW0zE.js`).then(e=>e.registerSessionFileAccessHooks())),ye(),X(`tengu_started`,{}),oe(d()),Z(`setup_after_prefetch`),!n()){let{hasReleaseNotes:e}=await de(z().lastReleaseNotesSeen);e&&await fe()}if(r===`bypassPermissions`||s){if(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!e(process.env.CLAUDE_CODE_BUBBLEWRAP))if(process.stdin.isTTY){console.error(i.bold.red(`WARNING: Running as root/sudo with bypass permissions mode is dangerous.`)),console.error(i.yellow(`Bypass mode skips ALL permission checks. Combined with root, any command (rm -rf /, chmod, dd) executes without review.`));let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout}),t=await new Promise(t=>{e.question(`
3
+ I understand the risks. Continue? [y/N] `,t)});e.close(),t.trim().toLowerCase()!==`y`&&(console.error(`Aborted.`),process.exit(1))}else console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1);if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`claude-desktop`){let[e,t]=await Promise.all([Q.getIsDocker(),L.hasInternetAccess()]),n=Q.getIsBubblewrapSandbox(),r=process.env.IS_SANDBOX===`1`;(!(e||n||r)||t)&&(console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${e}, Bubblewrap: ${n}, IS_SANDBOX: ${r}, hasInternet: ${t}`),process.exit(1))}}let M=V();M.lastCost!==void 0&&M.lastDuration!==void 0&&X(`tengu_exit`,{last_session_cost:M.lastCost,last_session_api_duration:M.lastAPIDuration,last_session_tool_duration:M.lastToolDuration,last_session_duration:M.lastDuration,last_session_lines_added:M.lastLinesAdded,last_session_lines_removed:M.lastLinesRemoved,last_session_total_input_tokens:M.lastTotalInputTokens,last_session_total_output_tokens:M.lastTotalOutputTokens,last_session_total_cache_creation_input_tokens:M.lastTotalCacheCreationInputTokens,last_session_total_cache_read_input_tokens:M.lastTotalCacheReadInputTokens,last_session_fps_average:M.lastFpsAverage,last_session_fps_low_1_pct:M.lastFpsLow1Pct,last_session_id:M.lastSessionId,...M.lastSessionMetrics})}export{be as setup};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{G as t,H as n,K as r,U as i,V as a}from"./loadAgentsDir-DrDu5yYy.js";import{bn as o}from"./prompt-C0nU0VK3.js";function s(e){return e===`projectSettings`||e===`policySettings`||e===`command`}function c(e){return r(e)}function l(e,t,n){let r=c(t.source),i=c(n.source),a=t.ruleValue.toolName;return e===`deny`?`Remove the "${a}" deny rule from ${r}, or remove the specific allow rule from ${i}`:`Remove the "${a}" ask rule from ${r}, or remove the specific allow rule from ${i}`}function u(e,t,n){let{toolName:r,ruleContent:i}=e.ruleValue;if(i===void 0)return{shadowed:!1};let a=t.find(e=>e.ruleValue.toolName===r&&e.ruleValue.ruleContent===void 0);return!a||r===`Bash`&&n.sandboxAutoAllowEnabled&&!s(a.source)?{shadowed:!1}:{shadowed:!0,shadowedBy:a,shadowType:`ask`}}function d(e,t){let{toolName:n,ruleContent:r}=e.ruleValue;if(r===void 0)return{shadowed:!1};let i=t.find(e=>e.ruleValue.toolName===n&&e.ruleValue.ruleContent===void 0);return i?{shadowed:!0,shadowedBy:i,shadowType:`deny`}:{shadowed:!1}}function f(e,t){let r=[],o=a(e),s=n(e),f=i(e);for(let e of o){let n=d(e,f);if(n.shadowed){let t=c(n.shadowedBy.source);r.push({rule:e,reason:`Blocked by "${n.shadowedBy.ruleValue.toolName}" deny rule (from ${t})`,shadowedBy:n.shadowedBy,shadowType:`deny`,fix:l(`deny`,n.shadowedBy,e)});continue}let i=u(e,s,t);if(i.shadowed){let t=c(i.shadowedBy.source);r.push({rule:e,reason:`Shadowed by "${i.shadowedBy.ruleValue.toolName}" ask rule (from ${t})`,shadowedBy:i.shadowedBy,shadowType:`ask`,fix:l(`ask`,i.shadowedBy,e)})}}return r}var p=e((()=>{o(),t()}));export{p as n,f as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{G as t,H as n,K as r,U as i,V as a}from"./loadAgentsDir-Clu7Uk6a.js";import{bn as o}from"./prompt-Bg_1U0gO.js";function s(e){return e===`projectSettings`||e===`policySettings`||e===`command`}function c(e){return r(e)}function l(e,t,n){let r=c(t.source),i=c(n.source),a=t.ruleValue.toolName;return e===`deny`?`Remove the "${a}" deny rule from ${r}, or remove the specific allow rule from ${i}`:`Remove the "${a}" ask rule from ${r}, or remove the specific allow rule from ${i}`}function u(e,t,n){let{toolName:r,ruleContent:i}=e.ruleValue;if(i===void 0)return{shadowed:!1};let a=t.find(e=>e.ruleValue.toolName===r&&e.ruleValue.ruleContent===void 0);return!a||r===`Bash`&&n.sandboxAutoAllowEnabled&&!s(a.source)?{shadowed:!1}:{shadowed:!0,shadowedBy:a,shadowType:`ask`}}function d(e,t){let{toolName:n,ruleContent:r}=e.ruleValue;if(r===void 0)return{shadowed:!1};let i=t.find(e=>e.ruleValue.toolName===n&&e.ruleValue.ruleContent===void 0);return i?{shadowed:!0,shadowedBy:i,shadowType:`deny`}:{shadowed:!1}}function f(e,t){let r=[],o=a(e),s=n(e),f=i(e);for(let e of o){let n=d(e,f);if(n.shadowed){let t=c(n.shadowedBy.source);r.push({rule:e,reason:`Blocked by "${n.shadowedBy.ruleValue.toolName}" deny rule (from ${t})`,shadowedBy:n.shadowedBy,shadowType:`deny`,fix:l(`deny`,n.shadowedBy,e)});continue}let i=u(e,s,t);if(i.shadowed){let t=c(i.shadowedBy.source);r.push({rule:e,reason:`Shadowed by "${i.shadowedBy.ruleValue.toolName}" ask rule (from ${t})`,shadowedBy:i.shadowedBy,shadowType:`ask`,fix:l(`ask`,i.shadowedBy,e)})}}return r}var p=e((()=>{o(),t()}));export{p as n,f as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Al as t,Ml as n,So as r,To as i,zo as a}from"./loadAgentsDir-DrDu5yYy.js";import{P as o,U as s}from"./rcDebugLog-2-1XSyFV.js";function c(e){let t=[],n=e.matchAll(d);for(let e of n)e.index!==void 0&&t.push({word:e[0],start:e.index,end:e.index+e[0].length});return t}async function l({question:e,cacheSafeParams:t}){let i=await n({promptMessages:[r({content:`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Al as t,Ml as n,So as r,To as i,zo as a}from"./loadAgentsDir-Clu7Uk6a.js";import{P as o,U as s}from"./rcDebugLog-VKwMl0yg.js";function c(e){let t=[],n=e.matchAll(d);for(let e of n)e.index!==void 0&&t.push({word:e[0],start:e.index,end:e.index+e[0].length});return t}async function l({question:e,cacheSafeParams:t}){let i=await n({promptMessages:[r({content:`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
2
2
 
3
3
  IMPORTANT CONTEXT:
4
4
  - You are a separate, lightweight agent spawned to answer this one question
@@ -1,2 +1,2 @@
1
- import{n as e,t}from"./axios-DaWTGg7G.js";import{en as n,ht as r}from"./state-ix0xIunV.js";import{S as i,a,at as o,d as s,l as c,nt as l,ot as u,p as d,rt as f,w as p}from"./debug-BrXObCdR.js";import{o as m,r as h,t as g,v as _,y as v}from"./log-BMCygSzM.js";import{a as y,n as b,t as x}from"./analytics-BotDBGh0.js";import{a as S,n as C,o as w}from"./firstPartyEventLogger-CQdJn3LV.js";import{r as T,t as E}from"./datadog-D9rlcN12.js";import{dirname as D,join as O}from"path";t(),n(),u(),v(),l(),a(),d(),m(),i();var k=h(new Date);function A(){return O(_.errors(),k+`.jsonl`)}function j(e){return O(_.mcpLogs(e),k+`.jsonl`)}function M(e){let t=o(e);return{write(e){t.write(p(e)+`
2
- `)},flush:t.flush,dispose:t.dispose}}var N=new Map;function P(e){let t=N.get(e);if(!t){let n=D(e);t=M({writeFn:t=>{try{s().appendFileSync(e,t)}catch{s().mkdirSync(n),s().appendFileSync(e,t)}},flushIntervalMs:1e3,maxBufferSize:50}),N.set(e,t),f(async()=>t?.dispose())}return t}function F(e,t){if(process.env.USER_TYPE!==`ant`)return;let n={timestamp:new Date().toISOString(),...t,cwd:s().cwd(),userType:process.env.USER_TYPE,sessionId:r(),version:`0.0.3`};P(e).write(n)}function I(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`)return t.message;if(typeof t.error==`object`&&t.error&&`message`in t.error&&typeof t.error.message==`string`)return t.error.message}}function L(t){let n=t.stack||t.message,r=``;if(e.isAxiosError(t)&&t.config?.url){let e=[`url=${t.config.url}`];t.response?.status!==void 0&&e.push(`status=${t.response.status}`);let n=I(t.response?.data);n&&e.push(`body=${n}`),r=`[${e.join(`,`)}] `}c(`${t.name}: ${r}${n}`,{level:`error`}),F(A(),{error:`${r}${n}`})}function R(e,t){c(`MCP server "${e}" ${t}`,{level:`error`});let n=j(e),i={error:t instanceof Error?t.stack||t.message:String(t),timestamp:new Date().toISOString(),sessionId:r(),cwd:s().cwd()};P(n).write(i)}function z(e,t){c(`MCP server "${e}": ${t}`);let n=j(e),i={debug:t,timestamp:new Date().toISOString(),sessionId:r(),cwd:s().cwd()};P(n).write(i)}function B(){g({logError:L,logMCPError:R,logMCPDebug:z,getErrorsPath:A,getMCPLogsPath:j}),c(`Error log sink initialized`)}E(),C(),b();function V(){return!1}function H(e,t){let n=w(e);if(n===0)return;let r=n===null?t:{...t,sample_rate:n};V()&&T(e,y(r)),S(e,r)}function U(e,t){return H(e,t),Promise.resolve()}function W(){x({logEvent:H,logEventAsync:U})}function G(){B(),W()}export{G as t};
1
+ import{n as e,t}from"./axios-DaWTGg7G.js";import{en as n,ht as r}from"./state-ix0xIunV.js";import{S as i,a,at as o,d as s,l as c,nt as l,ot as u,p as d,rt as f,w as p}from"./debug-BrXObCdR.js";import{o as m,r as h,t as g,v as _,y as v}from"./log-BMCygSzM.js";import{a as y,n as b,t as x}from"./analytics-BotDBGh0.js";import{a as S,n as C,o as w}from"./firstPartyEventLogger-BNGPPBNP.js";import{r as T,t as E}from"./datadog-UkGdjL8-.js";import{dirname as D,join as O}from"path";t(),n(),u(),v(),l(),a(),d(),m(),i();var k=h(new Date);function A(){return O(_.errors(),k+`.jsonl`)}function j(e){return O(_.mcpLogs(e),k+`.jsonl`)}function M(e){let t=o(e);return{write(e){t.write(p(e)+`
2
+ `)},flush:t.flush,dispose:t.dispose}}var N=new Map;function P(e){let t=N.get(e);if(!t){let n=D(e);t=M({writeFn:t=>{try{s().appendFileSync(e,t)}catch{s().mkdirSync(n),s().appendFileSync(e,t)}},flushIntervalMs:1e3,maxBufferSize:50}),N.set(e,t),f(async()=>t?.dispose())}return t}function F(e,t){if(process.env.USER_TYPE!==`ant`)return;let n={timestamp:new Date().toISOString(),...t,cwd:s().cwd(),userType:process.env.USER_TYPE,sessionId:r(),version:`0.0.5`};P(e).write(n)}function I(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`)return t.message;if(typeof t.error==`object`&&t.error&&`message`in t.error&&typeof t.error.message==`string`)return t.error.message}}function L(t){let n=t.stack||t.message,r=``;if(e.isAxiosError(t)&&t.config?.url){let e=[`url=${t.config.url}`];t.response?.status!==void 0&&e.push(`status=${t.response.status}`);let n=I(t.response?.data);n&&e.push(`body=${n}`),r=`[${e.join(`,`)}] `}c(`${t.name}: ${r}${n}`,{level:`error`}),F(A(),{error:`${r}${n}`})}function R(e,t){c(`MCP server "${e}" ${t}`,{level:`error`});let n=j(e),i={error:t instanceof Error?t.stack||t.message:String(t),timestamp:new Date().toISOString(),sessionId:r(),cwd:s().cwd()};P(n).write(i)}function z(e,t){c(`MCP server "${e}": ${t}`);let n=j(e),i={debug:t,timestamp:new Date().toISOString(),sessionId:r(),cwd:s().cwd()};P(n).write(i)}function B(){g({logError:L,logMCPError:R,logMCPDebug:z,getErrorsPath:A,getMCPLogsPath:j}),c(`Error log sink initialized`)}E(),C(),b();function V(){return!1}function H(e,t){let n=w(e);if(n===0)return;let r=n===null?t:{...t,sample_rate:n};V()&&T(e,y(r)),S(e,r)}function U(e,t){return H(e,t),Promise.resolve()}function W(){x({logEvent:H,logEventAsync:U})}function G(){B(),W()}export{G as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./sinks-1hFrW9HK.js";export{e as initSinks};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{c as r,d as i,f as a}from"./skillGenerator-CwXUfM4Y.js";import{d as o,g as s,h as c,l,m as u,p as d,x as f}from"./runtimeObserver-XufSllVw.js";import{o as p,r as m}from"./observationStore-DzCdXq8U.js";import{o as h,s as g}from"./projectContext-D9MDwJUF.js";import{t as _}from"./sessionObserver-B_09FQKV.js";import{i as v,r as y}from"./skillGapStore-75ZYlfwi.js";import{t as b}from"./skillLearning-CB-5fdMl.js";import{join as x}from"node:path";function S(e,t){let n=e.find(e=>e.startsWith(`${t}=`));if(n)return n.slice(t.length+1)||void 0;let r=e.indexOf(t);if(r>=0&&e[r+1]&&!e[r+1].startsWith(`--`))return e[r+1]}function C(e,t,n){let r=S(e,t);if(r===void 0)return n;let i=Number(r);return Number.isFinite(i)?i:n}var w;e((()=>{n(),b(),w=async e=>{let n=e.trim().split(/\s+/).filter(Boolean),b=n[0]??`status`,w=g(process.cwd()),T=process.env.CLAUDE_SKILL_LEARNING_HOME,E={project:w,rootDir:T};switch(b){case`status`:{let[e,t]=await Promise.all([p(E),d(E)]);return{type:`text`,value:[`Skill Learning status for ${w.projectName} (${w.projectId})`,`Observations: ${e.length}`,`Instincts: ${t.length}`].join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{c as r,d as i,f as a}from"./skillGenerator-BT8NGzXT.js";import{d as o,g as s,h as c,l,m as u,p as d,x as f}from"./runtimeObserver-Dm3LIUMp.js";import{o as p,r as m}from"./observationStore-DzCdXq8U.js";import{o as h,s as g}from"./projectContext-D9MDwJUF.js";import{t as _}from"./sessionObserver-CSOYgsvH.js";import{i as v,r as y}from"./skillGapStore-DyqNKuNy.js";import{t as b}from"./skillLearning-Cn9Uw0Kd.js";import{join as x}from"node:path";function S(e,t){let n=e.find(e=>e.startsWith(`${t}=`));if(n)return n.slice(t.length+1)||void 0;let r=e.indexOf(t);if(r>=0&&e[r+1]&&!e[r+1].startsWith(`--`))return e[r+1]}function C(e,t,n){let r=S(e,t);if(r===void 0)return n;let i=Number(r);return Number.isFinite(i)?i:n}var w;e((()=>{n(),b(),w=async e=>{let n=e.trim().split(/\s+/).filter(Boolean),b=n[0]??`status`,w=g(process.cwd()),T=process.env.CLAUDE_SKILL_LEARNING_HOME,E={project:w,rootDir:T};switch(b){case`status`:{let[e,t]=await Promise.all([p(E),d(E)]);return{type:`text`,value:[`Skill Learning status for ${w.projectName} (${w.projectId})`,`Observations: ${e.length}`,`Instincts: ${t.length}`].join(`
2
2
  `)}}case`ingest`:{let e=n[1];if(!e)return{type:`text`,value:`Usage: /skill-learning ingest <transcript.jsonl> [--min-session-length=<n>]`};let t=C(n,`--min-session-length`,10),r=await m(e,E);if(r.length<t)return{type:`text`,value:`Session too short for learning (${r.length} < min=${t}). Skipping instinct extraction.`};let i=_(r),a=[];for(let e of i)a.push(await s(e,E));return{type:`text`,value:`Ingested ${r.length} observations and saved ${a.length} instincts.`}}case`evolve`:{let e=n.includes(`--generate`),o=f(await d(E),{cwd:process.cwd()}),s=[];if(e)for(let e of o){let n=a(e,await i(e,[x(process.cwd(),`.claude`,`skills`),x(t(),`skills`)])),o=await r(n);s.push(`${n.type}: ${o.activePath??o.archivedPath??o.deletedPath??`no active write`}`)}return{type:`text`,value:e?`Generated ${s.length} learned skill(s):\n${s.join(`
3
3
  `)}`:`Found ${o.length} skill candidate(s). Use --generate to write them.`}}case`export`:{let e=n[1]??`skill-learning-instincts.json`,t=S(n,`--scope`),r=C(n,`--min-conf`,void 0),i=S(n,`--domain`),a=e=>e.filter(e=>!(t&&e.scope!==t||r!==void 0&&e.confidence<r||i&&e.domain!==i)),s=await d(E),c=a(s);if(c.length!==s.length){await o(e,E);let{writeFile:t}=await import(`node:fs/promises`);await t(e,`${JSON.stringify(c,null,2)}\n`)}else await o(e,E);let l=[`Exported ${c.length} instincts to ${e}`];if(t||r!==void 0||i){let e=[];t&&e.push(`scope=${t}`),r!==void 0&&e.push(`min-conf=${r}`),i&&e.push(`domain=${i}`),l.push(`(filters: ${e.join(`, `)})`)}return{type:`text`,value:l.join(` `)}}case`import`:{let e=n[1];if(!e)return{type:`text`,value:`Usage: /skill-learning import <instincts.json> [--scope=<scope>] [--min-conf=<n>] [--domain=<d>] [--dry-run]`};let t=S(n,`--scope`),r=C(n,`--min-conf`,void 0),i=S(n,`--domain`),a=n.includes(`--dry-run`),{readFile:o}=await import(`node:fs/promises`),c=JSON.parse(await o(e,`utf8`)),l=c.filter(e=>!(t&&e.scope!==t||r!==void 0&&e.confidence<r||i&&e.domain!==i));if(a)return{type:`text`,value:`Dry run: would import ${l.length}/${c.length} instincts.`};for(let e of l)await s(e,E);return{type:`text`,value:`Imported ${l.length}/${c.length} instincts.`}}case`prune`:{let e=n.indexOf(`--max-age`);return{type:`text`,value:`Pruned ${(await u(e>=0&&n[e+1]?Number(n[e+1]):30,E)).length} pending instincts.`}}case`promote`:{let e=n[1];if(!e){let e=await v(w,T),t=l(await d(E));return{type:`text`,value:[`Promotion candidates for ${w.projectName} (${w.projectId}):`,`Pending gaps: ${e.filter(e=>e.status===`pending`).length}`,`Global-eligible instincts (>=2 projects, avg confidence >=0.8): ${t.length}`,``,`Usage:`,` /skill-learning promote gap <gap-key> # pending gap -> draft`,` /skill-learning promote instinct <instinct-id> # project instinct -> global`].join(`
4
4
  `)}}if(e===`gap`){let e=n[2];if(!e)return{type:`text`,value:`Usage: /skill-learning promote gap <gap-key>`};let t=await y(e,w,T);return t?{type:`text`,value:`Promoted gap ${e} to status=${t.status} (draft=${t.draft?.skillPath??`none`}).`}:{type:`text`,value:`No gap found for key "${e}".`}}if(e===`instinct`){let e=n[2];if(!e)return{type:`text`,value:`Usage: /skill-learning promote instinct <instinct-id>`};let t=(await d(E)).find(t=>t.id===e);return t?t.scope===`global`?{type:`text`,value:`Instinct ${e} is already global.`}:(await c({...t,scope:`global`},{scope:`global`,rootDir:T}),{type:`text`,value:`Promoted instinct ${e} to global scope.`}):{type:`text`,value:`No project-scoped instinct found for id "${e}".`}}return{type:`text`,value:`Usage: /skill-learning promote [gap <gap-key>|instinct <instinct-id>]`}}case`projects`:{let e=h();if(e.length===0)return{type:`text`,value:`No known project scopes yet.`};let t=[`Known project scopes:`];for(let n of e){let e={project:n,rootDir:T},[r,i]=await Promise.all([d(e),p(e)]);t.push(`- ${n.projectName} (${n.projectId}) — instincts: ${r.length}, observations: ${i.length}, lastSeen: ${n.lastSeenAt}`)}return{type:`text`,value:t.join(`