@readmagic/workmate 0.0.18 → 0.0.20

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 (384) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Wa6Q24nu.js → AddWorkspaceDirectory-BYNvxNrD.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-3I_KlOLv.js → AgentsMdExternalIncludesDialog-CMEGV4Md.js} +1 -1
  4. package/dist/chunks/{App-BgPs1Bu8.js → App-W_9d1DjK.js} +1 -1
  5. package/dist/chunks/{ApproveApiKey-BxpapUq0.js → ApproveApiKey-Bf1Rb8Ql.js} +1 -1
  6. package/dist/chunks/ApproveApiKey-wpdvXpFr.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-lGn1Wj1k.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-8Cq982M0.js → BypassPermissionsModeDialog-CjVjyNf8.js} +1 -1
  9. package/dist/chunks/{DiffDialog-DwQTDWYh.js → DiffDialog-DCpchgp5.js} +2 -2
  10. package/dist/chunks/Doctor-6SjW91rd.js +1 -0
  11. package/dist/chunks/Doctor-FPYTivHw.js +3 -0
  12. package/dist/chunks/ExitFlow-Dy8_1D8J.js +2 -0
  13. package/dist/chunks/{Grove-_QX_wR9C.js → Grove-Dd6rjs5P.js} +1 -1
  14. package/dist/chunks/{HybridTransport-BG2VIIBC.js → HybridTransport-CJVkWa2u.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-BDdMkuaL.js → InvalidConfigDialog-Bisj9ic_.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-DSCqbVER.js → InvalidSettingsDialog-DyTPNRQR.js} +1 -1
  17. package/dist/chunks/MCPConnectionManager-DfyoZaiu.js +1 -0
  18. package/dist/chunks/MCPToolListView-Dioupv8F.js +1 -0
  19. package/dist/chunks/{McpParsingWarnings-Cr_n2QR6.js → McpParsingWarnings-BUlgpZAF.js} +1 -1
  20. package/dist/chunks/MessageSelector-D8fylxPg.js +3 -0
  21. package/dist/chunks/Messages-BZDFMYBT.js +10 -0
  22. package/dist/chunks/{Onboarding-Cz3CfOTl.js → Onboarding-BKLomZYo.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-GhA5Qa1I.js → PromptInputFooterSuggestions-DCum89fF.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-sX_yHORM.js → PromptInputHelpMenu-DG2lRqis.js} +1 -1
  25. package/dist/chunks/QueryEngine-CyGHpX7M.js +1 -0
  26. package/dist/chunks/REPL-BDsz8KIx.js +1 -0
  27. package/dist/chunks/REPL-CCBNfZfs.js +128 -0
  28. package/dist/chunks/RemoteSessionManager-BfsOv4K6.js +2 -0
  29. package/dist/chunks/{ResumeConversation-e5sISbWn.js → ResumeConversation-pC8NLq0F.js} +1 -1
  30. package/dist/chunks/{SSETransport-BuDKErlN.js → SSETransport-B3K6eH9I.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +1 -0
  32. package/dist/chunks/Settings-CKaGmKg2.js +2 -0
  33. package/dist/chunks/{TeleportProgress-BUtze4qa.js → TeleportProgress-CkgSp1cs.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-Dp7rzrrz.js → TeleportRepoMismatchDialog-DdO_rECq.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-Ch2osY21.js → TeleportResumeWrapper-BeG4N-2z.js} +1 -1
  36. package/dist/chunks/{ThemePicker-AA-0hjpq.js → ThemePicker-iD9ufy99.js} +1 -1
  37. package/dist/chunks/{TrustDialog-rO5dZ8G-.js → TrustDialog-qO5OdQt8.js} +1 -1
  38. package/dist/chunks/{ValidationErrorsList-DayOwxq9.js → ValidationErrorsList-BfZ5gcIv.js} +1 -1
  39. package/dist/chunks/add-dir-C4eSVlZ6.js +1 -0
  40. package/dist/chunks/{agentDisplay-nVTmC7tL.js → agentDisplay-BM4QG_RX.js} +1 -1
  41. package/dist/chunks/{agents-BQwi-6GV.js → agents-BbDBN5l9.js} +1 -1
  42. package/dist/chunks/agents-D3APE_8d.js +101 -0
  43. package/dist/chunks/allErrors-BkgB7JNK.js +1 -0
  44. package/dist/chunks/api-BHBK9axp.js +1 -0
  45. package/dist/chunks/{api-DAyhTxgY.js → api-DyUWfg3a.js} +1 -1
  46. package/dist/chunks/{auth-BzrroWLq.js → auth-0rn1U4Eq.js} +1 -1
  47. package/dist/chunks/auth-BEoTPSgC.js +1 -0
  48. package/dist/chunks/auth-BPug7U_u.js +1 -0
  49. package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +1 -0
  50. package/dist/chunks/backgroundHousekeeping-km82qEh0.js +17 -0
  51. package/dist/chunks/{banner-BfIcVEUU.js → banner-BkUdig-T.js} +1 -1
  52. package/dist/chunks/{bg-C15c_rMK.js → bg-tGgpwpYx.js} +2 -2
  53. package/dist/chunks/branch-CQ38cx5n.js +2 -0
  54. package/dist/chunks/{break-cache-XKbOAw-u.js → break-cache-CcwOjTKt.js} +3 -3
  55. package/dist/chunks/{bridgeConfig-Bxkrv8ZL.js → bridgeConfig-C5L-7KaP.js} +1 -1
  56. package/dist/chunks/bridgeConfig-CJMjDoaP.js +1 -0
  57. package/dist/chunks/{bridgeMessaging-BcSjIPCZ.js → bridgeMessaging-DVC3qj-C.js} +1 -1
  58. package/dist/chunks/{bridgePointer-CGhOBNMg.js → bridgePointer-DfTOjgtX.js} +1 -1
  59. package/dist/chunks/{bridgeStatusUtil-DBWBTU31.js → bridgeStatusUtil-Cex6VowM.js} +1 -1
  60. package/dist/chunks/btw-_P96ffHR.js +1 -0
  61. package/dist/chunks/caches-DH-q8Fjf.js +1 -0
  62. package/dist/chunks/caches-Dq0pJFDP.js +1 -0
  63. package/dist/chunks/{capacityWake-C24_KT1x.js → capacityWake-BpP6c7x3.js} +1 -1
  64. package/dist/chunks/{ccrClient-CH6PsxJJ.js → ccrClient-DO563xlf.js} +1 -1
  65. package/dist/chunks/{claudeDesktop-CovdLe-b.js → claudeDesktop-DPc_SaVn.js} +1 -1
  66. package/dist/chunks/{clear-D72LxXA6.js → clear-DmqQBNKg.js} +1 -1
  67. package/dist/chunks/{cliLaunch-DDA65zeR.js → cliLaunch-DDtwAolw.js} +1 -1
  68. package/dist/chunks/{client-o5_awagP.js → client-9uHzAmFH.js} +1 -1
  69. package/dist/chunks/client-BVal_QII.js +1 -0
  70. package/dist/chunks/client-C19cqYQS.js +1 -0
  71. package/dist/chunks/{client-eLOYyeES.js → client-C_jBL1yC.js} +1 -1
  72. package/dist/chunks/client-Dd7CKMRX.js +1 -0
  73. package/dist/chunks/commands-BkpqHY9F.js +1 -0
  74. package/dist/chunks/{compact--fnu8Zd-.js → compact-DuVIvqMu.js} +2 -2
  75. package/dist/chunks/config-DMP6-Ccr.js +1 -0
  76. package/dist/chunks/{config-BybjRr09.js → config-DRy1I12M.js} +2 -2
  77. package/dist/chunks/{config-BlQhL9Bh.js → config-e0Goy478.js} +1 -1
  78. package/dist/chunks/{context-D6PaqwrR.js → context-DjgMzIfe.js} +1 -1
  79. package/dist/chunks/{context-noninteractive-CxoMCfR4.js → context-noninteractive-BzDVMnWC.js} +5 -5
  80. package/dist/chunks/context-noninteractive-DV7bIJCm.js +1 -0
  81. package/dist/chunks/conversation-BBOE_EoE.js +1 -0
  82. package/dist/chunks/conversation-WxH5pb2z.js +1 -0
  83. package/dist/chunks/{createSSHSession-B3FdForb.js → createSSHSession-LVGVXHXL.js} +1 -1
  84. package/dist/chunks/createSession-BUzna9-E.js +1 -0
  85. package/dist/chunks/{createSession-C0e_DHsW.js → createSession-Dgwxk1WA.js} +1 -1
  86. package/dist/chunks/crossProjectResume-6B2NYy8a.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-ZxeaKwKd.js → datadog-Bc6wkPne.js} +1 -1
  90. package/dist/chunks/{debug-D7OBvqC2.js → debug-D58GQBDG.js} +1 -1
  91. package/dist/chunks/{debugUtils-B-GMBTBk.js → debugUtils-DXBRbwCE.js} +1 -1
  92. package/dist/chunks/{detached-uMuMcLsV.js → detached-Biz-xhu0.js} +1 -1
  93. package/dist/chunks/{detectRepository-AVEUw4lk.js → detectRepository-CDOJ-M7h.js} +1 -1
  94. package/dist/chunks/detectRepository-Cv9-k6dg.js +1 -0
  95. package/dist/chunks/{diff-BA2vN7sD.js → diff-DIg66U_d.js} +1 -1
  96. package/dist/chunks/{directoryCompletion-CLcmLin8.js → directoryCompletion-BDGcGDuv.js} +1 -1
  97. package/dist/chunks/doctor-BhUmhHQU.js +1 -0
  98. package/dist/chunks/{entry-cou5DS53.js → entry-B-Y-AYeK.js} +4 -4
  99. package/dist/chunks/{esm-D9-9wS1F.js → esm-CvHtYRrr.js} +1 -1
  100. package/dist/chunks/{execFileNoThrow-BHDSgTpZ.js → execFileNoThrow-Bmb5HEFz.js} +1 -1
  101. package/dist/chunks/{execSyncWrapper-pYxQXqb-.js → execSyncWrapper-C3ZFV9od.js} +1 -1
  102. package/dist/chunks/{exit-DdZJHhy2.js → exit-CW2eqUrR.js} +1 -1
  103. package/dist/chunks/{extraUsage-CHnG6JNH.js → extraUsage-CkTon7ib.js} +1 -1
  104. package/dist/chunks/extractMemories-CfmbvayQ.js +1 -0
  105. package/dist/chunks/fast-ByahC7Gw.js +1 -0
  106. package/dist/chunks/{fast-Bl_0cs9e.js → fast-xtIP4u4y.js} +1 -1
  107. package/dist/chunks/fetchModelList-D9aePIPW.js +1 -0
  108. package/dist/chunks/{fetchModelList-CheIBH5f.js → fetchModelList-Dy-x4h3G.js} +1 -1
  109. package/dist/chunks/{fileSuggestions-Dl87JhBr.js → fileSuggestions-CFkJktgc.js} +2 -2
  110. package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +1 -0
  111. package/dist/chunks/{firstPartyEventLogger-Cw9Bc3on.js → firstPartyEventLogger-DqGSujCz.js} +2 -2
  112. package/dist/chunks/{flushGate-BD3Tk3_k.js → flushGate-BjKW7PFC.js} +1 -1
  113. package/dist/chunks/{gemini-BARUjH_t.js → gemini-NnmxBoEp.js} +1 -1
  114. package/dist/chunks/{generateSessionName-CHaK44K-.js → generateSessionName-EpqGW-T2.js} +1 -1
  115. package/dist/chunks/{genericProcessUtils-D5hCZ2ho.js → genericProcessUtils-6E7fB1dI.js} +1 -1
  116. package/dist/chunks/{git-CNhyfMtb.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-fTQFogdl.js → goal-DbS8yJfB.js} +1 -1
  120. package/dist/chunks/{grok-D0J4IiCe.js → grok-BxZ4vTDw.js} +1 -1
  121. package/dist/chunks/{grove-mDH4wkhM.js → grove-CYE1Cfcz.js} +1 -1
  122. package/dist/chunks/{help-Dr7st1Yv.js → help-DatnwM25.js} +1 -1
  123. package/dist/chunks/{hooks-DCfpFhl2.js → hooks-7iyENdDG.js} +2 -2
  124. package/dist/chunks/hooks-DjbqtbUV.js +1 -0
  125. package/dist/chunks/initReplBridge-BEZW5PEY.js +1 -0
  126. package/dist/chunks/install-DJukI-kL.js +1 -0
  127. package/dist/chunks/{instrumentation-DS2S1m1a.js → instrumentation-2HH15DPu.js} +4 -4
  128. package/dist/chunks/{job-Dry-GMc5.js → job-CXz7SLZp.js} +1 -1
  129. package/dist/chunks/{jwtUtils-ClCcC8lO.js → jwtUtils-C_LG1txt.js} +1 -1
  130. package/dist/chunks/keybindings-C9l5il16.js +1 -0
  131. package/dist/chunks/{launchLocalMemory-_T0oHfh9.js → launchLocalMemory-BfGenqj1.js} +1 -1
  132. package/dist/chunks/{launchOnboarding-D4fS6pLc.js → launchOnboarding-DjMmXeQE.js} +1 -1
  133. package/dist/chunks/{loadAgentsDir-DnsldjYU.js → loadAgentsDir-DaNpxaO-.js} +588 -623
  134. package/dist/chunks/loadAgentsDir-DcI-8FQF.js +1 -0
  135. package/dist/chunks/{loadPluginHooks-CRoYa_il.js → loadPluginHooks-CGgpcyEC.js} +1 -1
  136. package/dist/chunks/{loader-C-PQ3onD.js → loader-C33o_5kS.js} +1 -1
  137. package/dist/chunks/{localSearch-nuNjYVKq.js → localSearch-C2SZ9bGW.js} +1 -1
  138. package/dist/chunks/localSearch-CTTwYTU1.js +1 -0
  139. package/dist/chunks/{log-CR0v5KUR.js → log-CZ7ploQm.js} +1 -1
  140. package/dist/chunks/{logoV2Utils-CZwL_VX1.js → logoUtils-CbIqOFrX.js} +1 -1
  141. package/dist/chunks/{magicDocs-D0rjtxup.js → magicDocs-CrTwULyJ.js} +2 -2
  142. package/dist/chunks/{main-DKqCPH3G.js → main-Blm02_Js.js} +2 -2
  143. package/dist/chunks/{main-C8n_p7yX.js → main-bJXadFi0.js} +30 -30
  144. package/dist/chunks/managedEnv-CUsdYhAI.js +1 -0
  145. package/dist/chunks/managedEnv-DXeaUDSK.js +1 -0
  146. package/dist/chunks/{mappers-BIDALdjB.js → mappers-_B-s9fNz.js} +1 -1
  147. package/dist/chunks/mcp-BbbYzWpy.js +6 -0
  148. package/dist/chunks/mcp-D91sH9a8.js +1 -0
  149. package/dist/chunks/mcp-Dx-zgUgu.js +2 -0
  150. package/dist/chunks/{memoize-C7xmvAQ0.js → memoize-CumjjK2Q.js} +1 -1
  151. package/dist/chunks/memory-BeL7ui9m.js +1 -0
  152. package/dist/chunks/{mode-CajUX4Uz.js → mode-D695kgLI.js} +1 -1
  153. package/dist/chunks/model-DX0TtzqX.js +1 -0
  154. package/dist/chunks/{model-xI2MbgRj.js → model-Do0f476p.js} +1 -1
  155. package/dist/chunks/model-DpcM8dz5.js +1 -0
  156. package/dist/chunks/{modelOptions-Ct80yABl.js → modelOptions-B3nis9cC.js} +1 -1
  157. package/dist/chunks/{src-l6_O0K-a.js → modifiersNative-BYHdmWw1.js} +1 -1
  158. package/dist/chunks/modifiersNative-D7nm70eq.js +1 -0
  159. package/dist/chunks/{nativeInstaller-C6aWHxve.js → nativeInstaller-CymO8TNe.js} +1 -1
  160. package/dist/chunks/omit-DO61BHZu.js +1 -0
  161. package/dist/chunks/onChangeAppState-vKml_lit.js +1 -0
  162. package/dist/chunks/{openai-wsPCDwGL.js → openai-DdupGVdC.js} +2 -2
  163. package/dist/chunks/{panel-BKMLX5AR.js → panel-CVd1dzYl.js} +1 -1
  164. package/dist/chunks/parser-Cq9X7HMP.js +1 -0
  165. package/dist/chunks/{parser-Dy-RMf4a.js → parser-eVu-cTRs.js} +1 -1
  166. package/dist/chunks/partition-BivH9MBJ.js +1 -0
  167. package/dist/chunks/permissions-C9iqR4_N.js +3 -0
  168. package/dist/chunks/pidLock-DiKz5Tza.js +3 -0
  169. package/dist/chunks/{plan-CTiLy_c4.js → plan-KDN5IGWY.js} +1 -1
  170. package/dist/chunks/{platform-BZm4WVLM.js → platform-DMQxcm4K.js} +1 -1
  171. package/dist/chunks/plugin-D0rzUb8E.js +17 -0
  172. package/dist/chunks/{pluginAutoupdate-DzK-fXJC.js → pluginAutoupdate-C2xTKLR_.js} +1 -1
  173. package/dist/chunks/{pluginBlocklist-B3JVl1h2.js → pluginBlocklist-xdiUmUpt.js} +1 -1
  174. package/dist/chunks/{pluginCliCommands-CubOvlhc.js → pluginCliCommands-CIDDvVN7.js} +1 -1
  175. package/dist/chunks/{pluginFlagging-Dp7W2eL8.js → pluginFlagging-DRA0m76J.js} +1 -1
  176. package/dist/chunks/pluginOperations-BEYsarAn.js +2 -0
  177. package/dist/chunks/{pluginStartupCheck-CL24_zVV.js → pluginStartupCheck-BF1N4Lih.js} +1 -1
  178. package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +1 -0
  179. package/dist/chunks/{plugins-DA3lpRU4.js → plugins-CWWU4BKs.js} +4 -4
  180. package/dist/chunks/poorMode-BTIe8W_H.js +1 -0
  181. package/dist/chunks/poorMode-CKQfWf3S.js +1 -0
  182. package/dist/chunks/print-B5H2xbBS.js +14 -0
  183. package/dist/chunks/processBashCommand-EQ9EWaRV.js +1 -0
  184. package/dist/chunks/processSlashCommand-C4PKNyFT.js +5 -0
  185. package/dist/chunks/{prompt-CzQkcxfg.js → prompt-8u06WVES.js} +17 -17
  186. package/dist/chunks/prompt-B9sDzLPK.js +1 -0
  187. package/dist/chunks/prompt-WsoTRhoh.js +1 -0
  188. package/dist/chunks/{promptEditor-C6w1vT5E.js → promptEditor-Cr4w-4Bz.js} +1 -1
  189. package/dist/chunks/{protocolHandler-B3bQyB6W.js → protocolHandler-DzHVaPl3.js} +2 -2
  190. package/dist/chunks/{proxy-DFIxRT0i.js → proxy-BhIc7-mj.js} +1 -1
  191. package/dist/chunks/reconciler-RIKmaPg7.js +1 -0
  192. package/dist/chunks/refresh-CCSCAjgz.js +1 -0
  193. package/dist/chunks/registerProtocol-C0IlPEoa.js +1 -0
  194. package/dist/chunks/{reload-plugins-BnZzcRcd.js → reload-plugins-DC-tbXVv.js} +1 -1
  195. package/dist/chunks/{remoteBridgeCore-DAK9KSWp.js → remoteBridgeCore-NGTnhQgw.js} +1 -1
  196. package/dist/chunks/remoteManagedSettings-BoOYHzYP.js +1 -0
  197. package/dist/chunks/{rename-OSN3Ua2J.js → rename-DS1AmW-F.js} +1 -1
  198. package/dist/chunks/{renderOptions-XgkOdKCJ.js → renderOptions-D-aQZbzS.js} +1 -1
  199. package/dist/chunks/resume-Cf5PSoPw.js +2 -0
  200. package/dist/chunks/{ripgrep-C_XuTqp3.js → ripgrep-C3jtZL7k.js} +1 -1
  201. package/dist/chunks/ripgrep-CBUbn6Po.js +1 -0
  202. package/dist/chunks/{runtimeObserver-CuTsWhhF.js → runtimeObserver-DzesbvgI.js} +1 -1
  203. package/dist/chunks/{runtimeObserver-D9sujsqj.js → runtimeObserver-L6041elO.js} +2 -2
  204. package/dist/chunks/sandbox-adapter-Z4Phj31K.js +1 -0
  205. package/dist/chunks/{sandbox-toggle-oasrWfbj.js → sandbox-toggle-COZE8Lo4.js} +1 -1
  206. package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
  207. package/dist/chunks/searchExtraTools-CvkRbL2m.js +1 -0
  208. package/dist/chunks/{session-c46jULDV.js → session-BvA99K4j.js} +1 -1
  209. package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +1 -0
  210. package/dist/chunks/{sessionObserver-Cu7vykWp.js → sessionObserver-0D8xFoRK.js} +1 -1
  211. package/dist/chunks/sessionObserver-CRWUBJEY.js +1 -0
  212. package/dist/chunks/{sessionState-B3tFm9SC.js → sessionState-CQhbGfmh.js} +2 -2
  213. package/dist/chunks/sessionStorage-DqEuxDlb.js +1 -0
  214. package/dist/chunks/{sessionTracing-BRp_Ej-e.js → sessionTracing-BoOZsXU2.js} +1 -1
  215. package/dist/chunks/{settings-DUyIag_5.js → settings-3xZ0fsvE.js} +4 -4
  216. package/dist/chunks/settings-Crx1cI1u.js +1 -0
  217. package/dist/chunks/settingsSync-rkWmClKS.js +1 -0
  218. package/dist/chunks/setup-D8L275fT.js +3 -0
  219. package/dist/chunks/{shadowedRuleDetection-ChoqK1Iq.js → shadowedRuleDetection-Cy9tsuKc.js} +1 -1
  220. package/dist/chunks/{shellQuote-C-7PluUY.js → shellQuote-Ddgr1vif.js} +1 -1
  221. package/dist/chunks/{sideQuestion-CkC27Pf3.js → sideQuestion-Ds7Elgs4.js} +1 -1
  222. package/dist/chunks/{sinks-C9qCsi94.js → sinks-BXX72cbf.js} +1 -1
  223. package/dist/chunks/sinks-DMp6uEzM.js +1 -0
  224. package/dist/chunks/skillChangeDetector-CtithJ4a.js +1 -0
  225. package/dist/chunks/{skillGapStore-DC8s2Whn.js → skillGapStore-BxCxKPev.js} +2 -2
  226. package/dist/chunks/{skillLifecycle-BaqH5lw_.js → skillLifecycle-CfyNC3sW.js} +2 -2
  227. package/dist/chunks/{skillSearchPanel-Dtvyo2Dk.js → skillSearchPanel-CMNJFIEC.js} +3 -3
  228. package/dist/chunks/{skills-DXW57WeY.js → skills-DXMk-498.js} +1 -1
  229. package/dist/chunks/{startupProfiler-BqUlQEaV.js → startupProfiler-CbzxVmbv.js} +1 -1
  230. package/dist/chunks/startupProfiler-uHetQush.js +1 -0
  231. package/dist/chunks/state-BStOuCh4.js +1 -0
  232. package/dist/chunks/{state-B3zvBu4R.js → state-D5D6QpTX.js} +1 -1
  233. package/dist/chunks/{stats-vvwEVnon.js → stats-Ce15gc3E.js} +1 -1
  234. package/dist/chunks/{status-g_dhM6Ep.js → status-CFrLuGbf.js} +2 -2
  235. package/dist/chunks/status-D5OCkMZG.js +1 -0
  236. package/dist/chunks/{statusNoticeHelpers-B235FWru.js → statusNoticeHelpers-CZoOse-_.js} +1 -1
  237. package/dist/chunks/{stringUtils-CGZoOfer.js → stringUtils-CKD8qDqx.js} +1 -1
  238. package/dist/chunks/switcher-AiMcRzoi.js +1 -0
  239. package/dist/chunks/{switcher-OAeeTHHt.js → switcher-DQF5ZNal.js} +1 -1
  240. package/dist/chunks/syncCache-qWJ_VfBo.js +1 -0
  241. package/dist/chunks/{tasks--7yJk7MD.js → tasks-C8pb6ftc.js} +1 -1
  242. package/dist/chunks/{teleport-ja50aVy3.js → teleport-Bi_1VFIZ.js} +1 -1
  243. package/dist/chunks/{templateJobs-DSM3tNDS.js → templateJobs-DJ4dcfcL.js} +1 -1
  244. package/dist/chunks/{terminalSetup-C735-5lZ.js → terminalSetup-7PdC4fV5.js} +1 -1
  245. package/dist/chunks/{terminalSetup-BpZXqE_G.js → terminalSetup-kWdZRKWq.js} +1 -1
  246. package/dist/chunks/{theme-BX54e0r7.js → theme-CEKOCSLw.js} +1 -1
  247. package/dist/chunks/{tmux-BIdWN33b.js → tmux-CpGd0Aca.js} +1 -1
  248. package/dist/chunks/{toolEventObserver-O6ljakS9.js → toolEventObserver-D2nk8ZbW.js} +1 -1
  249. package/dist/chunks/toolPool-Df5iUqJ-.js +1 -0
  250. package/dist/chunks/{trustedDevice-Kyid5Fuy.js → trustedDevice-CB6rNzl-.js} +1 -1
  251. package/dist/chunks/trustedDevice-DXGePUAC.js +1 -0
  252. package/dist/chunks/{types-DDku8UKF.js → types-APu4OCXJ.js} +1 -1
  253. package/dist/chunks/{udsClient-B2yCKNgT.js → udsClient-U7MEfYj7.js} +1 -1
  254. package/dist/chunks/{upstreamproxy--RTAcgrE.js → upstreamproxy-CTOuotLO.js} +1 -1
  255. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BnmDpMkm.js → useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js} +1 -1
  256. package/dist/chunks/useMainLoopModel-CIG2cjS2.js +1 -0
  257. package/dist/chunks/useManagePlugins-MSHw-qHx.js +1 -0
  258. package/dist/chunks/{useMergedTools-ChLA8dsy.js → useMergedTools-Bb-INJa2.js} +1 -1
  259. package/dist/chunks/{useSearchInput-DqymtQhH.js → useSearchInput-QL_VtdJD.js} +1 -1
  260. package/dist/chunks/useSettingsErrors-Dvi6zLCr.js +1 -0
  261. package/dist/chunks/{userAgent-D8vvjitA.js → userAgent-i-oGzf40.js} +1 -1
  262. package/dist/chunks/{util-CC-NRn16.js → util-CLQvtXuD.js} +1 -1
  263. package/dist/chunks/validatePlugin-1mTZ3TJR.js +1 -0
  264. package/dist/chunks/{vim-CIK2DjfK.js → vim-BagKUX4j.js} +1 -1
  265. package/dist/chunks/{which-3MmqfsNV.js → which-BxQ1hpjp.js} +1 -1
  266. package/dist/chunks/{windowsPaths-x-CxdtFP.js → windowsPaths-BdhjMYTm.js} +1 -1
  267. package/dist/chunks/windowsPaths-DtGZ83kH.js +1 -0
  268. package/dist/chunks/{workSecret-BsolC5S7.js → workSecret-CaM2yIJD.js} +1 -1
  269. package/dist/chunks/{workerRegistry-DE4Ghp-n.js → workerRegistry-BjxoZ12l.js} +2 -2
  270. package/dist/chunks/worktree-DpksgxdF.js +1 -0
  271. package/dist/cli.js +1 -1
  272. package/package.json +1 -5
  273. package/dist/chunks/AgentsMdExternalIncludesDialog-h150UBir.js +0 -1
  274. package/dist/chunks/ApproveApiKey-DIIIi6U8.js +0 -1
  275. package/dist/chunks/BackgroundTasksDialog-nfRmiGl3.js +0 -2
  276. package/dist/chunks/Doctor-Beo5yEMD.js +0 -1
  277. package/dist/chunks/Doctor-BxXAGr-Z.js +0 -3
  278. package/dist/chunks/ExitFlow-CVIuvrHT.js +0 -2
  279. package/dist/chunks/MCPConnectionManager-Cer1UawR.js +0 -1
  280. package/dist/chunks/MCPToolListView-DndNWDr1.js +0 -1
  281. package/dist/chunks/MessageSelector-BfmbAG8E.js +0 -3
  282. package/dist/chunks/Messages-CUJJ6nHV.js +0 -10
  283. package/dist/chunks/QueryEngine-C6Dx_-U8.js +0 -1
  284. package/dist/chunks/REPL-BPig-OIh.js +0 -128
  285. package/dist/chunks/REPL-e5wWV2Sl.js +0 -1
  286. package/dist/chunks/RemoteSessionManager-Cax4g0GH.js +0 -2
  287. package/dist/chunks/SearchExtraToolsTool-B_z74zwG.js +0 -1
  288. package/dist/chunks/Settings-B9rxF2wR.js +0 -2
  289. package/dist/chunks/add-dir-Cz33IGht.js +0 -1
  290. package/dist/chunks/agents-rfuJUSSc.js +0 -101
  291. package/dist/chunks/allErrors-YIRWFBD9.js +0 -1
  292. package/dist/chunks/api-CGk-0H2x.js +0 -1
  293. package/dist/chunks/attributionHooks-C0aXyx9L.js +0 -1
  294. package/dist/chunks/auth-DWWb8STf.js +0 -1
  295. package/dist/chunks/auth-DsqlBO-Q.js +0 -1
  296. package/dist/chunks/backgroundHousekeeping-CXv_Pm5h.js +0 -17
  297. package/dist/chunks/backgroundHousekeeping-Crx3oXIu.js +0 -1
  298. package/dist/chunks/branch-BEaujq-M.js +0 -2
  299. package/dist/chunks/bridgeConfig-Ctl7I_RR.js +0 -1
  300. package/dist/chunks/btw-8JqSG3o7.js +0 -1
  301. package/dist/chunks/caches-dnO4Ae_m.js +0 -1
  302. package/dist/chunks/caches-lPzD_yGv.js +0 -1
  303. package/dist/chunks/client-BFjMSlp7.js +0 -1
  304. package/dist/chunks/client-Byat5HpG.js +0 -1
  305. package/dist/chunks/client-Dzx24jGZ.js +0 -1
  306. package/dist/chunks/commands-D3lQbt9p.js +0 -1
  307. package/dist/chunks/config-CPGSP_1Z.js +0 -1
  308. package/dist/chunks/context-noninteractive-CwlOID3q.js +0 -1
  309. package/dist/chunks/conversation-BLEWB1BE.js +0 -1
  310. package/dist/chunks/conversation-Bos7yTIv.js +0 -1
  311. package/dist/chunks/createSession-B4wkDNam.js +0 -1
  312. package/dist/chunks/crossProjectResume-C5QtstD6.js +0 -40
  313. package/dist/chunks/cwd-BfiQQAqr.js +0 -1
  314. package/dist/chunks/cwd-Dj2ynhWd.js +0 -1
  315. package/dist/chunks/detectRepository-CWI2xcdR.js +0 -1
  316. package/dist/chunks/doctor-BV6zhneX.js +0 -1
  317. package/dist/chunks/extractMemories-DxGHxoNO.js +0 -1
  318. package/dist/chunks/fast-Bf-g-wR6.js +0 -1
  319. package/dist/chunks/fetchModelList-vk-RMDfG.js +0 -1
  320. package/dist/chunks/firstPartyEventLogger-DvsZdBy2.js +0 -1
  321. package/dist/chunks/git-Bujlb5tq.js +0 -1
  322. package/dist/chunks/githubRepoPathMapping-Dhz4cvw2.js +0 -1
  323. package/dist/chunks/hooks-C5YSYzSl.js +0 -1
  324. package/dist/chunks/initReplBridge-BFYTAFlT.js +0 -1
  325. package/dist/chunks/install-CjacxFXg.js +0 -1
  326. package/dist/chunks/keybindings-D01jzjKu.js +0 -1
  327. package/dist/chunks/loadAgentsDir-xG1HswS_.js +0 -1
  328. package/dist/chunks/localSearch-B17Mzd84.js +0 -1
  329. package/dist/chunks/managedEnv-C7bVtcgA.js +0 -1
  330. package/dist/chunks/managedEnv-d7HliQYg.js +0 -1
  331. package/dist/chunks/mcp-BcEApfqn.js +0 -1
  332. package/dist/chunks/mcp-CBbVcOTy.js +0 -2
  333. package/dist/chunks/mcp-DYtfHeRa.js +0 -6
  334. package/dist/chunks/memory-CijapyZk.js +0 -1
  335. package/dist/chunks/model-CyF5u3zH.js +0 -1
  336. package/dist/chunks/model-DaYZWYJe.js +0 -1
  337. package/dist/chunks/omit-BhPlISSj.js +0 -1
  338. package/dist/chunks/onChangeAppState-BOJd4Yce.js +0 -1
  339. package/dist/chunks/parser-B-QFQfSO.js +0 -1
  340. package/dist/chunks/partition-_qZZlGjS.js +0 -1
  341. package/dist/chunks/permissions-CcjGscyg.js +0 -3
  342. package/dist/chunks/pidLock-Cm9FWa4w.js +0 -3
  343. package/dist/chunks/plugin-D7vjs6Hu.js +0 -17
  344. package/dist/chunks/pluginOperations-BxHoy0pC.js +0 -2
  345. package/dist/chunks/pluginStartupCheck-CtX6QkdO.js +0 -1
  346. package/dist/chunks/poorMode-DyAWNRRM.js +0 -1
  347. package/dist/chunks/poorMode-aMzKXz6G.js +0 -1
  348. package/dist/chunks/postCommitAttribution-DoSP9wZD.js +0 -1
  349. package/dist/chunks/print-BrqZ3AgP.js +0 -14
  350. package/dist/chunks/processBashCommand-C6mBgRVz.js +0 -1
  351. package/dist/chunks/processSlashCommand-t0-BVku8.js +0 -5
  352. package/dist/chunks/prompt-BJ3xYAvE.js +0 -1
  353. package/dist/chunks/prompt-Di2lNwYp.js +0 -1
  354. package/dist/chunks/reconciler-p4lAu9ft.js +0 -1
  355. package/dist/chunks/refresh-DCQChX5A.js +0 -1
  356. package/dist/chunks/registerProtocol-CrzdmgCD.js +0 -1
  357. package/dist/chunks/remoteManagedSettings-DkLfclxa.js +0 -1
  358. package/dist/chunks/resume-K9q5B1li.js +0 -2
  359. package/dist/chunks/ripgrep-DLPH9MP9.js +0 -1
  360. package/dist/chunks/sandbox-adapter-CRxZBMAP.js +0 -1
  361. package/dist/chunks/searchExtraTools-BAYzzTE8.js +0 -1
  362. package/dist/chunks/sessionFileAccessHooks-CwnjOk6S.js +0 -1
  363. package/dist/chunks/sessionObserver-DNjDoJmy.js +0 -1
  364. package/dist/chunks/sessionStorage-CVZ0MUSE.js +0 -1
  365. package/dist/chunks/settings-DsqFBv6J.js +0 -1
  366. package/dist/chunks/settingsSync-yE43qjMS.js +0 -1
  367. package/dist/chunks/setup-CFOc-hPM.js +0 -3
  368. package/dist/chunks/sinks-B64r_OBE.js +0 -1
  369. package/dist/chunks/skillChangeDetector-CLnn22Jo.js +0 -1
  370. package/dist/chunks/src-DPUAq5Ty.js +0 -1
  371. package/dist/chunks/startupProfiler-yBU6FaAV.js +0 -1
  372. package/dist/chunks/state-mHtumqEo.js +0 -1
  373. package/dist/chunks/status--Ql7l0VG.js +0 -1
  374. package/dist/chunks/switcher-Cb9R9247.js +0 -1
  375. package/dist/chunks/syncCache-BiqQEess.js +0 -1
  376. package/dist/chunks/toolPool-H_kXc8vo.js +0 -1
  377. package/dist/chunks/trustedDevice-Dm_SY3Ko.js +0 -1
  378. package/dist/chunks/useMainLoopModel-DG8pghH7.js +0 -1
  379. package/dist/chunks/useManagePlugins-HMHtjIY-.js +0 -1
  380. package/dist/chunks/useSettingsErrors-Bs9uyzW4.js +0 -1
  381. package/dist/chunks/validatePlugin-yCb8gsVF.js +0 -1
  382. package/dist/chunks/windowsPaths-Dd_S96Bq.js +0 -1
  383. package/dist/chunks/worktree-D-CgffvU.js +0 -1
  384. /package/dist/chunks/{src-DLz3FZm1.js → urlHandler-DLz3FZm1.js} +0 -0
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{cn as r,d as i,h as a,ln as o,s}from"./settings-3xZ0fsvE.js";import{c,h as l}from"./config-DRy1I12M.js";import{d as u,g as d,h as f,l as p,n as m,t as h,v as g}from"./proxy-BhIc7-mj.js";import{n as _,t as v}from"./loader-C33o_5kS.js";import{n as y,t as b}from"./syncCache-qWJ_VfBo.js";import{n as x,r as S,t as C}from"./managedEnvConstants-BPwL2aWI.js";function w(e){if(!e||!process.env.ANTHROPIC_UNIX_SOCKET)return e||{};let{ANTHROPIC_UNIX_SOCKET:t,ANTHROPIC_BASE_URL:n,ANTHROPIC_API_KEY:r,ANTHROPIC_AUTH_TOKEN:i,CLAUDE_CODE_OAUTH_TOKEN:a,...o}=e;return o}function T(e){if(!e)return{};if(!t(process.env.CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST))return e;let n={};for(let[t,r]of Object.entries(e))S(t)||(n[t]=r);return n}function E(e){if(!e||!j)return e||{};let t={};for(let[n,r]of Object.entries(e))j.has(n)||(t[n]=r);return t}function D(e){if(!e)return{};let t=s(`userSettings`)?.activeProviderId;if(!t||!v(t))return e;let n={};for(let[t,r]of Object.entries(e))M.has(t.toUpperCase())||(n[t]=r);return n}function O(e){return E(T(D(w(e))))}function k(){j===void 0&&(j=process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`?new Set(Object.keys(process.env)):null),Object.assign(process.env,O(c().env));for(let e of N)e!==`policySettings`&&o(e)&&Object.assign(process.env,O(s(e)?.env));y(),Object.assign(process.env,O(s(`policySettings`)?.env));let e=O(i()?.env);for(let[t,n]of Object.entries(e))C.has(t.toUpperCase())&&(process.env[t]=n)}function A(){Object.assign(process.env,O(c().env)),Object.assign(process.env,O(i()?.env)),d(),u(),h(),m()}var j,M,N,P=e((()=>{_(),b(),g(),l(),n(),x(),f(),p(),r(),a(),M=new Set([`ANTHROPIC_BASE_URL`,`ANTHROPIC_API_KEY`,`ANTHROPIC_MODEL`,`CLAUDE_CODE_USE_OPENAI`,`OPENAI_BASE_URL`,`OPENAI_API_KEY`,`OPENAI_MODEL`]),N=[`userSettings`,`flagSettings`,`policySettings`]}));export{k as n,P as r,A as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./managedEnv-CUsdYhAI.js";e();export{t as applyConfigEnvironmentVariables};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{La as t,XT as n,eE as r,ma as i}from"./loadAgentsDir-DnsldjYU.js";import{Kr as a,qr as o}from"./src-DL3w8VPk2.js";import{Wt as s,pt as c}from"./state-B3zvBu4R.js";import{q as l}from"./log-CR0v5KUR.js";import{Jt as u}from"./prompt-CzQkcxfg.js";import{randomUUID as d}from"crypto";function f(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:e.message,uuid:e.uuid,requestId:void 0,timestamp:new Date().toISOString()}];case`user`:return[{type:`user`,message:e.message,uuid:e.uuid??d(),timestamp:e.timestamp??new Date().toISOString(),isMeta:e.isSynthetic}];default:return[]}})}function p(e){let t=e.preservedSegment;return{trigger:e.trigger,pre_tokens:e.preTokens,...t&&{preserved_segment:{head_uuid:t.headUuid,anchor_uuid:t.anchorUuid,tail_uuid:t.tailUuid}}}}function m(e){let t=e,n=t.preserved_segment;return{trigger:t.trigger,preTokens:t.pre_tokens,...n&&{preservedSegment:{headUuid:n.head_uuid,anchorUuid:n.anchor_uuid,tailUuid:n.tail_uuid}}}}function h(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:v(e),session_id:c(),parent_tool_use_id:null,uuid:e.uuid,error:e?.error}];case`user`:return[{type:`user`,message:e.message,session_id:c(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly,...e.toolUseResult===void 0?{}:{tool_use_result:e.toolUseResult}}];case`system`:return e.subtype===`compact_boundary`&&e.compactMetadata?[{type:`system`,subtype:`compact_boundary`,session_id:c(),uuid:e.uuid,compact_metadata:p(e.compactMetadata)}]:e.subtype===`local_command`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))?[g(e.content,e.uuid)]:[];default:return[]}})}function g(e,t){let n=i({content:o(e).replace(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/,`$1`).replace(/<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/,`$1`).trim()});return{type:`assistant`,content:n.message?.content,message:n.message,parent_tool_use_id:null,session_id:c(),uuid:t}}function _(e){if(e)return{type:`rate_limit`,status:e.status,...e.resetsAt!==void 0&&{resetsAt:e.resetsAt},...e.rateLimitType!==void 0&&{rateLimitType:e.rateLimitType},...e.utilization!==void 0&&{utilization:e.utilization},...e.overageStatus!==void 0&&{overageStatus:e.overageStatus},...e.overageResetsAt!==void 0&&{overageResetsAt:e.overageResetsAt},...e.overageDisabledReason!==void 0&&{overageDisabledReason:e.overageDisabledReason},...e.isUsingOverage!==void 0&&{isUsingOverage:e.isUsingOverage},...e.surpassedThreshold!==void 0&&{surpassedThreshold:e.surpassedThreshold}}}function v(e){let t=e.message.content;if(!Array.isArray(t))return e.message;let r=t.map(e=>{if(e.type!==`tool_use`)return e;if(e.name===`ExitPlanMode`){let t=n();if(t)return{...e,input:{...e.input,plan:t}}}return e});return{...e.message,content:r}}var y=e((()=>{s(),l(),u(),a(),t(),r()}));export{p as a,f as i,y as n,h as o,g as r,_ as s,m as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{GT as t,La as n,YT as r,ma as i}from"./loadAgentsDir-DaNpxaO-.js";import{Kr as a,qr as o}from"./src-DL3w8VPk2.js";import{Ut as s,ft as c}from"./state-D5D6QpTX.js";import{q as l}from"./log-CZ7ploQm.js";import{qt as u}from"./prompt-8u06WVES.js";import{randomUUID as d}from"crypto";function f(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:e.message,uuid:e.uuid,requestId:void 0,timestamp:new Date().toISOString()}];case`user`:return[{type:`user`,message:e.message,uuid:e.uuid??d(),timestamp:e.timestamp??new Date().toISOString(),isMeta:e.isSynthetic}];default:return[]}})}function p(e){let t=e.preservedSegment;return{trigger:e.trigger,pre_tokens:e.preTokens,...t&&{preserved_segment:{head_uuid:t.headUuid,anchor_uuid:t.anchorUuid,tail_uuid:t.tailUuid}}}}function m(e){let t=e,n=t.preserved_segment;return{trigger:t.trigger,preTokens:t.pre_tokens,...n&&{preservedSegment:{headUuid:n.head_uuid,anchorUuid:n.anchor_uuid,tailUuid:n.tail_uuid}}}}function h(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:v(e),session_id:c(),parent_tool_use_id:null,uuid:e.uuid,error:e?.error}];case`user`:return[{type:`user`,message:e.message,session_id:c(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly,...e.toolUseResult===void 0?{}:{tool_use_result:e.toolUseResult}}];case`system`:return e.subtype===`compact_boundary`&&e.compactMetadata?[{type:`system`,subtype:`compact_boundary`,session_id:c(),uuid:e.uuid,compact_metadata:p(e.compactMetadata)}]:e.subtype===`local_command`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))?[g(e.content,e.uuid)]:[];default:return[]}})}function g(e,t){let n=i({content:o(e).replace(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/,`$1`).replace(/<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/,`$1`).trim()});return{type:`assistant`,content:n.message?.content,message:n.message,parent_tool_use_id:null,session_id:c(),uuid:t}}function _(e){if(e)return{type:`rate_limit`,status:e.status,...e.resetsAt!==void 0&&{resetsAt:e.resetsAt},...e.rateLimitType!==void 0&&{rateLimitType:e.rateLimitType},...e.utilization!==void 0&&{utilization:e.utilization},...e.overageStatus!==void 0&&{overageStatus:e.overageStatus},...e.overageResetsAt!==void 0&&{overageResetsAt:e.overageResetsAt},...e.overageDisabledReason!==void 0&&{overageDisabledReason:e.overageDisabledReason},...e.isUsingOverage!==void 0&&{isUsingOverage:e.isUsingOverage},...e.surpassedThreshold!==void 0&&{surpassedThreshold:e.surpassedThreshold}}}function v(e){let n=e.message.content;if(!Array.isArray(n))return e.message;let r=n.map(e=>{if(e.type!==`tool_use`)return e;if(e.name===`ExitPlanMode`){let n=t();if(n)return{...e,input:{...e.input,plan:n}}}return e});return{...e.message,content:r}}var y=e((()=>{s(),l(),u(),a(),n(),r()}));export{p as a,f as i,y as n,h as o,g as r,_ as s,m as t};
@@ -0,0 +1,6 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Bb as n,Dp as r,Dx as i,Eb as a,Ex as o,Fx as s,Gb as c,Hb as l,Op as u,Ou as d,Ox as f,Ub as ee,Vb as p,Xh as m,Yh as te,Zd as h,_x as g,bb as _,ed as v,jx as y,ku as ne,mE as re,ox as b,pE as ie,qb as ae,sx as x,td as oe,vx as se,wb as S,xx as C}from"./loadAgentsDir-DaNpxaO-.js";import{D as w,H as T,I as E,P as D,T as O,ai as k,j as A,kn as j,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{R as F,V as I}from"./debug-D58GQBDG.js";import{c as L,h as R,o as z,v as B}from"./config-DRy1I12M.js";import{n as V,o as ce}from"./process-gEbdy6uY.js";import{i as H,o as U}from"./platform-DMQxcm4K.js";import{s as W,u as G}from"./types-APu4OCXJ.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-CKD8qDqx.js";import{n as J,t as Y}from"./exit-s9XGerrH.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";ie();var X=e(k(),1);t(),V(),M(),y(),ue(),u(),oe();var Z=P();function pe({servers:e,scope:t,onDone:n}){let i=Object.keys(e),[a,s]=(0,X.useState)({});(0,X.useEffect)(()=>{o().then(({servers:e})=>s(e))},[]);let c=i.filter(e=>a[e]!==void 0);async function l(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(a[e]!==void 0){let t=1;for(;a[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await C(e,n,t),r++}}d(r)}let[u]=T(),d=(0,X.useCallback)(e=>{ce(e>0?`\n${A(`success`,u)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
2
+ No servers were imported.`),n(),h()},[u,t,n]),f=(0,X.useCallback)(()=>{d(0)},[d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Work Mate Desktop`,subtitle:`Found ${i.length} MCP ${q(i.length,`server`)} in Work Mate Desktop.`,color:`success`,onCancel:f,hideInputGuide:!0,children:[c.length>0&&(0,Z.jsx)(D,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(D,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(v,{options:i.map(e=>({label:`${e}${c.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:i.filter(e=>!c.includes(e)),onSubmit:l,onCancel:f,hideIndexes:!0})]}),(0,Z.jsx)(E,{paddingX:1,children:(0,Z.jsx)(D,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(w,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(w,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(r,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),ne(),le(),ee(),a(),y(),se(),m(),R(),F(),t(),W(),U();async function Q(e,t){try{let n=await _(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw I(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-D8L275fT.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-Dx-zgUgu.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let r=i(e),a=()=>{r&&(r.type===`sse`||r.type===`http`)&&(p(e,r),n(e,r))};try{if(t.scope){let n=x(t.scope);K(`tengu_mcp_delete`,{name:e,scope:n}),await s(e,n),a(),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),J(`File modified: ${b(n)}`)}let n=z(),r=L(),{servers:i}=f(`project`),o=!!i[e],c=[];if(n.mcpServers?.[e]&&c.push(`local`),o&&c.push(`project`),r.mcpServers?.[e]&&c.push(`user`),c.length===0)Y(`No MCP server found with name: "${e}"`);else if(c.length===1){let t=c[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await s(e,t),a(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${b(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),c.forEach(e=>{process.stderr.write(` - ${g(e)} (${b(e)})\n`)}),process.stderr.write(`
3
+ To remove from a specific scope, use:
4
+ `),c.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){K(`tengu_mcp_list`,{});let{servers:e}=await o();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
5
+ `);let t=await re(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:S()});for(let{name:e,server:n,status:r}of t)if(n.type===`sse`)console.log(`${e}: ${n.url} (SSE) - ${r}`);else if(n.type===`http`)console.log(`${e}: ${n.url} (HTTP) - ${r}`);else if(n.type===`claudeai-proxy`)console.log(`${e}: ${n.url} - ${r}`);else if(!n.type||n.type===`stdio`){let t=n,i=Array.isArray(t.args)?t.args:[];console.log(`${e}: ${t.command} ${i.join(` `)} - ${r}`)}}await h(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=i(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${g(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),l(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),l(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await h(0)}async function _e(e,t,n){try{let r=x(n.scope),i=G(t),a=n.clientSecret&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&`oauth`in i&&i.oauth&&typeof i.oauth==`object`&&`clientId`in i.oauth?await c():void 0;await C(e,i,r);let o=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;a&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&ae(e,{type:i.type,url:i.url},a),K(`tengu_mcp_add`,{scope:r,source:`json`,type:o}),J(`Added ${o} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=x(e.scope);K(`tengu_mcp_add`,{scope:t,platform:H(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-DPc_SaVn.js`),r=await n();Object.keys(r).length===0&&J(`No MCP servers found in Work Mate Desktop configuration or configuration file does not exist.`);let{unmount:i}=await j((0,Z.jsx)(te,{children:(0,Z.jsx)(d,{children:(0,Z.jsx)(pe,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){K(`tengu_mcp_reset_mcpjson_choices`,{}),B(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
6
+ You will be prompted for approval next time you start Work Mate.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Dp as i,Mu as a,Op as o,Pu as s,Qh as c,Qu as l,Rb as u,Ub as d,Wb as f,Xh as p,Zh as m,Zu as h,hx as g,ox as _,px as v,uC as y,vx as b,zb as x}from"./loadAgentsDir-DaNpxaO-.js";import{D as S,Gt as ee,H as C,I as w,Lt as T,P as E,T as D,Wt as O,ai as k,j as A,t as j,y as te}from"./src-DL3w8VPk2.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{a as ne,i as re}from"./debug-D58GQBDG.js";import{l as ie,n as ae,o as N}from"./stringUtils-CKD8qDqx.js";import{C as oe,S as se}from"./sessionState-CQhbGfmh.js";import{i as ce,n as P,r as le}from"./MCPConnectionManager-DfyoZaiu.js";import{n as ue,t as de}from"./McpParsingWarnings-BUlgpZAF.js";import{a as fe,c as F,i as I,n as L,o as R,r as pe,s as me,t as he}from"./MCPToolListView-Dioupv8F.js";function ge({agentServer:e,onCancel:t,onComplete:n}){let[o]=C(),[s,c]=(0,z.useState)(!1),[d,p]=(0,z.useState)(null),[m,h]=(0,z.useState)(null),g=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>g.current?.abort(),[]),O(`confirm:no`,(0,z.useCallback)(()=>{s&&(g.current?.abort(),g.current=null,c(!1),h(null))},[s]),{context:`Confirmation`,isActive:s});let _=(0,z.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;c(!0),p(null);let t=new AbortController;g.current=t;try{let r={type:e.transport,url:e.url};await f(e.name,r,h,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof u)&&p(e.message)}finally{c(!1),g.current=null}},[e,n]),v=ae(String(e.name));if(s)return(0,B.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,B.jsxs)(E,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(a,{}),(0,B.jsx)(E,{children:` A browser window will open for authentication`})]}),m&&(0,B.jsxs)(w,{flexDirection:`column`,children:[(0,B.jsx)(E,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,B.jsx)(T,{url:m})]}),(0,B.jsx)(w,{marginLeft:3,children:(0,B.jsxs)(E,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,B.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let y=[];return e.needsAuth&&y.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),y.push({label:`Back`,value:`back`}),(0,B.jsxs)(te,{title:`${v} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,B.jsxs)(E,{children:[`Press `,e.keyName,` again to exit`]}):(0,B.jsxs)(D,{children:[(0,B.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,B.jsx)(S,{shortcut:`Enter`,action:`confirm`}),(0,B.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,B.jsxs)(w,{flexDirection:`column`,gap:0,children:[(0,B.jsxs)(w,{children:[(0,B.jsx)(E,{bold:!0,children:`Type: `}),(0,B.jsx)(E,{dimColor:!0,children:e.transport})]}),e.url&&(0,B.jsxs)(w,{children:[(0,B.jsx)(E,{bold:!0,children:`URL: `}),(0,B.jsx)(E,{dimColor:!0,children:e.url})]}),e.command&&(0,B.jsxs)(w,{children:[(0,B.jsx)(E,{bold:!0,children:`Command: `}),(0,B.jsx)(E,{dimColor:!0,children:e.command})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(E,{bold:!0,children:`Used by: `}),(0,B.jsx)(E,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,B.jsxs)(w,{marginTop:1,children:[(0,B.jsx)(E,{bold:!0,children:`Status: `}),(0,B.jsxs)(E,{children:[A(`inactive`,o)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,B.jsxs)(w,{children:[(0,B.jsx)(E,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,B.jsxs)(E,{children:[A(`success`,o)(r.tick),` authenticated`]}):(0,B.jsxs)(E,{children:[A(`warning`,o)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,B.jsx)(w,{children:(0,B.jsx)(E,{dimColor:!0,children:`This server connects only when running the agent.`})}),d&&(0,B.jsx)(w,{children:(0,B.jsxs)(E,{color:`error`,children:[`Error: `,d]})}),(0,B.jsx)(w,{children:(0,B.jsx)(l,{options:y,onChange:async e=>{switch(e){case`auth`:await _();break;case`back`:t();break}},onCancel:t})})]})}var z,B,_e=e((()=>{n(),z=t(k(),1),j(),y(),d(),N(),o(),h(),s(),B=M()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:_(e)};case`user`:return{label:`User MCPs`,path:_(e)};case`local`:return{label:`Local MCPs`,path:_(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function ve(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function ye({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:a,onComplete:o}){let[s]=C(),[c,l]=(0,H.useState)(0),u=H.useMemo(()=>ve(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),d=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),f=H.useMemo(()=>(u.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[u]),p=V(`dynamic`),m=H.useMemo(()=>{let e=[];for(let t of W){let n=u.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of d)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of f)e.push({type:`server`,server:t});return e},[u,d,t,f]),h=(0,H.useCallback)(()=>{o(`MCP dialog dismissed`,{display:`system`})},[o]);ee({"confirm:previous":()=>l(e=>e===0?m.length-1:e-1),"confirm:next":()=>l(e=>e===m.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=m[c];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&a&&a(e.agentServer))},[m,c,n,a]),"confirm:no":h},{context:`Confirmation`});let g=e=>m.findIndex(t=>t.type===`server`&&t.server===e),_=e=>m.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),v=ne(),y=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let b=e=>{let t=g(e),n=c===t,i=``,a=``;if(e.client.type===`disabled`)i=A(`inactive`,s)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=A(`success`,s)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=A(`inactive`,s)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=A(`warning`,s)(r.triangleUpOutline),a=`needs authentication`):(i=A(`error`,s)(r.cross),a=`failed`);return(0,U.jsxs)(w,{children:[(0,U.jsx)(E,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(E,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(E,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(E,{dimColor:!n,children:a})]},`${e.name}-${t}`)},x=e=>{let t=_(e),n=c===t,i=e.needsAuth?A(`warning`,s)(r.triangleUpOutline):A(`inactive`,s)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(w,{children:[(0,U.jsx)(E,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(E,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(E,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(E,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},O=e.length+t.length;return(0,U.jsxs)(w,{flexDirection:`column`,children:[(0,U.jsx)(de,{}),(0,U.jsx)(te,{title:`Manage MCP servers`,subtitle:`${O} ${ie(O,`server`)}`,onCancel:h,hideInputGuide:!0,children:(0,U.jsxs)(w,{flexDirection:`column`,children:[W.map(e=>{let t=u.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(w,{paddingLeft:2,children:[(0,U.jsx)(E,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(E,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>b(e))]},e)}),d.length>0&&(0,U.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(w,{paddingLeft:2,children:(0,U.jsx)(E,{bold:!0,children:`claude.ai`})}),d.map(e=>b(e))]}),t.length>0&&(0,U.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(w,{paddingLeft:2,children:(0,U.jsx)(E,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(w,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(w,{paddingLeft:2,children:(0,U.jsxs)(E,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>x(e))]},e))]}),f.length>0&&(0,U.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(w,{paddingLeft:2,children:[(0,U.jsx)(E,{bold:!0,children:p.label}),p.path&&(0,U.jsxs)(E,{dimColor:!0,children:[` (`,p.path,`)`]})]}),f.map(e=>b(e))]}),(0,U.jsxs)(w,{flexDirection:`column`,children:[y&&(0,U.jsx)(E,{dimColor:!0,children:v?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(E,{dimColor:!0,children:[(0,U.jsx)(T,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(w,{paddingX:1,children:(0,U.jsx)(E,{dimColor:!0,italic:!0,children:(0,U.jsxs)(D,{children:[(0,U.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(S,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(k(),1),j(),y(),b(),re(),N(),o(),ue(),U=M(),W=[`project`,`local`,`user`,`enterprise`]}));function be({serverName:e,onComplete:t}){let[n]=C(),i=c(),o=le(),[s,l]=(0,K.useState)(!0),[u,d]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){d(`MCP server "${e}" not found`),l(!1),t(`MCP server "${e}" not found`);return}switch((await o(e)).client.type){case`connected`:l(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:d(`${e} requires authentication`),l(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:d(`Failed to reconnect to ${e}`),l(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);d(n),l(!1),t(`Error: ${n}`)}}n()},[e,o,i,t]),s?(0,q.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(E,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(E,{bold:!0,children:e})]}),(0,q.jsxs)(w,{children:[(0,q.jsx)(a,{}),(0,q.jsx)(E,{children:` Establishing connection to MCP server`})]})]}):u?(0,q.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(w,{children:[(0,q.jsxs)(E,{children:[A(`error`,n)(r.cross),` `]}),(0,q.jsxs)(E,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(E,{dimColor:!0,children:[`Error: `,u]})]}):null}var K,q,J=e((()=>{n(),K=t(k(),1),j(),P(),p(),s(),q=M()}));function Y({onComplete:e}){let t=m(e=>e.mcp),n=m(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>v(n.allAgents),[n.allAgents]),l=X.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(X.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;if(r||i){let n=await new x(e.name,e.config).tokens(),r=se()!==null&&e.type===`connected`,i=e.type===`connected`&&g(t.tools,e.name).length>0;o=!!n||r||i}let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.workmate.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(ye,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=g(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(0,Z.jsx)(fe,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(me,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(he,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=g(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(pe,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(ge,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,xe=e((()=>{X=t(k(),1),d(),b(),p(),oe(),_e(),G(),F(),R(),I(),L(),Z=M()})),Se=e((()=>{_e(),G(),J(),F(),xe(),R(),I(),L()}));function Ce({action:e,target:t,onComplete:n}){let r=m(e=>e.mcp.clients),i=ce(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function we(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(be,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Ce,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(k(),1),Se(),J(),P(),p(),$=M()}))();export{we as call};
@@ -0,0 +1,2 @@
1
+ import{$y as e,AC as t,AS as n,B as r,B_ as i,Bl as a,CS as o,DS as s,FS as c,Fb as l,GS as u,HS as d,Kc as f,La as p,MS as m,NS as h,OS as g,PS as _,Pb as ee,Qs as te,Qy as ne,RS as v,SS as y,TS as b,US as x,V as S,VS as C,Vl as w,WS as T,Zs as E,_S as D,bS as O,cS as k,dS as A,fS as j,gS as M,hS as N,jS as P,kC as F,kS as I,lS as L,mS as re,ma as R,pS as z,qc as B,uS as V,vS as H,xS as U,yS as W,zS as G,z_ as K}from"./loadAgentsDir-DaNpxaO-.js";import{C as q,x as J}from"./debug-D58GQBDG.js";import{o as Y,s as X}from"./log-CZ7ploQm.js";import{_ as ie,u as ae}from"./model-Do0f476p.js";import{_n as Z,gn as oe,vn as se}from"./prompt-8u06WVES.js";import Q from"node:process";x(),D(),N(),C();var ce=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},U,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??`form`;switch(r){case`url`:if(!n?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!n?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let i=r===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:i},b,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};C(),z();var le=class extends M{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(_.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new re,this.setRequestHandler(I,e=>this._oninitialize(e)),this.setNotificationHandler(n,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(G,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=_.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ce(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=H(this._capabilities,e)}setRequestHandler(e,t){let n=d(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r;if(T(n)){let e=n;r=e._zod?.def?.value??e.value}else{let e=n;r=e._def?.value??e.value}if(typeof r!=`string`)throw Error(`Schema method literal must be a string`);return r===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let r=u(W,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new c(g.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=u(o,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new c(g.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=u(O,a);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new c(g.InvalidParams,`Invalid tools/call result: ${e}`)}return s.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){A(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&j(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:v.includes(t)?t:P,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},s)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},y,t):this.request({method:`sampling/createMessage`,params:e},U,t)}async elicitInput(e,t){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let n=e;return this.request({method:`elicitation/create`,params:n},b,t)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},b,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new c(g.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof c?e:new c(g.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},m,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};L();var $=class{constructor(e=Q.stdin,t=Q.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new k,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=V(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};C(),te(),se(),B(),l(),e(),Y(),p(),ie(),S(),F(),J(),w(),K();var ue=[];async function de(e,n,o){let s=ne(100);t(e);let c=new le({name:`claude/tengu`,version:`0.0.20`},{capabilities:{tools:{}}});c.setRequestHandler(h,async()=>{let e=Z(),t=f(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=i(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:i(n.inputSchema),outputSchema:r}}))}}),c.setRequestHandler(W,async({params:{name:e,arguments:t}})=>{let i=f(Z()),c=oe(i,e);if(!c)throw Error(`Tool ${e} not found`);let l={abortController:ee(),options:{commands:ue,tools:i,mainLoopModel:ae(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:n,verbose:o,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>E(),setAppState:()=>{},messages:[],readFileState:s,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!c.isEnabled())throw Error(`Tool ${e} is not enabled`);let n=await c.validateInput?.(t??{},l);if(n&&!n.result)throw Error(`Tool ${e} input is invalid: ${`message`in n?n.message:String(n)}`);let i=await c.call(t??{},l,r,R({content:[]}));return{content:[{type:`text`,text:typeof i==`string`?i:q(i.data)}]}}catch(e){return X(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?a(e):[String(e)]).filter(Boolean).join(`
2
+ `).trim()||`Error`}]}}});async function l(){let e=new $;await c.connect(e)}return await l()}export{de as startMCPServer};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as d,t as f}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{C as p,x as m}from"./debug-D7OBvqC2.js";import{o as h,s as g}from"./log-CR0v5KUR.js";import{channel as ee,tracingChannel as _}from"node:diagnostics_channel";function te(){let e=new Ne(c(T,this)),t=new Ne(c(T,this));u(W,this,e),u(U,this,t);let n=this.ttlAutopurge?Array.from({length:c(T,this)}):void 0;u(G,this,n),u(ye,this,(n,r,a=c(A,this).now())=>{t[n]=r===0?0:a,e[n]=r,i(n,r)}),u(ve,this,n=>{t[n]=e[n]===0?0:c(A,this).now(),i(n,e[n])});let i=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let a=setTimeout(()=>{c(Z,this).call(this,e)?(r(Y,this,w).call(this,c(P,this)[e],`expire`),n[e]=void 0):i(e,s(e))},t+1);a.unref&&a.unref(),n[e]=a}}:()=>{};u(X,this,(n,r)=>{if(e[r]){let i=e[r],s=t[r];if(!i||!s)return;n.ttl=i,n.start=s,n.now=a||o(),n.remainingTTL=i-(n.now-s)}});let a=0,o=()=>{let e=c(A,this).now();if(this.ttlResolution>0){a=e;let t=setTimeout(()=>a=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=c(N,this).get(e);return t===void 0?0:s(t)};let s=n=>{let r=e[n],i=t[n];return!r||!i?1/0:r-((a||o())-i)};u(Z,this,n=>{let r=t[n],i=e[n];return!!i&&!!r&&(a||o())-r>i})}function ne(){let e=new Ne(c(T,this));u(M,this,0),u(H,this,e),u(be,this,t=>{u(M,this,c(M,this)-e[t]),e[t]=0}),u(Se,this,(e,t,n,i)=>{if(!$(n)){if(r(Y,this,S).call(this,t))return this.backgroundFetchSize;if(i){if(typeof i!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=i(t,e),!$(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n}),u(xe,this,(t,n,i)=>{if(e[t]=n,c(E,this)){let n=c(E,this)-e[t];for(;c(M,this)>n;)r(Y,this,x).call(this,!0)}u(M,this,c(M,this)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=c(M,this))})}function*v({allowStale:e=this.allowStale}={}){if(c(j,this))for(let t=c(z,this);r(Y,this,re).call(this,t)&&((e||!c(Z,this).call(this,t))&&(yield t),t!==c(R,this));)t=c(L,this)[t]}function*y({allowStale:e=this.allowStale}={}){if(c(j,this))for(let t=c(R,this);r(Y,this,re).call(this,t)&&((e||!c(Z,this).call(this,t))&&(yield t),t!==c(z,this));)t=c(I,this)[t]}function re(e){return e!==void 0&&c(N,this).get(c(P,this)[e])===e}function b(e,t,n,i){var a;let{ttl:o=this.ttl,start:s,noDisposeOnSet:l=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:f}=n,p=r(Y,this,S).call(this,t);if(t===void 0)return f&&(f.set=`deleted`),this.delete(e),this;let{noUpdateTTL:m=this.noUpdateTTL}=n;f&&!p&&(f.value=t);let h=c(Se,this).call(this,e,t,n.size||0,d,f);if(this.maxEntrySize&&h>this.maxEntrySize)return r(Y,this,w).call(this,e,`set`),f&&(f.set=`miss`,f.maxEntrySizeExceeded=!0),this;let g=c(j,this)===0?void 0:c(N,this).get(e);if(g===void 0)g=c(j,this)===0?c(z,this):c(B,this).length===0?c(j,this)===c(T,this)?r(Y,this,x).call(this,!1):c(j,this):c(B,this).pop(),c(P,this)[g]=e,c(F,this)[g]=t,c(N,this).set(e,g),c(I,this)[c(z,this)]=g,c(L,this)[g]=c(z,this),u(z,this,g),u(j,this,(a=c(j,this),a++,a)),c(xe,this).call(this,g,h,f),f&&(f.set=`add`),m=!1,c(J,this)&&!p&&c(O,this)?.call(this,t,e,`add`);else{r(Y,this,de).call(this,g);let n=c(F,this)[g];if(t!==n){if(!l)if(r(Y,this,S).call(this,n)){n!==i&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:r}=n;r!==void 0&&r!==t&&(c(K,this)&&c(D,this)?.call(this,r,e,`set`),c(q,this)&&c(V,this)?.push([r,e,`set`]))}else c(K,this)&&c(D,this)?.call(this,n,e,`set`),c(q,this)&&c(V,this)?.push([n,e,`set`]);if(c(be,this).call(this,g),c(xe,this).call(this,g,h,f),c(F,this)[g]=t,!p){let i=n&&r(Y,this,S).call(this,n)?n.__staleWhileFetching:n,a=i===void 0?`add`:t===i?`update`:`replace`;f&&(f.set=a,i!==void 0&&(f.oldValue=i)),c(J,this)&&this.onInsert?.(t,e,a)}}else p||(f&&(f.set=`update`),c(J,this)&&this.onInsert?.(t,e,`update`))}if(o!==0&&!c(W,this)&&r(Y,this,te).call(this),c(W,this)&&(m||c(ye,this).call(this,g,o,s),f&&c(X,this).call(this,f,g)),!l&&c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}return this}function x(e){var t;let n=c(R,this),i=c(P,this)[n],a=c(F,this)[n],o=r(Y,this,S).call(this,a);o&&a.__abortController.abort(Error(`evicted`));let s=o?a.__staleWhileFetching:a;return(c(K,this)||c(q,this))&&s!==void 0&&(c(K,this)&&c(D,this)?.call(this,s,i,`evict`),c(q,this)&&c(V,this)?.push([s,i,`evict`])),c(be,this).call(this,n),c(G,this)?.[n]&&(clearTimeout(c(G,this)[n]),c(G,this)[n]=void 0),e&&(c(P,this)[n]=void 0,c(F,this)[n]=void 0,c(B,this).push(n)),c(j,this)===1?(u(R,this,u(z,this,0)),c(B,this).length=0):u(R,this,c(I,this)[n]),c(N,this).delete(i),u(j,this,(t=c(j,this),t--,t)),n}function ie(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,a=c(N,this).get(e);if(a!==void 0){let e=c(F,this)[a];if(r(Y,this,S).call(this,e)&&e.__staleWhileFetching===void 0)return!1;if(c(Z,this).call(this,a))i&&(i.has=`stale`,c(X,this).call(this,i,a));else return n&&c(ve,this).call(this,a),i&&(i.has=`hit`,c(X,this).call(this,i,a)),!0}else i&&(i.has=`miss`);return!1}function ae(e,t){let{status:n,allowStale:i=this.allowStale}=t,a=c(N,this).get(e);if(a===void 0||!i&&c(Z,this).call(this,a)){n&&(n.peek=a===void 0?`miss`:`stale`);return}let o=c(F,this)[a],s=r(Y,this,S).call(this,o)?o.__staleWhileFetching:o;return n&&(s===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=s)),s}function oe(e,t,n,i){let a=t===void 0?void 0:c(F,this)[t];if(r(Y,this,S).call(this,a))return a;let o=new AbortController,{signal:s}=n;s?.addEventListener(`abort`,()=>o.abort(s.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:i},u=(i,a=!1)=>{let{aborted:s}=o.signal,u=n.ignoreFetchAbort&&i!==void 0,d=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&i!==void 0);if(n.status&&(s&&!a?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,u&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),s&&!u&&!a)return f(o.signal.reason,d);let p=m,h=c(F,this)[t];return(h===m||h===void 0&&u&&a)&&(i===void 0?p.__staleWhileFetching===void 0?r(Y,this,w).call(this,e,`fetch`):c(F,this)[t]=p.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),r(Y,this,b).call(this,e,i,l.options,p))),i},d=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),f(e,!1)),f=(i,a)=>{let{aborted:s}=o.signal,l=s&&n.allowStaleOnFetchAbort,u=l||n.allowStaleOnFetchRejection,d=u||n.noDeleteOnFetchRejection,f=m;if(c(F,this)[t]===m&&(!d||!a&&f.__staleWhileFetching===void 0?r(Y,this,w).call(this,e,`fetch`):l||(c(F,this)[t]=f.__staleWhileFetching)),u)return n.status&&f.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),f.__staleWhileFetching;if(f.__returned===f)throw i},p=(t,r)=>{let i=c(he,this)?.call(this,e,a,l);o.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>u(e,!0)))}),i&&i instanceof Promise?i.then(e=>t(e===void 0?void 0:e),r):i!==void 0&&t(i)};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(p).then(u,d),h=Object.assign(m,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return t===void 0?(r(Y,this,b).call(this,e,h,{...l.options,status:void 0}),t=c(N,this).get(e)):c(F,this)[t]=h,h}function S(e){if(!c(_e,this))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}async function se(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:g,forceRefresh:ee=!1,status:_,signal:te}=t;if(_&&(_.op=`fetch`,_.key=e,ee&&(_.forceRefresh=!0),_.cache=this),!c(_e,this))return _&&(_.fetch=`get`),r(Y,this,C).call(this,e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:_});let ne={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:s,size:l,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:h,ignoreFetchAbort:m,status:_,signal:te},v=c(N,this).get(e);if(v===void 0){_&&(_.fetch=`miss`);let t=r(Y,this,oe).call(this,e,v,ne,g);return t.__returned=t}else{let t=c(F,this)[v];if(r(Y,this,S).call(this,t)){let e=n&&t.__staleWhileFetching!==void 0;return _&&(_.fetch=`inflight`,e&&(_.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let a=c(Z,this).call(this,v);if(!ee&&!a)return _&&(_.fetch=`hit`),r(Y,this,de).call(this,v),i&&c(ve,this).call(this,v),_&&c(X,this).call(this,_,v),t;let o=r(Y,this,oe).call(this,e,v,ne,g),s=o.__staleWhileFetching!==void 0&&n;return _&&(_.fetch=a?`stale`:`refresh`,s&&a&&(_.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}async function ce(e,t={}){let n=await r(Y,this,se).call(this,e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}function le(e,t={}){let n=c(ge,this);if(!n)throw Error(`no memoMethod provided to constructor`);let{context:i,status:a,forceRefresh:o,...s}=t;a&&o&&(a.forceRefresh=!0);let l=r(Y,this,C).call(this,e,s),u=o||l===void 0;if(a&&(a.memo=u?`miss`:`hit`,u||(a.value=l)),!u)return l;let d=n(e,l,{options:s,context:i});return a&&(a.value=d),r(Y,this,b).call(this,e,d,s),d}function C(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=t,s=c(N,this).get(e);if(s===void 0){o&&(o.get=`miss`);return}let l=c(F,this)[s],u=r(Y,this,S).call(this,l);return o&&c(X,this).call(this,o,s),c(Z,this).call(this,s)?u?(o&&(o.get=`stale-fetching`),n&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(a||r(Y,this,w).call(this,e,`expire`),o&&(o.get=`stale`),n?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?`fetching`:`hit`),r(Y,this,de).call(this,s),i&&c(ve,this).call(this,s),u?l.__staleWhileFetching:l)}function ue(e,t){c(L,this)[t]=e,c(I,this)[e]=t}function de(e){e!==c(z,this)&&(e===c(R,this)?u(R,this,c(I,this)[e]):r(Y,this,ue).call(this,c(L,this)[e],c(I,this)[e]),r(Y,this,ue).call(this,c(z,this),e),u(z,this,e))}function w(e,t){Q.hasSubscribers&&Q.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(c(j,this)!==0){let a=c(N,this).get(e);if(a!==void 0)if(c(G,this)?.[a]&&(clearTimeout(c(G,this)[a]),c(G,this)[a]=void 0),n=!0,c(j,this)===1)r(Y,this,fe).call(this,t);else{var i;c(be,this).call(this,a);let n=c(F,this)[a];if(r(Y,this,S).call(this,n)?n.__abortController.abort(Error(`deleted`)):(c(K,this)||c(q,this))&&(c(K,this)&&c(D,this)?.call(this,n,e,t),c(q,this)&&c(V,this)?.push([n,e,t])),c(N,this).delete(e),c(P,this)[a]=void 0,c(F,this)[a]=void 0,a===c(z,this))u(z,this,c(L,this)[a]);else if(a===c(R,this))u(R,this,c(I,this)[a]);else{let e=c(L,this)[a];c(I,this)[e]=c(I,this)[a];let t=c(I,this)[a];c(L,this)[t]=c(L,this)[a]}u(j,this,(i=c(j,this),i--,i)),c(B,this).push(a)}}if(c(q,this)&&c(V,this)?.length){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}return n}function fe(e){for(let t of r(Y,this,y).call(this,{allowStale:!0})){let n=c(F,this)[t];if(r(Y,this,S).call(this,n))n.__abortController.abort(Error(`deleted`));else{let r=c(P,this)[t];c(K,this)&&c(D,this)?.call(this,n,r,e),c(q,this)&&c(V,this)?.push([n,r,e])}}if(c(N,this).clear(),c(F,this).fill(void 0),c(P,this).fill(void 0),c(W,this)&&c(U,this)){c(W,this).fill(0),c(U,this).fill(0);for(let e of c(G,this)??[])e!==void 0&&clearTimeout(e);c(G,this)?.fill(void 0)}if(c(H,this)&&c(H,this).fill(0),u(R,this,0),u(z,this,0),c(B,this).length=0,u(M,this,0),u(j,this,0),c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}}var pe,me,T,E,D,O,k,he,ge,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,_e,q,J,Y,ve,X,ye,Z,be,xe,Se,Ce,we,Q,Te,Ee,De,Oe,ke,Ae,je,$,Me,Ne,Pe,Fe,Ie=e((()=>{t(),s(),d(),i(),a(),o(),Q=ee(`lru-cache:metrics`),Te=_(`lru-cache`),Ee=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,De=()=>Q.hasSubscribers||Te.hasSubscribers,Oe=new Set,ke=typeof process==`object`&&process?process:{},Ae=(e,t,n,r)=>{typeof ke.emitWarning==`function`?ke.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},je=e=>!Oe.has(e),$=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Me=e=>$(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Ne:null:null,Ne=class extends Array{constructor(e){super(e),this.fill(0)}},Pe=(pe=class e{static create(t){let n=Me(t);if(!n)return[];me._=r(pe,e,!0);let i=new e(t,n);return me._=r(pe,e,!1),i}constructor(t,i){if(n(this,`heap`,void 0),n(this,`length`,void 0),!r(pe,e,me)._)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new i(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},me={_:!1},pe),Fe=(T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,k=new WeakMap,he=new WeakMap,ge=new WeakMap,A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakMap,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,_e=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakSet,ve=new WeakMap,X=new WeakMap,ye=new WeakMap,Z=new WeakMap,be=new WeakMap,xe=new WeakMap,Se=new WeakMap,we=Symbol.iterator,Ce=Symbol.toStringTag,class e{get perf(){return c(A,this)}static unsafeExposeInternals(e){return{starts:c(U,e),ttls:c(W,e),autopurgeTimers:c(G,e),sizes:c(H,e),keyMap:c(N,e),keyList:c(P,e),valList:c(F,e),next:c(I,e),prev:c(L,e),get head(){return c(R,e)},get tail(){return c(z,e)},free:c(B,e),isBackgroundFetch:t=>r(Y,e,S).call(e,t),backgroundFetch:(t,n,i,a)=>r(Y,e,oe).call(e,t,n,i,a),moveToTail:t=>r(Y,e,de).call(e,t),indexes:t=>r(Y,e,v).call(e,t),rindexes:t=>r(Y,e,y).call(e,t),isStale:t=>c(Z,e).call(e,t)}}get max(){return c(T,this)}get maxSize(){return c(E,this)}get calculatedSize(){return c(M,this)}get size(){return c(j,this)}get fetchMethod(){return c(he,this)}get memoMethod(){return c(ge,this)}get dispose(){return c(D,this)}get onInsert(){return c(O,this)}get disposeAfter(){return c(k,this)}constructor(t){f(this,Y),l(this,T,void 0),l(this,E,void 0),l(this,D,void 0),l(this,O,void 0),l(this,k,void 0),l(this,he,void 0),l(this,ge,void 0),l(this,A,void 0),n(this,`ttl`,void 0),n(this,`ttlResolution`,void 0),n(this,`ttlAutopurge`,void 0),n(this,`updateAgeOnGet`,void 0),n(this,`updateAgeOnHas`,void 0),n(this,`allowStale`,void 0),n(this,`noDisposeOnSet`,void 0),n(this,`noUpdateTTL`,void 0),n(this,`maxEntrySize`,void 0),n(this,`sizeCalculation`,void 0),n(this,`noDeleteOnFetchRejection`,void 0),n(this,`noDeleteOnStaleGet`,void 0),n(this,`allowStaleOnFetchAbort`,void 0),n(this,`allowStaleOnFetchRejection`,void 0),n(this,`ignoreFetchAbort`,void 0),n(this,`backgroundFetchSize`,void 0),l(this,j,void 0),l(this,M,void 0),l(this,N,void 0),l(this,P,void 0),l(this,F,void 0),l(this,I,void 0),l(this,L,void 0),l(this,R,void 0),l(this,z,void 0),l(this,B,void 0),l(this,V,void 0),l(this,H,void 0),l(this,U,void 0),l(this,W,void 0),l(this,G,void 0),l(this,K,void 0),l(this,_e,void 0),l(this,q,void 0),l(this,J,void 0),l(this,ve,()=>{}),l(this,X,()=>{}),l(this,ye,()=>{}),l(this,Z,()=>!1),l(this,be,e=>{}),l(this,xe,(e,t,n)=>{}),l(this,Se,(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0}),n(this,Ce,`LRUCache`);let{max:i=0,ttl:a,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:d,updateAgeOnHas:p,allowStale:m,dispose:h,onInsert:g,disposeAfter:ee,noDisposeOnSet:_,noUpdateTTL:v,maxSize:y=0,maxEntrySize:re=0,sizeCalculation:b,fetchMethod:x,memoMethod:ie,noDeleteOnFetchRejection:ae,noDeleteOnStaleGet:oe,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:se,ignoreFetchAbort:ce,backgroundFetchSize:le=1,perf:C}=t;if(this.backgroundFetchSize=le,C!==void 0&&typeof C?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(u(A,this,C??Ee),i!==0&&!$(i))throw TypeError(`max option must be a nonnegative integer`);let ue=i?Me(i):Array;if(!ue)throw Error(`invalid max value: `+i);if(u(T,this,i),u(E,this,y),this.maxEntrySize=re||c(E,this),this.sizeCalculation=b,this.sizeCalculation){if(!c(E,this)&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(ie!==void 0&&typeof ie!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(u(ge,this,ie),x!==void 0&&typeof x!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(u(he,this,x),u(_e,this,!!x),u(N,this,new Map),u(P,this,Array.from({length:i}).fill(void 0)),u(F,this,Array.from({length:i}).fill(void 0)),u(I,this,new ue(i)),u(L,this,new ue(i)),u(R,this,0),u(z,this,0),u(B,this,Pe.create(i)),u(j,this,0),u(M,this,0),typeof h==`function`&&u(D,this,h),typeof g==`function`&&u(O,this,g),typeof ee==`function`?(u(k,this,ee),u(V,this,[])):(u(k,this,void 0),u(V,this,void 0)),u(K,this,!!c(D,this)),u(J,this,!!c(O,this)),u(q,this,!!c(k,this)),this.noDisposeOnSet=!!_,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!ae,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!se,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(c(E,this)!==0&&!$(c(E,this)))throw TypeError(`maxSize must be a positive integer if specified`);if(!$(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);r(Y,this,ne).call(this)}if(this.allowStale=!!m,this.noDeleteOnStaleGet=!!oe,this.updateAgeOnGet=!!d,this.updateAgeOnHas=!!p,this.ttlResolution=$(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=a||0,this.ttl){if(!$(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);r(Y,this,te).call(this)}if(c(T,this)===0&&this.ttl===0&&c(E,this)===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!c(T,this)&&!c(E,this)){let t=`LRU_CACHE_UNBOUNDED`;je(t)&&(Oe.add(t),Ae(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return c(N,this).has(e)?1/0:0}*entries(){for(let e of r(Y,this,v).call(this))c(F,this)[e]!==void 0&&c(P,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield[c(P,this)[e],c(F,this)[e]])}*rentries(){for(let e of r(Y,this,y).call(this))c(F,this)[e]!==void 0&&c(P,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield[c(P,this)[e],c(F,this)[e]])}*keys(){for(let e of r(Y,this,v).call(this)){let t=c(P,this)[e];t!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield t)}}*rkeys(){for(let e of r(Y,this,y).call(this)){let t=c(P,this)[e];t!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield t)}}*values(){for(let e of r(Y,this,v).call(this))c(F,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield c(F,this)[e])}*rvalues(){for(let e of r(Y,this,y).call(this))c(F,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield c(F,this)[e])}[we](){return this.entries()}find(e,t={}){for(let n of r(Y,this,v).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,c(P,this)[n],this))return r(Y,this,C).call(this,c(P,this)[n],t)}}forEach(e,t=this){for(let n of r(Y,this,v).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,c(P,this)[n],this)}}rforEach(e,t=this){for(let n of r(Y,this,y).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,c(P,this)[n],this)}}purgeStale(){let e=!1;for(let t of r(Y,this,y).call(this,{allowStale:!0}))c(Z,this).call(this,t)&&(r(Y,this,w).call(this,c(P,this)[t],`expire`),e=!0);return e}info(e){let t=c(N,this).get(e);if(t===void 0)return;let n=c(F,this)[t],i=r(Y,this,S).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let a={value:i};if(c(W,this)&&c(U,this)){let e=c(W,this)[t],n=c(U,this)[t];e&&n&&(a.ttl=e-(c(A,this).now()-n),a.start=Date.now())}return c(H,this)&&(a.size=c(H,this)[t]),a}dump(){let e=[];for(let t of r(Y,this,v).call(this,{allowStale:!0})){let n=c(P,this)[t],i=c(F,this)[t],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||n===void 0)continue;let o={value:a};if(c(W,this)&&c(U,this)){o.ttl=c(W,this)[t];let e=c(A,this).now()-c(U,this)[t];o.start=Math.floor(Date.now()-e)}c(H,this)&&(o.size=c(H,this)[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=c(A,this).now()-e}r(Y,this,b).call(this,t,n.value,n)}}set(e,t,n={}){let{status:i=Q.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op=`set`,i.key=e,t!==void 0&&(i.value=t),i.cache=this);let a=r(Y,this,b).call(this,e,t,n);return i&&Q.hasSubscribers&&Q.publish(i),a}pop(){try{for(;c(j,this);){let e=c(F,this)[c(R,this)];if(r(Y,this,x).call(this,!0),r(Y,this,S).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}}}has(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let i=r(Y,this,ie).call(this,e,t);return Q.hasSubscribers&&Q.publish(n),i}peek(e,t={}){let{status:n=De()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let i=r(Y,this,ae).call(this,e,t);return Q.hasSubscribers&&Q.publish(n),i}fetch(e,t={}){let n=Te.hasSubscribers,{status:i=De()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let a=r(Y,this,se).call(this,e,t);return i&&n&&(i.trace=!0,Te.tracePromise(()=>a,i).catch(()=>{})),a}forceFetch(e,t={}){let n=Te.hasSubscribers,{status:i=De()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let a=r(Y,this,ce).call(this,e,t);return i&&n&&(i.trace=!0,Te.tracePromise(()=>a,i).catch(()=>{})),a}memo(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=r(Y,this,le).call(this,e,t);return n&&(n.value=i),Q.hasSubscribers&&Q.publish(n),i}get(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let i=r(Y,this,C).call(this,e,t);return n&&(i!==void 0&&(n.value=i),Q.hasSubscribers&&Q.publish(n)),i}delete(e){return r(Y,this,w).call(this,e,`delete`)}clear(){return r(Y,this,fe).call(this,`delete`)}})}));function Le(e,t=300*1e3){let n=new Map,r=new Map,i=async(...i)=>{let a=p(i),o=n.get(a),s=Date.now();if(!o){let t=r.get(a);if(t)return t;let o=e(...i);r.set(a,o);try{let e=await o;return r.get(a)===o&&n.set(a,{value:e,timestamp:s,refreshing:!1}),e}finally{r.get(a)===o&&r.delete(a)}}if(o&&s-o.timestamp>t&&!o.refreshing){o.refreshing=!0;let t=o;return e(...i).then(e=>{n.get(a)===t&&n.set(a,{value:e,timestamp:Date.now(),refreshing:!1})}).catch(e=>{g(e),n.get(a)===t&&n.delete(a)}),o.value}return n.get(a).value};return i.cache={clear:()=>{n.clear(),r.clear()}},i}function Re(e,t,n=100){let r=new Fe({max:n}),i=(...n)=>{let i=t(...n),a=r.get(i);if(a!==void 0)return a;let o=e(...n);return r.set(i,o),o};return i.cache={clear:()=>r.clear(),size:()=>r.size,delete:e=>r.delete(e),get:e=>r.peek(e),has:e=>r.has(e)},i}var ze=e((()=>{Ie(),h(),m()}));export{Ie as a,Fe as i,Re as n,Le as r,ze as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as d,t as f}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{C as p,x as m}from"./debug-D58GQBDG.js";import{o as h,s as g}from"./log-CZ7ploQm.js";import{channel as ee,tracingChannel as _}from"node:diagnostics_channel";function te(){let e=new Ne(c(T,this)),t=new Ne(c(T,this));u(W,this,e),u(U,this,t);let n=this.ttlAutopurge?Array.from({length:c(T,this)}):void 0;u(G,this,n),u(ye,this,(n,r,a=c(A,this).now())=>{t[n]=r===0?0:a,e[n]=r,i(n,r)}),u(ve,this,n=>{t[n]=e[n]===0?0:c(A,this).now(),i(n,e[n])});let i=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let a=setTimeout(()=>{c(Z,this).call(this,e)?(r(Y,this,w).call(this,c(P,this)[e],`expire`),n[e]=void 0):i(e,s(e))},t+1);a.unref&&a.unref(),n[e]=a}}:()=>{};u(X,this,(n,r)=>{if(e[r]){let i=e[r],s=t[r];if(!i||!s)return;n.ttl=i,n.start=s,n.now=a||o(),n.remainingTTL=i-(n.now-s)}});let a=0,o=()=>{let e=c(A,this).now();if(this.ttlResolution>0){a=e;let t=setTimeout(()=>a=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=c(N,this).get(e);return t===void 0?0:s(t)};let s=n=>{let r=e[n],i=t[n];return!r||!i?1/0:r-((a||o())-i)};u(Z,this,n=>{let r=t[n],i=e[n];return!!i&&!!r&&(a||o())-r>i})}function ne(){let e=new Ne(c(T,this));u(M,this,0),u(H,this,e),u(be,this,t=>{u(M,this,c(M,this)-e[t]),e[t]=0}),u(Se,this,(e,t,n,i)=>{if(!$(n)){if(r(Y,this,S).call(this,t))return this.backgroundFetchSize;if(i){if(typeof i!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=i(t,e),!$(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n}),u(xe,this,(t,n,i)=>{if(e[t]=n,c(E,this)){let n=c(E,this)-e[t];for(;c(M,this)>n;)r(Y,this,x).call(this,!0)}u(M,this,c(M,this)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=c(M,this))})}function*v({allowStale:e=this.allowStale}={}){if(c(j,this))for(let t=c(z,this);r(Y,this,re).call(this,t)&&((e||!c(Z,this).call(this,t))&&(yield t),t!==c(R,this));)t=c(L,this)[t]}function*y({allowStale:e=this.allowStale}={}){if(c(j,this))for(let t=c(R,this);r(Y,this,re).call(this,t)&&((e||!c(Z,this).call(this,t))&&(yield t),t!==c(z,this));)t=c(I,this)[t]}function re(e){return e!==void 0&&c(N,this).get(c(P,this)[e])===e}function b(e,t,n,i){var a;let{ttl:o=this.ttl,start:s,noDisposeOnSet:l=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:f}=n,p=r(Y,this,S).call(this,t);if(t===void 0)return f&&(f.set=`deleted`),this.delete(e),this;let{noUpdateTTL:m=this.noUpdateTTL}=n;f&&!p&&(f.value=t);let h=c(Se,this).call(this,e,t,n.size||0,d,f);if(this.maxEntrySize&&h>this.maxEntrySize)return r(Y,this,w).call(this,e,`set`),f&&(f.set=`miss`,f.maxEntrySizeExceeded=!0),this;let g=c(j,this)===0?void 0:c(N,this).get(e);if(g===void 0)g=c(j,this)===0?c(z,this):c(B,this).length===0?c(j,this)===c(T,this)?r(Y,this,x).call(this,!1):c(j,this):c(B,this).pop(),c(P,this)[g]=e,c(F,this)[g]=t,c(N,this).set(e,g),c(I,this)[c(z,this)]=g,c(L,this)[g]=c(z,this),u(z,this,g),u(j,this,(a=c(j,this),a++,a)),c(xe,this).call(this,g,h,f),f&&(f.set=`add`),m=!1,c(J,this)&&!p&&c(O,this)?.call(this,t,e,`add`);else{r(Y,this,de).call(this,g);let n=c(F,this)[g];if(t!==n){if(!l)if(r(Y,this,S).call(this,n)){n!==i&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:r}=n;r!==void 0&&r!==t&&(c(K,this)&&c(D,this)?.call(this,r,e,`set`),c(q,this)&&c(V,this)?.push([r,e,`set`]))}else c(K,this)&&c(D,this)?.call(this,n,e,`set`),c(q,this)&&c(V,this)?.push([n,e,`set`]);if(c(be,this).call(this,g),c(xe,this).call(this,g,h,f),c(F,this)[g]=t,!p){let i=n&&r(Y,this,S).call(this,n)?n.__staleWhileFetching:n,a=i===void 0?`add`:t===i?`update`:`replace`;f&&(f.set=a,i!==void 0&&(f.oldValue=i)),c(J,this)&&this.onInsert?.(t,e,a)}}else p||(f&&(f.set=`update`),c(J,this)&&this.onInsert?.(t,e,`update`))}if(o!==0&&!c(W,this)&&r(Y,this,te).call(this),c(W,this)&&(m||c(ye,this).call(this,g,o,s),f&&c(X,this).call(this,f,g)),!l&&c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}return this}function x(e){var t;let n=c(R,this),i=c(P,this)[n],a=c(F,this)[n],o=r(Y,this,S).call(this,a);o&&a.__abortController.abort(Error(`evicted`));let s=o?a.__staleWhileFetching:a;return(c(K,this)||c(q,this))&&s!==void 0&&(c(K,this)&&c(D,this)?.call(this,s,i,`evict`),c(q,this)&&c(V,this)?.push([s,i,`evict`])),c(be,this).call(this,n),c(G,this)?.[n]&&(clearTimeout(c(G,this)[n]),c(G,this)[n]=void 0),e&&(c(P,this)[n]=void 0,c(F,this)[n]=void 0,c(B,this).push(n)),c(j,this)===1?(u(R,this,u(z,this,0)),c(B,this).length=0):u(R,this,c(I,this)[n]),c(N,this).delete(i),u(j,this,(t=c(j,this),t--,t)),n}function ie(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,a=c(N,this).get(e);if(a!==void 0){let e=c(F,this)[a];if(r(Y,this,S).call(this,e)&&e.__staleWhileFetching===void 0)return!1;if(c(Z,this).call(this,a))i&&(i.has=`stale`,c(X,this).call(this,i,a));else return n&&c(ve,this).call(this,a),i&&(i.has=`hit`,c(X,this).call(this,i,a)),!0}else i&&(i.has=`miss`);return!1}function ae(e,t){let{status:n,allowStale:i=this.allowStale}=t,a=c(N,this).get(e);if(a===void 0||!i&&c(Z,this).call(this,a)){n&&(n.peek=a===void 0?`miss`:`stale`);return}let o=c(F,this)[a],s=r(Y,this,S).call(this,o)?o.__staleWhileFetching:o;return n&&(s===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=s)),s}function oe(e,t,n,i){let a=t===void 0?void 0:c(F,this)[t];if(r(Y,this,S).call(this,a))return a;let o=new AbortController,{signal:s}=n;s?.addEventListener(`abort`,()=>o.abort(s.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:i},u=(i,a=!1)=>{let{aborted:s}=o.signal,u=n.ignoreFetchAbort&&i!==void 0,d=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&i!==void 0);if(n.status&&(s&&!a?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,u&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),s&&!u&&!a)return f(o.signal.reason,d);let p=m,h=c(F,this)[t];return(h===m||h===void 0&&u&&a)&&(i===void 0?p.__staleWhileFetching===void 0?r(Y,this,w).call(this,e,`fetch`):c(F,this)[t]=p.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),r(Y,this,b).call(this,e,i,l.options,p))),i},d=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),f(e,!1)),f=(i,a)=>{let{aborted:s}=o.signal,l=s&&n.allowStaleOnFetchAbort,u=l||n.allowStaleOnFetchRejection,d=u||n.noDeleteOnFetchRejection,f=m;if(c(F,this)[t]===m&&(!d||!a&&f.__staleWhileFetching===void 0?r(Y,this,w).call(this,e,`fetch`):l||(c(F,this)[t]=f.__staleWhileFetching)),u)return n.status&&f.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),f.__staleWhileFetching;if(f.__returned===f)throw i},p=(t,r)=>{let i=c(he,this)?.call(this,e,a,l);o.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>u(e,!0)))}),i&&i instanceof Promise?i.then(e=>t(e===void 0?void 0:e),r):i!==void 0&&t(i)};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(p).then(u,d),h=Object.assign(m,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return t===void 0?(r(Y,this,b).call(this,e,h,{...l.options,status:void 0}),t=c(N,this).get(e)):c(F,this)[t]=h,h}function S(e){if(!c(_e,this))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}async function se(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:g,forceRefresh:ee=!1,status:_,signal:te}=t;if(_&&(_.op=`fetch`,_.key=e,ee&&(_.forceRefresh=!0),_.cache=this),!c(_e,this))return _&&(_.fetch=`get`),r(Y,this,C).call(this,e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:_});let ne={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:s,size:l,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:h,ignoreFetchAbort:m,status:_,signal:te},v=c(N,this).get(e);if(v===void 0){_&&(_.fetch=`miss`);let t=r(Y,this,oe).call(this,e,v,ne,g);return t.__returned=t}else{let t=c(F,this)[v];if(r(Y,this,S).call(this,t)){let e=n&&t.__staleWhileFetching!==void 0;return _&&(_.fetch=`inflight`,e&&(_.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let a=c(Z,this).call(this,v);if(!ee&&!a)return _&&(_.fetch=`hit`),r(Y,this,de).call(this,v),i&&c(ve,this).call(this,v),_&&c(X,this).call(this,_,v),t;let o=r(Y,this,oe).call(this,e,v,ne,g),s=o.__staleWhileFetching!==void 0&&n;return _&&(_.fetch=a?`stale`:`refresh`,s&&a&&(_.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}async function ce(e,t={}){let n=await r(Y,this,se).call(this,e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}function le(e,t={}){let n=c(ge,this);if(!n)throw Error(`no memoMethod provided to constructor`);let{context:i,status:a,forceRefresh:o,...s}=t;a&&o&&(a.forceRefresh=!0);let l=r(Y,this,C).call(this,e,s),u=o||l===void 0;if(a&&(a.memo=u?`miss`:`hit`,u||(a.value=l)),!u)return l;let d=n(e,l,{options:s,context:i});return a&&(a.value=d),r(Y,this,b).call(this,e,d,s),d}function C(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=t,s=c(N,this).get(e);if(s===void 0){o&&(o.get=`miss`);return}let l=c(F,this)[s],u=r(Y,this,S).call(this,l);return o&&c(X,this).call(this,o,s),c(Z,this).call(this,s)?u?(o&&(o.get=`stale-fetching`),n&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(a||r(Y,this,w).call(this,e,`expire`),o&&(o.get=`stale`),n?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?`fetching`:`hit`),r(Y,this,de).call(this,s),i&&c(ve,this).call(this,s),u?l.__staleWhileFetching:l)}function ue(e,t){c(L,this)[t]=e,c(I,this)[e]=t}function de(e){e!==c(z,this)&&(e===c(R,this)?u(R,this,c(I,this)[e]):r(Y,this,ue).call(this,c(L,this)[e],c(I,this)[e]),r(Y,this,ue).call(this,c(z,this),e),u(z,this,e))}function w(e,t){Q.hasSubscribers&&Q.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(c(j,this)!==0){let a=c(N,this).get(e);if(a!==void 0)if(c(G,this)?.[a]&&(clearTimeout(c(G,this)[a]),c(G,this)[a]=void 0),n=!0,c(j,this)===1)r(Y,this,fe).call(this,t);else{var i;c(be,this).call(this,a);let n=c(F,this)[a];if(r(Y,this,S).call(this,n)?n.__abortController.abort(Error(`deleted`)):(c(K,this)||c(q,this))&&(c(K,this)&&c(D,this)?.call(this,n,e,t),c(q,this)&&c(V,this)?.push([n,e,t])),c(N,this).delete(e),c(P,this)[a]=void 0,c(F,this)[a]=void 0,a===c(z,this))u(z,this,c(L,this)[a]);else if(a===c(R,this))u(R,this,c(I,this)[a]);else{let e=c(L,this)[a];c(I,this)[e]=c(I,this)[a];let t=c(I,this)[a];c(L,this)[t]=c(L,this)[a]}u(j,this,(i=c(j,this),i--,i)),c(B,this).push(a)}}if(c(q,this)&&c(V,this)?.length){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}return n}function fe(e){for(let t of r(Y,this,y).call(this,{allowStale:!0})){let n=c(F,this)[t];if(r(Y,this,S).call(this,n))n.__abortController.abort(Error(`deleted`));else{let r=c(P,this)[t];c(K,this)&&c(D,this)?.call(this,n,r,e),c(q,this)&&c(V,this)?.push([n,r,e])}}if(c(N,this).clear(),c(F,this).fill(void 0),c(P,this).fill(void 0),c(W,this)&&c(U,this)){c(W,this).fill(0),c(U,this).fill(0);for(let e of c(G,this)??[])e!==void 0&&clearTimeout(e);c(G,this)?.fill(void 0)}if(c(H,this)&&c(H,this).fill(0),u(R,this,0),u(z,this,0),c(B,this).length=0,u(M,this,0),u(j,this,0),c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}}var pe,me,T,E,D,O,k,he,ge,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,_e,q,J,Y,ve,X,ye,Z,be,xe,Se,Ce,we,Q,Te,Ee,De,Oe,ke,Ae,je,$,Me,Ne,Pe,Fe,Ie=e((()=>{t(),s(),d(),i(),a(),o(),Q=ee(`lru-cache:metrics`),Te=_(`lru-cache`),Ee=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,De=()=>Q.hasSubscribers||Te.hasSubscribers,Oe=new Set,ke=typeof process==`object`&&process?process:{},Ae=(e,t,n,r)=>{typeof ke.emitWarning==`function`?ke.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},je=e=>!Oe.has(e),$=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Me=e=>$(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Ne:null:null,Ne=class extends Array{constructor(e){super(e),this.fill(0)}},Pe=(pe=class e{static create(t){let n=Me(t);if(!n)return[];me._=r(pe,e,!0);let i=new e(t,n);return me._=r(pe,e,!1),i}constructor(t,i){if(n(this,`heap`,void 0),n(this,`length`,void 0),!r(pe,e,me)._)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new i(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},me={_:!1},pe),Fe=(T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,k=new WeakMap,he=new WeakMap,ge=new WeakMap,A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakMap,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,_e=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakSet,ve=new WeakMap,X=new WeakMap,ye=new WeakMap,Z=new WeakMap,be=new WeakMap,xe=new WeakMap,Se=new WeakMap,we=Symbol.iterator,Ce=Symbol.toStringTag,class e{get perf(){return c(A,this)}static unsafeExposeInternals(e){return{starts:c(U,e),ttls:c(W,e),autopurgeTimers:c(G,e),sizes:c(H,e),keyMap:c(N,e),keyList:c(P,e),valList:c(F,e),next:c(I,e),prev:c(L,e),get head(){return c(R,e)},get tail(){return c(z,e)},free:c(B,e),isBackgroundFetch:t=>r(Y,e,S).call(e,t),backgroundFetch:(t,n,i,a)=>r(Y,e,oe).call(e,t,n,i,a),moveToTail:t=>r(Y,e,de).call(e,t),indexes:t=>r(Y,e,v).call(e,t),rindexes:t=>r(Y,e,y).call(e,t),isStale:t=>c(Z,e).call(e,t)}}get max(){return c(T,this)}get maxSize(){return c(E,this)}get calculatedSize(){return c(M,this)}get size(){return c(j,this)}get fetchMethod(){return c(he,this)}get memoMethod(){return c(ge,this)}get dispose(){return c(D,this)}get onInsert(){return c(O,this)}get disposeAfter(){return c(k,this)}constructor(t){f(this,Y),l(this,T,void 0),l(this,E,void 0),l(this,D,void 0),l(this,O,void 0),l(this,k,void 0),l(this,he,void 0),l(this,ge,void 0),l(this,A,void 0),n(this,`ttl`,void 0),n(this,`ttlResolution`,void 0),n(this,`ttlAutopurge`,void 0),n(this,`updateAgeOnGet`,void 0),n(this,`updateAgeOnHas`,void 0),n(this,`allowStale`,void 0),n(this,`noDisposeOnSet`,void 0),n(this,`noUpdateTTL`,void 0),n(this,`maxEntrySize`,void 0),n(this,`sizeCalculation`,void 0),n(this,`noDeleteOnFetchRejection`,void 0),n(this,`noDeleteOnStaleGet`,void 0),n(this,`allowStaleOnFetchAbort`,void 0),n(this,`allowStaleOnFetchRejection`,void 0),n(this,`ignoreFetchAbort`,void 0),n(this,`backgroundFetchSize`,void 0),l(this,j,void 0),l(this,M,void 0),l(this,N,void 0),l(this,P,void 0),l(this,F,void 0),l(this,I,void 0),l(this,L,void 0),l(this,R,void 0),l(this,z,void 0),l(this,B,void 0),l(this,V,void 0),l(this,H,void 0),l(this,U,void 0),l(this,W,void 0),l(this,G,void 0),l(this,K,void 0),l(this,_e,void 0),l(this,q,void 0),l(this,J,void 0),l(this,ve,()=>{}),l(this,X,()=>{}),l(this,ye,()=>{}),l(this,Z,()=>!1),l(this,be,e=>{}),l(this,xe,(e,t,n)=>{}),l(this,Se,(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0}),n(this,Ce,`LRUCache`);let{max:i=0,ttl:a,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:d,updateAgeOnHas:p,allowStale:m,dispose:h,onInsert:g,disposeAfter:ee,noDisposeOnSet:_,noUpdateTTL:v,maxSize:y=0,maxEntrySize:re=0,sizeCalculation:b,fetchMethod:x,memoMethod:ie,noDeleteOnFetchRejection:ae,noDeleteOnStaleGet:oe,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:se,ignoreFetchAbort:ce,backgroundFetchSize:le=1,perf:C}=t;if(this.backgroundFetchSize=le,C!==void 0&&typeof C?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(u(A,this,C??Ee),i!==0&&!$(i))throw TypeError(`max option must be a nonnegative integer`);let ue=i?Me(i):Array;if(!ue)throw Error(`invalid max value: `+i);if(u(T,this,i),u(E,this,y),this.maxEntrySize=re||c(E,this),this.sizeCalculation=b,this.sizeCalculation){if(!c(E,this)&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(ie!==void 0&&typeof ie!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(u(ge,this,ie),x!==void 0&&typeof x!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(u(he,this,x),u(_e,this,!!x),u(N,this,new Map),u(P,this,Array.from({length:i}).fill(void 0)),u(F,this,Array.from({length:i}).fill(void 0)),u(I,this,new ue(i)),u(L,this,new ue(i)),u(R,this,0),u(z,this,0),u(B,this,Pe.create(i)),u(j,this,0),u(M,this,0),typeof h==`function`&&u(D,this,h),typeof g==`function`&&u(O,this,g),typeof ee==`function`?(u(k,this,ee),u(V,this,[])):(u(k,this,void 0),u(V,this,void 0)),u(K,this,!!c(D,this)),u(J,this,!!c(O,this)),u(q,this,!!c(k,this)),this.noDisposeOnSet=!!_,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!ae,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!se,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(c(E,this)!==0&&!$(c(E,this)))throw TypeError(`maxSize must be a positive integer if specified`);if(!$(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);r(Y,this,ne).call(this)}if(this.allowStale=!!m,this.noDeleteOnStaleGet=!!oe,this.updateAgeOnGet=!!d,this.updateAgeOnHas=!!p,this.ttlResolution=$(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=a||0,this.ttl){if(!$(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);r(Y,this,te).call(this)}if(c(T,this)===0&&this.ttl===0&&c(E,this)===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!c(T,this)&&!c(E,this)){let t=`LRU_CACHE_UNBOUNDED`;je(t)&&(Oe.add(t),Ae(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return c(N,this).has(e)?1/0:0}*entries(){for(let e of r(Y,this,v).call(this))c(F,this)[e]!==void 0&&c(P,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield[c(P,this)[e],c(F,this)[e]])}*rentries(){for(let e of r(Y,this,y).call(this))c(F,this)[e]!==void 0&&c(P,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield[c(P,this)[e],c(F,this)[e]])}*keys(){for(let e of r(Y,this,v).call(this)){let t=c(P,this)[e];t!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield t)}}*rkeys(){for(let e of r(Y,this,y).call(this)){let t=c(P,this)[e];t!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield t)}}*values(){for(let e of r(Y,this,v).call(this))c(F,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield c(F,this)[e])}*rvalues(){for(let e of r(Y,this,y).call(this))c(F,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield c(F,this)[e])}[we](){return this.entries()}find(e,t={}){for(let n of r(Y,this,v).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,c(P,this)[n],this))return r(Y,this,C).call(this,c(P,this)[n],t)}}forEach(e,t=this){for(let n of r(Y,this,v).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,c(P,this)[n],this)}}rforEach(e,t=this){for(let n of r(Y,this,y).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,c(P,this)[n],this)}}purgeStale(){let e=!1;for(let t of r(Y,this,y).call(this,{allowStale:!0}))c(Z,this).call(this,t)&&(r(Y,this,w).call(this,c(P,this)[t],`expire`),e=!0);return e}info(e){let t=c(N,this).get(e);if(t===void 0)return;let n=c(F,this)[t],i=r(Y,this,S).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let a={value:i};if(c(W,this)&&c(U,this)){let e=c(W,this)[t],n=c(U,this)[t];e&&n&&(a.ttl=e-(c(A,this).now()-n),a.start=Date.now())}return c(H,this)&&(a.size=c(H,this)[t]),a}dump(){let e=[];for(let t of r(Y,this,v).call(this,{allowStale:!0})){let n=c(P,this)[t],i=c(F,this)[t],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||n===void 0)continue;let o={value:a};if(c(W,this)&&c(U,this)){o.ttl=c(W,this)[t];let e=c(A,this).now()-c(U,this)[t];o.start=Math.floor(Date.now()-e)}c(H,this)&&(o.size=c(H,this)[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=c(A,this).now()-e}r(Y,this,b).call(this,t,n.value,n)}}set(e,t,n={}){let{status:i=Q.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op=`set`,i.key=e,t!==void 0&&(i.value=t),i.cache=this);let a=r(Y,this,b).call(this,e,t,n);return i&&Q.hasSubscribers&&Q.publish(i),a}pop(){try{for(;c(j,this);){let e=c(F,this)[c(R,this)];if(r(Y,this,x).call(this,!0),r(Y,this,S).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}}}has(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let i=r(Y,this,ie).call(this,e,t);return Q.hasSubscribers&&Q.publish(n),i}peek(e,t={}){let{status:n=De()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let i=r(Y,this,ae).call(this,e,t);return Q.hasSubscribers&&Q.publish(n),i}fetch(e,t={}){let n=Te.hasSubscribers,{status:i=De()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let a=r(Y,this,se).call(this,e,t);return i&&n&&(i.trace=!0,Te.tracePromise(()=>a,i).catch(()=>{})),a}forceFetch(e,t={}){let n=Te.hasSubscribers,{status:i=De()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let a=r(Y,this,ce).call(this,e,t);return i&&n&&(i.trace=!0,Te.tracePromise(()=>a,i).catch(()=>{})),a}memo(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=r(Y,this,le).call(this,e,t);return n&&(n.value=i),Q.hasSubscribers&&Q.publish(n),i}get(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let i=r(Y,this,C).call(this,e,t);return n&&(i!==void 0&&(n.value=i),Q.hasSubscribers&&Q.publish(n)),i}delete(e){return r(Y,this,w).call(this,e,`delete`)}clear(){return r(Y,this,fe).call(this,`delete`)}})}));function Le(e,t=300*1e3){let n=new Map,r=new Map,i=async(...i)=>{let a=p(i),o=n.get(a),s=Date.now();if(!o){let t=r.get(a);if(t)return t;let o=e(...i);r.set(a,o);try{let e=await o;return r.get(a)===o&&n.set(a,{value:e,timestamp:s,refreshing:!1}),e}finally{r.get(a)===o&&r.delete(a)}}if(o&&s-o.timestamp>t&&!o.refreshing){o.refreshing=!0;let t=o;return e(...i).then(e=>{n.get(a)===t&&n.set(a,{value:e,timestamp:Date.now(),refreshing:!1})}).catch(e=>{g(e),n.get(a)===t&&n.delete(a)}),o.value}return n.get(a).value};return i.cache={clear:()=>{n.clear(),r.clear()}},i}function Re(e,t,n=100){let r=new Fe({max:n}),i=(...n)=>{let i=t(...n),a=r.get(i);if(a!==void 0)return a;let o=e(...n);return r.set(i,o),o};return i.cache={clear:()=>r.clear(),size:()=>r.size,delete:e=>r.delete(e),get:e=>r.peek(e),has:e=>r.has(e)},i}var ze=e((()=>{Ie(),h(),m()}));export{Ie as a,Fe as i,Re as n,Le as r,ze as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{Ky as i,Mc as a,Nc as o,Qu as s,Vy as c,Wy as l,Xh as u,Zh as d,Zu as f,eE as ee,eS as p,ff as m,nE as h,nS as te,pf as ne,uC as g}from"./loadAgentsDir-DaNpxaO-.js";import{I as _,Lt as v,P as y,Wt as b,_ as x,ai as S,di as re,fi as C,t as w,y as T}from"./src-DL3w8VPk2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{$ as D,Ut as O}from"./state-D5D6QpTX.js";import{n as k,t as A}from"./cwd-Nh5IZNKO.js";import{F as j,R as M}from"./debug-D58GQBDG.js";import{Cn as N,b as P,bn as ie,h as F}from"./settings-3xZ0fsvE.js";import{M as I,P as L,k as ae}from"./config-DRy1I12M.js";import{m as R,r as z}from"./git-By_J4XJL.js";import{o as oe,s as se}from"./log-CZ7ploQm.js";import{n as ce,r as B}from"./analytics-DJobLaWP.js";import{m as le,v as V}from"./startupProfiler-CbzxVmbv.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js";import{r as ue,t as de}from"./promptEditor-Cr4w-4Bz.js";import{homedir as fe}from"os";import{join as W,relative as pe}from"path";import{mkdir as G,writeFile as me}from"fs/promises";function he(e){return z(e)!==null}var K=e((()=>{R()}));function ge({onSelect:e,onCancel:t}){let r=(0,q.use)(l()),i=W(n(),`AGENTS.md`),a=W(D(),`AGENTS.md`),c=r.some(e=>e.path===i),u=r.some(e=>e.path===a),f=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...c?[]:[{path:i,type:`User`,content:``,exists:!1}],...u?[]:[{path:a,type:`Project`,content:``,exists:!1}]],p=new Map,m=f.map(e=>{let t=ie(e.path),n=e.exists?``:` (new)`,r=e.parent?(p.get(e.parent)??0)+1:0;p.set(e.path,r);let o=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===i?`User memory`:e.type===`Project`&&!e.isNested&&e.path===a?`Project memory`:r>0?`${o}L ${t}${n}`:`${t}`;let c,l=he(D());return c=e.type===`User`&&!e.isNested?`Saved in ~/.workmate/AGENTS.md`:e.type===`Project`&&!e.isNested&&e.path===a?`${l?`Checked in at`:`Saved in`} ./AGENTS.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),h=[],g=d(e=>e.agentDefinitions);if(L()){h.push({label:`Open auto-memory folder`,value:`${X}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=ee(e.agentType,e.memory);h.push({label:`Open ${re.bold(e.agentType)} agent memory`,value:`${X}${t}`,description:`${e.memory} scope`})}}m.push(...h);let v=Y&&m.some(e=>e.value===Y)?Y:m[0]?.value||``,[S,C]=(0,q.useState)(L),[w,T]=(0,q.useState)(o),[E]=(0,q.useState)(L),O=d(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,q.useState)(null);(0,q.useEffect)(()=>{E&&ne().then(A)},[E,O]);let j=O?`running`:k===null?``:k===0?`never`:`last ran ${le(new Date(k))}`,[M,N]=(0,q.useState)(null),F=M!==null,I=+!!E;function R(){let e=!S;P(`userSettings`,{autoMemoryEnabled:e}),C(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!w;P(`userSettings`,{autoDreamEnabled:e}),T(e),B(`tengu_auto_dream_toggled`,{enabled:e})}return H(),b(`confirm:no`,t,{context:`Confirmation`}),b(`confirm:yes`,()=>{M===0?R():M===1&&z()},{context:`Confirmation`,isActive:F}),b(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:F}),b(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:F}),(0,J.jsxs)(_,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,J.jsx)(x,{isFocused:M===0,children:(0,J.jsxs)(y,{children:[`Auto-memory: `,S?`on`:`off`]})}),E&&(0,J.jsx)(x,{isFocused:M===1,styled:!1,children:(0,J.jsxs)(y,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,J.jsxs)(y,{dimColor:!0,children:[` · `,j]}),!O&&w&&(0,J.jsx)(y,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,J.jsx)(s,{defaultFocusValue:v,options:m,isDisabled:F,onChange:t=>{if(t.startsWith(X)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>te(e));return}Y=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var q,J,Y,X,_e=e((()=>{C(),q=t(S(),1),O(),U(),w(),g(),I(),ce(),a(),m(),u(),h(),p(),i(),r(),N(),V(),K(),F(),f(),J=E(),X=`__open_folder__`}));function ve(e){let t=fe(),n=A(),r=e.startsWith(t)?`~${e.slice(t.length)}`:null,i=e.startsWith(n)?`./${pe(n,e)}`:null;return r&&i?r.length<=i.length?r:i:r||i||e}var ye=e((()=>{w(),k(),E()}));function be({onDone:e}){let t=async t=>{try{t.includes(n())&&await G(n(),{recursive:!0});try{await me(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(j(e)!==`EEXIST`)throw e}await de(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r==="default"?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${ve(t)}\n\n${o}`,{display:`system`})}catch(t){se(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(T,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(_,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(ge,{onSelect:t,onCancel:r})}),(0,Q.jsx)(_,{marginTop:1,children:(0,Q.jsxs)(y,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(v,{url:`https://code.workmate.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(S(),1),w(),_e(),ye(),i(),r(),M(),oe(),ue(),Q=E(),$=async e=>(c(),await l(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as n,Qu as r,ct as i,lt as a,st as o,ut as s}from"./loadAgentsDir-DnsldjYU.js";import{I as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({onDone:e}){let t=a(),n=o(),i=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(l,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(l,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function u(n){s(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function d(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(c,{flexDirection:`column`,children:[(0,h.jsxs)(c,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(l,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(l,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(r,{defaultValue:n,options:i,onChange:u,onCancel:d,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(u(),1),d(),n(),i(),h=f(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=a(),n=t.find(e=>e.slug===r);if(!n){e(`Unknown mode: "${r}"\n\nAvailable modes:\n${t.map(e=>`${e.icon} ${e.slug} — ${e.description}`).join(`
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as n,Qu as r,ct as i,lt as a,st as o,ut as s}from"./loadAgentsDir-DaNpxaO-.js";import{I as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({onDone:e}){let t=a(),n=o(),i=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(l,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(l,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function u(n){s(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function d(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(c,{flexDirection:`column`,children:[(0,h.jsxs)(c,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(l,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(l,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(r,{defaultValue:n,options:i,onChange:u,onCancel:d,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(u(),1),d(),n(),i(),h=f(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=a(),n=t.find(e=>e.slug===r);if(!n){e(`Unknown mode: "${r}"\n\nAvailable modes:\n${t.map(e=>`${e.icon} ${e.slug} — ${e.description}`).join(`
2
2
  `)}`,{display:`system`});return}s(r),e(`${n.icon} Mode switched to: ${n.name} (${n.slug}) — ${n.description}`,{display:`system`});return}return(0,h.jsx)(p,{onDone:e})}}))();export{g as call};
@@ -0,0 +1 @@
1
+ import{_ as e,u as t}from"./model-Do0f476p.js";e();export{t as getMainLoopModel};