@readmagic/workmate 0.0.10 → 0.0.11
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.
- package/dist/chunks/{AddWorkspaceDirectory-Vmmm7p1c.js → AddWorkspaceDirectory-ag2JTpmU.js} +1 -1
- package/dist/chunks/App-BuKmqFPm.js +1 -0
- package/dist/chunks/ApproveApiKey-CIWOi_7v.js +1 -0
- package/dist/chunks/ApproveApiKey-M6U-NafA.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-CLSACUmo.js → BypassPermissionsModeDialog-B05t83wa.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BqNxQOXJ.js → ClaudeMdExternalIncludesDialog-CSywJdVL.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +1 -0
- package/dist/chunks/{DiffDialog-9AYwtupw.js → DiffDialog-DUbFrzKu.js} +2 -2
- package/dist/chunks/Doctor-BcnUfJ4I.js +1 -0
- package/dist/chunks/Doctor-Dz4TuYas.js +3 -0
- package/dist/chunks/ExitFlow-BwyAtIHx.js +2 -0
- package/dist/chunks/{Grove-B9-hhkZA.js → Grove-BDoVj02t.js} +2 -2
- package/dist/chunks/{HybridTransport-MxJ_W_np.js → HybridTransport-C_U0IJfz.js} +4 -4
- package/dist/chunks/InvalidConfigDialog-bih293Xt.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-YyQcHocx.js → InvalidSettingsDialog-Br8kQOHz.js} +1 -1
- package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +1 -0
- package/dist/chunks/MCPToolListView-DJ06N1DG.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BCpfHaBK.js → McpParsingWarnings-COa71S9q.js} +1 -1
- package/dist/chunks/MessageSelector-o4ULADFg.js +3 -0
- package/dist/chunks/Messages-qqwHuAW5.js +11 -0
- package/dist/chunks/{Onboarding-ClwHS5rh.js → Onboarding-BzuQjney.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-BSA9NrZc.js → PromptInputFooterSuggestions-to5eYBvI.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-Bb4KdIX_.js → PromptInputHelpMenu-CfMFx-TF.js} +1 -1
- package/dist/chunks/QueryEngine-Dt0BKUeF.js +1 -0
- package/dist/chunks/REPL-CUbEDqEl.js +133 -0
- package/dist/chunks/REPL-DMaKNhTa.js +1 -0
- package/dist/chunks/{RemoteSessionManager-CS6mywIn.js → RemoteSessionManager-Bf44A0Ol.js} +2 -2
- package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +1 -0
- package/dist/chunks/{SSETransport-CoxQ8YpH.js → SSETransport-DN4tCDEh.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +1 -0
- package/dist/chunks/Settings-DfdcmvOV.js +2 -0
- package/dist/chunks/{TeleportProgress-Doucj-50.js → TeleportProgress-C2LQVLav.js} +1 -1
- package/dist/chunks/TeleportRepoMismatchDialog-BZL8Zblz.js +1 -0
- package/dist/chunks/{TeleportResumeWrapper-D6kpr2c6.js → TeleportResumeWrapper-wPiIs8xg.js} +1 -1
- package/dist/chunks/{ThemePicker-DrC8tlp0.js → ThemePicker-BT_NaRQC.js} +1 -1
- package/dist/chunks/{TrustDialog-Fk4m_Sy4.js → TrustDialog-ACaJ_m7A.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-D_OUa4RT.js → ValidationErrorsList-C-hWdy_8.js} +1 -1
- package/dist/chunks/{WelcomeV2-DvfQHnZY.js → WelcomeV2-ZQRKlcT4.js} +1 -1
- package/dist/chunks/add-dir-SAKTkw0S.js +1 -0
- package/dist/chunks/{agentDisplay-B755vMZE.js → agentDisplay-CuSHqgZc.js} +1 -1
- package/dist/chunks/{agents-CIvP8l0s.js → agents-CMC0iQP4.js} +1 -1
- package/dist/chunks/agents-ZgRKpjHv.js +103 -0
- package/dist/chunks/allErrors-_cOQksHC.js +1 -0
- package/dist/chunks/{api-nSHc_GIQ.js → api-BbJfMXRS.js} +1 -1
- package/dist/chunks/api-DS1MiW01.js +1 -0
- package/dist/chunks/{auth-5QB6tsfB.js → auth-7mJGtlZp.js} +2 -2
- package/dist/chunks/auth-DGZzCbU0.js +1 -0
- package/dist/chunks/auth-DN1MUpB8.js +1 -0
- package/dist/chunks/{autoMode-BnUiK9Cu.js → autoMode-CBtY7ACs.js} +6 -6
- package/dist/chunks/{autonomy-Src6sKCp.js → autonomy-DuQmYhq6.js} +9 -9
- package/dist/chunks/{autonomy-C1aSgWPQ.js → autonomy-lJV7yWUl.js} +1 -1
- package/dist/chunks/autonomyPanel-DAQm6lDz.js +1 -0
- package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +1 -0
- package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +17 -0
- package/dist/chunks/{banner-D0P7wXdw.js → banner-1Wyeyawe.js} +1 -1
- package/dist/chunks/{bg-DAPORXF3.js → bg-CJ0YWFli.js} +2 -2
- package/dist/chunks/bg-CeUrRz_7.js +1 -0
- package/dist/chunks/{branch-DFWa4Oxo.js → branch-k3kirqbA.js} +2 -2
- package/dist/chunks/{break-cache-Chj9i9MP.js → break-cache-CAoZ9b72.js} +1 -1
- package/dist/chunks/bridgeConfig-CzRUPn-D.js +1 -0
- package/dist/chunks/{bridgeConfig-Bb6URf4Q.js → bridgeConfig-UgaUfuP6.js} +1 -1
- package/dist/chunks/{bridgeMessaging-C3huGcR3.js → bridgeMessaging-Ci5H68MX.js} +1 -1
- package/dist/chunks/{bridgePointer-DLYyvRKb.js → bridgePointer-BL8-lGvN.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-DFMftajD.js → bridgeStatusUtil-C36w15ge.js} +1 -1
- package/dist/chunks/btw-nVoVuIae.js +1 -0
- package/dist/chunks/caches-B8sM3Zys.js +1 -0
- package/dist/chunks/caches-Bp9MZ7IE.js +1 -0
- package/dist/chunks/{capacityWake-amzeeBz0.js → capacityWake-BOySRJUJ.js} +1 -1
- package/dist/chunks/ccrClient-Br4LAofR.js +1 -0
- package/dist/chunks/{claudeDesktop-CsJfF1b-.js → claudeDesktop-Bgds1-YT.js} +1 -1
- package/dist/chunks/{clear-ClFDpWVJ.js → clear-C4Vtnbye.js} +1 -1
- package/dist/chunks/{cliLaunch-BWcoyZDP.js → cliLaunch-BTpfAGGI.js} +1 -1
- package/dist/chunks/{client-DFlE4fYh.js → client-B9404qIP.js} +1 -1
- package/dist/chunks/client-BCAbKdNz.js +1 -0
- package/dist/chunks/client-CJE6gEvU.js +1 -0
- package/dist/chunks/commands-DL-BzoMQ.js +1 -0
- package/dist/chunks/compact-Cx7BPXLU.js +2 -0
- package/dist/chunks/config-S5OW4Xqr.js +1 -0
- package/dist/chunks/{config-Do1870_d.js → config-aRiTrtCv.js} +2 -2
- package/dist/chunks/{config-CVHMRMwd.js → config-kB2eazPX.js} +1 -1
- package/dist/chunks/context-BN7DEjoH.js +1 -0
- package/dist/chunks/{context-noninteractive-D5iQhasu.js → context-noninteractive-D91W2B8e.js} +5 -5
- package/dist/chunks/context-noninteractive-DPacEFJ1.js +1 -0
- package/dist/chunks/conversation-D5Nbu9eT.js +1 -0
- package/dist/chunks/conversation-hcUx9e-C.js +1 -0
- package/dist/chunks/{createSSHSession-CJtzNQdZ.js → createSSHSession-DecOR6M5.js} +6 -6
- package/dist/chunks/createSession-D27zvmOs.js +1 -0
- package/dist/chunks/createSession-DRqkLZWt.js +1 -0
- package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +40 -0
- package/dist/chunks/{datadog-DjeJThpV.js → datadog-bm551AVV.js} +1 -1
- package/dist/chunks/debug-BecbSVoN.js +39 -0
- package/dist/chunks/{debugUtils-DX0KAXNK.js → debugUtils-CmJfIUxW.js} +1 -1
- package/dist/chunks/{detached-X_yjYR7x.js → detached-CIyF0M5O.js} +1 -1
- package/dist/chunks/detectRepository-C15umvKN.js +1 -0
- package/dist/chunks/detectRepository-DDfLfKcM.js +1 -0
- package/dist/chunks/{diff-jEJJe58I.js → diff-DeK4bwjw.js} +1 -1
- package/dist/chunks/{directoryCompletion-BbXR2bfy.js → directoryCompletion-BJCu19HJ.js} +1 -1
- package/dist/chunks/doctor-BJORBomU.js +1 -0
- package/dist/chunks/{entry-oIqjxIjQ.js → entry-mdegyj8z.js} +3 -3
- package/dist/chunks/{esm-Cf4nSRjF.js → esm-Ka3lhafK.js} +1 -1
- package/dist/chunks/{execFileNoThrow-Dwu6psHW.js → execFileNoThrow-DHyW8FMX.js} +2 -2
- package/dist/chunks/execSyncWrapper-CDzB0BM1.js +1 -0
- package/dist/chunks/exit-CF3KBl-S.js +1 -0
- package/dist/chunks/{extraUsage-Mi66JwFZ.js → extraUsage-BrKbpBK-.js} +1 -1
- package/dist/chunks/extractMemories-4lBn134y.js +1 -0
- package/dist/chunks/fast-0Vi354KI.js +1 -0
- package/dist/chunks/{fast-BU4iUZ8E.js → fast-DWn40OcQ.js} +1 -1
- package/dist/chunks/{fileSuggestions-BMfQIDdW.js → fileSuggestions-C7Pwq2yj.js} +3 -3
- package/dist/chunks/{firstPartyEventLogger-B3cXgR67.js → firstPartyEventLogger-BHjBQH0J.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +1 -0
- package/dist/chunks/{flushGate-DgSDVGKZ.js → flushGate-DdJjxCes.js} +1 -1
- package/dist/chunks/gemini-DHv2iVfy.js +1 -0
- package/dist/chunks/generateSessionName-DhS_6oHd.js +1 -0
- package/dist/chunks/{genericProcessUtils-CmsUPyRz.js → genericProcessUtils-B2HcDYhg.js} +1 -1
- package/dist/chunks/git-DBlOv64X.js +6 -0
- package/dist/chunks/git-DF4RFFaT.js +1 -0
- package/dist/chunks/githubRepoPathMapping-CK56bUDe.js +1 -0
- package/dist/chunks/{goal-ZmSRBx4q.js → goal-BZG4gtnb.js} +3 -3
- package/dist/chunks/{grok-BXMvezWb.js → grok-BS57ZhyW.js} +1 -1
- package/dist/chunks/{grove-CeOjTaY6.js → grove-_zlQ83yR.js} +2 -2
- package/dist/chunks/{help-5DNZO6_H.js → help-C_2tdXHC.js} +1 -1
- package/dist/chunks/{hooks-C637tFtd.js → hooks-C7Bn7MBe.js} +2 -2
- package/dist/chunks/hooks-DT80Arzc.js +1 -0
- package/dist/chunks/{initReplBridge-D1h10vQ9.js → initReplBridge-NkZRcM77.js} +1 -1
- package/dist/chunks/{install-C-6ItpH0.js → install-Du-DSVzj.js} +1 -1
- package/dist/chunks/{instrumentation-DaiPDUst.js → instrumentation-DMs3b82f.js} +5 -5
- package/dist/chunks/{job-BeYzQUiR.js → job-rbX1VZmp.js} +1 -1
- package/dist/chunks/jwtUtils-OzxN2zts.js +1 -0
- package/dist/chunks/keybindings-CwdC_8S0.js +2 -0
- package/dist/chunks/{launchLocalMemory-CE4J98xO.js → launchLocalMemory-BLRCK1_o.js} +2 -2
- package/dist/chunks/{launchOnboarding-BfTdC6vp.js → launchOnboarding-Al_X75Vz.js} +1 -1
- package/dist/chunks/{loadAgentsDir-C7lOqvfh.js → loadAgentsDir-BL93ulMm.js} +619 -619
- package/dist/chunks/loadAgentsDir-eVKq8efm.js +1 -0
- package/dist/chunks/loadPluginHooks-B0au35a4.js +1 -0
- package/dist/chunks/{localSearch-BKrznW5x.js → localSearch-C5ipegd9.js} +1 -1
- package/dist/chunks/localSearch-CZlFfR_X.js +1 -0
- package/dist/chunks/{log-CezCRpAN.js → log-Dauqle-Z.js} +1 -1
- package/dist/chunks/{logoV2Utils-BkQfyQ1-.js → logoV2Utils-CkvOihX7.js} +1 -1
- package/dist/chunks/{magicDocs-BpVcON9o.js → magicDocs-DLav5QK0.js} +3 -3
- package/dist/chunks/main-CVNWNAoh.js +513 -0
- package/dist/chunks/{main-CvOv59-7.js → main-LMyE3jXY.js} +2 -2
- package/dist/chunks/managedEnv-CYepSnm8.js +1 -0
- package/dist/chunks/{managedEnv-DhWRJ5DK.js → managedEnv-DJSCuqCb.js} +1 -1
- package/dist/chunks/{mappers-bOab8ipV.js → mappers-DQxMcezy.js} +1 -1
- package/dist/chunks/mcp-BAbbEaBA.js +1 -0
- package/dist/chunks/mcp-Ct4Sum6A.js +6 -0
- package/dist/chunks/{mcp-VcGPYCkW.js → mcp-D5HkCqUh.js} +2 -2
- package/dist/chunks/{memoize-DsqYrbeR.js → memoize-FeyE7JEh.js} +1 -1
- package/dist/chunks/memory-COa7aUbx.js +1 -0
- package/dist/chunks/{mode-DlKnUM8l.js → mode-Bl2RZC8M.js} +2 -2
- package/dist/chunks/model-B7rtZ7KV.js +1 -0
- package/dist/chunks/{model-BsZ4sP_H.js → model-Bgh_r4lg.js} +1 -1
- package/dist/chunks/model-DiuEAv6h.js +1 -0
- package/dist/chunks/{modelOptions-CxP067Qv.js → modelOptions-BtEZe5BB.js} +1 -1
- package/dist/chunks/nativeInstaller-BEwayifa.js +1 -0
- package/dist/chunks/omit--yH_T4rf.js +1 -0
- package/dist/chunks/onChangeAppState-ZdwI7boX.js +1 -0
- package/dist/chunks/{openai-B9C2XN5Q.js → openai-DWs4D-nQ.js} +3 -3
- package/dist/chunks/panel-CoNfXy3K.js +1 -0
- package/dist/chunks/{parser-BwPXQomy.js → parser-BH4u7QiV.js} +1 -1
- package/dist/chunks/parser-BMIaRErw.js +1 -0
- package/dist/chunks/{partition-D-UhsUCx.js → partition-DLcW5Oo_.js} +1 -1
- package/dist/chunks/permissions-CaucYK3s.js +3 -0
- package/dist/chunks/pidLock-DgOBc1Xo.js +3 -0
- package/dist/chunks/{plan-CyU2zrCK.js → plan-BNYDTnQd.js} +1 -1
- package/dist/chunks/{platform-BMPbglug.js → platform-B0uTQc9P.js} +1 -1
- package/dist/chunks/plugin-BN-of1_H.js +17 -0
- package/dist/chunks/pluginAutoupdate-BBU9Jn4p.js +1 -0
- package/dist/chunks/pluginBlocklist-DXQlbG0P.js +1 -0
- package/dist/chunks/pluginCliCommands-CfdVNs8D.js +1 -0
- package/dist/chunks/pluginFlagging-DcJ_FQuv.js +1 -0
- package/dist/chunks/pluginOperations-DnhzFbYI.js +2 -0
- package/dist/chunks/pluginStartupCheck-CKBFaMFr.js +1 -0
- package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +1 -0
- package/dist/chunks/plugins-CBW7kPyp.js +4 -0
- package/dist/chunks/{poorMode-DEwQOAJt.js → poorMode-B_xEvuEV.js} +1 -1
- package/dist/chunks/poorMode-yH1o41cQ.js +1 -0
- package/dist/chunks/{print-eCRv_Li-.js → print-BZOx09SU.js} +16 -16
- package/dist/chunks/processBashCommand-dcCNCiBp.js +1 -0
- package/dist/chunks/processSlashCommand-YDiM63Qr.js +5 -0
- package/dist/chunks/prompt-CXGy0llt.js +1 -0
- package/dist/chunks/prompt-DovNDmcx.js +1 -0
- package/dist/chunks/{prompt-M2lu8_Oa.js → prompt-Dx7IWhBt.js} +2 -2
- package/dist/chunks/{promptEditor-DhcZY-iu.js → promptEditor-WCkmpejM.js} +2 -2
- package/dist/chunks/{protocolHandler-CkFaJKKo.js → protocolHandler-BiVWrpHi.js} +4 -4
- package/dist/chunks/{proxy-CuMaO_YV.js → proxy-CVn7o19p.js} +3 -3
- package/dist/chunks/reconciler-C2Nd_e4n.js +1 -0
- package/dist/chunks/refresh-B84H2Ezd.js +1 -0
- package/dist/chunks/{registerProtocol-CsNYRZKr.js → registerProtocol-E0Iu5hEx.js} +2 -2
- package/dist/chunks/{reload-plugins-B7JAE3b4.js → reload-plugins-D-3AUT9g.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-CFLJhsB6.js → remoteBridgeCore-CV6we3ZA.js} +1 -1
- package/dist/chunks/remoteManagedSettings-D26Q09-7.js +1 -0
- package/dist/chunks/{rename-BCp2Vtqu.js → rename-CSavuBIE.js} +1 -1
- package/dist/chunks/{renderOptions-Q5oCLFIC.js → renderOptions-DDLbSMQU.js} +1 -1
- package/dist/chunks/resume-CROylN3J.js +2 -0
- package/dist/chunks/ripgrep-2M1GkXqJ.js +1 -0
- package/dist/chunks/{ripgrep-DvOOsDMv.js → ripgrep-C1ydIMzT.js} +5 -5
- package/dist/chunks/{runtimeObserver-CS_3BDNo.js → runtimeObserver-L7pSIWBT.js} +2 -2
- package/dist/chunks/{runtimeObserver-DYUva6g-.js → runtimeObserver-OU8KrZQG.js} +1 -1
- package/dist/chunks/sandbox-adapter-6UwMLh6e.js +1 -0
- package/dist/chunks/{sandbox-toggle--zNSKce_.js → sandbox-toggle-YrQNWGsr.js} +1 -1
- package/dist/chunks/searchExtraTools-Bdv5HJ74.js +1 -0
- package/dist/chunks/{session-CO3gEqQP.js → session-DUYsfPy_.js} +2 -2
- package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +1 -0
- package/dist/chunks/sessionObserver-B0zucj_c.js +1 -0
- package/dist/chunks/{sessionObserver-YkRHC-Aa.js → sessionObserver-Dv3Ba8eA.js} +2 -2
- package/dist/chunks/{sessionState-Bifmu95-.js → sessionState-D-SaBzWD.js} +2 -2
- package/dist/chunks/sessionStorage-BM1x51Z7.js +1 -0
- package/dist/chunks/{sessionTitle-COBSgSXS.js → sessionTitle-uCuYaNif.js} +2 -2
- package/dist/chunks/{sessionTracing-BrNx1k2V.js → sessionTracing-Bqb3vJTt.js} +3 -3
- package/dist/chunks/settings-BG15IFYx.js +1 -0
- package/dist/chunks/settings-D4CpDv2y.js +20 -0
- package/dist/chunks/settingsSync-BSrpnyqo.js +1 -0
- package/dist/chunks/setup-C62oq4AZ.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DEaw-X5j.js → shadowedRuleDetection-BzAZ57p2.js} +1 -1
- package/dist/chunks/{shellQuote-BYeOv3Ip.js → shellQuote-DS6WrivY.js} +2 -2
- package/dist/chunks/{sideQuestion-D0OKljee.js → sideQuestion-CvMBBjI8.js} +2 -2
- package/dist/chunks/sinks-WJ7nzLQs.js +1 -0
- package/dist/chunks/sinks-f7qYjbKJ.js +2 -0
- package/dist/chunks/skillChangeDetector-U5kRU5nd.js +1 -0
- package/dist/chunks/{skillGapStore-N_kmvXML.js → skillGapStore-CqaT8c0C.js} +2 -2
- package/dist/chunks/{skillLifecycle-C4F5RXuh.js → skillLifecycle-CnR8IqJM.js} +2 -2
- package/dist/chunks/skillSearchPanel-D9qrOXpI.js +21 -0
- package/dist/chunks/{skills-C4CTRN9o.js → skills-BgcFh0vy.js} +1 -1
- package/dist/chunks/startupProfiler-B4HBBbHN.js +1 -0
- package/dist/chunks/{startupProfiler-L_UWZ03w.js → startupProfiler-CmH_aVy2.js} +2 -2
- package/dist/chunks/{stats-IzV0_vEc.js → stats-B8uQ-UDi.js} +1 -1
- package/dist/chunks/{status-CeVP_uDT.js → status-BekdWoIj.js} +1 -1
- package/dist/chunks/status-D6KlRJmR.js +2 -0
- package/dist/chunks/{statusNoticeHelpers-Bb9gxdSt.js → statusNoticeHelpers-BMM8_uJ1.js} +1 -1
- package/dist/chunks/{stringUtils-C84IJ91d.js → stringUtils-C8PaYpQF.js} +1 -1
- package/dist/chunks/switcher-Ck9CrXrr.js +1 -0
- package/dist/chunks/{switcher-CCs9xl1z.js → switcher-DnAhkyIn.js} +1 -1
- package/dist/chunks/syncCache-ClP9aBqK.js +1 -0
- package/dist/chunks/{tasks-DZDhgx0w.js → tasks-Dmh6qikm.js} +1 -1
- package/dist/chunks/teleport-DH3IuAUQ.js +1 -0
- package/dist/chunks/{templateJobs-CrNPEKkh.js → templateJobs-CxqU-s5i.js} +1 -1
- package/dist/chunks/{terminalSetup-CBqcwQll.js → terminalSetup-BKGcmlWp.js} +1 -1
- package/dist/chunks/{terminalSetup-D-N8YPiQ.js → terminalSetup-Cy19F1Js.js} +4 -4
- package/dist/chunks/{theme-Dazsirbw.js → theme-U7lMFHQ0.js} +1 -1
- package/dist/chunks/{tmux-DewYVEBm.js → tmux-D5EvHWi3.js} +1 -1
- package/dist/chunks/{toolEventObserver-lnHJ9fLQ.js → toolEventObserver-D9qjoVl5.js} +1 -1
- package/dist/chunks/toolPool-69mfSPAs.js +1 -0
- package/dist/chunks/trustedDevice-B6AKlsl_.js +1 -0
- package/dist/chunks/trustedDevice-DL0pWP4_.js +1 -0
- package/dist/chunks/{types-3j8PS-Du.js → types-DafcFtmb.js} +2 -2
- package/dist/chunks/udsClient-CWnfsgFP.js +1 -0
- package/dist/chunks/{updateCCB-BPe9_FW6.js → updateCCB-C6XftzIG.js} +6 -6
- package/dist/chunks/{upstreamproxy-DF00RzGG.js → upstreamproxy-CXmjxHpl.js} +2 -2
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js → useExitOnCtrlCDWithKeybindings-DEEJhm_W.js} +1 -1
- package/dist/chunks/useMainLoopModel-6w7mhwhU.js +1 -0
- package/dist/chunks/useManagePlugins-CjnsO-Of.js +1 -0
- package/dist/chunks/{useMergedTools-Dk5cPqLc.js → useMergedTools-DbhqKk1-.js} +1 -1
- package/dist/chunks/{useSearchInput-C7Y1I9P9.js → useSearchInput-gUDbkLaC.js} +1 -1
- package/dist/chunks/{useSettingsErrors-DAEO7AyB.js → useSettingsErrors-CgPad-H0.js} +1 -1
- package/dist/chunks/{userAgent-CIq27vUR.js → userAgent-CU7Ndh79.js} +1 -1
- package/dist/chunks/util-B4oMhJKh.js +1 -0
- package/dist/chunks/validatePlugin-y_O_tCEL.js +1 -0
- package/dist/chunks/{vim-EYQn94Kx.js → vim-w37BfGZ5.js} +1 -1
- package/dist/chunks/{which-DzFN5TNM.js → which-BRWBO7Gu.js} +1 -1
- package/dist/chunks/windowsPaths-BY-IVNwQ.js +1 -0
- package/dist/chunks/windowsPaths-DtWHLjmE.js +1 -0
- package/dist/chunks/{workSecret-DUqdPy44.js → workSecret-BEhXgH2M.js} +1 -1
- package/dist/chunks/{workerRegistry-C07BcZIw.js → workerRegistry-Bq9bS5pw.js} +5 -5
- package/dist/chunks/worktree-4SUJ4dtz.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -3
- package/dist/chunks/App-C2yQjBgY.js +0 -1
- package/dist/chunks/ApproveApiKey-CKbv5C1x.js +0 -1
- package/dist/chunks/ApproveApiKey-MscC-ssL.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CL5NWsFL.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-C0-psohX.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-4mOvEer_.js +0 -1
- package/dist/chunks/Doctor-DmgAwce2.js +0 -1
- package/dist/chunks/Doctor-jEs9chPk.js +0 -3
- package/dist/chunks/ExitFlow-DVKxFdpX.js +0 -2
- package/dist/chunks/InvalidConfigDialog-o9DF1REI.js +0 -1
- package/dist/chunks/MCPConnectionManager-CUTuaa8T.js +0 -1
- package/dist/chunks/MCPToolListView-CvqB4nCw.js +0 -1
- package/dist/chunks/MessageSelector-BLzw172f.js +0 -3
- package/dist/chunks/Messages-4K5sLmNh.js +0 -11
- package/dist/chunks/QueryEngine-DPHLSsax.js +0 -1
- package/dist/chunks/REPL-Bf46iQCN.js +0 -1
- package/dist/chunks/REPL-DIaAo9M9.js +0 -133
- package/dist/chunks/ResumeConversation-Br2KsBoe.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-i_YO3QvV.js +0 -1
- package/dist/chunks/Settings-BMXysXIx.js +0 -2
- package/dist/chunks/TeleportRepoMismatchDialog-B5I73j7Y.js +0 -1
- package/dist/chunks/add-dir-CZ6Clvq8.js +0 -1
- package/dist/chunks/agents-DHnNg4h6.js +0 -103
- package/dist/chunks/allErrors-CU89tF-z.js +0 -1
- package/dist/chunks/api-BSeE6MwB.js +0 -1
- package/dist/chunks/auth-BIGJth5U.js +0 -1
- package/dist/chunks/auth-CDQMhIZP.js +0 -1
- package/dist/chunks/autonomyPanel-DnHpuiy4.js +0 -1
- package/dist/chunks/backgroundHousekeeping-B-cw0UcS.js +0 -17
- package/dist/chunks/backgroundHousekeeping-BS_8z3_x.js +0 -1
- package/dist/chunks/bg-50rllUNh.js +0 -1
- package/dist/chunks/bridgeConfig-BeqChxJC.js +0 -1
- package/dist/chunks/btw-DSK9R2C8.js +0 -1
- package/dist/chunks/caches-BTQAW9zc.js +0 -1
- package/dist/chunks/caches-BVtSCnV1.js +0 -1
- package/dist/chunks/ccrClient-Bu7Tf1Z5.js +0 -1
- package/dist/chunks/client-BWQ4-rN7.js +0 -1
- package/dist/chunks/client-c-3-PW1F.js +0 -1
- package/dist/chunks/commands-Bi7k3Wg-.js +0 -1
- package/dist/chunks/compact-J-h0Yf4b.js +0 -2
- package/dist/chunks/config-yyFe87vW.js +0 -1
- package/dist/chunks/context-Tb1Ca2Q-.js +0 -1
- package/dist/chunks/context-noninteractive-soPYKAc9.js +0 -1
- package/dist/chunks/conversation-CSEtUxOY.js +0 -1
- package/dist/chunks/conversation-Dk1WDQuN.js +0 -1
- package/dist/chunks/createSession-DkT1GL8y.js +0 -1
- package/dist/chunks/createSession-eE8mswkv.js +0 -1
- package/dist/chunks/crossProjectResume-04n3Ppy9.js +0 -40
- package/dist/chunks/debug-RAynG_nM.js +0 -39
- package/dist/chunks/detectRepository-DgpNd87p.js +0 -1
- package/dist/chunks/detectRepository-ctF9KDbb.js +0 -1
- package/dist/chunks/doctor-B-Wag4C1.js +0 -1
- package/dist/chunks/execSyncWrapper-BTZJjCuv.js +0 -1
- package/dist/chunks/exit-BtW7LfRX.js +0 -1
- package/dist/chunks/extractMemories-CUrdiNcr.js +0 -1
- package/dist/chunks/fast-C60p6AqJ.js +0 -1
- package/dist/chunks/firstPartyEventLogger-BfCYN7lt.js +0 -1
- package/dist/chunks/gemini-BwvSxGgn.js +0 -1
- package/dist/chunks/generateSessionName-DlrdedOk.js +0 -1
- package/dist/chunks/git-2c7WlGDL.js +0 -6
- package/dist/chunks/git-XtKbtJMc.js +0 -1
- package/dist/chunks/githubRepoPathMapping-DbWG4hFQ.js +0 -1
- package/dist/chunks/hooks-DWg07LmS.js +0 -1
- package/dist/chunks/jwtUtils-CUPXdX3W.js +0 -1
- package/dist/chunks/keybindings-DgIPdBy9.js +0 -2
- package/dist/chunks/loadAgentsDir-zikjxLvn.js +0 -1
- package/dist/chunks/loadPluginHooks-Cp8MSwAc.js +0 -1
- package/dist/chunks/localSearch-ZFyFy5FN.js +0 -1
- package/dist/chunks/main-9r5gLzUW.js +0 -605
- package/dist/chunks/managedEnv-B61yLpwp.js +0 -1
- package/dist/chunks/mcp-BckPBjaM.js +0 -6
- package/dist/chunks/mcp-CS1DA3JL.js +0 -1
- package/dist/chunks/memory-C5ohwh-T.js +0 -1
- package/dist/chunks/model-BGu1AGq0.js +0 -1
- package/dist/chunks/model-D19IIcll.js +0 -1
- package/dist/chunks/nativeInstaller-QB8cEJ18.js +0 -1
- package/dist/chunks/omit-DDUIPHnl.js +0 -1
- package/dist/chunks/onChangeAppState-RBl6H7ho.js +0 -1
- package/dist/chunks/panel-KW-wmEvU.js +0 -1
- package/dist/chunks/parser-xSBaQRLH.js +0 -1
- package/dist/chunks/permissions-BoLXYN1j.js +0 -3
- package/dist/chunks/pidLock-nJHbufJN.js +0 -3
- package/dist/chunks/plugin-C6-GQke5.js +0 -17
- package/dist/chunks/pluginAutoupdate-SlRFJlTT.js +0 -1
- package/dist/chunks/pluginBlocklist-n6Imlh3y.js +0 -1
- package/dist/chunks/pluginCliCommands-Bd96zSOQ.js +0 -1
- package/dist/chunks/pluginFlagging-DZaYzecY.js +0 -1
- package/dist/chunks/pluginOperations-D90IRawu.js +0 -2
- package/dist/chunks/pluginStartupCheck-Bxkxpm4k.js +0 -1
- package/dist/chunks/pluginStartupCheck-CB2q2dLv.js +0 -1
- package/dist/chunks/plugins-B9eSjLSA.js +0 -4
- package/dist/chunks/poorMode-BAnubpn1.js +0 -1
- package/dist/chunks/processBashCommand-B5F2Cl7K.js +0 -1
- package/dist/chunks/processSlashCommand-BC_D3cH5.js +0 -5
- package/dist/chunks/prompt-C1JPqinc.js +0 -1
- package/dist/chunks/prompt-DZhBz_Vu.js +0 -1
- package/dist/chunks/reconciler-B4GDm_iC.js +0 -1
- package/dist/chunks/refresh-DBVizOzg.js +0 -1
- package/dist/chunks/remoteManagedSettings-xh_MViZH.js +0 -1
- package/dist/chunks/resume-DVCSzKvv.js +0 -2
- package/dist/chunks/ripgrep-e-iewvTf.js +0 -1
- package/dist/chunks/sandbox-adapter-BFZFHplu.js +0 -1
- package/dist/chunks/searchExtraTools-ui5y2VSE.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-CZvCqQJ6.js +0 -1
- package/dist/chunks/sessionObserver-Ba7um95p.js +0 -1
- package/dist/chunks/sessionStorage-CedwLLQs.js +0 -1
- package/dist/chunks/settings-DkDH7WQT.js +0 -1
- package/dist/chunks/settings-DnptdP79.js +0 -20
- package/dist/chunks/settingsSync-PmU7SmkU.js +0 -1
- package/dist/chunks/setup-BEsBuzsk.js +0 -3
- package/dist/chunks/sinks-BJHgxz6Y.js +0 -1
- package/dist/chunks/sinks-D5-yhcgU.js +0 -2
- package/dist/chunks/skillChangeDetector-Dd0WPdkO.js +0 -1
- package/dist/chunks/skillSearchPanel-CftorvAM.js +0 -21
- package/dist/chunks/startupProfiler-D4FBdEQr.js +0 -1
- package/dist/chunks/status-Dzuw3hBv.js +0 -2
- package/dist/chunks/switcher-4KzBvuKH.js +0 -1
- package/dist/chunks/syncCache-CBRiRU5x.js +0 -1
- package/dist/chunks/teleport-Bw0jSxe9.js +0 -1
- package/dist/chunks/toolPool-CkXFlqsn.js +0 -1
- package/dist/chunks/trustedDevice-CFf5yaG-.js +0 -1
- package/dist/chunks/trustedDevice-CuwSv8dG.js +0 -1
- package/dist/chunks/udsClient-e9dIkwVA.js +0 -1
- package/dist/chunks/useMainLoopModel-2-eujv0n.js +0 -1
- package/dist/chunks/useManagePlugins-CYBIkaB1.js +0 -1
- package/dist/chunks/util-VO98TdOz.js +0 -1
- package/dist/chunks/validatePlugin-Kk6pxnO2.js +0 -1
- package/dist/chunks/windowsPaths-BU3yQWTB.js +0 -1
- package/dist/chunks/windowsPaths-DgZ3YY4a.js +0 -1
- package/dist/chunks/worktree-dFUkhVE_.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./cliLaunch-
|
|
1
|
+
import{i as e,o as t,t as n}from"./cliLaunch-BTpfAGGI.js";import{a as r,i,n as a,r as o,t as s}from"./state-BAGmpVBn.js";import{resolve as c}from"path";e(),s();var l=78,u=2e3,d=12e4,f=2,p=5;async function m(e){let t=e[0]||`status`;switch(t){case`start`:await y(e.slice(1));break;case`stop`:await _();break;case`status`:case`ps`:await g();break;case`bg`:await(await import(`./bg-CeUrRz_7.js`)).handleBgStart(e.slice(1));break;case`attach`:await(await import(`./bg-CeUrRz_7.js`)).attachHandler(e[1]);break;case`logs`:await(await import(`./bg-CeUrRz_7.js`)).logsHandler(e[1]);break;case`kill`:await(await import(`./bg-CeUrRz_7.js`)).killHandler(e[1]);break;case`--help`:case`-h`:case`help`:h();break;default:console.error(`Unknown daemon subcommand: ${t}`),h(),process.exitCode=1}}function h(){console.log(`
|
|
2
2
|
Work Mate Daemon — background process management
|
|
3
3
|
|
|
4
4
|
USAGE
|
|
@@ -26,6 +26,6 @@ OPTIONS (for start)
|
|
|
26
26
|
--name <name> Session name
|
|
27
27
|
-h, --help Show this help
|
|
28
28
|
`)}async function g(){let e=a();switch(console.log(`=== Daemon Supervisor ===`),e.status){case`running`:{let t=e.state;console.log(` Status: running`),console.log(` PID: ${t.pid}`),console.log(` CWD: ${t.cwd}`),console.log(` Started: ${t.startedAt}`),console.log(` Workers: ${t.workerKinds.join(`, `)}`);break}case`stopped`:console.log(` Status: stopped`);break;case`stale`:console.log(` Status: stale (cleaned up)`);break}console.log(`
|
|
29
|
-
=== Background Sessions ===`),await(await import(`./bg-
|
|
29
|
+
=== Background Sessions ===`),await(await import(`./bg-CeUrRz_7.js`)).psHandler([])}async function _(){let e=a();if(e.status===`stopped`){console.log(`daemon is not running`);return}if(e.status===`stale`){console.log(`daemon was stale (cleaned up)`);return}console.log(`stopping daemon (PID: ${e.state.pid})...`),await i()?console.log(`daemon stopped`):console.log(`daemon could not be stopped (may have already exited)`)}function v(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];r===`--dir`&&n+1<e.length?t.dir=c(e[++n]):r.startsWith(`--dir=`)?t.dir=c(r.slice(6)):r===`--spawn-mode`&&n+1<e.length?t.spawnMode=e[++n]:r.startsWith(`--spawn-mode=`)?t.spawnMode=r.slice(13):r===`--capacity`&&n+1<e.length?t.capacity=e[++n]:r.startsWith(`--capacity=`)?t.capacity=r.slice(11):r===`--permission-mode`&&n+1<e.length?t.permissionMode=e[++n]:r.startsWith(`--permission-mode=`)?t.permissionMode=r.slice(18):r===`--sandbox`?t.sandbox=`1`:r===`--name`&&n+1<e.length?t.name=e[++n]:r.startsWith(`--name=`)&&(t.name=r.slice(7))}return t}async function y(e){let t=v(e),n=t.dir||c(`.`);console.log(`[daemon] supervisor starting in ${n}`);let i=[{kind:`remoteControl`,process:null,backoffMs:u,failureCount:0,parked:!1,lastStartTime:0,restartTimer:null}];r({pid:process.pid,cwd:n,startedAt:new Date().toISOString(),workerKinds:i.map(e=>e.kind),lastStatus:`running`});let a=new AbortController,s=()=>{console.log(`[daemon] supervisor shutting down...`),a.abort(),o();for(let e of i)e.restartTimer&&(clearTimeout(e.restartTimer),e.restartTimer=null),e.process&&!e.process.killed&&e.process.kill(`SIGTERM`)};process.on(`SIGTERM`,s),process.on(`SIGINT`,s);for(let e of i)a.signal.aborted||b(e,n,t,a.signal);await new Promise(e=>{if(a.signal.aborted){e();return}a.signal.addEventListener(`abort`,()=>e(),{once:!0})}),await Promise.all(i.filter(e=>e.process&&e.process.exitCode===null).map(e=>new Promise(t=>{if(!e.process||e.process.exitCode!==null){t();return}let n=null;e.process.on(`exit`,()=>{n&&(clearTimeout(n),n=null),t()}),n=setTimeout(()=>{e.process&&e.process.exitCode===null&&e.process.kill(`SIGKILL`),t()},3e4),n.unref?.()}))),console.log(`[daemon] supervisor stopped`)}function b(e,r,i,a){if(a.aborted||e.parked)return;e.lastStartTime=Date.now();let o={...process.env,DAEMON_WORKER_DIR:r,DAEMON_WORKER_NAME:i.name,DAEMON_WORKER_SPAWN_MODE:i.spawnMode||`same-dir`,DAEMON_WORKER_CAPACITY:i.capacity||`4`,DAEMON_WORKER_PERMISSION:i.permissionMode,DAEMON_WORKER_SANDBOX:i.sandbox||`0`,DAEMON_WORKER_CREATE_SESSION:`1`,CLAUDE_CODE_SESSION_KIND:`daemon-worker`};console.log(`[daemon] spawning worker '${e.kind}'`);let s=t(n([`--daemon-worker=${e.kind}`],{env:o}),{cwd:r,stdio:[`ignore`,`pipe`,`pipe`]});e.process=s,s.stdout?.on(`data`,e=>{let t=e.toString().trimEnd().split(`
|
|
30
30
|
`);for(let e of t)console.log(` ${e}`)}),s.stderr?.on(`data`,e=>{let t=e.toString().trimEnd().split(`
|
|
31
31
|
`);for(let e of t)console.error(` ${e}`)}),s.on(`exit`,(t,n)=>{if(e.process=null,!a.aborted){if(t===l){console.error(`[daemon] worker '${e.kind}' exited with permanent error — parking`),e.parked=!0;return}if(Date.now()-e.lastStartTime<1e4){if(e.failureCount++,e.failureCount>=p){console.error(`[daemon] worker '${e.kind}' failed ${e.failureCount} times rapidly — parking`),e.parked=!0;return}}else e.failureCount=0,e.backoffMs=u;console.log(`[daemon] worker '${e.kind}' exited (code=${t}, signal=${n}), restarting in ${e.backoffMs}ms`),e.restartTimer=setTimeout(()=>{e.restartTimer=null,!a.aborted&&!e.parked&&b(e,r,i,a)},e.backoffMs),e.restartTimer.unref?.(),e.backoffMs=Math.min(e.backoffMs*f,d)}})}export{m as daemonMain};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./managedEnv-DJSCuqCb.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-BDhHQY0-.js";import{c as r,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-BDhHQY0-.js";import{c as r,f as i,g as a,ln as o,un as s}from"./settings-D4CpDv2y.js";import{c,h as l}from"./config-aRiTrtCv.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-CVn7o19p.js";import{n as _,t as v}from"./syncCache-ClP9aBqK.js";import{n as y,r as b,t as x}from"./managedEnvConstants-BPwL2aWI.js";function S(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 C(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))b(t)||(n[t]=r);return n}function w(e){if(!e||!O)return e||{};let t={};for(let[n,r]of Object.entries(e))O.has(n)||(t[n]=r);return t}function T(e){return w(C(S(e)))}function E(){O===void 0&&(O=process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`?new Set(Object.keys(process.env)):null),Object.assign(process.env,T(c().env));for(let e of k)e!==`policySettings`&&s(e)&&Object.assign(process.env,T(r(e)?.env));_(),Object.assign(process.env,T(r(`policySettings`)?.env));let e=T(i()?.env);for(let[t,n]of Object.entries(e))x.has(t.toUpperCase())&&(process.env[t]=n)}function D(){Object.assign(process.env,T(c().env)),Object.assign(process.env,T(i()?.env)),d(),u(),h(),m()}var O,k,A=e((()=>{v(),g(),l(),n(),y(),f(),p(),o(),a(),k=[`userSettings`,`flagSettings`,`policySettings`]}));export{E as n,A as r,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,ME as n,OE as r,_a as i}from"./loadAgentsDir-BL93ulMm.js";import{Kr as a,qr as o}from"./src-P_wYS_NJ2.js";import{Wt as s,pt as c}from"./state-BemZdQIl.js";import{q as l}from"./log-Dauqle-Z.js";import{Yt as u}from"./prompt-Dx7IWhBt.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 n=t.map(e=>{if(e.type!==`tool_use`)return e;if(e.name===`ExitPlanMode`){let t=r();if(t)return{...e,input:{...e.input,plan:t}}}return e});return{...e.message,content:n}}var y=e((()=>{s(),l(),u(),a(),t(),n()}));export{p as a,f as i,y as n,h as o,g as r,_ as s,m as t};
|
|
@@ -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{$u as i,$x as a,Cg as o,Fp as s,GC as c,Iu as l,Jx as u,Pp as d,Pu as f,Sg as p,Tx as m,Vx as h,Xx as g,bx as _,ed as v,wx as y,xg as b,yx as x}from"./loadAgentsDir-BL93ulMm.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,fi as k,j as A,t as j,y as M}from"./src-P_wYS_NJ2.js";import{t as N}from"./jsx-runtime-Bb4Xn-E0.js";import{a as te,i as ne}from"./debug-BecbSVoN.js";import{l as re,n as ie,o as ae}from"./stringUtils-C8PaYpQF.js";import{A as oe,k as se}from"./sessionState-D-SaBzWD.js";import{i as ce,n as P,r as le}from"./MCPConnectionManager-B9n4SXN4.js";import{n as ue,t as de}from"./McpParsingWarnings-COa71S9q.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-DJ06N1DG.js";function ge({agentServer:e,onCancel:t,onComplete:n}){let[i]=C(),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(null),[l,u]=(0,z.useState)(null),p=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>p.current?.abort(),[]),O(`confirm:no`,(0,z.useCallback)(()=>{a&&(p.current?.abort(),p.current=null,o(!1),u(null))},[a]),{context:`Confirmation`,isActive:a});let h=(0,z.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;o(!0),c(null);let t=new AbortController;p.current=t;try{let r={type:e.transport,url:e.url};await m(e.name,r,u,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof x)&&c(e.message)}finally{o(!1),p.current=null}},[e,n]),g=ie(String(e.name));if(a)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)(f,{}),(0,B.jsx)(E,{children:` A browser window will open for authentication`})]}),l&&(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:l})]}),(0,B.jsx)(w,{marginLeft:3,children:(0,B.jsxs)(E,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,B.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let _=[];return e.needsAuth&&_.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),_.push({label:`Back`,value:`back`}),(0,B.jsxs)(M,{title:`${g} 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)(d,{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`,i)(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`,i)(r.tick),` authenticated`]}):(0,B.jsxs)(E,{children:[A(`warning`,i)(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.`})}),s&&(0,B.jsx)(w,{children:(0,B.jsxs)(E,{color:`error`,children:[`Error: `,s]})}),(0,B.jsx)(w,{children:(0,B.jsx)(v,{options:_,onChange:async e=>{switch(e){case`auth`:await h();break;case`back`:t();break}},onCancel:t})})]})}var z,B,V=e((()=>{n(),z=t(k(),1),j(),c(),y(),ae(),s(),i(),l(),B=N()}));function H(e){switch(e){case`project`:return{label:`Project MCPs`,path:h(e)};case`user`:return{label:`User MCPs`,path:h(e)};case`local`:return{label:`Local MCPs`,path:h(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function _e(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 ve({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:i,onComplete:a}){let[o]=C(),[s,c]=(0,U.useState)(0),l=U.useMemo(()=>_e(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),u=U.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),f=U.useMemo(()=>(l.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[l]),p=H(`dynamic`),m=U.useMemo(()=>{let e=[];for(let t of G){let n=l.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of u)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},[l,u,t,f]),h=(0,U.useCallback)(()=>{a(`MCP dialog dismissed`,{display:`system`})},[a]);ee({"confirm:previous":()=>c(e=>e===0?m.length-1:e-1),"confirm:next":()=>c(e=>e===m.length-1?0:e+1),"confirm:yes":(0,U.useCallback)(()=>{let e=m[s];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&i&&i(e.agentServer))},[m,s,n,i]),"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=te(),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=s===t,i=``,a=``;if(e.client.type===`disabled`)i=A(`inactive`,o)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=A(`success`,o)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=A(`inactive`,o)(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`,o)(r.triangleUpOutline),a=`needs authentication`):(i=A(`error`,o)(r.cross),a=`failed`);return(0,W.jsxs)(w,{children:[(0,W.jsx)(E,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,W.jsx)(E,{color:n?`suggestion`:void 0,children:e.name}),(0,W.jsxs)(E,{dimColor:!n,children:[` · `,i,` `]}),(0,W.jsx)(E,{dimColor:!n,children:a})]},`${e.name}-${t}`)},x=e=>{let t=_(e),n=s===t,i=e.needsAuth?A(`warning`,o)(r.triangleUpOutline):A(`inactive`,o)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,W.jsxs)(w,{children:[(0,W.jsx)(E,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,W.jsx)(E,{color:n?`suggestion`:void 0,children:e.name}),(0,W.jsxs)(E,{dimColor:!n,children:[` · `,i,` `]}),(0,W.jsx)(E,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},O=e.length+t.length;return(0,W.jsxs)(w,{flexDirection:`column`,children:[(0,W.jsx)(de,{}),(0,W.jsx)(M,{title:`Manage MCP servers`,subtitle:`${O} ${re(O,`server`)}`,onCancel:h,hideInputGuide:!0,children:(0,W.jsxs)(w,{flexDirection:`column`,children:[G.map(e=>{let t=l.get(e);if(!t||t.length===0)return null;let n=H(e);return(0,W.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsxs)(w,{paddingLeft:2,children:[(0,W.jsx)(E,{bold:!0,children:n.label}),n.path&&(0,W.jsxs)(E,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>b(e))]},e)}),u.length>0&&(0,W.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(w,{paddingLeft:2,children:(0,W.jsx)(E,{bold:!0,children:`claude.ai`})}),u.map(e=>b(e))]}),t.length>0&&(0,W.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(w,{paddingLeft:2,children:(0,W.jsx)(E,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,W.jsxs)(w,{flexDirection:`column`,marginTop:1,children:[(0,W.jsx)(w,{paddingLeft:2,children:(0,W.jsxs)(E,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>x(e))]},e))]}),f.length>0&&(0,W.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsxs)(w,{paddingLeft:2,children:[(0,W.jsx)(E,{bold:!0,children:p.label}),p.path&&(0,W.jsxs)(E,{dimColor:!0,children:[` (`,p.path,`)`]})]}),f.map(e=>b(e))]}),(0,W.jsxs)(w,{flexDirection:`column`,children:[y&&(0,W.jsx)(E,{dimColor:!0,children:v?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,W.jsxs)(E,{dimColor:!0,children:[(0,W.jsx)(T,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`}),` for help`]})]})]})}),(0,W.jsx)(w,{paddingX:1,children:(0,W.jsx)(E,{dimColor:!0,italic:!0,children:(0,W.jsxs)(D,{children:[(0,W.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,W.jsx)(S,{shortcut:`Enter`,action:`confirm`}),(0,W.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var U,W,G,K=e((()=>{n(),U=t(k(),1),j(),c(),a(),ne(),ae(),s(),ue(),W=N(),G=[`project`,`local`,`user`,`enterprise`]}));function ye({serverName:e,onComplete:t}){let[n]=C(),i=o(),a=le(),[s,c]=(0,q.useState)(!0),[l,u]=(0,q.useState)(null);return(0,q.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){u(`MCP server "${e}" not found`),c(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:c(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:u(`${e} requires authentication`),c(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:u(`Failed to reconnect to ${e}`),c(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);u(n),c(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),s?(0,J.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(E,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(E,{bold:!0,children:e})]}),(0,J.jsxs)(w,{children:[(0,J.jsx)(f,{}),(0,J.jsx)(E,{children:` Establishing connection to MCP server`})]})]}):l?(0,J.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(w,{children:[(0,J.jsxs)(E,{children:[A(`error`,n)(r.cross),` `]}),(0,J.jsxs)(E,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,J.jsxs)(E,{dimColor:!0,children:[`Error: `,l]})]}):null}var q,J,Y=e((()=>{n(),q=t(k(),1),j(),P(),b(),l(),J=N()}));function be({onComplete:e}){let t=p(e=>e.mcp),n=p(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>u(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 _(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.claude.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(ve,{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),y(),a(),b(),oe(),V(),K(),F(),R(),I(),L(),Z=N()})),Se=e((()=>{V(),K(),Y(),F(),xe(),R(),I(),L()}));function Ce({action:e,target:t,onComplete:n}){let r=p(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)(be,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(ye,{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)(be,{onComplete:e})}var Q,$;e((()=>{Q=t(k(),1),Se(),Y(),P(),b(),$=N()}))();export{we as call};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,$x as n,Au as r,Cx as i,Ex as a,Fp as o,Hx as s,Ox as c,Pp as l,Qx as u,Sx as d,Vx as f,XE as ee,ZE as te,ax as p,bg as m,fS as h,gS as g,ju as _,lS as v,nS as y,nd as ne,rd as re,sS as b,sx as ie,tf as x,tx as ae,uS as oe,wx as se,xg as S,xx as C}from"./loadAgentsDir-BL93ulMm.js";import{D as w,H as T,I as E,P as D,T as O,fi as k,j as A,kn as j,t as M,y as N}from"./src-P_wYS_NJ2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{R as F,V as I}from"./debug-BecbSVoN.js";import{c as L,h as R,o as z,v as B}from"./config-aRiTrtCv.js";import{n as V,o as ce}from"./process-gEbdy6uY.js";import{i as H,o as U}from"./platform-B0uTQc9P.js";import{s as W,u as G}from"./types-DafcFtmb.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-C8PaYpQF.js";import{n as J,t as Y}from"./exit-BOhGfSlm.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";ee();var X=e(k(),1);x(),V(),M(),h(),ue(),o(),re();var Z=P();function pe({servers:e,scope:n,onDone:r}){let i=Object.keys(e),[a,o]=(0,X.useState)({});(0,X.useEffect)(()=>{b().then(({servers:e})=>o(e))},[]);let s=i.filter(e=>a[e]!==void 0);async function c(t){let r=0;for(let i of t){let t=e[i];if(t){let e=i;if(a[e]!==void 0){let t=1;for(;a[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await y(e,t,n),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 ${n} config.`)}\n`:`
|
|
2
|
+
No servers were imported.`),r(),t()},[u,n,r]),f=(0,X.useCallback)(()=>{d(0)},[d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${i.length} MCP ${q(i.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:f,hideInputGuide:!0,children:[s.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)(ne,{options:i.map(e=>({label:`${e}${s.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:i.filter(e=>!s.includes(e)),onSubmit:c,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)(l,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),_(),le(),se(),ie(),h(),n(),S(),R(),F(),x(),W(),U();async function Q(e,t){try{let n=await ae(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-C62oq4AZ.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-D5HkCqUh.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let n=v(e),r=()=>{n&&(n.type===`sse`||n.type===`http`)&&(d(e,n),C(e,n))};try{if(t.scope){let n=s(t.scope);K(`tengu_mcp_delete`,{name:e,scope:n}),await g(e,n),r(),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),J(`File modified: ${f(n)}`)}let n=z(),i=L(),{servers:a}=oe(`project`),o=!!a[e],c=[];if(n.mcpServers?.[e]&&c.push(`local`),o&&c.push(`project`),i.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 g(e,t),r(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${f(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),c.forEach(e=>{process.stderr.write(` - ${u(e)} (${f(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 b();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 te(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:p()});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 t(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let n=v(e);n||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${u(n.scope)}`);let r=await Q(e,n);if(console.log(` Status: ${r}`),n.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${n.url}`),n.headers){console.log(` Headers:`);for(let[e,t]of Object.entries(n.headers))console.log(` ${e}: ${t}`)}if(n.oauth?.clientId||n.oauth?.callbackPort){let t=[];n.oauth.clientId&&(t.push(`client_id configured`),i(e,n)?.clientSecret&&t.push(`client_secret configured`)),n.oauth.callbackPort&&t.push(`callback_port ${n.oauth.callbackPort}`),console.log(` OAuth: ${t.join(`, `)}`)}}else if(n.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${n.url}`),n.headers){console.log(` Headers:`);for(let[e,t]of Object.entries(n.headers))console.log(` ${e}: ${t}`)}if(n.oauth?.clientId||n.oauth?.callbackPort){let t=[];n.oauth.clientId&&(t.push(`client_id configured`),i(e,n)?.clientSecret&&t.push(`client_secret configured`)),n.oauth.callbackPort&&t.push(`callback_port ${n.oauth.callbackPort}`),console.log(` OAuth: ${t.join(`, `)}`)}}else if(n.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${n.command}`);let e=Array.isArray(n.args)?n.args:[];if(console.log(` Args: ${e.join(` `)}`),n.env){console.log(` Environment:`);for(let[e,t]of Object.entries(n.env))console.log(` ${e}=${t}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${n.scope}`),await t(0)}async function _e(e,t,n){try{let r=s(n.scope),i=G(t),o=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 a():void 0;await y(e,i,r);let l=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;o&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&c(e,{type:i.type,url:i.url},o),K(`tengu_mcp_add`,{scope:r,source:`json`,type:l}),J(`Added ${l} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=s(e.scope);K(`tengu_mcp_add`,{scope:t,platform:H(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-Bgds1-YT.js`),i=await n();Object.keys(i).length===0&&J(`No MCP servers found in Claude Desktop configuration or configuration file does not exist.`);let{unmount:a}=await j((0,Z.jsx)(m,{children:(0,Z.jsx)(r,{children:(0,Z.jsx)(pe,{servers:i,scope:t,onDone:()=>{a()}})})}),{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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$S as e,Ab as t,Ba as n,DC as r,EC as i,GS as a,Hl as o,JS as s,KS as c,OC as l,QS as u,SC as d,TC as f,U as p,Ul as m,W as ee,XS as h,YS as g,ZS as _,_C as v,_a as y,_x as te,aC as ne,cC as b,dC as x,eC as S,fC as C,fv as w,fw as T,gC as E,hC as D,iC as O,jb as k,mC as A,nC as j,nc as M,nl as N,oC as P,pC as F,pv as I,pw as L,qS as R,rC as re,rc as z,rl as B,tC as V,uC as H,vC as U,vx as W,wC as G,xC as K}from"./loadAgentsDir-C7lOqvfh.js";import{S as q,w as J}from"./debug-RAynG_nM.js";import{o as Y,s as X}from"./log-CezCRpAN.js";import{_ as ie,u as ae}from"./model-BsZ4sP_H.js";import{bn as Z,vn as oe,yn as Q}from"./prompt-M2lu8_Oa.js";import $ from"node:process";i(),S(),u(),G();var se=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},O,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)}};G(),h();var ce=class extends e{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(v.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 _,this.setRequestHandler(C,e=>this._oninitialize(e)),this.setNotificationHandler(F,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(d,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=v.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new se(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=V(this._capabilities,e)}setRequestHandler(e,t){let n=f(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let i;if(r(n)){let e=n;i=e._zod?.def?.value??e.value}else{let e=n;i=e._def?.value??e.value}if(typeof i!=`string`)throw Error(`Schema method literal must be a string`);return i===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let r=l(j,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new U(x.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=l(P,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new U(x.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let o=l(re,a);if(!o.success){let e=o.error instanceof Error?o.error.message:String(o.error);throw new U(x.InvalidParams,`Invalid tools/call result: ${e}`)}return o.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){s(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&g(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:K.includes(t)?t:A,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`},H)}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},ne,t):this.request({method:`sampling/createMessage`,params:e},O,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 U(x.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof U?e:new U(x.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},D,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`})}};c();var le=class{constructor(e=$.stdin,t=$.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new a,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=R(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};G(),z(),Z(),B(),W(),k(),Y(),n(),ie(),ee(),T(),q(),m(),w();var ue=[];async function de(e,n,r){let i=t(100);L(e);let a=new ce({name:`claude/tengu`,version:`0.0.10`},{capabilities:{tools:{}}});a.setRequestHandler(E,async()=>{let e=Q(),t=N(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}}))}}),a.setRequestHandler(j,async({params:{name:e,arguments:t}})=>{let a=N(Q()),s=oe(a,e);if(!s)throw Error(`Tool ${e} not found`);let c={abortController:te(),options:{commands:ue,tools:a,mainLoopModel:ae(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:n,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>M(),setAppState:()=>{},messages:[],readFileState:i,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!s.isEnabled())throw Error(`Tool ${e} is not enabled`);let n=await s.validateInput?.(t??{},c);if(n&&!n.result)throw Error(`Tool ${e} input is invalid: ${`message`in n?n.message:String(n)}`);let r=await s.call(t??{},c,p,y({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:J(r.data)}]}}catch(e){return X(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?o(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
-
`).trim()||`Error`}]}}});async function
|
|
1
|
+
import{$S as e,Ba as t,Bl as n,CC as r,EC as i,GS as a,JS as o,KS as s,Ob as c,QS as l,SC as u,TC as d,U as f,US as p,Vl as m,W as h,WS as g,XS as _,YS as v,ZS as y,_a as ee,bC as te,cC as b,dC as x,dv as S,dw as C,eC as w,ec as T,el as E,fC as D,gC as O,gx as k,hC as A,hx as j,iC as M,kb as N,lC as P,mC as F,nC as I,oC as L,pC as R,qS as ne,rC as z,tC as B,tc as V,tl as H,uC as U,uv as W,uw as G,wC as K,yC as q}from"./loadAgentsDir-BL93ulMm.js";import{C as J,x as Y}from"./debug-BecbSVoN.js";import{o as X,s as Z}from"./log-Dauqle-Z.js";import{_ as re,u as ie}from"./model-Bgh_r4lg.js";import{bn as ae,vn as oe,yn as Q}from"./prompt-Dx7IWhBt.js";import $ from"node:process";K(),l(),_(),u();var se=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},I,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},L,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)}};u(),o();var ce=class extends y{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(A.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 v,this.setRequestHandler(U,e=>this._oninitialize(e)),this.setNotificationHandler(x,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(te,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=A.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new se(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=e(this._capabilities,t)}setRequestHandler(e,t){let n=r(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let a;if(d(n)){let e=n;a=e._zod?.def?.value??e.value}else{let e=n;a=e._def?.value??e.value}if(typeof a!=`string`)throw Error(`Schema method literal must be a string`);return a===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let r=i(w,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new O(P.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=r.data,o=await Promise.resolve(t(e,n));if(a.task){let e=i(M,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new O(P.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=i(B,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new O(P.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){s(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&ne(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:q.includes(t)?t:D,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`},b)}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},z,t):this.request({method:`sampling/createMessage`,params:e},I,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},L,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},L,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new O(P.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof O?e:new O(P.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},R,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`})}};g();var le=class{constructor(e=$.stdin,t=$.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new p,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=a(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};u(),V(),ae(),H(),k(),N(),X(),t(),re(),h(),G(),Y(),m(),W();var ue=[];async function de(e,t,r){let i=c(100);C(e);let a=new ce({name:`claude/tengu`,version:`0.0.11`},{capabilities:{tools:{}}});a.setRequestHandler(F,async()=>{let e=Q(),t=E(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=S(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:S(n.inputSchema),outputSchema:r}}))}}),a.setRequestHandler(w,async({params:{name:e,arguments:a}})=>{let o=E(Q()),s=oe(o,e);if(!s)throw Error(`Tool ${e} not found`);let c={abortController:j(),options:{commands:ue,tools:o,mainLoopModel:ie(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:t,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>T(),setAppState:()=>{},messages:[],readFileState:i,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!s.isEnabled())throw Error(`Tool ${e} is not enabled`);let t=await s.validateInput?.(a??{},c);if(t&&!t.result)throw Error(`Tool ${e} input is invalid: ${`message`in t?t.message:String(t)}`);let n=await s.call(a??{},c,f,ee({content:[]}));return{content:[{type:`text`,text:typeof n==`string`?n:J(n.data)}]}}catch(e){return Z(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?n(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
+
`).trim()||`Error`}]}}});async function o(){let e=new le;await a.connect(e)}return await o()}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{S as p,w as m}from"./debug-RAynG_nM.js";import{o as h,s as g}from"./log-CezCRpAN.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=m(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(),p()}));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-BecbSVoN.js";import{o as h,s as g}from"./log-Dauqle-Z.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{n,o as r}from"./envUtils-BDhHQY0-.js";import{$u as i,Bc as a,FS as o,GC as s,LE as c,LS as l,Sb as u,Sg as d,Vc as ee,_b as f,bb as p,bf as te,ed as ne,xg as m,yf as h,zE as g}from"./loadAgentsDir-BL93ulMm.js";import{I as _,Lt as v,P as y,Wt as b,_ as x,di as S,fi as C,t as w,ui as re,y as T}from"./src-P_wYS_NJ2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as D,et as O}from"./state-BemZdQIl.js";import{n as k,t as A}from"./cwd-Cfdf7z7s.js";import{F as j,R as M}from"./debug-BecbSVoN.js";import{g as N,wn as P,x as F,xn as ie}from"./settings-D4CpDv2y.js";import{M as I,P as L,k as ae}from"./config-aRiTrtCv.js";import{m as R,r as z}from"./git-DBlOv64X.js";import{o as oe,s as se}from"./log-Dauqle-Z.js";import{n as ce,r as B}from"./analytics-DJobLaWP.js";import{m as le,v as V}from"./startupProfiler-CmH_aVy2.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-DEEJhm_W.js";import{r as ue,t as de}from"./promptEditor-WCkmpejM.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 ge=e((()=>{R()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(p()),i=W(n(),`CLAUDE.md`),a=W(O(),`CLAUDE.md`),o=r.some(e=>e.path===i),s=r.some(e=>e.path===a),u=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...o?[]:[{path:i,type:`User`,content:``,exists:!1}],...s?[]:[{path:a,type:`Project`,content:``,exists:!1}]],f=new Map,m=u.map(e=>{let t=ie(e.path),n=e.exists?``:` (new)`,r=e.parent?(f.get(e.parent)??0)+1:0;f.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(O());return c=e.type===`User`&&!e.isNested?`Saved in ~/.claude/CLAUDE.md`:e.type===`Project`&&!e.isNested&&e.path===a?`${l?`Checked in at`:`Saved in`} ./CLAUDE.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:`${Y}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=c(e.agentType,e.memory);h.push({label:`Open ${re.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}m.push(...h);let v=J&&m.some(e=>e.value===J)?J:m[0]?.value||``,[S,C]=(0,K.useState)(L),[w,T]=(0,K.useState)(ee),[E]=(0,K.useState)(L),D=d(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{E&&te().then(A)},[E,D]);let j=D?`running`:k===null?``:k===0?`never`:`last ran ${le(new Date(k))}`,[M,N]=(0,K.useState)(null),P=M!==null,I=+!!E;function R(){let e=!S;F(`userSettings`,{autoMemoryEnabled:e}),C(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!w;F(`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:P}),b(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:P}),b(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,q.jsxs)(_,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(x,{isFocused:M===0,children:(0,q.jsxs)(y,{children:[`Auto-memory: `,S?`on`:`off`]})}),E&&(0,q.jsx)(x,{isFocused:M===1,styled:!1,children:(0,q.jsxs)(y,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(y,{dimColor:!0,children:[` · `,j]}),!D&&w&&(0,q.jsx)(y,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(ne,{defaultFocusValue:v,options:m,isDisabled:P,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>l(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var K,q,J,Y,ve=e((()=>{S(),C(),K=t(C(),1),D(),U(),w(),s(),I(),ce(),a(),h(),m(),g(),o(),u(),r(),P(),V(),ge(),N(),i(),q=E(),Y=`__open_folder__`}));function ye(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 X=e((()=>{C(),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 ${ye(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)(_e,{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.claude.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(C(),1),w(),ve(),X(),u(),r(),M(),oe(),ue(),Q=E(),$=async e=>(f(),await p(),(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{dt as n,
|
|
2
|
-
`)}`,{display:`system`});return}a(
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{dt as n,ed as r,ft as i,pt as a,td as o,ut as s}from"./loadAgentsDir-BL93ulMm.js";import{I as c,P as l,fi as u,t as d}from"./src-P_wYS_NJ2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({onDone:e}){let t=i(),n=s(),o=(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){a(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:o,onChange:u,onCancel:d,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(u(),1),d(),o(),n(),h=f(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=i(),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
|
+
`)}`,{display:`system`});return}a(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-Bgh_r4lg.js";e();export{t as getMainLoopModel};
|