@readmagic/workmate 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-Y5S_lMjD.js → AddWorkspaceDirectory-DqlPtsVK.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-DVbU-BaD.js → AgentsMdExternalIncludesDialog-rJS5l6yk.js} +1 -1
- package/dist/chunks/App-DzRQpRKr.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-CBhSmdz_.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-DjqGAL4C.js → BypassPermissionsModeDialog-zz-lnmJt.js} +1 -1
- package/dist/chunks/CustomSelect-CYmc4vRh.js +1 -0
- package/dist/chunks/DiffDialog-CTUIAcEE.js +6 -0
- package/dist/chunks/Doctor-CLOYkPRR.js +3 -0
- package/dist/chunks/Doctor-CiZNe_qx.js +1 -0
- package/dist/chunks/{ExitFlow-Dh9QdaYK.js → ExitFlow-CATwJC4c.js} +2 -2
- package/dist/chunks/{InvalidConfigDialog-C9boykQn.js → InvalidConfigDialog-B-9Z58oD.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-UN5mleCK.js → InvalidSettingsDialog-B4EWjbp7.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-Dzg77_Xn.js +1 -0
- package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +1 -0
- package/dist/chunks/MCPToolListView-C7HT6rrl.js +1 -0
- package/dist/chunks/{McpParsingWarnings-zkM_lGd0.js → McpParsingWarnings-Dj_Fu5o-.js} +1 -1
- package/dist/chunks/MessageSelector-Dw_ERK_Z.js +3 -0
- package/dist/chunks/Messages-RBfRELKn.js +10 -0
- package/dist/chunks/Onboarding-BRSXxc2E.js +1 -0
- package/dist/chunks/{PermissionDialog-BaibiQae.js → PermissionDialog-DjCRuzSm.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-DZc_s_pE.js → PressEnterToContinue-DE1RxMX_.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-CCTZYbWI.js → PromptInputFooterSuggestions-ChpyD9B7.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-CrTT8MKE.js +1 -0
- package/dist/chunks/{ProviderSetup-yIj8YOKF.js → ProviderSetup-BEV95bnz.js} +1 -1
- package/dist/chunks/QueryEngine-BBBkZWu2.js +1 -0
- package/dist/chunks/REPL-BDnZnm__.js +124 -0
- package/dist/chunks/REPL-BHk0vZDf.js +1 -0
- package/dist/chunks/ResumeConversation-BuSqBrm1.js +1 -0
- package/dist/chunks/{SearchBox-C9xxQzh1.js → SearchBox-zA5QwIpO.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +1 -0
- package/dist/chunks/Settings-DYKmPdbd.js +2 -0
- package/dist/chunks/Spinner-DOI8qqZi.js +1 -0
- package/dist/chunks/SpinnerGlyph-BR_SiV9L.js +1 -0
- package/dist/chunks/{TextInput-Cev5Awdd.js → TextInput-ZKU-x_FD.js} +11 -11
- package/dist/chunks/ThemePicker-B69oDgXN.js +1 -0
- package/dist/chunks/TrustDialog-BSG8Ibh8.js +1 -0
- package/dist/chunks/{ValidationErrorsList-INwwoerV.js → ValidationErrorsList-BUYHEft4.js} +1 -1
- package/dist/chunks/{_baseEach-DrPH_FGo.js → _baseEach-P0u1zIx6.js} +1 -1
- package/dist/chunks/_baseSlice-D67_NpZ1.js +1 -0
- package/dist/chunks/{add-dir-D3RMaYxy.js → add-dir-C8RmmyQK.js} +1 -1
- package/dist/chunks/{agentDisplay-B3npXoCS.js → agentDisplay-np7CH47m.js} +1 -1
- package/dist/chunks/{agents-2mPGmeq6.js → agents-DRQlR5M1.js} +1 -1
- package/dist/chunks/agents-DedoH0Q4.js +101 -0
- package/dist/chunks/allErrors-DvcU0w0F.js +1 -0
- package/dist/chunks/appleTerminalBackup-Bemd4RXh.js +1 -0
- package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-BkFxfjOf.js → backgroundHousekeeping-BtEJ6TeC.js} +1 -1
- package/dist/chunks/banner-CuoceXzz.js +2 -0
- package/dist/chunks/branch-ClhlS7f8.js +2 -0
- package/dist/chunks/{break-cache-UUt6Dkf2.js → break-cache-B1nuWtD_.js} +2 -2
- package/dist/chunks/{btw-DUml5L1w.js → btw-B-FLxlx-.js} +1 -1
- package/dist/chunks/bundledMode-D9omqD3L.js +2 -0
- package/dist/chunks/caches-D7arwhaa.js +1 -0
- package/dist/chunks/caches-Dn8yrJmL.js +1 -0
- package/dist/chunks/{clear-CrGjNe6E.js → clear-BnWv0i65.js} +1 -1
- package/dist/chunks/{client-BYFVVMcf.js → client-2w-g5kMx.js} +1 -1
- package/dist/chunks/client-B0ngS4Uu.js +1 -0
- package/dist/chunks/client-BP4DOH3K.js +1 -0
- package/dist/chunks/{client-BDuhbzLD.js → client-pA7fKk0-.js} +1 -1
- package/dist/chunks/commands-AcfFLgl5.js +1 -0
- package/dist/chunks/compact-Banc-SNk.js +2 -0
- package/dist/chunks/config-BDn2YIjC.js +3 -0
- package/dist/chunks/config-BhBcadjZ.js +1 -0
- package/dist/chunks/config-Bm5pVdCq.js +1 -0
- package/dist/chunks/{context-mV5zjqmc.js → context-BvDBAyJ9.js} +1 -1
- package/dist/chunks/context-noninteractive-BK2IDLSS.js +1 -0
- package/dist/chunks/{context-noninteractive-DvfVvmSE.js → context-noninteractive-CuHHniJn.js} +7 -7
- package/dist/chunks/conversation-B2dX3X4Z.js +1 -0
- package/dist/chunks/conversation-Cjaftrrw.js +1 -0
- package/dist/chunks/conversationRecovery-NL05oJb1.js +1 -0
- package/dist/chunks/crossProjectResume-BzltC4NJ.js +40 -0
- package/dist/chunks/cwd-BH2f3u0o.js +1 -0
- package/dist/chunks/{cwd-BvNt_018.js → cwd-DrEEb4f5.js} +1 -1
- package/dist/chunks/{debug-CRnGsZOV.js → debug-2pVES-2G.js} +3 -3
- package/dist/chunks/detectRepository--luIRv5H.js +1 -0
- package/dist/chunks/{diff-DUEoNCnJ.js → diff--6gQCx_x.js} +1 -1
- package/dist/chunks/directoryCompletion-BC0qRmrz.js +1 -0
- package/dist/chunks/doctor-CQf8xPZH.js +1 -0
- package/dist/chunks/entry-DWYOrkFS.js +13 -0
- package/dist/chunks/envUtils-QyzA_cFM.js +1 -0
- package/dist/chunks/execFileNoThrow-DXSEj8ZO.js +1 -0
- package/dist/chunks/execa-CBhG1doD.js +34 -0
- package/dist/chunks/exit-uKtXb5U3.js +1 -0
- package/dist/chunks/{extraUsage-BtHE-SBX.js → extraUsage-Dr0YXm1w.js} +1 -1
- package/dist/chunks/extractMemories-8yvMGZ1J.js +1 -0
- package/dist/chunks/fast-C5-lNCQi.js +1 -0
- package/dist/chunks/fast-aNkj6WvB.js +1 -0
- package/dist/chunks/fetchModelList-9w1E4Ue8.js +1 -0
- package/dist/chunks/fetchModelList-D2quBF6M.js +1 -0
- package/dist/chunks/fileSuggestions-BYD78vcF.js +3 -0
- package/dist/chunks/{fpsMetrics-wxj9GAsd.js → fpsMetrics-DIpm2-xw.js} +1 -1
- package/dist/chunks/{gemini-4YGElN3H.js → gemini-BNBptTET.js} +2 -2
- package/dist/chunks/generateSessionName-CO2484aJ.js +1 -0
- package/dist/chunks/genericProcessUtils-GqURdVAv.js +12 -0
- package/dist/chunks/{goal-ePK_jLo3.js → goal-j0wdadwM.js} +1 -1
- package/dist/chunks/grok-BpO1ZwK_.js +1 -0
- package/dist/chunks/{help-B7xRle-V.js → help-DwhA0qQ6.js} +1 -1
- package/dist/chunks/history-CUrqO9rV.js +1 -0
- package/dist/chunks/hooks-B5Wq-KxE.js +1 -0
- package/dist/chunks/{hooks-BN5f58HY.js → hooks-DG4_WdZ2.js} +2 -2
- package/dist/chunks/{install-DrMiHa2Q.js → install-BbmCNCuM.js} +1 -1
- package/dist/chunks/{instrumentation-Oj5xagJG.js → instrumentation-DpPmDyNF.js} +6 -6
- package/dist/chunks/{job-D9ypO0cd.js → job-GcmX1ALd.js} +1 -1
- package/dist/chunks/keybindings-CxgQqQJe.js +1 -0
- package/dist/chunks/{launchLocalMemory-DliLezJw.js → launchLocalMemory-CDgT5lst.js} +1 -1
- package/dist/chunks/{launchOnboarding-A-kk-7ID.js → launchOnboarding-uQ_ux9sS.js} +1 -1
- package/dist/chunks/loadAgentsDir-BBbIAiay.js +1 -0
- package/dist/chunks/{loadAgentsDir-DGozQu_6.js → loadAgentsDir-uuZYOgKn.js} +573 -577
- package/dist/chunks/{loadPluginHooks-BiHPKDaY.js → loadPluginHooks-QoVXsBjy.js} +1 -1
- package/dist/chunks/loader-BMAtuwRa.js +1 -0
- package/dist/chunks/localSearch-D6MhwvnR.js +1 -0
- package/dist/chunks/{localSearch-BU02Qsv9.js → localSearch-yVCDrVrf.js} +1 -1
- package/dist/chunks/lockfile-D_9vif6E.js +1 -0
- package/dist/chunks/{log-DoSpAwRP.js → log-L1kqxa_P.js} +1 -1
- package/dist/chunks/{logoUtils-DLd6JKqW.js → logoUtils-B4wCDKs9.js} +1 -1
- package/dist/chunks/{magicDocs-Bj8LYrN2.js → magicDocs-D53lV8b5.js} +2 -2
- package/dist/chunks/main-fy_XSXGj.js +345 -0
- package/dist/chunks/managedEnv-B8YWmM4A.js +1 -0
- package/dist/chunks/managedEnv-ulQBH73B.js +1 -0
- package/dist/chunks/managedEnvConstants-BPY8yF1A.js +1 -0
- package/dist/chunks/mcp--LmEVBRg.js +1 -0
- package/dist/chunks/mcp-CZUVaPb3.js +5 -0
- package/dist/chunks/mcp-DCl-Tz-C.js +2 -0
- package/dist/chunks/memory-Bu5ku7y9.js +1 -0
- package/dist/chunks/{modalContext-DDZdU1J8.js → modalContext-sU2lfR08.js} +1 -1
- package/dist/chunks/{mode-CBKawxnD.js → mode-Bteqe2QG.js} +1 -1
- package/dist/chunks/{model-DwbqvCY2.js → model-CHDU5yqH.js} +1 -1
- package/dist/chunks/model-CcHyMyBv.js +1 -0
- package/dist/chunks/modelOptions-CJV1R3Jt.js +1 -0
- package/dist/chunks/nativeInstaller-CIUYh1aD.js +1 -0
- package/dist/chunks/{notifications-ql0eSo0Y.js → notifications-GLnjirCl.js} +1 -1
- package/dist/chunks/{observationStore-D0rm3GhP.js → observationStore-pnSSxec_.js} +1 -1
- package/dist/chunks/{onChangeAppState-D85b33R5.js → onChangeAppState-CxGW2d-l.js} +1 -1
- package/dist/chunks/openai-BpGQT2Iv.js +2 -0
- package/dist/chunks/{overlayContext-CLjlCFBl.js → overlayContext-7wgLio1O.js} +1 -1
- package/dist/chunks/{panel-DMZkOEiU.js → panel-DNiXDhBX.js} +1 -1
- package/dist/chunks/{parser-UqADrvxF.js → parser-CTnaXFVJ.js} +1 -1
- package/dist/chunks/parser-Diihup2V.js +1 -0
- package/dist/chunks/{partition-CwxTlmMd.js → partition-djFY9gGI.js} +1 -1
- package/dist/chunks/{pasteStore-ovtxMVR5.js → pasteStore-njJCBMKr.js} +1 -1
- package/dist/chunks/permissions-DNedQyLg.js +3 -0
- package/dist/chunks/pidLock-CFUBtZck.js +3 -0
- package/dist/chunks/plan-DI0n7LIV.js +1 -0
- package/dist/chunks/plugin-BQ8gRVYF.js +17 -0
- package/dist/chunks/pluginAutoupdate-CNrHb4RJ.js +1 -0
- package/dist/chunks/{pluginBlocklist-BAr9WTup.js → pluginBlocklist-CKCsgWdY.js} +1 -1
- package/dist/chunks/pluginCliCommands-CACeyIwz.js +1 -0
- package/dist/chunks/{pluginFlagging-BO_3qjfs.js → pluginFlagging-CUvkKGOB.js} +1 -1
- package/dist/chunks/pluginOperations-Ca_T-HYn.js +2 -0
- package/dist/chunks/pluginStartupCheck-DftTiXct.js +1 -0
- package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +1 -0
- package/dist/chunks/{plugins-9crasx2V.js → plugins-Divl-P-X.js} +4 -4
- package/dist/chunks/{poller-CpLBoB-N.js → poller-BeyVwHAf.js} +1 -1
- package/dist/chunks/poorMode-CG2JNTD0.js +1 -0
- package/dist/chunks/poorMode-eMIFCAC_.js +1 -0
- package/dist/chunks/print-DSHypGJa.js +13 -0
- package/dist/chunks/processBashCommand-BLcFmbyG.js +1 -0
- package/dist/chunks/processSlashCommand-Caif46Gi.js +5 -0
- package/dist/chunks/{projectContext-DhtjLv3k.js → projectContext-BFfHgAMh.js} +1 -1
- package/dist/chunks/{projectContext-5fmRr6Sd.js → projectContext-DnJHynXv.js} +1 -1
- package/dist/chunks/{projectOnboardingState--L3BKjOE.js → projectOnboardingState-nTCycGCD.js} +1 -1
- package/dist/chunks/prompt-BZmu5CeK.js +1 -0
- package/dist/chunks/{prompt-DzO1um1h.js → prompt-BfXryFt-.js} +21 -21
- package/dist/chunks/prompt-Cogr_WZr.js +1 -0
- package/dist/chunks/promptEditor-14TB3MYt.js +4 -0
- package/dist/chunks/protocolHandler-VigBkAQQ.js +13 -0
- package/dist/chunks/{proxy-BjkGlmBu.js → proxy--_NfbJhm.js} +2 -2
- package/dist/chunks/reconciler-B9XFdL4f.js +1 -0
- package/dist/chunks/refresh-CBHbWTGg.js +1 -0
- package/dist/chunks/reject-CBxnwckZ.js +1 -0
- package/dist/chunks/{reload-plugins-DeyJTx4s.js → reload-plugins-5eFWrQlL.js} +1 -1
- package/dist/chunks/rename-Cw7cMerG.js +1 -0
- package/dist/chunks/{renderOptions-DRS2EslG.js → renderOptions-B0RFpjRI.js} +1 -1
- package/dist/chunks/{resume-N4O5YI-S.js → resume-U2D0ybfU.js} +2 -2
- package/dist/chunks/ripgrep-67m14ImZ.js +5 -0
- package/dist/chunks/ripgrep-DB7KB8RZ.js +1 -0
- package/dist/chunks/{runtimeObserver-DMSzdFWt.js → runtimeObserver-CWaYMJG8.js} +4 -4
- package/dist/chunks/{runtimeObserver-C0CJvA3q.js → runtimeObserver-DOYlxx9H.js} +1 -1
- package/dist/chunks/sandbox-adapter-Df7Wpt77.js +1 -0
- package/dist/chunks/sandbox-toggle-BtiPyjT3.js +1 -0
- package/dist/chunks/searchExtraTools-CbJVb_Zk.js +1 -0
- package/dist/chunks/select-BuTJbu_Q.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +1 -0
- package/dist/chunks/sessionObserver-BZVgzp3W.js +1 -0
- package/dist/chunks/{sessionObserver-CRie77tp.js → sessionObserver-cfwD8pV8.js} +2 -2
- package/dist/chunks/sessionStorage-SC5RfnUP.js +1 -0
- package/dist/chunks/sessionTracing-DsdcOqvc.js +11 -0
- package/dist/chunks/settings-D4M13toi.js +104 -0
- package/dist/chunks/settings-Dfit5gGT.js +1 -0
- package/dist/chunks/setup-DR-KEmxL.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-CTnYVrmP.js → shadowedRuleDetection-DiZUDzxU.js} +1 -1
- package/dist/chunks/{sideQuestion-Cl8m2qYx.js → sideQuestion-CdgUarC2.js} +3 -3
- package/dist/chunks/{sinks-CiupmfTg.js → sinks-Cy3NqVbk.js} +1 -1
- package/dist/chunks/sinks-D41OiGE4.js +1 -0
- package/dist/chunks/skillChangeDetector-CVFCJcG7.js +1 -0
- package/dist/chunks/{skillGapStore-es3K-aYe.js → skillGapStore-BJV8ZIB1.js} +2 -2
- package/dist/chunks/{skillLifecycle-BcgoOQBk.js → skillLifecycle-iO_3s9Ff.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CuDDb1L-.js → skillSearchPanel-BL5gXTHU.js} +2 -2
- package/dist/chunks/skills-BEp3_RyT.js +1 -0
- package/dist/chunks/sleep-xKMbXTJe.js +1 -0
- package/dist/chunks/{src-DL3w8VPk.js → src-BX54x08P.js} +4 -4
- package/dist/chunks/{src-9vmGsuSI.js → src-HB5wLari.js} +1 -1
- package/dist/chunks/{startupProfiler-DF0AjiDf.js → startupProfiler-B9Qv2QGH.js} +2 -2
- package/dist/chunks/startupProfiler-DWcM4QBl.js +1 -0
- package/dist/chunks/{state-BQ4BEGin.js → state-CXY-q5gr.js} +1 -1
- package/dist/chunks/state-DXt6rahM.js +1 -0
- package/dist/chunks/{staticRender-BVWx0IM1.js → staticRender-Bt82RvGc.js} +1 -1
- package/dist/chunks/status-6JMz8jmM.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-BfmIub5L.js → statusNoticeHelpers-BoloSeXY.js} +1 -1
- package/dist/chunks/stringUtils-Cs6E5f-B.js +4 -0
- package/dist/chunks/switcher-95d4TrQH.js +1 -0
- package/dist/chunks/switcher-DSt2cVjA.js +1 -0
- package/dist/chunks/{tasks-B6gYXxOx.js → tasks-DyBUXnQb.js} +1 -1
- package/dist/chunks/{templateJobs-BW6TaqEC.js → templateJobs-BBnReWWj.js} +7 -7
- package/dist/chunks/{terminalSetup-C-g9Xvj3.js → terminalSetup-CDpFfqqV.js} +1 -1
- package/dist/chunks/{terminalSetup-BgIXFBpd.js → terminalSetup-DedaY1P7.js} +4 -4
- package/dist/chunks/{theme-9AZceq_m.js → theme-BZOy9Iqh.js} +1 -1
- package/dist/chunks/tipRegistry-Cl5sdLRX.js +2 -0
- package/dist/chunks/{toolEventObserver-DTuJcREC.js → toolEventObserver-ClwWmVbH.js} +1 -1
- package/dist/chunks/toolPool-DSTbgGmX.js +1 -0
- package/dist/chunks/udsClient-CWeoNrm3.js +1 -0
- package/dist/chunks/urlHandler-BNsQKqba.js +1 -0
- package/dist/chunks/{useDoublePress-C9xxQzh1.js → useDoublePress-zA5QwIpO.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DWRFdFoU.js → useExitOnCtrlCDWithKeybindings-ClN4NJnB.js} +1 -1
- package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +1 -0
- package/dist/chunks/useManagePlugins-CxHz-gUP.js +1 -0
- package/dist/chunks/useMergedTools-BUuWew0-.js +1 -0
- package/dist/chunks/{useSearchInput-B_mY9wBq.js → useSearchInput-BIQN_-Hm.js} +1 -1
- package/dist/chunks/{useSettingsErrors-CM7tThcp.js → useSettingsErrors-BDJCLei_.js} +1 -1
- package/dist/chunks/util-BHr5l6Bx.js +1 -0
- package/dist/chunks/validatePlugin-fx1Y8vam.js +1 -0
- package/dist/chunks/{vim-Dpnhgoz_.js → vim-CYjMtnwH.js} +1 -1
- package/dist/chunks/worktree-CGu_58ue.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -2
- package/scripts/postinstall.cjs +16 -16
- package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +0 -1
- package/dist/chunks/App-B8q8PV77.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +0 -2
- package/dist/chunks/CustomSelect-BvTftqEH.js +0 -1
- package/dist/chunks/DiffDialog-v5r8cBKW.js +0 -6
- package/dist/chunks/Doctor-DKpBnbuI.js +0 -1
- package/dist/chunks/Doctor-uvO6NM5m.js +0 -3
- package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +0 -1
- package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +0 -1
- package/dist/chunks/MCPToolListView-De1W4jpj.js +0 -1
- package/dist/chunks/MessageSelector-DW_itlX-.js +0 -3
- package/dist/chunks/Messages-BFsCpACq.js +0 -10
- package/dist/chunks/Onboarding-BT90cFkn.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +0 -1
- package/dist/chunks/QueryEngine-egz5mbaW.js +0 -1
- package/dist/chunks/REPL-D27CE4WN.js +0 -124
- package/dist/chunks/REPL-e8wAT1wN.js +0 -1
- package/dist/chunks/ResumeConversation-CWA27Lke.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +0 -1
- package/dist/chunks/SelectMulti-BW7Ffk1G.js +0 -1
- package/dist/chunks/Settings-axHLvYIy.js +0 -3
- package/dist/chunks/Spinner-VjwI7m_g.js +0 -1
- package/dist/chunks/SpinnerGlyph-CqrOK3Mx.js +0 -1
- package/dist/chunks/ThemePicker-CtQYHmOr.js +0 -1
- package/dist/chunks/TrustDialog-8Sjmuu0e.js +0 -1
- package/dist/chunks/agents-DEnmg8Xo.js +0 -101
- package/dist/chunks/allErrors-C9kx6lnk.js +0 -1
- package/dist/chunks/appleTerminalBackup-CT7g8yOs.js +0 -1
- package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +0 -1
- package/dist/chunks/banner-DHpTmEO7.js +0 -2
- package/dist/chunks/branch-Be_yDFU8.js +0 -2
- package/dist/chunks/caches-DWjwe-DN.js +0 -1
- package/dist/chunks/caches-VLs1tQkZ.js +0 -1
- package/dist/chunks/claudeDesktop-mBGFDbI6.js +0 -1
- package/dist/chunks/client-CO_6v4yl.js +0 -1
- package/dist/chunks/client-DO-O441l.js +0 -1
- package/dist/chunks/commands-Cn1P7Tms.js +0 -1
- package/dist/chunks/compact-DGUhdXcc.js +0 -2
- package/dist/chunks/config-C7GTF4iI.js +0 -1
- package/dist/chunks/config-CWPHVTic.js +0 -3
- package/dist/chunks/config-Cox0TM2Z.js +0 -1
- package/dist/chunks/context-noninteractive--OuiZUzL.js +0 -1
- package/dist/chunks/conversation--y8PD2Lk.js +0 -1
- package/dist/chunks/conversation-BIPJEOwO.js +0 -1
- package/dist/chunks/conversationRecovery-BBJzrA0g.js +0 -1
- package/dist/chunks/crossProjectResume-CwZb3cEU.js +0 -40
- package/dist/chunks/cwd-BZMp3CZ8.js +0 -1
- package/dist/chunks/detectRepository-CsJLbVEe.js +0 -1
- package/dist/chunks/directoryCompletion-Bgi8DBT5.js +0 -1
- package/dist/chunks/doctor-4NiE46ZG.js +0 -1
- package/dist/chunks/entry-D1iD76SW.js +0 -13
- package/dist/chunks/envUtils-DfkgIdYf.js +0 -1
- package/dist/chunks/execFileNoThrow-BgRsj_SW.js +0 -34
- package/dist/chunks/exit-CrsQsjbx.js +0 -1
- package/dist/chunks/extractMemories-kogJzpit.js +0 -1
- package/dist/chunks/fast-CuNVwVTr.js +0 -1
- package/dist/chunks/fast-RlFnwGRV.js +0 -1
- package/dist/chunks/fetchModelList-Cjow_QGy.js +0 -1
- package/dist/chunks/fetchModelList-uiCPVqbJ.js +0 -1
- package/dist/chunks/fileSuggestions-C96V9-Ne.js +0 -3
- package/dist/chunks/generateSessionName-BHIKyXpz.js +0 -1
- package/dist/chunks/genericProcessUtils-BNlr-QxM.js +0 -23
- package/dist/chunks/grok-DnmklTrm.js +0 -1
- package/dist/chunks/history-kOw3CcLT.js +0 -1
- package/dist/chunks/hooks-BDY1jMbS.js +0 -1
- package/dist/chunks/keybindings-BRRN_eap.js +0 -1
- package/dist/chunks/loadAgentsDir-CJAK4kif.js +0 -1
- package/dist/chunks/loader-CtoR-vO-.js +0 -1
- package/dist/chunks/localSearch-DyaB2Rm-.js +0 -1
- package/dist/chunks/main-B_09WbaG.js +0 -345
- package/dist/chunks/managedEnv-BJGfe3m7.js +0 -1
- package/dist/chunks/managedEnv-CIWJsuty.js +0 -1
- package/dist/chunks/managedEnvConstants-BPwL2aWI.js +0 -1
- package/dist/chunks/mcp-1nBvcNxw.js +0 -1
- package/dist/chunks/mcp-7DXpXMdT.js +0 -2
- package/dist/chunks/mcp-kw99WVi2.js +0 -6
- package/dist/chunks/memory-CjWvzR_9.js +0 -1
- package/dist/chunks/model-DpZaKZMb.js +0 -1
- package/dist/chunks/modelOptions-CXBfKFXA.js +0 -1
- package/dist/chunks/nativeInstaller-SmPeEisk.js +0 -1
- package/dist/chunks/openai-D_j7-KW6.js +0 -2
- package/dist/chunks/parser-2usBI4G-.js +0 -1
- package/dist/chunks/permissions-CgsvWOk_.js +0 -3
- package/dist/chunks/pidLock-B-SW3Nhx.js +0 -3
- package/dist/chunks/plan-BJrWtXEh.js +0 -1
- package/dist/chunks/platform-DsMIk3eq.js +0 -2
- package/dist/chunks/plugin-D97VJAxW.js +0 -17
- package/dist/chunks/pluginAutoupdate-DQqYDPVg.js +0 -1
- package/dist/chunks/pluginCliCommands-CUGPc853.js +0 -1
- package/dist/chunks/pluginOperations-rTrzu6Vg.js +0 -2
- package/dist/chunks/pluginStartupCheck-BRHnXlym.js +0 -1
- package/dist/chunks/pluginStartupCheck-BX6cv-vs.js +0 -1
- package/dist/chunks/poorMode-BaS0DBUO.js +0 -1
- package/dist/chunks/poorMode-DmvzFAz_.js +0 -1
- package/dist/chunks/print-Bi3xVdB3.js +0 -13
- package/dist/chunks/processBashCommand-BBtnCx-7.js +0 -1
- package/dist/chunks/processSlashCommand-jzF0GmLO.js +0 -5
- package/dist/chunks/prompt-CmijKW7G.js +0 -1
- package/dist/chunks/prompt-DYBx_D0H.js +0 -1
- package/dist/chunks/promptEditor-B6S_Rzcu.js +0 -4
- package/dist/chunks/protocolHandler-BWgH1jaF.js +0 -13
- package/dist/chunks/reconciler-CVMmAaCy.js +0 -1
- package/dist/chunks/refresh-CAGv8BJY.js +0 -1
- package/dist/chunks/reject-CEUkoI2G.js +0 -1
- package/dist/chunks/rename-DPFis9g_.js +0 -1
- package/dist/chunks/ripgrep-3omwGI-l.js +0 -1
- package/dist/chunks/ripgrep-CgQrN3XX.js +0 -5
- package/dist/chunks/sandbox-adapter-D15jjHJR.js +0 -1
- package/dist/chunks/sandbox-toggle-Tbbaw18C.js +0 -1
- package/dist/chunks/searchExtraTools-BoFc__Eg.js +0 -1
- package/dist/chunks/select-Fq6g2Ejk.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +0 -1
- package/dist/chunks/sessionObserver-PcaVCVkX.js +0 -1
- package/dist/chunks/sessionStorage-Dkf7FRgA.js +0 -1
- package/dist/chunks/sessionTracing-D7rekMdW.js +0 -11
- package/dist/chunks/settings-8fwIkMDV.js +0 -1
- package/dist/chunks/settings-CodSADx8.js +0 -24
- package/dist/chunks/setup-DBiIrXrh.js +0 -3
- package/dist/chunks/sinks-DH83d_kd.js +0 -1
- package/dist/chunks/skillChangeDetector-BrrZaFkT.js +0 -1
- package/dist/chunks/skills-BRtgqnLz.js +0 -1
- package/dist/chunks/startupProfiler-D1NRu2nj.js +0 -1
- package/dist/chunks/state-D3gvDiu8.js +0 -1
- package/dist/chunks/status-WXA16wIM.js +0 -1
- package/dist/chunks/stringUtils-Bu_lJH5c.js +0 -4
- package/dist/chunks/switcher-5gilU5_R.js +0 -1
- package/dist/chunks/switcher-DMfuKuw_.js +0 -1
- package/dist/chunks/tipRegistry-DtO1H_Wo.js +0 -2
- package/dist/chunks/toolPool-DHS8jWaL.js +0 -1
- package/dist/chunks/types-97nL3naE.js +0 -81
- package/dist/chunks/udsClient-CmYHFiBD.js +0 -1
- package/dist/chunks/urlHandler-DLz3FZm1.js +0 -1
- package/dist/chunks/use-select-navigation-BStVRvcX.js +0 -1
- package/dist/chunks/useMainLoopModel-DSN5HjV1.js +0 -1
- package/dist/chunks/useManagePlugins-ntnOf5OU.js +0 -1
- package/dist/chunks/useMergedTools-C5Yns9Ij.js +0 -1
- package/dist/chunks/util-Bb2S6g9N.js +0 -1
- package/dist/chunks/validatePlugin-D8WQ5z4W.js +0 -1
- package/dist/chunks/worktree-a5oOPSYl.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Pt as e,t}from"./state-BQ4BEGin.js";import{$w as n,AS as r,Cm as i,Gr as a,Ji as o,Jw as s,Ln as c,Nr as l,Or as u,Zp as d,_a as f,am as p,br as m,gr as h,is as g,kr as _,la as v,lr as y,nh as b,nr as x,oa as S,pS as C,rs as w,th as T,ts as E,va as D,wa as O,wm as k,xS as A,zn as j}from"./loadAgentsDir-DGozQu_6.js";import{n as M,t as N}from"./cwd-BvNt_018.js";import{Bt as P,zt as F}from"./settings-CodSADx8.js";import{o as I,s as L}from"./log-DoSpAwRP.js";import{relative as R}from"path";M(),e(),k(),P(),E(),p(),I(),o(),n(),T(),h();function z(e){if(e.type!==`attachment`)return e;let t=e.attachment;if(t.type===`new_file`)return{...e,attachment:{...t,type:`file`,displayPath:R(N(),t.filename)}};if(t.type===`new_directory`)return{...e,attachment:{...t,type:`directory`,displayPath:R(N(),t.path)}};if(!(`displayPath`in t)){let n=`filename`in t?t.filename:`path`in t?t.path:`skillDir`in t?t.skillDir:void 0;if(n)return{...e,attachment:{...t,displayPath:R(N(),n)}}}return e}function B(e){return V(e).messages}function V(e){try{let t=e.map(z),n=new Set(F);for(let e of t)e.type===`user`&&e.permissionMode!==void 0&&!n.has(e.permissionMode)&&(e.permissionMode=void 0);let i=S(f(D(t))),a=H(i),o;if(a.kind===`interrupted_turn`){let[e]=v([A({content:`Continue from where you left off.`,isMeta:!0})]);i.push(e),o={kind:`interrupted_prompt`,message:e}}else o=a;let s=i.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`);return s!==-1&&i[s].type===`user`&&i.splice(s+1,0,C({content:r})),{messages:i,turnInterruptionState:o}}catch(e){throw L(e),e}}function H(e){if(e.length===0)return{kind:`none`};let t=e.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`&&!(e.type===`assistant`&&e.isApiErrorMessage)),n=t===-1?void 0:e[t];return!n||n.type===`assistant`?{kind:`none`}:n.type===`user`?n.isMeta||n.isCompactSummary?{kind:`none`}:O(n)?{kind:`interrupted_turn`}:{kind:`interrupted_prompt`,message:n}:n.type===`attachment`?{kind:`interrupted_turn`}:{kind:`none`}}function U(e){for(let n of e)if(n.type===`attachment`){if(n.attachment.type===`invoked_skills`){let e=n.attachment.skills;for(let n of e)n.name&&n.path&&n.content&&t(n.name,n.path,n.content,null)}n.attachment.type===`skill_listing`&&g()}g(),w()}async function W(e){let{messages:t,leafUuids:n}=await l(e),r=null,i=0;for(let e of t.values()){if(e.isSidechain||!n.has(e.uuid))continue;let t=new Date(e.timestamp).getTime();t>i&&(i=t,r=e)}return r?{messages:a(c(t,r)),sessionId:r.sessionId}:{messages:[],sessionId:void 0}}async function G(e,t){try{let n=null,r=null,a;if(e===void 0){let e=_(),t=new Set;try{let{listAllLiveSessions:e}=await import(`./udsClient-CmYHFiBD.js`),n=await e();t=new Set(n.flatMap(e=>e.kind&&e.kind!==`interactive`&&e.sessionId?[e.sessionId]:[]))}catch{}n=(await e).find(e=>{let n=y(e);return!n||!t.has(n)})??null}else if(t){let e=await W(t);r=e.messages,a=e.sessionId}else typeof e==`string`?(n=await x(e),a=e):n=e;if(!n&&!r)return null;n&&(m(n)&&(n=await u(n)),a||(a=y(n)),a&&await s(n,i(a)),d(n),r=n.messages,j(r)),U(r);let o=V(r);r=o.messages;let c=await b(`resume`,{sessionId:a});return r.push(...c),{messages:r,turnInterruptionState:o.turnInterruptionState,fileHistorySnapshots:n?.fileHistorySnapshots,attributionSnapshots:n?.attributionSnapshots,contentReplacements:n?.contentReplacements,contextCollapseCommits:n?.contextCollapseCommits,contextCollapseSnapshot:n?.contextCollapseSnapshot,sessionId:a,agentName:n?.agentName,agentColor:n?.agentColor,agentSetting:n?.agentSetting,customTitle:n?.customTitle,tag:n?.tag,mode:n?.mode,worktreeSession:n?.worktreeSession,prNumber:n?.prNumber,prUrl:n?.prUrl,prRepository:n?.prRepository,fullPath:n?.fullPath,goal:n?.goal}}catch(e){throw L(e),e}}export{G as n,B as t};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{C as n,D as r,Gr as i,H as a,I as o,P as s,T as c,Wt as l,Xn as u,ai as d,di as f,fi as p,hn as m,k as ee,oi as te,ot as ne,p as h,t as g}from"./src-DL3w8VPk.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as v,at as re,q as ie}from"./state-BQ4BEGin.js";import{BS as y,Cb as ae,Dc as b,Kb as oe,Or as x,Tc as S,VS as se,bi as ce,br as C,ei as le,gr as w,hd as ue,kb as T,lr as E,md as D,qb as de,tr as fe,vr as pe,yi as me}from"./loadAgentsDir-DGozQu_6.js";import{S as he,c as O,i as k,x as ge}from"./debug-CRnGsZOV.js";import{Hn as _e,Ir as ve,Vn as A,kr as ye}from"./settings-CodSADx8.js";import{a as j,o as be,s as xe}from"./log-DoSpAwRP.js";import{n as Se}from"./analytics-COpjZpvd.js";import{S as Ce,_ as M,d as we,p as Te}from"./startupProfiler-DF0AjiDf.js";import{f as Ee,u as De}from"./model-DpZaKZMb.js";import{n as N,t as Oe}from"./TextInput-Cev5Awdd.js";import{n as ke,t as P}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{n as Ae,t as je}from"./select-Fq6g2Ejk.js";import{r as Me,t as Ne}from"./Spinner-VjwI7m_g.js";import{l as Pe,u as Fe}from"./SpinnerGlyph-CqrOK3Mx.js";import{t as Ie}from"./SearchBox-C9xxQzh1.js";import{n as Le,t as Re}from"./useSearchInput-B_mY9wBq.js";import{n as F,t as I}from"./Messages-BFsCpACq.js";function ze({log:e,onExit:t,onSelect:n}){let[i,a]=L.useState(null);L.useEffect(()=>{a(null),C(e)&&x(e).then(a)},[e]);let u=C(e)&&i===null,d=i??e,f=E(d)||``,p=S();return l(`confirm:no`,t,{context:`Confirmation`}),l(`confirm:yes`,(0,L.useCallback)(()=>{n(i??e)},[n,i,e]),{context:`Confirmation`}),u?(0,R.jsxs)(o,{flexDirection:`column`,padding:1,children:[(0,R.jsx)(h,{message:`Loading session…`}),(0,R.jsx)(s,{dimColor:!0,children:(0,R.jsx)(c,{children:(0,R.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,R.jsxs)(o,{flexDirection:`column`,children:[(0,R.jsx)(I,{messages:d.messages,tools:p,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:f,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,R.jsxs)(o,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,R.jsxs)(s,{children:[Te(d.modified),` · `,d.messageCount,` messages`,d.gitBranch?` · ${d.gitBranch}`:``]}),(0,R.jsx)(s,{dimColor:!0,children:(0,R.jsxs)(c,{children:[(0,R.jsx)(r,{shortcut:`Enter`,action:`resume`}),(0,R.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var L,R,Be=e((()=>{L=t(d(),1),g(),ae(),b(),M(),w(),ue(),F(),R=_()}));function z(e,t){if(e===V)return 5;let n=i(e),r=t?Math.min(n,t-H-U):n;return Math.max(0,r)+H+U}function Ve(e,t){let n=t-H-U;return i(e)<=n?e:n<=1?e.charAt(0):Ce(e,n)}function He({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,c=Math.max(qe,G),l=n-a-c-2,u=Math.max(0,Math.min(t,e.length-1)),d=Math.max(20,Math.floor(l/2)),f=e.map(e=>z(e,d)),p=0,m=e.length;if(f.reduce((e,t,n)=>e+t+ +(n<f.length-1),0)>l){let t=l-Ke,n=f[u]??0;for(p=u,m=u+1;p>0||m<e.length;){let r=p>0,i=m<e.length;if(r){let e=(f[p-1]??0)+1;if(n+e<=t){p--,n+=e;continue}}if(i){let e=(f[m]??0)+1;if(n+e<=t){m++,n+=e;continue}}break}}let ee=p,te=e.length-m,ne=e.slice(p,m),h=ne.map((e,t)=>p+t);return(0,B.jsxs)(o,{flexDirection:`row`,gap:1,children:[(0,B.jsx)(s,{color:`suggestion`,children:i}),ee>0&&(0,B.jsxs)(s,{dimColor:!0,children:[W,ee]}),ne.map((e,t)=>{let n=h[t]===u,r=e===V?e:`#${Ve(e,d-H)}`;return(0,B.jsxs)(s,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),te>0?(0,B.jsxs)(s,{dimColor:!0,children:[Ue,te,We]}):(0,B.jsx)(s,{dimColor:!0,children:Ge})]})}var B,V,H,U,W,Ue,We,Ge,Ke,qe,G,K=e((()=>{g(),M(),B=_(),V=`All`,H=2,U=1,W=`← `,Ue=`→`,We=` (tab to cycle)`,Ge=`(tab to cycle)`,Ke=5,qe=18,G=14}));function Je({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:s=`expanded`,isDisabled:c=!1,hideIndexes:l=!1,isNodeExpanded:u,onExpand:d,onCollapse:f,getParentPrefix:p,getChildPrefix:m,onUpFromFirstItem:ee}){let[te,ne]=q.useState(new Set),h=q.useRef(!1),g=q.useRef(null),_=q.useCallback(e=>u?u(e):te.has(e),[u,te]),v=q.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=_(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,_]),re=q.useCallback(e=>e?`▼ `:`▶ `,[]),ie=q.useCallback(e=>` ▸ `,[]),y=p??re,ae=m??ie,b=q.useCallback(e=>{let t=``;return e.hasChildren?t=y(e.isExpanded):e.depth>0&&(t=ae(e.depth)),t+e.node.label},[y,ae]),oe=q.useMemo(()=>v.map(e=>({label:b(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[v,b]),x=q.useMemo(()=>{let e=new Map;return v.forEach(t=>e.set(t.node.id,t.node)),e},[v]),S=q.useCallback(e=>v.find(t=>t.node.id===e),[v]),se=q.useCallback((e,t)=>{S(e)?.hasChildren&&(t?d?d(e):ne(t=>new Set(t).add(e)):f?f(e):ne(t=>{let n=new Set(t);return n.delete(e),n}))},[S,d,f]);return(0,Ye.jsx)(o,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||c)return;let t=S(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),se(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),se(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,se(t.parentId,!1),r)){let e=x.get(t.parentId);e&&r(e)}}}},children:(0,Ye.jsx)(je,{options:oe,onChange:q.useCallback(e=>{let n=x.get(e);n&&t(n)},[x,t]),onFocus:q.useCallback(e=>{if(h.current){h.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=x.get(e);t&&r(t)}},[r,x]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:s,isDisabled:c,hideIndexes:l,onUpFromFirstItem:ee})})}var q,Ye,Xe=e((()=>{q=t(d(),1),g(),Ae(),Ye=_()}));function Ze(e,t){return Ce(e.replace(/\s+/g,` `).trim(),t)}function Qe({before:e,match:t,after:n},r){return f.dim(e)+r(t)+f.dim(n)}function $e(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function et(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?st:i?ct:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${Ze(j(e),l)}${c}${s}`}function tt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=we(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function nt({logs:e,maxHeight:t=1/0,forceWidth:i,onCancel:d,onSelect:f,onLogsChanged:p,onLoadMore:h,initialSearchQuery:g,showAllProjects:_=!1,onToggleAllProjects:v,onAgenticSearch:y}){let ae=ne(),b=i===void 0?ae.columns:i,oe=ke(d),x=u(),S=pe(),[se]=a(),ce=Pe(se),C=J.useMemo(()=>e=>te(e,ce.warning),[ce.warning]),[w,ue]=J.useState(null),[T,de]=J.useState(!1),[he,O]=J.useState(!1),[k,ge]=J.useState(!1),_e=J.useMemo(()=>ie(),[]),[ve,A]=J.useState(``),[be,xe]=J.useState(0),[Se,Ce]=J.useState(new Set),[M,Te]=J.useState(null),[Ee,De]=J.useState(1),[N,P]=J.useState(`list`),[Ae,Me]=J.useState(null),Fe=J.useRef(null),[Ie,Re]=J.useState(0),[F,I]=J.useState({status:`idle`}),[L,R]=J.useState(!1),Be=J.useRef(null),{query:z,setQuery:Ve,cursorOffset:B}=Le({isActive:N===`search`&&F.status!==`searching`,onExit:()=>{P(`list`)},onExitUp:()=>{P(`list`)},passthroughCtrlKeys:[`n`],initialQuery:g||``}),V=J.useDeferredValue(z),[H,U]=J.useState(``);J.useEffect(()=>{if(!V){U(``);return}let e=setTimeout(U,300,V);return()=>clearTimeout(e)},[V]);let[W,Ue]=J.useState(null),[We,Ge]=J.useState(!1);J.useEffect(()=>{ye().then(e=>ue(e)),me(_e).then(e=>{ge(e.length>1)})},[_e]);let Ke=J.useMemo(()=>new Map(e.map(e=>[e,it(e)])),[e]),qe=J.useMemo(()=>null,[e,Ke,!1]),G=J.useMemo(()=>ot(e),[e]),K=G.length>0,q=J.useMemo(()=>K?[`All`,...G]:[],[K,G]),Ye=q.length>0&&Ie<q.length?Ie:0,Xe=q[Ye],nt=Xe===`All`?void 0:Xe,rt=+!!K,st=J.useMemo(()=>{let t=e;return S&&(t=e.filter(e=>{let t=re(),n=E(e);return!!(t&&n===t||e.customTitle||fe(e.messages)||e.firstPrompt||e.customTitle)})),nt!==void 0&&(t=t.filter(e=>e.tag===nt)),T&&w&&(t=t.filter(e=>e.gitBranch===w)),k&&!he&&(t=t.filter(e=>e.projectPath===_e)),t},[e,S,nt,T,w,k,he,_e]),ct=J.useMemo(()=>{if(!z)return st;let e=z.toLowerCase();return st.filter(t=>{let n=j(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[st,z]);J.useEffect(()=>{},[V,H,!1]),J.useEffect(()=>{Ue(null),Ge(!1)},[H,qe,!1]);let{filteredLogs:lt,snippets:X}=J.useMemo(()=>{let e=new Map,t=ct;if(W&&H&&W.query===H){for(let t of W.results)if(t.searchableText){let n=$e(t.searchableText,H,ut);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=W.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ct,W,H]),Z=J.useMemo(()=>F.status===`results`&&F.results.length>0?F.results:lt,[F,lt]),Q=Math.max(30,b-4),dt=J.useMemo(()=>{if(!S)return[];let e=at(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?Qe(i,C):null;if(t.length===1){let t=tt(n,{showProjectPath:_});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:et(n,Q),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=Z.indexOf(t),i=X.get(t),a=i?Qe(i,C):null,o=tt(t,{isChild:!0,showProjectPath:_});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:et(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=tt(n,{showProjectPath:_});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:et(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[S,Z,Q,_,X,C]),ft=J.useMemo(()=>S?[]:Z.map((e,t)=>{let n=Ze(j(e)+(e.isSidechain?` (sidechain)`:``),Q),r=we(e),i=_&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?Qe(a,C):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[S,Z,C,Q,_,X]),$=M?.value.log??null,pt=()=>{if(!S||!$)return``;let e=E($);if(!e)return``;let t=Z.filter(t=>E(t)===e);if(!(t.length>1))return``;let n=Se.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},mt=J.useCallback(async()=>{let e=$?E($):void 0;if(!$||!e){P(`list`),A(``);return}ve.trim()&&(await le(e,ve.trim(),$.fullPath),S&&p&&p()),P(`list`),A(``)},[$,ve,p,S]),ht=J.useCallback(()=>{P(`list`)},[]),gt=J.useCallback(()=>{P(`search`)},[]),_t=J.useCallback(async()=>{if(!z.trim()||!y||!0)return;Be.current?.abort();let t=new AbortController;Be.current=t,I({status:`searching`}),z.length;try{let n=await y(z,e,t.signal);if(t.signal.aborted)return;I({status:`results`,results:n,query:z}),z.length,n.length}catch(e){if(t.signal.aborted)return;I({status:`error`,message:e instanceof Error?e.message:`Search failed`}),z.length}},[z,y,!1,e]);J.useEffect(()=>{F.status!==`idle`&&F.status!==`searching`&&(F.status===`results`&&F.query!==z||F.status===`error`)&&I({status:`idle`})},[z,F]),J.useEffect(()=>()=>{Be.current?.abort()},[]);let vt=J.useRef(F.status);J.useEffect(()=>{let e=vt.current;if(vt.current=F.status,e===`searching`&&F.status===`results`){if(S&&dt.length>0)Te(dt[0]);else if(!S&&Z.length>0){let e=Z[0];Te({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[F.status,S,dt,Z]);let yt=J.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Fe.current===t.toString()||(Fe.current=t.toString(),Te({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),De(t+1))},[Z]),bt=J.useCallback(e=>{Te(e);let t=Z.findIndex(t=>E(t)===E(e.value.log));t>=0&&De(t+1)},[Z]);l(`confirm:no`,()=>{Be.current?.abort(),I({status:`idle`})},{context:`Confirmation`,isActive:N!==`preview`&&F.status===`searching`}),l(`confirm:no`,()=>{P(`list`),A(``)},{context:`Settings`,isActive:N===`rename`&&F.status!==`searching`}),l(`confirm:no`,()=>{Ve(``),R(!1),d?.()},{context:`Confirmation`,isActive:N!==`preview`&&N!==`rename`&&N!==`search`&&L&&F.status!==`searching`}),m((e,t)=>{if(N!==`preview`&&F.status!==`searching`&&N!==`rename`)if(N===`search`)e.toLowerCase()===`n`&&t.ctrl?ht():(t.return||t.downArrow)&&z.trim();else{if(L){if(t.return){_t(),R(!1);return}else if(t.downArrow){R(!1);return}else if(t.upArrow){P(`search`),R(!1);return}}if(K&&t.tab){let e=t.shift?-1:1;Re(t=>{let n=((t<q.length?t:0)+q.length+e)%q.length;return q[n],G.length,n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();r===`a`&&t.ctrl&&v?v():r===`b`&&t.ctrl?de(!T):r===`w`&&t.ctrl&&k?O(!he):r===`/`&&n?P(`search`):r===`r`&&t.ctrl&&$?(P(`rename`),A(``)):r===`v`&&t.ctrl&&$?(Me($),P(`preview`),$.messageCount):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(P(`search`),Ve(e))}},{isActive:!0});let xt=[];T&&w&&xt.push(w),k&&!he&&xt.push(`current worktree`);let St=8+ +(xt.length>0&&N!==`search`)+rt,Ct=Math.max(1,Math.floor((t-St-2)/3));return J.useEffect(()=>{if(!h)return;let e=Ct*2;Ee+e>=Z.length&&h(Ct*3)},[Ee,Ct,Z.length,h]),e.length===0?null:N===`preview`&&Ae&&S?(0,Y.jsx)(ze,{log:Ae,onExit:()=>{P(`list`),Me(null)},onSelect:f}):(0,Y.jsxs)(o,{flexDirection:`column`,height:t-1,children:[(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(n,{color:`suggestion`})}),(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(s,{children:` `})}),K?(0,Y.jsx)(He,{tabs:q,selectedIndex:Ye,availableWidth:b,showAllProjects:_}):(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsxs)(s,{bold:!0,color:`suggestion`,children:[`Resume Session`,N===`list`&&Z.length>Ct&&(0,Y.jsxs)(s,{dimColor:!0,children:[` `,`(`,Ee,` of `,Z.length,`)`]})]})}),(0,Y.jsx)(ee,{query:z,isFocused:N===`search`,isTerminalFocused:x,cursorOffset:B}),xt.length>0&&N!==`search`&&(0,Y.jsx)(o,{flexShrink:0,paddingLeft:2,children:(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsx)(c,{children:xt})})}),(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(s,{children:` `})}),F.status===`searching`&&(0,Y.jsxs)(o,{paddingLeft:1,flexShrink:0,children:[(0,Y.jsx)(Ne,{}),(0,Y.jsx)(s,{children:` Searching…`})]}),F.status===`results`&&F.results.length>0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),F.status===`results`&&F.results.length===0&<.length===0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),F.status===`error`&<.length===0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!z.trim()&&y&&!1,F.status===`searching`?null:N===`rename`&&$?(0,Y.jsxs)(o,{paddingLeft:2,flexDirection:`column`,children:[(0,Y.jsx)(s,{bold:!0,children:`Rename session:`}),(0,Y.jsx)(o,{paddingTop:1,children:(0,Y.jsx)(Oe,{value:ve,onChange:A,onSubmit:mt,placeholder:j($,`Enter new session name`),columns:b,cursorOffset:be,onChangeCursorOffset:xe,showCursor:!0})})]}):S?(0,Y.jsx)(Je,{nodes:dt,onSelect:e=>{f(e.value.log)},onFocus:bt,onCancel:d,focusNodeId:M?.id,visibleOptionCount:Ct,layout:`expanded`,isDisabled:N===`search`||L,hideIndexes:!1,isNodeExpanded:e=>{if(N===`search`||T)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Se.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Ce(e=>new Set(e).add(t))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Ce(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:gt}):(0,Y.jsx)(je,{options:ft,onChange:e=>{let t=Z[parseInt(e,10)];t&&f(t)},visibleOptionCount:Ct,onCancel:d,onFocus:yt,defaultFocusValue:M?.id.toString(),layout:`expanded`,isDisabled:N===`search`||L,onUpFromFirstItem:gt}),(0,Y.jsx)(o,{paddingLeft:2,children:oe.pending?(0,Y.jsxs)(s,{dimColor:!0,children:[`Press `,oe.keyName,` again to exit`]}):N===`rename`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(r,{shortcut:`Enter`,action:`save`}),(0,Y.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):F.status===`searching`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(s,{children:`Searching with Work Mate…`}),(0,Y.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):L?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(r,{shortcut:`Enter`,action:`search`}),(0,Y.jsx)(r,{shortcut:`↓`,action:`skip`}),(0,Y.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):N===`search`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(s,{children:`Type to Search`}),(0,Y.jsx)(r,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[v&&(0,Y.jsx)(r,{shortcut:`Ctrl+A`,action:`show ${_?`current dir`:`all projects`}`}),w&&(0,Y.jsx)(r,{shortcut:`Ctrl+B`,action:`toggle branch`}),k&&(0,Y.jsx)(r,{shortcut:`Ctrl+W`,action:`show ${he?`current worktree`:`all worktrees`}`}),(0,Y.jsx)(r,{shortcut:`Ctrl+V`,action:`preview`}),(0,Y.jsx)(r,{shortcut:`Ctrl+R`,action:`rename`}),(0,Y.jsx)(s,{children:`Type to search`}),(0,Y.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),pt()&&(0,Y.jsx)(s,{children:pt()})]})})})]})}function rt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function it(e){let t=(e.messages.length<=lt?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(rt).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>Z?n.slice(0,Z):n}function at(e){let t=new Map;for(let n of e){let e=E(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function ot(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var J,Y,st,ct,lt,X,Z,ut,Q=e((()=>{p(),J=t(d(),1),v(),P(),Re(),T(),g(),ae(),Se(),M(),ce(),ve(),be(),w(),Fe(),ue(),Ae(),Ie(),Be(),Me(),K(),N(),Xe(),Y=_(),st=2,ct=4,lt=2e3,X=1e3,Z=5e4,ut=50}));function dt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function ft(e){if(e.length===0)return``;let t=(e.length<=ht?e:[...e.slice(0,ht/2),...e.slice(-100/2)]).map(dt).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>mt?`${t.slice(0,mt)}…`:t}function $(e,t){return!!(j(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&ft(e.messages).toLowerCase().includes(t))}async function pt(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>$(e,r)),a;if(i.length>=gt)a=i.slice(0,gt);else{let e=t.filter(e=>!$(e,r)),n=gt-i.length;a=[...i,...e.slice(0,n)]}O(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${A(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(C(e))try{return await x(e)}catch(t){return xe(t),e}return e}),s=await Promise.all(o);O(`Agentic search: loaded ${A(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
|
|
2
|
-
${s.map((e,t)=>{let n=[`${t}:`],r=j(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=ft(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
|
|
3
|
-
`)}
|
|
4
|
-
|
|
5
|
-
Search query: "${e}"
|
|
6
|
-
|
|
7
|
-
Find the sessions that are most relevant to this query.`;O(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=De();O(`Agentic search using model: ${e}`);let t=(await se({model:e,system:_t,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return O(`No text content in agentic search response`),[];O(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return O(`Could not find JSON in agentic search response`),[];let i=(he(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return O(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return xe(e),O(`Agentic search error: ${e}`),[]}}var mt,ht,gt,_t,vt=e((()=>{_e(),k(),be(),Ee(),w(),y(),ge(),mt=2e3,ht=100,gt=100,_t=`Your goal is to find relevant sessions based on a user's search query.
|
|
8
|
-
|
|
9
|
-
You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
|
|
10
|
-
|
|
11
|
-
Each session may include:
|
|
12
|
-
- Title (display name or custom title)
|
|
13
|
-
- Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
|
|
14
|
-
- Branch (git branch name, shown as [branch: name])
|
|
15
|
-
- Summary (AI-generated summary)
|
|
16
|
-
- First message (beginning of the conversation)
|
|
17
|
-
- Transcript (excerpt of conversation content)
|
|
18
|
-
|
|
19
|
-
IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
|
|
20
|
-
|
|
21
|
-
For each session, consider (in order of priority):
|
|
22
|
-
1. Exact tag matches (highest priority - user explicitly categorized this session)
|
|
23
|
-
2. Partial tag matches or tag-related terms
|
|
24
|
-
3. Title matches (custom titles or first message content)
|
|
25
|
-
4. Branch name matches
|
|
26
|
-
5. Summary and transcript content matches
|
|
27
|
-
6. Semantic similarity and related concepts
|
|
28
|
-
|
|
29
|
-
CRITICAL: Be VERY inclusive in your matching. Include sessions that:
|
|
30
|
-
- Contain the query term anywhere in any field
|
|
31
|
-
- Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
|
|
32
|
-
- Discuss topics that could be related to the query
|
|
33
|
-
- Have transcripts that mention the concept even in passing
|
|
34
|
-
|
|
35
|
-
When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
|
|
36
|
-
|
|
37
|
-
Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
|
|
38
|
-
|
|
39
|
-
Respond with ONLY the JSON object, no markdown formatting:
|
|
40
|
-
{"relevant_indices": [2, 5, 0]}`}));function yt(e,t){let n=ie();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=E(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${de([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var bt=e((()=>{v(),oe(),w()}));export{nt as a,vt as i,bt as n,Q as o,pt as r,yt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./cwd-BvNt_018.js";e();export{t as getCwd};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-BvNt_018.js";import{c as r,i}from"./debug-CRnGsZOV.js";import{Ir as a,Nr as o}from"./settings-CodSADx8.js";function s(){f.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=n();if(f.has(e))return f.get(e)??null;try{let t=await o();if(r(`Git remote URL: ${t}`),!t)return r(`No git remote URL found`),f.set(e,null),null;let n=u(t);return r(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),f.set(e,n),n}catch(t){return r(`Error detecting repository: ${t}`),f.set(e,null),null}}function u(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return d(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return d(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function d(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var f,p=e((()=>{t(),i(),a(),f=new Map}));export{c as n,p as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{v as t,y as n}from"./types-97nL3naE.js";import{n as r,t as i}from"./cwd-BvNt_018.js";import{f as a,u as o}from"./debug-CRnGsZOV.js";import{er as s,nr as c}from"./settings-CodSADx8.js";import{o as l,s as u}from"./log-DoSpAwRP.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||i(),prefix:``};let n=s(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:n,prefix:``}:{directory:f(n),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await o().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return u(e),[]}}async function _(e,t={}){let{basePath:n=i(),maxResults:r=10}=t,{directory:a,prefix:o}=h(e,n),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,r).map(e=>({id:e.path,displayText:`${e.name}/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,r=w.get(n);if(r)return r;try{let r=(await o().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,r),r}catch(e){return u(e),[]}}async function b(e,t={}){let{basePath:n=i(),maxResults:r=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,n),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,r),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.${m}`))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?`${t}/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{n(),r(),a(),l(),c(),x=500,S=300*1e3,C=new t({max:x,ttl:S}),w=new t({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-uvO6NM5m.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{B as n,J as r,N as i,P as a,Q as o,R as s,U as c,W as l,X as u,Z as d,b as f,et as p,k as m}from"./types-97nL3naE.js";import{$n as h,Hn as g,Pt as _,Qn as ee,Tn as v,ot as y,q as b}from"./state-BQ4BEGin.js";import{B as te,Dc as ne,Di as re,Ds as ie,Ec as ae,Mi as oe,Os as se,Ug as ce,V as le,Xl as ue,Yl as de,gr as x,i as fe,nr as S,o as pe,zg as me}from"./loadAgentsDir-DGozQu_6.js";import{_r as C,d as he,h as ge,pr as _e,sr as ve}from"./settings-CodSADx8.js";import{d as ye,n as be}from"./config-CWPHVTic.js";import{f as xe,s as Se}from"./model-DpZaKZMb.js";import{_n as Ce,vn as we}from"./prompt-DzO1um1h.js";import{t as w}from"./conversationRecovery-BBJzrA0g.js";import{t as Te}from"./QueryEngine-egz5mbaW.js";import{n as Ee,r as De}from"./modelOptions-CXBfKFXA.js";import{n as Oe,r as ke}from"./managedEnv-CIWJsuty.js";import{dirname as Ae}from"node:path";import{randomUUID as T}from"node:crypto";import{Readable as je,Writable as Me}from"node:stream";import{unlink as Ne}from"node:fs/promises";import*as E from"node:path/posix";import{isAbsolute as Pe,resolve as Fe}from"node:path/posix";f();var D={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},O={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},Ie=l({_meta:r(u(),o()).nullish(),terminal:a().optional().default(!1)}),Le=l({_meta:r(u(),o()).nullish(),label:u().nullish(),name:u(),optional:a().optional().default(!1),secret:a().optional().default(!0)}),Re=l({_meta:r(u(),o()).nullish(),description:u().nullish(),id:u(),name:u()}),ze=l({_meta:r(u(),o()).nullish(),description:u().nullish(),id:u(),link:u().nullish(),name:u(),vars:i(Le)}),Be=l({_meta:r(u(),o()).nullish(),args:i(u()).optional(),description:u().nullish(),env:r(u(),u()).optional(),id:u(),name:u()}),Ve=d([ze.and(l({type:n(`env_var`)})),Be.and(l({type:n(`terminal`)})),Re]),He=l({_meta:r(u(),o()).nullish(),methodId:u()}),Ue=l({_meta:r(u(),o()).nullish()}),We=l({_meta:r(u(),o()).nullish(),blob:u(),mimeType:u().nullish(),uri:u()}),Ge=l({default:a().nullish(),description:u().nullish(),title:u().nullish()}),Ke=l({_meta:r(u(),o()).nullish()}),qe=l({_meta:r(u(),o()).nullish()}),Je=l({amount:c(),currency:u()}),Ye=l({_meta:r(u(),o()).nullish(),terminalId:u()}),Xe=l({_meta:r(u(),o()).nullish(),newText:u(),oldText:u().nullish(),path:u()}),Ze=d([u(),c(),c(),a(),i(u())]),Qe=s(d([l({content:r(u(),Ze).nullish()}).and(l({action:n(`accept`)})),l({action:n(`decline`)}),l({action:n(`cancel`)})]),l({_meta:r(u(),o()).nullish()})),$e=l({_meta:r(u(),o()).nullish()}),et=u(),tt=l({_meta:r(u(),o()).nullish(),elicitationId:et}),nt=n(`object`),rt=n(`string`),it=l({_meta:r(u(),o()).nullish()}),at=l({_meta:r(u(),o()).nullish(),form:$e.nullish(),url:it.nullish()}),ot=l({const:u(),title:u()}),st=l({_meta:r(u(),o()).nullish(),name:u(),value:u()}),ct=l({code:d([n(-32700),n(-32600),n(-32601),n(-32602),n(-32603),n(-32800),n(-32e3),n(-32002),n(-32042),c().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:o().optional(),message:u()}),lt=o(),ut=o(),dt=o(),ft=l({_meta:r(u(),o()).nullish(),readTextFile:a().optional().default(!1),writeTextFile:a().optional().default(!1)}),pt=l({_meta:r(u(),o()).nullish(),name:u(),value:u()}),mt=l({_meta:r(u(),o()).nullish(),name:u(),title:u().nullish(),version:u()}),ht=l({default:c().nullish(),description:u().nullish(),maximum:c().nullish(),minimum:c().nullish(),title:u().nullish()}),gt=l({_meta:r(u(),o()).nullish()}),_t=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cursor:u().nullish(),cwd:u().nullish()}),vt=l({_meta:r(u(),o()).nullish()}),yt=l({_meta:r(u(),o()).nullish(),logout:vt.nullish()}),bt=l({_meta:r(u(),o()).nullish()}),xt=l({_meta:r(u(),o()).nullish()}),St=l({_meta:r(u(),o()).nullish(),http:a().optional().default(!1),sse:a().optional().default(!1)}),Ct=l({_meta:r(u(),o()).nullish(),headers:i(pt),name:u(),url:u()}),wt=l({_meta:r(u(),o()).nullish(),headers:i(pt),name:u(),url:u()}),Tt=l({_meta:r(u(),o()).nullish(),args:i(u()),command:u(),env:i(st),name:u()}),k=d([Ct.and(l({type:n(`http`)})),wt.and(l({type:n(`sse`)})),Tt]),A=u(),Et=l({_meta:r(u(),o()).nullish(),description:u().nullish(),modelId:A,name:u()}),Dt=d([n(`error`),n(`warning`),n(`information`),n(`hint`)]),Ot=l({_meta:r(u(),o()).nullish()}),kt=l({_meta:r(u(),o()).nullish()}),At=l({_meta:r(u(),o()).nullish()}),jt=l({_meta:r(u(),o()).nullish()}),Mt=l({_meta:r(u(),o()).nullish()}),Nt=l({_meta:r(u(),o()).nullish(),maxCount:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=l({diff:u(),uri:u()}),Ft=l({endLine:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:u()}),It=l({_meta:r(u(),o()).nullish()}),Lt=l({_meta:r(u(),o()).nullish()}),Rt=l({languageId:u(),text:u(),uri:u()}),zt=l({_meta:r(u(),o()).nullish(),maxCount:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Bt=d([n(`rejected`),n(`ignored`),n(`replaced`),n(`cancelled`)]),Vt=l({excerpts:i(Ft),uri:u()}),Ht=l({_meta:r(u(),o()).nullish()}),Ut=l({_meta:r(u(),o()).nullish()}),Wt=l({name:u(),owner:u(),remoteUrl:u()}),Gt=l({_meta:r(u(),o()).nullish()}),Kt=l({_meta:r(u(),o()).nullish(),jump:It.nullish(),rename:Ut.nullish(),searchAndReplace:Gt.nullish()}),qt=l({id:u(),isRegex:a().nullish(),replace:u(),search:u(),uri:u()}),Jt=d([n(`automatic`),n(`diagnostic`),n(`manual`)]),Yt=l({_meta:r(u(),o()).nullish(),maxCount:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Xt=l({_meta:r(u(),o()).nullish(),diagnostics:Ot.nullish(),editHistory:Nt.nullish(),openFiles:Lt.nullish(),recentFiles:zt.nullish(),relatedSnippets:Ht.nullish(),userActions:Yt.nullish()}),Zt=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k)}),Qt=l({default:c().nullish(),description:u().nullish(),maximum:c().nullish(),minimum:c().nullish(),title:u().nullish()}),$t=u(),en=d([n(`allow_once`),n(`allow_always`),n(`reject_once`),n(`reject_always`)]),tn=l({_meta:r(u(),o()).nullish(),kind:en,name:u(),optionId:$t}),nn=d([n(`high`),n(`medium`),n(`low`)]),rn=d([n(`pending`),n(`in_progress`),n(`completed`)]),an=l({_meta:r(u(),o()).nullish(),content:u(),priority:nn,status:rn}),on=l({_meta:r(u(),o()).nullish(),entries:i(an)}),j=l({character:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),sn=l({id:u(),position:j,uri:u()}),cn=l({id:u(),newName:u(),position:j,uri:u()}),ln=l({action:u(),position:j,timestampMs:c(),uri:u()}),M=d([n(`utf-16`),n(`utf-32`),n(`utf-8`)]),un=l({_meta:r(u(),o()).nullish(),auth:Ie.optional().default({terminal:!1}),elicitation:at.nullish(),fs:ft.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Kt.nullish(),positionEncodings:i(M).optional(),terminal:a().optional().default(!1)}),dn=l({_meta:r(u(),o()).nullish(),audio:a().optional().default(!1),embeddedContext:a().optional().default(!1),image:a().optional().default(!1)}),fn=c().int().gte(0).lte(65535),pn=l({_meta:r(u(),o()).nullish(),clientCapabilities:un.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:mt.nullish(),protocolVersion:fn}),N=l({end:j,start:j}),mn=l({message:u(),range:N,severity:Dt,uri:u()}),hn=l({languageId:u(),lastFocusedMs:c().nullish(),uri:u(),visibleRange:N.nullish()}),gn=l({_meta:r(u(),o()).nullish(),diagnostics:i(mn).nullish(),editHistory:i(Pt).nullish(),openFiles:i(hn).nullish(),recentFiles:i(Rt).nullish(),relatedSnippets:i(Vt).nullish(),userActions:i(ln).nullish()}),_n=l({newText:u(),range:N}),vn=d([l({cursorPosition:j.nullish(),edits:i(_n),id:u(),uri:u()}).and(l({kind:n(`edit`)})),sn.and(l({kind:n(`jump`)})),cn.and(l({kind:n(`rename`)})),qt.and(l({kind:n(`searchAndReplace`)}))]),yn=l({_meta:r(u(),o()).nullish(),content:u()}),bn=l({_meta:r(u(),o()).nullish()}),P=d([c(),u()]).nullable();l({_meta:r(u(),o()).nullish(),requestId:P});var xn=l({requestId:P}),Sn=m([`assistant`,`user`]),F=l({_meta:r(u(),o()).nullish(),audience:i(Sn).nullish(),lastModified:u().nullish(),priority:c().nullish()}),Cn=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),data:u(),mimeType:u()}),wn=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),data:u(),mimeType:u(),uri:u().nullish()}),Tn=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),description:u().nullish(),mimeType:u().nullish(),name:u(),size:c().nullish(),title:u().nullish(),uri:u()}),En=l({_meta:r(u(),o()).nullish(),optionId:$t}),Dn=d([l({outcome:n(`cancelled`)}),En.and(l({outcome:n(`selected`)}))]),On=l({_meta:r(u(),o()).nullish(),outcome:Dn}),kn=l({_meta:r(u(),o()).nullish()}),An=l({_meta:r(u(),o()).nullish()}),jn=l({currentValue:a()}),Mn=u(),Nn=u(),Pn=d([n(`mode`),n(`model`),n(`thought_level`),u()]),I=u(),Fn=l({_meta:r(u(),o()).nullish(),description:u().nullish(),name:u(),value:I}),In=l({_meta:r(u(),o()).nullish(),group:Mn,name:u(),options:i(Fn)}),L=s(d([l({currentValue:I,options:d([i(Fn),i(In)])}).and(l({type:n(`select`)})),jn.and(l({type:n(`boolean`)}))]),l({_meta:r(u(),o()).nullish(),category:Pn.nullish(),description:u().nullish(),id:Nn,name:u()})),Ln=l({_meta:r(u(),o()).nullish(),configOptions:i(L)}),Rn=l({_meta:r(u(),o()).nullish()}),R=u(),zn=l({_meta:r(u(),o()).nullish(),id:u(),sessionId:R}),Bn=l({_meta:r(u(),o()).nullish(),sessionId:R}),Vn=l({_meta:r(u(),o()).nullish(),sessionId:R}),Hn=l({_meta:r(u(),o()).nullish(),sessionId:R}),Un=l({_meta:r(u(),o()).nullish(),args:i(u()).optional(),command:u(),cwd:u().nullish(),env:i(st).optional(),outputByteLimit:c().nullish(),sessionId:R}),Wn=l({_meta:r(u(),o()).nullish(),sessionId:R,uri:u()}),Gn=l({_meta:r(u(),o()).nullish(),position:j,sessionId:R,uri:u(),version:c(),visibleRange:N}),Kn=l({_meta:r(u(),o()).nullish(),languageId:u(),sessionId:R,text:u(),uri:u(),version:c()}),qn=l({_meta:r(u(),o()).nullish(),sessionId:R,uri:u()}),Jn=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k).optional(),sessionId:R}),Yn=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),Xn=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k),sessionId:R}),Zn=l({_meta:r(u(),o()).nullish(),limit:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:u(),sessionId:R}),Qn=l({_meta:r(u(),o()).nullish(),id:u(),reason:Bt.nullish(),sessionId:R}),$n=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),er=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k).optional(),sessionId:R}),tr=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),sessionId:R,title:u().nullish(),updatedAt:u().nullish()}),nr=l({_meta:r(u(),o()).nullish(),nextCursor:u().nullish(),sessions:i(tr)}),rr=l({_meta:r(u(),o()).nullish(),title:u().nullish(),updatedAt:u().nullish()}),ir=l({_meta:r(u(),o()).nullish()}),z=u(),ar=l({_meta:r(u(),o()).nullish(),currentModeId:z}),or=l({_meta:r(u(),o()).nullish(),description:u().nullish(),id:z,name:u()}),B=l({_meta:r(u(),o()).nullish(),availableModes:i(or),currentModeId:z}),V=l({_meta:r(u(),o()).nullish(),availableModels:i(Et),currentModelId:A}),sr=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),cr=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish()}),lr=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),ur=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish()}),dr=l({_meta:r(u(),o()).nullish()}),fr=l({_meta:r(u(),o()).nullish(),additionalDirectories:kn.nullish(),close:An.nullish(),fork:Rn.nullish(),list:ir.nullish(),resume:dr.nullish()}),pr=s(d([l({type:n(`boolean`),value:a()}),l({value:I})]),l({_meta:r(u(),o()).nullish(),configId:Nn,sessionId:R})),mr=l({_meta:r(u(),o()).nullish(),configOptions:i(L)}),hr=l({_meta:r(u(),o()).nullish(),modeId:z,sessionId:R}),gr=l({_meta:r(u(),o()).nullish()}),_r=l({_meta:r(u(),o()).nullish(),modelId:A,sessionId:R}),vr=l({_meta:r(u(),o()).nullish()}),yr=l({_meta:r(u(),o()).nullish(),sessionId:R}),br=d([n(`end_turn`),n(`max_tokens`),n(`max_turn_requests`),n(`refusal`),n(`cancelled`)]),xr=d([n(`email`),n(`uri`),n(`date`),n(`date-time`)]),Sr=l({default:u().nullish(),description:u().nullish(),enum:i(u()).nullish(),format:xr.nullish(),maxLength:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:i(ot).nullish(),pattern:u().nullish(),title:u().nullish()}),Cr=l({_meta:r(u(),o()).nullish(),context:gn.nullish(),position:j,selection:N.nullish(),sessionId:R,triggerKind:Jt,uri:u(),version:c()}),wr=l({_meta:r(u(),o()).nullish(),suggestions:i(vn)}),Tr=l({_meta:r(u(),o()).nullish(),terminalId:u()}),Er=l({_meta:r(u(),o()).nullish(),exitCode:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:u().nullish()}),Dr=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),Or=l({_meta:r(u(),o()).nullish(),exitStatus:Er.nullish(),output:u(),truncated:a()}),kr=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),text:u()}),Ar=l({range:N.nullish(),text:u()}),jr=l({_meta:r(u(),o()).nullish(),contentChanges:i(Ar),sessionId:R,uri:u(),version:c()});l({method:u(),params:d([Bn,Kn,jr,Wn,qn,Gn,zn,Qn,lt]).nullish()});var Mr=d([n(`full`),n(`incremental`)]),Nr=l({_meta:r(u(),o()).nullish(),syncKind:Mr}),Pr=l({_meta:r(u(),o()).nullish(),didChange:Nr.nullish(),didClose:kt.nullish(),didFocus:At.nullish(),didOpen:jt.nullish(),didSave:Mt.nullish()}),Fr=l({_meta:r(u(),o()).nullish(),document:Pr.nullish()}),Ir=l({_meta:r(u(),o()).nullish(),context:Xt.nullish(),events:Fr.nullish()}),Lr=l({_meta:r(u(),o()).nullish(),auth:yt.optional().default({}),loadSession:a().optional().default(!1),mcpCapabilities:St.optional().default({http:!1,sse:!1}),nes:Ir.nullish(),positionEncoding:M.nullish(),promptCapabilities:dn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:fr.optional().default({})}),Rr=l({_meta:r(u(),o()).nullish(),agentCapabilities:Lr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:mt.nullish(),authMethods:i(Ve).optional().default([]),protocolVersion:fn}),zr=d([l({_meta:r(u(),o()).nullish(),mimeType:u().nullish(),text:u(),uri:u()}),We]),Br=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),resource:zr}),H=d([kr.and(l({type:n(`text`)})),wn.and(l({type:n(`image`)})),Cn.and(l({type:n(`audio`)})),Tn.and(l({type:n(`resource_link`)})),Br.and(l({type:n(`resource`)}))]),Vr=l({_meta:r(u(),o()).nullish(),content:H}),U=l({_meta:r(u(),o()).nullish(),content:H,messageId:u().nullish()}),Hr=l({_meta:r(u(),o()).nullish(),messageId:u().nullish(),prompt:i(H),sessionId:R}),Ur=l({anyOf:i(ot)}),Wr=d([Vr.and(l({type:n(`content`)})),Xe.and(l({type:n(`diff`)})),Tr.and(l({type:n(`terminal`)}))]),W=u(),Gr=l({sessionId:R,toolCallId:W.nullish()}),Kr=s(d([Gr,xn]),l({elicitationId:et,url:u().url()})),qr=l({_meta:r(u(),o()).nullish(),line:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:u()}),Jr=d([n(`pending`),n(`in_progress`),n(`completed`),n(`failed`)]),Yr=d([n(`read`),n(`edit`),n(`delete`),n(`move`),n(`search`),n(`execute`),n(`think`),n(`fetch`),n(`switch_mode`),n(`other`)]),Xr=l({_meta:r(u(),o()).nullish(),content:i(Wr).optional(),kind:Yr.optional(),locations:i(qr).optional(),rawInput:o().optional(),rawOutput:o().optional(),status:Jr.optional(),title:u(),toolCallId:W}),Zr=l({_meta:r(u(),o()).nullish(),content:i(Wr).nullish(),kind:Yr.nullish(),locations:i(qr).nullish(),rawInput:o().optional(),rawOutput:o().optional(),status:Jr.nullish(),title:u().nullish(),toolCallId:W}),Qr=l({_meta:r(u(),o()).nullish(),options:i(tn),sessionId:R,toolCall:Zr}),$r=l({_meta:r(u(),o()).nullish(),hint:u()}),ei=l({_meta:r(u(),o()).nullish(),description:u(),input:$r.nullish(),name:u()}),ti=l({_meta:r(u(),o()).nullish(),availableCommands:i(ei)}),ni=d([l({enum:i(u()),type:rt}),Ur]),ri=l({default:i(u()).nullish(),description:u().nullish(),items:ni,maxItems:c().nullish(),minItems:c().nullish(),title:u().nullish()}),ii=d([Sr.and(l({type:n(`string`)})),Qt.and(l({type:n(`number`)})),ht.and(l({type:n(`integer`)})),Ge.and(l({type:n(`boolean`)})),ri.and(l({type:n(`array`)}))]),ai=l({description:u().nullish(),properties:r(u(),ii).optional().default({}),required:i(u()).nullish(),title:u().nullish(),type:nt.optional().default(`object`)}),oi=s(d([s(d([Gr,xn]),l({requestedSchema:ai})).and(l({mode:n(`form`)})),Kr.and(l({mode:n(`url`)}))]),l({_meta:r(u(),o()).nullish(),message:u()})),si=l({cachedReadTokens:c().nullish(),cachedWriteTokens:c().nullish(),inputTokens:c(),outputTokens:c(),thoughtTokens:c().nullish(),totalTokens:c()});d([l({id:P,result:d([Rr,Ue,xt,lr,cr,nr,sr,ur,qe,gr,mr,l({_meta:r(u(),o()).nullish(),stopReason:br,usage:si.nullish(),userMessageId:u().nullish()}),vr,yr,wr,Ke,dt])}),l({error:ct,id:P})]);var ci=l({_meta:r(u(),o()).nullish(),cost:Je.nullish(),size:c(),used:c()}),li=d([U.and(l({sessionUpdate:n(`user_message_chunk`)})),U.and(l({sessionUpdate:n(`agent_message_chunk`)})),U.and(l({sessionUpdate:n(`agent_thought_chunk`)})),Xr.and(l({sessionUpdate:n(`tool_call`)})),Zr.and(l({sessionUpdate:n(`tool_call_update`)})),on.and(l({sessionUpdate:n(`plan`)})),ti.and(l({sessionUpdate:n(`available_commands_update`)})),ar.and(l({sessionUpdate:n(`current_mode_update`)})),Ln.and(l({sessionUpdate:n(`config_option_update`)})),rr.and(l({sessionUpdate:n(`session_info_update`)})),ci.and(l({sessionUpdate:n(`usage_update`)}))]),ui=l({_meta:r(u(),o()).nullish(),sessionId:R,update:li});l({method:u(),params:d([ui,tt,lt]).nullish()});var di=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),fi=l({_meta:r(u(),o()).nullish(),exitCode:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:u().nullish()}),pi=l({name:u(),uri:u()}),mi=l({_meta:r(u(),o()).nullish(),repository:Wt.nullish(),workspaceFolders:i(pi).nullish(),workspaceUri:u().nullish()});l({id:P,method:u(),params:d([pn,He,bt,Zt,Xn,_t,Jn,er,Hn,hr,pr,Hr,_r,mi,Cr,Vn,ut]).nullish()});var hi=l({_meta:r(u(),o()).nullish(),content:u(),path:u(),sessionId:R});l({id:P,method:u(),params:d([hi,Zn,Qr,Un,Dr,$n,di,Yn,oi,ut]).nullish()}),d([l({id:P,result:d([l({_meta:r(u(),o()).nullish()}),yn,On,Ye,Or,bn,fi,gt,Qe,dt])}),l({error:ct,id:P})]),e();function gi(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
|
|
2
|
-
`);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}let t=n.trim();if(t)try{let n=JSON.parse(t);e.enqueue(n)}catch(e){console.error(`Failed to parse JSON message:`,t,e)}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
|
|
3
|
-
`,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}f();var _i,vi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case D.initialize:{let e=pn.parse(t);return r.initialize(e)}case D.session_new:{let e=Zt.parse(t);return r.newSession(e)}case D.session_load:{if(!r.loadSession)throw G.methodNotFound(e);let n=Xn.parse(t);return r.loadSession(n)}case D.session_list:{if(!r.listSessions)throw G.methodNotFound(e);let n=_t.parse(t);return r.listSessions(n)}case D.session_fork:{if(!r.unstable_forkSession)throw G.methodNotFound(e);let n=Jn.parse(t);return r.unstable_forkSession(n)}case D.session_resume:{if(!r.unstable_resumeSession)throw G.methodNotFound(e);let n=er.parse(t);return r.unstable_resumeSession(n)}case D.session_close:{if(!r.unstable_closeSession)throw G.methodNotFound(e);let n=Hn.parse(t);return r.unstable_closeSession(n)}case D.session_set_mode:{if(!r.setSessionMode)throw G.methodNotFound(e);let n=hr.parse(t);return await r.setSessionMode(n)??{}}case D.authenticate:{let e=He.parse(t);return await r.authenticate(e)??{}}case D.logout:{if(!r.unstable_logout)throw G.methodNotFound(e);let n=bt.parse(t);return await r.unstable_logout(n)??{}}case D.session_prompt:{let e=Hr.parse(t);return r.prompt(e)}case D.session_set_model:{if(!r.unstable_setSessionModel)throw G.methodNotFound(e);let n=_r.parse(t);return await r.unstable_setSessionModel(n)??{}}case D.session_set_config_option:{if(!r.setSessionConfigOption)throw G.methodNotFound(e);let n=pr.parse(t);return r.setSessionConfigOption(n)}case D.nes_start:{if(!r.unstable_startNes)throw G.methodNotFound(e);let n=mi.parse(t);return r.unstable_startNes(n)}case D.nes_suggest:{if(!r.unstable_suggestNes)throw G.methodNotFound(e);let n=Cr.parse(t);return r.unstable_suggestNes(n)}case D.nes_close:{if(!r.unstable_closeNes)throw G.methodNotFound(e);let n=Vn.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw G.methodNotFound(e)}},a=async(e,t)=>{switch(e){case D.session_cancel:{let e=Bn.parse(t);return r.cancel(e)}case D.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Kn.parse(t);return r.unstable_didOpenDocument(e)}case D.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=jr.parse(t);return r.unstable_didChangeDocument(e)}case D.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Wn.parse(t);return r.unstable_didCloseDocument(e)}case D.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=qn.parse(t);return r.unstable_didSaveDocument(e)}case D.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Gn.parse(t);return r.unstable_didFocusDocument(e)}case D.nes_accept:{if(!r.unstable_acceptNes)return;let e=zn.parse(t);return r.unstable_acceptNes(e)}case D.nes_reject:{if(!r.unstable_rejectNes)return;let e=Qn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw G.methodNotFound(e)}};this.connection=new bi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(O.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(O.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(O.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(O.fs_write_text_file,e)??{}}async createTerminal(e){return new yi((await this.connection.sendRequest(O.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(O.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(O.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};_i=Symbol.asyncDispose;var yi=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(O.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(O.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(O.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(O.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[_i](){await this.release()}},bi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof p)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof p)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new G(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},G=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};ee(),_(),ge(),we(),ye(),ce(),ne(),se(),oe(),le(),pe(),ke();function K(e,t){if(e)return t?Pe(e)?e:Fe(t,e):e}var xi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,Si={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function Ci(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=Si[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!xi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function wi(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ti=256;function Ei(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ti?t:`${t.slice(0,Ti-1)}…`}function q(e,t){if(!t)return e;let n=E.resolve(t),r=E.resolve(e);return r.startsWith(n+E.sep)||r===n?E.relative(n,r):e}function J(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return`${t}\n${e}${e.endsWith(`
|
|
4
|
-
`)?``:`
|
|
5
|
-
`}${t}`}function Y(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let e=i?.command??`Terminal`,t=i?.description;return{title:e,kind:`execute`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Read`:{let e=i?.file_path,t=e??`File`,r=i?.offset,a=i?.limit,o=``;a&&a>0?o=` (${r??1} - ${(r??1)+a-1})`:r&&(o=` (from line ${r})`);let s=t?q(t,n):`File`,c=K(e,n);return{title:`Read ${s}${o}`,kind:`read`,locations:c?[{path:c,line:r??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?q(e,n):void 0,a=K(e,n);return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:a?[{type:`diff`,path:a,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:a?[{path:a}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?q(e,n):void 0,o=K(e,n);return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:o?[{type:`diff`,path:o,oldText:t||null,newText:r}]:[],locations:o?[{path:o}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,r=K(e,n),a=`Find`;return e&&(a+=` \`${e}\``),t&&(a+=` \`${t}\``),{title:a,kind:`search`,content:[],locations:r?[{path:r}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function Di(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:Oi(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function Oi(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`resource_link`:{let t=e.uri;return{type:`resource_link`,uri:t,name:e.name??t,mimeType:e.mimeType}}case`resource`:{let t=e.resource;return{type:`resource`,resource:{uri:t?.uri??``,mimeType:t?.mimeType,...typeof t?.text==`string`?{text:t.text}:{},...typeof t?.blob==`string`?{blob:t.blob}:{}}}}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
|
|
6
|
-
`)||``)}case`text_editor_code_execution_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);default:try{return{type:`text`,text:JSON.stringify(e)}}catch{return{type:`text`,text:`[content]`}}}}function ki(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Di(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:J(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:J(e.text)}:Oi(e,!1)}))}:{};case`Bash`:{let e=``;if(i&&typeof i==`object`&&!Array.isArray(i)&&i.type===`bash_code_execution_result`){let t=i;e=[t.stdout,t.stderr].filter(Boolean).join(`
|
|
7
|
-
`)}else typeof i==`string`?e=i:Array.isArray(i)&&i.length>0&&(e=i.map(e=>e.type===`text`?e.text:``).join(`
|
|
8
|
-
`));return e.trim()?{content:[{type:`content`,content:{type:`text`,text:`\`\`\`console\n${e.trimEnd()}\n\`\`\``}}]}:{}}case`Edit`:case`Write`:return{};case`ExitPlanMode`:return{title:`Exited Plan Mode`};default:return Di(i??``,r)}}function Ai(e){return e===`in_progress`?`in_progress`:e===`completed`?`completed`:`pending`}function X(e,t,n,r,i,a,o){let s=[];for(let i of e){let e=i.type,a=null;switch(e){case`text`:case`text_delta`:{let e=i.text??``;a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`thinking`:case`thinking_delta`:{let e=i.thinking??``;a={sessionUpdate:`agent_thought_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`image`:{let e=i.source;e?.type===`base64`&&(a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`image`,data:e.data,mimeType:e.media_type}});break}case`tool_use`:case`server_tool_use`:case`mcp_tool_use`:{let t=i.id??``,n=i.name??`unknown`,s=i.input,c=t in r;if(r[t]={type:e,id:t,name:n,input:s},n===`TodoWrite`){let e=s?.todos;Array.isArray(e)&&(a={sessionUpdate:`plan`,entries:e.map(e=>({content:e.content,status:Ai(e.status),priority:`medium`}))})}else{let e=s?{...s}:{};a=c?{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call_update`,status:`in_progress`,rawInput:e,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}:{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call`,rawInput:e,status:`pending`,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}}break}case`tool_result`:case`mcp_tool_result`:{let e=i.tool_use_id??``,t=r[e];if(!t)break;if(t.name!==`TodoWrite`){let n=ki(i,{name:t.name,id:t.id},!1);a={_meta:{claudeCode:{toolName:t.name}},toolCallId:e,sessionUpdate:`tool_call_update`,status:i.is_error===!0?`failed`:`completed`,rawOutput:i.content,...n}}break}case`redacted_thinking`:case`input_json_delta`:case`citations_delta`:case`signature_delta`:case`container_upload`:case`compaction`:case`compaction_delta`:break}if(a){if(o?.parentToolUseId){let e=a._meta;a._meta={...e,claudeCode:{...e?.claudeCode??{},parentToolUseId:o.parentToolUseId}}}s.push({sessionId:n,update:a})}}return s}function ji(e,t,n,r,i){let a=e.message;if(!a)return[];let o=a.content;if(!o)return[];if(typeof o==`string`)return[{sessionId:t,update:{sessionUpdate:`agent_message_chunk`,...i?.messageId?{messageId:i.messageId}:{},content:{type:`text`,text:o}}}];let s=i?.streamingActive?o.filter(e=>e.type!==`text`&&e.type!==`thinking`):o;return s.length===0?[]:X(s,`assistant`,t,n,r,void 0,i)}function Mi(e,t,n,r,i){let a=e.event;if(!a)return[];switch(a.type){case`content_block_start`:{let o=a.content_block;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`content_block_delta`:{let o=a.delta;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`message_start`:case`message_delta`:case`message_stop`:case`content_block_stop`:return[];default:return[]}}function Ni(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;return n}function Pi(e,t){let n=null,r=0;for(let i of Object.keys(e)){let e=Ni(i,t);e>r&&(r=e,n=i)}return n?e[n]??null:null}var Fi=console;function Ii(e,t){if(t.aborted)return Promise.resolve({done:!0,value:void 0});let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e.next(),r]).finally(()=>{n&&t.removeEventListener(`abort`,n)})}async function Li(e,t,n,r,i,a,o,s){let c=`end_turn`,l={inputTokens:0,outputTokens:0,cachedReadTokens:0,cachedWriteTokens:0},u=null,d=null,f=2e5,p=!1,m=null;try{for(;!r.aborted;){let s=await Ii(t,r);if(s.done||r.aborted)break;let h=s.value;if(h==null)continue;let g=h;switch(g.type){case`system`:g.subtype===`compact_boundary`&&(u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
9
|
-
|
|
10
|
-
Compacting completed.`}}}));break;case`result`:{let t=g.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=g.modelUsage;if(i&&d){let e=Pi(i,d);e?.contextWindow&&(f=e.contextWindow)}u!==null&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:u,size:f}});let a=g.subtype,o=g.is_error;if(r.aborted){c=`cancelled`;break}switch(a){case`success`:{let e=g.stop_reason;c=e===`max_tokens`?`max_tokens`:e===`refusal`?`refusal`:`end_turn`,o&&(c=`end_turn`);break}case`error_during_execution`:c=g.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=g.parent_tool_use_id;t===null&&m===null&&(m=T());let r=Mi(g,e,i,n,{clientCapabilities:a,cwd:o,messageId:t===null?m??void 0:void 0});for(let e of r)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=g.message,r=g.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s;r===null&&(m===null&&(m=T()),s=m);let c=ji(g,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p,messageId:s});for(let e of c)await n.sessionUpdate(e);r===null&&(m=null);break}case`user`:break;case`progress`:{let t=g.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
11
|
-
|
|
12
|
-
Compacting completed.`}}});break;default:Fi.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function Ri(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Fi.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=T();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=X(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:T()});for(let e of t)await n.sessionUpdate(e)}}}function zi(e,t,n,r,i,a,o,s){return async(n,c,l,u,d,f)=>{let p=Vi(r);if(n.name===`ExitPlanMode`)return Bi(e,t,d,c,p,i,a,o,s);if(f!==void 0)return f;try{let e=await te(n,c,l,u,d);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:d}}let m=Y({name:n.name,id:d,input:c},p,i),h={toolCallId:d,title:m.title,kind:m.kind,status:`pending`,rawInput:c},g=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:h,options:g});if(n.outcome.outcome===`cancelled`)return s?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:d};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:c}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Bi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=Y({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Vi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}xe(),De(),de(),_e(),e(),x();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`workmate`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||b(),n=await ve(t),r=await ue({dir:t}),i=[];for(let e of r){if(!e.cwd||await ve(e.cwd)!==n)continue;let t=Ei(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Hi(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await C(e.sessionId);if(t)try{await Ne(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw G.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Hi(e){let t;try{let n=await S(e);n&&n.messages.length>0&&(t=w(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Ui=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Wi(e){return Ui.includes(e)}function Gi(e,t,n){if(t){let t=Ki(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Yi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return qi(n)??`default`}function Ki(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return Ci(e,t)}function qi(e){if(e!=null)try{return Ci(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Ji(e,t){return!!e&&Object.hasOwn(e,t)}function Yi(){return Xi()}function Xi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Zi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function Qi(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function $i(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}_();function ea(){return he().permissions?.defaultMode}async function ta(e,t={}){be();let n=t.sessionId??T(),r=e.cwd;g(n,y()),v(r);let i=process.cwd(),a=!1;try{process.chdir(r),a=!0}catch{}h(),Oe();try{let i=Ce(),a=ae(i),o=e._meta,s=Ji(o,`permissionMode`),c=Gi(s?o?.permissionMode:void 0,s,ea()),l=$(this),u=this.conn,d=zi(u,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,l,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),f=Yi(),p={...ie(),toolPermissionContext:{...i,mode:c,isBypassPermissionsModeAvailable:f}},[m,h]=await Promise.all([re(r),fe(r)]);p.agentDefinitions=h;let g=new Te({cwd:r,tools:a,commands:m,mcpClients:[],agents:h.activeAgents,canUseTool:d,getAppState:()=>p,setAppState:e=>{let t=e(p);Object.assign(p,t)},readFileCache:new me(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),_={currentModeId:c,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},...f?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},ee=Ee(),v=Se(),y={availableModels:ee.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:v};g.setModel(v);let b=Zi(_,y),te={queryEngine:g,cancelled:!1,cancelGeneration:0,cwd:r,modes:_,models:y,configOptions:b,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:l,appState:p,commands:m,sessionFingerprint:wi({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,te),{sessionId:n,modes:_,models:y,configOptions:b}}finally{a&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:ta}),x(),_(),_e();async function na(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(wi({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await C(e.sessionId,e.cwd);return g(e.sessionId,r?Ae(r.filePath):null),v(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await C(e.sessionId,e.cwd),i=r?Ae(r.filePath):null;g(e.sessionId,i),v(e.cwd);let a;if(r)try{let t=await S(e.sessionId);t&&t.messages.length>0&&(a=w(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let o=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await Ri(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:o.sessionId,modes:o.modes,models:o.models,configOptions:o.configOptions}}async function ra(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function ia(e){try{let t=await S(e.sessionId);if(!t||t.messages.length===0)return;let n=w(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await Ri(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function aa(e,t){if(!Wi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function oa(e,t,n){let r=this.sessions.get(e);r&&($i(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:na,teardownSession:ra,replaySessionHistory:ia,applySessionMode:aa,updateConfigOption:oa});function sa(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(ca(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
|
|
13
|
-
`)}function ca(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function la(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),ua(e),n}ua(e)}function ua(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}_();async function da(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=sa(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=T();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),g(e.sessionId,y());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Li(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await pa(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Work Mate Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=la(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=Qi(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),$i(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function pa(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=Ei(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:da,setSessionConfigOption:fa}),ye(),ke();function ma(e,t){let n=je.toWeb(e);return gi(Me.toWeb(t),n)}async function ha(){be(),Oe();let e=ma(process.stdin,process.stdout),t,n=new vi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ha as runAcpAgent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{homedir as r}from"os";import{join as i}from"path";function a(e){let t=process.env.NODE_OPTIONS;return t?t.split(/\s+/).includes(e):!1}function o(e){if(!e)return!1;if(typeof e==`boolean`)return e;let t=e.toLowerCase().trim();return[`1`,`true`,`yes`,`on`].includes(t)}function s(e){if(e===void 0)return!1;if(typeof e==`boolean`)return!e;if(!e)return!1;let t=e.toLowerCase().trim();return[`0`,`false`,`no`,`off`].includes(t)}function c(){return o(process.env.CLAUDE_CODE_SIMPLE)||process.argv.includes(`--bare`)}function l(e){let t={};if(e)for(let n of e){let[e,...r]=n.split(`=`);if(!e||r.length===0)throw Error(`Invalid environment variable format: ${n}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`);t[e]=r.join(`=`)}return t}function u(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||`us-east-1`}function d(){return process.env.CLOUD_ML_REGION||`us-east5`}function f(){return o(process.env.CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR)}function p(){return!1}function m(e){if(e){let t=g.find(([t])=>e.startsWith(t));if(t)return process.env[t[1]]||d()}return d()}var h,g,_=e((()=>{n(),h=t(()=>(process.env.WORKMATE_CONFIG_DIR??i(r(),`.workmate`)).normalize(`NFC`),()=>process.env.WORKMATE_CONFIG_DIR),g=[[`claude-haiku-4-5`,`VERTEX_REGION_CLAUDE_HAIKU_4_5`],[`claude-3-5-haiku`,`VERTEX_REGION_CLAUDE_3_5_HAIKU`],[`claude-3-5-sonnet`,`VERTEX_REGION_CLAUDE_3_5_SONNET`],[`claude-3-7-sonnet`,`VERTEX_REGION_CLAUDE_3_7_SONNET`],[`claude-opus-4-1`,`VERTEX_REGION_CLAUDE_4_1_OPUS`],[`claude-opus-4`,`VERTEX_REGION_CLAUDE_4_0_OPUS`],[`claude-sonnet-4-6`,`VERTEX_REGION_CLAUDE_4_6_SONNET`],[`claude-sonnet-4-5`,`VERTEX_REGION_CLAUDE_4_5_SONNET`],[`claude-sonnet-4`,`VERTEX_REGION_CLAUDE_4_0_SONNET`]]}));export{a,s as c,l as d,f,h as i,o as l,d as n,_ as o,m as r,c as s,u as t,p as u};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as m,t as h}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{i as g,n as _,r as v,t as y}from"./figures-5ThXQEtq.js";import{n as b,t as x}from"./cwd-BvNt_018.js";import{w as ee,x as te}from"./debug-CRnGsZOV.js";import{o as ne,s as re}from"./log-DoSpAwRP.js";import{aborted as ie,callbackify as S,debuglog as ae,inspect as oe,promisify as se,stripVTControlCharacters as ce}from"node:util";import C,{execArgv as le,execPath as ue,hrtime as de,platform as fe}from"node:process";import w from"node:path";import{ChildProcess as pe,execFile as me,spawn as he,spawnSync as ge}from"node:child_process";import{appendFileSync as _e,createReadStream as ve,createWriteStream as ye,readFileSync as be,statSync as xe,writeFileSync as Se}from"node:fs";import{constants as Ce}from"node:os";import we from"node:tty";import{EventEmitter as Te,addAbortListener as Ee,on as De,once as T,setMaxListeners as Oe}from"node:events";import{Duplex as ke,PassThrough as Ae,Readable as E,Transform as je,Writable as Me,getDefaultHighWaterMark as Ne}from"node:stream";import{Buffer as Pe}from"node:buffer";import{fileURLToPath as Fe}from"node:url";import{StringDecoder as Ie}from"node:string_decoder";import{scheduler as Le,setImmediate as Re,setTimeout as ze}from"node:timers/promises";import{serialize as Be}from"node:v8";import{finished as D}from"node:stream/promises";function O(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var k=t((()=>{})),Ve,He,Ue,We,Ge=t((()=>{Ve=(e,t)=>{let n=We(He(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},He=e=>Ue(e)?e.toString():e,Ue=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,We=e=>e instanceof URL?Fe(e):e})),Ke,qe=t((()=>{k(),Ge(),Ke=(e,t=[],n={})=>{let r=Ve(e,`First argument`),[i,a]=O(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!O(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]}})),Je,Ye,A,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,j=t((()=>{({toString:Je}=Object.prototype),Ye=e=>Je.call(e)===`[object ArrayBuffer]`,A=e=>Je.call(e)===`[object Uint8Array]`,Xe=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ze=new TextEncoder,Qe=e=>Ze.encode(e),$e=new TextDecoder,et=e=>$e.decode(e),tt=(e,t)=>nt(e,t).join(``),nt=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new Ie(t),r=e.map(e=>typeof e==`string`?Qe(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},rt=e=>e.length===1&&A(e[0])?e[0]:at(it(e)),it=e=>e.map(e=>typeof e==`string`?Qe(e):e),at=e=>{let t=new Uint8Array(ot(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},ot=e=>{let t=0;for(let n of e)t+=n.length;return t}})),st,ct,lt,ut,dt,ft,pt,mt,ht,gt=t((()=>{k(),j(),st=e=>Array.isArray(e)&&Array.isArray(e.raw),ct=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=lt({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},lt=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ut(i,e.raw[r]),c=pt(n,a,o);if(r===t.length)return c;let l=t[r],u=Array.isArray(l)?l.map(e=>mt(e)):[mt(l)];return pt(c,u,s)},ut=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=dt.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(dt.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
|
|
2
|
-
`?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=ft[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},dt=new Set([` `,` `,`\r`,`
|
|
3
|
-
`]),ft={x:3,u:5},pt=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],mt=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(O(e)&&(`stdout`in e||`isMaxBuffer`in e))return ht(e);throw e instanceof pe||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},ht=({stdout:e})=>{if(typeof e==`string`)return e;if(A(e))return et(e);throw TypeError(e===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${typeof e}" stdout in template expression`)}})),M,_t,N,vt,P=t((()=>{M=e=>_t.includes(e),_t=[C.stdin,C.stdout,C.stderr],N=[`stdin`,`stdout`,`stderr`],vt=e=>N[e]??`stdio[${e}]`})),yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt,F=t((()=>{k(),P(),yt=e=>{let t={...e};for(let n of jt)t[n]=bt(e,n);return t},bt=(e,t)=>{let n=Array.from({length:xt(e)+1}),r=St(e[t],n,t);return kt(r,t)},xt=({stdio:e})=>Array.isArray(e)?Math.max(e.length,N.length):N.length,St=(e,t,n)=>O(e)?Ct(e,t,n):t.fill(e),Ct=(e,t,n)=>{for(let r of Object.keys(e).sort(wt))for(let i of Et(r,n,t))t[i]=e[r];return t},wt=(e,t)=>Tt(e)<Tt(t)?1:-1,Tt=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,Et=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=Dt(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
|
|
4
|
-
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
5
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return r===`all`?[1,2]:[r]},Dt=e=>{if(e===`all`)return e;if(N.includes(e))return N.indexOf(e);let t=Ot.exec(e);if(t!==null)return Number(t[1])},Ot=/^fd(\d+)$/,kt=(e,t)=>e.map(e=>e===void 0?At[t]:e),At={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:ae(`execa`).enabled?`full`:`none`,stripFinalNewline:!0},jt=[`lines`,`buffer`,`maxBuffer`,`verbose`,`stripFinalNewline`],Mt=(e,t)=>t===`ipc`?e.at(-1):e[t]})),Nt,Pt,Ft,It,Lt,Rt,zt,I=t((()=>{F(),Nt=({verbose:e},t)=>It(e,t)!==`none`,Pt=({verbose:e},t)=>![`none`,`short`].includes(It(e,t)),Ft=({verbose:e},t)=>{let n=It(e,t);return Rt(n)?n:void 0},It=(e,t)=>t===void 0?Lt(e):Mt(e,t),Lt=e=>e.find(e=>Rt(e))??zt.findLast(t=>e.includes(t)),Rt=e=>typeof e==`function`,zt=[`none`,`short`,`full`]})),Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt=t((()=>{Bt=(e,t)=>{let n=[e,...t];return{command:n.join(` `),escapedCommand:n.map(e=>Jt(Ht(e))).join(` `)}},Vt=e=>ce(e).split(`
|
|
6
|
-
`).map(e=>Ht(e)).join(`
|
|
7
|
-
`),Ht=e=>e.replaceAll(Gt,e=>Ut(e)),Ut=e=>{let t=Kt[e];if(t!==void 0)return t;let n=e.codePointAt(0),r=n.toString(16);return n<=qt?`\\u${r.padStart(4,`0`)}`:`\\U${r}`},Wt=()=>{try{return RegExp(`\\p{Separator}|\\p{Other}`,`gu`)}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Gt=Wt(),Kt={" ":` `,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},qt=65535,Jt=e=>Yt.test(e)?e:fe===`win32`?`"${e.replaceAll(`"`,`""`)}"`:`'${e.replaceAll(`'`,`'\\''`)}'`,Yt=/^[\w./-]+$/})),Zt,L,Qt,$t,en,tn,nn=t((()=>{Zt=we?.WriteStream?.prototype?.hasColors?.()??!1,L=(e,t)=>{if(!Zt)return e=>e;let n=`\u001B[${e}m`,r=`\u001B[${t}m`;return e=>{let i=e+``,a=i.indexOf(r);if(a===-1)return n+i+r;let o=n,s=0,c=(t===22?r:``)+n;for(;a!==-1;)o+=i.slice(s,a)+c,s=a+r.length,a=i.indexOf(r,s);return o+=i.slice(s)+r,o}},L(0,0),Qt=L(1,22),L(2,22),L(3,23),L(4,24),L(53,55),L(7,27),L(8,28),L(9,29),L(30,39),L(31,39),L(32,39),L(33,39),L(34,39),L(35,39),L(36,39),L(37,39),$t=L(90,39),L(40,49),L(41,49),L(42,49),L(43,49),L(44,49),L(45,49),L(46,49),L(47,49),L(100,49),en=L(91,39),L(92,39),tn=L(93,39),L(94,39),L(95,39),L(96,39),L(97,39),L(101,49),L(102,49),L(103,49),L(104,49),L(105,49),L(106,49),L(107,49)})),rn=t((()=>{nn(),nn()})),an,on,sn,cn,ln,un,dn,fn=t((()=>{_(),rn(),an=({type:e,message:t,timestamp:n,piped:r,commandId:i,result:{failed:a=!1}={},options:{reject:o=!0}})=>{let s=on(n),c=ln[e]({failed:a,reject:o,piped:r}),l=dn[e]({reject:o});return`${$t(`[${s}]`)} ${$t(`[${i}]`)} ${l(c)} ${l(t)}`},on=e=>`${sn(e.getHours(),2)}:${sn(e.getMinutes(),2)}:${sn(e.getSeconds(),2)}.${sn(e.getMilliseconds(),3)}`,sn=(e,t)=>String(e).padStart(t,`0`),cn=({failed:e,reject:t})=>e?t?y.cross:y.warning:y.tick,ln={command:({piped:e})=>e?`|`:`$`,output:()=>` `,ipc:()=>`*`,error:cn,duration:cn},un=e=>e,dn={command:()=>Qt,output:()=>un,ipc:()=>un,error:({reject:e})=>e?en:tn,duration:()=>$t}})),pn,mn,hn,gn=t((()=>{I(),pn=(e,t,n)=>{let r=Ft(t,n);return e.map(({verboseLine:e,verboseObject:t})=>mn(e,t,r)).filter(e=>e!==void 0).map(e=>hn(e)).join(``)},mn=(e,t,n)=>{if(n===void 0)return e;let r=n(e,t);if(typeof r==`string`)return r},hn=e=>e.endsWith(`
|
|
8
|
-
`)?e:`${e}\n`})),_n,vn,yn,bn,xn,Sn,Cn=t((()=>{Xt(),fn(),gn(),_n=({type:e,verboseMessage:t,fdNumber:n,verboseInfo:r,result:i})=>{let a=vn({type:e,result:i,verboseInfo:r}),o=pn(yn(t,a),r,n);o!==``&&console.warn(o.slice(0,-1))},vn=({type:e,result:t,verboseInfo:{escapedCommand:n,commandId:r,rawOptions:{piped:i=!1,...a}}})=>({type:e,escapedCommand:n,commandId:`${r}`,timestamp:new Date,piped:i,result:t,options:a}),yn=(e,t)=>e.split(`
|
|
9
|
-
`).map(e=>bn({...t,message:e})),bn=e=>({verboseLine:an(e),verboseObject:e}),xn=e=>Vt(typeof e==`string`?e:oe(e)).replaceAll(` `,` `.repeat(Sn)),Sn=2})),wn,Tn=t((()=>{I(),Cn(),wn=(e,t)=>{Nt(t)&&_n({type:`command`,verboseMessage:e,verboseInfo:t})}})),En,Dn,On,kn,An=t((()=>{I(),En=(e,t,n)=>(kn(e),{verbose:e,escapedCommand:t,commandId:Dn(e),rawOptions:n}),Dn=e=>Nt({verbose:e})?On++:void 0,On=0n,kn=e=>{for(let t of e){if(t===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!zt.includes(t)&&!Rt(t)){let e=zt.map(e=>`'${e}'`).join(`, `);throw TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${e} or a function.`)}}}})),jn,Mn,Nn=t((()=>{jn=()=>de.bigint(),Mn=e=>Number(de.bigint()-e)/1e6})),Pn,Fn=t((()=>{Tn(),An(),Nn(),Xt(),F(),Pn=(e,t,n)=>{let r=jn(),{command:i,escapedCommand:a}=Bt(e,t),o=En(bt(n,`verbose`),a,{...n});return wn(a,o),{command:i,escapedCommand:a,startTime:r,verboseInfo:o}}})),In=r(((t,n)=>{n.exports=o,o.sync=s;var r=e(`fs`);function i(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function a(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:i(t,n)}function o(e,t,n){r.stat(e,function(r,i){n(r,!r&&a(i,e,t))})}function s(e,t){return a(r.statSync(e),e,t)}})),Ln=r(((t,n)=>{n.exports=i,i.sync=a;var r=e(`fs`);function i(e,t,n){r.stat(e,function(e,r){n(e,!e&&o(r,t))})}function a(e,t){return o(r.statSync(e),t)}function o(e,t){return e.isFile()&&s(e,t)}function s(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),Rn=r(((t,n)=>{e(`fs`);var r=process.platform===`win32`||global.TESTING_WINDOWS?In():Ln();n.exports=i,i.sync=a;function i(e,t,n){if(typeof t==`function`&&(n=t,t={}),!n){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,r){i(e,t||{},function(e,t){e?r(e):n(t)})})}r(e,t||{},function(e,r){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,r=!1),n(e,r)})}function a(e,t){try{return r.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),zn=r(((t,n)=>{var r=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,i=e(`path`),a=r?`;`:`:`,o=Rn(),s=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),c=(e,t)=>{let n=t.colon||a,i=e.match(/\//)||r&&e.match(/\\/)?[``]:[...r?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(n)],o=r?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=r?o.split(n):[``];return r&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:i,pathExt:s,pathExtExe:o}},l=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:a,pathExtExe:l}=c(e,t),u=[],d=n=>new Promise((a,o)=>{if(n===r.length)return t.all&&u.length?a(u):o(s(e));let c=r[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(l,e),p=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;a(f(p,n,0))}),f=(e,n,r)=>new Promise((i,s)=>{if(r===a.length)return i(d(n+1));let c=a[r];o(e+c,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+c);else return i(e+c);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};n.exports=l,l.sync=(e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:a}=c(e,t),l=[];for(let s=0;s<n.length;s++){let c=n[s],u=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<r.length;e++){let n=f+r[e];try{if(o.sync(n,{pathExt:a}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw s(e)}})),Bn=r(((e,t)=>{var n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),Vn=r(((t,n)=>{var r=e(`path`),i=zn(),a=Bn();function o(e,t){let n=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=i.sync(e.command,{path:n[a({env:n})],pathExt:t?r.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&(l=r.resolve(s?e.options.cwd:``,l)),l}function s(e){return o(e)||o(e,!0)}n.exports=s})),Hn=r(((e,t)=>{var n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),Un=r(((e,t)=>{t.exports=/^#!(.*)/})),Wn=r(((e,t)=>{var n=Un();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),Gn=r(((t,n)=>{var r=e(`fs`),i=Wn();function a(e){let t=Buffer.alloc(150),n;try{n=r.openSync(e,`r`),r.readSync(n,t,0,150,0),r.closeSync(n)}catch{}return i(t.toString())}n.exports=a})),Kn=r(((t,n)=>{var r=e(`path`),i=Vn(),a=Hn(),o=Gn(),s=process.platform===`win32`,c=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(e){e.file=i(e);let t=e.file&&o(e.file);return t?(e.args.unshift(e.file),e.command=t,i(e)):e.file}function d(e){if(!s)return e;let t=u(e),n=!c.test(t);if(e.options.forceShell||n){let n=l.test(t);e.command=r.normalize(e.command),e.command=a.command(e.command),e.args=e.args.map(e=>a.argument(e,n)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function f(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:d(r)}n.exports=f})),qn=r(((e,t)=>{var n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),Jn=r(((t,n)=>{var r=e(`child_process`),i=Kn(),a=qn();function o(e,t,n){let o=i(e,t,n),s=r.spawn(o.command,o.args,o.options);return a.hookChildProcess(s,o),s}function s(e,t,n){let o=i(e,t,n),s=r.spawnSync(o.command,o.args,o.options);return s.error=s.error||a.verifyENOENTSync(s.status,o),s}n.exports=o,n.exports.spawn=o,n.exports.sync=s,n.exports._parse=i,n.exports._enoent=a}));function Yn(e={}){let{env:t=process.env,platform:n=process.platform}=e;return n===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`}var Xn=t((()=>{})),Zn=t((()=>{}));function Qn(e){return e instanceof URL?Fe(e):e}function $n(e){return{*[Symbol.iterator](){let t=w.resolve(Qn(e)),n;for(;n!==t;)yield t,n=t,t=w.resolve(t,`..`)}}}var er=t((()=>{Zn(),se(me)})),tr,nr,rr,ir,ar=t((()=>{Xn(),er(),tr=({cwd:e=C.cwd(),path:t=C.env[Yn()],preferLocal:n=!0,execPath:r=C.execPath,addExecPath:i=!0}={})=>{let a=w.resolve(Qn(e)),o=[],s=t.split(w.delimiter);return n&&nr(o,s,a),i&&rr(o,s,r,a),t===``||t===w.delimiter?`${o.join(w.delimiter)}${t}`:[...o,t].join(w.delimiter)},nr=(e,t,n)=>{for(let r of $n(n)){let n=w.join(r,`node_modules/.bin`);t.includes(n)||e.push(n)}},rr=(e,t,n,r)=>{let i=w.resolve(r,Qn(n),`..`);t.includes(i)||e.push(i)},ir=({env:e=C.env,...t}={})=>{e={...e};let n=Yn({env:e});return t.path=e[n],e[n]=tr(t),e}})),or,sr,cr,lr,ur,dr,fr,pr,R=t((()=>{or=(e,t,n)=>new(n?pr:fr)(t,e instanceof sr?{}:{cause:e}),sr=class extends Error{},cr=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,ur,{value:!0,writable:!1,enumerable:!1,configurable:!1})},lr=e=>dr(e)&&ur in e,ur=Symbol(`isExecaError`),dr=e=>Object.prototype.toString.call(e)===`[object Error]`,fr=class extends Error{},cr(fr,fr.name),pr=class extends Error{},cr(pr,pr.name)})),mr,hr,gr,_r=t((()=>{mr=()=>{let e=64-gr+1;return Array.from({length:e},hr)},hr=(e,t)=>({name:`SIGRT${t+1}`,number:gr+t,action:`terminate`,description:`Application-specific signal (realtime)`,standard:`posix`}),gr=34})),vr,yr=t((()=>{vr=[{name:`SIGHUP`,number:1,action:`terminate`,description:`Terminal closed`,standard:`posix`},{name:`SIGINT`,number:2,action:`terminate`,description:`User interruption with CTRL-C`,standard:`ansi`},{name:`SIGQUIT`,number:3,action:`core`,description:`User interruption with CTRL-\\`,standard:`posix`},{name:`SIGILL`,number:4,action:`core`,description:`Invalid machine instruction`,standard:`ansi`},{name:`SIGTRAP`,number:5,action:`core`,description:`Debugger breakpoint`,standard:`posix`},{name:`SIGABRT`,number:6,action:`core`,description:`Aborted`,standard:`ansi`},{name:`SIGIOT`,number:6,action:`core`,description:`Aborted`,standard:`bsd`},{name:`SIGBUS`,number:7,action:`core`,description:`Bus error due to misaligned, non-existing address or paging error`,standard:`bsd`},{name:`SIGEMT`,number:7,action:`terminate`,description:`Command should be emulated but is not implemented`,standard:`other`},{name:`SIGFPE`,number:8,action:`core`,description:`Floating point arithmetic error`,standard:`ansi`},{name:`SIGKILL`,number:9,action:`terminate`,description:`Forced termination`,standard:`posix`,forced:!0},{name:`SIGUSR1`,number:10,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGSEGV`,number:11,action:`core`,description:`Segmentation fault`,standard:`ansi`},{name:`SIGUSR2`,number:12,action:`terminate`,description:`Application-specific signal`,standard:`posix`},{name:`SIGPIPE`,number:13,action:`terminate`,description:`Broken pipe or socket`,standard:`posix`},{name:`SIGALRM`,number:14,action:`terminate`,description:`Timeout or timer`,standard:`posix`},{name:`SIGTERM`,number:15,action:`terminate`,description:`Termination`,standard:`ansi`},{name:`SIGSTKFLT`,number:16,action:`terminate`,description:`Stack is empty or overflowed`,standard:`other`},{name:`SIGCHLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`posix`},{name:`SIGCLD`,number:17,action:`ignore`,description:`Child process terminated, paused or unpaused`,standard:`other`},{name:`SIGCONT`,number:18,action:`unpause`,description:`Unpaused`,standard:`posix`,forced:!0},{name:`SIGSTOP`,number:19,action:`pause`,description:`Paused`,standard:`posix`,forced:!0},{name:`SIGTSTP`,number:20,action:`pause`,description:`Paused using CTRL-Z or "suspend"`,standard:`posix`},{name:`SIGTTIN`,number:21,action:`pause`,description:`Background process cannot read terminal input`,standard:`posix`},{name:`SIGBREAK`,number:21,action:`terminate`,description:`User interruption with CTRL-BREAK`,standard:`other`},{name:`SIGTTOU`,number:22,action:`pause`,description:`Background process cannot write to terminal output`,standard:`posix`},{name:`SIGURG`,number:23,action:`ignore`,description:`Socket received out-of-band data`,standard:`bsd`},{name:`SIGXCPU`,number:24,action:`core`,description:`Process timed out`,standard:`bsd`},{name:`SIGXFSZ`,number:25,action:`core`,description:`File too big`,standard:`bsd`},{name:`SIGVTALRM`,number:26,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGPROF`,number:27,action:`terminate`,description:`Timeout or timer`,standard:`bsd`},{name:`SIGWINCH`,number:28,action:`ignore`,description:`Terminal window size changed`,standard:`bsd`},{name:`SIGIO`,number:29,action:`terminate`,description:`I/O is available`,standard:`other`},{name:`SIGPOLL`,number:29,action:`terminate`,description:`Watched event`,standard:`other`},{name:`SIGINFO`,number:29,action:`ignore`,description:`Request for process information`,standard:`other`},{name:`SIGPWR`,number:30,action:`terminate`,description:`Device running out of power`,standard:`systemv`},{name:`SIGSYS`,number:31,action:`core`,description:`Invalid system call`,standard:`other`},{name:`SIGUNUSED`,number:31,action:`terminate`,description:`Invalid system call`,standard:`other`}]})),br,xr,Sr=t((()=>{yr(),_r(),br=()=>{let e=mr();return[...vr,...e].map(xr)},xr=({name:e,number:t,description:n,action:r,forced:i=!1,standard:a})=>{let{signals:{[e]:o}}=Ce,s=o!==void 0;return{name:e,number:s?o:t,description:n,supported:s,action:r,forced:i,standard:a}}})),Cr,wr,Tr,Er,Dr,Or,kr=t((()=>{_r(),Sr(),Cr=()=>{let e=br();return Object.fromEntries(e.map(wr))},wr=({name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:i,forced:a,standard:o}],Tr=Cr(),Er=()=>{let e=br(),t=Array.from({length:65},(t,n)=>Dr(n,e));return Object.assign({},...t)},Dr=(e,t)=>{let n=Or(e,t);if(n===void 0)return{};let{name:r,description:i,supported:a,action:o,forced:s,standard:c}=n;return{[e]:{name:r,number:e,description:i,supported:a,action:o,forced:s,standard:c}}},Or=(e,t)=>{let n=t.find(({name:t})=>Ce.signals[t]===e);return n===void 0?t.find(t=>t.number===e):n},Er()})),Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr=t((()=>{kr(),Ar=e=>{let t="option `killSignal`";if(e===0)throw TypeError(`Invalid ${t}: 0 cannot be used.`);return Mr(e,t)},jr=e=>e===0?e:Mr(e,"`subprocess.kill()`'s argument"),Mr=(e,t)=>{if(Number.isInteger(e))return Nr(e,t);if(typeof e==`string`)return Ir(e,t);throw TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.\n${Lr()}`)},Nr=(e,t)=>{if(Fr.has(e))return Fr.get(e);throw TypeError(`Invalid ${t} ${e}: this signal integer does not exist.\n${Lr()}`)},Pr=()=>new Map(Object.entries(Ce.signals).reverse().map(([e,t])=>[t,e])),Fr=Pr(),Ir=(e,t)=>{if(e in Ce.signals)return e;throw e.toUpperCase()in Ce.signals?TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):TypeError(`Invalid ${t} '${e}': this signal name does not exist.\n${Lr()}`)},Lr=()=>`Available signal names: ${Rr()}.
|
|
10
|
-
Available signal numbers: ${zr()}.`,Rr=()=>Object.keys(Ce.signals).sort().map(e=>`'${e}'`).join(`, `),zr=()=>[...new Set(Object.values(Ce.signals).sort((e,t)=>e-t))].join(`, `),Br=e=>Tr[e].description})),Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr=t((()=>{R(),Vr(),Hr=e=>{if(e===!1)return e;if(e===!0)return Ur;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Ur=1e3*5,Wr=({kill:e,options:{forceKillAfterDelay:t,killSignal:n},onInternalError:r,context:i,controller:a},o,s)=>{let{signal:c,error:l}=Gr(o,s,n);Kr(l,r);let u=e(c);return qr({kill:e,signal:c,forceKillAfterDelay:t,killSignal:n,killResult:u,context:i,controller:a}),u},Gr=(e,t,n)=>{let[r=n,i]=dr(e)?[void 0,e]:[e,t];if(typeof r!=`string`&&!Number.isInteger(r))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(r)}`);if(i!==void 0&&!dr(i))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:jr(r),error:i}},Kr=(e,t)=>{e!==void 0&&t.reject(e)},qr=async({kill:e,signal:t,forceKillAfterDelay:n,killSignal:r,killResult:i,context:a,controller:o})=>{t===r&&i&&Jr({kill:e,forceKillAfterDelay:n,context:a,controllerSignal:o.signal})},Jr=async({kill:e,forceKillAfterDelay:t,context:n,controllerSignal:r})=>{if(t!==!1)try{await ze(t,void 0,{signal:r}),e(`SIGKILL`)&&(n.isForcefullyTerminated??(n.isForcefullyTerminated=!0))}catch{}}})),Xr,Zr=t((()=>{Xr=async(e,t)=>{e.aborted||await T(e,`abort`,{signal:t})}})),Qr,$r,ei,ti=t((()=>{Zr(),Qr=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!==`[object AbortSignal]`)throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},$r=({subprocess:e,cancelSignal:t,gracefulCancel:n,context:r,controller:i})=>t===void 0||n?[]:[ei(e,t,r,i)],ei=async(e,t,n,{signal:r})=>{throw await Xr(t,r),n.terminationReason??(n.terminationReason=`cancel`),e.kill(),t.reason}})),ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,z,_i,B,vi,yi=t((()=>{ni=({methodName:e,isSubprocess:t,ipc:n,isConnected:r})=>{ri(e,t,n),ii(e,t,r)},ri=(e,t,n)=>{if(!n)throw Error(`${z(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},ii=(e,t,n)=>{if(!n)throw Error(`${z(e,t)} cannot be used: the ${B(t)} has already exited or disconnected.`)},ai=e=>{throw Error(`${z(`getOneMessage`,e)} could not complete: the ${B(e)} exited or disconnected.`)},oi=e=>{throw Error(`${z(`sendMessage`,e)} failed: the ${B(e)} is sending a message too, instead of listening to incoming messages.
|
|
11
|
-
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
12
|
-
|
|
13
|
-
const [receivedMessage] = await Promise.all([
|
|
14
|
-
${z(`getOneMessage`,e)},
|
|
15
|
-
${z(`sendMessage`,e,`message, {strict: true}`)},
|
|
16
|
-
]);`)},si=(e,t)=>Error(`${z(`sendMessage`,t)} failed when sending an acknowledgment response to the ${B(t)}.`,{cause:e}),ci=e=>{throw Error(`${z(`sendMessage`,e)} failed: the ${B(e)} is not listening to incoming messages.`)},li=e=>{throw Error(`${z(`sendMessage`,e)} failed: the ${B(e)} exited without listening to incoming messages.`)},ui=()=>Error(`\`cancelSignal\` aborted: the ${B(!0)} disconnected.`),di=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},fi=({error:e,methodName:t,isSubprocess:n})=>{if(e.code===`EPIPE`)throw Error(`${z(t,n)} cannot be used: the ${B(n)} is disconnecting.`,{cause:e})},pi=({error:e,methodName:t,isSubprocess:n,message:r})=>{if(mi(e))throw Error(`${z(t,n)}'s argument type is invalid: the message cannot be serialized: ${String(r)}.`,{cause:e})},mi=({code:e,message:t})=>hi.has(e)||gi.some(e=>t.includes(e)),hi=new Set([`ERR_MISSING_ARGS`,`ERR_INVALID_ARG_TYPE`]),gi=[`could not be cloned`,`circular structure`,`call stack size exceeded`],z=(e,t,n=``)=>e===`cancelSignal`?"`cancelSignal`'s `controller.abort()`":`${_i(t)}${e}(${n})`,_i=e=>e?``:`subprocess.`,B=e=>e?`parent process`:`subprocess`,vi=e=>{e.connected&&e.disconnect()}})),bi,xi=t((()=>{bi=()=>{let e={},t=new Promise((t,n)=>{Object.assign(e,{resolve:t,reject:n})});return Object.assign(t,e)}})),Si,Ci,V,wi,Ti,Ei,Di,Oi,ki,Ai,ji,H=t((()=>{F(),Si=(e,t=`stdin`)=>{let{options:n,fileDescriptors:r}=V.get(e),i=wi(r,t,!0),a=e.stdio[i];if(a===null)throw TypeError(Di(i,t,n,!0));return a},Ci=(e,t=`stdout`)=>{let{options:n,fileDescriptors:r}=V.get(e),i=wi(r,t,!1),a=i===`all`?e.all:e.stdio[i];if(a==null)throw TypeError(Di(i,t,n,!1));return a},V=new WeakMap,wi=(e,t,n)=>{let r=Ti(t,n);return Ei(r,t,n,e),r},Ti=(e,t)=>{let n=Dt(e);if(n!==void 0)return n;let{validOptions:r,defaultValue:i}=t?{validOptions:`"stdin"`,defaultValue:`stdin`}:{validOptions:`"stdout", "stderr", "all"`,defaultValue:`stdout`};throw TypeError(`"${Ai(t)}" must not be "${e}".
|
|
17
|
-
It must be ${r} or "fd3", "fd4" (and so on).
|
|
18
|
-
It is optional and defaults to "${i}".`)},Ei=(e,t,n,r)=>{let i=r[ki(e)];if(i===void 0)throw TypeError(`"${Ai(n)}" must not be ${t}. That file descriptor does not exist.
|
|
19
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);if(i.direction===`input`&&!n)throw TypeError(`"${Ai(n)}" must not be ${t}. It must be a readable stream, not writable.`);if(i.direction!==`input`&&n)throw TypeError(`"${Ai(n)}" must not be ${t}. It must be a writable stream, not readable.`)},Di=(e,t,n,r)=>{if(e===`all`&&!n.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:a}=Oi(e,n);return`The "${i}: ${ji(a)}" option is incompatible with using "${Ai(r)}: ${ji(t)}".
|
|
20
|
-
Please set this option with "pipe" instead.`},Oi=(e,{stdin:t,stdout:n,stderr:r,stdio:i})=>{let a=ki(e);return a===0&&t!==void 0?{optionName:`stdin`,optionValue:t}:a===1&&n!==void 0?{optionName:`stdout`,optionValue:n}:a===2&&r!==void 0?{optionName:`stderr`,optionValue:r}:{optionName:`stdio[${a}]`,optionValue:i[a]}},ki=e=>e===`all`?1:e,Ai=e=>e?`to`:`from`,ji=e=>typeof e==`string`?`'${e}'`:typeof e==`number`?`${e}`:`Stream`})),Mi,Ni=t((()=>{Mi=(e,t,n)=>{let r=e.getMaxListeners();r===0||r===1/0||(e.setMaxListeners(r+t),Ee(n,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))}})),Pi,Fi,Ii,Li,Ri,zi,Bi=t((()=>{Pi=(e,t)=>{t&&Fi(e)},Fi=e=>{e.refCounted()},Ii=(e,t)=>{t&&Li(e)},Li=e=>{e.unrefCounted()},Ri=(e,t)=>{t&&(Li(e),Li(e))},zi=(e,t)=>{t&&(Fi(e),Fi(e))}})),Vi,Hi,Ui,Wi=t((()=>{pa(),Bi(),oa(),Oa(),Vi=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r},i)=>{if(ea(i)||wa(i))return;Ui.has(e)||Ui.set(e,[]);let a=Ui.get(e);if(a.push(i),!(a.length>1))for(;a.length>0;){await la(e,r,i),await Le.yield();let o=await $i({wrappedMessage:a[0],anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r});a.shift(),r.emit(`message`,o),r.emit(`message:done`)}},Hi=async({anyProcess:e,channel:t,isSubprocess:n,ipcEmitter:r,boundOnMessage:i})=>{Ea();let a=Ui.get(e);for(;a?.length>0;)await T(r,`message:done`);e.removeListener(`message`,i),zi(t,n),r.connected=!1,r.emit(`disconnect`)},Ui=new WeakMap})),Gi,Ki,qi,Ji,Yi=t((()=>{Wi(),Bi(),Gi=(e,t,n)=>{if(Ki.has(e))return Ki.get(e);let r=new Te;return r.connected=!0,Ki.set(e,r),qi({ipcEmitter:r,anyProcess:e,channel:t,isSubprocess:n}),r},Ki=new WeakMap,qi=({ipcEmitter:e,anyProcess:t,channel:n,isSubprocess:r})=>{let i=Vi.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e});t.on(`message`,i),t.once(`disconnect`,Hi.bind(void 0,{anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:e,boundOnMessage:i})),Ri(n,r)},Ji=e=>{let t=Ki.get(e);return t===void 0?e.channel!==null:t.connected}})),Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa=t((()=>{xi(),Ni(),ya(),yi(),Yi(),pa(),Xi=({anyProcess:e,channel:t,isSubprocess:n,message:r,strict:i})=>{if(!i)return r;let a=da(e,Gi(e,t,n));return{id:Zi++,type:ia,message:r,hasListeners:a}},Zi=0n,Qi=(e,t)=>{if(!(t?.type!==ia||t.hasListeners))for(let{id:t}of e)t!==void 0&&na[t].resolve({isDeadlock:!0,hasListeners:!1})},$i=async({wrappedMessage:e,anyProcess:t,channel:n,isSubprocess:r,ipcEmitter:i})=>{if(e?.type!==ia||!t.connected)return e;let{id:a,message:o}=e,s={id:a,type:aa,message:da(t,i)};try{await ma({anyProcess:t,channel:n,isSubprocess:r,ipc:!0},s)}catch(e){i.emit(`strict:error`,e)}return o},ea=e=>{if(e?.type!==aa)return!1;let{id:t,message:n}=e;return na[t]?.resolve({isDeadlock:!1,hasListeners:n}),!0},ta=async(e,t,n)=>{if(e?.type!==ia)return;let r=bi();na[e.id]=r;let i=new AbortController;try{let{isDeadlock:e,hasListeners:a}=await Promise.race([r,ra(t,n,i)]);e&&oi(n),a||ci(n)}finally{i.abort(),delete na[e.id]}},na={},ra=async(e,t,{signal:n})=>{Mi(e,1,n),await T(e,`disconnect`,{signal:n}),li(t)},ia=`execa:ipc:request`,aa=`execa:ipc:response`})),sa,ca,la,ua,da,fa,pa=t((()=>{xi(),F(),H(),oa(),sa=(e,t,n)=>{ua.has(e)||ua.set(e,new Set);let r=ua.get(e),i={onMessageSent:bi(),id:n?t.id:void 0};return r.add(i),{outgoingMessages:r,outgoingMessage:i}},ca=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},la=async(e,t,n)=>{for(;!da(e,t)&&ua.get(e)?.size>0;){let t=[...ua.get(e)];Qi(t,n),await Promise.all(t.map(({onMessageSent:e})=>e))}},ua=new WeakMap,da=(e,t)=>t.listenerCount(`message`)>fa(e),fa=e=>V.has(e)&&!Mt(V.get(e).options.buffer,`ipc`)?1:0})),ma,ha,ga,_a,va,ya=t((()=>{yi(),pa(),oa(),ma=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},i,{strict:a=!1}={})=>{let o=`sendMessage`;return ni({methodName:o,isSubprocess:n,ipc:r,isConnected:e.connected}),ha({anyProcess:e,channel:t,methodName:o,isSubprocess:n,message:i,strict:a})},ha=async({anyProcess:e,channel:t,methodName:n,isSubprocess:r,message:i,strict:a})=>{let o=Xi({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:a}),s=sa(e,o,a);try{await ga({anyProcess:e,methodName:n,isSubprocess:r,wrappedMessage:o,message:i})}catch(t){throw vi(e),t}finally{ca(s)}},ga=async({anyProcess:e,methodName:t,isSubprocess:n,wrappedMessage:r,message:i})=>{let a=_a(e);try{await Promise.all([ta(r,e,n),a(r)])}catch(e){throw fi({error:e,methodName:t,isSubprocess:n}),pi({error:e,methodName:t,isSubprocess:n,message:i}),e}},_a=e=>{if(va.has(e))return va.get(e);let t=se(e.send.bind(e));return va.set(e,t),t},va=new WeakMap})),ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa=t((()=>{ya(),Yi(),yi(),ba=(e,t)=>{let n=`cancelSignal`;return ii(n,!1,e.connected),ga({anyProcess:e,methodName:n,isSubprocess:!1,wrappedMessage:{type:Ta,message:t},message:t})},xa=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>(await Sa({anyProcess:e,channel:t,isSubprocess:n,ipc:r}),Da.signal),Sa=async({anyProcess:e,channel:t,isSubprocess:n,ipc:r})=>{if(!Ca){if(Ca=!0,!r){di();return}if(t===null){Ea();return}Gi(e,t,n),await Le.yield()}},Ca=!1,wa=e=>e?.type===Ta?(Da.abort(e.message),!0):!1,Ta=`execa:ipc:cancel`,Ea=()=>{Da.abort(ui())},Da=new AbortController})),ka,Aa,ja,Ma,Na=t((()=>{Zr(),Oa(),Yr(),ka=({gracefulCancel:e,cancelSignal:t,ipc:n,serialization:r})=>{if(e){if(t===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!n)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(r===`json`)throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},Aa=({subprocess:e,cancelSignal:t,gracefulCancel:n,forceKillAfterDelay:r,context:i,controller:a})=>n?[ja({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:a})]:[],ja=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:n,context:r,controller:{signal:i}})=>{throw await Xr(t,i),await ba(e,Ma(t)),Jr({kill:e.kill,forceKillAfterDelay:n,context:r,controllerSignal:i}),r.terminationReason??(r.terminationReason=`gracefulCancel`),t.reason},Ma=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t}})),Pa,Fa,Ia,La=t((()=>{R(),Pa=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Fa=(e,t,n,r)=>t===0||t===void 0?[]:[Ia(e,t,n,r)],Ia=async(e,t,n,{signal:r})=>{throw await ze(t,void 0,{signal:r}),n.terminationReason??(n.terminationReason=`timeout`),e.kill(),new sr}})),Ra,za,Ba=t((()=>{Ge(),Ra=({options:e})=>{if(e.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},za=(e,t,{node:n=!1,nodePath:r=ue,nodeOptions:i=le.filter(e=>!e.startsWith(`--inspect`)),cwd:a,execPath:o,...s})=>{if(o!==void 0)throw TypeError(`The "execPath" option has been removed. Please use the "nodePath" option instead.`);let c=Ve(r,`The "nodePath" option`),l=w.resolve(a,c),u={...s,nodePath:l,node:n,cwd:a};if(!n)return[e,t,u];if(w.basename(e,`.exe`)===`node`)throw TypeError(`When the "node" option is true, the first argument does not need to be "node".`);return[l,[...i,e,...t],{ipc:!0,...u,shell:!1}]}})),Va,Ha,Ua,Wa,Ga,Ka=t((()=>{Va=({ipcInput:e,ipc:t,serialization:n})=>{if(e!==void 0){if(!t)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");Wa[n](e)}},Ha=e=>{try{Be(e)}catch(e){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Ua=e=>{try{JSON.stringify(e)}catch(e){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Wa={advanced:Ha,json:Ua},Ga=async(e,t)=>{t!==void 0&&await e.sendMessage(t)}})),qa,Ja,U,Ya,Xa,Za,Qa,$a=t((()=>{qa=({encoding:e})=>{if(Ya.has(e))return;let t=Xa(e);if(t!==void 0)throw TypeError(`Invalid option \`encoding: ${Qa(e)}\`.
|
|
21
|
-
Please rename it to ${Qa(t)}.`);let n=[...Ya].map(e=>Qa(e)).join(`, `);throw TypeError(`Invalid option \`encoding: ${Qa(e)}\`.
|
|
22
|
-
Please rename it to one of: ${n}.`)},Ja=new Set([`utf8`,`utf16le`]),U=new Set([`buffer`,`hex`,`base64`,`base64url`,`latin1`,`ascii`]),Ya=new Set([...Ja,...U]),Xa=e=>{if(e===null)return`buffer`;if(typeof e!=`string`)return;let t=e.toLowerCase();if(t in Za)return Za[t];if(Ya.has(t))return t},Za={"utf-8":`utf8`,"utf-16le":`utf16le`,"ucs-2":`utf16le`,ucs2:`utf16le`,binary:`latin1`},Qa=e=>typeof e==`string`?`"${e}"`:String(e)})),eo,to,no,ro=t((()=>{Ge(),eo=(e=to())=>{let t=Ve(e,`The "cwd" option`);return w.resolve(t)},to=()=>{try{return C.cwd()}catch(e){throw e.message=`The current directory does not exist.\n${e.message}`,e}},no=(e,t)=>{if(t===to())return e;let n;try{n=xe(t)}catch(n){return`The "cwd" option is invalid: ${t}.\n${n.message}\n${e}`}return n.isDirectory()?e:`The "cwd" option is not a directory: ${t}.\n${e}`}})),io,ao,oo,so,co=t((()=>{io=n(Jn(),1),ar(),Yr(),Vr(),ti(),Na(),La(),Ba(),Ka(),$a(),ro(),Ge(),F(),ao=(e,t,n)=>{n.cwd=eo(n.cwd);let[r,i,a]=za(e,t,n),{command:o,args:s,options:c}=io.default._parse(r,i,a),l=yt(c),u=oo(l);return Pa(u),qa(u),Va(u),Qr(u),ka(u),u.shell=We(u.shell),u.env=so(u),u.killSignal=Ar(u.killSignal),u.forceKillAfterDelay=Hr(u.forceKillAfterDelay),u.lines=u.lines.map((e,t)=>e&&!U.has(u.encoding)&&u.buffer[t]),C.platform===`win32`&&w.basename(o,`.exe`)===`cmd`&&s.unshift(`/q`),{file:o,commandArguments:s,options:u}},oo=({extendEnv:e=!0,preferLocal:t=!1,cwd:n,localDir:r=n,encoding:i=`utf8`,reject:a=!0,cleanup:o=!0,all:s=!1,windowsHide:c=!0,killSignal:l=`SIGTERM`,forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:f,ipc:p=f!==void 0||d,serialization:m=`advanced`,...h})=>({...h,extendEnv:e,preferLocal:t,cwd:n,localDirectory:r,encoding:i,reject:a,cleanup:o,all:s,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:f,ipc:p,serialization:m}),so=({env:e,extendEnv:t,preferLocal:n,node:r,localDirectory:i,nodePath:a})=>{let o=t?{...C.env,...e}:e;return n||r?ir({env:o,cwd:i,execPath:a,preferLocal:n,addExecPath:r}):o}})),lo,uo=t((()=>{lo=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n]}));function fo(e){if(typeof e==`string`)return po(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw Error(`Input must be a string or a Uint8Array`);return mo(e)}var po,mo,ho,go,_o,vo,yo=t((()=>{po=e=>e.at(-1)===ho?e.slice(0,e.at(-2)===_o?-2:-1):e,mo=e=>e.at(-1)===go?e.subarray(0,e.at(-2)===vo?-2:-1):e,ho=`
|
|
23
|
-
`,go=ho.codePointAt(0),_o=`\r`,vo=_o.codePointAt(0)}));function W(e,{checkOpen:t=!0}={}){return typeof e==`object`&&!!e&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe==`function`}function bo(e,{checkOpen:t=!0}={}){return W(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write==`function`&&typeof e.end==`function`&&typeof e.writable==`boolean`&&typeof e.writableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function xo(e,{checkOpen:t=!0}={}){return W(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read==`function`&&typeof e.readable==`boolean`&&typeof e.readableObjectMode==`boolean`&&typeof e.destroy==`function`&&typeof e.destroyed==`boolean`}function So(e,t){return bo(e,t)&&xo(e,t)}var Co=t((()=>{}));async function wo(){if(d(K,this))return{done:!0,value:void 0};let e;try{e=await d(G,this).read()}catch(e){throw p(q,this,void 0),p(K,this,!0),d(G,this).releaseLock(),e}return e.done&&(p(q,this,void 0),p(K,this,!0),d(G,this).releaseLock()),e}async function To(e){if(d(K,this))return{done:!0,value:e};if(p(K,this,!0),!d(Ao,this)){let t=d(G,this).cancel(e);return d(G,this).releaseLock(),await t,{done:!0,value:e}}return d(G,this).releaseLock(),{done:!0,value:e}}function Eo(){return this[No].next()}function Do(e){return this[No].return(e)}function Oo({preventCancel:e=!1}={}){let t=this.getReader(),n=new Mo(t,e),r=Object.create(Po);return r[No]=n,r}var ko,G,Ao,K,q,jo,Mo,No,Po,Fo=t((()=>{m(),s(),l(),u(),c(),ko=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),G=new WeakMap,Ao=new WeakMap,K=new WeakMap,q=new WeakMap,jo=new WeakSet,Mo=class{constructor(e,t){h(this,jo),f(this,G,void 0),f(this,Ao,void 0),f(this,K,!1),f(this,q,void 0),p(G,this,e),p(Ao,this,t)}next(){let e=()=>o(jo,this,wo).call(this);return p(q,this,d(q,this)?d(q,this).then(e,e):e()),d(q,this)}return(e){let t=()=>o(jo,this,To).call(this,e);return d(q,this)?d(q,this).then(t,t):t()}},No=Symbol(),Object.defineProperty(Eo,"name",{value:`next`}),Object.defineProperty(Do,"name",{value:`return`}),Po=Object.create(ko,{next:{enumerable:!0,configurable:!0,writable:!0,value:Eo},return:{enumerable:!0,configurable:!0,writable:!0,value:Do}})})),Io=t((()=>{Fo()})),Lo,Ro,zo,Bo,Vo,Ho=t((()=>{Co(),Io(),Lo=e=>{if(xo(e,{checkOpen:!1})&&Vo.on!==void 0)return zo(e);if(typeof e?.[Symbol.asyncIterator]==`function`)return e;if(Ro.call(e)===`[object ReadableStream]`)return Oo.call(e);throw TypeError(`The first argument must be a Readable, a ReadableStream, or an async iterable.`)},{toString:Ro}=Object.prototype,zo=async function*(e){let t=new AbortController,n={};Bo(e,t,n);try{for await(let[n]of Vo.on(e,`data`,{signal:t.signal}))yield n}catch(e){if(n.error!==void 0)throw n.error;if(!t.signal.aborted)throw e}finally{e.destroy()}},Bo=async(e,t,n)=>{try{await Vo.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(e){n.error=e}finally{t.abort()}},Vo={}})),Uo,Wo,Go,Ko,qo,Jo,Yo,Xo=t((()=>{Ho(),i(),Uo=async(e,{init:t,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,finalize:s},{maxBuffer:c=1/0}={})=>{let l=Lo(e),u=t();u.length=0;try{for await(let e of l){let t=n[qo(e)](e,u);Go({convertedChunk:t,state:u,getSize:r,truncateChunk:i,addChunk:a,maxBuffer:c})}return Wo({state:u,convertChunk:n,getSize:r,truncateChunk:i,addChunk:a,getFinalChunk:o,maxBuffer:c}),s(u)}catch(e){let t=typeof e==`object`&&e?e:Error(e);throw t.bufferedData=s(u),t}},Wo=({state:e,getSize:t,truncateChunk:n,addChunk:r,getFinalChunk:i,maxBuffer:a})=>{let o=i(e);o!==void 0&&Go({convertedChunk:o,state:e,getSize:t,truncateChunk:n,addChunk:r,maxBuffer:a})},Go=({convertedChunk:e,state:t,getSize:n,truncateChunk:r,addChunk:i,maxBuffer:a})=>{let o=n(e),s=t.length+o;if(s<=a){Ko(e,t,i,s);return}let c=r(e,a-t.length);throw c!==void 0&&Ko(c,t,i,a),new Yo},Ko=(e,t,n,r)=>{t.contents=n(e,t,r),t.length=r},qo=e=>{let t=typeof e;if(t===`string`)return`string`;if(t!==`object`||e===null)return`others`;if(globalThis.Buffer?.isBuffer(e))return`buffer`;let n=Jo.call(e);return n===`[object ArrayBuffer]`?`arrayBuffer`:n===`[object DataView]`?`dataView`:Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Jo.call(e.buffer)===`[object ArrayBuffer]`?`typedArray`:`others`},{toString:Jo}=Object.prototype,Yo=class extends Error{constructor(){super(`maxBuffer exceeded`),a(this,`name`,`MaxBufferError`)}}})),J,Zo,Qo,$o,es,ts=t((()=>{J=e=>e,Zo=()=>void 0,Qo=({contents:e})=>e,$o=e=>{throw Error(`Streams in object mode are not supported: ${String(e)}`)},es=e=>e.length}));async function ns(e,t){return Uo(e,os,t)}var rs,is,as,os,ss=t((()=>{Xo(),ts(),rs=()=>({contents:[]}),is=()=>1,as=(e,{contents:t})=>(t.push(e),t),os={init:rs,convertChunk:{string:J,buffer:J,arrayBuffer:J,dataView:J,typedArray:J,others:J},getSize:is,truncateChunk:Zo,addChunk:as,getFinalChunk:Zo,finalize:Qo}}));async function cs(e,t){return Uo(e,Ss,t)}var ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs=t((()=>{Xo(),ts(),ls=()=>({contents:new ArrayBuffer(0)}),us=e=>ds.encode(e),ds=new TextEncoder,fs=e=>new Uint8Array(e),ps=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),ms=(e,t)=>e.slice(0,t),hs=(e,{contents:t,length:n},r)=>{let i=xs()?_s(t,r):gs(t,r);return new Uint8Array(i).set(e,n),i},gs=(e,t)=>{if(t<=e.byteLength)return e;let n=new ArrayBuffer(vs(t));return new Uint8Array(n).set(new Uint8Array(e),0),n},_s=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let n=new ArrayBuffer(t,{maxByteLength:vs(t)});return new Uint8Array(n).set(new Uint8Array(e),0),n},vs=e=>ys**Math.ceil(Math.log(e)/Math.log(ys)),ys=2,bs=({contents:e,length:t})=>xs()?e:e.slice(0,t),xs=()=>`resize`in ArrayBuffer.prototype,Ss={init:ls,convertChunk:{string:us,buffer:fs,arrayBuffer:fs,dataView:ps,typedArray:ps,others:$o},getSize:es,truncateChunk:ms,addChunk:hs,getFinalChunk:Zo,finalize:bs}}));async function ws(e,t){return Uo(e,As,t)}var Ts,Es,Ds,Os,ks,As,js=t((()=>{Xo(),ts(),Ts=()=>({contents:``,textDecoder:new TextDecoder}),Es=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Ds=(e,{contents:t})=>t+e,Os=(e,t)=>e.slice(0,t),ks=({textDecoder:e})=>{let t=e.decode();return t===``?void 0:t},As={init:Ts,convertChunk:{string:J,buffer:Es,arrayBuffer:Es,dataView:Es,typedArray:Es,others:$o},getSize:es,truncateChunk:Os,addChunk:Ds,getFinalChunk:ks,finalize:Qo}})),Ms=t((()=>{ss(),Cs(),js(),Xo()})),Ns=t((()=>{Ms()})),Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs=t((()=>{Ns(),P(),F(),Ps=({error:e,stream:t,readableObjectMode:n,lines:r,encoding:i,fdNumber:a})=>{if(!(e instanceof Yo))throw e;if(a===`all`)return e;throw e.maxBufferInfo={fdNumber:a,unit:Fs(n,r,i)},t.destroy(),e},Fs=(e,t,n)=>e?`objects`:t?`lines`:n===`buffer`?`bytes`:`characters`,Is=(e,t,n)=>{if(t.length!==n)return;let r=new Yo;throw r.maxBufferInfo={fdNumber:`ipc`},r},Ls=(e,t)=>{let{streamName:n,threshold:r,unit:i}=Rs(e,t);return`Command's ${n} was larger than ${r} ${i}`},Rs=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:`output`,threshold:t[1],unit:`bytes`};let{maxBufferInfo:{fdNumber:n,unit:r}}=e;delete e.maxBufferInfo;let i=Mt(t,n);return n===`ipc`?{streamName:`IPC output`,threshold:i,unit:`messages`}:{streamName:vt(n),threshold:i,unit:r}},zs=(e,t,n)=>e?.code===`ENOBUFS`&&t!==null&&t.some(e=>e!==null&&e.length>Vs(n)),Bs=(e,t,n)=>{if(!t)return e;let r=Vs(n);return e.length>r?e.slice(0,r):e},Vs=([,e])=>e})),Us,Ws,Gs,Ks,qs,Js,Ys,Xs=t((()=>{yo(),j(),ro(),Xt(),Hs(),Vr(),R(),Us=({stdio:e,all:t,ipcOutput:n,originalError:r,signal:i,signalDescription:a,exitCode:o,escapedCommand:s,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m,maxBuffer:h,timeout:g,cwd:_})=>{let v=r?.code,y=Ws({originalError:r,timedOut:c,timeout:g,isMaxBuffer:d,maxBuffer:h,errorCode:v,signal:i,signalDescription:a,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:f,forceKillAfterDelay:p,killSignal:m}),b=Ks(r,_),x=`${y}: ${s}${b===void 0?``:`\n${b}`}`;return{originalMessage:b,shortMessage:x,message:[x,...t===void 0?[e[2],e[1]]:[t],...e.slice(3),n.map(e=>qs(e)).join(`
|
|
24
|
-
`)].map(e=>Vt(fo(Js(e)))).filter(Boolean).join(`
|
|
25
|
-
|
|
26
|
-
`)}},Ws=({originalError:e,timedOut:t,timeout:n,isMaxBuffer:r,maxBuffer:i,errorCode:a,signal:o,signalDescription:s,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:f,killSignal:p})=>{let m=Gs(d,f);return t?`Command timed out after ${n} milliseconds${m}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${m}`:`Command was gracefully canceled with ${o} (${s})`:l?`Command was canceled${m}`:r?`${Ls(e,i)}${m}`:a===void 0?d?`Command was killed with ${p} (${Br(p)})${m}`:o===void 0?c===void 0?`Command failed`:`Command failed with exit code ${c}`:`Command was killed with ${o} (${s})`:`Command failed with ${a}${m}`},Gs=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:``,Ks=(e,t)=>{if(e instanceof sr)return;let n=Vt(no(lr(e)?e.originalMessage:String(e?.message??e),t));return n===``?void 0:n},qs=e=>typeof e==`string`?e:oe(e),Js=e=>Array.isArray(e)?e.map(e=>fo(Ys(e))).filter(Boolean).join(`
|
|
27
|
-
`):Ys(e),Ys=e=>typeof e==`string`?e:A(e)?et(e):``})),Zs,Qs,$s,ec,tc,nc,rc=t((()=>{Vr(),Nn(),R(),Xs(),Zs=({command:e,escapedCommand:t,stdio:n,all:r,ipcOutput:i,options:{cwd:a},startTime:o})=>tc({command:e,escapedCommand:t,cwd:a,durationMs:Mn(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:n[1],stderr:n[2],all:r,stdio:n,ipcOutput:i,pipedFrom:[]}),Qs=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:o})=>$s({error:e,command:t,escapedCommand:n,startTime:a,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:r.length}),ipcOutput:[],options:i,isSync:o}),$s=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:_,cwd:v,maxBuffer:y},isSync:b})=>{let{exitCode:x,signal:ee,signalDescription:te}=nc(l,u),{originalMessage:ne,shortMessage:re,message:ie}=Us({stdio:d,all:f,ipcOutput:p,originalError:e,signal:ee,signalDescription:te,exitCode:x,escapedCommand:n,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:_,maxBuffer:y,timeout:h,cwd:v}),S=or(e,ie,b);return Object.assign(S,ec({error:S,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:x,signal:ee,signalDescription:te,stdio:d,all:f,ipcOutput:p,cwd:v,originalMessage:ne,shortMessage:re})),S},ec=({error:e,command:t,escapedCommand:n,startTime:r,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:f,all:p,ipcOutput:m,cwd:h,originalMessage:g,shortMessage:_})=>tc({shortMessage:_,originalMessage:g,command:t,escapedCommand:n,cwd:h,durationMs:Mn(r),failed:!0,timedOut:i,isCanceled:a,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:s,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:e.cause?.code,stdout:f[1],stderr:f[2],all:p,stdio:f,ipcOutput:m,pipedFrom:[]}),tc=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)),nc=(e,t)=>{let n=e===null?void 0:e,r=t===null?void 0:t;return{exitCode:n,signal:r,signalDescription:r===void 0?void 0:Br(t)}}}));function ic(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(sc(e*1e3)%1e3),nanoseconds:Math.trunc(sc(e*1e6)%1e3)}}function ac(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function oc(e){switch(typeof e){case`number`:if(Number.isFinite(e))return ic(e);break;case`bigint`:return ac(e)}throw TypeError(`Expected a finite number or bigint`)}var sc,cc=t((()=>{sc=e=>Number.isFinite(e)?e:0}));function lc(e,t){let n=typeof e==`bigint`;if(!n&&!Number.isFinite(e))throw TypeError(`Expected a finite number or bigint`);t={...t};let r=e<0?`-`:``;e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let i=[],a=(e,t)=>{let n=Math.floor(e*10**t+fc);return(Math.round(n)/10**t).toFixed(t)},o=(e,n,r,a)=>{if(!((i.length===0||!t.colonNotation)&&uc(e)&&!(t.colonNotation&&r===`m`))){if(a??(a=String(e)),t.colonNotation){let e=a.includes(`.`)?a.split(`.`)[0].length:a.length,t=i.length>0?2:1;a=`0`.repeat(Math.max(0,t-e))+a}else a+=t.verbose?` `+dc(n,e):r;i.push(a)}},s=oc(e),c=BigInt(s.days);if(t.hideYearAndDays?o(BigInt(c)*24n+BigInt(s.hours),`hour`,`h`):(t.hideYear?o(c,`day`,`d`):(o(c/365n,`year`,`y`),o(c%365n,`day`,`d`)),o(Number(s.hours),`hour`,`h`)),o(Number(s.minutes),`minute`,`m`),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let e=Number(s.seconds),n=Number(s.milliseconds),r=Number(s.microseconds),i=Number(s.nanoseconds);if(o(e,`second`,`s`),t.formatSubMilliseconds)o(n,`millisecond`,`ms`),o(r,`microsecond`,`µs`),o(i,`nanosecond`,`ns`);else{let e=n+r/1e3+i/1e6,a=typeof t.millisecondsDecimalDigits==`number`?t.millisecondsDecimalDigits:0,s=a?e.toFixed(a):e>=1?Math.round(e):Math.ceil(e);o(Number.parseFloat(s),`millisecond`,`ms`,s)}}else{let r=a((n?Number(e%pc):e)/1e3%60,typeof t.secondsDecimalDigits==`number`?t.secondsDecimalDigits:1),i=t.keepDecimalsOnWholeSeconds?r:r.replace(/\.0+$/,``);o(Number.parseFloat(i),`second`,`s`,i)}if(i.length===0)return r+`0`+(t.verbose?` milliseconds`:`ms`);let l=t.colonNotation?`:`:` `;return typeof t.unitCount==`number`&&(i=i.slice(0,Math.max(t.unitCount,1))),r+i.join(l)}var uc,dc,fc,pc,mc=t((()=>{cc(),uc=e=>e===0||e===0n,dc=(e,t)=>t===1||t===1n?e:`${e}s`,fc=1e-7,pc=24n*60n*60n*1000n})),hc,gc=t((()=>{Cn(),hc=(e,t)=>{e.failed&&_n({type:`error`,verboseMessage:e.shortMessage,verboseInfo:t,result:e})}})),_c,vc,yc=t((()=>{mc(),I(),Cn(),gc(),_c=(e,t)=>{Nt(t)&&(hc(e,t),vc(e,t))},vc=(e,t)=>{_n({type:`duration`,verboseMessage:`(done in ${lc(e.durationMs)})`,verboseInfo:t,result:e})}})),bc,xc=t((()=>{yc(),bc=(e,t,{reject:n})=>{if(_c(e,t),e.failed&&n)throw e;return e}})),Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,Y,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,X,qc,Jc,Yc,Xc,Zc,Z=t((()=>{Co(),k(),j(),Sc=(e,t)=>Y(e)?`asyncGenerator`:jc(e)?`generator`:Nc(e)?`fileUrl`:Fc(e)?`filePath`:Hc(e)?`webStream`:W(e,{checkOpen:!1})?`native`:A(e)?`uint8Array`:Wc(e)?`asyncIterable`:Gc(e)?`iterable`:Uc(e)?Tc({transform:e},t):Mc(e)?Cc(e,t):`native`,Cc=(e,t)=>So(e.transform,{checkOpen:!1})?wc(e,t):Uc(e.transform)?Tc(e,t):Oc(e,t),wc=(e,t)=>(Ec(e,t,`Duplex stream`),`duplex`),Tc=(e,t)=>(Ec(e,t,`web TransformStream`),`webTransform`),Ec=({final:e,binary:t,objectMode:n},r,i)=>{Dc(e,`${r}.final`,i),Dc(t,`${r}.binary`,i),kc(n,`${r}.objectMode`)},Dc=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${n}.`)},Oc=({transform:e,final:t,binary:n,objectMode:r},i)=>{if(e!==void 0&&!Ac(e))throw TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(So(t,{checkOpen:!1}))throw TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(Uc(t))throw TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!Ac(t))throw TypeError(`The \`${i}.final\` option must be a generator.`);return kc(n,`${i}.binary`),kc(r,`${i}.objectMode`),Y(e)||Y(t)?`asyncGenerator`:`generator`},kc=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`The \`${t}\` option must use a boolean.`)},Ac=e=>Y(e)||jc(e),Y=e=>Object.prototype.toString.call(e)===`[object AsyncGeneratorFunction]`,jc=e=>Object.prototype.toString.call(e)===`[object GeneratorFunction]`,Mc=e=>O(e)&&(e.transform!==void 0||e.final!==void 0),Nc=e=>Object.prototype.toString.call(e)===`[object URL]`,Pc=e=>Nc(e)&&e.protocol!==`file:`,Fc=e=>O(e)&&Object.keys(e).length>0&&Object.keys(e).every(e=>Ic.has(e))&&Lc(e.file),Ic=new Set([`file`,`append`]),Lc=e=>typeof e==`string`,Rc=(e,t)=>e===`native`&&typeof t==`string`&&!zc.has(t),zc=new Set([`ipc`,`ignore`,`inherit`,`overlapped`,`pipe`]),Bc=e=>Object.prototype.toString.call(e)===`[object ReadableStream]`,Vc=e=>Object.prototype.toString.call(e)===`[object WritableStream]`,Hc=e=>Bc(e)||Vc(e),Uc=e=>Bc(e?.readable)&&Vc(e?.writable),Wc=e=>Kc(e)&&typeof e[Symbol.asyncIterator]==`function`,Gc=e=>Kc(e)&&typeof e[Symbol.iterator]==`function`,Kc=e=>typeof e==`object`&&!!e,X=new Set([`generator`,`asyncGenerator`,`duplex`,`webTransform`]),qc=new Set([`fileUrl`,`filePath`,`fileNumber`]),Jc=new Set([`fileUrl`,`filePath`]),Yc=new Set([...Jc,`webStream`,`nodeStream`]),Xc=new Set([`webTransform`,`duplex`]),Zc={generator:`a generator`,asyncGenerator:`an async generator`,fileUrl:`a file URL`,filePath:`a file path string`,fileNumber:`a file descriptor number`,webStream:`a web stream`,nodeStream:`a Node.js stream`,webTransform:`a web TransformStream`,duplex:`a Duplex stream`,native:`any value`,iterable:`an iterable`,asyncIterable:`an async iterable`,string:`a string`,uint8Array:`a Uint8Array`}})),Qc,$c,el,tl,nl=t((()=>{Z(),Qc=(e,t,n,r)=>r===`output`?$c(e,t,n):el(e,t,n),$c=(e,t,n)=>{let r=t!==0&&n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:e??r}},el=(e,t,n)=>{let r=t===0?e===!0:n[t-1].value.readableObjectMode;return{writableObjectMode:r,readableObjectMode:t!==n.length-1&&(e??r)}},tl=(e,t)=>{let n=e.findLast(({type:e})=>X.has(e));return n===void 0?!1:t===`input`?n.value.writableObjectMode:n.value.readableObjectMode}})),rl,il,al,ol,sl,cl,ll,ul=t((()=>{k(),$a(),Z(),nl(),rl=(e,t,n,r)=>[...e.filter(({type:e})=>!X.has(e)),...il(e,t,n,r)],il=(e,t,n,{encoding:r})=>{let i=e.filter(({type:e})=>X.has(e)),a=Array.from({length:i.length});for(let[e,o]of Object.entries(i))a[e]=al({stdioItem:o,index:Number(e),newTransforms:a,optionName:t,direction:n,encoding:r});return ll(a,n)},al=({stdioItem:e,stdioItem:{type:t},index:n,newTransforms:r,optionName:i,direction:a,encoding:o})=>t===`duplex`?ol({stdioItem:e,optionName:i}):t===`webTransform`?sl({stdioItem:e,index:n,newTransforms:r,direction:a}):cl({stdioItem:e,index:n,newTransforms:r,direction:a,encoding:o}),ol=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:n,readableObjectMode:r},objectMode:i=r}},optionName:a})=>{if(i&&!r)throw TypeError(`The \`${a}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&r)throw TypeError(`The \`${a}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:n,readableObjectMode:r}}},sl=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i})=>{let{transform:a,objectMode:o}=O(t)?t:{transform:t},{writableObjectMode:s,readableObjectMode:c}=Qc(o,n,r,i);return{...e,value:{transform:a,writableObjectMode:s,readableObjectMode:c}}},cl=({stdioItem:e,stdioItem:{value:t},index:n,newTransforms:r,direction:i,encoding:a})=>{let{transform:o,final:s,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=O(t)?t:{transform:t},d=c||U.has(a),{writableObjectMode:f,readableObjectMode:p}=Qc(u,n,r,i);return{...e,value:{transform:o,final:s,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},ll=(e,t)=>t===`input`?e.reverse():e})),dl,fl,pl,ml,hl,gl,_l,vl,yl=t((()=>{Co(),Z(),dl=(e,t,n)=>{let r=e.map(e=>fl(e,t));if(r.includes(`input`)&&r.includes(`output`))throw TypeError(`The \`${n}\` option must not be an array of both readable and writable values.`);return r.find(Boolean)??vl},fl=({type:e,value:t},n)=>pl[n]??gl[e](t),pl=[`input`,`output`,`output`],ml=()=>void 0,hl=()=>`input`,gl={generator:ml,asyncGenerator:ml,fileUrl:ml,filePath:ml,iterable:hl,asyncIterable:hl,uint8Array:hl,webStream:e=>Vc(e)?`output`:`input`,nodeStream(e){return xo(e,{checkOpen:!1})?bo(e,{checkOpen:!1})?void 0:`input`:`output`},webTransform:ml,duplex:ml,native(e){let t=_l(e);if(t!==void 0)return t;if(W(e,{checkOpen:!1}))return gl.nodeStream(e)}},_l=e=>{if([0,C.stdin].includes(e))return`input`;if([1,2,C.stdout,C.stderr].includes(e))return`output`},vl=`output`})),bl,xl=t((()=>{bl=(e,t)=>t&&!e.includes(`ipc`)?[...e,`ipc`]:e})),Sl,Cl,wl,Tl,El,Dl,Ol=t((()=>{P(),xl(),I(),Sl=({stdio:e,ipc:t,buffer:n,...r},i,a)=>{let o=Cl(e,r).map((e,t)=>Tl(e,t));return a?El(o,n,i):bl(o,t)},Cl=(e,t)=>{if(e===void 0)return N.map(e=>t[e]);if(wl(t))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${N.map(e=>`\`${e}\``).join(`, `)}`);if(typeof e==`string`)return[e,e,e];if(!Array.isArray(e))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let n=Math.max(e.length,N.length);return Array.from({length:n},(t,n)=>e[n])},wl=e=>N.some(t=>e[t]!==void 0),Tl=(e,t)=>Array.isArray(e)?e.map(e=>Tl(e,t)):e??(t>=N.length?`ignore`:`pipe`),El=(e,t,n)=>e.map((e,r)=>!t[r]&&r!==0&&!Pt(n,r)&&Dl(e)?`ignore`:e),Dl=e=>e===`pipe`||Array.isArray(e)&&e.every(e=>e===`pipe`)})),kl,Al,jl,Ml,Nl,Pl,Fl=t((()=>{Co(),P(),j(),H(),kl=({stdioItem:e,stdioItem:{type:t},isStdioArray:n,fdNumber:r,direction:i,isSync:a})=>!n||t!==`native`?e:a?Al({stdioItem:e,fdNumber:r,direction:i}):Nl({stdioItem:e,fdNumber:r}),Al=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r,direction:i})=>{let a=jl({value:t,optionName:n,fdNumber:r,direction:i});if(a!==void 0)return a;if(W(t,{checkOpen:!1}))throw TypeError(`The \`${n}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},jl=({value:e,optionName:t,fdNumber:n,direction:r})=>{let i=Ml(e,n);if(i!==void 0){if(r===`output`)return{type:`fileNumber`,value:i,optionName:t};if(we.isatty(i))throw TypeError(`The \`${t}: ${ji(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:`uint8Array`,value:Xe(be(i)),optionName:t}}},Ml=(e,t)=>{if(e===`inherit`)return t;if(typeof e==`number`)return e;let n=_t.indexOf(e);if(n!==-1)return n},Nl=({stdioItem:e,stdioItem:{value:t,optionName:n},fdNumber:r})=>t===`inherit`?{type:`nodeStream`,value:Pl(r,t,n),optionName:n}:typeof t==`number`?{type:`nodeStream`,value:Pl(t,t,n),optionName:n}:W(t,{checkOpen:!1})?{type:`nodeStream`,value:t,optionName:n}:e,Pl=(e,t,n)=>{let r=_t[e];if(r===void 0)throw TypeError(`The \`${n}: ${t}\` option is invalid: no such standard stream.`);return r}})),Il,Ll,Rl,zl,Bl,Vl=t((()=>{Co(),j(),Z(),Il=({input:e,inputFile:t},n)=>n===0?[...Ll(e),...zl(t)]:[],Ll=e=>e===void 0?[]:[{type:Rl(e),value:e,optionName:`input`}],Rl=e=>{if(xo(e,{checkOpen:!1}))return`nodeStream`;if(typeof e==`string`)return`string`;if(A(e))return`uint8Array`;throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},zl=e=>e===void 0?[]:[{...Bl(e),optionName:`inputFile`}],Bl=e=>{if(Nc(e))return{type:`fileUrl`,value:e};if(Lc(e))return{type:`filePath`,value:{file:e}};throw Error("The `inputFile` option must be a file path string or a file URL.")}})),Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl=t((()=>{Z(),Hl=e=>e.filter((t,n)=>e.every((e,r)=>t.value!==e.value||n>=r||t.type===`generator`||t.type===`asyncGenerator`)),Ul=({stdioItem:{type:e,value:t,optionName:n},direction:r,fileDescriptors:i,isSync:a})=>{let o=Wl(i,e);if(o.length!==0){if(a){Gl({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});return}if(Yc.has(e))return Kl({otherStdioItems:o,type:e,value:t,optionName:n,direction:r});Xc.has(e)&&Jl({otherStdioItems:o,type:e,value:t,optionName:n})}},Wl=(e,t)=>e.flatMap(({direction:e,stdioItems:n})=>n.filter(e=>e.type===t).map((t=>({...t,direction:e})))),Gl=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{Jc.has(t)&&Kl({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})},Kl=({otherStdioItems:e,type:t,value:n,optionName:r,direction:i})=>{let a=e.filter(e=>ql(e,n));if(a.length===0)return;let o=a.find(e=>e.direction!==i);return Yl(o,r,t),i===`output`?a[0].stream:void 0},ql=({type:e,value:t},n)=>e===`filePath`?t.file===n.file:e===`fileUrl`?t.href===n.href:t===n,Jl=({otherStdioItems:e,type:t,value:n,optionName:r})=>{let i=e.find(({value:{transform:e}})=>e===n.transform);Yl(i,r,t)},Yl=(e,t,n)=>{if(e!==void 0)throw TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${Zc[n]} that is the same.`)}})),Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du=t((()=>{P(),ul(),nl(),Z(),yl(),Ol(),Fl(),Vl(),Xl(),Zl=(e,t,n,r)=>{let i=Sl(t,n,r).map((e,n)=>Ql({stdioOption:e,fdNumber:n,options:t,isSync:r})),a=ou({initialFileDescriptors:i,addProperties:e,options:t,isSync:r});return t.stdio=a.map(({stdioItems:e})=>uu(e)),a},Ql=({stdioOption:e,fdNumber:t,options:n,isSync:r})=>{let i=vt(t),{stdioItems:a,isStdioArray:o}=$l({stdioOption:e,fdNumber:t,options:n,optionName:i}),s=dl(a,t,i),c=rl(a.map(e=>kl({stdioItem:e,isStdioArray:o,fdNumber:t,direction:s,isSync:r})),i,s,n),l=tl(c,s);return au(c,l),{direction:s,objectMode:l,stdioItems:c}},$l=({stdioOption:e,fdNumber:t,options:n,optionName:r})=>{let i=Hl([...(Array.isArray(e)?e:[e]).map(e=>eu(e,r)),...Il(n,t)]),a=i.length>1;return tu(i,a,r),ru(i),{stdioItems:i,isStdioArray:a}},eu=(e,t)=>({type:Sc(e,t),value:e,optionName:t}),tu=(e,t,n)=>{if(e.length===0)throw TypeError(`The \`${n}\` option must not be an empty array.`);if(t){for(let{value:t,optionName:n}of e)if(nu.has(t))throw Error(`The \`${n}\` option must not include \`${t}\`.`)}},nu=new Set([`ignore`,`ipc`]),ru=e=>{for(let t of e)iu(t)},iu=({type:e,value:t,optionName:n})=>{if(Pc(t))throw TypeError(`The \`${n}: URL\` option must use the \`file:\` scheme.
|
|
28
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Rc(e,t))throw TypeError(`The \`${n}: { file: '...' }\` option must be used instead of \`${n}: '...'\`.`)},au=(e,t)=>{if(!t)return;let n=e.find(({type:e})=>qc.has(e));if(n!==void 0)throw TypeError(`The \`${n.optionName}\` option cannot use both files and transforms in objectMode.`)},ou=({initialFileDescriptors:e,addProperties:t,options:n,isSync:r})=>{let i=[];try{for(let a of e)i.push(su({fileDescriptor:a,fileDescriptors:i,addProperties:t,options:n,isSync:r}));return i}catch(e){throw lu(i),e}},su=({fileDescriptor:{direction:e,objectMode:t,stdioItems:n},fileDescriptors:r,addProperties:i,options:a,isSync:o})=>({direction:e,objectMode:t,stdioItems:n.map(t=>cu({stdioItem:t,addProperties:i,direction:e,options:a,fileDescriptors:r,isSync:o}))}),cu=({stdioItem:e,addProperties:t,direction:n,options:r,fileDescriptors:i,isSync:a})=>{let o=Ul({stdioItem:e,direction:n,fileDescriptors:i,isSync:a});return o===void 0?{...e,...t[n][e.type](e,r)}:{...e,stream:o}},lu=e=>{for(let{stdioItems:t}of e)for(let{stream:e}of t)e!==void 0&&!M(e)&&e.destroy()},uu=e=>{if(e.length>1)return e.some(({value:e})=>e===`overlapped`)?`overlapped`:`pipe`;let[{type:t,value:n}]=e;return t===`native`?n:`pipe`}})),fu,Q,pu,mu,hu,gu,_u=t((()=>{j(),du(),Z(),fu=(e,t)=>Zl(gu,e,t,!0),Q=({type:e,optionName:t})=>{mu(t,Zc[e])},pu=({optionName:e,value:t})=>((t===`ipc`||t===`overlapped`)&&mu(e,`"${t}"`),{}),mu=(e,t)=>{throw TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},hu={generator(){},asyncGenerator:Q,webStream:Q,nodeStream:Q,webTransform:Q,duplex:Q,asyncIterable:Q,native:pu},gu={input:{...hu,fileUrl:({value:e})=>({contents:[Xe(be(e))]}),filePath:({value:{file:e}})=>({contents:[Xe(be(e))]}),fileNumber:Q,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...hu,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Q,string:Q,uint8Array:Q}}})),vu,yu,bu=t((()=>{yo(),vu=(e,{stripFinalNewline:t},n)=>yu(t,n)&&e!==void 0&&!Array.isArray(e)?fo(e):e,yu=(e,t)=>t===`all`?e[1]||e[2]:e[t]})),xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu=t((()=>{xu=(e,t,n,r)=>e||n?void 0:wu(t,r),Su=(e,t,n)=>n?e.flatMap(e=>Cu(e,t)):Cu(e,t),Cu=(e,t)=>{let{transform:n,final:r}=wu(t,{});return[...n(e),...r()]},wu=(e,t)=>(t.previousChunks=``,{transform:Tu.bind(void 0,t,e),final:Du.bind(void 0,t)}),Tu=function*(e,t,n){if(typeof n!=`string`){yield n;return}let{previousChunks:r}=e,i=-1;for(let a=0;a<n.length;a+=1)if(n[a]===`
|
|
29
|
-
`){let o=Eu(n,a,t,e),s=n.slice(i+1,a+1-o);r.length>0&&(s=Au(r,s),r=``),yield s,i=a}i!==n.length-1&&(r=Au(r,n.slice(i+1))),e.previousChunks=r},Eu=(e,t,n,r)=>n?0:(r.isWindowsNewline=t!==0&&e[t-1]===`\r`,r.isWindowsNewline?2:1),Du=function*({previousChunks:e}){e.length>0&&(yield e)},Ou=({binary:e,preserveNewlines:t,readableObjectMode:n,state:r})=>e||t||n?void 0:{transform:ku.bind(void 0,r)},ku=function*({isWindowsNewline:e=!1},t){let{unixNewline:n,windowsNewline:r,LF:i,concatBytes:a}=typeof t==`string`?ju:Nu;if(t.at(-1)===i){yield t;return}yield a(t,e?r:n)},Au=(e,t)=>`${e}${t}`,ju={windowsNewline:`\r
|
|
30
|
-
`,unixNewline:`
|
|
31
|
-
`,LF:`
|
|
32
|
-
`,concatBytes:Au},Mu=(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},Nu={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:Mu}})),Fu,Iu,Lu,Ru,zu,Bu,Vu=t((()=>{j(),Fu=(e,t)=>e?void 0:Iu.bind(void 0,t),Iu=function*(e,t){if(typeof t!=`string`&&!A(t)&&!Pe.isBuffer(t))throw TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},Lu=(e,t)=>e?Ru.bind(void 0,t):zu.bind(void 0,t),Ru=function*(e,t){Bu(e,t),yield t},zu=function*(e,t){if(Bu(e,t),typeof t!=`string`&&!A(t))throw TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},Bu=(e,t)=>{if(t==null)throw TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
|
|
33
|
-
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
34
|
-
if (condition) { yield value; }`)}})),Hu,Uu,Wu,Gu,Ku=t((()=>{j(),Hu=(e,t,n)=>{if(n)return;if(e)return{transform:Uu.bind(void 0,new TextEncoder)};let r=new Ie(t);return{transform:Wu.bind(void 0,r),final:Gu.bind(void 0,r)}},Uu=function*(e,t){Pe.isBuffer(t)?yield Xe(t):typeof t==`string`?yield e.encode(t):yield t},Wu=function*(e,t){yield A(t)?e.write(t):t},Gu=function*(e){let t=e.end();t!==``&&(yield t)}})),qu,Ju,Yu,Xu,Zu,Qu,$u=t((()=>{qu=S(async(e,t,n,r)=>{t.currentIterable=e(...n);try{for await(let e of t.currentIterable)r.push(e)}finally{delete t.currentIterable}}),Ju=async function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=Qu}=t[n];for await(let i of r(e))yield*Ju(i,t,n+1)},Yu=async function*(e){for(let[t,{final:n}]of Object.entries(e))yield*Xu(n,Number(t),e)},Xu=async function*(e,t,n){if(e!==void 0)for await(let r of e())yield*Ju(r,n,t+1)},Zu=S(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Qu=function*(e){yield e}})),ed,td,nd,rd,id,ad,od=t((()=>{ed=(e,t,n,r)=>{try{for(let r of e(...t))n.push(r);r()}catch(e){r(e)}},td=(e,t)=>[...t.flatMap(t=>[...nd(t,e,0)]),...rd(e)],nd=function*(e,t,n){if(n===t.length){yield e;return}let{transform:r=ad}=t[n];for(let i of r(e))yield*nd(i,t,n+1)},rd=function*(e){for(let[t,{final:n}]of Object.entries(e))yield*id(n,Number(t),e)},id=function*(e,t,n){if(e!==void 0)for(let r of e())yield*nd(r,n,t+1)},ad=function*(e){yield e}})),sd,cd,ld,ud=t((()=>{Z(),Pu(),Vu(),Ku(),$u(),od(),sd=({value:e,value:{transform:t,final:n,writableObjectMode:r,readableObjectMode:i},optionName:a},{encoding:o})=>{let s={},c=ld(e,o,a),l=Y(t),u=Y(n),d=l?qu.bind(void 0,Ju,s):ed.bind(void 0,nd),f=l||u?qu.bind(void 0,Yu,s):ed.bind(void 0,rd),p=l||u?Zu.bind(void 0,s):void 0;return{stream:new je({writableObjectMode:r,writableHighWaterMark:Ne(r),readableObjectMode:i,readableHighWaterMark:Ne(i),transform(e,t,n){d([e,c,0],this,n)},flush(e){f([c],this,e)},destroy:p})}},cd=(e,t,n,r)=>{let i=t.filter(({type:e})=>e===`generator`),a=r?i.reverse():i;for(let{value:t,optionName:r}of a)e=td(ld(t,n,r),e);return e},ld=({transform:e,final:t,binary:n,writableObjectMode:r,readableObjectMode:i,preserveNewlines:a},o,s)=>{let c={};return[{transform:Fu(r,s)},Hu(n,o,r),xu(n,a,r,c),{transform:e,final:t},{transform:Lu(i,s)},Ou({binary:n,preserveNewlines:a,readableObjectMode:i,state:c})].filter(Boolean)}})),dd,fd,pd,md,hd,gd=t((()=>{ud(),j(),Z(),dd=(e,t)=>{for(let n of fd(e))pd(e,n,t)},fd=e=>new Set(Object.entries(e).filter(([,{direction:e}])=>e===`input`).map(([e])=>Number(e))),pd=(e,t,n)=>{let{stdioItems:r}=e[t],i=r.filter(({contents:e})=>e!==void 0);if(i.length!==0){if(t!==0){let[{type:e,optionName:t}]=i;throw TypeError(`Only the \`stdin\` option, not \`${t}\`, can be ${Zc[e]} with synchronous methods.`)}n.input=rt(i.map(({contents:e})=>e).map(e=>md(e,r)))}},md=(e,t)=>{let n=cd(e,t,`utf8`,!0);return hd(n),rt(n)},hd=e=>{let t=e.find(e=>typeof e!=`string`&&!A(e));if(t!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)}})),_d,vd,yd,bd,xd,Sd,Cd,wd=t((()=>{$a(),Z(),Cn(),I(),_d=({stdioItems:e,encoding:t,verboseInfo:n,fdNumber:r})=>r!==`all`&&Pt(n,r)&&!U.has(t)&&vd(r)&&(e.some(({type:e,value:t})=>e===`native`&&yd.has(t))||e.every(({type:e})=>X.has(e))),vd=e=>e===1||e===2,yd=new Set([`pipe`,`overlapped`]),bd=async(e,t,n,r)=>{for await(let i of e)Sd(t)||Cd(i,n,r)},xd=(e,t,n)=>{for(let r of e)Cd(r,t,n)},Sd=e=>e._readableState.pipes.length>0,Cd=(e,t,n)=>{_n({type:`output`,verboseMessage:xn(e),fdNumber:t,verboseInfo:n})}})),Td,Ed,Dd,Od,kd,Ad,jd=t((()=>{wd(),ud(),Pu(),j(),Z(),Hs(),Td=({fileDescriptors:e,syncResult:{output:t},options:n,isMaxBuffer:r,verboseInfo:i})=>{if(t===null)return{output:Array.from({length:3})};let a={},o=new Set([]);return{output:t.map((t,s)=>Ed({result:t,fileDescriptors:e,fdNumber:s,state:a,outputFiles:o,isMaxBuffer:r,verboseInfo:i},n)),...a}},Ed=({result:e,fileDescriptors:t,fdNumber:n,state:r,outputFiles:i,isMaxBuffer:a,verboseInfo:o},{buffer:s,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(e===null)return;let f=Xe(Bs(e,a,d)),{stdioItems:p,objectMode:m}=t[n],h=Dd([f],p,c,r),{serializedResult:g,finalResult:_=g}=Od({chunks:h,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:n});kd({serializedResult:g,fdNumber:n,state:r,verboseInfo:o,encoding:c,stdioItems:p,objectMode:m});let v=s[n]?_:void 0;try{return r.error===void 0&&Ad(g,p,i),v}catch(e){return r.error=e,v}},Dd=(e,t,n,r)=>{try{return cd(e,t,n,!1)}catch(t){return r.error=t,e}},Od=({chunks:e,objectMode:t,encoding:n,lines:r,stripFinalNewline:i,fdNumber:a})=>{if(t)return{serializedResult:e};if(n===`buffer`)return{serializedResult:rt(e)};let o=tt(e,n);return r[a]?{serializedResult:o,finalResult:Su(o,!i[a],t)}:{serializedResult:o}},kd=({serializedResult:e,fdNumber:t,state:n,verboseInfo:r,encoding:i,stdioItems:a,objectMode:o})=>{if(!_d({stdioItems:a,encoding:i,verboseInfo:r,fdNumber:t}))return;let s=Su(e,!1,o);try{xd(s,t,r)}catch(e){n.error??(n.error=e)}},Ad=(e,t,n)=>{for(let{path:r,append:i}of t.filter(({type:e})=>qc.has(e))){let t=typeof r==`string`?r:r.toString();i||n.has(t)?_e(r,e):(n.add(t),Se(r,e))}}})),Md,Nd=t((()=>{j(),bu(),Md=([,e,t],n)=>{if(n.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,vu(t,n,`all`)]:Array.isArray(t)?[vu(e,n,`all`),...t]:A(e)&&A(t)?at([e,t]):`${e}${t}`}})),Pd,Fd,Id,Ld,Rd,zd,Bd=t((()=>{R(),Pd=async(e,t)=>{let[n,r]=await Fd(e);return t.isForcefullyTerminated??(t.isForcefullyTerminated=!1),[n,r]},Fd=async e=>{let[t,n]=await Promise.allSettled([T(e,`spawn`),T(e,`exit`)]);return t.status===`rejected`?[]:n.status===`rejected`?Id(e):n.value},Id=async e=>{try{return await T(e,`exit`)}catch{return Id(e)}},Ld=async e=>{let[t,n]=await e;if(!Rd(t,n)&&zd(t,n))throw new sr;return[t,n]},Rd=(e,t)=>e===void 0&&t===void 0,zd=(e,t)=>e!==0||t!==null})),Vd,Hd,Ud=t((()=>{R(),Hs(),Bd(),Vd=({error:e,status:t,signal:n,output:r},{maxBuffer:i})=>{let a=Hd(e,t,n);return{resultError:a,exitCode:t,signal:n,timedOut:a?.code===`ETIMEDOUT`,isMaxBuffer:zs(a,r,i)}},Hd=(e,t,n)=>e===void 0?zd(t,n)?new sr:void 0:e})),Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d=t((()=>{Fn(),co(),uo(),rc(),xc(),_u(),bu(),gd(),jd(),Hs(),Nd(),Ud(),Wd=(e,t,n)=>{let{file:r,commandArguments:i,command:a,escapedCommand:o,startTime:s,verboseInfo:c,options:l,fileDescriptors:u}=Gd(e,t,n);return bc(Yd({file:r,commandArguments:i,options:l,command:a,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:s}),c,l)},Gd=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Pn(e,t,n),{file:s,commandArguments:c,options:l}=ao(e,t,Kd(n));return qd(l),{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:l,fileDescriptors:fu(l,o)}},Kd=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,qd=({ipc:e,ipcInput:t,detached:n,cancelSignal:r})=>{t&&Jd(`ipcInput`),e&&Jd(`ipc: true`),n&&Jd(`detached: true`),r&&Jd(`cancelSignal`)},Jd=e=>{throw TypeError(`The "${e}" option cannot be used with synchronous methods.`)},Yd=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,verboseInfo:a,fileDescriptors:o,startTime:s})=>{let c=Xd({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:o,startTime:s});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Vd(c,n),{output:m,error:h=l}=Td({fileDescriptors:o,syncResult:c,options:n,isMaxBuffer:p,verboseInfo:a}),g=m.map((e,t)=>vu(e,n,t)),_=vu(Md(m,n),n,`all`);return Qd({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:_,options:n,command:r,escapedCommand:i,startTime:s})},Xd=({file:e,commandArguments:t,options:n,command:r,escapedCommand:i,fileDescriptors:a,startTime:o})=>{try{return dd(a,n),ge(...lo(e,t,Zd(n)))}catch(e){return Qs({error:e,command:r,escapedCommand:i,fileDescriptors:a,options:n,startTime:o,isSync:!0})}},Zd=({encoding:e,maxBuffer:t,...n})=>({...n,encoding:`buffer`,maxBuffer:Vs(t)}),Qd=({error:e,exitCode:t,signal:n,timedOut:r,isMaxBuffer:i,stdio:a,all:o,options:s,command:c,escapedCommand:l,startTime:u})=>e===void 0?Zs({command:c,escapedCommand:l,stdio:a,all:o,ipcOutput:[],options:s,startTime:u}):$s({error:e,command:c,escapedCommand:l,timedOut:r,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:t,signal:n,stdio:a,all:o,ipcOutput:[],options:s,startTime:u,isSync:!0})})),ef,tf,nf,rf,af,of=t((()=>{yi(),Yi(),Bi(),ef=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0,filter:a}={})=>(ni({methodName:`getOneMessage`,isSubprocess:n,ipc:r,isConnected:Ji(e)}),tf({anyProcess:e,channel:t,isSubprocess:n,filter:a,reference:i})),tf=async({anyProcess:e,channel:t,isSubprocess:n,filter:r,reference:i})=>{Pi(t,i);let a=Gi(e,t,n),o=new AbortController;try{return await Promise.race([nf(a,r,o),rf(a,n,o),af(a,n,o)])}catch(t){throw vi(e),t}finally{o.abort(),Ii(t,i)}},nf=async(e,t,{signal:n})=>{if(t===void 0){let[t]=await T(e,`message`,{signal:n});return t}for await(let[r]of De(e,`message`,{signal:n}))if(t(r))return r},rf=async(e,t,{signal:n})=>{await T(e,`disconnect`,{signal:n}),ai(t)},af=async(e,t,{signal:n})=>{let[r]=await T(e,`strict:error`,{signal:n});throw si(r,t)}})),sf,cf,lf,uf,df,ff,pf=t((()=>{yi(),Yi(),Bi(),sf=({anyProcess:e,channel:t,isSubprocess:n,ipc:r},{reference:i=!0}={})=>cf({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:!n,reference:i}),cf=({anyProcess:e,channel:t,isSubprocess:n,ipc:r,shouldAwait:i,reference:a})=>{ni({methodName:`getEachMessage`,isSubprocess:n,ipc:r,isConnected:Ji(e)}),Pi(t,a);let o=Gi(e,t,n),s=new AbortController,c={};return lf(e,o,s),uf({ipcEmitter:o,isSubprocess:n,controller:s,state:c}),df({anyProcess:e,channel:t,ipcEmitter:o,isSubprocess:n,shouldAwait:i,controller:s,state:c,reference:a})},lf=async(e,t,n)=>{try{await T(t,`disconnect`,{signal:n.signal}),n.abort()}catch{}},uf=async({ipcEmitter:e,isSubprocess:t,controller:n,state:r})=>{try{let[i]=await T(e,`strict:error`,{signal:n.signal});r.error=si(i,t),n.abort()}catch{}},df=async function*({anyProcess:e,channel:t,ipcEmitter:n,isSubprocess:r,shouldAwait:i,controller:a,state:o,reference:s}){try{for await(let[e]of De(n,`message`,{signal:a.signal}))ff(o),yield e}catch{ff(o)}finally{a.abort(),Ii(t,s),r||vi(e),i&&await e}},ff=({error:e})=>{if(e)throw e}})),mf,hf,gf,_f=t((()=>{ya(),of(),pf(),Oa(),mf=(e,{ipc:t})=>{Object.assign(e,gf(e,!1,t))},hf=()=>{let e=C,t=C.channel!==void 0;return{...gf(e,!0,t),getCancelSignal:xa.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:!0,ipc:t})}},gf=(e,t,n)=>({sendMessage:ma.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getOneMessage:ef.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n}),getEachMessage:sf.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:n})})})),vf,yf,bf,xf,Sf,Cf,wf,Tf=t((()=>{du(),rc(),xc(),vf=({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,verboseInfo:o})=>{lu(r);let s=new pe;yf(s,r),Object.assign(s,{readable:xf,writable:Sf,duplex:Cf});let c=Qs({error:e,command:t,escapedCommand:n,fileDescriptors:r,options:i,startTime:a,isSync:!1});return{subprocess:s,promise:wf(c,o,i)}},yf=(e,t)=>{let n=bf(),r=bf(),i=bf(),a=Array.from({length:t.length-3},bf),o=bf(),s=[n,r,i,...a];Object.assign(e,{stdin:n,stdout:r,stderr:i,all:o,stdio:s})},bf=()=>{let e=new Ae;return e.end(),e},xf=()=>new E({read(){}}),Sf=()=>new Me({write(){}}),Cf=()=>new ke({read(){},write(){}}),wf=async(e,t,n)=>bc(e,t,n)})),Ef,Df,Of,kf,Af=t((()=>{ud(),du(),Z(),Ef=(e,t)=>Zl(kf,e,t,!1),Df=({type:e,optionName:t})=>{throw TypeError(`The \`${t}\` option cannot be ${Zc[e]}.`)},Of={fileNumber:Df,generator:sd,asyncGenerator:sd,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:n}}){let r=t||n;return{stream:ke.fromWeb(e,{objectMode:r})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},kf={input:{...Of,fileUrl:({value:e})=>({stream:ve(e)}),filePath:({value:{file:e}})=>({stream:ve(e)}),webStream:({value:e})=>({stream:E.fromWeb(e)}),iterable:({value:e})=>({stream:E.from(e)}),asyncIterable:({value:e})=>({stream:E.from(e)}),string:({value:e})=>({stream:E.from(e)}),uint8Array:({value:e})=>({stream:E.from(Pe.from(e))})},output:{...Of,fileUrl:({value:e})=>({stream:ye(e)}),filePath:({value:{file:e,append:t}})=>({stream:ye(e,t?{flags:`a`}:{})}),webStream:({value:e})=>({stream:Me.fromWeb(e)}),iterable:Df,asyncIterable:Df,string:Df,uint8Array:Df}}}));function jf(e){if(!Array.isArray(e))throw TypeError(`Expected an array, got \`${typeof e}\`.`);for(let t of e)Uf(t);let t=e.some(({readableObjectMode:e})=>e),n=Mf(e,t),r=new zf({objectMode:t,writableHighWaterMark:n,readableHighWaterMark:n});for(let t of e)r.add(t);return r}var Mf,Nf,Pf,Ff,If,Lf,Rf,zf,Bf,Vf,Hf,Uf,Wf,Gf,Kf,qf,Jf,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp=t((()=>{s(),c(),l(),Mf=(e,t)=>{if(e.length===0)return Ne(t);let n=e.filter(({readableObjectMode:e})=>e===t).map(({readableHighWaterMark:e})=>e);return Math.max(...n)},Nf=new WeakMap,Pf=new WeakMap,Ff=new WeakMap,If=new WeakMap,Lf=new WeakMap,Rf=new WeakMap,zf=class extends Ae{constructor(...e){super(...e),f(this,Nf,new Set([])),f(this,Pf,new Set([])),f(this,Ff,new Set([])),f(this,If,void 0),f(this,Lf,Symbol(`unpipe`)),f(this,Rf,new WeakMap)}add(e){if(Uf(e),d(Nf,this).has(e))return;d(Nf,this).add(e),d(If,this)??p(If,this,Bf(this,d(Nf,this),d(Lf,this)));let t=Wf({passThroughStream:this,stream:e,streams:d(Nf,this),ended:d(Pf,this),aborted:d(Ff,this),onFinished:d(If,this),unpipeEvent:d(Lf,this)});d(Rf,this).set(e,t),e.pipe(this,{end:!1})}async remove(e){if(Uf(e),!d(Nf,this).has(e))return!1;let t=d(Rf,this).get(e);return t===void 0?!1:(d(Rf,this).delete(e),e.unpipe(this),await t,!0)}},Bf=async(e,t,n)=>{ep(e,tp);let r=new AbortController;try{await Promise.race([Vf(e,r),Hf(e,t,n,r)])}finally{r.abort(),ep(e,-tp)}},Vf=async(e,{signal:t})=>{try{await D(e,{signal:t,cleanup:!0})}catch(t){throw Yf(e,t),t}},Hf=async(e,t,n,{signal:r})=>{for await(let[i]of De(e,`unpipe`,{signal:r}))t.has(i)&&i.emit(n)},Uf=e=>{if(typeof e?.pipe!=`function`)throw TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},Wf=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,onFinished:a,unpipeEvent:o})=>{ep(e,np);let s=new AbortController;try{await Promise.race([Gf(a,t,s),Kf({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:s}),qf({stream:t,streams:n,ended:r,aborted:i,unpipeEvent:o,controller:s})])}finally{s.abort(),ep(e,-np)}n.size>0&&n.size===r.size+i.size&&(r.size===0&&i.size>0?Zf(e):Jf(e))},Gf=async(e,t,{signal:n})=>{try{await e,n.aborted||Zf(t)}catch(e){n.aborted||Yf(t,e)}},Kf=async({passThroughStream:e,stream:t,streams:n,ended:r,aborted:i,controller:{signal:a}})=>{try{await D(t,{signal:a,cleanup:!0,readable:!0,writable:!1}),n.has(t)&&r.add(t)}catch(r){if(a.aborted||!n.has(t))return;Xf(r)?i.add(t):Qf(e,r)}},qf=async({stream:e,streams:t,ended:n,aborted:r,unpipeEvent:i,controller:{signal:a}})=>{if(await T(e,i,{signal:a}),!e.readable)return T(a,`abort`,{signal:a});t.delete(e),n.delete(e),r.delete(e)},Jf=e=>{e.writable&&e.end()},Yf=(e,t)=>{Xf(t)?Zf(e):Qf(e,t)},Xf=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,Zf=e=>{(e.readable||e.writable)&&e.destroy()},Qf=(e,t)=>{e.destroyed||(e.once(`error`,$f),e.destroy(t))},$f=()=>{},ep=(e,t)=>{let n=e.getMaxListeners();n!==0&&n!==1/0&&e.setMaxListeners(n+t)},tp=2,np=1})),ip,ap,op,sp,cp,lp=t((()=>{P(),ip=(e,t)=>{e.pipe(t),ap(e,t),sp(e,t)},ap=async(e,t)=>{if(!(M(e)||M(t))){try{await D(e,{cleanup:!0,readable:!0,writable:!1})}catch{}op(t)}},op=e=>{e.writable&&e.end()},sp=async(e,t)=>{if(!(M(e)||M(t))){try{await D(t,{cleanup:!0,readable:!1,writable:!0})}catch{}cp(e)}},cp=e=>{e.readable&&e.destroy()}})),up,dp,fp,pp,mp,hp,gp=t((()=>{rp(),P(),Ni(),Z(),lp(),up=(e,t,n)=>{let r=new Map;for(let[i,{stdioItems:a,direction:o}]of Object.entries(t)){for(let{stream:t}of a.filter(({type:e})=>X.has(e)))dp(e,t,o,i);for(let{stream:t}of a.filter(({type:e})=>!X.has(e)))pp({subprocess:e,stream:t,direction:o,fdNumber:i,pipeGroups:r,controller:n})}for(let[e,t]of r.entries())ip(t.length===1?t[0]:jf(t),e)},dp=(e,t,n,r)=>{n===`output`?ip(e.stdio[r],t):ip(t,e.stdio[r]);let i=fp[r];i!==void 0&&(e[i]=t),e.stdio[r]=t},fp=[`stdin`,`stdout`,`stderr`],pp=({subprocess:e,stream:t,direction:n,fdNumber:r,pipeGroups:i,controller:a})=>{if(t===void 0)return;mp(t,a);let[o,s]=n===`output`?[t,e.stdio[r]]:[e.stdio[r],t],c=i.get(o)??[];i.set(o,[...c,s])},mp=(e,{signal:t})=>{M(e)&&Mi(e,hp,t)},hp=2})),_p,vp=t((()=>{v(),_p=(e,{cleanup:t,detached:n},{signal:r})=>{if(!t||n)return;let i=g(()=>{e.kill()});Ee(r,()=>{i()})}})),yp,bp,xp,Sp,Cp,wp=t((()=>{qe(),Nn(),H(),Ge(),yp=({source:e,sourcePromise:t,boundOptions:n,createNested:r},...i)=>{let a=jn(),{destination:o,destinationStream:s,destinationError:c,from:l,unpipeSignal:u}=bp(n,r,i),{sourceStream:d,sourceError:f}=Cp(e,l),{options:p,fileDescriptors:m}=V.get(e);return{sourcePromise:t,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:s,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:a}},bp=(e,t,n)=>{try{let{destination:r,pipeOptions:{from:i,to:a,unpipeSignal:o}={}}=xp(e,t,...n);return{destination:r,destinationStream:Si(r,a),from:i,unpipeSignal:o}}catch(e){return{destinationError:e}}},xp=(e,t,n,...r)=>{if(Array.isArray(n))return{destination:t(Sp,e)(n,...r),pipeOptions:e};if(typeof n==`string`||n instanceof URL||Ue(n)){if(Object.keys(e).length>0)throw TypeError(`Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).`);let[i,a,o]=Ke(n,...r);return{destination:t(Sp)(i,a,o),pipeOptions:o}}if(V.has(n)){if(Object.keys(e).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:n,pipeOptions:r[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${n}`)},Sp=({options:e})=>({options:{...e,stdin:`pipe`,piped:!0}}),Cp=(e,t)=>{try{return{sourceStream:Ci(e,t)}}catch(e){return{sourceError:e}}}})),Tp,Ep,Dp,Op,kp=t((()=>{rc(),lp(),Tp=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r,fileDescriptors:i,sourceOptions:a,startTime:o})=>{let s=Ep({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r});if(s!==void 0)throw Dp({error:s,fileDescriptors:i,sourceOptions:a,startTime:o})},Ep=({sourceStream:e,sourceError:t,destinationStream:n,destinationError:r})=>{if(t!==void 0&&r!==void 0)return r;if(r!==void 0)return cp(e),r;if(t!==void 0)return op(n),t},Dp=({error:e,fileDescriptors:t,sourceOptions:n,startTime:r})=>Qs({error:e,command:Op,escapedCommand:Op,fileDescriptors:t,options:n,startTime:r,isSync:!1}),Op=`source.pipe(destination)`})),Ap,jp=t((()=>{Ap=async e=>{let[{status:t,reason:n,value:r=n},{status:i,reason:a,value:o=a}]=await e;if(o.pipedFrom.includes(r)||o.pipedFrom.push(r),i===`rejected`)throw o;if(t===`rejected`)throw r;return o}})),Mp,Np,Pp,Fp,Ip,Lp,Rp,zp=t((()=>{rp(),Ni(),lp(),Mp=(e,t,n)=>{let r=Ip.has(t)?Pp(e,t):Np(e,t);return Mi(e,Lp,n.signal),Mi(t,Rp,n.signal),Fp(t),r},Np=(e,t)=>{let n=jf([e]);return ip(n,t),Ip.set(t,n),n},Pp=(e,t)=>{let n=Ip.get(t);return n.add(e),n},Fp=async e=>{try{await D(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Ip.delete(e)},Ip=new WeakMap,Lp=2,Rp=1})),Bp,Vp,Hp=t((()=>{kp(),Bp=(e,t)=>e===void 0?[]:[Vp(e,t)],Vp=async(e,{sourceStream:t,mergedStream:n,fileDescriptors:r,sourceOptions:i,startTime:a})=>{throw await ie(e,t),await n.remove(t),Dp({error:Error("Pipe canceled by `unpipeSignal` option."),fileDescriptors:r,sourceOptions:i,startTime:a})}})),Up,Wp,Gp,Kp=t((()=>{k(),wp(),kp(),jp(),zp(),Hp(),Up=(e,...t)=>{if(O(t[0]))return Up.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:n,...r}=yp(e,...t),i=Wp({...r,destination:n});return i.pipe=Up.bind(void 0,{...e,source:n,sourcePromise:i,boundOptions:{}}),i},Wp=async({sourcePromise:e,sourceStream:t,sourceOptions:n,sourceError:r,destination:i,destinationStream:a,destinationError:o,unpipeSignal:s,fileDescriptors:c,startTime:l})=>{let u=Gp(e,i);Tp({sourceStream:t,sourceError:r,destinationStream:a,destinationError:o,fileDescriptors:c,sourceOptions:n,startTime:l});let d=new AbortController;try{let e=Mp(t,a,d);return await Promise.race([Ap(u),...Bp(s,{sourceStream:t,mergedStream:e,sourceOptions:n,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Gp=(e,t)=>Promise.allSettled([e,t])})),qp,Jp,Yp,Xp,Zp,Qp,$p,em,tm,nm=t((()=>{Ku(),Pu(),od(),qp=({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:r,encoding:i,preserveNewlines:a})=>{let o=new AbortController;return Jp(t,o),Zp({stream:e,controller:o,binary:n,shouldEncode:!e.readableObjectMode&&r,encoding:i,shouldSplit:!e.readableObjectMode,preserveNewlines:a})},Jp=async(e,t)=>{try{await e}catch{}finally{t.abort()}},Yp=({stream:e,onStreamEnd:t,lines:n,encoding:r,stripFinalNewline:i,allMixed:a})=>{let o=new AbortController;Xp(t,o,e);let s=e.readableObjectMode&&!a;return Zp({stream:e,controller:o,binary:r===`buffer`,shouldEncode:!s,encoding:r,shouldSplit:!s&&n,preserveNewlines:!i})},Xp=async(e,t,n)=>{try{await e}catch{n.destroy()}finally{t.abort()}},Zp=({stream:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})=>{let s=De(e,`data`,{signal:t.signal,highWaterMark:$p,highWatermark:$p});return em({onStdoutChunk:s,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o})},Qp=Ne(!0),$p=Qp,em=async function*({onStdoutChunk:e,controller:t,binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o}){let s=tm({binary:n,shouldEncode:r,encoding:i,shouldSplit:a,preserveNewlines:o});try{for await(let[t]of e)yield*nd(t,s,0)}catch(e){if(!t.signal.aborted)throw e}finally{yield*rd(s)}},tm=({binary:e,shouldEncode:t,encoding:n,shouldSplit:r,preserveNewlines:i})=>[Hu(e,n,!t),xu(e,i,!r,{})].filter(Boolean)})),rm,im,am,om,sm,cm,lm=t((()=>{Ns(),j(),wd(),nm(),Hs(),bu(),rm=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,buffer:i,maxBuffer:a,lines:o,allMixed:s,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=im({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:s,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([am(e),d]);return}let f=Yp({stream:e,onStreamEnd:t,lines:o,encoding:r,stripFinalNewline:yu(c,n),allMixed:s}),[p]=await Promise.all([om({stream:e,iterable:f,fdNumber:n,encoding:r,maxBuffer:a,lines:o}),d]);return p},im=async({stream:e,onStreamEnd:t,fdNumber:n,encoding:r,allMixed:i,verboseInfo:a,streamInfo:{fileDescriptors:o}})=>{_d({stdioItems:o[n]?.stdioItems,encoding:r,verboseInfo:a,fdNumber:n})&&await bd(Yp({stream:e,onStreamEnd:t,lines:!0,encoding:r,stripFinalNewline:!0,allMixed:i}),e,n,a)},am=async e=>{await Re(),e.readableFlowing===null&&e.resume()},om=async({stream:e,stream:{readableObjectMode:t},iterable:n,fdNumber:r,encoding:i,maxBuffer:a,lines:o})=>{try{return t||o?await ns(n,{maxBuffer:a}):i===`buffer`?new Uint8Array(await cs(n,{maxBuffer:a})):await ws(n,{maxBuffer:a})}catch(n){return cm(Ps({error:n,stream:e,readableObjectMode:t,lines:o,encoding:i,fdNumber:r}))}},sm=async e=>{try{return await e}catch(e){return cm(e)}},cm=({bufferedData:e})=>Ye(e)?new Uint8Array(e):e})),um,dm,fm,pm,mm,hm,gm,_m,vm,ym=t((()=>{um=async(e,t,n,{isSameDirection:r,stopOnExit:i=!1}={})=>{let a=dm(e,n),o=new AbortController;try{await Promise.race([...i?[n.exitPromise]:[],D(e,{cleanup:!0,signal:o.signal})])}catch(e){a.stdinCleanedUp||mm(e,t,n,r)}finally{o.abort()}},dm=(e,{originalStreams:[t],subprocess:n})=>{let r={stdinCleanedUp:!1};return e===t&&fm(e,n,r),r},fm=(e,t,n)=>{let{_destroy:r}=e;e._destroy=(...i)=>{pm(t,n),r.call(e,...i)}},pm=({exitCode:e,signalCode:t},n)=>{(e!==null||t!==null)&&(n.stdinCleanedUp=!0)},mm=(e,t,n,r)=>{if(!hm(e,t,n,r))throw e},hm=(e,t,n,r=!0)=>n.propagating?vm(e)||_m(e):(n.propagating=!0,gm(n,t)===r?vm(e):_m(e)),gm=({fileDescriptors:e},t)=>t!==`all`&&e[t].direction===`input`,_m=e=>e?.code===`ERR_STREAM_PREMATURE_CLOSE`,vm=e=>e?.code===`EPIPE`})),bm,xm,Sm=t((()=>{lm(),ym(),bm=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>e.stdio.map((e,c)=>xm({stream:e,fdNumber:c,encoding:t,buffer:n[c],maxBuffer:r[c],lines:i[c],allMixed:!1,stripFinalNewline:a,verboseInfo:o,streamInfo:s})),xm=async({stream:e,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,verboseInfo:c,streamInfo:l})=>{if(!e)return;let u=um(e,t,l);if(gm(l,t)){await u;return}let[d]=await Promise.all([rm({stream:e,onStreamEnd:u,fdNumber:t,encoding:n,buffer:r,maxBuffer:i,lines:a,allMixed:o,stripFinalNewline:s,verboseInfo:c,streamInfo:l}),u]);return d}})),Cm,wm,Tm,Em,Dm=t((()=>{rp(),Sm(),Cm=({stdout:e,stderr:t},{all:n})=>n&&(e||t)?jf([e,t].filter(Boolean)):void 0,wm=({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:a,verboseInfo:o,streamInfo:s})=>xm({...Tm(e,n),fdNumber:`all`,encoding:t,maxBuffer:r[1]+r[2],lines:i[1]||i[2],allMixed:Em(e),stripFinalNewline:a,verboseInfo:o,streamInfo:s}),Tm=({stdout:e,stderr:t,all:n},[,r,i])=>{let a=r||i;return a?r?i?{stream:n,buffer:a}:{stream:e,buffer:a}:{stream:t,buffer:a}:{stream:n,buffer:a}},Em=({all:e,stdout:t,stderr:n})=>e&&t&&n&&t.readableObjectMode!==n.readableObjectMode})),Om,km,Am=t((()=>{Cn(),I(),Om=e=>Pt(e,`ipc`),km=(e,t)=>{_n({type:`ipc`,verboseMessage:xn(e),fdNumber:`ipc`,verboseInfo:t})}})),jm,Mm,Nm=t((()=>{Hs(),Am(),F(),pf(),jm=async({subprocess:e,buffer:t,maxBuffer:n,ipc:r,ipcOutput:i,verboseInfo:a})=>{if(!r)return i;let o=Om(a),s=Mt(t,`ipc`),c=Mt(n,`ipc`);for await(let t of cf({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:r,shouldAwait:!1,reference:!0}))s&&(Is(e,i,c),i.push(t)),o&&km(t,a);return i},Mm=async(e,t)=>(await Promise.allSettled([e]),t)})),Pm,Fm,Im,Lm,Rm=t((()=>{Co(),La(),ti(),Na(),P(),Z(),lm(),Nm(),Ka(),Dm(),Sm(),Bd(),ym(),Pm=async({subprocess:e,options:{encoding:t,buffer:n,maxBuffer:r,lines:i,timeoutDuration:a,cancelSignal:o,gracefulCancel:s,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:_})=>{let v=Pd(e,f),y={originalStreams:h,fileDescriptors:m,subprocess:e,exitPromise:v,propagating:!1},b=bm({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),x=wm({subprocess:e,encoding:t,buffer:n,maxBuffer:r,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:y}),ee=[],te=jm({subprocess:e,buffer:n,maxBuffer:r,ipc:u,ipcOutput:ee,verboseInfo:p}),ne=Fm(h,e,y),re=Im(m,y);try{return await Promise.race([Promise.all([{},Ld(v),Promise.all(b),x,te,Ga(e,d),...ne,...re]),g,Lm(e,_),...Fa(e,a,f,_),...$r({subprocess:e,cancelSignal:o,gracefulCancel:s,context:f,controller:_}),...Aa({subprocess:e,cancelSignal:o,gracefulCancel:s,forceKillAfterDelay:c,context:f,controller:_})])}catch(e){return f.terminationReason??(f.terminationReason=`other`),Promise.all([{error:e},v,Promise.all(b.map(e=>sm(e))),sm(x),Mm(te,ee),Promise.allSettled(ne),Promise.allSettled(re)])}},Fm=(e,t,n)=>e.map((e,r)=>e===t.stdio[r]?void 0:um(e,r,n)),Im=(e,t)=>e.flatMap(({stdioItems:e},n)=>e.filter(({value:e,stream:t=e})=>W(t,{checkOpen:!1})&&!M(t)).map(({type:e,value:r,stream:i=r})=>um(i,n,t,{isSameDirection:X.has(e),stopOnExit:e===`native`}))),Lm=async(e,{signal:t})=>{let[n]=await T(e,`error`,{signal:t});throw n}})),zm,Bm,Vm,Hm=t((()=>{xi(),zm=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),Bm=(e,t,n)=>{let r=e[n];r.has(t)||r.set(t,[]);let i=r.get(t),a=bi();return i.push(a),{resolve:a.resolve.bind(a),promises:i}},Vm=async({resolve:e,promises:t},n)=>{e();let[r]=await Promise.race([Promise.allSettled([!0,n]),Promise.all([!1,...t])]);return!r}})),Um,Wm,Gm,Km,qm,Jm,Ym=t((()=>{ym(),Um=async e=>{if(e!==void 0)try{await Gm(e)}catch{}},Wm=async e=>{if(e!==void 0)try{await Km(e)}catch{}},Gm=async e=>{await D(e,{cleanup:!0,readable:!1,writable:!0})},Km=async e=>{await D(e,{cleanup:!0,readable:!0,writable:!1})},qm=async(e,t)=>{if(await e,t)throw t},Jm=(e,t,n)=>{n&&!_m(n)?e.destroy(n):t&&e.destroy()}})),Xm,Zm,Qm,$m,eh,th,nh,rh,ih=t((()=>{$a(),H(),nm(),xi(),Hm(),Ym(),Xm=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,binary:i=!0,preserveNewlines:a=!0}={})=>{let o=i||U.has(n),{subprocessStdout:s,waitReadableDestroy:c}=Zm(e,r,t),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=Qm(s,o),{read:f,onStdoutDataDone:p}=$m({subprocessStdout:s,subprocess:e,binary:o,encoding:n,preserveNewlines:a}),m=new E({read:f,destroy:S(nh.bind(void 0,{subprocessStdout:s,subprocess:e,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return th({subprocessStdout:s,onStdoutDataDone:p,readable:m,subprocess:e}),m},Zm=(e,t,n)=>{let r=Ci(e,t);return{subprocessStdout:r,waitReadableDestroy:Bm(n,r,`readableDestroy`)}},Qm=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n},r)=>r?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:n}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:Qp},$m=({subprocessStdout:e,subprocess:t,binary:n,encoding:r,preserveNewlines:i})=>{let a=bi(),o=qp({subprocessStdout:e,subprocess:t,binary:n,shouldEncode:!n,encoding:r,preserveNewlines:i});return{read(){eh(this,o,a)},onStdoutDataDone:a}},eh=async(e,t,n)=>{try{let{value:r,done:i}=await t.next();i?n.resolve():e.push(r)}catch{}},th=async({subprocessStdout:e,onStdoutDataDone:t,readable:n,subprocess:r,subprocessStdin:i})=>{try{await Km(e),await r,await Um(i),await t,n.readable&&n.push(null)}catch(e){await Um(i),rh(n,e)}},nh=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:n},r)=>{await Vm(n,t)&&(rh(e,r),await qm(t,r))},rh=(e,t)=>{Jm(e,e.readable,t)}})),ah,oh,sh,ch,lh,uh,dh,fh,ph=t((()=>{H(),Hm(),Ym(),ah=({subprocess:e,concurrentStreams:t},{to:n}={})=>{let{subprocessStdin:r,waitWritableFinal:i,waitWritableDestroy:a}=oh(e,n,t),o=new Me({...sh(r,e,i),destroy:S(dh.bind(void 0,{subprocessStdin:r,subprocess:e,waitWritableFinal:i,waitWritableDestroy:a})),highWaterMark:r.writableHighWaterMark,objectMode:r.writableObjectMode});return uh(r,o),o},oh=(e,t,n)=>{let r=Si(e,t);return{subprocessStdin:r,waitWritableFinal:Bm(n,r,`writableFinal`),waitWritableDestroy:Bm(n,r,`writableDestroy`)}},sh=(e,t,n)=>({write:ch.bind(void 0,e),final:S(lh.bind(void 0,e,t,n))}),ch=(e,t,n,r)=>{e.write(t,n)?r():e.once(`drain`,r)},lh=async(e,t,n)=>{await Vm(n,t)&&(e.writable&&e.end(),await t)},uh=async(e,t,n)=>{try{await Gm(e),t.writable&&t.end()}catch(e){await Wm(n),fh(t,e)}},dh=async({subprocessStdin:e,subprocess:t,waitWritableFinal:n,waitWritableDestroy:r},i)=>{await Vm(n,t),await Vm(r,t)&&(fh(e,i),await qm(t,i))},fh=(e,t)=>{Jm(e,e.writable,t)}})),mh,hh,gh=t((()=>{$a(),ih(),ph(),mh=({subprocess:e,concurrentStreams:t,encoding:n},{from:r,to:i,binary:a=!0,preserveNewlines:o=!0}={})=>{let s=a||U.has(n),{subprocessStdout:c,waitReadableDestroy:l}=Zm(e,r,t),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=oh(e,i,t),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=Qm(c,s),{read:g,onStdoutDataDone:_}=$m({subprocessStdout:c,subprocess:e,binary:s,encoding:n,preserveNewlines:o}),v=new ke({read:g,...sh(u,e,d),destroy:S(hh.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:e,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return th({subprocessStdout:c,onStdoutDataDone:_,readable:v,subprocess:e,subprocessStdin:u}),uh(u,v,c),v},hh=async({subprocessStdout:e,subprocessStdin:t,subprocess:n,waitReadableDestroy:r,waitWritableFinal:i,waitWritableDestroy:a},o)=>{await Promise.all([nh({subprocessStdout:e,subprocess:n,waitReadableDestroy:r},o),dh({subprocessStdin:t,subprocess:n,waitWritableFinal:i,waitWritableDestroy:a},o)])}})),_h,vh,yh=t((()=>{$a(),H(),nm(),_h=(e,t,{from:n,binary:r=!1,preserveNewlines:i=!1}={})=>{let a=r||U.has(t),o=Ci(e,n),s=qp({subprocessStdout:o,subprocess:e,binary:a,shouldEncode:!0,encoding:t,preserveNewlines:i});return vh(s,o,e)},vh=async function*(e,t,n){try{yield*e}finally{t.readable&&t.destroy(),await n}}})),bh,xh=t((()=>{Hm(),ih(),ph(),gh(),yh(),bh=(e,{encoding:t})=>{let n=zm();e.readable=Xm.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.writable=ah.bind(void 0,{subprocess:e,concurrentStreams:n}),e.duplex=mh.bind(void 0,{subprocess:e,concurrentStreams:n,encoding:t}),e.iterable=_h.bind(void 0,e,t),e[Symbol.asyncIterator]=_h.bind(void 0,e,t,{})}})),Sh,Ch,wh,Th=t((()=>{Sh=(e,t)=>{for(let[n,r]of wh){let i=r.value.bind(t);Reflect.defineProperty(e,n,{...r,value:i})}},Ch=(async()=>{})().constructor.prototype,wh=[`then`,`catch`,`finally`].map(e=>[e,Reflect.getOwnPropertyDescriptor(Ch,e)])})),Eh,Dh,Oh,kh,Ah,jh,Mh=t((()=>{Ns(),Fn(),co(),H(),uo(),_f(),rc(),xc(),Tf(),Af(),bu(),gp(),Yr(),vp(),Kp(),Dm(),Rm(),xh(),xi(),Th(),Eh=(e,t,n,r)=>{let{file:i,commandArguments:a,command:o,escapedCommand:s,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Dh(e,t,n),{subprocess:f,promise:p}=kh({file:i,commandArguments:a,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:s,fileDescriptors:d});return f.pipe=Up.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:r}),Sh(f,p),V.set(f,{options:u,fileDescriptors:d}),f},Dh=(e,t,n)=>{let{command:r,escapedCommand:i,startTime:a,verboseInfo:o}=Pn(e,t,n),{file:s,commandArguments:c,options:l}=ao(e,t,n),u=Oh(l);return{file:s,commandArguments:c,command:r,escapedCommand:i,startTime:a,verboseInfo:o,options:u,fileDescriptors:Ef(u,o)}},Oh=({timeout:e,signal:t,...n})=>{if(t!==void 0)throw TypeError(`The "signal" option has been renamed to "cancelSignal" instead.`);return{...n,timeoutDuration:e}},kh=({file:e,commandArguments:t,options:n,startTime:r,verboseInfo:i,command:a,escapedCommand:o,fileDescriptors:s})=>{let c;try{c=he(...lo(e,t,n))}catch(e){return vf({error:e,command:a,escapedCommand:o,fileDescriptors:s,options:n,startTime:r,verboseInfo:i})}let l=new AbortController;Oe(1/0,l.signal);let u=[...c.stdio];up(c,s,l),_p(c,n,l);let d={},f=bi();c.kill=Wr.bind(void 0,{kill:c.kill.bind(c),options:n,onInternalError:f,context:d,controller:l}),c.all=Cm(c,n),bh(c,n),mf(c,n);let p=Ah({subprocess:c,options:n,startTime:r,verboseInfo:i,fileDescriptors:s,originalStreams:u,command:a,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},Ah=async({subprocess:e,options:t,startTime:n,verboseInfo:r,fileDescriptors:i,originalStreams:a,command:o,escapedCommand:s,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await Pm({subprocess:e,options:t,context:c,verboseInfo:r,fileDescriptors:i,originalStreams:a,onInternalError:l,controller:u});u.abort(),l.resolve();let _=m.map((e,n)=>vu(e,t,n)),v=vu(h,t,`all`);return bc(jh({errorInfo:d,exitCode:f,signal:p,stdio:_,all:v,ipcOutput:g,context:c,options:t,command:o,escapedCommand:s,startTime:n}),r,t)},jh=({errorInfo:e,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,context:o,options:s,command:c,escapedCommand:l,startTime:u})=>`error`in e?$s({error:e.error,command:c,escapedCommand:l,timedOut:o.terminationReason===`timeout`,isCanceled:o.terminationReason===`cancel`||o.terminationReason===`gracefulCancel`,isGracefullyCanceled:o.terminationReason===`gracefulCancel`,isMaxBuffer:e.error instanceof Yo,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:n,stdio:r,all:i,ipcOutput:a,options:s,startTime:u,isSync:!1}):Zs({command:c,escapedCommand:l,stdio:r,all:i,ipcOutput:a,options:s,startTime:u})})),Nh,Ph,Fh,Ih=t((()=>{k(),F(),Nh=(e,t)=>{let n=Object.fromEntries(Object.entries(t).map(([t,n])=>[t,Ph(t,e[t],n)]));return{...e,...n}},Ph=(e,t,n)=>Fh.has(e)&&O(t)&&O(n)?{...t,...n}:n,Fh=new Set([`env`,...jt])})),$,Lh,Rh,zh=t((()=>{k(),qe(),gt(),$d(),Mh(),Ih(),$=(e,t,n,r)=>{let i=(e,t,r)=>$(e,t,n,r),a=(...a)=>Lh({mapArguments:e,deepOptions:n,boundOptions:t,setBoundExeca:r,createNested:i},...a);return r!==void 0&&r(a,i,t),a},Lh=({mapArguments:e,deepOptions:t={},boundOptions:n={},setBoundExeca:r,createNested:i},a,...o)=>{if(O(a))return i(e,Nh(n,a),r);let{file:s,commandArguments:c,options:l,isSync:u}=Rh({mapArguments:e,firstArgument:a,nextArguments:o,deepOptions:t,boundOptions:n});return u?Wd(s,c,l):Eh(s,c,l,i)},Rh=({mapArguments:e,firstArgument:t,nextArguments:n,deepOptions:r,boundOptions:i})=>{let[a,o,s]=Ke(...st(t)?ct(t,n):[t,...n]),c=Nh(Nh(r,i),s),{file:l=a,commandArguments:u=o,options:d=c,isSync:f=!1}=e({file:a,commandArguments:o,options:c});return{file:l,commandArguments:u,options:d,isSync:f}}})),Bh,Vh,Hh,Uh,Wh,Gh=t((()=>{Bh=({file:e,commandArguments:t})=>Hh(e,t),Vh=({file:e,commandArguments:t})=>({...Hh(e,t),isSync:!0}),Hh=(e,t)=>{if(t.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[n,...r]=Uh(e);return{file:n,commandArguments:r}},Uh=e=>{if(typeof e!=`string`)throw TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t===``)return[];let n=[];for(let e of t.split(Wh)){let t=n.at(-1);t&&t.endsWith(`\\`)?n[n.length-1]=`${t.slice(0,-1)} ${e}`:n.push(e)}return n},Wh=/ +/g})),Kh,qh,Jh,Yh,Xh,Zh,Qh=t((()=>{Kh=(e,t,n)=>{e.sync=t(Jh,n),e.s=e.sync},qh=({options:e})=>Yh(e),Jh=({options:e})=>({...Yh(e),isSync:!0}),Yh=e=>({options:{...Xh(e),...e}}),Xh=({input:e,inputFile:t,stdio:n})=>e===void 0&&t===void 0&&n===void 0?{stdin:`inherit`}:{},Zh={preferLocal:!0}})),$h,eg,tg,ng,rg,ig,ag=t((()=>{zh(),Gh(),Ba(),Qh(),_f(),R(),$h=$(()=>({})),eg=$(()=>({isSync:!0})),$(Bh),$(Vh),$(Ra),$(qh,{},Zh,Kh),{sendMessage:tg,getOneMessage:ng,getEachMessage:rg,getCancelSignal:ig}=hf()}));function og(e,t,n=10*dg*ug){let r;r=t===void 0?{}:t instanceof AbortSignal?{abortSignal:t,timeout:n}:t;let{abortSignal:i,timeout:a=10*dg*ug,input:o,stdio:s=[`ignore`,`pipe`,`pipe`]}=r;i?.throwIfAborted(),ee`exec: ${e.slice(0,200)}`;try{let t=eg(e,{env:process.env,maxBuffer:1e6,timeout:a,cwd:x(),stdio:s,shell:!0,reject:!1,input:o});return t.stdout&&t.stdout.trim()||null}catch{return null}}function sg(e,t,n={timeout:10*dg*ug,preserveOutputOnError:!0,useCwd:!0}){return lg(e,t,{abortSignal:n.abortSignal,timeout:n.timeout,preserveOutputOnError:n.preserveOutputOnError,cwd:n.useCwd?x():void 0,env:n.env,stdin:n.stdin,input:n.input})}function cg(e,t){return e.shortMessage?e.shortMessage:typeof e.signal==`string`?e.signal:String(t)}function lg(e,t,{abortSignal:n,timeout:r=10*dg*ug,preserveOutputOnError:i=!0,cwd:a,env:o,maxBuffer:s,shell:c,stdin:l,input:u}={timeout:10*dg*ug,preserveOutputOnError:!0,maxBuffer:1e6}){return new Promise(d=>{$h(e,t,{maxBuffer:s,cancelSignal:n,timeout:r,cwd:a,env:o,shell:c,stdin:l,input:u,reject:!1}).then(e=>{if(e.failed)if(i){let t=e.exitCode??1;d({stdout:e.stdout||``,stderr:e.stderr||``,code:t,error:cg(e,t)})}else d({stdout:``,stderr:``,code:e.exitCode??1});else d({stdout:e.stdout,stderr:e.stderr,code:0})}).catch(e=>{re(e),d({stdout:``,stderr:``,code:1})})})}var ug,dg,fg=t((()=>{ag(),b(),ne(),te(),ug=1e3,dg=60}));export{$h as a,Jn as c,fg as i,lg as n,eg as o,og as r,ag as s,sg as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{FC as n,IC as r,St as i,Xs as a,Zs as o,gi as s,mi as c,yt as l}from"./loadAgentsDir-DGozQu_6.js";import{n as u,t as d}from"./ExitFlow-Dh9QdaYK.js";import{spawnSync as f}from"child_process";function p(){return r(g)??`Goodbye!`}async function m(e){if(o())return e(),f(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=l()!==null;return t?(0,h.jsx)(d,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(p()),await c(0,`prompt_input_exit`),null)}var h,g;e((()=>{n(),u(),a(),s(),i(),h=t(),g=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{m as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cc as e,dc as t,lc as n,uc as r}from"./loadAgentsDir-DGozQu_6.js";t();export{e as drainPendingExtraction,n as executeExtractMemories,r as initExtractMemories};
|