@readmagic/workmate 0.0.17 → 0.0.19

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 (385) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-YAhnVwyN.js → AddWorkspaceDirectory-9FcHMKgX.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-Bny8WDwC.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-Ba4GYFl3.js → AgentsMdExternalIncludesDialog-DLnj3JQO.js} +1 -1
  4. package/dist/chunks/{App-mri25OrC.js → App-NkBqbDbC.js} +1 -1
  5. package/dist/chunks/ApproveApiKey-BKzkEkW-.js +1 -0
  6. package/dist/chunks/{ApproveApiKey-DCw6d7dm.js → ApproveApiKey-rgB6AsYD.js} +1 -1
  7. package/dist/chunks/BackgroundTasksDialog-CcViruUO.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-B5QBJTB4.js → BypassPermissionsModeDialog-D254L98G.js} +1 -1
  9. package/dist/chunks/{DiffDialog-Bd-DcTsK.js → DiffDialog-6Srcz3NW.js} +2 -2
  10. package/dist/chunks/Doctor-DYEdLRxR.js +1 -0
  11. package/dist/chunks/Doctor-DiNxlXfC.js +3 -0
  12. package/dist/chunks/ExitFlow-Bt2De110.js +2 -0
  13. package/dist/chunks/{Grove-CClEZT2e.js → Grove-DC4jyxeB.js} +1 -1
  14. package/dist/chunks/{HybridTransport-DyEuslQB.js → HybridTransport-DArmWb1V.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-Wyrk_cXR.js → InvalidConfigDialog-DFiB0Kzc.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-Cr9fmSyh.js → InvalidSettingsDialog-BHNo2__T.js} +1 -1
  17. package/dist/chunks/MCPConnectionManager-CdpO2Tj9.js +1 -0
  18. package/dist/chunks/MCPToolListView-Ch4jOk_x.js +1 -0
  19. package/dist/chunks/{McpParsingWarnings-BF4np2Y3.js → McpParsingWarnings-D4UQ8Q2e.js} +1 -1
  20. package/dist/chunks/MessageSelector-BgsrdJur.js +3 -0
  21. package/dist/chunks/Messages-DB1pmDY_.js +10 -0
  22. package/dist/chunks/{Onboarding-BAJXV7Ay.js → Onboarding-BnjdTwci.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-Cm4WN3qd.js → PromptInputFooterSuggestions-Chg9U-BC.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-ESj8sOpK.js → PromptInputHelpMenu-C0ZSo12s.js} +1 -1
  25. package/dist/chunks/QueryEngine-bKlupZpA.js +1 -0
  26. package/dist/chunks/REPL-Cg8UXYpX.js +128 -0
  27. package/dist/chunks/REPL-yzvMFfaU.js +1 -0
  28. package/dist/chunks/RemoteSessionManager-CRWOHvKf.js +2 -0
  29. package/dist/chunks/{ResumeConversation-NSVT3gn7.js → ResumeConversation-Ld7tYLKO.js} +1 -1
  30. package/dist/chunks/{SSETransport-CDGMGrxN.js → SSETransport-pPrlSZNF.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-CdgQlm--.js +1 -0
  32. package/dist/chunks/Settings-CsOlPcIW.js +2 -0
  33. package/dist/chunks/{TeleportProgress-8cS6aHVO.js → TeleportProgress-Di-PMey7.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-B0epkMgp.js → TeleportRepoMismatchDialog-CDv1cbo-.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-Bb14JeEk.js → TeleportResumeWrapper-Bmf13tGU.js} +1 -1
  36. package/dist/chunks/{ThemePicker-CnX8faYA.js → ThemePicker-B3AO3_jA.js} +1 -1
  37. package/dist/chunks/{TrustDialog-6wJF3W6K.js → TrustDialog-C0aiR_LU.js} +1 -1
  38. package/dist/chunks/{ValidationErrorsList-Cuq6W2yc.js → ValidationErrorsList-BfZ5gcIv.js} +1 -1
  39. package/dist/chunks/add-dir-w1Ay3861.js +1 -0
  40. package/dist/chunks/{agentDisplay-QqGqcHGz.js → agentDisplay-D01ZlnVX.js} +1 -1
  41. package/dist/chunks/agents-B_hUgPnR.js +101 -0
  42. package/dist/chunks/{agents-DFPEienW.js → agents-Bxenhf8S.js} +1 -1
  43. package/dist/chunks/allErrors-C_iHQOlK.js +1 -0
  44. package/dist/chunks/{api-B3Wnozaf.js → api-C5ULzZny.js} +1 -1
  45. package/dist/chunks/api-CB3e0De0.js +1 -0
  46. package/dist/chunks/auth-CsYEYXBO.js +1 -0
  47. package/dist/chunks/auth-CubXYcRl.js +1 -0
  48. package/dist/chunks/{auth-CQGJitIV.js → auth-DvcZHXGk.js} +1 -1
  49. package/dist/chunks/backgroundHousekeeping-BGKR5cdA.js +17 -0
  50. package/dist/chunks/backgroundHousekeeping-CykbtljP.js +1 -0
  51. package/dist/chunks/{banner-HfMnBd03.js → banner-BkUdig-T.js} +1 -1
  52. package/dist/chunks/{bg-DltfF1_K.js → bg-tGgpwpYx.js} +2 -2
  53. package/dist/chunks/branch-CqQxCSHG.js +2 -0
  54. package/dist/chunks/{break-cache-Cd1yQ-0h.js → break-cache-CcwOjTKt.js} +3 -3
  55. package/dist/chunks/bridgeConfig-Cp2x_wtE.js +1 -0
  56. package/dist/chunks/{bridgeConfig-B3mR0kJ0.js → bridgeConfig-MxsnEEPx.js} +1 -1
  57. package/dist/chunks/{bridgeMessaging-wZ5EKxW_.js → bridgeMessaging-Bx5pkkkx.js} +1 -1
  58. package/dist/chunks/bridgePointer-DfTOjgtX.js +1 -0
  59. package/dist/chunks/bridgeStatusUtil-B9EcQksI.js +1 -0
  60. package/dist/chunks/btw-DeznoRrw.js +1 -0
  61. package/dist/chunks/caches-BiVRgePi.js +1 -0
  62. package/dist/chunks/caches-CGzKSWiP.js +1 -0
  63. package/dist/chunks/{capacityWake-LRiPhPeM.js → capacityWake-BpP6c7x3.js} +1 -1
  64. package/dist/chunks/{ccrClient-EisctZbc.js → ccrClient-CimQTd0b.js} +1 -1
  65. package/dist/chunks/{claudeDesktop-CB3UCt7U.js → claudeDesktop-DPc_SaVn.js} +1 -1
  66. package/dist/chunks/{clear-BjtPf2Jb.js → clear-KvoD-lFN.js} +1 -1
  67. package/dist/chunks/{cliLaunch-xIVvtPZy.js → cliLaunch-DDtwAolw.js} +1 -1
  68. package/dist/chunks/{client-DNEVh6Wu.js → client-9uHzAmFH.js} +1 -1
  69. package/dist/chunks/client-BVal_QII.js +1 -0
  70. package/dist/chunks/{client-Bb2eZnuq.js → client-C_jBL1yC.js} +1 -1
  71. package/dist/chunks/client-CmnPWgLq.js +1 -0
  72. package/dist/chunks/client-Dd7CKMRX.js +1 -0
  73. package/dist/chunks/commands-CrzVgHxp.js +1 -0
  74. package/dist/chunks/{compact-w8AhLkr6.js → compact-Dgzve3dI.js} +2 -2
  75. package/dist/chunks/{config-BSkuQZNf.js → config-DRy1I12M.js} +2 -2
  76. package/dist/chunks/config-Df8jooTW.js +1 -0
  77. package/dist/chunks/{config-D78R57VA.js → config-e0Goy478.js} +1 -1
  78. package/dist/chunks/{context-Btn2JU2y.js → context-Dz-bbYCw.js} +1 -1
  79. package/dist/chunks/{context-noninteractive-044464Vs.js → context-noninteractive-ApbVPU86.js} +5 -5
  80. package/dist/chunks/context-noninteractive-m4O3VtG7.js +1 -0
  81. package/dist/chunks/conversation-BYBX07j8.js +1 -0
  82. package/dist/chunks/conversation-CJ-d0O-U.js +1 -0
  83. package/dist/chunks/{createSSHSession-C0KSI0fJ.js → createSSHSession-DOz_Ox1_.js} +1 -1
  84. package/dist/chunks/createSession-C_-ZEQT5.js +1 -0
  85. package/dist/chunks/{createSession-8ScCWTKb.js → createSession-yR87Rhiv.js} +1 -1
  86. package/dist/chunks/crossProjectResume-DNnZo3gU.js +40 -0
  87. package/dist/chunks/cwd-DLK3znO7.js +1 -0
  88. package/dist/chunks/cwd-Nh5IZNKO.js +1 -0
  89. package/dist/chunks/{datadog-BqINRWAW.js → datadog-DBgIEaEd.js} +1 -1
  90. package/dist/chunks/{debug-BQj6h99Q.js → debug-D58GQBDG.js} +1 -1
  91. package/dist/chunks/{debugUtils-B86DM1Sp.js → debugUtils-DXBRbwCE.js} +1 -1
  92. package/dist/chunks/{detached--wGwkuHX.js → detached-Biz-xhu0.js} +1 -1
  93. package/dist/chunks/{detectRepository-Qy3zKoyn.js → detectRepository-CDOJ-M7h.js} +1 -1
  94. package/dist/chunks/detectRepository-Cv9-k6dg.js +1 -0
  95. package/dist/chunks/{diff-CcrSQNvQ.js → diff-qOom_T1G.js} +1 -1
  96. package/dist/chunks/{directoryCompletion-i2oWpaUe.js → directoryCompletion-BDGcGDuv.js} +1 -1
  97. package/dist/chunks/doctor-CflXjqVK.js +1 -0
  98. package/dist/chunks/{entry-oVZ7Z59B.js → entry-EmOA7oWN.js} +4 -4
  99. package/dist/chunks/{esm-BZciQG9N.js → esm-DBMVQDVv.js} +1 -1
  100. package/dist/chunks/{execFileNoThrow-DYm1GeGn.js → execFileNoThrow-Bmb5HEFz.js} +1 -1
  101. package/dist/chunks/{execSyncWrapper-CqvQqke-.js → execSyncWrapper-C3ZFV9od.js} +1 -1
  102. package/dist/chunks/{exit-jikLI2Zh.js → exit-DDrAFCzE.js} +1 -1
  103. package/dist/chunks/{extraUsage-BT3in1Aj.js → extraUsage-DylXI7Fc.js} +1 -1
  104. package/dist/chunks/extractMemories-B_8wZpXA.js +1 -0
  105. package/dist/chunks/fast-4ajfJv-M.js +1 -0
  106. package/dist/chunks/{fast-CKhtBOx7.js → fast-BCkhj9Dq.js} +1 -1
  107. package/dist/chunks/{fetchModelList-DmaMgpa2.js → fetchModelList-BbjuFHQT.js} +1 -1
  108. package/dist/chunks/fetchModelList-V8_e2O1N.js +1 -0
  109. package/dist/chunks/{fileSuggestions-BfG3sbET.js → fileSuggestions-Ct7vKEpR.js} +2 -2
  110. package/dist/chunks/{firstPartyEventLogger-Q3fMF0BR.js → firstPartyEventLogger-CxUuXQhL.js} +2 -2
  111. package/dist/chunks/firstPartyEventLogger-YQm0DoVu.js +1 -0
  112. package/dist/chunks/flushGate-BZe_QwEz.js +1 -0
  113. package/dist/chunks/{gemini-L8Gj2B4H.js → gemini-8sSwOtEf.js} +1 -1
  114. package/dist/chunks/{generateSessionName-cAL5T7pG.js → generateSessionName-vT1khubt.js} +1 -1
  115. package/dist/chunks/{genericProcessUtils-Bbcbi11g.js → genericProcessUtils-6E7fB1dI.js} +1 -1
  116. package/dist/chunks/{git-DplvjXEY.js → git-By_J4XJL.js} +1 -1
  117. package/dist/chunks/git-zJCasBa6.js +1 -0
  118. package/dist/chunks/githubRepoPathMapping-CzgPGOHQ.js +1 -0
  119. package/dist/chunks/{goal-D-x2WXm7.js → goal-CznQA1n1.js} +1 -1
  120. package/dist/chunks/{grok-DtypRM4d.js → grok-cEzUsG-s.js} +1 -1
  121. package/dist/chunks/{grove-CSivzrhe.js → grove--HtQL4QZ.js} +1 -1
  122. package/dist/chunks/{help-DKZhC0lL.js → help-B6A_kDQA.js} +1 -1
  123. package/dist/chunks/hooks-CJY5Vfy6.js +1 -0
  124. package/dist/chunks/{hooks-D_afUDcs.js → hooks-CN5hLrhi.js} +2 -2
  125. package/dist/chunks/initReplBridge-BJhmlcVt.js +1 -0
  126. package/dist/chunks/install-DUOtI2Hq.js +1 -0
  127. package/dist/chunks/{instrumentation-IljwxX0V.js → instrumentation-DpgB3GFx.js} +4 -4
  128. package/dist/chunks/{job-N25KhSUu.js → job-DDoX1iFe.js} +1 -1
  129. package/dist/chunks/{jwtUtils-YCoZL0FW.js → jwtUtils-C_LG1txt.js} +1 -1
  130. package/dist/chunks/keybindings-BGTuYfk-.js +1 -0
  131. package/dist/chunks/{launchLocalMemory-DJsuNLIf.js → launchLocalMemory-CoWeLNeP.js} +1 -1
  132. package/dist/chunks/{launchOnboarding-CVvuxeH-.js → launchOnboarding-CTIBGSLV.js} +1 -1
  133. package/dist/chunks/{external-CEp-aPkt.js → lazySchema-DULtBUCI.js} +1 -1
  134. package/dist/chunks/{loadAgentsDir-CbtNPJV3.js → loadAgentsDir-DXOkUcW3.js} +587 -597
  135. package/dist/chunks/loadAgentsDir-Dxz1vp3F.js +1 -0
  136. package/dist/chunks/{loadPluginHooks-BxkDBFd6.js → loadPluginHooks-DrNVtTBq.js} +1 -1
  137. package/dist/chunks/loader-C33o_5kS.js +1 -0
  138. package/dist/chunks/localSearch-CCs5fOd_.js +1 -0
  139. package/dist/chunks/{localSearch-B5mTHBwK.js → localSearch-DnT21UkF.js} +1 -1
  140. package/dist/chunks/{log-BlJ7CcKG.js → log-CZ7ploQm.js} +1 -1
  141. package/dist/chunks/{logoV2Utils-D5nRpirL.js → logoUtils-YwL3izJt.js} +1 -1
  142. package/dist/chunks/{magicDocs-C9aIo4Oe.js → magicDocs-rxv0rR8E.js} +2 -2
  143. package/dist/chunks/{main-DeUt_aE2.js → main-BOvY4O6D.js} +30 -30
  144. package/dist/chunks/{main-Zh18lf2J.js → main-Blm02_Js.js} +2 -2
  145. package/dist/chunks/managedEnv-CpgCYISH.js +1 -0
  146. package/dist/chunks/managedEnv-CrnBYTtQ.js +1 -0
  147. package/dist/chunks/{mappers-Del1KoA7.js → mappers-DYtq2XVS.js} +1 -1
  148. package/dist/chunks/mcp-BPvcoKDY.js +1 -0
  149. package/dist/chunks/mcp-BfqsHRx0.js +2 -0
  150. package/dist/chunks/mcp-BoU3TNFs.js +6 -0
  151. package/dist/chunks/{memoize-_2f7NWDv.js → memoize-CumjjK2Q.js} +1 -1
  152. package/dist/chunks/memory-BPKRdkBb.js +1 -0
  153. package/dist/chunks/{mode-DPbrxU32.js → mode-CXpXux2s.js} +1 -1
  154. package/dist/chunks/model-CxPYKiW1.js +1 -0
  155. package/dist/chunks/model-Cxx3suBa.js +1 -0
  156. package/dist/chunks/model-aEJ54cMA.js +1 -0
  157. package/dist/chunks/{modelOptions-SMq3one0.js → modelOptions-BqBHEyiR.js} +1 -1
  158. package/dist/chunks/{nativeInstaller-DTJ4clp-.js → nativeInstaller-CaXwRpoR.js} +1 -1
  159. package/dist/chunks/omit-DZUxsClb.js +1 -0
  160. package/dist/chunks/onChangeAppState-qHXqufwy.js +1 -0
  161. package/dist/chunks/{openai-D9KvLMrj.js → openai-_FQ9EhuR.js} +2 -2
  162. package/dist/chunks/{panel-Bg_0PHE6.js → panel-CVd1dzYl.js} +1 -1
  163. package/dist/chunks/parser-Cq9X7HMP.js +1 -0
  164. package/dist/chunks/{parser-a2S_eFyE.js → parser-eVu-cTRs.js} +1 -1
  165. package/dist/chunks/partition-BgwHlPsO.js +1 -0
  166. package/dist/chunks/permissions-Dv5d5Nu3.js +3 -0
  167. package/dist/chunks/pidLock-CEhbTkBE.js +3 -0
  168. package/dist/chunks/{plan-dG2H4eQl.js → plan-DVPBW5OS.js} +1 -1
  169. package/dist/chunks/{platform-DVeTi9mp.js → platform-DMQxcm4K.js} +1 -1
  170. package/dist/chunks/plugin-Bh2eBwLW.js +17 -0
  171. package/dist/chunks/{pluginAutoupdate-B9W_vxOG.js → pluginAutoupdate-C2YbEHrP.js} +1 -1
  172. package/dist/chunks/{pluginBlocklist-BvdBsnJG.js → pluginBlocklist-B2NAKaB9.js} +1 -1
  173. package/dist/chunks/{pluginCliCommands-NKIgFTUF.js → pluginCliCommands-Cw5TrYYb.js} +1 -1
  174. package/dist/chunks/{pluginFlagging-C0PtAJEg.js → pluginFlagging-BDTgCYuC.js} +1 -1
  175. package/dist/chunks/pluginOperations-BBwGEdfC.js +2 -0
  176. package/dist/chunks/pluginStartupCheck-CHx379_R.js +1 -0
  177. package/dist/chunks/{pluginStartupCheck-p0njap1l.js → pluginStartupCheck-DhhMk3dA.js} +1 -1
  178. package/dist/chunks/{plugins-B9WBqOAW.js → plugins-r0h93GT_.js} +4 -4
  179. package/dist/chunks/pollConfig-2nFzv6Hy.js +1 -0
  180. package/dist/chunks/poorMode-BTIe8W_H.js +1 -0
  181. package/dist/chunks/poorMode-CKQfWf3S.js +1 -0
  182. package/dist/chunks/print-CDzhHi2F.js +14 -0
  183. package/dist/chunks/processBashCommand-DmdCAWOR.js +1 -0
  184. package/dist/chunks/processSlashCommand-B43TkiaI.js +5 -0
  185. package/dist/chunks/prompt-C50mDqWv.js +1 -0
  186. package/dist/chunks/{prompt-BRGC5U9Y.js → prompt-DEioJrx_.js} +17 -17
  187. package/dist/chunks/prompt-WGH9CcXh.js +1 -0
  188. package/dist/chunks/{promptEditor-CRIw6vJS.js → promptEditor-eJzbtNn4.js} +1 -1
  189. package/dist/chunks/{protocolHandler--eQQuSyx.js → protocolHandler-C-CFTcUJ.js} +1 -1
  190. package/dist/chunks/{proxy-C0j74LqT.js → proxy-BhIc7-mj.js} +1 -1
  191. package/dist/chunks/reconciler-DZP4dJJG.js +1 -0
  192. package/dist/chunks/refresh-vaY-Sr80.js +1 -0
  193. package/dist/chunks/{registerProtocol-DrWIX3Lb.js → registerProtocol-Xsq4ldwg.js} +1 -1
  194. package/dist/chunks/{reload-plugins-Cl6wvT6V.js → reload-plugins-m9CzoIxu.js} +1 -1
  195. package/dist/chunks/{remoteBridgeCore-DnFZoXaw.js → remoteBridgeCore-C4vSr1gp.js} +1 -1
  196. package/dist/chunks/remoteManagedSettings-6RAHPt_g.js +1 -0
  197. package/dist/chunks/{rename-CdzxOzN5.js → rename-DmauGVBX.js} +1 -1
  198. package/dist/chunks/{renderOptions-CkqTbz6d.js → renderOptions-D-aQZbzS.js} +1 -1
  199. package/dist/chunks/resume-ut_pBrLN.js +2 -0
  200. package/dist/chunks/{ripgrep-DsLUmulz.js → ripgrep-C3jtZL7k.js} +1 -1
  201. package/dist/chunks/ripgrep-CBUbn6Po.js +1 -0
  202. package/dist/chunks/{runtimeObserver-Dov-m2dl.js → runtimeObserver-C2vjqtCE.js} +2 -2
  203. package/dist/chunks/{runtimeObserver-CwtRE2cj.js → runtimeObserver-CSroopId.js} +1 -1
  204. package/dist/chunks/sandbox-adapter-CL0qdcxn.js +1 -0
  205. package/dist/chunks/{sandbox-toggle-DWCrG9zV.js → sandbox-toggle-BJKd1ZYk.js} +1 -1
  206. package/dist/chunks/searchExtraTools-ByWuNCGo.js +1 -0
  207. package/dist/chunks/{session-L5191BSn.js → session-DTin6hOR.js} +1 -1
  208. package/dist/chunks/sessionFileAccessHooks-DorzHolr.js +1 -0
  209. package/dist/chunks/sessionObserver-Dy6NFlzL.js +1 -0
  210. package/dist/chunks/{sessionObserver-DpY0DOjI.js → sessionObserver-iAJLH92a.js} +1 -1
  211. package/dist/chunks/{sessionState-BlbRQ3Y6.js → sessionState-DAcub-HK.js} +2 -2
  212. package/dist/chunks/sessionStorage-DItJMkwx.js +1 -0
  213. package/dist/chunks/{sessionTracing-DqVx8aFD.js → sessionTracing-Dvi520eN.js} +1 -1
  214. package/dist/chunks/{settings-CvhsRFaT.js → settings-3xZ0fsvE.js} +5 -5
  215. package/dist/chunks/settings-Crx1cI1u.js +1 -0
  216. package/dist/chunks/settingsSync-aHn3p-6J.js +1 -0
  217. package/dist/chunks/setup-CK3ybjjM.js +3 -0
  218. package/dist/chunks/{shadowedRuleDetection-Gerk3t93.js → shadowedRuleDetection-BL7dEv-u.js} +1 -1
  219. package/dist/chunks/{shellQuote-D3Ocv_U-.js → shellQuote-Ddgr1vif.js} +1 -1
  220. package/dist/chunks/{sideQuestion-RndkXExy.js → sideQuestion-Ct87yvOR.js} +1 -1
  221. package/dist/chunks/{sinks-CfzgqLH5.js → sinks-Bmn3li0M.js} +1 -1
  222. package/dist/chunks/sinks-QQ_6Op7q.js +1 -0
  223. package/dist/chunks/skillChangeDetector-Bco3UoeW.js +1 -0
  224. package/dist/chunks/{skillGapStore-CLxhWLyq.js → skillGapStore-MtlRyYmT.js} +2 -2
  225. package/dist/chunks/{skillLifecycle-CSNX2qOH.js → skillLifecycle-Drs6gEv9.js} +2 -2
  226. package/dist/chunks/{skillSearchPanel-CsQDjy_E.js → skillSearchPanel-DkvmjNaw.js} +3 -3
  227. package/dist/chunks/{skills-DM9ACPW-.js → skills-axToWEo0.js} +1 -1
  228. package/dist/chunks/{startupProfiler-2sjXZkIP.js → startupProfiler-CbzxVmbv.js} +1 -1
  229. package/dist/chunks/startupProfiler-uHetQush.js +1 -0
  230. package/dist/chunks/state-BStOuCh4.js +1 -0
  231. package/dist/chunks/{state-BPFYBqm1.js → state-D5D6QpTX.js} +1 -1
  232. package/dist/chunks/{stats-Dq-5qizS.js → stats-Ce15gc3E.js} +1 -1
  233. package/dist/chunks/status-3uevwSMo.js +1 -0
  234. package/dist/chunks/{status-C5v7KsX4.js → status-CGp4uRlH.js} +2 -2
  235. package/dist/chunks/{statusNoticeHelpers-BY_8pK19.js → statusNoticeHelpers-BrN_2q7H.js} +1 -1
  236. package/dist/chunks/{stringUtils-BjnclTLB.js → stringUtils-CKD8qDqx.js} +1 -1
  237. package/dist/chunks/switcher-99gm2vpe.js +1 -0
  238. package/dist/chunks/switcher-DJDxjLPQ.js +1 -0
  239. package/dist/chunks/syncCache-B3OVvp8K.js +1 -0
  240. package/dist/chunks/{tasks-qVyXOLBf.js → tasks-t5zT_D32.js} +1 -1
  241. package/dist/chunks/{teleport-Deq_ecN9.js → teleport-CvX_nUjQ.js} +1 -1
  242. package/dist/chunks/{templateJobs-CntPyct-.js → templateJobs-Bm8bovHx.js} +1 -1
  243. package/dist/chunks/{terminalSetup-DDvQ0K5e.js → terminalSetup-7PdC4fV5.js} +1 -1
  244. package/dist/chunks/{terminalSetup-JJiXmszo.js → terminalSetup-kWdZRKWq.js} +1 -1
  245. package/dist/chunks/{theme-DVWYzSct.js → theme-DzaSXOpQ.js} +1 -1
  246. package/dist/chunks/{tmux-g0cQ0Buz.js → tmux-CpGd0Aca.js} +1 -1
  247. package/dist/chunks/{toolEventObserver-BZn8ZJB5.js → toolEventObserver-C_nHI27x.js} +1 -1
  248. package/dist/chunks/toolPool-CgKK0K8f.js +1 -0
  249. package/dist/chunks/{trustedDevice-CdLAZK6m.js → trustedDevice-Bb7O8_tj.js} +1 -1
  250. package/dist/chunks/trustedDevice-C2gnF9Lc.js +1 -0
  251. package/dist/chunks/{types-BomO8WUz.js → types-APu4OCXJ.js} +2 -2
  252. package/dist/chunks/{udsClient-DSvRPCvR.js → udsClient-U7MEfYj7.js} +1 -1
  253. package/dist/chunks/{upstreamproxy-DYoLvdM9.js → upstreamproxy-CTOuotLO.js} +1 -1
  254. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-YSWYVWk6.js → useExitOnCtrlCDWithKeybindings-D0uqGxGw.js} +1 -1
  255. package/dist/chunks/useMainLoopModel-BGPOmBkl.js +1 -0
  256. package/dist/chunks/useManagePlugins-ITVFO9dz.js +1 -0
  257. package/dist/chunks/{useMergedTools-B4qRVJ8b.js → useMergedTools-rQ19rFvH.js} +1 -1
  258. package/dist/chunks/{useSearchInput-DfUNYhqC.js → useSearchInput-CXTa-leH.js} +1 -1
  259. package/dist/chunks/useSettingsErrors-Xc6RYjYF.js +1 -0
  260. package/dist/chunks/{userAgent-CNPTS7ix.js → userAgent-CJ5Rp9kc.js} +1 -1
  261. package/dist/chunks/{util-6aJHnBQ_.js → util-CD3ar4of.js} +1 -1
  262. package/dist/chunks/validatePlugin-CxrlCKc1.js +1 -0
  263. package/dist/chunks/{vim-s-wmybpU.js → vim-BagKUX4j.js} +1 -1
  264. package/dist/chunks/{which-BR8YVCCW.js → which-BxQ1hpjp.js} +1 -1
  265. package/dist/chunks/{windowsPaths-BmXyrasP.js → windowsPaths-BdhjMYTm.js} +1 -1
  266. package/dist/chunks/windowsPaths-DtGZ83kH.js +1 -0
  267. package/dist/chunks/{workSecret-BUd8cQ6-.js → workSecret-CaM2yIJD.js} +1 -1
  268. package/dist/chunks/{workerRegistry-BwJ54Lzk.js → workerRegistry-BGJtgrko.js} +2 -2
  269. package/dist/chunks/worktree-CanG5GhE.js +1 -0
  270. package/dist/cli.js +1 -1
  271. package/package.json +1 -1
  272. package/dist/chunks/AgentsMdExternalIncludesDialog--D4BeNAN.js +0 -1
  273. package/dist/chunks/ApproveApiKey-lv4Sg0RR.js +0 -1
  274. package/dist/chunks/BackgroundTasksDialog-CZND8e_Z.js +0 -2
  275. package/dist/chunks/Doctor-C9t7udHN.js +0 -3
  276. package/dist/chunks/Doctor-V-JLC4e3.js +0 -1
  277. package/dist/chunks/ExitFlow-CShdrKmr.js +0 -2
  278. package/dist/chunks/MCPConnectionManager-BnUw0nYN.js +0 -1
  279. package/dist/chunks/MCPToolListView-CY2EezWF.js +0 -1
  280. package/dist/chunks/MessageSelector-Dtt2Sf65.js +0 -3
  281. package/dist/chunks/Messages-D5Uuapmf.js +0 -10
  282. package/dist/chunks/QueryEngine-B79JLwG4.js +0 -1
  283. package/dist/chunks/REPL-B7evbhvN.js +0 -1
  284. package/dist/chunks/REPL-cAXdORs2.js +0 -128
  285. package/dist/chunks/RemoteSessionManager-C5pAD0Lh.js +0 -2
  286. package/dist/chunks/SearchExtraToolsTool-CddjJcAH.js +0 -1
  287. package/dist/chunks/Settings-_b5Yxt_9.js +0 -2
  288. package/dist/chunks/add-dir-LLAv-rGS.js +0 -1
  289. package/dist/chunks/agents-C8wRUTNV.js +0 -101
  290. package/dist/chunks/allErrors-DUYYPpdH.js +0 -1
  291. package/dist/chunks/api-BAT--5sp.js +0 -1
  292. package/dist/chunks/auth-DaJXqwN5.js +0 -1
  293. package/dist/chunks/auth-DkhPycBL.js +0 -1
  294. package/dist/chunks/backgroundHousekeeping-Bjb_Jc7L.js +0 -17
  295. package/dist/chunks/backgroundHousekeeping-V-dg2j2E.js +0 -1
  296. package/dist/chunks/branch-BWq5ynjm.js +0 -2
  297. package/dist/chunks/bridgeConfig-D31i4BRi.js +0 -1
  298. package/dist/chunks/bridgePointer-CiHy2tTN.js +0 -1
  299. package/dist/chunks/bridgeStatusUtil-mvVQSVN-.js +0 -1
  300. package/dist/chunks/btw-XNgXHnNr.js +0 -1
  301. package/dist/chunks/caches-ByLjTvdy.js +0 -1
  302. package/dist/chunks/caches-ckqJ4Qso.js +0 -1
  303. package/dist/chunks/client-Bl43xcRk.js +0 -1
  304. package/dist/chunks/client-Pap_HyZZ.js +0 -1
  305. package/dist/chunks/client-zhozU2ws.js +0 -1
  306. package/dist/chunks/commands-BDhn7EPO.js +0 -1
  307. package/dist/chunks/config-CbAvTdZ7.js +0 -1
  308. package/dist/chunks/context-noninteractive-ulRLlYg5.js +0 -1
  309. package/dist/chunks/conversation-D08lU377.js +0 -1
  310. package/dist/chunks/conversation-a82khZ_n.js +0 -1
  311. package/dist/chunks/createSession-CnlPXXkA.js +0 -1
  312. package/dist/chunks/crossProjectResume-BCN462Wa.js +0 -40
  313. package/dist/chunks/cwd-Besi3Os3.js +0 -1
  314. package/dist/chunks/cwd-DpqwaYHw.js +0 -1
  315. package/dist/chunks/detectRepository-tRUoPOKy.js +0 -1
  316. package/dist/chunks/doctor-DRFDBrH1.js +0 -1
  317. package/dist/chunks/extractMemories-BsQU2bVO.js +0 -1
  318. package/dist/chunks/fast-B9vVL3sY.js +0 -1
  319. package/dist/chunks/fetchModelList-BeL40TyR.js +0 -1
  320. package/dist/chunks/firstPartyEventLogger-6GwZ6VLr.js +0 -1
  321. package/dist/chunks/flushGate-COa_KO98.js +0 -1
  322. package/dist/chunks/git-BaSq69E7.js +0 -1
  323. package/dist/chunks/githubRepoPathMapping-Px3_GeD1.js +0 -1
  324. package/dist/chunks/hooks-DvVuNKRx.js +0 -1
  325. package/dist/chunks/initReplBridge-sTaq4a0K.js +0 -1
  326. package/dist/chunks/install-BWe3Jz4M.js +0 -1
  327. package/dist/chunks/keybindings-DLEorhlY.js +0 -1
  328. package/dist/chunks/lazySchema-B4D4qJVE.js +0 -1
  329. package/dist/chunks/loadAgentsDir-D0gl_H2S.js +0 -1
  330. package/dist/chunks/localSearch-D3UrYUre.js +0 -1
  331. package/dist/chunks/managedEnv-ADMKY7-G.js +0 -1
  332. package/dist/chunks/managedEnv-CDxyrUw1.js +0 -1
  333. package/dist/chunks/mcp-Bh3MNBIj.js +0 -6
  334. package/dist/chunks/mcp-D7vMhEOV.js +0 -2
  335. package/dist/chunks/mcp-nnBVM5Lt.js +0 -1
  336. package/dist/chunks/memory-DtqQhHu8.js +0 -1
  337. package/dist/chunks/model-B50j-O5v.js +0 -1
  338. package/dist/chunks/model-DLG1nrnf.js +0 -1
  339. package/dist/chunks/model-DlLO7TSx.js +0 -1
  340. package/dist/chunks/omit-CMldTqqy.js +0 -1
  341. package/dist/chunks/onChangeAppState-EAnsmOuo.js +0 -1
  342. package/dist/chunks/parser-x-w3ikxt.js +0 -1
  343. package/dist/chunks/partition-B8Y4jvjW.js +0 -1
  344. package/dist/chunks/permissions-cDtIZRM1.js +0 -3
  345. package/dist/chunks/pidLock-Br3_YNi_.js +0 -3
  346. package/dist/chunks/plugin-CzQHuIlP.js +0 -17
  347. package/dist/chunks/pluginOperations-wUUdFpu9.js +0 -2
  348. package/dist/chunks/pluginStartupCheck-hDT6pEAd.js +0 -1
  349. package/dist/chunks/pollConfig-BgpfHQPJ.js +0 -1
  350. package/dist/chunks/poorMode-DD88nPJ4.js +0 -1
  351. package/dist/chunks/poorMode-wm2WkPF0.js +0 -1
  352. package/dist/chunks/print-G3DgPTxy.js +0 -14
  353. package/dist/chunks/processBashCommand-zLWgCRws.js +0 -1
  354. package/dist/chunks/processSlashCommand-BHBnHBjj.js +0 -5
  355. package/dist/chunks/prompt-Ct3Ryb3C.js +0 -1
  356. package/dist/chunks/prompt-TZJKyomz.js +0 -1
  357. package/dist/chunks/reconciler-DiU1RvGD.js +0 -1
  358. package/dist/chunks/refresh-DEXe3Lmx.js +0 -1
  359. package/dist/chunks/remoteManagedSettings-BboLJ46D.js +0 -1
  360. package/dist/chunks/resume-DgFXYWTN.js +0 -2
  361. package/dist/chunks/ripgrep-Di-2j8Ws.js +0 -1
  362. package/dist/chunks/sandbox-adapter-CtEngx-6.js +0 -1
  363. package/dist/chunks/searchExtraTools-zFMN5MqY.js +0 -1
  364. package/dist/chunks/sessionFileAccessHooks-C2VjT-PU.js +0 -1
  365. package/dist/chunks/sessionObserver-BuhXr3FP.js +0 -1
  366. package/dist/chunks/sessionStorage-CiYSwyY3.js +0 -1
  367. package/dist/chunks/settings-BgHApyGL.js +0 -1
  368. package/dist/chunks/settingsSync-BhlegQAU.js +0 -1
  369. package/dist/chunks/setup-DvnKMqDy.js +0 -3
  370. package/dist/chunks/sinks-Cf4vx9UX.js +0 -1
  371. package/dist/chunks/skillChangeDetector-BQx4xe_b.js +0 -1
  372. package/dist/chunks/startupProfiler-B2fyaBEa.js +0 -1
  373. package/dist/chunks/state-CsdHk8n-.js +0 -1
  374. package/dist/chunks/status-C3z0CSBw.js +0 -1
  375. package/dist/chunks/switcher-C9VsM-ip.js +0 -1
  376. package/dist/chunks/switcher-CnBKuiNp.js +0 -1
  377. package/dist/chunks/syncCache-Dff4hbz4.js +0 -1
  378. package/dist/chunks/toolPool-Dzp1ob3I.js +0 -1
  379. package/dist/chunks/trustedDevice-1Q4FTNyX.js +0 -1
  380. package/dist/chunks/useMainLoopModel-C1JRp4zE.js +0 -1
  381. package/dist/chunks/useManagePlugins-DfuI4Nhd.js +0 -1
  382. package/dist/chunks/useSettingsErrors-Bls74ocI.js +0 -1
  383. package/dist/chunks/validatePlugin-BajM6yNf.js +0 -1
  384. package/dist/chunks/windowsPaths-BybjGW7e.js +0 -1
  385. package/dist/chunks/worktree-BFP10vim.js +0 -1
@@ -1,4 +1,4 @@
1
- import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{aS as o,nf as s,oS as c,rf as l}from"./loadAgentsDir-CbtNPJV3.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-BQj6h99Q.js";import{g as p,n as m}from"./settings-CvhsRFaT.js";import{c as h,h as g,y as _}from"./config-BSkuQZNf.js";import{o as v,s as y}from"./log-BlJ7CcKG.js";import{n as b,r as x}from"./analytics-DJobLaWP.js";import{l as S,u as C}from"./oauth-D38aRTUb.js";import{$r as re,Ar as w,Cr as ie,Er as ae,Ir as oe,Lr as se,Mr as ce,Nr as T,Or as E,Pr as D,Pt as O,Sr as k,St as A,Tn as j,Tr as M,Tt as N,Xn as P,Xt as F,_n as I,bn as L,cn as R,gn as z,gt as B,in as V,kt as H,on as U,pt as W,qn as G,sn as K,ti as le,un as ue,wr as de,xt as fe}from"./model-DlLO7TSx.js";import{n as pe,t as me}from"./userAgent-CNPTS7ix.js";import{F as q,T as he}from"./sessionState-BlbRQ3Y6.js";import{d as ge,u as _e}from"./firstPartyEventLogger-Q3fMF0BR.js";import{n as ve}from"./trustedDevice-CdLAZK6m.js";import{i as ye,r as be}from"./grove-CSivzrhe.js";import{t as xe}from"./remoteManagedSettings-BboLJ46D.js";import{d as Se,n as Ce,t as we}from"./status-C5v7KsX4.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";l(),O(),j(),g(),I(),ue(),_e();async function Y(){A.cache?.clear?.(),ve(),L(),R(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await s()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-IljwxX0V.js`);await t(),await V(),z().delete(),await Y(),_(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),te(),f(),ne(),b(),p(),le(),se(),E(),he(),a(),C(),g(),P(),v(),pe();async function Oe(){try{if(h().claudeCodeFirstTokenDate!==void 0)return;let e=G();if(e.error){y(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${S().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":me()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){y(Error(`Received invalid first_token_date from API: ${n}`));return}}_(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){y(e)}}o(),C(),v();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?S().CLAUDEAI_SUCCESS_URL:S().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=S().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){y(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function X(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Z(){return X(J(32))}function Ae(e){let t=Te(`sha256`);return t.update(e),X(t.digest())}function je(){return X(J(32))}b(),E(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Z()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=Ae(this.codeVerifier),r=je(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=k({...i,isManual:!0}),o=k({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await c(o))}),l=this.authCodeListener?.hasPendingResponse()??!1;x(`tengu_oauth_auth_code_received`,{automatic:l});try{let e=await de(s,r,this.codeVerifier,this.port,!l,t?.expiresIn),n=await ae(e.access_token);if(l){let t=w(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw l&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:w(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};b(),E(),O(),g(),v(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await oe(e.accessToken);t?D({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&D({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=U(e);if(W(),n.warning&&x(`tengu_oauth_storage_warning`,{warning:n.warning}),await M(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await ie(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function Me({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
1
+ import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{eS as o,nf as s,rf as c,tS as l}from"./loadAgentsDir-DXOkUcW3.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-D58GQBDG.js";import{h as p,t as m}from"./settings-3xZ0fsvE.js";import{c as h,h as g,y as _}from"./config-DRy1I12M.js";import{o as v,s as y}from"./log-CZ7ploQm.js";import{n as b,r as x}from"./analytics-DJobLaWP.js";import{l as S,u as C}from"./oauth-D38aRTUb.js";import{$r as re,Ar as w,Cr as ie,Er as ae,Ir as oe,Lr as se,Mr as ce,Nr as T,Or as E,Pr as D,Pt as O,Sr as k,St as A,Tn as j,Tr as M,Tt as N,Xn as P,Xt as F,_n as I,bn as L,cn as R,gn as z,gt as B,in as V,kt as H,on as U,pt as W,qn as G,sn as K,ti as le,un as ue,wr as de,xt as fe}from"./model-Cxx3suBa.js";import{n as pe,t as me}from"./userAgent-CJ5Rp9kc.js";import{F as q,T as he}from"./sessionState-DAcub-HK.js";import{d as ge,u as _e}from"./firstPartyEventLogger-CxUuXQhL.js";import{n as ve}from"./trustedDevice-Bb7O8_tj.js";import{i as ye,r as be}from"./grove--HtQL4QZ.js";import{t as xe}from"./remoteManagedSettings-6RAHPt_g.js";import{d as Se,n as Ce,t as we}from"./status-CGp4uRlH.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";c(),O(),j(),g(),I(),ue(),_e();async function Y(){A.cache?.clear?.(),ve(),L(),R(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await s()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-DpgB3GFx.js`);await t(),await V(),z().delete(),await Y(),_(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),te(),f(),ne(),b(),p(),le(),se(),E(),he(),a(),C(),g(),P(),v(),pe();async function Oe(){try{if(h().claudeCodeFirstTokenDate!==void 0)return;let e=G();if(e.error){y(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${S().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":me()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){y(Error(`Received invalid first_token_date from API: ${n}`));return}}_(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){y(e)}}o(),C(),v();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?S().CLAUDEAI_SUCCESS_URL:S().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=S().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){y(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function X(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Z(){return X(J(32))}function Ae(e){let t=Te(`sha256`);return t.update(e),X(t.digest())}function je(){return X(J(32))}b(),E(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Z()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=Ae(this.codeVerifier),r=je(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=k({...i,isManual:!0}),o=k({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await l(o))}),c=this.authCodeListener?.hasPendingResponse()??!1;x(`tengu_oauth_auth_code_received`,{automatic:c});try{let e=await de(s,r,this.codeVerifier,this.port,!c,t?.expiresIn),n=await ae(e.access_token);if(c){let t=w(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw c&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:w(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};b(),E(),O(),g(),v(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await oe(e.accessToken);t?D({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&D({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=U(e);if(W(),n.warning&&x(`tengu_oauth_storage_warning`,{warning:n.warning}),await M(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await ie(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function Me({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
2
2
  `),process.exit(1));let i=m(),a=i.forceLoginMethod?i.forceLoginMethod===`claudeai`:!n,o=i.forceLoginOrgUUID,s=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(s){let e=process.env.CLAUDE_CODE_OAUTH_SCOPES;e||(process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
3
3
  Set it to the space-separated scopes the refresh token was issued with
4
4
  (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
@@ -0,0 +1,17 @@
1
+ import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{Bd as n,Cc as r,Fb as i,La as a,Pb as o,Q as s,Qf as c,SC as l,Sa as ee,St as u,Ta as d,X as f,bC as te,br as ne,by as p,cm as m,dt as h,ep as g,lr as _,wa as v,wc as re,zd as ie}from"./loadAgentsDir-DXOkUcW3.js";import{L as y,U as b,Ut as x}from"./state-D5D6QpTX.js";import{n as ae,t as oe}from"./cwd-Nh5IZNKO.js";import{R as S,U as C,c as w,f as T,i as E,u as D,x as O}from"./debug-D58GQBDG.js";import{d as k,h as A,v as j}from"./settings-3xZ0fsvE.js";import{S as M}from"./config-DRy1I12M.js";import{o as N,s as P,v as F,y as I}from"./log-CZ7ploQm.js";import{n as L,r as R}from"./analytics-DJobLaWP.js";import{_ as z,h as B}from"./model-Cxx3suBa.js";import{_n as V,vn as H}from"./prompt-DEioJrx_.js";import{Q as U}from"./sessionState-DAcub-HK.js";import{i as W,t as G}from"./nativeInstaller-CaXwRpoR.js";import{n as se,t as K}from"./allErrors-C_iHQOlK.js";import{r as ce}from"./magicDocs-rxv0rR8E.js";import{n as le,t as ue}from"./pluginAutoupdate-C2YbEHrP.js";import{n as de}from"./registerProtocol-Xsq4ldwg.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ae(),O(),T(),E(),I(),A(),H(),z(),re(),ne(),ce(),f(),N(),S(),a(),p(),f(),i(),S(),N(),a(),p(),m();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(oe(),`.workmate`,`skills`,e,`SKILL.md`),a;try{a=await r.readFile(i,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${i}`));return}let c=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
+ `),l=B(),u=await s({messages:[ee({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
+
4
+ <current_skill_file>
5
+ ${a}
6
+ </current_skill_file>
7
+
8
+ <improvements>
9
+ ${c}
10
+ </improvements>
11
+
12
+ Rules:
13
+ - Integrate the improvements naturally into the existing structure
14
+ - Preserve frontmatter (--- block) exactly as-is
15
+ - Preserve the overall format and style
16
+ - Do not remove existing content unless an improvement explicitly replaces it
17
+ - Output the complete updated file inside <updated_file> tags`})],systemPrompt:U([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:o().signal,options:{getToolPermissionContext:async()=>V(),model:l,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),f=v(d(Array.isArray(u.message.content)?u.message.content:[]).trim(),`updated_file`);if(!f){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,f,`utf-8`)}catch(e){P(C(e))}}L(),g(),M(),N(),G(),n(),se(),l(),u();var pe=30;function J(){let e=((k()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await D().readdir(e);for(let a of i)try{he(a.name)<t&&(await D().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=D(),t=J(),n=F.errors(),r=F.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=_(),r=D(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,te),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=D(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=D(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=K();if(e.length>0&&j(`cleanupPeriodDays`)){w(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await c(),await ie(J());let t=await h(J());t>0&&R(`tengu_worktree_cleanup`,{removed:t})}x(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-B_8wZpXA.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),r(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-BGKR5cdA.js";export{e as startBackgroundHousekeeping};
@@ -1,2 +1,2 @@
1
- import{S as e,m as t,s as n,y as r}from"./git-DplvjXEY.js";import{f as i,m as a,v as o}from"./startupProfiler-2sjXZkIP.js";import{homedir as s}from"os";import{join as c,sep as l}from"path";import{stat as u}from"fs/promises";o(),e(),t();var d=10080*60*1e3,f=1e3;function p(e){let t=[`This session was opened by an external deep link in ${g(e.cwd)}`];if(e.repo){let n=e.lastFetch?a(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>d;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>f?`The prompt below (${i(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
1
+ import{S as e,m as t,s as n,y as r}from"./git-By_J4XJL.js";import{f as i,m as a,v as o}from"./startupProfiler-CbzxVmbv.js";import{homedir as s}from"os";import{join as c,sep as l}from"path";import{stat as u}from"fs/promises";o(),e(),t();var d=10080*60*1e3,f=1e3;function p(e){let t=[`This session was opened by an external deep link in ${g(e.cwd)}`];if(e.repo){let n=e.lastFetch?a(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>d;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>f?`The prompt below (${i(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
2
2
  `)}async function m(e){let t=await n(e);if(!t)return;let i=await r(t),[a,o]=await Promise.all([h(c(t,`FETCH_HEAD`)),i?h(c(i,`FETCH_HEAD`)):Promise.resolve(void 0)]);return a&&o?a>o?a:o:a??o}async function h(e){try{let{mtime:t}=await u(e);return t}catch{return}}function g(e){let t=s();return e===t?`~`:e.startsWith(t+l)?`~${e.slice(t.length)}`:e}export{m as n,p as t};
@@ -1,5 +1,5 @@
1
- import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{S as n,x as r}from"./debug-BQj6h99Q.js";import{a as i,i as a}from"./genericProcessUtils-Bbcbi11g.js";import{join as o}from"path";import{randomUUID as s}from"crypto";import{readFile as c,readdir as l,unlink as u}from"fs/promises";t(),r(),a();async function d(){if(process.platform===`win32`){let{DetachedEngine:e}=await import(`./detached--wGwkuHX.js`);return new e}let{TmuxEngine:e}=await import(`./tmux-g0cQ0Buz.js`),t=new e;if(await t.available())return t;let{DetachedEngine:n}=await import(`./detached--wGwkuHX.js`);return new n}function f(){return o(e(),`sessions`)}async function p(){let e=f(),t;try{t=await l(e)}catch{return[]}let r=[];for(let a of t)if(/^\d+\.json$/.test(a)){if(!i(parseInt(a.slice(0,-5),10))){u(o(e,a)).catch(()=>{});continue}try{let t=n(await c(o(e,a),`utf-8`));r.push(t)}catch{}}return r}function m(e,t){let n=parseInt(t,10);return e.find(e=>e.sessionId===t||e.pid===n||e.name&&e.name===t)}function h(e){return new Date(e).toLocaleString()}function g(e){return e.engine?e.engine:e.tmuxSessionName?`tmux`:`detached`}async function _(e){let t=await p();if(t.length===0){console.log(`No active sessions.`);return}console.log(`${t.length} active session${t.length>1?`s`:``}:\n`);for(let e of t){let t=g(e),n=[` PID: ${e.pid}`,` Kind: ${e.kind}`,` Engine: ${t}`,` Session: ${e.sessionId}`,` CWD: ${e.cwd}`];e.name&&n.push(` Name: ${e.name}`),e.startedAt&&n.push(` Started: ${h(e.startedAt)}`),e.status&&n.push(` Status: ${e.status}`),e.waitingFor&&n.push(` Waiting for: ${e.waitingFor}`),e.bridgeSessionId&&n.push(` Bridge: ${e.bridgeSessionId}`),e.tmuxSessionName&&n.push(` Tmux: ${e.tmuxSessionName}`),e.logPath&&n.push(` Log: ${e.logPath}`),console.log(n.join(`
2
- `)),console.log()}}async function v(e){let t=await p();if(!e){if(t.length===0){console.log(`No active sessions.`);return}if(t.length===1)e=t[0].sessionId;else{console.log(`Multiple sessions active. Specify one:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}if(!n.logPath){console.log(`No log path recorded for session ${n.sessionId}`);return}try{let e=await c(n.logPath,`utf-8`);process.stdout.write(e)}catch(e){console.error(`Failed to read log file: ${n.logPath}`),console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function y(e){let t=await p();if(!e){let n=t.filter(e=>e.tmuxSessionName||e.engine===`detached`);if(n.length===0){console.log("No background sessions to attach to. Start one with `claude daemon bg`.");return}if(n.length===1)e=n[0].sessionId;else{console.log(`Multiple background sessions. Specify one:`);for(let e of n){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId,n=g(e);console.log(` ${t} PID=${e.pid} engine=${n}`)}return}}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}let r=g(n);try{if(r===`tmux`){let{TmuxEngine:e}=await import(`./tmux-g0cQ0Buz.js`),t=new e;if(!await t.available()){console.error(`tmux is no longer available. Cannot attach to tmux session.`),process.exitCode=1;return}await t.attach(n)}else{let{DetachedEngine:e}=await import(`./detached--wGwkuHX.js`);await new e().attach(n)}}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function b(e){let t=await p();if(!e){if(t.length===0){console.log(`No active sessions to kill.`);return}console.log(`Specify a session to kill:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}console.log(`Killing session ${n.sessionId} (PID: ${n.pid})...`);try{process.kill(n.pid,`SIGTERM`)}catch{console.log(`Session already exited.`);return}if(await new Promise(e=>setTimeout(e,2e3)),i(n.pid))try{process.kill(n.pid,`SIGKILL`),console.log(`Session force-killed.`)}catch{console.log(`Session exited during grace period.`)}else console.log(`Session stopped.`);u(o(f(),`${n.pid}.json`)).catch(()=>{})}async function x(t){let n=await d(),r=t.filter(e=>e!==`--bg`&&e!==`--background`);if(!n.supportsInteractiveInput&&!r.some(e=>e===`-p`||e===`--print`||e===`--pipe`)){console.error(`Error: Background sessions with detached engine require -p/--print flag.
1
+ import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{S as n,x as r}from"./debug-D58GQBDG.js";import{a as i,i as a}from"./genericProcessUtils-6E7fB1dI.js";import{join as o}from"path";import{randomUUID as s}from"crypto";import{readFile as c,readdir as l,unlink as u}from"fs/promises";t(),r(),a();async function d(){if(process.platform===`win32`){let{DetachedEngine:e}=await import(`./detached-Biz-xhu0.js`);return new e}let{TmuxEngine:e}=await import(`./tmux-CpGd0Aca.js`),t=new e;if(await t.available())return t;let{DetachedEngine:n}=await import(`./detached-Biz-xhu0.js`);return new n}function f(){return o(e(),`sessions`)}async function p(){let e=f(),t;try{t=await l(e)}catch{return[]}let r=[];for(let a of t)if(/^\d+\.json$/.test(a)){if(!i(parseInt(a.slice(0,-5),10))){u(o(e,a)).catch(()=>{});continue}try{let t=n(await c(o(e,a),`utf-8`));r.push(t)}catch{}}return r}function m(e,t){let n=parseInt(t,10);return e.find(e=>e.sessionId===t||e.pid===n||e.name&&e.name===t)}function h(e){return new Date(e).toLocaleString()}function g(e){return e.engine?e.engine:e.tmuxSessionName?`tmux`:`detached`}async function _(e){let t=await p();if(t.length===0){console.log(`No active sessions.`);return}console.log(`${t.length} active session${t.length>1?`s`:``}:\n`);for(let e of t){let t=g(e),n=[` PID: ${e.pid}`,` Kind: ${e.kind}`,` Engine: ${t}`,` Session: ${e.sessionId}`,` CWD: ${e.cwd}`];e.name&&n.push(` Name: ${e.name}`),e.startedAt&&n.push(` Started: ${h(e.startedAt)}`),e.status&&n.push(` Status: ${e.status}`),e.waitingFor&&n.push(` Waiting for: ${e.waitingFor}`),e.bridgeSessionId&&n.push(` Bridge: ${e.bridgeSessionId}`),e.tmuxSessionName&&n.push(` Tmux: ${e.tmuxSessionName}`),e.logPath&&n.push(` Log: ${e.logPath}`),console.log(n.join(`
2
+ `)),console.log()}}async function v(e){let t=await p();if(!e){if(t.length===0){console.log(`No active sessions.`);return}if(t.length===1)e=t[0].sessionId;else{console.log(`Multiple sessions active. Specify one:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}if(!n.logPath){console.log(`No log path recorded for session ${n.sessionId}`);return}try{let e=await c(n.logPath,`utf-8`);process.stdout.write(e)}catch(e){console.error(`Failed to read log file: ${n.logPath}`),console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function y(e){let t=await p();if(!e){let n=t.filter(e=>e.tmuxSessionName||e.engine===`detached`);if(n.length===0){console.log("No background sessions to attach to. Start one with `claude daemon bg`.");return}if(n.length===1)e=n[0].sessionId;else{console.log(`Multiple background sessions. Specify one:`);for(let e of n){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId,n=g(e);console.log(` ${t} PID=${e.pid} engine=${n}`)}return}}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}let r=g(n);try{if(r===`tmux`){let{TmuxEngine:e}=await import(`./tmux-CpGd0Aca.js`),t=new e;if(!await t.available()){console.error(`tmux is no longer available. Cannot attach to tmux session.`),process.exitCode=1;return}await t.attach(n)}else{let{DetachedEngine:e}=await import(`./detached-Biz-xhu0.js`);await new e().attach(n)}}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function b(e){let t=await p();if(!e){if(t.length===0){console.log(`No active sessions to kill.`);return}console.log(`Specify a session to kill:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}console.log(`Killing session ${n.sessionId} (PID: ${n.pid})...`);try{process.kill(n.pid,`SIGTERM`)}catch{console.log(`Session already exited.`);return}if(await new Promise(e=>setTimeout(e,2e3)),i(n.pid))try{process.kill(n.pid,`SIGKILL`),console.log(`Session force-killed.`)}catch{console.log(`Session exited during grace period.`)}else console.log(`Session stopped.`);u(o(f(),`${n.pid}.json`)).catch(()=>{})}async function x(t){let n=await d(),r=t.filter(e=>e!==`--bg`&&e!==`--background`);if(!n.supportsInteractiveInput&&!r.some(e=>e===`-p`||e===`--print`||e===`--pipe`)){console.error(`Error: Background sessions with detached engine require -p/--print flag.
3
3
  The detached engine has no terminal for interactive input.
4
4
 
5
5
  Usage:
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Er as t,br as n,cr as r,fi as i,gr as a,hr as o,oi as s}from"./loadAgentsDir-DXOkUcW3.js";import{$ as c,Ut as l,ft as u}from"./state-D5D6QpTX.js";import{C as d,x as f}from"./debug-D58GQBDG.js";import{c as p,s as m}from"./types-APu4OCXJ.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";import{i as _,o as v}from"./stringUtils-CKD8qDqx.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),i=u(),s=r(c()),l=a(n),f=o();await b(s,{recursive:!0,mode:448});let m;try{m=await x(f)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=p(m),g=h.filter(e=>t(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let t={...e,sessionId:n,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(d(t)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:n,replacements:_};C.push(d(e))}return await S(l,`${C.join(`
2
+ `)}\n`,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:l,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let t=`${e} (Branch)`;if((await i(t,{exact:!0})).length===0)return t;let n=await i(`${e} (Branch`),r=new Set([1]),a=RegExp(`^${_(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(a);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let o=2;for(;r.has(o);)o++;return`${e} (Branch ${o})`}async function E(e,t,n){let r=n?.trim()||void 0,i=u();try{let{sessionId:n,title:a,forkPath:o,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(a??d);await s(n,f,o),g(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!a});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=a?` "${a}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${i}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{l(),h(),m(),n(),f(),v()}))();export{E as call,C as deriveFirstPrompt};
@@ -1,7 +1,7 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{Wt as r,z as i}from"./state-BPFYBqm1.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{R as r,Ut as i}from"./state-D5D6QpTX.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
2
2
  `).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,`${JSON.stringify(r)}\n`,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
3
3
  `)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
4
4
  `)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: The prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
5
5
  `)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
6
- `)}}var y,b,x,S=e((()=>{r(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
7
- `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!i(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-Bg_0PHE6.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>i(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
6
+ `)}}var y,b,x,S=e((()=>{i(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
7
+ `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-CVd1dzYl.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n,t as r}from"./bridgeConfig-MxsnEEPx.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./oauth-D38aRTUb.js";import{Pt as r,St as i}from"./model-DlLO7TSx.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??i()?.accessToken}function c(){return o()??t().BASE_API_URL}function l(){return!!o()}var u=e((()=>{n(),r()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./oauth-D38aRTUb.js";import{Pt as r,St as i}from"./model-Cxx3suBa.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??i()?.accessToken}function c(){return o()??t().BASE_API_URL}function l(){return!!o()}var u=e((()=>{n(),r()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
@@ -1 +1 @@
1
- import{o as e}from"./envUtils-DcaKZlRU.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{P as r,R as i,S as a,c as o,i as s,x as c}from"./debug-BQj6h99Q.js";import{B as l,F as u,H as d,I as f,O as p,b as m,g as h,m as g,q as _}from"./log-BlJ7CcKG.js";import{n as v,r as y}from"./analytics-DJobLaWP.js";import{T as b,et as x}from"./sessionState-BlbRQ3Y6.js";import{n as S,t as C}from"./rcDebugLog-DSchf3Hs.js";import{t as w}from"./controlMessageCompat-IFu4Gc1y.js";import{randomUUID as T}from"crypto";e();async function E(){return!1}function D(){return!1}function O(){return!0}function k(){return null}v(),b(),s(),C(),g(),i(),c(),_(),t();function A(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function j(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_response`&&`response`in e}function M(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_request`&&`request_id`in e&&`request`in e}function N(e){return(e.type===`user`||e.type===`assistant`)&&e.isVirtual?!1:e.type===`user`||e.type===`assistant`||e.type===`system`&&e.subtype===`local_command`}function P(e){if(e.type!==`user`||e.isMeta||e.toolUseResult||e.isCompactSummary||e.origin&&e.origin.kind!==`human`)return;let t=e.message.content,n;if(typeof t==`string`)n=t;else for(let e of t??[])if(e.type===`text`){n=e.text;break}if(n)return h(n)||void 0}var F=`system-reminder`,I=/\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy,L=new Set([m,p,u,f,l,d]);function R(e){let t=e.message?.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``):``}function z(e){let t=e.trim();if(!t)return null;I.lastIndex=0;let n=[];for(;I.lastIndex<t.length;){let e=I.exec(t);if(!e)return null;n.push(e[1])}return n.length>0?n:null}function B(e){if(e.type!==`user`||e.isVisibleInTranscriptOnly)return!1;if(e.toolUseResult!==void 0||!e.isMeta)return!0;let t=z(R(e));return!t||t.some(e=>e!==`local-command-caveat`&&e!==F&&L.has(e))}function V(e){return e.some(B)}function H(e,t,n,i,s,c){try{let r=w(a(e));if(j(r)){o(`[bridge:repl] Ingress message type=control_response`),s?.(r);return}if(M(r)){o(`[bridge:repl] Inbound control_request subtype=${r.request.subtype}`),c?.(r);return}if(!A(r))return;let l=`uuid`in r&&typeof r.uuid==`string`?r.uuid:void 0;if(l&&t.has(l)){o(`[bridge:repl] Ignoring echo: type=${r.type} uuid=${l}`);return}if(l&&n.has(l)){o(`[bridge:repl] Ignoring re-delivered inbound: type=${r.type} uuid=${l}`);return}o(`[bridge:repl] Ingress message type=${r.type}${l?` uuid=${l}`:``}`),r.type===`user`?(l&&n.add(l),y(`tengu_bridge_message_received`,{is_repl:!0}),i?.(r)):o(`[bridge:repl] Ignoring non-user inbound message: type=${r.type}`)}catch(e){o(`[bridge:repl] Failed to parse ingress message: ${r(e)}`)}}var U=`This session is outbound-only. Enable Remote Control locally to allow inbound control.`;function W(e,t){let{transport:n,sessionId:r,outboundOnly:i,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:l}=t;if(!n){o(`[bridge:repl] Cannot respond to control_request: transport not configured`);return}let u,d=e.request;if(i&&d.subtype!==`initialize`){u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:U}};let t={...u,session_id:r};n.write(t),o(`[bridge:repl] Rejected ${d.subtype} (outbound-only) request_id=${e.request_id}`);return}switch(d.subtype){case`initialize`:u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:{commands:[],output_style:`normal`,available_output_styles:[`normal`],models:[],account:{},pid:process.pid}}};break;case`set_model`:s?.(d.model),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_max_thinking_tokens`:c?.(d.max_thinking_tokens??null),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_permission_mode`:{let t=l?.(d.mode)??{ok:!1,error:`set_permission_mode is not supported in this context (onSetPermissionMode callback not registered)`};u=t.ok?{type:`control_response`,response:{subtype:`success`,request_id:e.request_id}}:{type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t.error}};break}case`interrupt`:a?.(),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;default:u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:`REPL bridge does not handle control_request subtype: ${d.subtype}`}}}let f={...u,session_id:r};n.write(f),S(`control_response: subtype=${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`),o(`[bridge:repl] Sent control_response for ${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`)}function G(e){return{type:`result_success`,subtype:`success`,duration_ms:0,duration_api_ms:0,is_error:!1,num_turns:0,result:``,stop_reason:null,total_cost_usd:0,usage:{...x},modelUsage:{},permission_denials:[],session_id:e,uuid:T()}}var K=class{constructor(e){n(this,`capacity`,void 0),n(this,`ring`,void 0),n(this,`set`,new Set),n(this,`writeIdx`,0),this.capacity=e,this.ring=Array(e)}add(e){if(this.set.has(e))return;let t=this.ring[this.writeIdx];t!==void 0&&this.set.delete(t),this.ring[this.writeIdx]=e,this.set.add(e),this.writeIdx=(this.writeIdx+1)%this.capacity}has(e){return this.set.has(e)}clear(){this.set.clear(),this.ring.fill(void 0),this.writeIdx=0}};export{N as a,V as c,O as d,D as f,W as i,k as l,P as n,G as o,H as r,B as s,K as t,E as u};
1
+ import{o as e}from"./envUtils-DcaKZlRU.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{P as r,R as i,S as a,c as o,i as s,x as c}from"./debug-D58GQBDG.js";import{B as l,F as u,H as d,I as f,O as p,b as m,g as h,m as g,q as _}from"./log-CZ7ploQm.js";import{n as v,r as y}from"./analytics-DJobLaWP.js";import{T as b,et as x}from"./sessionState-DAcub-HK.js";import{n as S,t as C}from"./rcDebugLog-DSchf3Hs.js";import{t as w}from"./controlMessageCompat-IFu4Gc1y.js";import{randomUUID as T}from"crypto";e();async function E(){return!1}function D(){return!1}function O(){return!0}function k(){return null}v(),b(),s(),C(),g(),i(),c(),_(),t();function A(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function j(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_response`&&`response`in e}function M(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_request`&&`request_id`in e&&`request`in e}function N(e){return(e.type===`user`||e.type===`assistant`)&&e.isVirtual?!1:e.type===`user`||e.type===`assistant`||e.type===`system`&&e.subtype===`local_command`}function P(e){if(e.type!==`user`||e.isMeta||e.toolUseResult||e.isCompactSummary||e.origin&&e.origin.kind!==`human`)return;let t=e.message.content,n;if(typeof t==`string`)n=t;else for(let e of t??[])if(e.type===`text`){n=e.text;break}if(n)return h(n)||void 0}var F=`system-reminder`,I=/\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy,L=new Set([m,p,u,f,l,d]);function R(e){let t=e.message?.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``):``}function z(e){let t=e.trim();if(!t)return null;I.lastIndex=0;let n=[];for(;I.lastIndex<t.length;){let e=I.exec(t);if(!e)return null;n.push(e[1])}return n.length>0?n:null}function B(e){if(e.type!==`user`||e.isVisibleInTranscriptOnly)return!1;if(e.toolUseResult!==void 0||!e.isMeta)return!0;let t=z(R(e));return!t||t.some(e=>e!==`local-command-caveat`&&e!==F&&L.has(e))}function V(e){return e.some(B)}function H(e,t,n,i,s,c){try{let r=w(a(e));if(j(r)){o(`[bridge:repl] Ingress message type=control_response`),s?.(r);return}if(M(r)){o(`[bridge:repl] Inbound control_request subtype=${r.request.subtype}`),c?.(r);return}if(!A(r))return;let l=`uuid`in r&&typeof r.uuid==`string`?r.uuid:void 0;if(l&&t.has(l)){o(`[bridge:repl] Ignoring echo: type=${r.type} uuid=${l}`);return}if(l&&n.has(l)){o(`[bridge:repl] Ignoring re-delivered inbound: type=${r.type} uuid=${l}`);return}o(`[bridge:repl] Ingress message type=${r.type}${l?` uuid=${l}`:``}`),r.type===`user`?(l&&n.add(l),y(`tengu_bridge_message_received`,{is_repl:!0}),i?.(r)):o(`[bridge:repl] Ignoring non-user inbound message: type=${r.type}`)}catch(e){o(`[bridge:repl] Failed to parse ingress message: ${r(e)}`)}}var U=`This session is outbound-only. Enable Remote Control locally to allow inbound control.`;function W(e,t){let{transport:n,sessionId:r,outboundOnly:i,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:l}=t;if(!n){o(`[bridge:repl] Cannot respond to control_request: transport not configured`);return}let u,d=e.request;if(i&&d.subtype!==`initialize`){u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:U}};let t={...u,session_id:r};n.write(t),o(`[bridge:repl] Rejected ${d.subtype} (outbound-only) request_id=${e.request_id}`);return}switch(d.subtype){case`initialize`:u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:{commands:[],output_style:`normal`,available_output_styles:[`normal`],models:[],account:{},pid:process.pid}}};break;case`set_model`:s?.(d.model),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_max_thinking_tokens`:c?.(d.max_thinking_tokens??null),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_permission_mode`:{let t=l?.(d.mode)??{ok:!1,error:`set_permission_mode is not supported in this context (onSetPermissionMode callback not registered)`};u=t.ok?{type:`control_response`,response:{subtype:`success`,request_id:e.request_id}}:{type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t.error}};break}case`interrupt`:a?.(),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;default:u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:`REPL bridge does not handle control_request subtype: ${d.subtype}`}}}let f={...u,session_id:r};n.write(f),S(`control_response: subtype=${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`),o(`[bridge:repl] Sent control_response for ${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`)}function G(e){return{type:`result_success`,subtype:`success`,duration_ms:0,duration_api_ms:0,is_error:!1,num_turns:0,result:``,stop_reason:null,total_cost_usd:0,usage:{...x},modelUsage:{},permission_denials:[],session_id:e,uuid:T()}}var K=class{constructor(e){n(this,`capacity`,void 0),n(this,`ring`,void 0),n(this,`set`,new Set),n(this,`writeIdx`,0),this.capacity=e,this.ring=Array(e)}add(e){if(this.set.has(e))return;let t=this.ring[this.writeIdx];t!==void 0&&this.set.delete(t),this.ring[this.writeIdx]=e,this.set.add(e),this.writeIdx=(this.writeIdx+1)%this.capacity}has(e){return this.set.has(e)}clear(){this.set.clear(),this.ring.fill(void 0),this.writeIdx=0}};export{N as a,V as c,O as d,D as f,W as i,k as l,P as n,G as o,H as r,B as s,K as t,E as u};
@@ -0,0 +1 @@
1
+ import{D as e,N as t,f as n,n as r,r as i,t as a}from"./lazySchema-DULtBUCI.js";import{B as o,C as s,R as c,S as l,c as u,i as d,x as f}from"./debug-D58GQBDG.js";import{c as p,l as m,m as h}from"./sessionStoragePortable-x0Yn02-G.js";import{dirname as g,join as _}from"path";import{mkdir as v,readFile as y,stat as b,unlink as x,writeFile as S}from"fs/promises";i(),d(),c(),a(),m(),f();var C=r(()=>e({sessionId:t(),environmentId:t(),source:n([`standalone`,`repl`])}));function w(e){return _(p(),h(e),`bridge-pointer.json`)}async function T(e,t){let n=w(e);try{await v(g(n),{recursive:!0}),await S(n,s(t),`utf8`),u(`[bridge:pointer] wrote ${n}`)}catch(e){u(`[bridge:pointer] write failed: ${e}`,{level:`warn`})}}async function E(e){let t=w(e),n,r;try{r=(await b(t)).mtimeMs,n=await y(t,`utf8`)}catch{return null}let i=C().safeParse(O(n));if(!i.success)return u(`[bridge:pointer] invalid schema, clearing: ${t}`),await D(e),null;let a=Math.max(0,Date.now()-r);return a>144e5?(u(`[bridge:pointer] stale (>4h mtime), clearing: ${t}`),await D(e),null):{...i.data,ageMs:a}}async function D(e){let t=w(e);try{await x(t),u(`[bridge:pointer] cleared ${t}`)}catch(e){o(e)||u(`[bridge:pointer] clear failed: ${e}`,{level:`warn`})}}function O(e){try{return l(e)}catch{return null}}export{D as clearBridgePointer,E as readBridgePointer,T as writeBridgePointer};
@@ -0,0 +1 @@
1
+ import{aS as e,sS as t}from"./loadAgentsDir-DXOkUcW3.js";import{v as n}from"./startupProfiler-CbzxVmbv.js";import{a as r,n as i,o as a}from"./bridgeConfig-MxsnEEPx.js";t(),r(),n();function o(t,n){return`${a()?i():e(void 0,n)}/code?bridge=${t}`}function s({error:e,connected:t,sessionActive:n,reconnecting:r}){return e?{label:`Remote Control failed`,color:`error`}:r?{label:`Remote Control reconnecting`,color:`warning`}:n||t?{label:`Remote Control active`,color:`success`}:{label:`Remote Control connecting…`,color:`warning`}}function c(e){return`Code everywhere with the Work Mate app or ${e}`}function l(e){return`Continue coding in the Work Mate app or ${e}`}var u=`Something went wrong, please try again`;export{s as a,c as i,l as n,o as r,u as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Fb as n,J_ as r,La as i,Lu as a,Pb as o,Ru as s,Sp as c,Y_ as l,at as u,by as d,cc as f,gC as p,ka as m,lc as h,ot as g,q_ as _,wp as v}from"./loadAgentsDir-DXOkUcW3.js";import{I as y,P as b,ai as x,bn as S,ot as C,t as w,vn as T,xt as E}from"./src-DL3w8VPk2.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{P as O,R as k}from"./debug-D58GQBDG.js";import{Ut as A}from"./settings-3xZ0fsvE.js";import{h as j,y as M}from"./config-DRy1I12M.js";import{Q as N}from"./sessionState-DAcub-HK.js";import{n as P,r as F}from"./sideQuestion-Ct87yvOR.js";import{i as I,n as L}from"./modalContext-wY9CeN4G.js";function R({question:e,context:t,onDone:n}){let[r,i]=(0,H.useState)(null),[s,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(0),f=(0,H.useRef)(null),{rows:p}=I(C());S(()=>d(e=>e+1),r||s?null:80);function m(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),f.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),f.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=o();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?i(r.response):l(`No response received`))}catch(e){n.signal.aborted||l(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let h=Math.max(5,p-W-G);return(0,U.jsxs)(y,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:m,children:[(0,U.jsxs)(y,{children:[(0,U.jsxs)(b,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(b,{dimColor:!0,children:e})]}),(0,U.jsx)(y,{marginTop:1,marginLeft:2,maxHeight:h,children:(0,U.jsx)(E,{ref:f,flexDirection:`column`,flexGrow:1,children:s?(0,U.jsx)(b,{color:`error`,children:s}):r?(0,U.jsx)(c,{children:r}):(0,U.jsxs)(y,{children:[(0,U.jsx)(a,{frame:u,messageColor:`warning`}),(0,U.jsx)(b,{color:`warning`,children:`Answering...`})]})})}),(r||s)&&(0,U.jsx)(y,{marginTop:1,children:(0,U.jsxs)(b,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=m(z(e.messages)),n=f();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[i,a,o]=await Promise.all([u(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),r(),_()]);return{systemPrompt:N(i),userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(M(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{H=t(x(),1),T(),v(),s(),A(),g(),L(),l(),p(),w(),n(),j(),k(),h(),i(),P(),d(),U=D(),W=5,G=6,K=3}))();export{V as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$f as t,Di as n,Ds as r,Du as i,Eu as a,G as o,Im as s,J_ as c,K_ as l,Ki as u,Ky as d,Li as f,MC as p,Os as m,Pm as h,Q_ as g,Sh as _,Sv as v,X_ as y,Xi as b,Y_ as x,Z_ as S,bv as C,ep as w,jC as T,q as E,q_ as D,qy as O,rm as k,xh as A}from"./loadAgentsDir-DXOkUcW3.js";import{Dn as j,Ut as M,l as N}from"./state-D5D6QpTX.js";import{S as P,v as F}from"./git-By_J4XJL.js";import{i as I,t as L}from"./detectRepository-CDOJ-M7h.js";import{a as R,n as z}from"./fileSuggestions-Ct7vKEpR.js";import{r as B,t as V}from"./magicDocs-rxv0rR8E.js";function H(e=new Set){let r=e.size>0;c.cache.clear?.(),D.cache.clear?.(),l.cache.clear?.(),S.cache.clear?.(),z(),n(),r||v(),y(null),j(null),s(),m(),O(`session_start`),t(),a(),import(`./attributionHooks-C0aXyx9L.js`).then(({clearAttributionCaches:e})=>e()),L(),o(),N(e),F(),u(),_(),V(),T(),import(`./SearchExtraToolsTool-CdgQlm--.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-Dxz1vp3F.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-C50mDqWv.js`).then(({clearPromptCache:e})=>e())}var U=e((()=>{M(),f(),g(),x(),R(),k(),C(),i(),h(),A(),B(),b(),r(),E(),d(),I(),P(),w(),p()}));export{U as n,H as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./caches-BiVRgePi.js";e();export{t as clearSessionCaches};
@@ -1,3 +1,3 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{n,t as r}from"./axios-DaWTGg7G.js";import{i,o as a,t as o}from"./debugUtils-B86DM1Sp.js";import{n as s,t as c}from"./rcDebugLog-DSchf3Hs.js";r(),a(),c();var l=1440*60*1e3,u=`Remote Control requires authentication.`,d=`Error: You must be logged in to use Remote Control.
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{n,t as r}from"./axios-DaWTGg7G.js";import{i,o as a,t as o}from"./debugUtils-DXBRbwCE.js";import{n as s,t as c}from"./rcDebugLog-DSchf3Hs.js";r(),a(),c();var l=1440*60*1e3,u=`Remote Control requires authentication.`,d=`Error: You must be logged in to use Remote Control.
2
2
 
3
3
  Remote Control requires authentication.`;e();var f=`environments-2025-11-01`,p=/^[a-zA-Z0-9_-]+$/;function m(e,t){if(!e||!p.test(e))throw Error(`Invalid ${t}: contains unsafe characters`);return e}var h=class extends Error{constructor(e,n,r){super(e),t(this,`status`,void 0),t(this,`errorType`,void 0),this.name=`BridgeFatalError`,this.status=n,this.errorType=r}};function g(e){function t(t){e.onDebug?.(t)}let r=0;function i(t){let n={Authorization:`Bearer ${t}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"anthropic-beta":f,"x-environment-runner-version":e.runnerVersion},r=e.getTrustedDeviceToken?.();return r&&(n[`X-Trusted-Device-Token`]=r),n}function a(){let t=e.getAccessToken();if(!t)throw Error(u);return t}async function c(n,r){let i=a(),o=await n(i);if(o.status!==401)return o;if(!e.onAuth401)return t(`[bridge:api] ${r}: 401 received, no refresh handler`),o;if(t(`[bridge:api] ${r}: 401 received, attempting token refresh`),await e.onAuth401(i)){t(`[bridge:api] ${r}: Token refreshed, retrying request`);let e=await n(a());if(e.status!==401)return e;t(`[bridge:api] ${r}: Retry after refresh also got 401`)}else t(`[bridge:api] ${r}: Token refresh failed`);return o}return{async registerBridgeEnvironment(r){t(`[bridge:api] POST /v1/environments/bridge bridgeId=${r.bridgeId}`);let a=await c(t=>n.post(`${e.baseUrl}/v1/environments/bridge`,{machine_name:r.machineName,directory:r.dir,branch:r.branch,git_repo_url:r.gitRepoUrl,max_sessions:r.maxSessions,metadata:{worker_type:r.workerType},...r.reuseEnvironmentId&&{environment_id:r.reuseEnvironmentId}},{headers:i(t),timeout:15e3,validateStatus:e=>e<500}),`Registration`);return _(a.status,a.data,`Registration`),t(`[bridge:api] POST /v1/environments/bridge -> ${a.status} environment_id=${a.data.environment_id}`),t(`[bridge:api] >>> ${o({machine_name:r.machineName,directory:r.dir,branch:r.branch,git_repo_url:r.gitRepoUrl,max_sessions:r.maxSessions,metadata:{worker_type:r.workerType}})}`),t(`[bridge:api] <<< ${o(a.data)}`),a.data},async pollForWork(a,c,l,u){m(a,`environmentId`);let d=r;r=0;let f=await n.get(`${e.baseUrl}/v1/environments/${a}/work/poll`,{headers:i(c),params:u===void 0?void 0:{reclaim_older_than_ms:u},timeout:1e4,signal:l,validateStatus:e=>e<500});return _(f.status,f.data,`Poll`),s(`poll response: status=${f.status} hasData=${!!f.data} url=${e.baseUrl}`),f.data?(t(`[bridge:api] GET .../work/poll -> ${f.status} workId=${f.data.id} type=${f.data.data?.type}${f.data.data?.id?` sessionId=${f.data.data.id}`:``}`),t(`[bridge:api] <<< ${o(f.data)}`),f.data):(r=d+1,(r===1||r%100==0)&&t(`[bridge:api] GET .../work/poll -> ${f.status} (no work, ${r} consecutive empty polls)`),null)},async acknowledgeWork(r,a,o){m(r,`environmentId`),m(a,`workId`),t(`[bridge:api] POST .../work/${a}/ack`);let s=await n.post(`${e.baseUrl}/v1/environments/${r}/work/${a}/ack`,{},{headers:i(o),timeout:1e4,validateStatus:e=>e<500});_(s.status,s.data,`Acknowledge`),t(`[bridge:api] POST .../work/${a}/ack -> ${s.status}`)},async stopWork(r,a,o){m(r,`environmentId`),m(a,`workId`),t(`[bridge:api] POST .../work/${a}/stop force=${o}`);let s=await c(t=>n.post(`${e.baseUrl}/v1/environments/${r}/work/${a}/stop`,{force:o},{headers:i(t),timeout:1e4,validateStatus:e=>e<500}),`StopWork`);_(s.status,s.data,`StopWork`),t(`[bridge:api] POST .../work/${a}/stop -> ${s.status}`)},async deregisterEnvironment(r){m(r,`environmentId`),t(`[bridge:api] DELETE /v1/environments/bridge/${r}`);let a=await c(t=>n.delete(`${e.baseUrl}/v1/environments/bridge/${r}`,{headers:i(t),timeout:1e4,validateStatus:e=>e<500}),`Deregister`);_(a.status,a.data,`Deregister`),t(`[bridge:api] DELETE /v1/environments/bridge/${r} -> ${a.status}`)},async archiveSession(r){m(r,`sessionId`),t(`[bridge:api] POST /v1/sessions/${r}/archive`);let a=await c(t=>n.post(`${e.baseUrl}/v1/sessions/${r}/archive`,{},{headers:i(t),timeout:1e4,validateStatus:e=>e<500}),`ArchiveSession`);if(a.status===409){t(`[bridge:api] POST /v1/sessions/${r}/archive -> 409 (already archived)`);return}_(a.status,a.data,`ArchiveSession`),t(`[bridge:api] POST /v1/sessions/${r}/archive -> ${a.status}`)},async reconnectSession(r,a){m(r,`environmentId`),m(a,`sessionId`),t(`[bridge:api] POST /v1/environments/${r}/bridge/reconnect session_id=${a}`);let o=await c(t=>n.post(`${e.baseUrl}/v1/environments/${r}/bridge/reconnect`,{session_id:a},{headers:i(t),timeout:1e4,validateStatus:e=>e<500}),`ReconnectSession`);_(o.status,o.data,`ReconnectSession`),t(`[bridge:api] POST .../bridge/reconnect -> ${o.status}`)},async heartbeatWork(r,a,o){m(r,`environmentId`),m(a,`workId`),t(`[bridge:api] POST .../work/${a}/heartbeat`);let s=await n.post(`${e.baseUrl}/v1/environments/${r}/work/${a}/heartbeat`,{},{headers:i(o),timeout:1e4,validateStatus:e=>e<500});return _(s.status,s.data,`Heartbeat`),t(`[bridge:api] POST .../work/${a}/heartbeat -> ${s.status} lease_extended=${s.data.lease_extended} state=${s.data.state}`),s.data},async sendPermissionResponseEvent(r,a,s){m(r,`sessionId`),t(`[bridge:api] POST /v1/sessions/${r}/events type=${a.type}`);let c=await n.post(`${e.baseUrl}/v1/sessions/${r}/events`,{events:[a]},{headers:i(s),timeout:1e4,validateStatus:e=>e<500});_(c.status,c.data,`SendPermissionResponseEvent`),t(`[bridge:api] POST /v1/sessions/${r}/events -> ${c.status}`),t(`[bridge:api] >>> ${o({events:[a]})}`),t(`[bridge:api] <<< ${o(c.data)}`)}}}function _(e,t,n){if(e===200||e===204)return;let r=i(t),a=b(t);switch(e){case 401:throw new h(`${n}: Authentication failed (401)${r?`: ${r}`:``}. ${u}`,401,a);case 403:throw new h(v(a)?"Remote Control session has expired. Please restart with `claude remote-control` or /remote-control.":`${n}: Access denied (403)${r?`: ${r}`:``}. Check your organization permissions.`,403,a);case 404:throw new h(r??`${n}: Not found (404). Remote Control may not be available for this organization.`,404,a);case 410:throw new h(r??"Remote Control session has expired. Please restart with `claude remote-control` or /remote-control.",410,a??`environment_expired`);case 429:throw Error(`${n}: Rate limited (429). Polling too frequently.`);default:throw Error(`${n}: Failed with status ${e}${r?`: ${r}`:``}`)}}function v(e){return e?e.includes(`expired`)||e.includes(`lifetime`):!1}function y(e){return e.status===403?e.message.includes(`external_poll_sessions`)||e.message.includes(`environments:manage`):!1}function b(e){if(e&&typeof e==`object`&&`error`in e&&e.error&&typeof e.error==`object`&&`type`in e.error&&typeof e.error.type==`string`)return e.error.type}function x(e){let t=new AbortController;function n(){t.abort(),t=new AbortController}function r(){let n=new AbortController,r=()=>n.abort();if(e.aborted||t.signal.aborted)return n.abort(),{signal:n.signal,cleanup:()=>{}};e.addEventListener(`abort`,r,{once:!0});let i=t.signal;return i.addEventListener(`abort`,r,{once:!0}),{signal:n.signal,cleanup:()=>{e.removeEventListener(`abort`,r),i.removeEventListener(`abort`,r)}}}return{signal:r,wake:n}}export{y as a,l as c,v as i,h as n,m as o,g as r,d as s,x as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,F as r,P as i,R as a,c as o,i as s,x as c}from"./debug-BQj6h99Q.js";import{O as l,k as u}from"./git-DplvjXEY.js";import{dn as d,fn as f}from"./model-DlLO7TSx.js";import{l as p,r as m}from"./proxy-C0j74LqT.js";import{n as h,t as g}from"./userAgent-CNPTS7ix.js";import{C as _,S as v,f as y,g as b,u as x,x as S}from"./sessionState-BlbRQ3Y6.js";import{n as C}from"./jwtUtils-YCoZL0FW.js";import{randomUUID as w}from"crypto";a(),s(),l(),p(),h(),d(),_(),x(),c(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let r=0,i=0;for(;i<this.pending.length&&i<e;){let e;try{e=Buffer.byteLength(n(this.pending[i]))}catch{this.pending.splice(i,1);continue}if(i>0&&r+e>t)break;r+=e,i++}return this.pending.splice(0,i)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await f(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}d(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,m({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??S,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),y(()=>{this.writeEvent({type:`keep_alive`})}),o(`CCRClient: initialized, epoch=${this.workerEpoch}`),u(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||u(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,n,a,{timeout:s=1e4}={}){let c=this.getAuthHeaders();if(Object.keys(c).length===0)return{ok:!1};try{let r=await this.http[e](`${this.sessionBaseUrl}${t}`,n,{headers:{...c,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":g()},validateStatus:j,timeout:s});if(r.status>=200&&r.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(r.status===409&&this.handleEpochMismatch(),r.status===401||r.status===403){let e=v(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(o(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),u(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(o(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),u(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(o(`CCRClient: ${a} returned ${r.status}`,{level:`warn`}),u(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:r.status}),r.status===429){let e=r.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(n){return o(`CCRClient: ${a} failed: ${i(n)}`,{level:`warn`}),u(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:r(n)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){o(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),u(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&o(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return o(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,n){for(let n=1;n<=10;n++){let r;try{r=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":g()},validateStatus:j,timeout:3e4})}catch(t){o(`CCRClient: GET ${e} failed (attempt ${n}/10): ${i(t)}`,{level:`warn`}),n<10&&await f(Math.min(500*2**(n-1),3e4)+Math.random()*500);continue}if(r.status>=200&&r.status<300)return r.data;r.status===409&&this.handleEpochMismatch(),o(`CCRClient: GET ${e} returned ${r.status} (attempt ${n}/10)`,{level:`warn`}),n<10&&await f(Math.min(500*2**(n-1),3e4)+Math.random()*500)}return o(`CCRClient: GET retries exhausted`,{level:`error`}),u(`error`,`cli_worker_get_retries_exhausted`,{context:n}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),b(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,F as r,P as i,R as a,c as o,i as s,x as c}from"./debug-D58GQBDG.js";import{O as l,k as u}from"./git-By_J4XJL.js";import{dn as d,fn as f}from"./model-Cxx3suBa.js";import{l as p,r as m}from"./proxy-BhIc7-mj.js";import{n as h,t as g}from"./userAgent-CJ5Rp9kc.js";import{C as _,S as v,f as y,g as b,u as x,x as S}from"./sessionState-DAcub-HK.js";import{n as C}from"./jwtUtils-C_LG1txt.js";import{randomUUID as w}from"crypto";a(),s(),l(),p(),h(),d(),_(),x(),c(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let r=0,i=0;for(;i<this.pending.length&&i<e;){let e;try{e=Buffer.byteLength(n(this.pending[i]))}catch{this.pending.splice(i,1);continue}if(i>0&&r+e>t)break;r+=e,i++}return this.pending.splice(0,i)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await f(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}d(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,m({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??S,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),y(()=>{this.writeEvent({type:`keep_alive`})}),o(`CCRClient: initialized, epoch=${this.workerEpoch}`),u(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||u(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,n,a,{timeout:s=1e4}={}){let c=this.getAuthHeaders();if(Object.keys(c).length===0)return{ok:!1};try{let r=await this.http[e](`${this.sessionBaseUrl}${t}`,n,{headers:{...c,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":g()},validateStatus:j,timeout:s});if(r.status>=200&&r.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(r.status===409&&this.handleEpochMismatch(),r.status===401||r.status===403){let e=v(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(o(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),u(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(o(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),u(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(o(`CCRClient: ${a} returned ${r.status}`,{level:`warn`}),u(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:r.status}),r.status===429){let e=r.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(n){return o(`CCRClient: ${a} failed: ${i(n)}`,{level:`warn`}),u(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:r(n)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){o(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),u(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&o(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return o(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,n){for(let n=1;n<=10;n++){let r;try{r=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":g()},validateStatus:j,timeout:3e4})}catch(t){o(`CCRClient: GET ${e} failed (attempt ${n}/10): ${i(t)}`,{level:`warn`}),n<10&&await f(Math.min(500*2**(n-1),3e4)+Math.random()*500);continue}if(r.status>=200&&r.status<300)return r.data;r.status===409&&this.handleEpochMismatch(),o(`CCRClient: GET ${e} returned ${r.status} (attempt ${n}/10)`,{level:`warn`}),n<10&&await f(Math.min(500*2**(n-1),3e4)+Math.random()*500)}return o(`CCRClient: GET retries exhausted`,{level:`error`}),u(`error`,`cli_worker_get_retries_exhausted`,{context:n}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),b(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
@@ -1 +1 @@
1
- import{F as e,R as t}from"./debug-BQj6h99Q.js";import{o as n,s as r}from"./log-BlJ7CcKG.js";import{i,o as a,t as o}from"./platform-DVeTi9mp.js";import{a as s,i as c,s as l,u}from"./types-BomO8WUz.js";import{homedir as d}from"os";import{join as f}from"path";import{readFile as p,readdir as m,stat as h}from"fs/promises";s(),t(),l(),n(),a();async function g(){let e=i();if(!o.includes(e))throw Error(`Unsupported platform: ${e} - Work Mate Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Work Mate`,`claude_desktop_config.json`);let t=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(t){let e=`/mnt/c${t.replace(/^[A-Z]:/,``)}/AppData/Roaming/Work Mate/claude_desktop_config.json`;try{return await h(e),e}catch{}}try{let e=`/mnt/c/Users`;try{let t=await m(e,{withFileTypes:!0});for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=f(e,n.name,`AppData`,`Roaming`,`Work Mate`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){r(e)}throw Error(`Could not find Work Mate Desktop config file in Windows. Make sure Work Mate Desktop is installed on Windows.`)}async function _(){if(!o.includes(i()))throw Error(`Unsupported platform - Work Mate Desktop integration only works on macOS and WSL.`);try{let t=await g(),n;try{n=await p(t,{encoding:`utf8`})}catch(t){if(e(t)===`ENOENT`)return{};throw t}let r=u(n);if(!r||typeof r!=`object`)return{};let i=r.mcpServers;if(!i||typeof i!=`object`)return{};let a={};for(let[e,t]of Object.entries(i)){if(!t||typeof t!=`object`)continue;let n=c().safeParse(t);n.success&&(a[e]=n.data)}return a}catch(e){return r(e),{}}}export{_ as readClaudeDesktopMcpServers};
1
+ import{F as e,R as t}from"./debug-D58GQBDG.js";import{o as n,s as r}from"./log-CZ7ploQm.js";import{i,o as a,t as o}from"./platform-DMQxcm4K.js";import{a as s,i as c,s as l,u}from"./types-APu4OCXJ.js";import{homedir as d}from"os";import{join as f}from"path";import{readFile as p,readdir as m,stat as h}from"fs/promises";s(),t(),l(),n(),a();async function g(){let e=i();if(!o.includes(e))throw Error(`Unsupported platform: ${e} - Work Mate Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Work Mate`,`claude_desktop_config.json`);let t=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(t){let e=`/mnt/c${t.replace(/^[A-Z]:/,``)}/AppData/Roaming/Work Mate/claude_desktop_config.json`;try{return await h(e),e}catch{}}try{let e=`/mnt/c/Users`;try{let t=await m(e,{withFileTypes:!0});for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=f(e,n.name,`AppData`,`Roaming`,`Work Mate`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){r(e)}throw Error(`Could not find Work Mate Desktop config file in Windows. Make sure Work Mate Desktop is installed on Windows.`)}async function _(){if(!o.includes(i()))throw Error(`Unsupported platform - Work Mate Desktop integration only works on macOS and WSL.`);try{let t=await g(),n;try{n=await p(t,{encoding:`utf8`})}catch(t){if(e(t)===`ENOENT`)return{};throw t}let r=u(n);if(!r||typeof r!=`object`)return{};let i=r.mcpServers;if(!i||typeof i!=`object`)return{};let a={};for(let[e,t]of Object.entries(i)){if(!t||typeof t!=`object`)continue;let n=c().safeParse(t);n.success&&(a[e]=n.data)}return a}catch(e){return r(e),{}}}export{_ as readClaudeDesktopMcpServers};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-a82khZ_n.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-CJ-d0O-U.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
@@ -1 +1 @@
1
- import{n as e,t}from"./bundledMode--fG1S62b.js";import{i as n,r}from"./shellQuote-D3Ocv_U-.js";import{spawn as i}from"child_process";t(),r();function a(t){let n=[];for(let r=0;r<t.length;r++){let i=t[r];if(i===`-d`||i.startsWith(`-d `)||i.startsWith(`-d `)){n.push(i),i===`-d`&&r+1<t.length&&n.push(t[++r]);continue}if(i.startsWith(`-d`)&&i.includes(`:`)){n.push(i);continue}if(i===`--feature`){n.push(i),r+1<t.length&&n.push(t[++r]);continue}if(/^--inspect(-brk)?(=|$)/.test(i)){n.push(i);continue}if(i.startsWith(`--`)&&!i.includes(`=`)&&r+1<t.length){if(e())continue;n.push(i),n.push(t[++r]);continue}i.startsWith(`-`)&&!e()&&n.push(i)}return n}var o=Object.freeze(a(process.execArgv)),s=process.argv[1],c=process.execPath,l=process.platform===`win32`;function u(t,n){let r=n?.env??process.env,i=e()||!s?[...o,...t]:[...o,s,...t],a={...r};return l&&(process.env.CLAUDE_CODE_GIT_BASH_PATH&&!a.CLAUDE_CODE_GIT_BASH_PATH&&(a.CLAUDE_CODE_GIT_BASH_PATH=process.env.CLAUDE_CODE_GIT_BASH_PATH),process.env.SHELL&&!a.SHELL&&(a.SHELL=process.env.SHELL)),{execPath:c,args:i,env:a,windowsHide:l}}function d(e,t){return i(e.execPath,e.args,{...t,env:{...e.env,...t.env},windowsHide:e.windowsHide})}function f(e){return n([e.execPath,...e.args])}function p(){return o}function m(){return s}export{d as a,f as i,p as n,m as r,u as t};
1
+ import{n as e,t}from"./bundledMode--fG1S62b.js";import{i as n,r}from"./shellQuote-Ddgr1vif.js";import{spawn as i}from"child_process";t(),r();function a(t){let n=[];for(let r=0;r<t.length;r++){let i=t[r];if(i===`-d`||i.startsWith(`-d `)||i.startsWith(`-d `)){n.push(i),i===`-d`&&r+1<t.length&&n.push(t[++r]);continue}if(i.startsWith(`-d`)&&i.includes(`:`)){n.push(i);continue}if(i===`--feature`){n.push(i),r+1<t.length&&n.push(t[++r]);continue}if(/^--inspect(-brk)?(=|$)/.test(i)){n.push(i);continue}if(i.startsWith(`--`)&&!i.includes(`=`)&&r+1<t.length){if(e())continue;n.push(i),n.push(t[++r]);continue}i.startsWith(`-`)&&!e()&&n.push(i)}return n}var o=Object.freeze(a(process.execArgv)),s=process.argv[1],c=process.execPath,l=process.platform===`win32`;function u(t,n){let r=n?.env??process.env,i=e()||!s?[...o,...t]:[...o,s,...t],a={...r};return l&&(process.env.CLAUDE_CODE_GIT_BASH_PATH&&!a.CLAUDE_CODE_GIT_BASH_PATH&&(a.CLAUDE_CODE_GIT_BASH_PATH=process.env.CLAUDE_CODE_GIT_BASH_PATH),process.env.SHELL&&!a.SHELL&&(a.SHELL=process.env.SHELL)),{execPath:c,args:i,env:a,windowsHide:l}}function d(e,t){return i(e.execPath,e.args,{...t,env:{...e.env,...t.env},windowsHide:e.windowsHide})}function f(e){return n([e.execPath,...e.args])}function p(){return o}function m(){return s}export{d as a,f as i,p as n,m as r,u as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,l as n}from"./proxy-C0j74LqT.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";function a(e){if(s)return s;let n=new r({apiKey:process.env.GROK_API_KEY||process.env.XAI_API_KEY||``,baseURL:process.env.GROK_BASE_URL||o,maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:t({forAnthropicAPI:!1}),...e?.fetchOverride&&{fetch:e.fetchOverride}});return e?.fetchOverride||(s=n),n}var o,s,c=e((()=>{i(),n(),o=`https://api.x.ai/v1`,s=null}));export{c as n,a as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,l as n}from"./proxy-BhIc7-mj.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";function a(e){if(s)return s;let n=new r({apiKey:process.env.GROK_API_KEY||process.env.XAI_API_KEY||``,baseURL:process.env.GROK_BASE_URL||o,maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:t({forAnthropicAPI:!1}),...e?.fetchOverride&&{fetch:e.fetchOverride}});return e?.fetchOverride||(s=n),n}var o,s,c=e((()=>{i(),n(),o=`https://api.x.ai/v1`,s=null}));export{c as n,a as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./client-C_jBL1yC.js";e();export{t as clearOpenAIClientCache};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,l as n}from"./proxy-C0j74LqT.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let n=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:n,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:t({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),n(),m=null}));export{f as n,h as r,p as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,l as n}from"./proxy-BhIc7-mj.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let n=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:n,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:t({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),n(),m=null}));export{f as n,h as r,p as t};
@@ -0,0 +1 @@
1
+ import{Dr as e,Or as t}from"./model-Cxx3suBa.js";t();export{e as getOrganizationUUID};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./client-9uHzAmFH.js";e();export{t as getGrokClient};
@@ -0,0 +1 @@
1
+ import{Di as e,Li as t,Mi as n}from"./loadAgentsDir-DXOkUcW3.js";t();export{e as clearCommandsCache,n as getCommands};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$_ as t,Am as n,G_ as r,Im as i,J_ as a,La as o,Om as s,Pm as c,W_ as l,Y_ as u,_p as d,at as f,bC as p,bv as m,ev as h,fv as g,hn as _,iv as v,ka as y,l_ as b,o_ as x,ot as S,q_ as C,rv as w,s_ as T,u_ as E,vp as D,vv as O,xv as k,yC as A}from"./loadAgentsDir-CbtNPJV3.js";import{di as j,fi as M}from"./src-DL3w8VPk2.js";import{Wt as N,qt as P}from"./state-BPFYBqm1.js";import{L as F,R as I}from"./debug-BQj6h99Q.js";import{o as L,s as R}from"./log-BlJ7CcKG.js";function z(e,t){let n=d(`tip`),r=A(`app:toggleTranscript`,`Global`,`ctrl+o`),i=[...e.options.verbose?[]:[`(${r} to see full summary)`],...t?[t]:[],...n?[n]:[]];return j.dim(`Compacted ${i.join(`
2
- `)}`)}async function B(e,t){let n=e.getAppState(),r=await f(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=l({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[o,s]=await Promise.all([a(),C()]);return{systemPrompt:i,userContext:o,systemContext:s,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{M(),N(),S(),u(),p(),m(),E(),w(),t(),c(),s(),g(),I(),_(),L(),o(),D(),r(),V=async(e,t)=>{let{abortController:r}=t,{messages:o}=t;if(o=y(o),o.length===0)throw Error(`No messages to compact`);let s=e.trim();try{if(!s){let e=await n(o,t.agentId);if(e)return a.cache.clear?.(),i(),k(t.options.querySource??`compact`,t.agentId),P(),v(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await h(o,t)).messages,r=await b(e,t,await B(t,e),!1,s,!1);return O(void 0),v(),a.cache.clear?.(),i(),{type:`compact`,compactionResult:r,displayText:z(t,r.userDisplayMessage)}}catch(e){throw r.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(T):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(x):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$_ as t,Am as n,G_ as r,Im as i,J_ as a,La as o,Om as s,Pm as c,W_ as l,Y_ as u,_p as d,at as f,bv as p,ev as m,fv as h,hC as g,hn as _,iv as v,ka as y,l_ as b,mC as x,o_ as S,ot as C,q_ as w,rv as T,s_ as E,u_ as D,vp as O,vv as k,xv as A}from"./loadAgentsDir-DXOkUcW3.js";import{di as j,fi as M}from"./src-DL3w8VPk2.js";import{Kt as N,Ut as P}from"./state-D5D6QpTX.js";import{L as F,R as I}from"./debug-D58GQBDG.js";import{o as L,s as R}from"./log-CZ7ploQm.js";function z(e,t){let n=d(`tip`),r=x(`app:toggleTranscript`,`Global`,`ctrl+o`),i=[...e.options.verbose?[]:[`(${r} to see full summary)`],...t?[t]:[],...n?[n]:[]];return j.dim(`Compacted ${i.join(`
2
+ `)}`)}async function B(e,t){let n=e.getAppState(),r=await f(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=l({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[o,s]=await Promise.all([a(),w()]);return{systemPrompt:i,userContext:o,systemContext:s,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{M(),P(),C(),u(),g(),p(),D(),T(),t(),c(),s(),h(),I(),_(),L(),o(),O(),r(),V=async(e,t)=>{let{abortController:r}=t,{messages:o}=t;if(o=y(o),o.length===0)throw Error(`No messages to compact`);let s=e.trim();try{if(!s){let e=await n(o,t.agentId);if(e)return a.cache.clear?.(),i(),A(t.options.querySource??`compact`,t.agentId),N(),v(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await m(o,t)).messages,r=await b(e,t,await B(t,e),!1,s,!1);return k(void 0),v(),a.cache.clear?.(),i(),{type:`compact`,compactionResult:r,displayText:z(t,r.userDisplayMessage)}}catch(e){throw r.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(E):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(S):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
@@ -1,3 +1,3 @@
1
- import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,i as c,l,o as u}from"./envUtils-DcaKZlRU.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{Ar as f,Ci as p,Cr as m,Dr as h,Er as g,Fr as _,Or as v,Pr as ee,Si as te,Sr as ne,Wt as re,et as ie,fi as ae,gt as oe,hi as se,it as ce,jr as le,kr as ue,mi as de,oi as fe,pi as pe,si as me,vi as he,yi as ge}from"./state-BPFYBqm1.js";import{n as _e,t as ve}from"./cwd-Besi3Os3.js";import{C as y,F as b,O as x,R as ye,S as be,c as S,f as xe,i as Se,nt as Ce,tt as we,u as C,x as Te}from"./debug-BQj6h99Q.js";import{Cr as Ee,Dr as De,Fn as Oe,Jt as w,Or as ke,Qt as Ae,Xt as je,Yt as Me,_r as Ne,c as T,cr as Pe,g as Fe,lr as E,n as Ie,vr as Le,wn as Re,wr as ze}from"./settings-CvhsRFaT.js";import{O as Be,k as Ve,m as He,n as Ue}from"./git-DplvjXEY.js";import{d as We,o as Ge,s as Ke,u as qe}from"./log-BlJ7CcKG.js";import{m as Je}from"./sessionStoragePortable-x0Yn02-G.js";import{f as Ye,p as Xe,s as Ze,u as Qe}from"./types-BomO8WUz.js";import{n as $e,r as D}from"./analytics-DJobLaWP.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as j,resolve as nt,sep as rt}from"path";import{unwatchFile as it,watchFile as at}from"fs";import{randomBytes as ot}from"crypto";var M,st=t((()=>{p(),Le(),pe(),de(),M=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)te(t,ae(e)),e=Ne(e);return t}:se}));function ct(e){return he(e,ze,M)}var lt=t((()=>{ge(),st(),Ee()}));function ut(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(l(e))return!1;if(s(e))return!0;if(l(process.env.CLAUDE_CODE_SIMPLE)||l(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=Ie();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function dt(){return!1}function ft(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:c()}function pt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=j(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=j(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+rt).normalize(`NFC`)}function mt(){return pt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function ht(){return pt(T(`policySettings`)?.autoMemoryDirectory??T(`flagSettings`)?.autoMemoryDirectory??T(`localSettings`)?.autoMemoryDirectory??T(`userSettings`)?.autoMemoryDirectory,!0)}function gt(){return mt()!==void 0}function _t(){return Ue(ce())??ce()}function vt(){return A(N(),xt)}function yt(e){return j(e).startsWith(N())}var bt,xt,N,St=t((()=>{o(),re(),u(),He(),Pe(),Fe(),bt=`memory`,xt=`MEMORY.md`,N=a(()=>(mt()??ht())||(A(A(ft(),`projects`),Je(_t()),bt)+rt).normalize(`NFC`),()=>ce())}));function Ct(e,t,n,i){if(!r(e))return e;t=f(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=ue(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:me(t[a+1])?[]:{})}De(c,l,u),c=c[l]}return e}var wt=t((()=>{ke(),le(),fe(),i(),v()}));function Tt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=g(e,o);n(s,o)&&Ct(a,f(o,e),s)}return a}var Et=t((()=>{h(),wt(),le()}));function P(e,t){if(e==null)return{};var n=ee(ct(e),function(e){return[e]});return t=ne(t),Tt(e,n,function(e,n){return t(e,n[0])})}var Dt=t((()=>{_(),m(),Et(),lt()})),Ot=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),kt=n((e=>{var t=Ot();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),At=n(((e,t)=>{t.exports=kt()})),jt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Mt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=jt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Nt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Pt=n(((t,n)=>{var r=e(`path`),i=d(),a=At(),o=Mt(),s=Nt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),Ft=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),It=n(((e,t)=>{var n=Pt(),{toPromise:r,toSync:i,toSyncOptions:a}=Ft();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function F(){return I||(I=It()),I}function Lt(e,t){return F().lock(e,t)}function Rt(e,t){return F().lockSync(e,t)}function zt(e,t){return F().check(e,t)}var I,Bt=t((()=>{}));function L(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Vt(){return fn||(fn=Ht())}function Ht(){if(oe())return!0;let e=B(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=E(ve());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=E(nt(n,`..`));if(t===n)break;n=t}return!1}function R(e){let t=K.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function Ut(e){let t=null;try{Zt(w(),L,n=>{let r=e(n);return r===n?n:(t={...r,projects:Kt(n.projects)},t)})&&t&&z(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=H(w(),L);if(R(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Kt(r.projects)},Xt(w(),t,G),z(t)}}function Wt(){let e=J+Y;e>0&&D(`tengu_config_cache_stats`,{cache_hits:J,cache_misses:Y,hit_rate:J/e}),J=0,Y=0}function Gt(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Kt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function qt(){if(Z)return;Z=!0;let e=w();at(e,{interval:pn,persistent:!1},t=>{t.mtimeMs<=K.mtime||C().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=Qe(Xe(e));typeof n!=`object`||!n||(K={config:Gt({...L(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Ce(async()=>{it(e),Z=!1})}function z(e){K={config:e,mtime:Date.now()},q=null}function B(){if(K.config)return J++,K.config;Y++;try{let e=null;try{e=C().statSync(w())}catch{}let t=Gt(H(w(),L));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,qt(),t}catch{return Gt(H(w(),L))}}function Jt(){let e=B().remoteControlAtStartup;return e!==void 0&&e}function Yt(e){let t=B();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Xt(e,t,n){let r=k(e);C().mkdirSync(r),Oe(e,y(P(t,(e,t)=>y(e)!==y(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++}function Zt(e,t,n){let r=t(),i=k(e),a=C();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=Rt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Work Mate instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),q&&e===w())try{let t=a.statSync(e);(t.mtimeMs!==q.mtime||t.size!==q.size)&&D(`tengu_config_stale_write`,{read_mtime:q.mtime,write_mtime:t.mtimeMs,read_size:q.size,write_size:t.size})}catch(e){if(b(e)!==`ENOENT`)throw e}let l=H(e,t);if(e===w()&&R(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.workmate.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=P(u,(e,t)=>y(e)!==y(r[t]));try{let t=O(e),n=V();try{a.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){b(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return Oe(e,y(d,null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++,!0}finally{o&&o()}}function Qt(){if(Q)return;let e=Date.now();Ve(`info`,`enable_configs_started`),Q=!0,H(w(),L,!0),Ve(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function V(){return A(c(),`backups`)}function $t(e){let t=C(),n=O(e),r=V();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function H(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=C();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=be(Xe(n));return{...t(),...e}}catch(n){throw new x(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=$t(e);return n&&process.stderr.write(`\nWork Mate configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof x&&n)throw i;if(i instanceof x){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!U){U=!0;try{Ke(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{U=!1}}process.stderr.write(`\nWork Mate configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=V();try{r.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=$t(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
1
+ import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,i as c,l,o as u}from"./envUtils-DcaKZlRU.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{$ as f,Ar as p,Dr as m,Er as h,Nr as g,Or as _,Pr as v,Si as ee,Sr as te,Tr as ne,Ut as re,_i as ie,ai as ae,di as oe,fi as se,ht as ce,kr as le,mi as ue,oi as de,pi as fe,rt as pe,vi as me,xi as he,xr as ge}from"./state-D5D6QpTX.js";import{n as _e,t as ve}from"./cwd-Nh5IZNKO.js";import{C as y,F as b,O as x,R as ye,S as be,c as S,f as xe,i as Se,nt as Ce,tt as we,u as C,x as Te}from"./debug-D58GQBDG.js";import{Cn as Ee,Cr as De,Dr as Oe,Er as ke,Jt as Ae,Pn as je,Sr as Me,Yt as Ne,Zt as Pe,_r as Fe,cr as w,gr as Ie,h as Le,qt as T,s as E,sr as Re,t as ze}from"./settings-3xZ0fsvE.js";import{O as Be,k as Ve,m as He,n as Ue}from"./git-By_J4XJL.js";import{d as We,o as Ge,s as Ke,u as qe}from"./log-CZ7ploQm.js";import{m as Je}from"./sessionStoragePortable-x0Yn02-G.js";import{f as Ye,p as Xe,s as Ze,u as Qe}from"./types-APu4OCXJ.js";import{n as $e,r as D}from"./analytics-DJobLaWP.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as j,resolve as nt,sep as rt}from"path";import{unwatchFile as it,watchFile as at}from"fs";import{randomBytes as ot}from"crypto";var M,st=t((()=>{ee(),Fe(),se(),fe(),M=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)he(t,oe(e)),e=Ie(e);return t}:ue}));function ct(e){return ie(e,De,M)}var lt=t((()=>{me(),st(),Me()}));function ut(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(l(e))return!1;if(s(e))return!0;if(l(process.env.CLAUDE_CODE_SIMPLE)||l(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=ze();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function dt(){return!1}function ft(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:c()}function pt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=j(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=j(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+rt).normalize(`NFC`)}function mt(){return pt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function ht(){return pt(E(`policySettings`)?.autoMemoryDirectory??E(`flagSettings`)?.autoMemoryDirectory??E(`localSettings`)?.autoMemoryDirectory??E(`userSettings`)?.autoMemoryDirectory,!0)}function gt(){return mt()!==void 0}function _t(){return Ue(pe())??pe()}function vt(){return A(N(),xt)}function yt(e){return j(e).startsWith(N())}var bt,xt,N,St=t((()=>{o(),re(),u(),He(),Re(),Le(),bt=`memory`,xt=`MEMORY.md`,N=a(()=>(mt()??ht())||(A(A(ft(),`projects`),Je(_t()),bt)+rt).normalize(`NFC`),()=>pe())}));function Ct(e,t,n,i){if(!r(e))return e;t=le(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=_(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:de(t[a+1])?[]:{})}ke(c,l,u),c=c[l]}return e}var wt=t((()=>{Oe(),p(),ae(),i(),m()}));function Tt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ne(e,o);n(s,o)&&Ct(a,le(o,e),s)}return a}var Et=t((()=>{h(),wt(),p()}));function P(e,t){if(e==null)return{};var n=g(ct(e),function(e){return[e]});return t=ge(t),Tt(e,n,function(e,n){return t(e,n[0])})}var Dt=t((()=>{v(),te(),Et(),lt()})),Ot=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),kt=n((e=>{var t=Ot();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),At=n(((e,t)=>{t.exports=kt()})),jt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Mt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=jt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Nt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Pt=n(((t,n)=>{var r=e(`path`),i=d(),a=At(),o=Mt(),s=Nt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),Ft=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),It=n(((e,t)=>{var n=Pt(),{toPromise:r,toSync:i,toSyncOptions:a}=Ft();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function F(){return I||(I=It()),I}function Lt(e,t){return F().lock(e,t)}function Rt(e,t){return F().lockSync(e,t)}function zt(e,t){return F().check(e,t)}var I,Bt=t((()=>{}));function L(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Vt(){return dn||(dn=Ht())}function Ht(){if(ce())return!0;let e=H(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=w(ve());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=w(nt(n,`..`));if(t===n)break;n=t}return!1}function R(e){let t=q.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function z(e){let t=null;try{Yt(T(),L,n=>{let r=e(n);return r===n?n:(t={...r,projects:Wt(n.projects)},t)})&&t&&V(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=U(T(),L);if(R(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Wt(r.projects)},Jt(T(),t,K),V(t)}}function Ut(){let e=Y+X;e>0&&D(`tengu_config_cache_stats`,{cache_hits:Y,cache_misses:X,hit_rate:Y/e}),Y=0,X=0}function B(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Wt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Gt(){if(Z)return;Z=!0;let e=T();at(e,{interval:pn,persistent:!1},t=>{t.mtimeMs<=q.mtime||C().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=q.mtime)return;let n=Qe(Xe(e));typeof n!=`object`||!n||(q={config:B({...L(),...n}),mtime:t.mtimeMs},J={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Ce(async()=>{it(e),Z=!1})}function V(e){q={config:e,mtime:Date.now()},J=null}function H(){if(q.config)return Y++,q.config;X++;try{let e=null;try{e=C().statSync(T())}catch{}let t=B(U(T(),L));return q={config:t,mtime:e?.mtimeMs??Date.now()},J=e?{mtime:e.mtimeMs,size:e.size}:null,Gt(),t}catch{return B(U(T(),L))}}function Kt(){let e=H().remoteControlAtStartup;return e!==void 0&&e}function qt(e){let t=H();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Jt(e,t,n){let r=k(e);C().mkdirSync(r),je(e,y(P(t,(e,t)=>y(e)!==y(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===T()&&fn++}function Yt(e,t,n){let r=t(),i=k(e),a=C();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=Rt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Work Mate instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),J&&e===T())try{let t=a.statSync(e);(t.mtimeMs!==J.mtime||t.size!==J.size)&&D(`tengu_config_stale_write`,{read_mtime:J.mtime,write_mtime:t.mtimeMs,read_size:J.size,write_size:t.size})}catch(e){if(b(e)!==`ENOENT`)throw e}let l=U(e,t);if(e===T()&&R(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.workmate.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=P(u,(e,t)=>y(e)!==y(r[t]));try{let t=O(e),n=Zt();try{a.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){b(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return je(e,y(d,null,2),{encoding:`utf-8`,mode:384}),e===T()&&fn++,!0}finally{o&&o()}}function Xt(){if(Q)return;let e=Date.now();Ve(`info`,`enable_configs_started`),Q=!0,U(T(),L,!0),Ve(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function Zt(){return A(c(),`backups`)}function Qt(e){let t=C(),n=O(e),r=Zt();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function U(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=C();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=be(Xe(n));return{...t(),...e}}catch(n){throw new x(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=Qt(e);return n&&process.stderr.write(`\nWork Mate configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof x&&n)throw i;if(i instanceof x){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!W){W=!0;try{Ke(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{W=!1}}process.stderr.write(`\nWork Mate configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=Zt();try{r.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=Qt(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
2
2
  `),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
3
- `)}return t()}}function en(){let e=$(),t=B();if(!t.projects)return W;let n=t.projects[e]??W;return typeof n.allowedTools==`string`&&(n.allowedTools=Qe(n.allowedTools)??[]),n}function tn(e){let t=$(),n=null;try{Zt(w(),L,r=>{let i=r.projects?.[t]??W,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&z(n)}catch(r){S(`Failed to save config with lock: ${r}`,{level:`error`});let i=H(w(),L);if(R(i)){S(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??W,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Xt(w(),n,G),z(n)}}function nn(){return on()!==null}function rn(){return nn()&&!l(process.env.FORCE_AUTOUPDATE_PLUGINS)}function an(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function on(){if(!l(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(l(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=qe();if(e)return{type:`env`,envVar:e};let t=B();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function sn(){let e=B();if(e.userID)return e.userID;let t=ot(32).toString(`hex`);return Ut(e=>({...e,userID:t})),t}function cn(){if(!B().firstStartTime){let e=new Date().toISOString();Ut(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function ln(e){let t=ie();switch(e){case`User`:return A(c(),`AGENTS.md`);case`Local`:return A(t,`AGENTS.local.md`);case`Project`:return A(t,`AGENTS.md`);case`Managed`:return A(je(),`AGENTS.md`);case`AutoMem`:return vt();default:return A(c(),`AGENTS.md`)}}function un(){return A(je(),`.workmate`,`rules`)}function dn(){return A(c(),`rules`)}var U,W,G,fn,K,q,J,Y,X,pn,Z,Q,$,mn=t((()=>{o(),Dt(),re(),St(),$e(),_e(),we(),Se(),Be(),Me(),u(),ye(),Re(),xe(),He(),Ze(),Ye(),Bt(),Ge(),Pe(),We(),Ae(),Te(),U=!1,W={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!1},G=L(),fn=!1,{...G},{...W},K={config:null,mtime:0},q=null,J=0,Y=0,X=0,Ce(async()=>{Wt()}),pn=1e3,Z=!1,Q=!1,$=a(()=>{let e=ie();return E(Ue(e)||nt(e))})}));export{ft as A,Lt as C,wt as D,Ct as E,dt as F,ct as I,lt as L,St as M,yt as N,vt as O,ut as P,M as R,Bt as S,P as T,cn as _,on as a,rn as b,B as c,sn as d,$ as f,nn as g,mn as h,an as i,gt as j,N as k,un as l,dn as m,Vt as n,en as o,Jt as p,Qt as r,Yt as s,G as t,ln as u,tn as v,Dt as w,zt as x,Ut as y,st as z};
3
+ `)}return t()}}function $t(){let e=$(),t=H();if(!t.projects)return G;let n=t.projects[e]??G;return typeof n.allowedTools==`string`&&(n.allowedTools=Qe(n.allowedTools)??[]),n}function en(e){let t=$(),n=null;try{Yt(T(),L,r=>{let i=r.projects?.[t]??G,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&V(n)}catch(r){S(`Failed to save config with lock: ${r}`,{level:`error`});let i=U(T(),L);if(R(i)){S(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??G,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Jt(T(),n,K),V(n)}}function tn(){return an()!==null}function nn(){return tn()&&!l(process.env.FORCE_AUTOUPDATE_PLUGINS)}function rn(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function an(){if(!l(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(l(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=qe();if(e)return{type:`env`,envVar:e};let t=H();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function on(){let e=H();if(e.userID)return e.userID;let t=ot(32).toString(`hex`);return z(e=>({...e,userID:t})),t}function sn(){if(!H().firstStartTime){let e=new Date().toISOString();z(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function cn(e){let t=f();switch(e){case`User`:return A(c(),`AGENTS.md`);case`Local`:return A(t,`AGENTS.local.md`);case`Project`:return A(t,`AGENTS.md`);case`Managed`:return A(Ne(),`AGENTS.md`);case`AutoMem`:return vt();default:return A(c(),`AGENTS.md`)}}function ln(){return A(Ne(),`.workmate`,`rules`)}function un(){return A(c(),`rules`)}var W,G,K,dn,q,J,Y,X,fn,pn,Z,Q,$,mn=t((()=>{o(),Dt(),re(),St(),$e(),_e(),we(),Se(),Be(),Ae(),u(),ye(),Ee(),xe(),He(),Ze(),Ye(),Bt(),Ge(),Re(),We(),Pe(),Te(),W=!1,G={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!1},K=L(),dn=!1,{...K},{...G},q={config:null,mtime:0},J=null,Y=0,X=0,fn=0,Ce(async()=>{Ut()}),pn=1e3,Z=!1,Q=!1,$=a(()=>{let e=f();return w(Ue(e)||nt(e))})}));export{ft as A,Lt as C,wt as D,Ct as E,dt as F,ct as I,lt as L,St as M,yt as N,vt as O,ut as P,M as R,Bt as S,P as T,sn as _,an as a,nn as b,H as c,on as d,$ as f,tn as g,mn as h,rn as i,gt as j,N as k,ln as l,un as m,Vt as n,$t as o,Kt as p,Xt as r,qt as s,K as t,cn as u,en as v,Dt as w,zt as x,z as y,st as z};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-CsOlPcIW.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -1 +1 @@
1
- import{c as e,h as t,n,o as r,r as i,v as a,y as o}from"./config-BSkuQZNf.js";t();export{n as checkHasTrustDialogAccepted,i as enableConfigs,r as getCurrentProjectConfig,e as getGlobalConfig,a as saveCurrentProjectConfig,o as saveGlobalConfig};
1
+ import{c as e,h as t,n,o as r,r as i,v as a,y as o}from"./config-DRy1I12M.js";t();export{n as checkHasTrustDialogAccepted,i as enableConfigs,r as getCurrentProjectConfig,e as getGlobalConfig,a as saveCurrentProjectConfig,o as saveGlobalConfig};