@readmagic/workmate 0.0.24 → 0.0.25
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 +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-DVbU-BaD.js +1 -0
- package/dist/chunks/App-B8q8PV77.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-DjqGAL4C.js +1 -0
- package/dist/chunks/CustomSelect-BvTftqEH.js +1 -0
- package/dist/chunks/DiffDialog-v5r8cBKW.js +6 -0
- package/dist/chunks/Doctor-DKpBnbuI.js +1 -0
- package/dist/chunks/Doctor-uvO6NM5m.js +3 -0
- package/dist/chunks/ExitFlow-Dh9QdaYK.js +2 -0
- package/dist/chunks/InvalidConfigDialog-C9boykQn.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-iwh8H52b.js → InvalidSettingsDialog-UN5mleCK.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +1 -0
- package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +1 -0
- package/dist/chunks/MCPToolListView-De1W4jpj.js +1 -0
- package/dist/chunks/McpParsingWarnings-zkM_lGd0.js +1 -0
- package/dist/chunks/MessageSelector-DW_itlX-.js +3 -0
- package/dist/chunks/Messages-BFsCpACq.js +10 -0
- package/dist/chunks/Onboarding-BT90cFkn.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-CCTZYbWI.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +1 -0
- package/dist/chunks/{ProviderSetup-BCSPsvfv.js → ProviderSetup-yIj8YOKF.js} +1 -1
- package/dist/chunks/QueryEngine-egz5mbaW.js +1 -0
- package/dist/chunks/REPL-D27CE4WN.js +124 -0
- package/dist/chunks/REPL-e8wAT1wN.js +1 -0
- package/dist/chunks/ResumeConversation-CWA27Lke.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +1 -0
- package/dist/chunks/{SelectMulti-BQRHed-d.js → SelectMulti-BW7Ffk1G.js} +1 -1
- package/dist/chunks/Settings-axHLvYIy.js +3 -0
- package/dist/chunks/Spinner-VjwI7m_g.js +1 -0
- package/dist/chunks/{SpinnerGlyph-CmkRUvHe.js → SpinnerGlyph-CqrOK3Mx.js} +1 -1
- package/dist/chunks/TextInput-Cev5Awdd.js +22 -0
- package/dist/chunks/ThemePicker-CtQYHmOr.js +1 -0
- package/dist/chunks/TrustDialog-8Sjmuu0e.js +1 -0
- package/dist/chunks/{ValidationErrorsList-DgNzJQUP.js → ValidationErrorsList-INwwoerV.js} +1 -1
- package/dist/chunks/_baseEach-DrPH_FGo.js +1 -0
- package/dist/chunks/add-dir-D3RMaYxy.js +1 -0
- package/dist/chunks/{agentDisplay-M4pfwbMC.js → agentDisplay-B3npXoCS.js} +1 -1
- package/dist/chunks/{agents-DddX7lLX.js → agents-2mPGmeq6.js} +1 -1
- package/dist/chunks/agents-DEnmg8Xo.js +101 -0
- package/dist/chunks/allErrors-C9kx6lnk.js +1 -0
- package/dist/chunks/analytics-COpjZpvd.js +1 -0
- package/dist/chunks/{appleTerminalBackup-BArZWB21.js → appleTerminalBackup-CT7g8yOs.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-BkFxfjOf.js +1 -0
- package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +1 -0
- package/dist/chunks/banner-DHpTmEO7.js +2 -0
- package/dist/chunks/branch-Be_yDFU8.js +2 -0
- package/dist/chunks/{break-cache-BMXqFTeS.js → break-cache-UUt6Dkf2.js} +2 -2
- package/dist/chunks/btw-DUml5L1w.js +1 -0
- package/dist/chunks/caches-DWjwe-DN.js +1 -0
- package/dist/chunks/caches-VLs1tQkZ.js +1 -0
- package/dist/chunks/{claudeDesktop-D8ml2767.js → claudeDesktop-mBGFDbI6.js} +1 -1
- package/dist/chunks/{clear-B8ZtFPOK.js → clear-CrGjNe6E.js} +1 -1
- package/dist/chunks/{client-CpTCeWba.js → client-BDuhbzLD.js} +1 -1
- package/dist/chunks/{client-4iqhC8xq.js → client-BYFVVMcf.js} +1 -1
- package/dist/chunks/client-CO_6v4yl.js +1 -0
- package/dist/chunks/client-DO-O441l.js +1 -0
- package/dist/chunks/commands-Cn1P7Tms.js +1 -0
- package/dist/chunks/compact-DGUhdXcc.js +2 -0
- package/dist/chunks/config-C7GTF4iI.js +1 -0
- package/dist/chunks/config-CWPHVTic.js +3 -0
- package/dist/chunks/config-Cox0TM2Z.js +1 -0
- package/dist/chunks/context-mV5zjqmc.js +1 -0
- package/dist/chunks/context-noninteractive--OuiZUzL.js +1 -0
- package/dist/chunks/{context-noninteractive-C7wrRZnM.js → context-noninteractive-DvfVvmSE.js} +2 -2
- package/dist/chunks/conversation--y8PD2Lk.js +1 -0
- package/dist/chunks/conversation-BIPJEOwO.js +1 -0
- package/dist/chunks/conversationRecovery-BBJzrA0g.js +1 -0
- package/dist/chunks/crossProjectResume-CwZb3cEU.js +40 -0
- package/dist/chunks/cwd-BZMp3CZ8.js +1 -0
- package/dist/chunks/cwd-BvNt_018.js +1 -0
- package/dist/chunks/debug-CRnGsZOV.js +39 -0
- package/dist/chunks/{detectRepository-CfX8Lc0A.js → detectRepository-CsJLbVEe.js} +1 -1
- package/dist/chunks/{diff-DdpHThJ7.js → diff-DUEoNCnJ.js} +1 -1
- package/dist/chunks/{directoryCompletion-D_Rtg-4j.js → directoryCompletion-Bgi8DBT5.js} +1 -1
- package/dist/chunks/doctor-4NiE46ZG.js +1 -0
- package/dist/chunks/entry-D1iD76SW.js +13 -0
- package/dist/chunks/{esm-CGx9qY3q.js → esm-DUH16IqH.js} +1 -1
- package/dist/chunks/execAsync-D6SA-YsV.js +1 -0
- package/dist/chunks/{execFileNoThrow-BTachNBI.js → execFileNoThrow-BgRsj_SW.js} +3 -3
- package/dist/chunks/exit-CrsQsjbx.js +1 -0
- package/dist/chunks/extraUsage-BtHE-SBX.js +1 -0
- package/dist/chunks/extractMemories-kogJzpit.js +1 -0
- package/dist/chunks/fast-CuNVwVTr.js +1 -0
- package/dist/chunks/fast-RlFnwGRV.js +1 -0
- package/dist/chunks/fetchModelList-Cjow_QGy.js +1 -0
- package/dist/chunks/fetchModelList-uiCPVqbJ.js +1 -0
- package/dist/chunks/fileSuggestions-C96V9-Ne.js +3 -0
- package/dist/chunks/firstPartyEventLogger-CN9UOmEC.js +1 -0
- package/dist/chunks/firstPartyEventLogger-RR5rvDtk.js +1 -0
- package/dist/chunks/{gemini-C_ApXgwc.js → gemini-4YGElN3H.js} +2 -2
- package/dist/chunks/generateSessionName-BHIKyXpz.js +1 -0
- package/dist/chunks/{genericProcessUtils-DwQFuna9.js → genericProcessUtils-BNlr-QxM.js} +1 -1
- package/dist/chunks/getMachineId-bsd-DTYGimUN.js +1 -0
- package/dist/chunks/getMachineId-darwin-DqIFUVvd.js +2 -0
- package/dist/chunks/getMachineId-linux-CnCTmdzd.js +1 -0
- package/dist/chunks/getMachineId-unsupported-Cx21ssu1.js +1 -0
- package/dist/chunks/getMachineId-win-vZhex7KX.js +1 -0
- package/dist/chunks/goal-ePK_jLo3.js +3 -0
- package/dist/chunks/grok-DnmklTrm.js +1 -0
- package/dist/chunks/help-B7xRle-V.js +1 -0
- package/dist/chunks/history-kOw3CcLT.js +1 -0
- package/dist/chunks/hooks-BDY1jMbS.js +1 -0
- package/dist/chunks/{hooks-DR3IYPJ3.js → hooks-BN5f58HY.js} +2 -2
- package/dist/chunks/install-DrMiHa2Q.js +1 -0
- package/dist/chunks/instrumentation-Oj5xagJG.js +21 -0
- package/dist/chunks/{job-YhJQWgE0.js → job-D9ypO0cd.js} +1 -1
- package/dist/chunks/keybindings-BRRN_eap.js +1 -0
- package/dist/chunks/launchLocalMemory-DliLezJw.js +3 -0
- package/dist/chunks/launchOnboarding-A-kk-7ID.js +8 -0
- package/dist/chunks/loadAgentsDir-CJAK4kif.js +1 -0
- package/dist/chunks/{loadAgentsDir-B0Anodo0.js → loadAgentsDir-DGozQu_6.js} +550 -550
- package/dist/chunks/{loadPluginHooks-BSwCtQ6T.js → loadPluginHooks-BiHPKDaY.js} +1 -1
- package/dist/chunks/{loader-CICGtLp2.js → loader-CtoR-vO-.js} +1 -1
- package/dist/chunks/{localSearch-BxLYi6w_.js → localSearch-BU02Qsv9.js} +1 -1
- package/dist/chunks/localSearch-DyaB2Rm-.js +1 -0
- package/dist/chunks/{log-D2TIwHBV.js → log-DoSpAwRP.js} +1 -1
- package/dist/chunks/logoUtils-DLd6JKqW.js +1 -0
- package/dist/chunks/{magicDocs-Bkz7ZcmL.js → magicDocs-Bj8LYrN2.js} +2 -2
- package/dist/chunks/main-B_09WbaG.js +345 -0
- package/dist/chunks/managedEnv-BJGfe3m7.js +1 -0
- package/dist/chunks/{managedEnv-OPlzUPbJ.js → managedEnv-CIWJsuty.js} +1 -1
- package/dist/chunks/mcp-1nBvcNxw.js +1 -0
- package/dist/chunks/mcp-7DXpXMdT.js +2 -0
- package/dist/chunks/mcp-kw99WVi2.js +6 -0
- package/dist/chunks/memory-CjWvzR_9.js +1 -0
- package/dist/chunks/mode-CBKawxnD.js +2 -0
- package/dist/chunks/model-DpZaKZMb.js +1 -0
- package/dist/chunks/model-DwbqvCY2.js +1 -0
- package/dist/chunks/modelOptions-CXBfKFXA.js +1 -0
- package/dist/chunks/nativeInstaller-SmPeEisk.js +1 -0
- package/dist/chunks/{notifications-Bc6k-Ozy.js → notifications-ql0eSo0Y.js} +1 -1
- package/dist/chunks/onChangeAppState-D85b33R5.js +1 -0
- package/dist/chunks/open-Cyrr4E5x.js +1 -0
- package/dist/chunks/openai-D_j7-KW6.js +2 -0
- package/dist/chunks/overlayContext-CLjlCFBl.js +1 -0
- package/dist/chunks/{panel-CVS4SK_E.js → panel-DMZkOEiU.js} +1 -1
- package/dist/chunks/parser-2usBI4G-.js +1 -0
- package/dist/chunks/{parser-Cg6hSCmn.js → parser-UqADrvxF.js} +1 -1
- package/dist/chunks/partition-CwxTlmMd.js +1 -0
- package/dist/chunks/{pasteStore-P0zP-ch0.js → pasteStore-ovtxMVR5.js} +1 -1
- package/dist/chunks/permissions-CgsvWOk_.js +3 -0
- package/dist/chunks/pidLock-B-SW3Nhx.js +3 -0
- package/dist/chunks/plan-BJrWtXEh.js +1 -0
- package/dist/chunks/platform-DsMIk3eq.js +2 -0
- package/dist/chunks/plugin-D97VJAxW.js +17 -0
- package/dist/chunks/{pluginAutoupdate-ennb9k8_.js → pluginAutoupdate-DQqYDPVg.js} +1 -1
- package/dist/chunks/{pluginBlocklist-9OrNEh--.js → pluginBlocklist-BAr9WTup.js} +1 -1
- package/dist/chunks/pluginCliCommands-CUGPc853.js +1 -0
- package/dist/chunks/{pluginFlagging-js_-WmYj.js → pluginFlagging-BO_3qjfs.js} +1 -1
- package/dist/chunks/pluginOperations-rTrzu6Vg.js +2 -0
- package/dist/chunks/pluginStartupCheck-BRHnXlym.js +1 -0
- package/dist/chunks/{pluginStartupCheck-SRXOyqr7.js → pluginStartupCheck-BX6cv-vs.js} +1 -1
- package/dist/chunks/plugins-9crasx2V.js +4 -0
- package/dist/chunks/poorMode-BaS0DBUO.js +1 -0
- package/dist/chunks/{poorMode-B0QGV6Ci.js → poorMode-DmvzFAz_.js} +1 -1
- package/dist/chunks/print-Bi3xVdB3.js +13 -0
- package/dist/chunks/processBashCommand-BBtnCx-7.js +1 -0
- package/dist/chunks/processSlashCommand-jzF0GmLO.js +5 -0
- package/dist/chunks/{projectOnboardingState-B5YATuc6.js → projectOnboardingState--L3BKjOE.js} +1 -1
- package/dist/chunks/prompt-CmijKW7G.js +1 -0
- package/dist/chunks/prompt-DYBx_D0H.js +1 -0
- package/dist/chunks/{prompt-CJ1l3XXk.js → prompt-DzO1um1h.js} +4 -4
- package/dist/chunks/{promptEditor-DoGHJN_W.js → promptEditor-B6S_Rzcu.js} +2 -2
- package/dist/chunks/protocolHandler-BWgH1jaF.js +13 -0
- package/dist/chunks/{proxy-CDBfZjO7.js → proxy-BjkGlmBu.js} +1 -1
- package/dist/chunks/reconciler-CVMmAaCy.js +1 -0
- package/dist/chunks/refresh-CAGv8BJY.js +1 -0
- package/dist/chunks/reject-CEUkoI2G.js +1 -0
- package/dist/chunks/{reload-plugins-CQZFQLWP.js → reload-plugins-DeyJTx4s.js} +1 -1
- package/dist/chunks/rename-DPFis9g_.js +1 -0
- package/dist/chunks/{renderOptions-DV0dn0IW.js → renderOptions-DRS2EslG.js} +1 -1
- package/dist/chunks/resume-N4O5YI-S.js +2 -0
- package/dist/chunks/ripgrep-3omwGI-l.js +1 -0
- package/dist/chunks/ripgrep-CgQrN3XX.js +5 -0
- package/dist/chunks/{runtimeObserver-DEuR8z0f.js → runtimeObserver-C0CJvA3q.js} +1 -1
- package/dist/chunks/{runtimeObserver-PJ1o8GRA.js → runtimeObserver-DMSzdFWt.js} +4 -4
- package/dist/chunks/sandbox-adapter-D15jjHJR.js +1 -0
- package/dist/chunks/sandbox-toggle-Tbbaw18C.js +1 -0
- package/dist/chunks/searchExtraTools-BoFc__Eg.js +1 -0
- package/dist/chunks/select-Fq6g2Ejk.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +1 -0
- package/dist/chunks/{sessionObserver-BtKjvteq.js → sessionObserver-CRie77tp.js} +2 -2
- package/dist/chunks/sessionObserver-PcaVCVkX.js +1 -0
- package/dist/chunks/sessionStorage-Dkf7FRgA.js +1 -0
- package/dist/chunks/sessionTracing-D7rekMdW.js +11 -0
- package/dist/chunks/settings-8fwIkMDV.js +1 -0
- package/dist/chunks/settings-CodSADx8.js +24 -0
- package/dist/chunks/setup-DBiIrXrh.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-Bg_aIc5Z.js → shadowedRuleDetection-CTnYVrmP.js} +1 -1
- package/dist/chunks/{sideQuestion-D49GsfH7.js → sideQuestion-Cl8m2qYx.js} +3 -3
- package/dist/chunks/sinks-CiupmfTg.js +1 -0
- package/dist/chunks/sinks-DH83d_kd.js +1 -0
- package/dist/chunks/skillChangeDetector-BrrZaFkT.js +1 -0
- package/dist/chunks/{skillGapStore-CcFoHNLl.js → skillGapStore-es3K-aYe.js} +2 -2
- package/dist/chunks/{skillLifecycle-Bnz_4wE5.js → skillLifecycle-BcgoOQBk.js} +2 -2
- package/dist/chunks/{skillSearchPanel-C_5yUhqn.js → skillSearchPanel-CuDDb1L-.js} +4 -4
- package/dist/chunks/skills-BRtgqnLz.js +1 -0
- package/dist/chunks/{src-CiJCsqUl.js → src-C8gyNm5a.js} +1 -1
- package/dist/chunks/src-Db7K3F_i.js +3 -0
- package/dist/chunks/startupProfiler-D1NRu2nj.js +1 -0
- package/dist/chunks/startupProfiler-DF0AjiDf.js +3 -0
- package/dist/chunks/{state-B4jiUise.js → state-BQ4BEGin.js} +1 -1
- package/dist/chunks/state-D3gvDiu8.js +1 -0
- package/dist/chunks/status-WXA16wIM.js +1 -0
- package/dist/chunks/statusNoticeHelpers-BfmIub5L.js +1 -0
- package/dist/chunks/{stringUtils-C718f5ey.js → stringUtils-Bu_lJH5c.js} +1 -1
- package/dist/chunks/switcher-5gilU5_R.js +1 -0
- package/dist/chunks/{switcher-DZwUo5Ed.js → switcher-DMfuKuw_.js} +1 -1
- package/dist/chunks/{tasks-DdcUQEeD.js → tasks-B6gYXxOx.js} +1 -1
- package/dist/chunks/{templateJobs-C8qsPrLj.js → templateJobs-BW6TaqEC.js} +1 -1
- package/dist/chunks/{terminalSetup-B_10N_gE.js → terminalSetup-BgIXFBpd.js} +4 -4
- package/dist/chunks/{terminalSetup-qc2PlvOm.js → terminalSetup-C-g9Xvj3.js} +1 -1
- package/dist/chunks/{theme-f1h2QI8J.js → theme-9AZceq_m.js} +1 -1
- package/dist/chunks/tipRegistry-DtO1H_Wo.js +2 -0
- package/dist/chunks/{toolEventObserver-7QP38x4t.js → toolEventObserver-DTuJcREC.js} +1 -1
- package/dist/chunks/toolPool-DHS8jWaL.js +1 -0
- package/dist/chunks/{types-Dx7P7JLQ.js → types-97nL3naE.js} +16 -16
- package/dist/chunks/{udsClient-cQz6nJ_T.js → udsClient-CmYHFiBD.js} +1 -1
- package/dist/chunks/{use-select-navigation-hWL5VHnL.js → use-select-navigation-BStVRvcX.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-DWRFdFoU.js +1 -0
- package/dist/chunks/useMainLoopModel-DSN5HjV1.js +1 -0
- package/dist/chunks/useManagePlugins-ntnOf5OU.js +1 -0
- package/dist/chunks/useMergedTools-C5Yns9Ij.js +1 -0
- package/dist/chunks/useSearchInput-B_mY9wBq.js +1 -0
- package/dist/chunks/useSettingsErrors-CM7tThcp.js +1 -0
- package/dist/chunks/util-Bb2S6g9N.js +1 -0
- package/dist/chunks/{validatePlugin-BMSoeb_b.js → validatePlugin-D8WQ5z4W.js} +1 -1
- package/dist/chunks/vim-Dpnhgoz_.js +1 -0
- package/dist/chunks/worktree-a5oOPSYl.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -12
- package/dist/chunks/AddWorkspaceDirectory-Ch8IcWXO.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-Cyia0s4g.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-LjI_H_Au.js +0 -1
- package/dist/chunks/App-BOqh_1tN.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CSEuuoq9.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-CwfCwUr9.js +0 -1
- package/dist/chunks/CustomSelect-wmZ9jz0W.js +0 -1
- package/dist/chunks/DiffDialog-BpXIEWiE.js +0 -6
- package/dist/chunks/Doctor-CMpr7tdf.js +0 -1
- package/dist/chunks/Doctor-DqW6j3_B.js +0 -3
- package/dist/chunks/ExitFlow-DacaBTlk.js +0 -2
- package/dist/chunks/Grove-CNqYPWI6.js +0 -11
- package/dist/chunks/InvalidConfigDialog-0TMJItCC.js +0 -1
- package/dist/chunks/KeybindingProviderSetup-D49HHTXD.js +0 -1
- package/dist/chunks/MCPConnectionManager-Cie77ZAK.js +0 -1
- package/dist/chunks/MCPToolListView-B4ehtkXd.js +0 -1
- package/dist/chunks/McpParsingWarnings-Bff66RtJ.js +0 -1
- package/dist/chunks/MessageSelector-Dpd6Iywp.js +0 -3
- package/dist/chunks/Messages-DN7M3oS_.js +0 -10
- package/dist/chunks/Onboarding-CQmE3rUf.js +0 -1
- package/dist/chunks/PromptInputFooterSuggestions-HI6HH3TP.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-3QNUC2Cg.js +0 -1
- package/dist/chunks/QueryEngine-DdLWvJv6.js +0 -1
- package/dist/chunks/REPL-BqO9KcK_.js +0 -124
- package/dist/chunks/REPL-CmZmypfF.js +0 -1
- package/dist/chunks/ResumeConversation-DBqX7gva.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BsSoILFj.js +0 -1
- package/dist/chunks/Settings-B-7yBewS.js +0 -3
- package/dist/chunks/Spinner-ByQXTvAA.js +0 -1
- package/dist/chunks/TextInput-B8ruWRf2.js +0 -22
- package/dist/chunks/ThemePicker-BQErFFW1.js +0 -1
- package/dist/chunks/TrustDialog-BIhz6AZE.js +0 -1
- package/dist/chunks/_baseEach-CsIRoaTH.js +0 -1
- package/dist/chunks/add-dir-CrUDs19x.js +0 -1
- package/dist/chunks/agents-CGaCQeLw.js +0 -101
- package/dist/chunks/allErrors-BF73lon8.js +0 -1
- package/dist/chunks/analytics-DJobLaWP.js +0 -1
- package/dist/chunks/backgroundHousekeeping-Bq3LMsVR.js +0 -17
- package/dist/chunks/backgroundHousekeeping-Cl3Ox7Qh.js +0 -1
- package/dist/chunks/banner-Cu2-XUek.js +0 -2
- package/dist/chunks/branch-Yg_taNlT.js +0 -2
- package/dist/chunks/btw-udbprVvu.js +0 -1
- package/dist/chunks/caches-ChjIEcdd.js +0 -1
- package/dist/chunks/caches-DLJ6urv-.js +0 -1
- package/dist/chunks/client-BiqbIkwr.js +0 -1
- package/dist/chunks/client-CZ8nyVh5.js +0 -1
- package/dist/chunks/commands-CVCpJo7M.js +0 -1
- package/dist/chunks/compact-izk6RKHQ.js +0 -2
- package/dist/chunks/config-C-Y2qtB2.js +0 -3
- package/dist/chunks/config-CFqpXMFX.js +0 -1
- package/dist/chunks/config-DD8fCYXn.js +0 -1
- package/dist/chunks/context-BbVm4SWK.js +0 -1
- package/dist/chunks/context-noninteractive-x0HAzWhc.js +0 -1
- package/dist/chunks/conversation-DouVzO0K.js +0 -1
- package/dist/chunks/conversation-DrVkifKy.js +0 -1
- package/dist/chunks/conversationRecovery-DliPBo_z.js +0 -1
- package/dist/chunks/crossProjectResume-DxMy05_P.js +0 -40
- package/dist/chunks/cwd-Dc3NV7s8.js +0 -1
- package/dist/chunks/cwd-Pa83R95t.js +0 -1
- package/dist/chunks/datadog-Cu3s7P48.js +0 -1
- package/dist/chunks/debug-Bglx1aTu.js +0 -39
- package/dist/chunks/doctor-D_kV_D_l.js +0 -1
- package/dist/chunks/entry-Bxseqbi_.js +0 -13
- package/dist/chunks/esm-BXTZz3av.js +0 -1
- package/dist/chunks/execAsync-Bv2yxuGe.js +0 -1
- package/dist/chunks/exit-C_R_FgzR.js +0 -1
- package/dist/chunks/extraUsage-xMuDiNKh.js +0 -1
- package/dist/chunks/extractMemories-D4Dl1itt.js +0 -1
- package/dist/chunks/fast-DH-C5IZs.js +0 -1
- package/dist/chunks/fast-bopOPrtf.js +0 -1
- package/dist/chunks/fetchModelList-DC4VQpqa.js +0 -1
- package/dist/chunks/fetchModelList-FE8tzTDc.js +0 -1
- package/dist/chunks/fileSuggestions-C-9unnoJ.js +0 -3
- package/dist/chunks/firstPartyEventLogger-QmjjQmgt.js +0 -3
- package/dist/chunks/firstPartyEventLogger-lFeqhtfh.js +0 -1
- package/dist/chunks/generateSessionName-CQ03xlYI.js +0 -1
- package/dist/chunks/getMachineId-bsd-Cut1kHoA.js +0 -1
- package/dist/chunks/getMachineId-darwin-CsRhaP3y.js +0 -2
- package/dist/chunks/getMachineId-linux-Bd7UBNRQ.js +0 -1
- package/dist/chunks/getMachineId-unsupported-vFGP8E_8.js +0 -1
- package/dist/chunks/getMachineId-win-DamF2CH_.js +0 -1
- package/dist/chunks/goal-CdL29Y8C.js +0 -3
- package/dist/chunks/grok-C6WAslUT.js +0 -1
- package/dist/chunks/grove-O6qp7ITR.js +0 -1
- package/dist/chunks/help-DxanITNN.js +0 -1
- package/dist/chunks/history-BMycjPTT.js +0 -1
- package/dist/chunks/hooks-D9ApLkBp.js +0 -1
- package/dist/chunks/install-0D9u2dZw.js +0 -1
- package/dist/chunks/instrumentation-BFiGwntt.js +0 -21
- package/dist/chunks/keybindings-DZrF9iNd.js +0 -1
- package/dist/chunks/launchLocalMemory-DhJ56KDc.js +0 -3
- package/dist/chunks/launchOnboarding-DmMoZwv5.js +0 -8
- package/dist/chunks/loadAgentsDir-BbUR6pqH.js +0 -1
- package/dist/chunks/localSearch-zfn7jgrh.js +0 -1
- package/dist/chunks/logoUtils-CRxTutvr.js +0 -1
- package/dist/chunks/main-9ksgUUY_.js +0 -345
- package/dist/chunks/managedEnv-BEqrGqn1.js +0 -1
- package/dist/chunks/mcp-ChF12reQ.js +0 -1
- package/dist/chunks/mcp-DoEl5uah.js +0 -2
- package/dist/chunks/mcp-hp9qqjAy.js +0 -6
- package/dist/chunks/memory-Qv-wGNQ5.js +0 -1
- package/dist/chunks/mode-bFXPCR2P.js +0 -2
- package/dist/chunks/model-6lkW4o2c.js +0 -1
- package/dist/chunks/model-BvQFFOf8.js +0 -1
- package/dist/chunks/modelOptions-BBvF3wHK.js +0 -1
- package/dist/chunks/nativeInstaller-CdjmE9Zy.js +0 -1
- package/dist/chunks/onChangeAppState-DLjZ1x95.js +0 -1
- package/dist/chunks/open-BtQHzzL9.js +0 -1
- package/dist/chunks/openai-D46QvESE.js +0 -2
- package/dist/chunks/overlayContext-8--_fbvY.js +0 -1
- package/dist/chunks/parser-CG5RuOCK.js +0 -1
- package/dist/chunks/partition-DznN4XZH.js +0 -1
- package/dist/chunks/permissions-DmGFViHI.js +0 -3
- package/dist/chunks/pidLock-Cm4sW35f.js +0 -3
- package/dist/chunks/plan-CzGBz_87.js +0 -1
- package/dist/chunks/platform-BacQ6ACS.js +0 -2
- package/dist/chunks/plugin-CluR79xX.js +0 -17
- package/dist/chunks/pluginCliCommands-CJv5uhOG.js +0 -1
- package/dist/chunks/pluginOperations-CcUSHAIa.js +0 -2
- package/dist/chunks/pluginStartupCheck-CRBUO9gP.js +0 -1
- package/dist/chunks/plugins-IwwaCDba.js +0 -4
- package/dist/chunks/poorMode-G-pnu6NM.js +0 -1
- package/dist/chunks/print-CgszM1ea.js +0 -13
- package/dist/chunks/processBashCommand-D098WsqY.js +0 -1
- package/dist/chunks/processSlashCommand-DOQFjJ88.js +0 -5
- package/dist/chunks/prompt-BKPmDAuL.js +0 -1
- package/dist/chunks/prompt-CgOklk7z.js +0 -1
- package/dist/chunks/protocolHandler-DjQALaU2.js +0 -13
- package/dist/chunks/reconciler-ykkSPR-i.js +0 -1
- package/dist/chunks/refresh-Dn_I1R4v.js +0 -1
- package/dist/chunks/registerProtocol-CAsDme_E.js +0 -1
- package/dist/chunks/reject-DtcCfuZV.js +0 -1
- package/dist/chunks/rename-DyEfsZiq.js +0 -1
- package/dist/chunks/resume-BcXEDUqZ.js +0 -2
- package/dist/chunks/ripgrep-DLs8MraF.js +0 -1
- package/dist/chunks/ripgrep-Dl3y5r4m.js +0 -5
- package/dist/chunks/sandbox-adapter-DfB9kgQD.js +0 -1
- package/dist/chunks/sandbox-toggle-D9GDUsTl.js +0 -1
- package/dist/chunks/searchExtraTools-D4gMMQv0.js +0 -1
- package/dist/chunks/select-DIxfl_VN.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-lbgHnVvi.js +0 -1
- package/dist/chunks/sessionObserver-D6qzEdGJ.js +0 -1
- package/dist/chunks/sessionStorage-C_7gow_z.js +0 -1
- package/dist/chunks/sessionTracing-CtbeAD0s.js +0 -11
- package/dist/chunks/settings-B2jvL8Dp.js +0 -24
- package/dist/chunks/settings-CisDe8DB.js +0 -1
- package/dist/chunks/setup-qecdf-ES.js +0 -3
- package/dist/chunks/sinks-C-lP7uyO.js +0 -1
- package/dist/chunks/sinks-De-B1lPQ.js +0 -1
- package/dist/chunks/skillChangeDetector-DkOJoNhT.js +0 -1
- package/dist/chunks/skills-BE5scC-g.js +0 -1
- package/dist/chunks/src-CHw1lvBc.js +0 -3
- package/dist/chunks/startupProfiler-BH0FoI66.js +0 -1
- package/dist/chunks/startupProfiler-CJdr3SxP.js +0 -3
- package/dist/chunks/state-BhOKSFi5.js +0 -1
- package/dist/chunks/status-Dw09WZLd.js +0 -1
- package/dist/chunks/statusNoticeHelpers-BRQpUIlH.js +0 -1
- package/dist/chunks/switcher-CgZVah7U.js +0 -1
- package/dist/chunks/tipRegistry-B71o4qWr.js +0 -2
- package/dist/chunks/toolPool-V-7Yv0GA.js +0 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-BKwzUpgb.js +0 -1
- package/dist/chunks/useMainLoopModel-DxvV70Ru.js +0 -1
- package/dist/chunks/useManagePlugins-BXLXazrR.js +0 -1
- package/dist/chunks/useMergedTools-CCgnBJzO.js +0 -1
- package/dist/chunks/useSearchInput-CzopttqC.js +0 -1
- package/dist/chunks/useSettingsErrors-SFPWfxsA.js +0 -1
- package/dist/chunks/util-Cbb3S6SX.js +0 -1
- package/dist/chunks/vim-CoRp9lY1.js +0 -1
- package/dist/chunks/worktree-Vm-SNY5x.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,I as a,P as o,T as s,Wt as c,ai as l,t as u,vn as d,y as f,yn as p}from"./src-DL3w8VPk.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Cb as h,F as g,N as _,P as v,hd as y,md as b}from"./loadAgentsDir-DGozQu_6.js";import{n as x,t as S}from"./TextInput-Cev5Awdd.js";import{n as C,t as w}from"./select-Fq6g2Ejk.js";import{r as T,t as E}from"./directoryCompletion-Bgi8DBT5.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-CCTZYbWI.js";function k(){return(0,P.jsx)(o,{dimColor:!0,children:`Work Mate will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(a,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(o,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:s,selectedSuggestion:c}){return(0,P.jsxs)(a,{flexDirection:`column`,children:[(0,P.jsx)(o,{children:`Enter the path to the directory:`}),(0,P.jsx)(a,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(S,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),s.length>0&&(0,P.jsx)(a,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:s,selectedSuggestion:c})}),i&&(0,P.jsx)(o,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[l,u]=(0,N.useState)(``),[d,m]=(0,N.useState)(null),[h,v]=(0,N.useState)([]),[y,x]=(0,N.useState)(0),S=(0,N.useMemo)(()=>F,[]),C=p((0,N.useCallback)(async e=>{if(!e){v([]),x(0);return}let t=await E(e);v(t),x(0)},[]),100);(0,N.useEffect)(()=>{C(l)},[l,C]);let T=(0,N.useCallback)(e=>{let t=`${e.id}/`;u(t),m(null)},[]),D=(0,N.useCallback)(async t=>{let r=await g(t,n);r.resultType===`success`?e(r.absolutePath,!1):m(_(r))},[n,e]);c(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(h.length>0){if(e.key===`tab`){e.preventDefault();let t=h[y];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=h[y];t&&D(`${t.id}/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),x(e=>e<=0?h.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),x(e=>e>=h.length-1?0:e+1);return}}},[h,y,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(a,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(f,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(o,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(s,{children:[(0,P.jsx)(i,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(i,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(b,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(w,{options:S,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(a,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:l,onChange:u,onSubmit:D,error:d,suggestions:h,selectedSuggestion:y})]})})})}var N,P,F,I=e((()=>{n(),N=t(l(),1),d(),v(),x(),u(),h(),T(),y(),C(),D(),P=m(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./AgentsMdExternalIncludesDialog-DVbU-BaD.js";e();export{t as AgentsMdExternalIncludesDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,ai as a,t as o,y as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{d as l,m as u}from"./config-CWPHVTic.js";import{n as d}from"./analytics-COpjZpvd.js";import{t as f}from"./select-Fq6g2Ejk.js";import{t as p}from"./CustomSelect-BvTftqEH.js";function m({onDone:e,isStandaloneDialog:t,externalIncludes:a}){h.useEffect(()=>{},[]);let o=(0,h.useCallback)(t=>{u(t===`no`?e=>({...e,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!0}):e=>({...e,hasAgentsMdExternalIncludesApproved:!0,hasAgentsMdExternalIncludesWarningShown:!0})),e()},[e]);return(0,g.jsxs)(s,{title:`Allow external AGENTS.md file imports?`,color:`warning`,onCancel:(0,h.useCallback)(()=>{o(`no`)},[o]),hideBorder:!t,hideInputGuide:!t,children:[(0,g.jsx)(i,{children:`This project's AGENTS.md imports files outside the current working directory. Never allow this for third-party repositories.`}),a&&a.length>0&&(0,g.jsxs)(n,{flexDirection:`column`,children:[(0,g.jsx)(i,{dimColor:!0,children:`External imports:`}),a.map((e,t)=>(0,g.jsxs)(i,{dimColor:!0,children:[` `,e.path]},t))]}),(0,g.jsxs)(i,{dimColor:!0,children:[`Important: Only use Work Mate with files you trust. Accessing untrusted files may pose security risks`,` `,(0,g.jsx)(r,{url:`https://code.workmate.com/docs/en/security`}),` `]}),(0,g.jsx)(f,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>o(e)})]})}var h,g,_=e((()=>{h=t(a(),1),d(),o(),l(),p(),g=c()}));export{_ as n,m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as e,t}from"./src-DL3w8VPk.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Lp as r,zp as i}from"./loadAgentsDir-DGozQu_6.js";import{d as a,h as o,o as s}from"./config-CWPHVTic.js";import{t as c}from"./fpsMetrics-wxj9GAsd.js";import{n as l,t as u}from"./onChangeAppState-D85b33R5.js";i(),t(),a();var d=n();function f({getFpsMetrics:t,stats:n,initialState:i,children:a}){return(0,d.jsx)(c,{getFpsMetrics:t,children:(0,d.jsx)(l,{store:n,children:(0,d.jsx)(r,{initialState:i,onChangeAppState:u,children:(0,d.jsx)(e,{initialState:s().theme,onThemeSave:e=>o(t=>({...t,theme:e})),children:a})})})})}export{f as App};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,Gt as a,H as o,I as s,P as c,T as l,ai as u,ot as d,t as f,y as p}from"./src-DL3w8VPk.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as h,Cb as g,Dc as _,Ec as v,En as y,Gl as b,Hl as x,Hp as ee,Ji as S,Tb as te,Ul as C,Wl as ne,Xu as w,Yu as T,_u as E,fm as re,fs as ie,gu as D,hm as O,kb as k,nS as A,ps as j,wb as M,wn as N,zp as P}from"./loadAgentsDir-DGozQu_6.js";import{_ as ae,f as oe}from"./debug-CRnGsZOV.js";import{Hn as se,Un as ce,Vn as F}from"./settings-CodSADx8.js";import{l as I,o as L}from"./stringUtils-Bu_lJH5c.js";import{S as le,_ as R,f as ue,l as de,u as fe,y as z}from"./startupProfiler-DF0AjiDf.js";import{_n as pe,gn as me,vn as he}from"./prompt-DzO1um1h.js";import{i as ge,t as _e}from"./overlayContext-CLjlCFBl.js";function B(e,t,n=1e3,r=0,i){let a=()=>de(Math.max(0,(i??Date.now())-e-r));return(0,V.useSyncExternalStore)((0,V.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var V,H=e((()=>{V=t(u(),1),R()}));function ve(e,t,n){let r=me(t,e.toolName);if(!r)return e.toolName;try{let t=r.inputSchema.safeParse(e.input),i=t.success?t.data:{},a=r.userFacingName(i);if(!a)return e.toolName;let o=r.renderToolUseMessage(i,{theme:n,verbose:!1});return o?(0,ye.jsxs)(c,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var ye,be=e((()=>{f(),he(),ye=m()}));function xe(e,t){let{isIdle:n,awaitingApproval:i,hasError:a,shutdownRequested:o}=t??{};return a?r.cross:i?r.questionMarkPrefix:o?r.warning:e===`running`?n?r.ellipsis:r.play:e===`completed`?r.tick:e===`failed`||e===`killed`?r.cross:r.bullet}function Se(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:a}=t??{};return i?`error`:r||a?`warning`:n?`background`:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:`background`}function Ce(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(E(t))return n=!0,!1;return n}var we=e((()=>{n(),D()}));function Te({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[u]=o(),d=(0,Ee.useMemo)(()=>v(pe()),[]),f=B(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);a({"confirm:yes":t},{context:`Confirmation`});let m=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},h=A(e.prompt,`plan`),g=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,_=e.result?.totalTokens??e.progress?.tokenCount,y=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,U.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:m,children:(0,U.jsx)(p,{title:(0,U.jsxs)(c,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,U.jsxs)(c,{children:[e.status!==`running`&&(0,U.jsxs)(c,{color:Se(e.status),children:[xe(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,U.jsxs)(c,{dimColor:!0,children:[f,_!==void 0&&_>0&&(0,U.jsxs)(U.Fragment,{children:[` · `,ue(_),` tokens`]}),y!==void 0&&y>0&&(0,U.jsxs)(U.Fragment,{children:[` `,`· `,y,` `,y===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,U.jsxs)(c,{children:[`Press `,t.keyName,` again to exit`]}):(0,U.jsxs)(l,{children:[r&&(0,U.jsx)(i,{shortcut:`←`,action:`go back`}),(0,U.jsx)(i,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,U.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:(0,U.jsxs)(s,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,children:[(0,U.jsx)(c,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,U.jsxs)(c,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,ve(t,d,u)]},n))]}),h?(0,U.jsx)(s,{marginTop:1,children:(0,U.jsx)(T,{addMargin:!1,planContent:h})}):(0,U.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(c,{bold:!0,dimColor:!0,children:`Prompt`}),(0,U.jsx)(c,{wrap:`wrap`,children:g})]}),e.status===`failed`&&e.error&&(0,U.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(c,{bold:!0,color:`error`,children:`Error`}),(0,U.jsx)(c,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var Ee,U,De=e((()=>{Ee=t(u(),1),H(),f(),g(),he(),_(),R(),S(),w(),be(),we(),U=m()}));function W({status:e,label:t,suffix:n}){return(0,G.jsxs)(c,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function Oe({shell:e}){switch(e.status){case`completed`:return(0,G.jsx)(W,{status:`completed`,label:`done`});case`failed`:return(0,G.jsx)(W,{status:`failed`,label:`error`});case`killed`:return(0,G.jsx)(W,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,G.jsx)(W,{status:`running`})}}var G,ke=e((()=>{f(),G=m()}));function Ae({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,K.jsxs)(c,{children:[z(e.command,n,!0),` `,(0,K.jsx)(Oe,{shell:e})]});case`local_agent`:return(0,K.jsxs)(c,{children:[z(e.description,n,!0),` `,(0,K.jsx)(W,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`local_workflow`:{let t=e;return(0,K.jsxs)(c,{children:[z(t.workflowName??e.summary??e.description,n,!0),` `,(0,K.jsx)(W,{status:e.status,label:e.status===`running`?`${t.agentCount} ${I(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${I(t,`file`)}`:`${e.sessionsReviewing} ${I(e.sessionsReviewing,`session`)}`;return(0,K.jsxs)(c,{children:[e.description,` `,(0,K.jsxs)(c,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,K.jsx)(W,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var K,je=e((()=>{f(),R(),L(),ke(),K=m()}));function Me({task:e,onDone:t,onBack:n,onKill:r}){let o=B(e.startTime,e.status===`running`,1e3,0);a({"confirm:yes":t},{context:`Confirmation`});let u=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},d=e.turns.filter(e=>e.text!==``),f=d.slice(-6),m=d.length-f.length;return(0,q.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:u,children:(0,q.jsx)(p,{title:`Memory consolidation`,subtitle:(0,q.jsxs)(c,{dimColor:!0,children:[o,` · reviewing `,e.sessionsReviewing,` `,I(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,q.jsxs)(q.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,I(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,q.jsxs)(c,{children:[`Press `,t.keyName,` again to exit`]}):(0,q.jsxs)(l,{children:[n&&(0,q.jsx)(i,{shortcut:`←`,action:`go back`}),(0,q.jsx)(i,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,q.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:(0,q.jsxs)(s,{flexDirection:`column`,gap:1,children:[(0,q.jsxs)(c,{children:[(0,q.jsx)(c,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,q.jsx)(c,{color:`background`,children:`running`}):e.status===`completed`?(0,q.jsx)(c,{color:`success`,children:e.status}):(0,q.jsx)(c,{color:`error`,children:e.status})]}),f.length===0?(0,q.jsx)(c,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,q.jsxs)(q.Fragment,{children:[m>0&&(0,q.jsxs)(c,{dimColor:!0,children:[`(`,m,` earlier `,I(m,`turn`),`)`]}),f.map((e,t)=>(0,q.jsxs)(s,{flexDirection:`column`,children:[(0,q.jsx)(c,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,q.jsxs)(c,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,I(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var q,Ne=e((()=>{H(),f(),g(),L(),q=m()}));async function Pe(e){let t=N(e.id);try{let e=await ae(t,Le);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function Fe({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:o}=d(),[u,f]=(0,J.useState)(()=>Pe(e)),m=(0,J.useDeferredValue)(u);(0,J.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(Pe(t)),1e3,f,e);return()=>clearInterval(t)},[e.id,e.status]);let h=()=>t(`Shell details dismissed`,{display:`system`});a({"confirm:yes":h},{context:`Confirmation`});let g=i=>{i.key===` `?(i.preventDefault(),t(`Shell details dismissed`,{display:`system`})):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},_=le(e.command,280);return(0,Y.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:(0,Y.jsxs)(p,{title:`Shell details`,onCancel:h,color:`background`,inputGuide:t=>t.pending?(0,Y.jsxs)(c,{children:[`Press `,t.keyName,` again to exit`]}):(0,Y.jsxs)(l,{children:[r&&(0,Y.jsx)(i,{shortcut:`←`,action:`go back`}),(0,Y.jsx)(i,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,Y.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:[(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsxs)(c,{children:[(0,Y.jsx)(c,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,Y.jsxs)(c,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,Y.jsxs)(c,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,Y.jsxs)(c,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,Y.jsxs)(c,{children:[(0,Y.jsx)(c,{bold:!0,children:`Runtime:`}),` `,de((e.endTime??Date.now())-e.startTime)]}),(0,Y.jsxs)(c,{wrap:`wrap`,children:[(0,Y.jsx)(c,{bold:!0,children:`Command:`}),` `,_]})]}),(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsx)(c,{bold:!0,children:`Output:`}),(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(c,{dimColor:!0,children:`Loading output…`}),children:(0,Y.jsx)(Ie,{outputPromise:m,columns:o})})]})]})})}function Ie({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,J.use)(e);if(!n)return(0,Y.jsx)(c,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
|
|
2
|
+
`,a-1);i.push(e+1),a=e}i.reverse();let o=r>n.length,l=[];for(let e=0;e<i.length;e++){let t=i[e],r=e<i.length-1?i[e+1]-1:n.length,a=n.slice(t,r);a&&l.push(a)}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(s,{borderStyle:`round`,paddingX:1,flexDirection:`column`,height:12,maxWidth:t-6,children:l.map((e,t)=>(0,Y.jsx)(c,{wrap:`truncate-end`,children:e},t))}),(0,Y.jsxs)(c,{dimColor:!0,italic:!0,children:[`Showing ${l.length} lines`,o?` of ${fe(r)}`:``]})]})}var J,Y,Le,Re=e((()=>{J=t(u(),1),k(),f(),g(),R(),oe(),y(),Y=m(),Le=8192}));function ze(e,t){return Object.values(e??{}).filter(E).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Be({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=h(e=>e.tasks),o=h(e=>e.foregroundedTaskId),u=ee(),d=te(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),f=r,m=(0,Z.useRef)(!1),[g,_]=(0,Z.useState)(()=>{if(n)return m.current=!0,{mode:`detail`,itemId:n};let e=ze(f,o);return e.length===1?(m.current=!0,{mode:`detail`,itemId:e[0].id}):{mode:`list`}}),[v,y]=(0,Z.useState)(0);ge(`background-tasks-dialog`);let{bashTasks:b,agentTasks:x,workflowTasks:S,dreamTasks:C,allSelectableItems:w}=(0,Z.useMemo)(()=>{let e=Object.values(f??{}).filter(E).map(Ve).sort((e,t)=>{let n=e.status,r=t.status;if(n===`running`&&r!==`running`)return-1;if(n!==`running`&&r===`running`)return 1;let i=`task`in e?e.task.startTime:0;return(`task`in t?t.task.startTime:0)-i}),t=e.filter(e=>e.type===`local_bash`),n=e.filter(e=>e.type===`local_agent`&&e.id!==o),r=e.filter(e=>e.type===`local_workflow`),i=e.filter(e=>e.type===`dream`);return{bashTasks:t,agentTasks:n,workflowTasks:r,dreamTasks:i,allSelectableItems:[...t,...n,...r,...i]}},[f,o]),T=w[v]??null;a({"confirm:previous":()=>y(e=>Math.max(0,e-1)),"confirm:next":()=>y(e=>Math.min(w.length-1,e+1)),"confirm:yes":()=>{let e=w[v];e&&_({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:g.mode===`list`});let D=t=>{if(g.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=w[v];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?O(n.id):n.type===`local_agent`&&n.status===`running`?k(n.id):n.type===`local_workflow`&&n.status===`running`?$(n.id,u):n.type===`dream`&&n.status===`running`&&A(n.id))};async function O(e){await re.kill(e,u)}async function k(e){await ie.kill(e,u)}async function A(e){await ne.kill(e,u)}let j=(0,Z.useEffectEvent)(e);(0,Z.useEffect)(()=>{if(g.mode!==`list`){let e=f?.[g.itemId];(!e||e.type!==`local_workflow`&&!E(e))&&(m.current?j(`Background tasks dialog dismissed`,{display:`system`}):_({mode:`list`}))}let e=w.length;v>=e&&e>0&&y(e-1)},[g,f,v,w,j]);let M=()=>{m.current&&w.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(m.current=!1,_({mode:`list`}))};if(g.mode!==`list`&&f){let t=f[g.itemId];if(!t)return null;switch(t.type){case`local_bash`:return(0,Q.jsx)(Fe,{shell:t,onDone:e,onKillShell:()=>void O(t.id),onBack:M},`shell-${t.id}`);case`local_agent`:return(0,Q.jsx)(Te,{agent:t,onDone:e,onKillAgent:()=>void k(t.id),onBack:M},`agent-${t.id}`);case`local_workflow`:{let e=t.status===`running`?()=>$(t.id,u):void 0;return(0,Q.jsx)(s,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:t=>{t.key===`left`?(t.preventDefault(),M()):t.key===`x`&&e&&(t.preventDefault(),e())},children:(0,Q.jsx)(p,{title:t.workflowName,subtitle:(0,Q.jsxs)(c,{dimColor:!0,children:[t.status,t.summary?` · ${t.summary}`:``]}),onCancel:M,inputGuide:()=>(0,Q.jsxs)(l,{children:[(0,Q.jsx)(i,{shortcut:`←`,action:`go back`}),(0,Q.jsx)(i,{shortcut:`Esc`,action:`close`}),e&&(0,Q.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:t.status===`failed`&&t.error?(0,Q.jsxs)(c,{color:`error`,children:[`失败原因:`,t.error]}):null})},`workflow-${t.id}`)}case`dream`:return(0,Q.jsx)(Me,{task:t,onDone:()=>e(`Background tasks dialog dismissed`,{display:`system`}),onBack:M,onKill:t.status===`running`?()=>void A(t.id):void 0},`dream-${t.id}`)}}let N=F(b,e=>e.status===`running`),P=F(x,e=>e.status===`running`),ae=ce([...N>0?[(0,Q.jsxs)(c,{children:[N,` `,N===1?`active shell`:`active shells`]},`shells`)]:[],...P>0?[(0,Q.jsxs)(c,{children:[P,` `,P===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,Q.jsx)(c,{children:` · `},`separator-${e}`)),oe=[(0,Q.jsx)(i,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,Q.jsx)(i,{shortcut:`Enter`,action:`view`},`enter`),...(T?.type===`local_bash`||T?.type===`local_agent`||T?.type===`local_workflow`||T?.type===`dream`)&&T.status===`running`?[(0,Q.jsx)(i,{shortcut:`x`,action:`stop`},`kill`)]:[],...x.some(e=>e.status===`running`)?[(0,Q.jsx)(i,{shortcut:d,action:`stop all agents`},`kill-all`)]:[],(0,Q.jsx)(i,{shortcut:`←/Esc`,action:`close`},`esc`)],se=()=>e(`Background tasks dialog dismissed`,{display:`system`});function I(e){return e.pending?(0,Q.jsxs)(c,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsx)(l,{children:oe})}return(0,Q.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:D,children:(0,Q.jsx)(p,{title:`Background tasks`,subtitle:ae,onCancel:se,color:`background`,inputGuide:I,children:w.length===0?(0,Q.jsx)(c,{dimColor:!0,children:`No tasks currently running`}):(0,Q.jsxs)(s,{flexDirection:`column`,children:[b.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,children:[x.length>0&&(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Shells`]}),` (`,b.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:b.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})]}),x.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,marginTop:+(b.length>0),children:[(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Local agents`]}),` (`,x.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:x.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})]}),S.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,marginTop:+(b.length>0||x.length>0),children:[(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Workflows`]}),` (`,S.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:S.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})]}),C.length>0&&(0,Q.jsx)(s,{flexDirection:`column`,marginTop:+(b.length>0||x.length>0||S.length>0),children:(0,Q.jsx)(s,{flexDirection:`column`,children:C.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})})]})})})}function Ve(e){switch(e.type){case`local_bash`:return{id:e.id,type:`local_bash`,label:e.command,status:e.status,task:e};case`local_agent`:return{id:e.id,type:`local_agent`,label:e.description,status:e.status,task:e};case`local_workflow`:return{id:e.id,type:`local_workflow`,label:e.summary??e.description,status:e.status,task:e};case`dream`:return{id:e.id,type:`dream`,label:e.description,status:e.status,task:e}}}function X({item:e,isSelected:t}){let{columns:n}=d(),i=Math.max(30,n-26);return(0,Q.jsxs)(s,{flexDirection:`row`,children:[(0,Q.jsx)(c,{children:t?`${r.pointer} `:` `}),(0,Q.jsx)(c,{color:t?`suggestion`:void 0,children:(0,Q.jsx)(Ae,{task:e.task,maxActivityWidth:i})})]})}var Z,Q,$,He=e((()=>{n(),Z=t(u(),1),k(),P(),b(),j(),O(),D(),se(),_e(),f(),g(),M(),De(),je(),Ne(),Re(),x(),Q=m(),$=C}));export{H as a,Ce as i,He as n,B as o,we as r,Be as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,Lt as n,P as r,ai as i,kt as a,t as o,y as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{gi as l,hi as u}from"./loadAgentsDir-DGozQu_6.js";import{b as d,h as f}from"./settings-CodSADx8.js";import{n as p}from"./analytics-COpjZpvd.js";import{t as m}from"./select-Fq6g2Ejk.js";import{t as h}from"./CustomSelect-BvTftqEH.js";var g=e(i(),1);p(),o(),l(),f(),h();var _=c();function v({onAccept:e}){let[i,o]=g.useState(null);g.useEffect(()=>{if(i!==null){let e=i,t=setTimeout(()=>u(e));return()=>clearTimeout(t)}},[i]),g.useEffect(()=>{},[]);function c(t){switch(t){case`accept`:d(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:o(1);break}}let l=(0,g.useCallback)(()=>{o(0)},[]);return i===null?(0,_.jsxs)(s,{title:`WARNING: Work Mate running in Bypass Permissions mode`,color:`error`,onCancel:l,children:[(0,_.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,_.jsxs)(r,{children:[`In Bypass Permissions mode, Work Mate will not ask for your approval before running potentially dangerous commands.`,(0,_.jsx)(a,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,_.jsx)(r,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,_.jsx)(n,{url:`https://code.workmate.com/docs/en/security`})]}),(0,_.jsx)(m,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{v as BypassPermissionsModeDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t}from"./SelectMulti-BW7Ffk1G.js";import{n}from"./select-Fq6g2Ejk.js";var r=e((()=>{t(),n()}));export{r as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{C as i,Gt as a,I as o,P as s,T as c,ai as l,ot as u,t as d,y as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Cb as m,Sp as h,Tb as ee,kb as g,wb as _,xp as v}from"./loadAgentsDir-DGozQu_6.js";import{n as y,t as b}from"./cwd-BvNt_018.js";import{Fr as x,Ir as S,Mr as C,jn as w,jr as T,wn as E}from"./settings-CodSADx8.js";import{i as D,t as O}from"./execFileNoThrow-BgRsj_SW.js";import{l as k,o as A}from"./stringUtils-Bu_lJH5c.js";import{_ as te,x as ne}from"./startupProfiler-DF0AjiDf.js";import{i as re,t as ie}from"./overlayContext-CLjlCFBl.js";import{r as ae}from"./detectRepository-CsJLbVEe.js";import{join as oe,resolve as se}from"path";import{access as j}from"fs/promises";async function M(){if(!await C()||await N())return null;let{stdout:e,code:t}=await O(x(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await O(x(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=le(n),o=I-a.size;if(o>0){let e=await P(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function ce(){if(!await C()||await N())return new Map;let{stdout:e,code:t}=await O(x(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?ue(e):new Map}function le(e){let t=e.trim().split(`
|
|
2
|
+
`).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function ue(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
|
|
3
|
+
`),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(`${t}`),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function N(){let e=await T(b());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>j(oe(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function P(e){let{stdout:t,code:n}=await O(x(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
|
|
4
|
+
`).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{y(),ae(),D(),E(),S(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([M(),ce()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,fe=e((()=>{H=t(l(),1),B(),U=400}));function pe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function W(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:`${n.slice(0,29)}…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(r?.type===`user`){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(pe(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&W(e)){let t=e.content.split(`
|
|
5
|
+
`),n={oldStart:0,oldLines:0,newStart:1,newLines:t.length,lines:t.map(e=>`+${e}`)};a.hunks.push(n),a.linesAdded+=t.length}else{a.hunks.push(...r);let{added:e,removed:t}=me(r);a.linesAdded+=e,a.linesRemoved+=t}i&&(a.isNewFile=!0)}}}}n.lastProcessedIndex=e.length;let r=[...n.completedTurns];return n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),r.push(n.currentTurn)),r.reverse()},[e])}var K,_e=e((()=>{K=t(l(),1)}));function ve({filePath:e,hunks:t,isLargeFile:n,isBinary:r,isTruncated:a,isUntracked:c}){let{columns:l}=u(),{firstLine:d,fileContent:f}=(0,q.useMemo)(()=>{if(!e)return{firstLine:null,fileContent:void 0};let t=w(se(b(),e));return{firstLine:t?.split(`
|
|
6
|
+
`)[0]??null,fileContent:t??void 0}},[e]);return c?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),(0,J.jsx)(s,{dimColor:!0,children:` (untracked)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`New file not yet staged.`}),(0,J.jsxs)(s,{dimColor:!0,italic:!0,children:["Run `git add ",e,"` to see line counts."]})]})]}):r?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Binary file - cannot display diff`})})]}):n?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Large file - diff exceeds 1 MB limit`})})]}):(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),a&&(0,J.jsx)(s,{dimColor:!0,children:` (truncated)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:t.length===0?(0,J.jsx)(s,{dimColor:!0,children:`No diff content`}):t.map((t,n)=>(0,J.jsx)(v,{patch:t,filePath:e,firstLine:d,fileContent:f,dim:!1,width:l-2-2},n))}),a&&(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`… diff truncated (exceeded 400 line limit)`})]})}var q,J,ye=e((()=>{q=t(l(),1),g(),d(),y(),E(),h(),J=p()}));function be({files:e,selectedIndex:t}){let{columns:n}=u(),{startIndex:r,endIndex:i}=(0,Y.useMemo)(()=>{if(e.length===0||e.length<=Z)return{startIndex:0,endIndex:e.length};let n=Math.max(0,t-Math.floor(Z/2)),r=n+Z;return r>e.length&&(r=e.length,n=Math.max(0,r-Z)),{startIndex:n,endIndex:r}},[e.length,t]);if(e.length===0)return(0,X.jsx)(s,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),c=r>0,l=i<e.length,d=e.length>Z,f=Math.max(20,n-16-3-4);return(0,X.jsxs)(o,{flexDirection:`column`,children:[d&&(0,X.jsx)(s,{dimColor:!0,children:c?` ↑ ${r} more ${k(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:f},e.path)),d&&(0,X.jsx)(s,{dimColor:!0,children:l?` ↓ ${e.length-i} more ${k(e.length-i,`file`)}`:` `})]})}function xe({file:e,isSelected:t,maxPathWidth:n}){let i=ne(e.path,n),a=`${t?`${r.pointer} `:` `}${i}`;return(0,X.jsxs)(o,{flexDirection:`row`,children:[(0,X.jsx)(s,{bold:t,color:t?`background`:void 0,inverse:t,children:a}),(0,X.jsx)(o,{flexGrow:1}),(0,X.jsx)(Se,{file:e,isSelected:t})]})}function Se({file:e,isSelected:t}){return e.isUntracked?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`untracked`}):e.isBinary?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Binary file`}):e.isLargeFile?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Large file modified`}):(0,X.jsxs)(s,{children:[e.linesAdded>0&&(0,X.jsxs)(s,{color:`diffAddedWord`,bold:t,children:[`+`,e.linesAdded]}),e.linesAdded>0&&e.linesRemoved>0&&` `,e.linesRemoved>0&&(0,X.jsxs)(s,{color:`diffRemovedWord`,bold:t,children:[`-`,e.linesRemoved]}),e.isTruncated&&(0,X.jsx)(s,{dimColor:!t,children:` (truncated)`})]})}var Y,X,Z,Ce=e((()=>{n(),Y=t(l(),1),g(),d(),te(),A(),X=p(),Z=5}));function we(e){let t=Array.from(e.files.values()).map(e=>({path:e.filePath,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,isBinary:!1,isLargeFile:!1,isTruncated:!1,isNewFile:e.isNewFile})).sort((e,t)=>e.path.localeCompare(t.path)),n=new Map;for(let t of e.files.values())n.set(t.filePath,t.hunks);return{stats:{filesCount:e.stats.filesChanged,linesAdded:e.stats.linesAdded,linesRemoved:e.stats.linesRemoved},files:t,hunks:n,loading:!1}}function Te({messages:e,onDone:t}){let n=V(),r=ge(e),[i,l]=(0,Q.useState)(`list`),[u,d]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(0),h=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=h[p],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[u],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{p>=h.length&&m(Math.max(0,h.length-1))},[h.length,p]);let x=(0,Q.useRef)(p);(0,Q.useEffect)(()=>{x.current!==p&&(d(0),x.current=p)},[p]),re(`diff-dialog`),a({"diff:previousSource":()=>{i===`detail`?l(`list`):i===`list`&&h.length>1&&m(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&h.length>1&&m(e=>Math.min(h.length-1,e+1))},"diff:back":()=>{i===`detail`&&l(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&l(`detail`)},"diff:previousFile":()=>{i===`list`&&d(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&d(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(s,{dimColor:!0,children:[v.stats.filesCount,` `,k(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(s,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(s,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=h.length>1?(0,$.jsxs)(o,{children:[p>0&&(0,$.jsx)(s,{dimColor:!0,children:`◀ `}),h.map((e,t)=>{let n=t===p,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(s,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),p<h.length-1&&(0,$.jsx)(s,{dimColor:!0,children:` ▶`})]}):null,E=ee(`diff:dismiss`,`DiffDialog`,`esc`),D=v.loading?`Loading diff…`:_?`No file changes in this turn`:v.stats&&v.stats.filesCount>0&&v.files.length===0?`Too many files to display details`:`Working tree is clean`,O=(0,$.jsxs)(s,{children:[C,w&&(0,$.jsxs)(s,{dimColor:!0,children:[` `,w]})]});function A(){i===`detail`?l(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(f,{title:O,onCancel:A,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(c,{children:[h.length>1&&(0,$.jsx)(s,{children:`←/→ source`}),(0,$.jsx)(s,{children:`↑/↓ select`}),(0,$.jsx)(s,{children:`Enter view`}),(0,$.jsxs)(s,{children:[E,` close`]})]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(s,{children:`← back`}),(0,$.jsxs)(s,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(o,{marginTop:1,children:(0,$.jsx)(s,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:u})}):(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(ve,{filePath:y?.path||``,hunks:b,isLargeFile:y?.isLargeFile,isBinary:y?.isBinary,isTruncated:y?.isTruncated,isUntracked:y?.isUntracked})})]})}var Q,$;e((()=>{Q=t(l(),1),ie(),fe(),_e(),d(),m(),_(),A(),ye(),Ce(),$=p()}))();export{Te as DiffDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./Doctor-uvO6NM5m.js";e();export{t as Doctor};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Gt as o,I as s,P as c,ai as l,t as u,x as d}from"./src-DL3w8VPk.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as p,q as ee}from"./state-BQ4BEGin.js";import{A_ as m,Ah as h,Al as g,Bp as _,Cb as v,DC as y,D_ as b,Dw as x,Ki as S,O_ as C,Ol as w,Ow as T,ax as E,cx as te,eS as ne,ix as re,jw as ie,kC as D,kh as ae,kl as oe,kw as se,ox as ce,qi as O,sx as k,tS as A,w_ as j,zp as M}from"./loadAgentsDir-DGozQu_6.js";import{R as N,V as P,kn as F,wn as I}from"./settings-CodSADx8.js";import{l as L,o as R}from"./stringUtils-Bu_lJH5c.js";import{at as z,f as B,nt as V,s as H}from"./model-DpZaKZMb.js";import{n as U,t as W}from"./ValidationErrorsList-INwwoerV.js";import{n as G,t as le}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{f as ue,g as de,h as fe,i as pe,n as me,o as he,p as ge,r as _e}from"./pidLock-B-SW3Nhx.js";import{n as ve,t as ye}from"./McpParsingWarnings-zkM_lGd0.js";import{n as be,t as xe}from"./PressEnterToContinue-DZc_s_pE.js";import{n as Se,t as Ce}from"./useSettingsErrors-CM7tThcp.js";import{n as we,t as Te}from"./shadowedRuleDetection-CTnYVrmP.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-BfmIub5L.js";import{join as q}from"path";function Oe(){if(!ie())return null;let e=x();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(c,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`Location: `}),(0,J.jsx)(c,{dimColor:!0,children:T()})]}),(0,J.jsxs)(s,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`error`,children:`[Error]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,ke=e((()=>{u(),se(),J=f()}));function Ae(){if(!y.isSupportedPlatform()||!y.isSandboxEnabledInSettings())return null;let e=y.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsx)(c,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(c,{children:[`└ Status: `,(0,Y.jsx)(c,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(c,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(c,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(c,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,je=e((()=>{u(),D(),Y=f()}));async function Me(){let e=b(await C());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`agentsmd_files`,severity:`warning`,message:e.length===1?`Large AGENTS.md file detected (${e[0].content.length.toLocaleString()} chars > ${j.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${j.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:j}}async function Ne(e){if(!e)return null;let t=Ee(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:O(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function X(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await ae(e,t,n,H());if(r<=Z)return null;let a=new Map;for(let e of i){let t=e.name.split(`__`)[1]||`unknown`,n=a.get(t)||{count:0,tokens:0};a.set(t,{count:n.count+1,tokens:n.tokens+e.tokens})}let o=Array.from(a.entries()).sort((e,t)=>t[1].tokens-e[1].tokens),s=o.slice(0,5).map(([e,t])=>`${e}: ${t.count} tools (~${t.tokens.toLocaleString()} tokens)`);return o.length>5&&s.push(`(${o.length-5} more servers)`),{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${r.toLocaleString()} tokens > ${Z.toLocaleString()})`,details:s,currentValue:r,threshold:Z}}catch{let e=r.reduce((e,t)=>e+O(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function Pe(e){let t=Te(await e(),{sandboxAutoAllowEnabled:y.isSandboxingEnabled()&&y.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${P(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${L(t.length,`unreachable permission rule`)} detected`,details:n,currentValue:t.length,threshold:0}}async function Fe(e,t,n){let[r,i,a,o]=await Promise.all([Me(),Ne(t),X(e,n,t),Pe(n)]);return{agentsMdWarning:r,agentWarning:i,mcpWarning:a,unreachableRulesWarning:o}}var Z,Ie=e((()=>{S(),h(),m(),B(),N(),we(),D(),De(),R(),Z=25e3}));function Le({onDone:e}){let t=_(e=>e.agentDefinitions),r=_(e=>e.mcp.tools),i=_(e=>e.toolPermissionContext),l=_(e=>e.plugins.errors);G();let u=(0,Q.useMemo)(()=>r||[],[r]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),x=Se().filter(e=>e.mcpErrorMetadata===void 0),S=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:re,upperLimit:E},{name:`TASK_MAX_OUTPUT_LENGTH`,default:w,upperLimit:oe},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...V(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=te(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{fe().then(p),(async()=>{let e=q(n(),`agents`),r=q(ee(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:s}=t,[c,l]=await Promise.all([F(e),F(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:c,projectDirExists:l,failedFiles:s};h(d);let f=await Fe(u,{activeAgents:a,allAgents:o,failedFiles:s},async()=>i);if(v(f),he()){let e=q(ue(),`claude`,`locks`),t=me(e),n=_e(e);b({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else b({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,u,t]);let C=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return o({"confirm:yes":C,"confirm:no":C},{context:`Confirmation`}),f?(0,$.jsxs)(d,{children:[(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(c,{children:[`└ Currently running: `,f.installationType,` (`,f.version,`)`]}),f.packageManager&&(0,$.jsxs)(c,{children:[`└ Package manager: `,f.packageManager]}),(0,$.jsxs)(c,{children:[`└ Path: `,f.installationPath]}),(0,$.jsxs)(c,{children:[`└ Invoked: `,f.invokedBinary]}),(0,$.jsxs)(c,{children:[`└ Config install method: `,f.configInstallMethod]}),(0,$.jsxs)(c,{children:[`└ Search: `,f.ripgrepStatus.working?`OK`:`Not working`,` (`,f.ripgrepStatus.mode===`embedded`?`bundled`:f.ripgrepStatus.mode===`builtin`?`vendor`:f.ripgrepStatus.systemPath||`system`,`)`]}),f.ripgrepStatus.note&&(0,$.jsxs)(c,{color:`warning`,children:[`└ Note: `,f.ripgrepStatus.note]}),f.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsxs)(c,{color:`warning`,children:[`Recommendation: `,f.recommendation.split(`
|
|
2
|
+
`)[0]]}),(0,$.jsx)(c,{dimColor:!0,children:f.recommendation.split(`
|
|
3
|
+
`)[1]})]}),f.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsx)(c,{color:`warning`,children:`Warning: Multiple installations found`}),f.multipleInstallations.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.type,` at `,e.path]},t))]}),f.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),f.warnings.map((e,t)=>(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsxs)(c,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(c,{children:[`Fix: `,e.fix]})]},t))]}),x.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(c,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:x})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),S.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Environment Variables`}),S.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(c,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),y?.enabled&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Version Locks`}),y.staleLocksCleaned>0&&(0,$.jsxs)(c,{dimColor:!0,children:[`└ Cleaned `,y.staleLocksCleaned,` stale lock(s)`]}),y.locks.length===0?(0,$.jsx)(c,{dimColor:!0,children:`└ No active version locks`}):y.locks.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(c,{children:`(running)`}):(0,$.jsx)(c,{color:`warning`,children:`(stale)`})]},t))]}),m?.failedFiles&&m.failedFiles.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ Failed to parse `,m.failedFiles.length,` agent file(s):`]}),m.failedFiles.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),l.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ `,l.length,` plugin error(s) detected:`]}),l.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,ne(e)]},t))]}),g?.unreachableRulesWarning&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.unreachableRulesWarning.message]})]}),g.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),g&&(g.agentsMdWarning||g.agentWarning||g.mcpWarning)&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Context Usage Warnings`}),g.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.agentsMdWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Files:`]}),g.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),g.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.agentWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Top contributors:`]}),g.agentWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),g.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.mcpWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ MCP servers:`]}),g.mcpWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(s,{children:(0,$.jsx)(xe,{})})]}):(0,$.jsx)(d,{children:(0,$.jsx)(c,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,Re=e((()=>{i(),Q=t(l(),1),ke(),ve(),z(),r(),p(),u(),be(),je(),U(),Ce(),le(),v(),M(),A(),Ie(),de(),k(),I(),pe(),ce(),g(),ge(),$=f()}));export{Re as n,Le as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{I as r,P as i,ai as a,t as o,y as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{$w as l,FC as u,Hb as d,IC as f,Qw as p,St as m,Tt as h,Ub as g,ci as _,gi as v,gr as y,mi as b,pt as x,wt as S,yt as C}from"./loadAgentsDir-DGozQu_6.js";import{c as w,i as T}from"./debug-CRnGsZOV.js";import{i as E,t as D}from"./execFileNoThrow-BgRsj_SW.js";import{n as O}from"./analytics-COpjZpvd.js";import{n as k,t as A}from"./select-Fq6g2Ejk.js";import{r as j,t as M}from"./Spinner-VjwI7m_g.js";function N(){(y(),e(_)).saveWorktreeState(null)}function P({onDone:e,onCancel:t}){let[n,a]=(0,F.useState)(`loading`),[o,c]=(0,F.useState)([]),[l,u]=(0,F.useState)(0),[d,f]=(0,F.useState)(),m=C();if((0,F.useEffect)(()=>{async function e(){let e=[],t=await D(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
|
|
2
|
+
`).filter(e=>e.trim()!==``),c(e)),m){let{stdout:t}=await D(`git`,[`rev-list`,`--count`,`${m.originalHeadCommit}..HEAD`]),n=parseInt(t.trim(),10)||0;if(u(n),e.length===0&&n===0){a(`removing`),x().then(()=>{process.chdir(m.originalCwd),g(m.originalCwd),N(),p.cache.clear?.(),f(`Worktree removed (no changes)`)}).catch(e=>{w(`Failed to clean up worktree: ${e}`,{level:`error`}),f(`Worktree cleanup failed, exiting anyway`)}).then(()=>{a(`done`)});return}else a(`asking`)}}e()},[m]),(0,F.useEffect)(()=>{n===`done`&&e(d)},[n,e,d]),!m)return e(`No active worktree session found`,{display:`system`}),null;if(n===`loading`||n===`done`)return null;async function _(e){if(!m)return;let t=!!m.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)a(`keeping`),o.length,await S(),process.chdir(m.originalCwd),g(m.originalCwd),N(),p.cache.clear?.(),f(t?`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${m.tmuxSessionName}`:`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}`),a(`done`);else if(e===`keep-kill-tmux`)a(`keeping`),o.length,m.tmuxSessionName&&await h(m.tmuxSessionName),await S(),process.chdir(m.originalCwd),g(m.originalCwd),N(),p.cache.clear?.(),f(`Worktree kept at ${m.worktreePath} on branch ${m.worktreeBranch}. Tmux session terminated.`),a(`done`);else if(e===`remove`||e===`remove-with-tmux`){a(`removing`),o.length,m.tmuxSessionName&&await h(m.tmuxSessionName);try{await x(),process.chdir(m.originalCwd),g(m.originalCwd),N(),p.cache.clear?.()}catch(e){w(`Failed to clean up worktree: ${e}`,{level:`error`}),f(`Worktree cleanup failed, exiting anyway`),a(`done`);return}let e=t?` Tmux session terminated.`:``;l>0&&o.length>0?f(`Worktree removed. ${l} ${l===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):l>0?f(`Worktree removed. ${l} ${l===1?`commit`:`commits`} on ${m.worktreeBranch} ${l===1?`was`:`were`} discarded.${e}`):o.length>0?f(`Worktree removed. Uncommitted changes were discarded.${e}`):f(`Worktree removed.${e}`),a(`done`)}}if(n===`keeping`)return(0,I.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,I.jsx)(M,{}),(0,I.jsx)(i,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,I.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,I.jsx)(M,{}),(0,I.jsx)(i,{children:`Removing worktree…`})]});let v=m.worktreeBranch,y=o.length>0,b=l>0,T=``;T=y&&b?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`} and ${l} ${l===1?`commit`:`commits`} on ${v}. All will be lost if you remove.`:y?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:b?`You have ${l} ${l===1?`commit`:`commits`} on ${v}. The branch will be deleted if you remove the worktree.`:`You are working in a worktree. Keep it to continue working there, or remove it to clean up.`;function E(){if(t){t();return}_(`keep`)}let O=y||b?`All changes and commits will be lost.`:`Clean up the worktree directory.`,k=!!m.tmuxSessionName,j=k?[{label:`Keep worktree and tmux session`,value:`keep-with-tmux`,description:`Stays at ${m.worktreePath}. Reattach with: tmux attach -t ${m.tmuxSessionName}`},{label:`Keep worktree, kill tmux session`,value:`keep-kill-tmux`,description:`Keeps worktree at ${m.worktreePath}, terminates tmux session.`},{label:`Remove worktree and tmux session`,value:`remove-with-tmux`,description:O}]:[{label:`Keep worktree`,value:`keep`,description:`Stays at ${m.worktreePath}`},{label:`Remove worktree`,value:`remove`,description:O}];return(0,I.jsx)(s,{title:`Exiting worktree session`,subtitle:T,onCancel:E,children:(0,I.jsx)(A,{defaultFocusValue:k?`keep-with-tmux`:`keep`,options:j,onChange:_})})}var F,I,L=t((()=>{F=n(a(),1),O(),T(),o(),E(),l(),d(),m(),k(),j(),I=c()}));function R(){return f(V)??`Goodbye!`}function z({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??R()),await b(0,`prompt_input_exit`)}return e?(0,B.jsx)(P,{onDone:r,onCancel:n}):null}var B,V,H=t((()=>{u(),v(),L(),B=c(),V=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}));export{H as n,z as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as e,P as t,kn as n,t as r,y as i}from"./src-DL3w8VPk.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Lp as o,zp as s}from"./loadAgentsDir-DGozQu_6.js";import{C as c,T as l,x as u}from"./debug-CRnGsZOV.js";import{t as d}from"./KeybindingProviderSetup-DsJqfEt-.js";import{t as f}from"./select-Fq6g2Ejk.js";import{t as p}from"./CustomSelect-BvTftqEH.js";import{t as m}from"./renderOptions-DRS2EslG.js";r(),s(),u(),p();var h=a();function g({filePath:n,errorDescription:r,onExit:a,onReset:o}){return(0,h.jsxs)(i,{title:`Configuration Error`,color:`error`,onCancel:a,children:[(0,h.jsxs)(e,{flexDirection:`column`,gap:1,children:[(0,h.jsxs)(t,{children:[`The configuration file at `,(0,h.jsx)(t,{bold:!0,children:n}),` contains invalid JSON.`]}),(0,h.jsx)(t,{children:r})]}),(0,h.jsxs)(e,{flexDirection:`column`,children:[(0,h.jsx)(t,{bold:!0,children:`Choose an option:`}),(0,h.jsx)(f,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?a():o()},onCancel:a})]})]})}var _=`dark`;async function v({error:e}){let t={...m(!1),theme:_};await new Promise(async r=>{let{unmount:i}=await n((0,h.jsx)(o,{children:(0,h.jsx)(d,{children:(0,h.jsx)(g,{filePath:e.filePath,errorDescription:e.message,onExit:()=>{i(),r(),process.exit(1)},onReset:()=>{l(e.filePath,c(e.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),i(),r(),process.exit(0)}})})}),t)})}export{v as showInvalidConfigDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as e,t,y as n}from"./src-DL3w8VPk.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{n as i,t as a}from"./ValidationErrorsList-
|
|
1
|
+
import{P as e,t,y as n}from"./src-DL3w8VPk.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{n as i,t as a}from"./ValidationErrorsList-INwwoerV.js";import{t as o}from"./select-Fq6g2Ejk.js";import{t as s}from"./CustomSelect-BvTftqEH.js";t(),s(),i();var c=r();function l({settingsErrors:t,onContinue:r,onExit:i}){function s(e){e===`exit`?i():r()}return(0,c.jsxs)(n,{title:`Settings Error`,onCancel:i,color:`warning`,children:[(0,c.jsx)(a,{errors:t}),(0,c.jsx)(e,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,c.jsx)(o,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:s})]})}export{l as InvalidSettingsDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Vt as t,ai as n,t as r}from"./src-DL3w8VPk.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Aw as a,Mw as o,Nw as s,kw as c}from"./loadAgentsDir-DGozQu_6.js";import{c as l,i as u}from"./debug-CRnGsZOV.js";import{Hn as d,Vn as f}from"./settings-CodSADx8.js";import{l as p,o as m}from"./stringUtils-Bu_lJH5c.js";import{n as h,t as g}from"./notifications-ql0eSo0Y.js";var _=e(n(),1);g(),d(),u(),m(),r(),c();var v=i();function y({children:e}){let{addNotification:n,removeNotification:r}=h();return(0,v.jsx)(t,{loadBindings:o,subscribeToChanges:s,initWatcher:a,onWarnings:(0,_.useCallback)((e,t)=>{let i=`keybinding-config-warning`;if(e.length===0){r(i);return}let a=f(e,e=>e.severity===`error`),o=f(e,e=>e.severity===`warning`),s;s=a>0&&o>0?`Found ${a} keybinding ${p(a,`error`)} and ${o} ${p(o,`warning`)}`:a>0?`Found ${a} keybinding ${p(a,`error`)}`:`Found ${o} keybinding ${p(o,`warning`)}`,s+=` · /doctor for details`,n({key:i,text:s,color:a>0?`error`:`warning`,priority:a>0?`immediate`:`high`,timeoutMs:6e4})},[n,r]),onDebugLog:l,children:e})}export{y as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-DL3w8VPk.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as i,at as a}from"./state-BQ4BEGin.js";import{$_ as o,Bp as s,Cv as c,Fv as l,Gy as u,Hp as d,Jy as f,Nv as p,Pv as m,Vp as ee,Wy as te,Yy as h,Z_ as g,ay as _,ev as v,gv as y,iv as b,iy as x,ov as S,rv as C,tv as w,uv as ne,zp as T,zv as E}from"./loadAgentsDir-DGozQu_6.js";import{I as D,M as O,c as k,i as A}from"./debug-CRnGsZOV.js";import{rt as j,tt as M}from"./settings-CodSADx8.js";import{c as N,l as P,o as F}from"./log-DoSpAwRP.js";import{n as I}from"./analytics-COpjZpvd.js";import{i as L,n as R,r as z,t as B}from"./reject-CEUkoI2G.js";import{n as V,t as H}from"./notifications-ql0eSo0Y.js";function U(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function W(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>U(e))),r=t.filter(e=>!n.has(U(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function G(e,t=!1){let n=ee(),r=s(e=>e.mcp.pluginReconnectKey),i=d(),c=(0,q.useRef)(new Map),{addNotification:m}=V(),h=(0,q.useRef)([]),b=(0,q.useRef)(null),x=(0,q.useCallback)(()=>{b.current=null;let e=h.current;e.length!==0&&(h.current=[],i(t=>{let n=t.mcp;for(let t of e){let{tools:e,commands:r,resources:i,...a}=t,o=a.type===`disabled`||a.type===`failed`?e??[]:e,s=a.type===`disabled`||a.type===`failed`?r??[]:r,c=a.type===`disabled`||a.type===`failed`?i??[]:i,l=M(a.name),u=n.clients.findIndex(e=>e.name===a.name)===-1?[...n.clients,a]:n.clients.map(e=>e.name===a.name?a:e),d=o===void 0?n.tools:[...R(n.tools,e=>e.name?.startsWith(l)),...o],f=s===void 0?n.commands:[...R(n.commands,e=>ne(e,a.name)),...s],p=c===void 0?n.resources:{...n.resources,...c.length>0?{[a.name]:c}:L(n.resources,a.name)};n={...n,clients:u,tools:d,commands:f,resources:p}}return{...t,mcp:n}}))},[i]),T=(0,q.useCallback)(e=>{h.current.push(e),b.current===null&&(b.current=setTimeout(x,16))},[x]),D=(0,q.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(T({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:_(e.client,e.name,i),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(g(e.name,e.config).catch(()=>{k(`Failed to invalidate the server cache: ${e.name}`)}),l(e.name)){N(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=K(t);N(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=c.current.get(e.name);r&&(clearTimeout(r),c.current.delete(e.name)),(async()=>{for(let t=1;t<=J;t++){if(l(e.name)){N(e.name,`Server disabled during reconnection, stopping retry`),c.current.delete(e.name);return}T({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:J});let r=Date.now();try{let i=await S(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){N(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),c.current.delete(e.name),D(i);return}if(N(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===J){N(e.name,`Max reconnection attempts (${J}) reached, giving up`),c.current.delete(e.name),D(i);return}}catch(i){let a=Date.now()-r;if(P(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===J){N(e.name,`Max reconnection attempts (${J}) reached, giving up`),c.current.delete(e.name),T({...e,type:`failed`});return}}let i=Math.min(Y*2**(t-1),X);N(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);c.current.set(e.name,n)})}})()}else T({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(f,async()=>{N(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=w.cache.get(e.name);w.cache.delete(e.name);let n=await w(e);n.length,t&&t.then(e=>{e.length},()=>{}),T({...e,tools:n})}catch(t){P(e.name,`Failed to refresh tools after list_changed notification: ${O(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(te,async()=>{N(e.name,`Received prompts/list_changed notification, refreshing prompts`);try{o.cache.delete(e.name);let t=await o(e);T({...e,commands:t})}catch(t){P(e.name,`Failed to refresh prompts after list_changed notification: ${O(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(u,async()=>{N(e.name,`Received resources/list_changed notification, refreshing resources`);try{v.cache.delete(e.name);let t=await v(e);T({...e,resources:t})}catch(t){P(e.name,`Failed to refresh resources after list_changed notification: ${O(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[T]),A=a();return(0,q.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await p(e),a={...n,...e};W(i,r),i(e=>{let{stale:t,...n}=y(e.mcp,a);for(let e of t){let t=c.current.get(e.name);t&&(clearTimeout(t),c.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,g(e.name,e.config).catch(()=>{}))}let r=new Set(n.clients.map(e=>e.name)),i=Object.entries(a).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,type:l(e)?`disabled`:`pending`,config:t}));return i.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...i]}}})}n().catch(e=>{P(`useManageMCPConnections`,`Failed to initialize servers as pending: ${O(e)}`)})},[t,e,i,A,r]),(0,q.useEffect)(()=>{let n=!1;async function r(){let r=Promise.resolve({}),{servers:a,errors:o}=t?{servers:{},errors:[]}:await p(e,r);if(n)return;W(i,o);let s={...a,...e},c=Object.fromEntries(Object.entries(s).filter(([e])=>!l(e)));C(D,c).catch(e=>{P(`useManageMcpConnections`,`Failed to get MCP resources: ${O(e)}`)});let u={},d={...s,...u},f={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(d))t.scope===`enterprise`?f.enterprise++:t.scope===`user`?f.global++:t.scope===`project`?f.project++:t.scope===`local`?f.user++:t.scope===`dynamic`?f.plugin++:t.scope===`claudeai`&&f.claudeai++;({...f})}return r(),()=>{n=!0}},[t,e,D,i,A,r]),(0,q.useEffect)(()=>{let e=c.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),b.current!==null&&(clearTimeout(b.current),b.current=null,x())}},[x]),{reconnectMcpServer:(0,q.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);let r=c.current.get(e);r&&(clearTimeout(r),c.current.delete(e));let i=await S(e,t.config);return D(i),i},[n,D]),toggleMcpServer:(0,q.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);if(t.type!==`disabled`){let n=c.current.get(e);n&&(clearTimeout(n),c.current.delete(e)),E(e,!1),t.type===`connected`&&await g(e,t.config),T({name:e,type:`disabled`,config:t.config})}else{E(e,!0),T({name:e,type:`pending`,config:t.config});let n=await S(e,t.config);D(n)}},[n,T,D])}}function K(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var q,J,Y,X,re=e((()=>{q=t(n(),1),i(),b(),h(),z(),B(),I(),m(),A(),H(),T(),D(),F(),x(),j(),c(),J=5,Y=1e3,X=3e4}));function ie(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function ae(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function oe({children:e,dynamicMcpConfig:t,isStrictMcpConfig:n}){let{reconnectMcpServer:r,toggleMcpServer:i}=G(t,n),a=(0,Z.useMemo)(()=>({reconnectMcpServer:r,toggleMcpServer:i}),[r,i]);return(0,Q.jsx)($.Provider,{value:a,children:e})}var Z,Q,$,se=e((()=>{Z=t(n(),1),re(),Q=r(),$=(0,Z.createContext)(null)}));export{ae as i,se as n,ie as r,oe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,H as a,I as o,P as s,T as c,ai as l,j as u,t as d,y as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as m,Cv as h,Hp as g,Pv as _,Z_ as v,_v as y,bv as b,dv as x,hd as S,hv as ee,iv as C,jv as w,md as T,mv as E,yv as D,zp as O}from"./loadAgentsDir-DGozQu_6.js";import{I as k,M as te}from"./debug-CRnGsZOV.js";import{$ as A,et as j,rt as M}from"./settings-CodSADx8.js";import{l as ne,n as re,o as N}from"./stringUtils-Bu_lJH5c.js";import{n as ie}from"./analytics-COpjZpvd.js";import{i as P,n as ae,r as oe}from"./MCPConnectionManager-DkZVxLEj.js";import{n as F,t as I}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{t as L}from"./select-Fq6g2Ejk.js";import{r as R,t as z}from"./Spinner-VjwI7m_g.js";import{t as B}from"./CustomSelect-BvTftqEH.js";function V({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,H.jsxs)(o,{children:[(0,H.jsx)(s,{bold:!0,children:`Capabilities: `}),(0,H.jsx)(s,{color:`text`,children:r.length>0?(0,H.jsx)(c,{children:r}):`none`})]})}var H,U=e((()=>{d(),H=p()}));function W(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function G(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var K=e((()=>{}));function se({server:e,serverToolsCount:t,onViewTools:n,onCancel:l,onComplete:d,borderless:f=!1}){let[p]=a(),h=F(),_=m(e=>e.mcp),b=g(),[S,C]=(0,q.useState)(!1),[w,O]=(0,q.useState)(null),k=oe(),A=P(),j=re(String(e.name)),M=D(_.commands,e.name).length,ne=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await A(e.name),e.config.type,l()}catch(n){d?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${te(n)}`)}},[e.client.type,e.config.type,e.name,A,l,d]);if(S)return(0,J.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(s,{color:`text`,children:[`Connecting to `,(0,J.jsx)(s,{bold:!0,children:e.name}),`…`]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(z,{}),(0,J.jsx)(s,{children:` Establishing connection to MCP server`})]}),(0,J.jsx)(s,{dimColor:!0,children:`This may take a few moments.`})]});let N=[];return e.client.type===`disabled`&&N.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&N.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&N.push({label:`Reconnect`,value:`reconnectMcpServer`}),N.push({label:`Disable`,value:`toggle-enabled`})),N.length===0&&N.push({label:`Back`,value:`back`}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:f?void 0:`round`,children:[(0,J.jsx)(o,{marginBottom:1,children:(0,J.jsxs)(s,{bold:!0,children:[j,` MCP Server`]})}),(0,J.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(s,{children:[u(`inactive`,p)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(s,{children:[u(`success`,p)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(s,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(s,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,J.jsxs)(s,{children:[u(`warning`,p)(r.triangleUpOutline),` needs authentication`]}):(0,J.jsxs)(s,{children:[u(`error`,p)(r.cross),` failed`]})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`URL: `}),(0,J.jsx)(s,{dimColor:!0,children:e.config.url})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Config location: `}),(0,J.jsx)(s,{dimColor:!0,children:x(e.scope)})]}),e.client.type===`connected`&&(0,J.jsx)(V,{serverToolsCount:t,serverPromptsCount:M,serverResourcesCount:_.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Tools: `}),(0,J.jsxs)(s,{dimColor:!0,children:[t,` tools`]})]})]}),w&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsxs)(s,{color:`error`,children:[`Error: `,w]})}),N.length>0&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(L,{options:N,onChange:async t=>{switch(t){case`tools`:n();break;case`reconnectMcpServer`:C(!0),O(null);try{await v(e.name,{...e.config,scope:e.scope}),b(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`pending`}:t),r=y(t.mcp.tools,e.name),i=E(t.mcp.commands,e.name),a=ee(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}});let{message:t}=W(await k(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{C(!1)}break;case`toggle-enabled`:await ne();break;case`back`:l();break}},onCancel:l})})]}),(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:h.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,J.jsxs)(c,{children:[(0,J.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,ce=e((()=>{n(),q=t(l(),1),ie(),I(),d(),C(),ae(),h(),O(),k(),N(),S(),B(),R(),U(),K(),J=p()}));function le({server:e,serverToolsCount:t,onViewTools:n,onCancel:l,onComplete:d,borderless:f=!1}){let[p]=a(),h=F(),g=m(e=>e.mcp),_=oe(),v=P(),[y,b]=(0,Y.useState)(!1),S=Y.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await v(e.name),l()}catch(n){d(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${te(n)}`)}},[e.client.type,e.name,v,l,d]),ee=re(String(e.name)),C=D(g.commands,e.name).length,E=[];return e.client.type!==`disabled`&&t>0&&E.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&E.push({label:`Reconnect`,value:`reconnectMcpServer`}),E.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),E.length===0&&E.push({label:`Back`,value:`back`}),y?(0,X.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,X.jsxs)(s,{color:`text`,children:[`Reconnecting to `,(0,X.jsx)(s,{bold:!0,children:e.name})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(z,{}),(0,X.jsx)(s,{children:` Restarting MCP server process`})]}),(0,X.jsx)(s,{dimColor:!0,children:`This may take a few moments.`})]}):(0,X.jsxs)(o,{flexDirection:`column`,children:[(0,X.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:f?void 0:`round`,children:[(0,X.jsx)(o,{marginBottom:1,children:(0,X.jsxs)(s,{bold:!0,children:[ee,` MCP Server`]})}),(0,X.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,X.jsxs)(s,{children:[u(`inactive`,p)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,X.jsxs)(s,{children:[u(`success`,p)(r.tick),` connected`]}):e.client.type===`pending`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(s,{dimColor:!0,children:r.radioOff}),(0,X.jsx)(s,{children:` connecting…`})]}):(0,X.jsxs)(s,{children:[u(`error`,p)(r.cross),` failed`]})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Command: `}),(0,X.jsx)(s,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Args: `}),(0,X.jsx)(s,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Config location: `}),(0,X.jsx)(s,{dimColor:!0,children:x(w(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,X.jsx)(V,{serverToolsCount:t,serverPromptsCount:C,serverResourcesCount:g.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Tools: `}),(0,X.jsxs)(s,{dimColor:!0,children:[t,` tools`]})]})]}),E.length>0&&(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(L,{options:E,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){b(!0);try{let{message:t}=W(await _(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{b(!1)}}else t===`toggle-enabled`?await S():t===`back`&&l()},onCancel:l})})]}),(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(s,{dimColor:!0,italic:!0,children:h.pending?(0,X.jsxs)(X.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,X.jsxs)(c,{children:[(0,X.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var Y,X,ue=e((()=>{n(),Y=t(l(),1),I(),d(),_(),ae(),h(),O(),k(),N(),S(),B(),R(),U(),K(),X=p()}));function de({tool:e,server:t,onBack:n}){let[r,i]=Z.useState(``),a=j(e.name,t.name),c=A(e.userFacingName?e.userFacingName({}):a),l=e.isReadOnly?.({})??!1,u=e.isDestructive?.({})??!1,d=e.isOpenWorld?.({})??!1;return Z.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,Q.jsx)(f,{title:(0,Q.jsxs)(Q.Fragment,{children:[c,l&&(0,Q.jsx)(s,{color:`success`,children:` [read-only]`}),u&&(0,Q.jsx)(s,{color:`error`,children:` [destructive]`}),d&&(0,Q.jsx)(s,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Q.jsxs)(o,{flexDirection:`column`,children:[(0,Q.jsxs)(o,{children:[(0,Q.jsx)(s,{bold:!0,children:`Tool name: `}),(0,Q.jsx)(s,{dimColor:!0,children:a})]}),(0,Q.jsxs)(o,{children:[(0,Q.jsx)(s,{bold:!0,children:`Full name: `}),(0,Q.jsx)(s,{dimColor:!0,children:e.name})]}),r&&(0,Q.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Q.jsx)(s,{bold:!0,children:`Description:`}),(0,Q.jsx)(s,{wrap:`wrap`,children:r})]}),e.inputJSONSchema?.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Q.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Q.jsx)(s,{bold:!0,children:`Parameters:`}),(0,Q.jsx)(o,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Q.jsxs)(s,{children:[`• `,t,r&&(0,Q.jsx)(s,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Q.jsx)(s,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Q.jsxs)(s,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var Z,Q,fe=e((()=>{Z=t(l(),1),d(),M(),S(),Q=p()}));function pe({server:e,onSelectTool:t,onBack:n}){let r=m(e=>e.mcp.tools),a=me.useMemo(()=>e.client.type===`connected`?b(r,e.name):[],[e,r]),o=a.map((t,n)=>{let r=j(t.name,e.name),i=A(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,$.jsx)(f,{title:`Tools for ${e.name}`,subtitle:`${a.length} ${ne(a.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,$.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,$.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:a.length===0?(0,$.jsx)(s,{dimColor:!0,children:`No tools available`}):(0,$.jsx)(L,{options:o,onChange:e=>{let n=parseInt(e,10),r=a[n];r&&t(r,n)},onCancel:n})})}var me,$,he=e((()=>{me=t(l(),1),d(),M(),h(),O(),N(),S(),B(),$=p()}));export{le as a,ce as c,fe as i,he as n,ue as o,de as r,se as s,pe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,ai as a,t as o}from"./src-DL3w8VPk.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{Cv as c,Mv as l,Pv as u,Sv as d,dv as f}from"./loadAgentsDir-DGozQu_6.js";function p({scope:e,parsingErrors:t,warnings:r}){let a=t.length>0,o=r.length>0;return!a&&!o?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(n,{children:[(a||o)&&(0,_.jsxs)(i,{color:a?`error`:`warning`,children:[`[`,a?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(i,{children:d(e)})]}),(0,_.jsxs)(n,{children:[(0,_.jsx)(i,{dimColor:!0,children:`Location: `}),(0,_.jsx)(i,{dimColor:!0,children:f(e)})]}),(0,_.jsxs)(n,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`error`,children:`[Error]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),r.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:l(`user`)},{scope:`project`,config:l(`project`)},{scope:`local`,config:l(`local`)},{scope:`enterprise`,config:l(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),a=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!a?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(i,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(n,{marginTop:1,children:(0,_.jsxs)(i,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(r,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(a(),1),u(),c(),o(),_=s()}));export{v as n,m as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{C as a,Gt as o,I as s,P as c,Wt as l,ai as u,ot as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{An as m,Pt as h}from"./state-BQ4BEGin.js";import{$o as g,$p as ee,Bp as _,Bu as v,Cb as y,Ji as b,LS as x,Qo as S,Qp as C,Ru as w,_c as T,am as E,b_ as D,dx as O,em as k,fx as A,gc as j,hc as M,iS as N,kb as te,lx as P,mn as ne,nS as F,nn as re,ts as ie,un as I,vS as ae,wa as L,xS as R,x_ as oe,xa as se,yc as z,zp as ce}from"./loadAgentsDir-DGozQu_6.js";import{Hn as le,Vn as B}from"./settings-CodSADx8.js";import{D as V,h as ue,m as H,o as de,q as fe,s as U}from"./log-DoSpAwRP.js";import{n as W}from"./analytics-COpjZpvd.js";import{_ as pe,p as me,y as he}from"./startupProfiler-DF0AjiDf.js";import{E as ge,T as _e,c as ve,d as ye,w as be}from"./sessionTracing-D7rekMdW.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{n as Ce,t as we}from"./select-Fq6g2Ejk.js";import{r as Te,t as Ee}from"./Spinner-VjwI7m_g.js";import*as G from"path";import{randomUUID as K}from"crypto";var q=t(u(),1),J=p();f(),h(),fe(),H(),de(),le(),W(),pe(),O(),D(),be(),w(),ve(),T(),M(),ie(),b(),ne();function De(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function Oe(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function ke(e,t,n,r,i,a,o){let s=K();m(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;ye(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&_e(`user_prompt`,{prompt_length:String(l.length),prompt:ge(l),"prompt.id":s}),De(c),Oe(c),t.length>0?{messages:[R({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[R({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}W(),b();async function Ae({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:o,messages:s,setUserInputOnProcessing:c,uuid:l,isAlreadyProcessing:u,querySource:d,canUseTool:f,skipSlashCommands:p,bridgeOrigin:m,isMeta:h,skipAttachments:g,autonomy:ee}){let _=typeof e==`string`?e:null,v=_?.startsWith(`/`)&&!p;n===`prompt`&&_!==null&&!h&&!v&&c?.(_),z(`query_process_user_input_base_start`);let y=i.getAppState(),b=await Me(e,n,r,i,a,o,s,l,u,d,f,y.toolPermissionContext.mode,p,m,h,g,t,ee);if(z(`query_process_user_input_base_end`),!b.shouldQuery)return b;z(`query_hooks_start`);let x=N(e)||``;for await(let t of re(x,y.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[ae(`${I(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:b.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return b.messages.push(R({content:e})),b.shouldQuery=!1,b}if(t.additionalContexts&&t.additionalContexts.length>0&&b.messages.push(S({type:`hook_additional_context`,content:t.additionalContexts.map(je),hookName:`UserPromptSubmit`,toolUseID:`hook-${K()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;b.messages.push({...t.message,attachment:{...t.message.attachment,content:je(t.message.attachment.content)}});break;default:b.messages.push(t.message);break}}return z(`query_hooks_end`),b}var Y=1e4;function je(e){return e.length>Y?`${e.substring(0,Y)}… [output truncated - exceeded ${Y} characters]`:e}async function Me(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,ee,_){let y=null,b=[],x=[],S=e;if(typeof e==`string`)y=e;else if(e.length>0){z(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await A(n);if(e.dimensions){let t=P(e.dimensions);t&&x.push(t)}t.push(e.block)}else t.push(n);S=t,z(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(y=n.text,b=t.slice(0,-1)):b=t}if(y===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let C=i?Object.values(i).filter(oe):[],w=C.map(e=>e.id),T=i?await v(i):new Map;z(`query_pasted_image_processing_start`);let E=await Promise.all(C.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return e.content.length,{resized:await A(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??T.get(e.id)}})),D=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of E){if(e.dimensions){let t=P(e.dimensions,n);t&&x.push(t)}else if(t){let e=P(t,n);e&&x.push(e)}else n&&x.push(`[Image source: ${n}]`);D.push(e.block)}z(`query_pasted_image_processing_end`);let O=f,k=!h&&y!==null&&(t!==`prompt`||O||!y.startsWith(`/`));z(`query_attachment_loading_start`);let M=k?await j(g(y,r,a??null,[],o,l)):[];if(z(`query_attachment_loading_end`),y!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-BBtnCx-7.js`);return X(await e(y,b,M,r,n),x)}if(y!==null&&!O&&y.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-jzF0GmLO.js`);return X(await e(y,b,D,M,r,n,s,c,u,_),x)}if(y!==null&&t===`prompt`){let e=y.trim(),t=M.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`;e.startsWith(n)}}return X(ke(S,D,w,M,s,d,m),x)}function X(e,t){return t.length>0&&e.messages.push(R({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}var Ne=n({MessageSelector:()=>Fe,messagesAfterAreOnlySynthetic:()=>He,selectableUserMessagesFilter:()=>Q});function Pe(e){return e.type===`text`}function Z(e){return e===`summarize`}function Fe({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:u,onClose:d,preselectedMessage:f}){let p=_(e=>e.fileHistory),[m,h]=(0,q.useState)(void 0),g=ee(),v=(0,q.useMemo)(K,[]),y=(0,q.useMemo)(()=>[...e.filter(Q),{...R({content:``}),uuid:v}],[e,v]),[b,x]=(0,q.useState)(y.length-1),S=Math.max(0,Math.min(b-Math.floor($/2),y.length-$)),w=y.length>1,[T,E]=(0,q.useState)(f),[D,O]=(0,q.useState)(void 0);(0,q.useEffect)(()=>{if(!f||!g)return;let e=!1;return k(p,f.uuid).then(t=>{e||O(t)}),()=>{e=!0}},[f,g,p]);let[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(null),[te,P]=(0,q.useState)(`both`),[ne,F]=(0,q.useState)(``);function re(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:F}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,q.useEffect)(()=>{},[]);async function ie(e){t(),j(!0);try{await n(e),j(!1),d()}catch(e){U(e),j(!1),h(`Failed to restore the conversation:\n${e}`)}}async function I(t){let n=e.indexOf(t);if(e.length-1-n,t.type,!e.includes(t)){d();return}if(!g){await ie(t);return}let r=await k(p,t.uuid);E(t),O(r)}async function ae(e){if(!T){h(`Message not found.`);return}if(e===`nevermind`){f?d():E(void 0);return}if(Z(e)){t(),j(!0),N(e),h(void 0);try{let e=ne.trim()||void 0;await u(T,e,`from`),j(!1),N(null),E(void 0),d()}catch(e){U(e),j(!1),N(null),E(void 0),h(`Failed to summarize:\n${e}`)}return}t(),j(!0),h(void 0);let i=null,a=null;if(e===`code`||e===`both`)try{await r(T)}catch(e){i=e,U(i)}if(e===`conversation`||e===`both`)try{await n(T)}catch(e){a=e,U(a)}j(!1),E(void 0),a&&i?h(`Failed to restore the conversation and code:\n${a}\n${i}`):a?h(`Failed to restore the conversation:\n${a}`):i?h(`Failed to restore the code:\n${i}`):d()}let L=xe(),oe=(0,q.useCallback)(()=>{if(T&&!f){E(void 0);return}d()},[d,T,f]),se=(0,q.useCallback)(()=>x(e=>Math.max(0,e-1)),[]),z=(0,q.useCallback)(()=>x(e=>Math.min(y.length-1,e+1)),[y.length]),ce=(0,q.useCallback)(()=>x(0),[]),le=(0,q.useCallback)(()=>x(y.length-1),[y.length]),B=(0,q.useCallback)(()=>{let e=y[b];e&&I(e)},[y,b,I]);l(`confirm:no`,oe,{context:`Confirmation`,isActive:!T}),o({"messageSelector:up":se,"messageSelector:down":z,"messageSelector:top":ce,"messageSelector:bottom":le,"messageSelector:select":B},{context:`MessageSelector`,isActive:!A&&!m&&!T&&w});let[V,ue]=(0,q.useState)({});(0,q.useEffect)(()=>{async function t(){g&&Promise.all(y.map(async(t,n)=>{if(t.uuid!==v){let r=C(p,t.uuid),i=y.at(n+1),a=r?Ve(e,t.uuid,i?.uuid===v?void 0:i?.uuid):void 0;ue(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[y,e,v,p,g]);let H=g&&D?.filesChanged&&D.filesChanged.length>0,de=!m&&!T&&!f&&w;return(0,J.jsxs)(s,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(a,{color:`suggestion`}),(0,J.jsxs)(s,{flexDirection:`column`,marginX:1,gap:1,children:[(0,J.jsx)(c,{bold:!0,color:`suggestion`,children:`Rewind`}),m&&(0,J.jsxs)(c,{color:`error`,children:[`Error: `,m]}),!w&&(0,J.jsx)(c,{children:`Nothing to rewind to yet.`}),!m&&T&&w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{children:[`Confirm you want to restore `,!D&&`the conversation `,`to the point before you sent this message:`]}),(0,J.jsxs)(s,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,J.jsx)(Be,{userMessage:T,color:`text`,isCurrent:!1}),(0,J.jsxs)(c,{dimColor:!0,children:[`(`,me(new Date(T.timestamp)),`)`]})]}),(0,J.jsx)(Le,{selectedRestoreOption:te,canRestoreCode:!!H,diffStatsForRestore:D}),A&&Z(M)?(0,J.jsxs)(s,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(Ee,{}),(0,J.jsx)(c,{children:`Summarizing…`})]}):(0,J.jsx)(we,{isDisabled:A,options:re(!!H),defaultFocusValue:H?`both`:`conversation`,onFocus:e=>P(e),onChange:e=>ae(e),onCancel:()=>f?d():E(void 0)}),H&&(0,J.jsx)(s,{marginBottom:1,children:(0,J.jsxs)(c,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),de&&(0,J.jsxs)(J.Fragment,{children:[g?(0,J.jsx)(c,{children:`Restore the code and/or conversation to the point before…`}):(0,J.jsx)(c,{children:`Restore and fork the conversation to the point before…`}),(0,J.jsx)(s,{width:`100%`,flexDirection:`column`,children:y.slice(S,S+$).map((e,t)=>{let n=S+t,r=n===b,a=e.uuid===v,o=n in V,l=V[n],u=l?.filesChanged?.length;return(0,J.jsxs)(s,{height:g?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,J.jsx)(s,{width:2,minWidth:2,children:r?(0,J.jsxs)(c,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,J.jsx)(c,{children:` `})}),(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(s,{flexShrink:1,height:1,overflow:`hidden`,children:(0,J.jsx)(Be,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),g&&o&&(0,J.jsx)(s,{height:1,flexDirection:`row`,children:l?(0,J.jsx)(c,{dimColor:!r,color:`inactive`,children:u?(0,J.jsxs)(J.Fragment,{children:[u===1&&l.filesChanged[0]?`${G.basename(l.filesChanged[0])} `:`${u} files changed `,(0,J.jsx)(ze,{diffStats:l})]}):(0,J.jsx)(J.Fragment,{children:`No code changes`})}):(0,J.jsxs)(c,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!T&&(0,J.jsx)(c,{dimColor:!0,italic:!0,children:L.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):(0,J.jsxs)(J.Fragment,{children:[!m&&w&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Ie(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function Le({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(c,{dimColor:!0,children:Ie(e)}),!Z(e)&&(r?(0,J.jsx)(Re,{diffStatsForRestore:n}):(0,J.jsx)(c,{dimColor:!0,children:`The code will be unchanged.`}))]})}function Re({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged?.[0])return(0,J.jsx)(c,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?G.basename(e.filesChanged[0]||``):t===2?`${G.basename(e.filesChanged[0]||``)} and ${G.basename(e.filesChanged[1]||``)}`:`${G.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,J.jsxs)(c,{dimColor:!0,children:[`The code will be restored `,(0,J.jsx)(ze,{diffStats:e}),` in `,n,`.`]})}function ze({diffStats:e}){if(e?.filesChanged)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,J.jsxs)(c,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function Be({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=d();if(r)return(0,J.jsx)(s,{width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,l=typeof o==`string`?null:o[o.length-1],u=ue(typeof o==`string`?o.trim():l&&Pe(l)?l.text.trim():`(no prompt)`);if(se(u))return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(u.includes(`<bash-input>`)){let e=F(u,`bash-input`);if(e)return(0,J.jsxs)(s,{flexDirection:`row`,width:`100%`,children:[(0,J.jsx)(c,{color:`bashBorder`,children:`!`}),(0,J.jsxs)(c,{color:t,dimColor:n,children:[` `,e]})]})}if(u.includes(`<command-message>`)){let e=F(u,V),r=F(u,`command-args`),i=F(u,`skill-format`)===`true`;if(e)return i?(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{color:t,dimColor:n,children:i?he(u,a-i,!0):u.slice(0,500).split(`
|
|
2
|
+
`).slice(0,4).join(`
|
|
3
|
+
`)})})}function Ve(e,t,n){let r=e.findIndex(e=>e.uuid===t);if(r===-1)return;let i=n?e.findIndex(e=>e.uuid===n):e.length;i===-1&&(i=e.length);let a=[],o=0,s=0;for(let t=r+1;t<i;t++){let n=e[t];if(!n||!L(n))continue;let r=n.toolUseResult;if(!(!r?.filePath||!r.structuredPatch)){a.includes(r.filePath)||a.push(r.filePath);try{if(`type`in r&&r.type===`create`)o+=r.content.split(/\r?\n/).length;else for(let e of r.structuredPatch){let t=B(e.lines,e=>e.startsWith(`+`)),n=B(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Q(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||x(e)||e.isMeta||e.isCompactSummary||e.isVisibleInTranscriptOnly)return!1;let t=e.message.content,n=typeof t==`string`?null:t[t.length-1],r=typeof t==`string`?t.trim():n&&Pe(n)?n.text.trim():``;return!(r.indexOf(`<local-command-stdout>`)!==-1||r.indexOf(`<local-command-stderr>`)!==-1||r.indexOf(`<bash-stdout>`)!==-1||r.indexOf(`<bash-stderr>`)!==-1||r.indexOf(`<task-notification>`)!==-1||r.indexOf(`<tick>`)!==-1)}function He(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!x(t)&&!L(t)&&t.type!==`progress`&&t.type!==`system`&&t.type!==`attachment`&&!(t.type===`user`&&t.isMeta)){if(t.type===`assistant`){let e=t.message.content;if(Array.isArray(e)&&e.some(e=>e.type===`text`&&e.text.trim()||e.type===`tool_use`))return!1;continue}if(t.type===`user`)return!1}}return!0}var $,Ue=e((()=>{r(),W(),ce(),E(),Se(),y(),b(),Ce(),Te(),te(),$=7}));export{Q as a,He as i,Ne as n,Ae as o,Ue as r,Fe as t};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{C as o,Gr as s,I as c,N as l,P as u,Pn as d,Rn as f,ai as p,di as m,fi as h,j as g,mt as _,ot as v,t as y,xt as b}from"./src-DL3w8VPk.js";import{t as x}from"./jsx-runtime-Bb4Xn-E0.js";import{$i as S,$u as C,A_ as w,Bp as T,DC as ee,DS as E,D_ as D,Du as O,Eu as k,Ff as A,If as j,Ji as M,Mp as N,OS as P,O_ as F,Ou as I,Qi as L,Sa as te,Tb as ne,Tu as re,_b as ie,aa as ae,bC as oe,bb as se,bu as ce,cv as le,da as ue,dd as R,du as de,ea as fe,ed as pe,fu as me,gw as he,ha as ge,hb as _e,hm as ve,jp as z,kC as ye,kS as be,kb as xe,ku as Se,la as Ce,lv as B,nS as we,na as Te,oS as Ee,pS as De,pa as Oe,ra as ke,sS as Ae,ta as je,ud as Me,uu as V,vb as Ne,vu as Pe,vw as Fe,w_ as Ie,wb as Le,wu as Re,xb as ze,xu as Be,yC as Ve,yb as He,yu as Ue,zp as We}from"./loadAgentsDir-DGozQu_6.js";import{n as Ge,t as Ke}from"./cwd-BvNt_018.js";import{a as qe,c as Je,i as Ye,n as Xe,o as Ze}from"./debug-CRnGsZOV.js";import{Ht as Qe,Vt as $e,h as et,t as tt}from"./settings-CodSADx8.js";import{d as nt,h as rt,o as it}from"./config-CWPHVTic.js";import{B as at,L as ot,R as st,q as ct}from"./log-DoSpAwRP.js";import{l as lt,o as ut}from"./stringUtils-Bu_lJH5c.js";import{_ as dt,f as ft,p as pt,y as mt}from"./startupProfiler-DF0AjiDf.js";import{f as ht,h as gt,x as _t}from"./model-DpZaKZMb.js";import{gn as vt,vn as yt}from"./prompt-DzO1um1h.js";import{a as bt,n as xt,r as St,t as Ct}from"./projectOnboardingState--L3BKjOE.js";import{n as wt,t as Tt}from"./systemTheme-Ceakddth.js";import{a as Et,c as Dt,i as Ot}from"./SpinnerGlyph-CqrOK3Mx.js";import{n as kt,r as At}from"./PromptInputFooterSuggestions-CCTZYbWI.js";import{n as jt,t as Mt}from"./useMainLoopModel-DSN5HjV1.js";import{n as Nt,t as Pt}from"./modalContext-DDZdU1J8.js";import{n as Ft,r as It,t as Lt}from"./statusNoticeHelpers-BfmIub5L.js";import{a as Rt,c as zt,i as Bt,l as Vt,n as Ht,o as Ut,r as Wt,t as Gt,u as Kt}from"./logoUtils-DLd6JKqW.js";import{homedir as qt}from"os";import{relative as Jt}from"path";import{fileURLToPath as Yt}from"url";function Xt(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var Zt=e((()=>{}));function Qt(e){if(e.type!==`user`)return!1;let t=Array.isArray(e.message.content)?e.message.content[0]:void 0;return!t||typeof t==`string`||t?.type!==`text`||!t.text.includes(`<task-notification`)||we(t.text,`status`)!==`completed`?!1:we(t.text,`summary`)?.startsWith(`Background command `)??!1}function $t(e,t){if(!N()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if(Qt(t)){let i=0;for(;r<e.length&&Qt(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${at}><${ot}>completed</${ot}><${st}>${i} background commands completed</${st}></${at}>`}]}})}else n.push(t),r++}return n}var en=e((()=>{ct(),ve(),z(),M()}));function tn(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function nn(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(tn(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!tn(t)||t.hookLabel!==i)break;a.push(t),n++}a.length===1?t.push(r):t.push({...r,hookCount:a.reduce((e,t)=>e+t.hookCount,0),hookInfos:a.flatMap(e=>e.hookInfos),hookErrors:a.flatMap(e=>e.hookErrors),preventedContinuation:a.some(e=>e.preventedContinuation),hasOutput:a.some(e=>e.hasOutput),totalDurationMs:Math.max(...a.map(e=>e.totalDurationMs??0))})}else t.push(r),n++}return t}var rn=e((()=>{}));function an(e){let t=cn.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),cn.set(e,t)),t}function on(e){if(e.type===`assistant`&&e.message?.content&&Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_use`){let t=e.message.content[0];return{messageId:e.message.id,toolUseId:t.id,toolName:t.name}}return null}function sn(e,t,n=!1){if(n)return{messages:e};let r=an(t),i=new Map;for(let t of e){let e=on(t);if(e&&r.has(e.toolName)){let n=`${e.messageId}:${e.toolName}`,r=i.get(n)??[];r.push(t),i.set(n,r)}}let a=new Map,o=new Set;for(let[e,t]of i)if(t.length>=2){a.set(e,t);for(let e of t){let t=on(e);t&&o.add(t.toolUseId)}}let s=new Map;for(let t of e)if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content))for(let e of t.message.content)e.type===`tool_result`&&o.has(e.tool_use_id)&&s.set(e.tool_use_id,t);let c=[],l=new Set;for(let t of e){let e=on(t);if(e){let t=`${e.messageId}:${e.toolName}`,n=a.get(t);if(n){if(!l.has(t)){l.add(t);let r=n[0],i=[];for(let e of n){let t=e.message.content[0].id,n=s.get(t);n&&i.push(n)}let a={type:`grouped_tool_use`,toolName:e.toolName,messages:n,results:i,displayMessage:r,uuid:`grouped-${r.uuid}`,timestamp:r.timestamp,messageId:e.messageId};c.push(a)}continue}}if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content)){let e=t.message.content.filter(e=>e.type===`tool_result`);if(e.length>0&&e.every(e=>o.has(e.tool_use_id)))continue}c.push(t)}return{messages:c}}var cn,ln=e((()=>{cn=new WeakMap}));function un(e){let t=gn.get(e);if(t!==void 0)return t;let n=dn(e).toLowerCase();return gn.set(e,n),n}function dn(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=hn.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?hn.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(pn(e.toolUseResult));t=r.join(`
|
|
2
|
+
`)}break}case`assistant`:{let n=e.message.content;Array.isArray(n)&&(t=n.flatMap(e=>e.type===`text`?[e.text]:e.type===`tool_use`?[fn(e.input)]:[]).join(`
|
|
3
|
+
`));break}case`attachment`:if(e.attachment.type===`relevant_memories`)t=(e.attachment.memories??[]).map(e=>e.content).join(`
|
|
4
|
+
`);else if(e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
|
|
5
|
+
`)}break;case`collapsed_read_search`:e.relevantMemories&&(t=e.relevantMemories.map(e=>e.content).join(`
|
|
6
|
+
`));break;default:break}let n=t,r=n.indexOf(`<system-reminder>`);for(;r>=0;){let e=n.indexOf(mn,r);if(e<0)break;n=n.slice(0,r)+n.slice(e+18),r=n.indexOf(`<system-reminder>`)}return n}function fn(e){if(!e||typeof e!=`object`)return``;let t=e,n=[];for(let e of[`command`,`pattern`,`file_path`,`path`,`prompt`,`description`,`query`,`url`,`skill`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`args`,`files`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(` `))}return n.join(`
|
|
7
|
+
`)}function pn(e){if(!e||typeof e!=`object`)return typeof e==`string`?e:``;let t=e;if(typeof t.stdout==`string`){let e=typeof t.stderr==`string`?t.stderr:``;return t.stdout+(e?`\n${e}`:``)}if(t.file&&typeof t.file==`object`&&typeof t.file.content==`string`)return t.file.content;let n=[];for(let e of[`content`,`output`,`result`,`text`,`message`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`filenames`,`lines`,`results`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(`
|
|
8
|
+
`))}return n.join(`
|
|
9
|
+
`)}var mn,hn,gn,_n=e((()=>{M(),mn=`</system-reminder>`,hn=new Set([P,be]),gn=new WeakMap}));function vn({pose:e=`default`}={}){return(0,yn.jsxs)(c,{flexDirection:`column`,alignItems:`center`,children:[(0,yn.jsx)(u,{color:`clawd_body`,children:` █████ `}),(0,yn.jsx)(u,{color:`clawd_body`,children:`██ ● ● ██`}),(0,yn.jsx)(u,{color:`clawd_body`,children:`██ ▄▄▄ ██`}),(0,yn.jsx)(u,{color:`clawd_body`,children:` █ █ █ █ `})]})}var yn,bn=e((()=>{y(),yn=x()}));function xn(e){let{title:t,lines:n,footer:r,emptyMessage:i,customContent:a}=e,o=s(t);if(a!==void 0)o=Math.max(o,a.width);else if(n.length===0&&i)o=Math.max(o,s(i));else{let e=Math.max(0,...n.map(e=>e.timestamp?s(e.timestamp):0));for(let t of n){let n=e>0?e:0,r=s(t.text)+(n>0?n+2:0);o=Math.max(o,r)}}return r&&(o=Math.max(o,s(r))),o}function Sn({config:e,actualWidth:t}){let{title:n,lines:r,footer:i,emptyMessage:a,customContent:o}=e,l=Math.max(0,...r.map(e=>e.timestamp?s(e.timestamp):0));return(0,H.jsxs)(c,{flexDirection:`column`,width:t,children:[(0,H.jsx)(u,{bold:!0,color:`claude`,children:n}),o?(0,H.jsxs)(H.Fragment,{children:[o.content,i&&(0,H.jsx)(u,{dimColor:!0,italic:!0,children:mt(i,t)})]}):r.length===0&&a?(0,H.jsx)(u,{dimColor:!0,children:mt(a,t)}):(0,H.jsxs)(H.Fragment,{children:[r.map((e,n)=>{let r=Math.max(10,t-(l>0?l+2:0));return(0,H.jsxs)(u,{children:[l>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{dimColor:!0,children:(e.timestamp||``).padEnd(l)}),` `]}),(0,H.jsx)(u,{children:mt(e.text,r)})]},n)}),i&&(0,H.jsx)(u,{dimColor:!0,italic:!0,children:mt(i,t)})]})]})}var H,Cn=e((()=>{y(),dt(),H=x()}));function wn({feeds:e,maxWidth:t}){let n=e.map(e=>xn(e)),r=Math.max(...n),i=Math.min(r,t);return(0,En.jsx)(c,{flexDirection:`column`,children:e.map((t,n)=>(0,En.jsxs)(Tn.Fragment,{children:[(0,En.jsx)(Sn,{config:t,actualWidth:i}),n<e.length-1&&(0,En.jsx)(o,{color:`claude`,width:i})]},n))})}var Tn,En,Dn=e((()=>{Tn=t(p(),1),y(),Cn(),En=x()}));function On(e){let t=e.map(e=>{let t=pt(e.modified);return{text:(e.summary&&e.summary!==`No prompt`?e.summary:e.firstPrompt)||``,timestamp:t}});return{title:`Recent activity`,lines:t,footer:t.length>0?`/resume for more`:void 0,emptyMessage:`No recent activity`}}function kn(e){let t=e.filter(({isEnabled:e})=>e).sort((e,t)=>Number(e.isComplete)-Number(t.isComplete)).map(({text:e,isComplete:t})=>({text:`${t?`${a.tick} `:``}${e}`})),n=Ke()===qt()?`Note: You have launched claude in your home directory. For the best experience, launch it in a project directory instead.`:void 0;return n&&t.push({text:n}),{title:`Tips for getting started`,lines:t}}var An=e((()=>{i(),Ge(),dt()}));function U(e,t,n){return Array.from({length:n},()=>({pose:e,offset:t}))}function jn(){let{pose:e,bounceOffset:t,onClick:n}=Mn();return(0,Pn.jsx)(c,{height:Bn,flexDirection:`column`,onClick:n,children:(0,Pn.jsx)(c,{marginTop:t,flexShrink:0,children:(0,Pn.jsx)(vn,{pose:e})})})}function Mn(){let[e]=(0,Nn.useState)(()=>tt().prefersReducedMotion??!1),[t,n]=(0,Nn.useState)(-1),r=(0,Nn.useRef)(Fn),i=()=>{e||t!==-1||(r.current=In[Math.floor(Math.random()*In.length)],n(0))};(0,Nn.useEffect)(()=>{if(t===-1)return;if(t>=r.current.length){n(-1);return}let e=setTimeout(n,Rn,zn);return()=>clearTimeout(e)},[t]);let a=r.current,o=t>=0&&t<a.length?a[t]:Ln;return{pose:o.pose,bounceOffset:o.offset,onClick:i}}var Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn=e((()=>{Nn=t(p(),1),y(),et(),bn(),Pn=x(),Fn=[...U(`default`,1,2),...U(`arms-up`,0,3),...U(`default`,0,1),...U(`default`,1,2),...U(`arms-up`,0,3),...U(`default`,0,1)],In=[Fn,[...U(`look-right`,0,5),...U(`look-left`,0,5),...U(`default`,0,1)]],Ln={pose:`default`,offset:0},Rn=60,zn=e=>e+1,Bn=3}));function Hn(){let{columns:e}=v(),t=T(e=>e.agent),n=_t(jt()),{version:r,cwd:i,billingType:a,agentName:o}=Ut(),l=t??o,d=Math.max(e-15,20),f=mt(r,Math.max(d-11,6)),{shouldSplit:p,truncatedModel:m,truncatedBilling:h}=Wt(n,a,d),g=l?d-1-s(l)-3:d,_=Kt(i,Math.max(g,10));return(0,W.jsx)(A,{children:(0,W.jsxs)(c,{flexDirection:`row`,gap:2,alignItems:`center`,children:[N()?(0,W.jsx)(jn,{}):(0,W.jsx)(vn,{}),(0,W.jsxs)(c,{flexDirection:`column`,children:[(0,W.jsxs)(u,{children:[(0,W.jsx)(u,{bold:!0,children:`Work Mate`}),` `,(0,W.jsxs)(u,{dimColor:!0,children:[`v`,f]})]}),p?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(u,{dimColor:!0,children:m}),(0,W.jsx)(u,{dimColor:!0,children:h})]}):(0,W.jsxs)(u,{dimColor:!0,children:[m,` · `,h]}),(0,W.jsx)(u,{dimColor:!0,children:l?`@${l} · ${_}`:_})]})]})})}var W,Un=e((()=>{Mt(),xe(),y(),We(),dt(),z(),Vt(),ht(),j(),Vn(),bn(),W=x()}));function Wn(){let e=(0,Kn.useMemo)(Gn,[]),t=(0,Kn.useMemo)(()=>it().lastShownEmergencyTip,[]),n=e.tip&&e.tip!==t;return(0,Kn.useEffect)(()=>{n&&rt(t=>t.lastShownEmergencyTip===e.tip?t:{...t,lastShownEmergencyTip:e.tip})},[n,e.tip]),n?(0,qn.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,qn.jsx)(u,{...e.color===`warning`?{color:`warning`}:e.color===`error`?{color:`error`}:{dimColor:!0},children:e.tip})}):null}function Gn(){return Jn}var Kn,qn,Jn,Yn=e((()=>{Kn=t(p(),1),y(),nt(),qn=x(),Jn={tip:``,color:`dim`}}));function Xn({char:e=`✻`}){let[t]=(0,Zn.useState)(()=>tt().prefersReducedMotion??!1),[n,r]=(0,Zn.useState)(t),i=(0,Zn.useRef)(null),[a,o]=_(n?null:50);return(0,Zn.useEffect)(()=>{if(n)return;let e=setTimeout(r,er,!0);return()=>clearTimeout(e)},[n]),n?(0,Qn.jsx)(c,{ref:a,children:(0,Qn.jsx)(u,{color:tr,children:e})}):(i.current===null&&(i.current=o),(0,Qn.jsx)(c,{ref:a,children:(0,Qn.jsx)(u,{color:Dt(Ot((o-i.current)/$n*360%360)),children:e})}))}var Zn,Qn,$n,er,tr,nr=e((()=>{Zn=t(p(),1),Qe(),y(),et(),Et(),Qn=x(),$n=1500,er=$n*2,tr=Dt({r:153,g:153,b:153})}));function rr(){return gt()&&(it().opus1mMergeNoticeSeenCount??0)<sr}function ir(){let[e]=(0,ar.useState)(rr);return(0,ar.useEffect)(()=>{if(!e)return;let t=(it().opus1mMergeNoticeSeenCount??0)+1;rt(e=>(e.opus1mMergeNoticeSeenCount??0)>=t?e:{...e,opus1mMergeNoticeSeenCount:t})},[e]),e?(0,or.jsxs)(c,{paddingLeft:2,children:[(0,or.jsx)(Xn,{char:`↑`}),(0,or.jsx)(u,{dimColor:!0,children:` Opus now defaults to 1M context · 5x more room, same pricing`})]}):null}var ar,or,sr,cr=e((()=>{ar=t(p(),1),Qe(),y(),nt(),ht(),nr(),or=x(),sr=6}));function lr(){let e=zt(),{columns:t}=v(),r=bt(),i=ee.isSandboxingEnabled(),a=T(e=>e.agent),o=it(),[l]=(0,ur.useState)(()=>{let e=tt().companyAnnouncements;if(!(!e||e.length===0))return o.numStartups===1?e[0]:e[Math.floor(Math.random()*e.length)]});(0,ur.useEffect)(()=>{r&&xt()},[r]),!r&&n(process.env.CLAUDE_CODE_FORCE_FULL_LOGO);let d=_t(jt()),{version:f,cwd:p,billingType:m,agentName:h}=Ut(),_=a??h,y=mt(d,dr-20);if(!r&&!n(process.env.CLAUDE_CODE_FORCE_FULL_LOGO))return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Hn,{}),(0,G.jsx)(ir,{}),qe()&&(0,G.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(u,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(u,{dimColor:!0,children:[`Logging to: `,Ze()?`stderr`:Xe()]})]}),(0,G.jsx)(Wn,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(u,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(u,{dimColor:!0,children:process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Work Mate uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),l&&(0,G.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(u,{children:l})})]});let b=Rt(t),x=wt(it().theme),S=` ${g(`claude`,x)(`Work Mate`)} ${g(`inactive`,x)(`v${f}`)} `,C=g(`claude`,x)(` Work Mate `);if(b===`compact`){let e=Bt(null);s(e)>t-4&&(e=Bt(null));let n=_?t-4-1-s(_)-3:t-4,r=Kt(p,Math.max(n,10));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(A,{children:(0,G.jsxs)(c,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:C,position:`top`,align:`start`,offset:1},paddingX:1,paddingY:1,alignItems:`center`,width:t,children:[(0,G.jsx)(u,{bold:!0,children:e}),(0,G.jsx)(c,{marginY:1,children:(0,G.jsx)(vn,{})}),(0,G.jsx)(u,{dimColor:!0,children:y}),(0,G.jsx)(u,{dimColor:!0,children:m}),(0,G.jsx)(u,{dimColor:!0,children:_?`@${_} · ${r}`:r})]})}),(0,G.jsx)(ir,{}),i&&(0,G.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,G.jsx)(u,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}let w=Bt(null),E=`${y} · ${m}`,D=_?dr-1-s(_)-3:dr,O=Kt(p,Math.max(D,10)),k=_?`@${_} · ${O}`:O,{leftWidth:j,rightWidth:M}=Gt(t,b,Ht(w,k,E));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(A,{children:(0,G.jsx)(c,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:S,position:`top`,align:`start`,offset:3},children:(0,G.jsxs)(c,{flexDirection:b===`horizontal`?`row`:`column`,paddingX:1,gap:1,children:[(0,G.jsxs)(c,{flexDirection:`column`,width:j,justifyContent:`space-between`,alignItems:`center`,minHeight:9,children:[(0,G.jsx)(c,{marginTop:1,children:(0,G.jsx)(u,{bold:!0,children:w})}),(0,G.jsx)(vn,{}),(0,G.jsxs)(c,{flexDirection:`column`,alignItems:`center`,children:[(0,G.jsx)(u,{dimColor:!0,children:E}),(0,G.jsx)(u,{dimColor:!0,children:k})]})]}),b===`horizontal`&&(0,G.jsx)(c,{height:`100%`,borderStyle:`single`,borderColor:`claude`,borderDimColor:!0,borderTop:!1,borderBottom:!1,borderLeft:!1}),b===`horizontal`&&(0,G.jsx)(wn,{feeds:r?[kn(Ct()),On(e)]:[On(e)],maxWidth:M})]})})}),(0,G.jsx)(ir,{}),qe()&&(0,G.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(u,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(u,{dimColor:!0,children:[`Logging to: `,Ze()?`stderr`:Xe()]})]}),(0,G.jsx)(Wn,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(u,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(u,{dimColor:!0,children:process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Work Mate uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),l&&(0,G.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(u,{children:l})}),i&&(0,G.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(u,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}var ur,G,dr,fr=e((()=>{y(),xe(),Vt(),dt(),bn(),Dn(),An(),nt(),Tt(),et(),Ye(),ur=t(p(),1),St(),Un(),j(),r(),Yn(),cr(),ye(),We(),Mt(),ht(),G=x(),dr=50}));function pr({message:e,isTranscriptMode:t}){let n=e.message?.content,r=Array.isArray(n)?n:[];if(!(t&&e.type===`assistant`&&e.message?.model&&r.some(e=>e?.type===`text`)))return null;let i=e.message.model;return(0,mr.jsx)(c,{minWidth:s(i)+8,children:(0,mr.jsx)(u,{dimColor:!0,children:i})})}var mr,hr=e((()=>{y(),mr=x()}));function gr({message:e,isTranscriptMode:t}){if(!(t&&e.timestamp&&e.type===`assistant`&&Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`text`)))return null;let n=new Date(e.timestamp).toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!0});return(0,_r.jsx)(c,{minWidth:s(n),children:(0,_r.jsx)(u,{dimColor:!0,children:n})})}var _r,vr=e((()=>{y(),_r=x()}));function yr(e,t,n,r){for(let i=t+1;i<e.length;i++){let t=e[i];if(t?.type===`assistant`){let e=Er(t.message.content);if(e?.type===`thinking`||e?.type===`redacted_thinking`||e?.type===`tool_use`&&(k(e.name,e.input,n).isCollapsible||r.has(e.id)))continue;return!0}if(!(t?.type===`system`||t?.type===`attachment`)&&!(t?.type===`user`&&Er(t.message.content)?.type===`tool_result`)){if(t?.type===`grouped_tool_use`){let e=Er(t.messages[0]?.message.content)?.input;if(k(t.toolName,e,n).isCollapsible)continue}return!0}}return!1}function br({message:e,isUserContinuation:t,hasContentAfter:n,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,streamingToolUseIDs:s,screen:l,canAnimate:u,lastThinkingBlockId:d,latestBashOutputUUID:f,columns:p,isLoading:m,lookups:h,shouldCollapseDiffs:g}){let _=l===`transcript`,v=e.type===`grouped_tool_use`,y=e.type===`collapsed_read_search`,b=y&&(I(e,o)||m&&!n),x=v?e.displayMessage:y?re(e):e,S=v||y?[]:fe(e,h),C=Li(e,s,o,v||y?E:je(e,h),l,h),w=!1;if(u)if(v)w=e.messages.some(e=>{let t=Er(e.message.content);return t?.type===`tool_use`&&o.has(t.id)});else if(y)w=I(e,o);else{let t=Ae(e);w=!t||o.has(t)}let T=_&&x.type===`assistant`&&Array.isArray(x.message.content)&&x.message.content.some(e=>e.type===`text`)&&(x.timestamp||x.message.model),ee=(0,Tr.jsx)(V,{message:e,lookups:h,addMargin:!T,containerWidth:T?void 0:p,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,progressMessagesForMessage:S,shouldAnimate:w,shouldShowDot:!0,isTranscriptMode:_,isStatic:C,isActiveCollapsedGroup:b,isUserContinuation:t,lastThinkingBlockId:d,latestBashOutputUUID:f,shouldCollapseDiffs:g});return T?(0,Tr.jsx)(A,{children:(0,Tr.jsxs)(c,{width:p,flexDirection:`column`,children:[(0,Tr.jsxs)(c,{flexDirection:`row`,justifyContent:`flex-end`,gap:1,marginTop:1,children:[(0,Tr.jsx)(gr,{message:x,isTranscriptMode:_}),(0,Tr.jsx)(pr,{message:x,isTranscriptMode:_})]}),ee]})}):(0,Tr.jsx)(A,{children:ee})}function xr(e,t){if(e.type===`grouped_tool_use`)return e.messages.some(e=>{let n=Er(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return O(e).some(e=>t.has(e));let n=Ae(e);return!!n&&t.has(n)}function Sr(e,t){if(e.type===`grouped_tool_use`)return e.messages.every(e=>{let n=Er(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return O(e).every(e=>t.has(e));if(e.type===`assistant`){let n=Er(e.message.content);if(n?.type===`server_tool_use`)return t.has(n.id)}let n=Ae(e);return!n||t.has(n)}function Cr(e,t){if(e.message!==t.message||e.screen!==t.screen||e.verbose!==t.verbose||e.message.type===`collapsed_read_search`&&t.screen!==`transcript`||e.columns!==t.columns||e.latestBashOutputUUID===e.message.uuid!=(t.latestBashOutputUUID===t.message.uuid)||e.lastThinkingBlockId!==t.lastThinkingBlockId&&de(t.message))return!1;let n=xr(e.message,e.streamingToolUseIDs),r=Sr(e.message,e.lookups.resolvedToolUseIDs);return!(n||!r)}var wr,Tr,Er,Dr,Or=e((()=>{wr=t(p(),1),y(),Se(),M(),me(),Tr=x(),hr(),Gi(),vr(),j(),Er=e=>{if(!Array.isArray(e))return;let t=e[0];if(!(t==null||typeof t==`string`))return t},Dr=wr.memo(br,Cr)}));function kr(e){return e.type===`attachment`&&Ar.has(e.attachment.type)}var Ar,jr=e((()=>{Ar=new Set(`hook_success.hook_additional_context.hook_cancelled.command_permissions.agent_mention.budget_usd.critical_system_reminder.edited_image_file.edited_text_file.opened_file_in_ide.output_style.plan_mode.plan_mode_exit.plan_mode_reentry.structured_output.todo_reminder.context_efficiency.deferred_tools_delta.mcp_instructions_delta.token_usage.max_turns_reached.task_reminder.auto_mode.auto_mode_exit.output_token_usage.verify_plan_reminder.current_session_memory.compaction_reminder.date_change`.split(`.`))}));function Mr(e){return Fr.filter(t=>t.isActive(e))}var K,Nr,Pr,Fr,Ir=e((()=>{y(),w(),i(),Ge(),dt(),It(),K=x(),Nr={id:`large-memory-files`,type:`warning`,isActive:e=>D(e.memoryFiles).length>0,render:e=>(0,K.jsx)(K.Fragment,{children:D(e.memoryFiles).map(e=>{let t=e.path.startsWith(Ke())?Jt(Ke(),e.path):e.path;return(0,K.jsxs)(c,{flexDirection:`row`,children:[(0,K.jsx)(u,{color:`warning`,children:a.warning}),(0,K.jsxs)(u,{color:`warning`,children:[`Large `,(0,K.jsx)(u,{bold:!0,children:t}),` will impact performance (`,ft(e.content.length),` chars > `,ft(Ie),`)`,(0,K.jsx)(u,{dimColor:!0,children:` · /memory to edit`})]})]},e.path)})})},Pr={id:`large-agent-descriptions`,type:`warning`,isActive:e=>Ft(e.agentDefinitions)>Lt,render:e=>{let t=Ft(e.agentDefinitions);return(0,K.jsxs)(c,{flexDirection:`row`,children:[(0,K.jsx)(u,{color:`warning`,children:a.warning}),(0,K.jsxs)(u,{color:`warning`,children:[`Large cumulative agent descriptions will impact performance (~`,ft(t),` tokens > `,ft(Lt),`)`,(0,K.jsx)(u,{dimColor:!0,children:` · /agents to manage`})]})]})}},Fr=[Nr,Pr]}));function Lr({agentDefinitions:e}={}){let t={config:it(),agentDefinitions:e,memoryFiles:(0,zr.use)(F())},n=Mr(t);return n.length===0?null:(0,Br.jsx)(c,{flexDirection:`column`,paddingLeft:1,children:n.map(e=>(0,Br.jsx)(Rr.Fragment,{children:e.render(t)},e.id))})}var Rr,zr,Br,Vr=e((()=>{Rr=t(p(),1),zr=t(p(),1),y(),w(),nt(),Ir(),Br=x()}));function Hr(e,t,n){let r=(0,q.useRef)(new Map),i=(0,q.useRef)(0),a=(0,q.useRef)(0),o=(0,q.useRef)({arr:new Float64Array,version:-1,n:-1}),s=(0,q.useRef)(new Map),c=(0,q.useRef)(new Map),l=(0,q.useRef)(n),u=(0,q.useRef)(!1),d=(0,q.useRef)(null),f=(0,q.useRef)(0);if(l.current!==n){let e=l.current/n;l.current=n;for(let[t,n]of r.current)r.current.set(t,Math.max(1,Math.round(n*e)));i.current++,u.current=!0,f.current=2}let p=f.current>0?d.current:null,m=(0,q.useRef)(0),h=(0,q.useRef)(null);(0,q.useSyncExternalStore)((0,q.useCallback)(t=>e.current?.subscribe(t)??Xr,[e]),()=>{let t=e.current;if(!t)return NaN;let n=t.getScrollTop()+t.getPendingDelta(),r=Math.floor(n/Kr);return t.isSticky()?~r:r});let g=e.current?.getScrollTop()??-1,_=e.current?.getPendingDelta()??0,v=e.current?.getViewportHeight()??0,y=e.current?.isSticky()??!0;(0,q.useMemo)(()=>{let e=new Set(t),n=!1;for(let t of r.current.keys())e.has(t)||(r.current.delete(t),n=!0);for(let t of c.current.keys())e.has(t)||c.current.delete(t);n&&i.current++},[t]);let b=t.length;if(o.current.version!==i.current||o.current.n!==b){let e=o.current.arr.length>=b+1?o.current.arr:new Float64Array(b+1);e[0]=0;for(let n=0;n<b;n++)e[n+1]=e[n]+(r.current.get(t[n])??Ur);o.current={arr:e,version:i.current,n:b}}let x=o.current.arr,S=x[b],C,w;if(p)[C,w]=p,C=Math.min(C,b),w=Math.min(w,b);else if(v===0||g<0)C=Math.max(0,b-Gr),w=b;else{if(y){let e=v+Wr;for(C=b;C>0&&S-x[C-1]<e;)C--;w=b}else{let e=m.current,n=v*3,i=Math.min(g,g+_),a=Math.max(g,g+_),o=a-i,c=o>n&&_<0?a-n:i,l=c+Math.min(o,n),u=Math.max(0,c-e),f=l-e,p=u-Wr;{let e=0,t=b;for(;e<t;){let n=e+t>>1;x[n+1]<=p?e=n+1:t=n}C=e}{let e=d.current;if(e&&e[0]<C)for(let n=e[0];n<Math.min(C,e[1]);n++){let e=t[n];if(s.current.has(e)&&!r.current.has(e)){C=n;break}}}let h=v+2*Wr,y=Math.min(b,C+Jr),S=0;for(w=C;w<y&&(S<h||x[w]<f+v+Wr);)S+=r.current.get(t[w])??qr,w++}let e=v+2*Wr,n=Math.max(0,w-Jr),i=0;for(let e=C;e<w;e++)i+=r.current.get(t[e])??qr;for(;C>n&&i<e;)C--,i+=r.current.get(t[C])??qr;let o=d.current,c=Math.abs(g-a.current)+Math.abs(_);if(o&&c>v*2){let[e,t]=o;C<e-Yr&&(C=e-Yr),w>t+Yr&&(w=t+Yr),C>w&&(w=Math.min(C+Yr,b))}a.current=g}f.current>0?f.current--:d.current=[C,w];let T=(0,q.useDeferredValue)(C),ee=(0,q.useDeferredValue)(w),E=C<T?T:C,D=w>ee?ee:w;if((E>D||y)&&(E=C,D=w),_>0&&(D=w),D-E>Jr){let e=(x[E]+x[D])/2;g-m.current<e?D=E+Jr:E=D-Jr}let O=m.current,k=x[E],A=E===0?0:k+O,j=D===b?1/0:Math.max(k,x[D]-v)+O;(0,q.useLayoutEffect)(()=>{y?e.current?.setClampBounds(void 0,void 0):e.current?.setClampBounds(A,j)}),(0,q.useLayoutEffect)(()=>{let e=h.current?.yogaNode;if(e&&e.getComputedWidth()>0&&(m.current=e.getComputedTop()),u.current){u.current=!1;return}let t=!1;for(let[e,n]of s.current){let i=n.yogaNode;if(!i)continue;let a=i.getComputedHeight(),o=r.current.get(e);a>0?o!==a&&(r.current.set(e,a),t=!0):i.getComputedWidth()>0&&o!==0&&(r.current.set(e,0),t=!0)}t&&i.current++});let M=(0,q.useCallback)(e=>{let t=c.current.get(e);return t||(t=t=>{if(t)s.current.set(e,t);else{let t=s.current.get(e)?.yogaNode;if(t&&!u.current){let n=t.getComputedHeight();(n>0||t.getComputedWidth()>0)&&r.current.get(e)!==n&&(r.current.set(e,n),i.current++)}s.current.delete(e)}},c.current.set(e,t)),t},[]),N=(0,q.useCallback)(e=>{let n=s.current.get(t[e])?.yogaNode;return!n||n.getComputedWidth()===0?-1:n.getComputedTop()},[t]),P=(0,q.useCallback)(e=>s.current.get(t[e])??null,[t]),F=(0,q.useCallback)(e=>r.current.get(t[e]),[t]),I=(0,q.useCallback)(t=>{let n=o.current;t<0||t>=n.n||e.current?.scrollTo(n.arr[t]+m.current)},[e]),L=S-x[D];return{range:[E,D],topSpacer:k,bottomSpacer:L,measureRef:M,spacerRef:h,offsets:x,getItemTop:N,getItemElement:P,getItemHeight:F,scrollToIndex:I}}var q,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr=e((()=>{q=t(p(),1),Ur=3,Wr=40,Gr=30,Kr=20,qr=1,Jr=200,Yr=25,Xr=()=>{}}));function Qr({children:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null);return(0,ri.jsx)(ai.Provider,{value:n,children:(0,ri.jsx)(si.Provider,{value:i,children:(0,ri.jsx)(ii.Provider,{value:t,children:(0,ri.jsx)(oi.Provider,{value:r,children:e})})})})}function $r(){return(0,J.useContext)(ii)}function ei(){return(0,J.useContext)(oi)}function ti(e){let t=(0,J.useContext)(ai);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}function ni(e){let t=(0,J.useContext)(si);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}var J,ri,ii,ai,oi,si,ci=e((()=>{J=t(p(),1),ri=x(),ii=(0,J.createContext)(null),ai=(0,J.createContext)(null),oi=(0,J.createContext)(null),si=(0,J.createContext)(null)}));function li(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(e);r.current=e;let i=(0,Y.useRef)(null),a=(0,Y.useCallback)(()=>{n(null)},[]),o=(0,Y.useCallback)(e=>{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());e.getScrollTop()+e.getPendingDelta()>=t||i.current===null&&(i.current=e.getScrollHeight(),n(r.current))},[]),s=(0,Y.useCallback)(e=>{e&&e.scrollToBottom()},[]);return(0,Y.useEffect)(()=>{t===null?i.current=null:e<t&&(i.current=null,n(null))},[e,t]),{dividerIndex:t,dividerYRef:i,onScrollAway:o,onRepin:a,jumpToNew:s,shiftDivider:(0,Y.useCallback)((e,t)=>{n(t=>t===null?null:t+e),i.current!==null&&(i.current+=t)},[])}}function ui(e,t){let n=0,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t.type===`progress`||t.type===`assistant`&&!di(t))continue;let a=t.type===`assistant`;a&&!r&&n++,r=a}return n}function di(e){if(e.type!==`assistant`||!Array.isArray(e.message.content))return!1;for(let t of e.message.content)if(typeof t!=`string`&&t.type===`text`&&t.text.trim()!==``)return!0;return!1}function fi(e,t){if(t===null)return;let n=t;for(;n<e.length&&(e[n]?.type===`progress`||kr(e[n]));)n++;let r=e[n]?.uuid;if(!r)return;let i=ui(e,t);return{firstUnseenUuid:r,count:Math.max(1,i)}}function pi({scrollable:e,bottom:t,overlay:n,bottomFloat:r,modal:i,modalScrollRef:a,scrollRef:o,dividerYRef:s,hidePill:l=!1,hideSticky:d=!1,newMessageCount:p=0,onPillClick:m}){let{rows:h,columns:g}=v(),[_,y]=(0,Y.useState)(null),x=(0,Y.useMemo)(()=>({setStickyPrompt:y}),[]),S=(0,Y.useSyncExternalStore)((0,Y.useCallback)(e=>o?.current?.subscribe(e)??(()=>{}),[o]),()=>{let e=o?.current,t=s?.current;return!e||t==null?!1:e.getScrollTop()+e.getPendingDelta()+e.getViewportHeight()<t});if((0,Y.useLayoutEffect)(()=>{if(!N())return;let e=f.get(process.stdout);if(e)return e.onHyperlinkClick=e=>{if(e.startsWith(`file:`))try{Be(Yt(e))}catch{}else ce(e)},()=>{e.onHyperlinkClick=void 0}},[]),N()){let s=d?null:_,f=s!=null&&s!==`clicked`&&n==null?s:null,v=s!=null&&n==null;return(0,X.jsxs)(Qr,{children:[(0,X.jsx)(c,{flexDirection:`row`,flexGrow:1,overflow:`hidden`,width:`100%`,children:(0,X.jsxs)(c,{flexDirection:`column`,flexGrow:1,width:g,overflow:`hidden`,children:[(0,X.jsxs)(c,{flexGrow:1,flexDirection:`column`,overflow:`hidden`,children:[f&&(0,X.jsx)(hi,{text:f.text,onClick:f.scrollTo}),(0,X.jsxs)(b,{ref:o,flexGrow:1,flexDirection:`column`,paddingTop:+!v,stickyScroll:!0,children:[(0,X.jsx)(yi,{value:x,children:e}),n]}),!l&&S&&n==null&&(0,X.jsx)(mi,{count:p,onClick:m}),r!=null&&(0,X.jsx)(c,{position:`absolute`,bottom:0,right:0,opaque:!0,children:r})]}),(0,X.jsxs)(c,{flexDirection:`column`,flexShrink:0,width:`100%`,maxHeight:`50%`,children:[(0,X.jsx)(gi,{}),(0,X.jsx)(_i,{}),(0,X.jsx)(c,{flexDirection:`column`,width:`100%`,flexGrow:1,overflowY:`hidden`,children:t})]})]})}),i!=null&&(0,X.jsx)(Pt,{value:{rows:h-vi-1,columns:g-4,scrollRef:a??null},children:(0,X.jsxs)(c,{position:`absolute`,bottom:0,left:0,right:0,maxHeight:h-vi,flexDirection:`column`,overflow:`hidden`,opaque:!0,children:[(0,X.jsx)(c,{flexShrink:0,children:(0,X.jsx)(u,{color:`permission`,children:`▔`.repeat(g)})}),(0,X.jsx)(c,{flexDirection:`column`,paddingX:2,flexShrink:0,overflow:`hidden`,children:i})]})})]})}return(0,X.jsxs)(X.Fragment,{children:[e,t,n,i]})}function mi({count:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(c,{position:`absolute`,bottom:0,left:0,right:0,justifyContent:`center`,children:(0,X.jsx)(c,{onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(u,{backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,dimColor:!0,children:[` `,e>0?`${e} new ${lt(e,`message`)}`:`Jump to bottom`,` `,a.arrowDown,` `]})})})}function hi({text:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(c,{flexShrink:0,width:`100%`,height:1,paddingRight:1,backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(u,{color:`subtle`,wrap:`truncate-end`,children:[a.pointer,` `,e]})})}function gi(){let e=$r();return!e||e.suggestions.length===0?null:(0,X.jsx)(c,{position:`absolute`,bottom:`100%`,left:0,right:0,paddingX:2,paddingTop:1,flexDirection:`column`,opaque:!0,children:(0,X.jsx)(kt,{suggestions:e.suggestions,selectedSuggestion:e.selectedSuggestion,maxColumnWidth:e.maxColumnWidth,overlay:!0})})}function _i(){let e=ei();return e?(0,X.jsx)(c,{position:`absolute`,bottom:`100%`,left:0,right:0,opaque:!0,children:e}):null}var Y,X,vi,yi,bi=e((()=>{i(),Y=t(p(),1),Nt(),ci(),xe(),y(),Ue(),z(),ut(),jr(),At(),X=x(),vi=2,yi=(0,Y.createContext)({setStickyPrompt:()=>{}})}));function xi(e){let t=ki.get(e);if(t!==void 0)return t;let n=un(e);return ki.set(e,n),n}function Si(e){let t=ji.get(e);if(t!==void 0)return t;let n=Ci(e);return ji.set(e,n),n}function Ci(e){let t=null;if(e.type===`user`){if(e.isMeta||e.isVisibleInTranscriptOnly)return null;let n=e.message.content[0];if(n?.type!==`text`)return null;t=n.text??null}else if(e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text??``]:[]).join(`
|
|
10
|
+
`)}if(t===null)return null;let n=se(t);return n.startsWith(`<`)||n===``?null:n}function wi({itemKey:e,msg:t,idx:n,measureRef:r,expanded:i,hovered:a,clickable:o,onClickK:s,onEnterK:u,onLeaveK:d,renderItem:f}){return(0,Di.jsx)(c,{ref:r(e),flexDirection:`column`,backgroundColor:i?`userMessageBackgroundHover`:void 0,paddingBottom:i?1:void 0,onClick:o?e=>s(t,e.cellIsBlank):void 0,onMouseEnter:o?()=>u(e):void 0,onMouseLeave:o?()=>d(e):void 0,children:(0,Di.jsx)(l.Provider,{value:a&&!i?`text`:void 0,children:f(t,n)})})}function Ti({messages:e,scrollRef:t,columns:n,itemKey:r,renderItem:i,onItemClick:a,isItemClickable:o,isItemExpanded:s,extractSearchText:l=xi,trackStickyPrompt:u,selectedIndex:d,cursorNavRef:f,setCursor:p,jumpRef:m,onSearchMatchesChange:h,scanElement:g,setPositions:_}){let v=(0,Z.useRef)([]),y=(0,Z.useRef)(e),b=(0,Z.useRef)(r);if(b.current!==r||e.length<v.current.length||e[0]!==y.current[0])v.current=e.map(e=>r(e));else for(let t=v.current.length;t<e.length;t++)v.current.push(r(e[t]));y.current=e,b.current=r;let x=v.current,{range:S,topSpacer:C,bottomSpacer:w,measureRef:T,spacerRef:ee,offsets:E,getItemTop:D,getItemElement:O,getItemHeight:k,scrollToIndex:A}=Hr(t,x,n),[j,M]=S,N=(0,Z.useCallback)(t=>k(t)!==0&&He(e[t]),[k,e]);(0,Z.useImperativeHandle)(f,()=>{let n=e=>p?.({uuid:e.uuid,msgType:e.type,expanded:!1,toolName:ze(e)?.name}),r=d??-1,i=(t,r,i=N)=>{for(let a=t;a>=0&&a<e.length;a+=r)if(i(a))return n(e[a]),!0;return!1},a=t=>N(t)&&e[t].type===`user`;return{enterCursor:()=>i(e.length-1,-1,a),navigatePrev:()=>i(r-1,-1),navigateNext:()=>{i(r+1,1)||(t.current?.scrollToBottom(),p?.(null))},navigatePrevUser:()=>i(r-1,-1,a),navigateNextUser:()=>i(r+1,1,a),navigateTop:()=>i(0,1),navigateBottom:()=>i(e.length-1,-1),getSelected:()=>r>=0?e[r]??null:null}},[e,d,p,N]);let P=(0,Z.useRef)({offsets:E,start:j,getItemElement:O,getItemTop:D,messages:e,scrollToIndex:A});P.current={offsets:E,start:j,getItemElement:O,getItemTop:D,messages:e,scrollToIndex:A},(0,Z.useEffect)(()=>{if(d===void 0)return;let e=P.current,n=e.getItemElement(d);n?t.current?.scrollToElement(n,1):e.scrollToIndex(d)},[d,t]);let F=(0,Z.useRef)(null),I=(0,Z.useRef)({msgIdx:-1,positions:[]}),L=(0,Z.useRef)(-1),te=(0,Z.useRef)(0),ne=(0,Z.useRef)(0),re=(0,Z.useRef)(()=>{}),ie=(0,Z.useRef)(()=>{}),ae=(0,Z.useRef)({matches:[],ptr:0,screenOrd:0,prefixSum:[]}),oe=(0,Z.useRef)(-1),se=(0,Z.useRef)(!1);function ce(e){let t=P.current.getItemTop(e);return Math.max(0,t-Oi)}function le(e){let n=t.current,{msgIdx:r,positions:i}=I.current;if(!n||i.length===0||r<0){_?.(null);return}let a=Math.max(0,Math.min(e,i.length-1)),o=i[a],s=P.current.getItemTop(r),c=n.getViewportTop(),l=s-n.getScrollTop(),u=n.getViewportHeight(),d=c+l+o.row;(d<c||d>=c+u)&&(n.scrollTo(Math.max(0,s+o.row-Oi)),l=s-n.getScrollTop(),d=c+l+o.row),_?.({positions:i,rowOffset:c+l,currentIdx:a});let f=ae.current,p=f.prefixSum.at(-1)??0,m=(f.prefixSum[f.ptr]??0)+a+1;h?.(p,m),Je(`highlight(i=${r}, ord=${a}/${i.length}): pos={row:${o.row},col:${o.col}} lo=${l} screenRow=${d} badge=${m}/${p}`)}ie.current=le;let[ue,R]=(0,Z.useState)(0),de=(0,Z.useCallback)(()=>R(e=>e+1),[]);(0,Z.useEffect)(()=>{let e=F.current;if(!e)return;let{idx:n,wantLast:r,tries:i}=e,a=t.current;if(!a)return;let{getItemElement:o,getItemTop:s,scrollToIndex:c}=P.current,l=o(n),u=l?.yogaNode?.getComputedHeight()??0;if(!l||u===0){if(i>1){F.current=null,Je(`seek(i=${n}): no mount after scrollToIndex, skip`),re.current(r?-1:1);return}F.current={idx:n,wantLast:r,tries:i+1},c(n),de();return}F.current=null,a.scrollTo(Math.max(0,s(n)-Oi));let d=g?.(l)??[];if(I.current={msgIdx:n,positions:d},Je(`seek(i=${n} t=${i}): ${d.length} positions`),d.length===0){if(++te.current>20){te.current=0;return}re.current(r?-1:1);return}te.current=0;let f=r?d.length-1:0;ae.current.screenOrd=f,L.current=-1,ie.current(f);let p=ne.current;p&&(ne.current=0,re.current(p))},[ue]);function fe(e,n){let r=t.current;if(!r)return;let i=P.current,{getItemElement:a,scrollToIndex:o}=i;if(e<0||e>=i.messages.length)return;_?.(null),I.current={msgIdx:-1,positions:[]},F.current={idx:e,wantLast:n,tries:0};let s=a(e),c=s?.yogaNode?.getComputedHeight()??0;s&&c>0?r.scrollTo(ce(e)):o(e),de()}function pe(e){let t=ae.current,{matches:n,prefixSum:r}=t,i=r.at(-1)??0;if(n.length===0)return;if(F.current){ne.current=e;return}L.current<0&&(L.current=t.ptr);let{positions:a}=I.current,o=t.screenOrd+e;if(o>=0&&o<a.length){t.screenOrd=o,le(o),L.current=-1;return}let s=(t.ptr+e+n.length)%n.length;if(s===L.current){_?.(null),L.current=-1,Je(`step: wraparound at ptr=${s}, all ${n.length} msgs phantoms`);return}t.ptr=s,t.screenOrd=0,fe(n[s],e<0);let c=e<0?r[s+1]??i:r[s]+1;h?.(i,c)}re.current=pe,(0,Z.useImperativeHandle)(m,()=>({jumpToIndex:e=>{let n=t.current;n&&n.scrollTo(ce(e))},setSearchQuery:e=>{F.current=null,I.current={msgIdx:-1,positions:[]},L.current=-1,_?.(null);let n=e.toLowerCase(),r=[],i=[0];if(n){let e=P.current.messages;for(let t=0;t<e.length;t++){let a=l(e[t]),o=a.indexOf(n),s=0;for(;o>=0;)s++,o=a.indexOf(n,o+n.length);s>0&&(r.push(t),i.push(i.at(-1)+s))}}let a=i.at(-1),o=0,s=t.current,{offsets:c,start:u,getItemTop:d}=P.current,f=d(u),p=f>=0?f-c[u]:0;if(r.length>0&&s){let t=oe.current>=0?oe.current:s.getScrollTop(),n=1/0;for(let e=0;e<r.length;e++){let i=Math.abs(p+c[r[e]]-t);i<=n&&(n=i,o=e)}Je(`setSearchQuery('${e}'): ${r.length} msgs · ptr=${o} msgIdx=${r[o]} curTop=${t} origin=${p}`)}ae.current={matches:r,ptr:o,screenOrd:0,prefixSum:i},r.length>0?fe(r[o],!0):oe.current>=0&&s&&s.scrollTo(oe.current),h?.(a,r.length>0?i[o+1]??a:0)},nextMatch:()=>pe(1),prevMatch:()=>pe(-1),setAnchor:()=>{let e=t.current;e&&(oe.current=e.getScrollTop())},disarmSearch:()=>{_?.(null),F.current=null,I.current={msgIdx:-1,positions:[]},L.current=-1},warmSearchIndex:async()=>{if(se.current)return 0;let e=P.current.messages,t=0,n=performance.now();for(let n=0;n<e.length;n+=500){await B(0);let r=performance.now(),i=Math.min(n+500,e.length);for(let t=n;t<i;t++)l(e[t]);t+=performance.now()-r}let r=Math.round(performance.now()-n);return Je(`warmSearchIndex: ${e.length} msgs · work=${Math.round(t)}ms wall=${r}ms chunks=${Math.ceil(e.length/500)}`),se.current=!0,Math.round(t)}}),[t]);let[me,he]=(0,Z.useState)(null),ge=(0,Z.useRef)({onItemClick:a,setHoveredKey:he});ge.current={onItemClick:a,setHoveredKey:he};let _e=(0,Z.useCallback)((e,t)=>{let n=ge.current;!t&&n.onItemClick&&n.onItemClick(e)},[]),ve=(0,Z.useCallback)(e=>{ge.current.setHoveredKey(e)},[]),z=(0,Z.useCallback)(e=>{ge.current.setHoveredKey(t=>t===e?null:t)},[]);return(0,Di.jsxs)(Di.Fragment,{children:[(0,Di.jsx)(c,{ref:ee,height:C,flexShrink:0}),e.slice(j,M).map((e,t)=>{let n=j+t,r=x[n],c=!!a&&(o?.(e)??!0),l=c&&me===r,u=s?.(e);return(0,Di.jsx)(wi,{itemKey:r,msg:e,idx:n,measureRef:T,expanded:u,hovered:l,clickable:c,onClickK:_e,onEnterK:ve,onLeaveK:z,renderItem:i},r)}),w>0&&(0,Di.jsx)(c,{height:w,flexShrink:0}),u&&(0,Di.jsx)(Ei,{messages:e,start:j,end:M,offsets:E,getItemTop:D,getItemElement:O,scrollRef:t})]})}function Ei({messages:e,start:t,end:n,offsets:r,getItemTop:i,getItemElement:a,scrollRef:o}){let{setStickyPrompt:s}=(0,Z.useContext)(yi);(0,Z.useSyncExternalStore)((0,Z.useCallback)(e=>o.current?.subscribe(e)??Mi,[o]),()=>{let e=o.current;if(!e)return NaN;let t=e.getScrollTop()+e.getPendingDelta();return e.isSticky()?-1-t:t});let c=o.current?.isSticky()??!0,l=Math.max(0,(o.current?.getScrollTop()??0)+(o.current?.getPendingDelta()??0)),u=t,d=-1;for(let e=n-1;e>=t;e--){let t=i(e);if(t>=0){if(t<l)break;d=t}u=e}let f=-1,p=null;if(u>0&&!c)for(let t=u-1;t>=0;t--){let n=Si(e[t]);if(n===null)continue;let r=i(t);if(!(r>=0&&r+1>=l)){f=t,p=n;break}}let m=d>=0?d-r[u]:0,h=f>=0?Math.max(0,m+r[f]):-1,g=(0,Z.useRef)({idx:-1,tries:0}),_=(0,Z.useRef)(`none`),v=(0,Z.useRef)(-1);return(0,Z.useEffect)(()=>{if(g.current.idx>=0)return;if(_.current===`armed`){_.current=`force`;return}let e=_.current===`force`;if(_.current=`none`,!e&&v.current===f)return;if(v.current=f,p===null){s(null);return}let t=p.trimStart(),n=t.search(/\n\s*\n/),r=(n>=0?t.slice(0,n):t).slice(0,Ai).replace(/\s+/g,` `).trim();if(r===``){s(null);return}let i=f,c=h;s({text:r,scrollTo:()=>{s(`clicked`),_.current=`armed`;let e=a(i);e?o.current?.scrollToElement(e,1):(o.current?.scrollTo(c),g.current={idx:i,tries:0})}})}),(0,Z.useEffect)(()=>{if(g.current.idx<0)return;let e=a(g.current.idx);e?(o.current?.scrollToElement(e,1),g.current={idx:-1,tries:0}):++g.current.tries>5&&(g.current={idx:-1,tries:0})}),null}var Z,Di,Oi,ki,Ai,ji,Mi,Ni=e((()=>{Z=t(p(),1),Zr(),y(),Pe(),bi(),Di=x(),Ye(),le(),_n(),Ne(),Oi=3,ki=new WeakMap,Ai=500,ji=new WeakMap,Mi=()=>{}}));function Pi(e,t,n=Vi,r=Hi){let i=t.current,a=i?e.findIndex(e=>e.uuid===i.uuid):-1,o=a>=0?a:i?Math.min(i.idx,Math.max(0,e.length-n)):0;e.length-o>n+r&&(o=e.length-n);let s=e[o];return s&&(i?.uuid!==s.uuid||i.idx!==o)?t.current={uuid:s.uuid,idx:o}:!s&&i&&(t.current=null),o}function Fi(e){return(e.type===`assistant`||e.type===`user`?Ae(e):null)??e.uuid}function Ii(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Li(e,t,n,r,i,a){if(i===`transcript`)return!0;switch(e.type){case`attachment`:case`user`:case`assistant`:{if(e.type===`assistant`){let t=e.message.content[0];if(t?.type===`server_tool_use`)return a.resolvedToolUseIDs.has(t.id)}let i=Ae(e);return i?t.has(i)||n.has(i)||ke(i,`PostToolUse`,a)?!1:Xt(r,a.resolvedToolUseIDs):!0}case`system`:return e.subtype!==`api_error`;case`grouped_tool_use`:return e.messages.every(e=>{let t=e.message.content[0];return t?.type===`tool_use`&&a.resolvedToolUseIDs.has(t.id)});case`collapsed_read_search`:return!1;default:return!0}}var Ri,Q,$,zi,Bi,Vi,Hi,Ui,Wi,Gi=e((()=>{h(),Ri=t(p(),1),Q=t(p(),1),Zt(),Qe(),xe(),y(),Le(),yt(),Ve(),en(),rn(),Se(),nt(),r(),z(),ln(),M(),ut(),_n(),fr(),R(),Or(),Ne(),pe(),jr(),j(),Vr(),$=x(),he(),Ni(),zi=Ri.memo(function({agentDefinitions:e}){return(0,$.jsx)(A,{children:(0,$.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,$.jsx)(lr,{}),(0,$.jsx)(Ri.Suspense,{fallback:null,children:(0,$.jsx)(Lr,{agentDefinitions:e})})]})})}),Bi=30,Vi=200,Hi=50,Ui=({messages:e,tools:t,commands:r,verbose:i,toolJSX:a,toolUseConfirmQueue:s,inProgressToolUseIDs:l,isMessageSelectorVisible:f,conversationId:p,screen:h,streamingToolUses:g,showAllInTranscript:_=!1,agentDefinitions:y,hideLogo:b=!1,isLoading:x,hidePastThinking:w=!1,streamingThinking:T,streamingText:ee,unseenDivider:E,scrollRef:D,trackStickyPrompt:O,jumpRef:k,onSearchMatchesChange:A,scanElement:j,setPositions:M,disableRenderCap:P=!1,cursor:F=null,setCursor:I,cursorNavRef:re,renderRange:se})=>{let{columns:ce}=v(),le=ne(`transcript:toggleShowAll`,`Transcript`,`Ctrl+E`),R=(0,Q.useMemo)(()=>Ce(e).filter(te),[e]),de=(0,Q.useMemo)(()=>T?T.isStreaming?!0:T.streamingEndedAt?Date.now()-T.streamingEndedAt<3e4:!1:!1,[T]),{lastThinkingBlockId:fe,latestBashOutputUUID:pe}=(0,Q.useMemo)(()=>{let e=null,t=null,n=w&&!de;w&&de&&(e=`streaming`);for(let r=R.length-1;r>=0;r--){let i=R[r];if(i?.type===`user`){let r=i.message.content;if(!t){for(let e of r)if(e.type===`text`){let n=e.text??``;if(n.startsWith(`<bash-stdout`)||n.startsWith(`<bash-stderr`)){t=i.uuid;break}}}n&&!e&&(r.some(e=>e.type===`tool_result`)||(e=`no-thinking`))}else if(i?.type===`assistant`&&n&&!e){let t=i.message.content;for(let n=t.length-1;n>=0;n--)if(t[n]?.type===`thinking`){e=`${i.uuid}:${n}`;break}}if(e!==null&&t)break}return w||(e=null),{lastThinkingBlockId:e,latestBashOutputUUID:t}},[R,w,de]),me=(0,Q.useMemo)(()=>Te(R),[R]),he=(0,Q.useMemo)(()=>g.filter(e=>!l.has(e.contentBlock.id)&&!me.has(e.contentBlock.id)),[g,l,me]),ve=(0,Q.useMemo)(()=>he.flatMap(e=>{let t=De({content:[e.contentBlock]});return t.uuid=Oe(e.contentBlock.id,0),Ce([t])}),[he]),z=h===`transcript`,ye=(0,Q.useMemo)(()=>n(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]),be=D!=null&&!ye,xe=z&&!_&&!be,Se=(0,Q.useRef)(null),B=(0,Q.useRef)(null),{collapsed:we,lookups:ke,hasTruncatedMessages:Ae,hiddenMessageCount:je}=(0,Q.useMemo)(()=>{let e=ue((i||N()?R:Ee(R,{includeSnipped:!0})).filter(e=>e.type!==`progress`&&!kr(e)&&ge(e,z)),ve),n=xe?e.slice(-30):e,r=xe&&e.length>Bi,{messages:a}=sn(n,t,i),o=$t(nn(Re(a,t)),i),s=S(R,n),c=(()=>{let e=n.at(-1);return e?.type===`assistant`?e.message?.id:void 0})(),l;if(B.current&&B.current.key===s)l=B.current.lookups;else if(B.current&&R.length>=B.current.normalizedCount&&n.length>=B.current.messageCount&&B.current.lastAssistantMsgId===c){let e=ae(B.current.lookups,B.current.normalizedCount,B.current.messageCount,R,n);e?(l=e,B.current={key:s,lookups:l,normalizedCount:R.length,messageCount:n.length,lastAssistantMsgId:c}):(l=L(R,n),B.current={key:s,lookups:l,normalizedCount:R.length,messageCount:n.length,lastAssistantMsgId:c})}else l=L(R,n),B.current={key:s,lookups:l,normalizedCount:R.length,messageCount:n.length,lastAssistantMsgId:c};let u=e.length-Bi;return{collapsed:o,lookups:l,hasTruncatedMessages:r,hiddenMessageCount:u}},[i,R,z,ve,xe,t]),V=(0,Q.useMemo)(()=>{let e=!be&&!P?Pi(we,Se):0;return se?we.slice(se[0],se[1]):e>0?we.slice(e):we},[we,se,be,P]),Ne=(0,Q.useMemo)(()=>new Set(g.map(e=>e.contentBlock.id)),[g]),{dividerBeforeIndex:Pe,selectedIdx:Ie}=(0,Q.useMemo)(()=>{if(!E&&!F)return{dividerBeforeIndex:-1,selectedIdx:-1};let e=-1,t=-1,n=E?.firstUnseenUuid.slice(0,24);for(let r=0;r<V.length;r++){let i=V[r];if(e===-1&&n&&i.uuid.slice(0,24)===n&&(e=r),t===-1&&F&&i.uuid===F.uuid&&(t=r),e!==-1&&t!==-1)break}return{dividerBeforeIndex:e,selectedIdx:t}},[E,F,V]),[Le,ze]=(0,Q.useState)(()=>new Set),Be=(0,Q.useCallback)(e=>{let t=Fi(e);ze(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),Ve=(0,Q.useCallback)(e=>Le.size>0&&Le.has(Fi(e)),[Le]),He=(0,Q.useRef)(ke);He.current=ke;let Ue=(0,Q.useCallback)(e=>{if(e.type===`collapsed_read_search`)return!0;if(e.type===`assistant`){let t=e.message.content,n=Array.isArray(t)?t[0]:void 0;return n!=null&&oe(n)&&n.type===`advisor_tool_result`&&n.content.type===`advisor_result`}if(e.type!==`user`)return!1;let n=e.message.content[0];if(n?.type!==`tool_result`||n.is_error||!e.toolUseResult)return!1;let r=He.current.toolUseByToolUseID.get(n.tool_use_id??``)?.name;return(r?vt(t,r):void 0)?.isResultTruncated?.(e.toolUseResult)??!1},[t]),We=(!a||!!a.shouldContinueAnimation)&&!s.length&&!f,Ge=l.size>0,{progress:Ke}=d(),qe=(0,Q.useRef)(null),Je=it().terminalProgressBarEnabled&&!Fe();(0,Q.useEffect)(()=>{let e=Je?Ge?`indeterminate`:`completed`:null;qe.current!==e&&(qe.current=e,Ke(e))},[Ke,Je,Ge]),(0,Q.useEffect)(()=>()=>Ke(null),[Ke]);let Ye=(0,Q.useCallback)(e=>`${e.uuid}-${p}`,[p]),Xe=(e,n)=>{let a=n>0?V[n-1]?.type:void 0,s=e.type===`user`&&a===`user`,u=e.type===`collapsed_read_search`&&(!!ee||yr(V,n,t,Ne)),d=V.length-1-n>0,f=Ye(e),p=(0,$.jsx)(Dr,{message:e,isUserContinuation:s,hasContentAfter:u,tools:t,commands:r,verbose:i||Ve(e)||F?.expanded===!0&&n===Ie,inProgressToolUseIDs:l,streamingToolUseIDs:Ne,screen:h,canAnimate:We,lastThinkingBlockId:fe,latestBashOutputUUID:pe,columns:ce,isLoading:x,lookups:ke,shouldCollapseDiffs:d},f),m=(0,$.jsx)(ie.Provider,{value:n===Ie,children:p},f);return E&&n===Pe?[(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(o,{title:`${E.count} new ${lt(E.count,`message`)}`,width:ce,color:`inactive`})},`unseen-divider`),m]:m},Ze=(0,Q.useRef)(new WeakMap),Qe=(0,Q.useCallback)(e=>{let n=Ze.current.get(e);if(n!==void 0)return n;let r=un(e);if(e.type===`user`&&e.toolUseResult&&Array.isArray(e.message.content)){let n=e.message.content.find(e=>e.type===`tool_result`);if(n&&`tool_use_id`in n){let i=ke.toolUseByToolUseID.get(n.tool_use_id),a=(i&&vt(t,i.name))?.extractSearchText?.(e.toolUseResult);a!==void 0&&(r=a)}}let i=r.toLowerCase();return Ze.current.set(e,i),i},[t,ke]);return(0,$.jsxs)($.Fragment,{children:[!b&&!(se&&se[0]>0)&&(0,$.jsx)(zi,{agentDefinitions:y}),Ae&&(0,$.jsx)(o,{title:`${le} to show ${m.bold(je)} previous messages`,width:ce}),z&&_&&je>0&&!P&&(0,$.jsx)(o,{title:`${le} to hide ${m.bold(je)} previous messages`,width:ce}),be?(0,$.jsx)(_e.Provider,{value:!0,children:(0,$.jsx)(Ti,{messages:V,scrollRef:D,columns:ce,itemKey:Ye,renderItem:Xe,onItemClick:Be,isItemClickable:Ue,isItemExpanded:Ve,trackStickyPrompt:O,selectedIndex:Ie>=0?Ie:void 0,cursorNavRef:re,setCursor:I,jumpRef:k,onSearchMatchesChange:A,scanElement:j,setPositions:M,extractSearchText:Qe})}):V.flatMap(Xe),ee&&(0,$.jsx)(c,{alignItems:`flex-start`,flexDirection:`row`,marginTop:1,width:`100%`,children:(0,$.jsxs)(c,{flexDirection:`row`,children:[(0,$.jsx)(c,{minWidth:2,children:(0,$.jsx)(u,{color:`text`,children:$e})}),(0,$.jsx)(c,{flexDirection:`column`,children:(0,$.jsx)(Me,{children:ee})})]})}),de&&T&&(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(C,{param:{type:`thinking`,thinking:T.thinking},addMargin:!1,isTranscriptMode:!0,verbose:i,hideInTranscript:!1})})]})},Wi=Ri.memo(Ui,(e,t)=>{let n=Object.keys(e);for(let r of n)if(!(r===`scrollRef`||r===`trackStickyPrompt`||r===`setCursor`||r===`cursorNavRef`||r===`jumpRef`||r===`onSearchMatchesChange`||r===`scanElement`||r===`setPositions`)&&e[r]!==t[r]){if(r===`streamingToolUses`){let n=e.streamingToolUses,r=t.streamingToolUses;if(n.length===r.length&&n.every((e,t)=>e.contentBlock===r[t]?.contentBlock))continue}if(r===`inProgressToolUseIDs`&&Ii(e.inProgressToolUseIDs,t.inProgressToolUseIDs))continue;if(r===`unseenDivider`){let n=e.unseenDivider,r=t.unseenDivider;if(n?.firstUnseenUuid===r?.firstUnseenUuid&&n?.count===r?.count)continue}if(r===`tools`){let n=e.tools,r=t.tools;if(n.length===r.length&&n.every((e,t)=>e.name===r[t]?.name))continue}return!1}return!0})}));export{bi as a,ti as c,fi as i,ni as l,Gi as n,li as o,pi as r,ci as s,Wi as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,ai as o,kt as s,t as c}from"./src-DL3w8VPk.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{Cb as u}from"./loadAgentsDir-DGozQu_6.js";import{Wt as d,qt as f}from"./settings-CodSADx8.js";import{n as p}from"./analytics-COpjZpvd.js";import{c as m,i as h,s as g}from"./terminalSetup-BgIXFBpd.js";import{n as _,t as v}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{n as y,t as b}from"./select-Fq6g2Ejk.js";import{r as x}from"./Spinner-VjwI7m_g.js";import{n as S,t as C}from"./ThemePicker-CtQYHmOr.js";import{n as w,t as T}from"./PressEnterToContinue-DZc_s_pE.js";var E=e(o(),1),D=l();p(),f(),u(),h(),v(),c(),c(),x(),y(),c();var O=58;function k(){let[e]=n(),t=`Welcome to Work Mate`;return d.terminal===`Apple_Terminal`?(0,D.jsx)(A,{theme:e,welcomeMessage:t}):[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.25`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` ░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` `})]}):(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.25`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` * █████▓▓░ `}),(0,D.jsx)(a,{children:` * ███▓░ ░░ `}),(0,D.jsx)(a,{children:` ░░░░░░ ███▓░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,D.jsxs)(a,{children:[(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{bold:!0,children:`*`}),(0,D.jsx)(a,{children:` ██▓░░ ▓ `})]}),(0,D.jsx)(a,{children:` ░▓▓███▓▓░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * `})]})}function A({theme:e,welcomeMessage:t}){return[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.25`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` ░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` `})]}):(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`claudeBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.25`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` * █████▓▓░ `}),(0,D.jsx)(a,{children:` * ███▓░ ░░ `}),(0,D.jsx)(a,{children:` ░░░░░░ ███▓░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,D.jsxs)(a,{children:[(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{bold:!0,children:`*`}),(0,D.jsx)(a,{children:` ██▓░░ ▓ `})]}),(0,D.jsx)(a,{children:` ░▓▓███▓▓░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░░░░░░░░░ `})]})}S(),w(),c();var j=(0,E.createContext)({marker:``});function M({children:e}){let{marker:t}=(0,E.useContext)(j);return(0,D.jsxs)(r,{gap:1,children:[(0,D.jsx)(a,{dimColor:!0,children:t}),(0,D.jsx)(r,{flexDirection:`column`,children:e})]})}c();var N=(0,E.createContext)({marker:``});function P({children:e}){let{marker:t}=(0,E.useContext)(N),n=0;for(let t of E.Children.toArray(e))!(0,E.isValidElement)(t)||t.type!==M||n++;let i=String(n).length;return(0,D.jsx)(r,{flexDirection:`column`,children:E.Children.map(e,(e,n)=>{if(!(0,E.isValidElement)(e)||e.type!==M)return e;let r=`${String(n+1).padStart(i)}.`,a=`${t}${r}`;return(0,D.jsx)(N.Provider,{value:{marker:a},children:(0,D.jsx)(j.Provider,{value:{marker:a},children:e})})})})}P.Item=M;var F=P;c(),f();function I({onDone:e}){let[o,c]=(0,E.useState)(0),[l,u]=n();(0,E.useEffect)(()=>{},[]);function f(){if(o<x.length-1){let e=o+1;c(e),x[e]?.id}else e()}function p(e){u(e),f()}let h=_(),v=(0,D.jsx)(r,{marginX:1,children:(0,D.jsx)(C,{onThemeSelect:p,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),y=(0,D.jsxs)(r,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,D.jsx)(a,{bold:!0,children:`Before you start, keep in mind:`}),(0,D.jsx)(r,{flexDirection:`column`,width:70,children:(0,D.jsxs)(F,{children:[(0,D.jsxs)(F.Item,{children:[(0,D.jsx)(a,{children:`Always review changes before accepting`}),(0,D.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Work Mate can make mistakes — especially when running commands`,(0,D.jsx)(s,{}),`or editing files. You stay in control of every action.`,(0,D.jsx)(s,{})]})]}),(0,D.jsxs)(F.Item,{children:[(0,D.jsx)(a,{children:`Only use Work Mate on projects you trust`}),(0,D.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Untrusted code could contain prompt injection attacks.`,(0,D.jsx)(s,{}),(0,D.jsx)(i,{url:`https://code.workmate.com/docs/en/security`})]})]})]})}),(0,D.jsx)(T,{})]}),x=[];x.push({id:`theme`,component:v}),x.push({id:`security`,component:y}),m()&&x.push({id:`terminal-setup`,component:(0,D.jsxs)(r,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,D.jsx)(a,{bold:!0,children:`Use Work Mate's terminal setup?`}),(0,D.jsxs)(r,{flexDirection:`column`,width:70,gap:1,children:[(0,D.jsxs)(a,{children:[`For the optimal coding experience, enable the recommended settings`,(0,D.jsx)(s,{}),`for your terminal:`,` `,d.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,D.jsx)(b,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?g(l).catch(()=>{}).finally(f):f()},onCancel:()=>f()}),(0,D.jsx)(a,{dimColor:!0,children:h.pending?(0,D.jsxs)(D.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,D.jsx)(D.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let S=x[o],w=(0,E.useCallback)(()=>{o===x.length-1?e():f()},[o,x.length,e]),O=(0,E.useCallback)(()=>{f()},[o,x.length,e]);return t({"confirm:yes":w},{context:`Confirmation`,isActive:S?.id===`security`}),t({"confirm:no":O},{context:`Confirmation`,isActive:S?.id===`terminal-setup`}),(0,D.jsxs)(r,{flexDirection:`column`,children:[(0,D.jsx)(k,{}),(0,D.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[S?.component,h.pending&&(0,D.jsx)(r,{padding:1,children:(0,D.jsxs)(a,{dimColor:!0,children:[`Press `,h.keyName,` again to exit`]})})]})]})}export{I as Onboarding};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gr as n,I as r,P as i,ai as a,ot as o,t as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{kb as l}from"./loadAgentsDir-DGozQu_6.js";import{S as u,_ as d,b as f}from"./startupProfiler-DF0AjiDf.js";function p(e){return e.startsWith(`file-`)?`+`:e.startsWith(`mcp-resource-`)?`◇`:e.startsWith(`agent-`)?`*`:`+`}function m(e){return e.startsWith(`file-`)||e.startsWith(`mcp-resource-`)||e.startsWith(`agent-`)}function h({suggestions:e,selectedSuggestion:t,maxColumnWidth:i,overlay:a}){let{rows:s}=o(),c=a?5:Math.min(6,Math.max(1,s-3));if(e.length===0)return null;let l=i??Math.max(...e.map(e=>n(e.displayText)))+5,u=Math.max(0,Math.min(t-Math.floor(c/2),e.length-c)),d=Math.min(u+c,e.length),f=e.slice(u,d);return(0,_.jsx)(r,{flexDirection:`column`,justifyContent:a?void 0:`flex-end`,children:f.map(n=>(0,_.jsx)(v,{item:n,maxColumnWidth:l,isSelected:n.id===e[t]?.id},n.id))})}var g,_,v,y,b=e((()=>{g=t(a(),1),l(),s(),d(),_=c(),v=(0,g.memo)(function({item:e,maxColumnWidth:t,isSelected:r}){let a=o().columns;if(m(e.id)){let t=p(e.id),o=r?`suggestion`:void 0,s=!r,c=e.id.startsWith(`file-`),l=e.id.startsWith(`mcp-resource-`),d=e.description?3:0,m;if(c){let t=e.description?Math.min(20,n(e.description)):0,r=a-2-4-d-t;m=f(e.displayText,r)}else m=l?u(e.displayText,30):e.displayText;let h=a-2-n(m)-d-4,g;if(e.description){let n=Math.max(0,h),r=u(e.description.replace(/\s+/g,` `),n);g=`${t} ${m} – ${r}`}else g=`${t} ${m}`;return(0,_.jsx)(i,{color:o,dimColor:s,wrap:`truncate`,children:g})}let s=Math.floor(a*.4),c=Math.min(t??n(e.displayText)+5,s),l=e.color||(r?`suggestion`:void 0),d=!r,h=e.displayText;n(h)>c-2&&(h=u(h,c-2));let g=h+` `.repeat(Math.max(0,c-n(h))),v=e.tag?`[${e.tag}] `:``,y=n(v),b=Math.max(0,a-c-y-4),x=e.description?u(e.description.replace(/\s+/g,` `),b):``;return(0,_.jsxs)(i,{wrap:`truncate`,children:[(0,_.jsx)(i,{color:l,dimColor:d,children:g}),v?(0,_.jsx)(i,{color:e.tag===`local`?`ansi:yellow`:void 0,dimColor:e.tag!==`local`,children:v}):null,(0,_.jsx)(i,{color:r?`suggestion`:void 0,dimColor:!r,children:x})]})}),y=(0,g.memo)(h)}));export{y as n,b as r,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,t as r}from"./src-DL3w8VPk.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Tb as a,aw as o,jw as s,kw as c,nw as l,rw as u,wb as d}from"./loadAgentsDir-DGozQu_6.js";import{Wt as f,qt as p}from"./settings-CodSADx8.js";import{d as m,o as h}from"./config-CWPHVTic.js";import{i as g,n as _}from"./platform-DsMIk3eq.js";import{a as v,i as y,r as b}from"./terminalSetup-BgIXFBpd.js";function x(){return h().editorMode===`vim`}function S(){return f.terminal===`Apple_Terminal`&&process.platform===`darwin`||v()?`shift + ⏎ for newline`:b()?`\\⏎ for newline`:`backslash (\\) + return (⏎) for newline`}function C(e,t){return t.ctrl||t.meta||t.escape||t.return||t.tab||t.backspace||t.delete||t.upArrow||t.downArrow||t.leftArrow||t.rightArrow||t.pageUp||t.pageDown||t.home||t.end?!1:e.length>0&&!/^\s/.test(e)&&!e.startsWith(`\x1B`)}var w=e((()=>{y(),m(),p()}));function T(e){return e.replace(/\+/g,` + `)}function E(e){let{dimColor:r,fixedWidth:i,gap:c,paddingX:l}=e,d=T(a(`app:toggleTranscript`,`Global`,`ctrl+o`)),f=T(a(`app:toggleTodos`,`Global`,`ctrl+t`)),p=T(a(`chat:undo`,`Chat`,`ctrl+_`)),m=T(a(`chat:stash`,`Chat`,`ctrl+s`)),h=T(a(`chat:cycleMode`,`Chat`,`shift+tab`)),g=T(a(`chat:modelPicker`,`Chat`,`alt+p`)),v=T(a(`chat:fastMode`,`Chat`,`alt+o`)),y=T(a(`chat:externalEditor`,`Chat`,`ctrl+g`));T(a(`app:toggleTerminal`,`Global`,`meta+j`));let b=T(a(`chat:imagePaste`,`Chat`,`ctrl+v`));return(0,D.jsxs)(t,{paddingX:l,flexDirection:`row`,gap:c,children:[(0,D.jsxs)(t,{flexDirection:`column`,width:i?24:void 0,children:[(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`! for bash mode`})}),(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`/ for commands`})}),(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`@ for file paths`})}),(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`& for background`})}),(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`/btw for side question`})})]}),(0,D.jsxs)(t,{flexDirection:`column`,width:i?35:void 0,children:[(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`double tap esc to clear input`})}),(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[h,` to auto-accept edits`]})}),(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[d,` for verbose output`]})}),(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[f,` to toggle tasks`]})}),(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:S()})})]}),(0,D.jsxs)(t,{flexDirection:`column`,children:[(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[p,` to undo`]})}),_()!==`windows`&&(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`ctrl + z to suspend`})}),(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[b,` to paste images`]})}),(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[g,` to switch model`]})}),o()&&u()&&(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[v,` to toggle fast mode`]})}),(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[m,` to stash prompt`]})}),(0,D.jsx)(t,{children:(0,D.jsxs)(n,{dimColor:r,children:[y,` to edit in $EDITOR`]})}),s()&&(0,D.jsx)(t,{children:(0,D.jsx)(n,{dimColor:r,children:`/keybindings to customize`})})]})]})}var D,O=e((()=>{r(),g(),c(),d(),l(),w(),D=i()}));export{x as a,C as i,O as n,w as r,E as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kt as i,t as a}from"./src-DL3w8VPk.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{i as s,n as c}from"./loader-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kt as i,t as a}from"./src-DL3w8VPk.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{i as s,n as c}from"./loader-CtoR-vO-.js";import{r as l,t as u}from"./switcher-DMfuKuw_.js";import{n as d,t as f}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{t as p}from"./select-Fq6g2Ejk.js";import{t as m}from"./CustomSelect-BvTftqEH.js";var h=e(r(),1);a(),f(),c(),l(),m();var g=o(),_=[{key:`id`,label:`Provider id (kebab-case)`,placeholder:`my-provider`},{key:`baseUrl`,label:`Base URL`,placeholder:`https://api.example.com/v1`},{key:`apiKey`,label:`API Key`,placeholder:`sk-...`},{key:`model`,label:`Default model`,placeholder:`gpt-4o-mini`}],v=[{value:`save-openai`,label:`Save as OpenAI-compat (Chat Completions API)`},{value:`save-anthropic`,label:`Save as Anthropic-compat (Messages API)`},{value:`skip`,label:`Skip — configure later with /provider add`}];function y(e){return e===`save-openai`||e===`save-anthropic`||e===`skip`}function b(e){if(!e.id)return`Provider id is required.`;if(!/^[a-z0-9-]+$/.test(e.id))return`Provider id must be kebab-case (lowercase letters, digits, hyphens).`;if(!e.baseUrl)return`Base URL is required.`;try{new URL(e.baseUrl)}catch{return`Base URL must be a valid URL.`}return e.apiKey?null:`API Key is required.`}function x({onDone:e}){let r=(0,h.useRef)({id:``,baseUrl:``,apiKey:``,model:``}),[a,o]=(0,h.useState)(null),c=d();async function l(t){if(t===`skip`){e();return}let n=t===`save-openai`?`openai-compat`:`anthropic-compat`,i=b(r.current);if(i){o(i);return}let a={id:r.current.id,kind:n,baseUrl:r.current.baseUrl,apiKey:r.current.apiKey,defaultModel:r.current.model||`gpt-4o-mini`};try{s([a]),await u(a.id)}catch(e){let t=e instanceof Error?e.message:String(e);o(`Failed to save provider: ${t}`);return}e()}function f(e){o(null),y(e)&&l(e)}let m=[..._.map(e=>({type:`input`,label:e.label,value:e.key,placeholder:e.placeholder,allowEmptySubmitToCancel:!0,onChange:t=>{r.current[e.key]=t}})),...v.map(e=>({type:`text`,label:e.label,value:e.value}))];return(0,g.jsxs)(t,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,g.jsx)(n,{bold:!0,color:`permission`,children:`Configure an API provider`}),(0,g.jsx)(t,{flexDirection:`column`,width:70,children:(0,g.jsxs)(n,{dimColor:!0,wrap:`wrap`,children:[`No provider is configured yet — `,(0,g.jsx)(n,{children:`~/.workmate/providers.json`}),` was not found.`,(0,g.jsx)(i,{}),`Fill in the fields below to point Work Mate at any OpenAI- or Anthropic-compatible`,(0,g.jsx)(i,{}),`endpoint. Type to edit a focused field, ↑/↓ to move between rows, Enter to trigger`,(0,g.jsx)(i,{}),`the highlighted action.`]})}),(0,g.jsx)(p,{options:m,onChange:f,onCancel:()=>e(),visibleOptionCount:m.length}),a&&(0,g.jsx)(n,{color:`error`,wrap:`wrap`,children:a}),c.pending&&(0,g.jsxs)(n,{dimColor:!0,children:[`Press `,c.keyName,` again to exit`]})]})}export{x as ProviderSetup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,s as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{Kr as o,qr as s}from"./src-DL3w8VPk.js";import{Ft as c,K as l,Pt as u,at as d,ft as f,gt as p,rt as m}from"./state-BQ4BEGin.js";import{$ as h,$C as g,$g as _,$p as v,$w as y,Ai as ee,BC as b,Cs as x,FS as te,Fh as ne,Gu as S,HS as C,Hb as w,Ia as re,Ih as T,Ji as E,Js as ie,Ju as ae,Mi as D,Oa as O,Pa as k,Ph as oe,Ss as se,Ts as ce,Ub as le,Ug as ue,Vg as A,Wr as j,X as de,Xn as M,Y as fe,am as N,cy as P,ef as F,f_ as I,fa as pe,gn as me,gr as he,hC as L,hg as R,hn as z,ly as B,mg as ge,nf as V,nm as _e,nw as ve,oT as ye,ot as be,pC as xe,pS as Se,qs as Ce,sT as we,st as Te,ws as Ee,zC as De}from"./loadAgentsDir-DGozQu_6.js";import{n as H,t as Oe}from"./cwd-BvNt_018.js";import{J as U,Z as ke,d as Ae,h as je}from"./settings-CodSADx8.js";import{E as Me,T as Ne,d as W,o as Pe}from"./config-CWPHVTic.js";import{i as Fe,o as Ie,q as Le}from"./log-DoSpAwRP.js";import{f as G,s as Re,v as ze}from"./model-DpZaKZMb.js";import{at as K,bn as Be,nt as Ve,vn as He}from"./prompt-DzO1um1h.js";import{n as Ue,o as We,r as q}from"./MessageSelector-DW_itlX-.js";import{n as Ge,t as J}from"./systemTheme-Ceakddth.js";import{randomUUID as Y}from"crypto";n(),i(),o(),u(),H(),Ie(),je(),Me(),He(),W(),ye(),ve(),De(),C(),I(),K(),ue(),R(),N(),V(),Ce(),k(),E(),D(),he(),z(),de(),Te(),T(),B(),G(),_(),S();async function Ke({tools:e,mainLoopModel:t,additionalWorkingDirectories:n,mcpClients:r,customSystemPrompt:i}){let[a,o,s]=await Promise.all([i===void 0?be(e,t,n,r):Promise.resolve([]),ne(),i===void 0?oe():Promise.resolve({})]);return{defaultSystemPrompt:a,userContext:o,systemContext:s}}async function qe({tools:e,commands:t,mcpClients:n,messages:r,readFileState:i,getAppState:a,setAppState:o,customSystemPrompt:s,appendSystemPrompt:c,thinkingConfig:l,agents:u}){let d=Re(),f=a(),{defaultSystemPrompt:p,userContext:m,systemContext:h}=await Ke({tools:e,mainLoopModel:d,additionalWorkingDirectories:Array.from(f.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:n,customSystemPrompt:s}),g=xe([...s===void 0?p:[s],...c?[c]:[]]),_=r.at(-1),v=_?.type===`assistant`&&_.message.stop_reason===null?r.slice(0,-1):r;return{systemPrompt:g,userContext:m,systemContext:h,toolUseContext:{options:{commands:t,debug:!1,mainLoopModel:d,tools:e,verbose:!1,thinkingConfig:l??(ae()===!1?{type:`disabled`}:{type:`adaptive`}),mcpClients:n,mcpResources:{},isNonInteractiveSession:!0,agentDefinitions:{activeAgents:u,allAgents:[]},customSystemPrompt:s,appendSystemPrompt:c},abortController:P(),readFileState:i,getAppState:a,setAppState:o,messages:v,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}},forkContextMessages:v}}ke(),w(),O(),J(),y();function X(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:e.message,uuid:e.uuid,requestId:void 0,timestamp:new Date().toISOString()}];case`user`:return[{type:`user`,message:e.message,uuid:e.uuid??Y(),timestamp:e.timestamp??new Date().toISOString(),isMeta:e.isSynthetic}];default:return[]}})}function Je(e){let t=e.preservedSegment;return{trigger:e.trigger,pre_tokens:e.preTokens,...t&&{preserved_segment:{head_uuid:t.headUuid,anchor_uuid:t.anchorUuid,tail_uuid:t.tailUuid}}}}function Ye(e,t){let n=Se({content:s(e).replace(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/,`$1`).replace(/<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/,`$1`).trim()});return{type:`assistant`,content:n.message?.content,message:n.message,parent_tool_use_id:null,session_id:d(),uuid:t}}function Z(e){if(e)return{type:`rate_limit`,status:e.status,...e.resetsAt!==void 0&&{resetsAt:e.resetsAt},...e.rateLimitType!==void 0&&{rateLimitType:e.rateLimitType},...e.utilization!==void 0&&{utilization:e.utilization},...e.overageStatus!==void 0&&{overageStatus:e.overageStatus},...e.overageResetsAt!==void 0&&{overageResetsAt:e.overageResetsAt},...e.overageDisabledReason!==void 0&&{overageDisabledReason:e.overageDisabledReason},...e.isUsingOverage!==void 0&&{isUsingOverage:e.isUsingOverage},...e.surpassedThreshold!==void 0&&{surpassedThreshold:e.surpassedThreshold}}}u();function Xe(e){return e===`Agent`?U:e}function Ze(e){let t=Ae()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:Oe(),session_id:d(),tools:e.tools.map(e=>Xe(e.name)),mcp_servers:e.mcpClients.map(e=>({name:e.name,status:e.type})),model:e.model,permissionMode:e.permissionMode,slash_commands:e.commands.filter(e=>e.userInvocable!==!1).map(e=>e.name),apiKeySource:process.env.ANTHROPIC_API_KEY?`ANTHROPIC_API_KEY`:`none`,betas:m(),claude_code_version:`0.0.25`,output_style:t,agents:e.agents.map(e=>e.agentType),skills:e.skills.filter(e=>e.userInvocable!==!1).map(e=>e.name),plugins:e.plugins.map(e=>({name:e.name,path:e.path,source:e.source})),uuid:Y()};return n.fast_mode_state=g(e.model,e.fastMode),n}u(),o(),Le(),B(),H(),ve(),E(),G(),_(),S(),x();var Qe=()=>{try{return q(),e(Ue)}catch{return null}},Q=class{constructor(e){a(this,`config`,void 0),a(this,`mutableMessages`,void 0),a(this,`abortController`,void 0),a(this,`permissionDenials`,void 0),a(this,`totalUsage`,void 0),a(this,`hasHandledOrphanedPermission`,!1),a(this,`readFileState`,void 0),a(this,`discoveredSkillNames`,new Set),a(this,`loadedNestedMemoryPaths`,new Set),this.config=e,this.mutableMessages=e.initialMessages??[],this.abortController=e.abortController??P(),this.permissionDenials=[],this.readFileState=e.readFileCache,this.totalUsage=L}async*submitMessage(e,n){let{cwd:i,commands:a,tools:o,mcpClients:u,verbose:m=!1,thinkingConfig:_,maxTurns:y,maxBudgetUsd:x,taskBudget:ne,canUseTool:S,customSystemPrompt:C,appendSystemPrompt:w,userSpecifiedModel:T,fallbackModel:E,jsonSchema:D,getAppState:O,setAppState:k,replayUserMessages:oe=!1,includePartialMessages:ue=!1,agents:A=[],setSDKStatus:de,orphanedPermission:N}=this.config;this.discoveredSkillNames.clear(),this.permissionDenials=[],le(i);let P=!c(),I=Date.now(),he=async(e,t,n,r,i,a)=>{let o=await S(e,t,n,r,i,a);return o.behavior!==`allow`&&this.permissionDenials.push({type:`permission_denial`,tool_name:Xe(e.name),tool_use_id:i,tool_input:t}),o},R=O(),z=T?ze(T):Re(),B=_||(ae()===!1?{type:`disabled`}:{type:`adaptive`});F(`before_getSystemPrompt`);let V=typeof C==`string`?C:void 0,{defaultSystemPrompt:ve,userContext:ye,systemContext:be}=await Ke({tools:o,mainLoopModel:z,additionalWorkingDirectories:Array.from(R.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:u,customSystemPrompt:V});F(`after_getSystemPrompt`);let Se={...ye},Ce=V!==void 0&&Ne()?await we():null,Te=xe([...V===void 0?ve:[V],...Ce?[Ce]:[],...w?[w]:[]]),De=o.some(e=>Be(e,Ve));D&&De&&me(k,d());let H={messages:this.mutableMessages,setMessages:e=>{this.mutableMessages=e(this.mutableMessages)},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:m,mainLoopModel:z,thinkingConfig:B,mcpClients:u,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:C,appendSystemPrompt:w,agentDefinitions:{activeAgents:A,allAgents:[]},theme:Ge(Pe().theme),maxBudgetUsd:x},getAppState:O,setAppState:k,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:e=>{k(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState:e=>{k(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},setSDKStatus:de};if(N&&!this.hasHandledOrphanedPermission){this.hasHandledOrphanedPermission=!0;for await(let e of se(N,o,this.mutableMessages,H))yield e}let{messages:U,shouldQuery:ke,allowedTools:Ae,model:je,resultText:Me}=await We({input:e,mode:`prompt`,setToolJSX:()=>{},context:{...H,messages:this.mutableMessages},messages:this.mutableMessages,uuid:n?.uuid,isMeta:n?.isMeta,querySource:`sdk`});this.mutableMessages.push(...U);let W=[...this.mutableMessages];if(P&&U.length>0){let e=j(W);r()||(await e,(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M())}let Ie=Qe(),Le=U.filter(e=>e.type===`user`&&!e.isMeta&&!e.toolUseResult&&(Ie?.selectableUserMessagesFilter(e)??!0)||e.type===`system`&&e.subtype===`compact_boundary`),G=oe?Le:[];k(e=>({...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:Ae}}}));let K=je??z;H={messages:W,setMessages:()=>{},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:m,mainLoopModel:K,thinkingConfig:B,mcpClients:u,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:C,appendSystemPrompt:w,theme:Ge(Pe().theme),agentDefinitions:{activeAgents:A,allAgents:[]},maxBudgetUsd:x},getAppState:O,setAppState:k,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:H.updateFileHistoryState,updateAttributionState:H.updateAttributionState,setSDKStatus:de},F(`before_skills_plugins`);let[He,{enabled:Ue}]=await Promise.all([ee(Oe()),re()]);if(F(`after_skills_plugins`),yield Ze({tools:o,mcpClients:u,model:K,permissionMode:R.toolPermissionContext.mode,commands:a,agents:A,skills:He,plugins:Ue,fastMode:R.fastMode}),F(`system_message_yielded`),!ke){for(let e of U)if(e.type===`user`&&typeof e.message.content==`string`&&(e.message.content.includes(`<local-command-stdout>`)||e.message.content.includes(`<local-command-stderr>`)||e.isCompactSummary)&&(yield{type:`user`,message:{...e.message,content:s(e.message.content)},session_id:d(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!e.isCompactSummary,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly}),e.type===`system`&&e.subtype===`local_command`&&typeof e.content==`string`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))&&(yield Ye(e.content,e.uuid)),e.type===`system`&&e.subtype===`compact_boundary`){let t=e;yield{type:`system`,subtype:`compact_boundary`,session_id:d(),uuid:e.uuid,compact_metadata:Je(t.compactMetadata)}}P&&(await j(W),(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M()),yield{type:`result`,subtype:`success`,is_error:!1,duration_ms:Date.now()-I,duration_api_ms:f(),num_turns:W.length-1,result:Me??``,stop_reason:null,session_id:d(),total_cost_usd:p(),usage:this.totalUsage,modelUsage:l(),permission_denials:this.permissionDenials,fast_mode_state:g(K,R.fastMode),uuid:Y()};return}if(v()&&P){let e=Qe()?.selectableUserMessagesFilter??(e=>!0);U.filter(e).forEach(e=>{_e(e=>{k(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)})}let q=L,J=1,qe=!1,X,Z=null,Q=Fe().at(-1),$e=D?pe(this.mutableMessages,Ve):0;for await(let e of ie({messages:W,systemPrompt:Te,userContext:Se,systemContext:be,canUseTool:he,toolUseContext:H,fallbackModel:E,querySource:`sdk`,maxTurns:y,taskBudget:ne})){if(e.type===`assistant`||e.type===`user`||e.type===`system`&&e.subtype===`compact_boundary`){if(P&&e.type===`system`&&e.subtype===`compact_boundary`){let t=e.compactMetadata?.preservedSegment?.tailUuid;if(t){let e=this.mutableMessages.findLastIndex(e=>e.uuid===t);e!==-1&&await j(this.mutableMessages.slice(0,e+1))}}if(W.push(e),P&&(e.type===`assistant`?j(W):await j(W)),!qe&&G.length>0){qe=!0;for(let e of G)e.type===`user`&&(yield{type:`user`,message:e.message,session_id:d(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}}switch(e.type===`user`&&J++,e.type){case`tombstone`:break;case`assistant`:{let t=e,n=t.message?.stop_reason;n!=null&&(Z=n),this.mutableMessages.push(t),yield*ce(t);break}case`progress`:{let t=e;this.mutableMessages.push(t),P&&(W.push(t),j(W)),yield*ce(t);break}case`user`:{let t=e;this.mutableMessages.push(t),yield*ce(t);break}case`stream_event`:{let t=e.event;if(t.type===`message_start`){q=L;let e=t.message;q=h(q,e.usage)}if(t.type===`message_delta`){q=h(q,t.usage);let e=t.delta;e.stop_reason!=null&&(Z=e.stop_reason)}t.type===`message_stop`&&(this.totalUsage=fe(this.totalUsage,q)),ue&&(yield{type:`stream_event`,event:t,session_id:d(),parent_tool_use_id:null,uuid:Y()});break}case`attachment`:{let n=e;this.mutableMessages.push(n),P&&(W.push(n),j(W));let r=n.attachment;if(r.type===`structured_output`)X=r.data;else if(r.type===`max_turns_reached`){P&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),yield{type:`result`,subtype:`error_max_turns`,duration_ms:Date.now()-I,duration_api_ms:f(),is_error:!0,num_turns:r.turnCount,stop_reason:Z,session_id:d(),total_cost_usd:p(),usage:this.totalUsage,modelUsage:l(),permission_denials:this.permissionDenials,fast_mode_state:g(K,R.fastMode),uuid:Y(),errors:[`Reached maximum number of turns (${r.maxTurns})`]};return}else oe&&r.type===`queued_command`&&(yield{type:`user`,message:{role:`user`,content:r.prompt},session_id:d(),parent_tool_use_id:null,uuid:r.source_uuid||n.uuid,timestamp:n.timestamp,isReplay:!0});break}case`stream_request_start`:break;case`system`:{let t=e,n=this.config.snipReplay?.(t,this.mutableMessages);if(n!==void 0){n.executed&&(this.mutableMessages.length=0,this.mutableMessages.push(...n.messages));break}if(this.mutableMessages.push(t),t.subtype===`compact_boundary`&&t.compactMetadata){let e=t,n=this.mutableMessages.length-1;n>0&&this.mutableMessages.splice(0,n);let r=W.length-1;r>0&&W.splice(0,r),yield{type:`system`,subtype:`compact_boundary`,session_id:d(),uuid:t.uuid,compact_metadata:Je(e.compactMetadata)}}if(t.subtype===`api_error`){let e=t;yield{type:`system`,subtype:`api_retry`,attempt:e.retryAttempt,max_retries:e.maxRetries,retry_delay_ms:e.retryInMs,error_status:e.error.status??null,error:ge(e.error),session_id:d(),uuid:t.uuid}}break}case`tool_use_summary`:{let t=e;yield{type:`tool_use_summary`,summary:t.summary,preceding_tool_use_ids:t.precedingToolUseIds,session_id:d(),uuid:t.uuid};break}}if(x!==void 0&&p()>=x){P&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),yield{type:`result`,subtype:`error_max_budget_usd`,duration_ms:Date.now()-I,duration_api_ms:f(),is_error:!0,num_turns:J,stop_reason:Z,session_id:d(),total_cost_usd:p(),usage:this.totalUsage,modelUsage:l(),permission_denials:this.permissionDenials,fast_mode_state:g(K,R.fastMode),uuid:Y(),errors:[`Reached maximum budget ($${x}). Increase the limit with --max-budget-usd or start a new session.`]};return}if(e.type===`user`&&D){let e=pe(this.mutableMessages,Ve)-$e,n=parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES||`5`,10);if(e>=n){P&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),yield{type:`result`,subtype:`error_max_structured_output_retries`,duration_ms:Date.now()-I,duration_api_ms:f(),is_error:!0,num_turns:J,stop_reason:Z,session_id:d(),total_cost_usd:p(),usage:this.totalUsage,modelUsage:l(),permission_denials:this.permissionDenials,fast_mode_state:g(K,R.fastMode),uuid:Y(),errors:[`Failed to provide valid structured output after ${n} attempts`]};return}}}let $=W.findLast(e=>e.type===`assistant`||e.type===`user`),et=$?.type??`undefined`,tt=$?.type===`assistant`?b($.message.content)?.type??`none`:`n/a`;if(P&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),!Ee($,Z)){yield{type:`result`,subtype:`error_during_execution`,duration_ms:Date.now()-I,duration_api_ms:f(),is_error:!0,num_turns:J,stop_reason:Z,session_id:d(),total_cost_usd:p(),usage:this.totalUsage,modelUsage:l(),permission_denials:this.permissionDenials,fast_mode_state:g(K,R.fastMode),uuid:Y(),errors:(()=>{let e=Fe(),t=Q?e.lastIndexOf(Q)+1:0;return[`[ede_diagnostic] result_type=${et} last_content_type=${tt} stop_reason=${Z}`,...e.slice(t).map(e=>e.error)]})()};return}let nt=``,rt=!1;if($.type===`assistant`){let e=b($.message.content);e?.type===`text`&&!te.has(e.text)&&(nt=e.text),rt=!!$.isApiErrorMessage}yield{type:`result`,subtype:`success`,is_error:rt,duration_ms:Date.now()-I,duration_api_ms:f(),num_turns:J,result:nt,stop_reason:Z,session_id:d(),total_cost_usd:p(),usage:this.totalUsage,modelUsage:l(),permission_denials:this.permissionDenials,structured_output:X,fast_mode_state:g(K,R.fastMode),uuid:Y()}}interrupt(){this.abortController.abort()}resetAbortController(){this.abortController=P()}getAbortSignal(){return this.abortController.signal}getMessages(){return this.mutableMessages}getReadFileState(){return this.readFileState}getSessionId(){return d()}setModel(e){this.config.userSpecifiedModel=e}};async function*$e({commands:e,prompt:t,promptUuid:n,isMeta:r,cwd:i,tools:a,mcpClients:o,verbose:s=!1,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,canUseTool:f,mutableMessages:p=[],getReadFileCache:m,setReadFileCache:h,customSystemPrompt:g,appendSystemPrompt:_,userSpecifiedModel:v,fallbackModel:y,jsonSchema:ee,getAppState:b,setAppState:x,abortController:te,replayUserMessages:ne=!1,includePartialMessages:S=!1,handleElicitation:C,agents:w=[],setSDKStatus:re,orphanedPermission:T}){let E=new Q({cwd:i,tools:a,commands:e,mcpClients:o,agents:w??[],canUseTool:f,getAppState:b,setAppState:x,initialMessages:p,readFileCache:A(m()),customSystemPrompt:g,appendSystemPrompt:_,userSpecifiedModel:v,fallbackModel:y,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,jsonSchema:ee,verbose:s,handleElicitation:C,replayUserMessages:ne,includePartialMessages:S,setSDKStatus:re,abortController:te,orphanedPermission:T});try{yield*E.submitMessage(t,{uuid:n,isMeta:r})}finally{h(E.getReadFileState())}}export{qe as a,Z as i,$e as n,X as r,Q as t};
|