@readmagic/workmate 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-mS8iUoWY.js → AddWorkspaceDirectory-DqlPtsVK.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-BHBkysy0.js → AgentsMdExternalIncludesDialog-rJS5l6yk.js} +1 -1
- package/dist/chunks/{App-D--vtCyq.js → App-DzRQpRKr.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-CBhSmdz_.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-DyqI98d2.js → BypassPermissionsModeDialog-zz-lnmJt.js} +1 -1
- package/dist/chunks/CustomSelect-CYmc4vRh.js +1 -0
- package/dist/chunks/{DiffDialog-BQAU2pJx.js → DiffDialog-CTUIAcEE.js} +6 -6
- package/dist/chunks/{Doctor-DJOMbSDE.js → Doctor-CLOYkPRR.js} +2 -2
- package/dist/chunks/Doctor-CiZNe_qx.js +1 -0
- package/dist/chunks/{ExitFlow-xBOnvhiW.js → ExitFlow-CATwJC4c.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-NiuhcaG5.js → InvalidConfigDialog-B-9Z58oD.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-DrromC1I.js → InvalidSettingsDialog-B4EWjbp7.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-Dzg77_Xn.js +1 -0
- package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +1 -0
- package/dist/chunks/MCPToolListView-C7HT6rrl.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BYG2yqjO.js → McpParsingWarnings-Dj_Fu5o-.js} +1 -1
- package/dist/chunks/MessageSelector-Dw_ERK_Z.js +3 -0
- package/dist/chunks/Messages-RBfRELKn.js +10 -0
- package/dist/chunks/Onboarding-BRSXxc2E.js +1 -0
- package/dist/chunks/{PermissionDialog-tEMMa5-a.js → PermissionDialog-DjCRuzSm.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-CPOaYnym.js → PressEnterToContinue-DE1RxMX_.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-CwqAsTI2.js → PromptInputFooterSuggestions-ChpyD9B7.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-CrTT8MKE.js +1 -0
- package/dist/chunks/{ProviderSetup-J6Ty-Wj8.js → ProviderSetup-BEV95bnz.js} +1 -1
- package/dist/chunks/QueryEngine-BBBkZWu2.js +1 -0
- package/dist/chunks/REPL-BDnZnm__.js +124 -0
- package/dist/chunks/REPL-BHk0vZDf.js +1 -0
- package/dist/chunks/{ResumeConversation-Cmsbo5m7.js → ResumeConversation-BuSqBrm1.js} +1 -1
- package/dist/chunks/{SearchBox-DQBLKyzJ.js → SearchBox-zA5QwIpO.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +1 -0
- package/dist/chunks/Settings-DYKmPdbd.js +2 -0
- package/dist/chunks/Spinner-DOI8qqZi.js +1 -0
- package/dist/chunks/SpinnerGlyph-BR_SiV9L.js +1 -0
- package/dist/chunks/{TextInput-BboKIug2.js → TextInput-ZKU-x_FD.js} +7 -7
- package/dist/chunks/{ThemePicker-DTpXbEY0.js → ThemePicker-B69oDgXN.js} +1 -1
- package/dist/chunks/TrustDialog-BSG8Ibh8.js +1 -0
- package/dist/chunks/{ValidationErrorsList-C_gDQfm1.js → ValidationErrorsList-BUYHEft4.js} +1 -1
- package/dist/chunks/{_baseEach-DGbaIpJA.js → _baseEach-P0u1zIx6.js} +1 -1
- package/dist/chunks/{add-dir-B576wzi9.js → add-dir-C8RmmyQK.js} +1 -1
- package/dist/chunks/{agentDisplay-ZuFoBZYu.js → agentDisplay-np7CH47m.js} +1 -1
- package/dist/chunks/{agents-Dy4_hDic.js → agents-DRQlR5M1.js} +1 -1
- package/dist/chunks/agents-DedoH0Q4.js +101 -0
- package/dist/chunks/allErrors-DvcU0w0F.js +1 -0
- package/dist/chunks/{appleTerminalBackup-C9kjzdM9.js → appleTerminalBackup-Bemd4RXh.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-PyLNnGdw.js → backgroundHousekeeping-BtEJ6TeC.js} +1 -1
- package/dist/chunks/banner-CuoceXzz.js +2 -0
- package/dist/chunks/branch-ClhlS7f8.js +2 -0
- package/dist/chunks/{break-cache-DL95nKZl.js → break-cache-B1nuWtD_.js} +2 -2
- package/dist/chunks/{btw-Y44ctueB.js → btw-B-FLxlx-.js} +1 -1
- package/dist/chunks/bundledMode-D9omqD3L.js +2 -0
- package/dist/chunks/caches-D7arwhaa.js +1 -0
- package/dist/chunks/caches-Dn8yrJmL.js +1 -0
- package/dist/chunks/{clear-DtTkA707.js → clear-BnWv0i65.js} +1 -1
- package/dist/chunks/{client-aJ2Nr_sh.js → client-2w-g5kMx.js} +1 -1
- package/dist/chunks/client-B0ngS4Uu.js +1 -0
- package/dist/chunks/client-BP4DOH3K.js +1 -0
- package/dist/chunks/{client-Bw_L3lSc.js → client-pA7fKk0-.js} +1 -1
- package/dist/chunks/commands-AcfFLgl5.js +1 -0
- package/dist/chunks/{compact-CvNOtu7J.js → compact-Banc-SNk.js} +1 -1
- package/dist/chunks/config-BDn2YIjC.js +3 -0
- package/dist/chunks/config-BhBcadjZ.js +1 -0
- package/dist/chunks/config-Bm5pVdCq.js +1 -0
- package/dist/chunks/{context-Opu4E8dL.js → context-BvDBAyJ9.js} +1 -1
- package/dist/chunks/context-noninteractive-BK2IDLSS.js +1 -0
- package/dist/chunks/{context-noninteractive-B1V2Mp26.js → context-noninteractive-CuHHniJn.js} +9 -9
- package/dist/chunks/conversation-B2dX3X4Z.js +1 -0
- package/dist/chunks/{conversation-CG_z7TLE.js → conversation-Cjaftrrw.js} +1 -1
- package/dist/chunks/conversationRecovery-NL05oJb1.js +1 -0
- package/dist/chunks/crossProjectResume-BzltC4NJ.js +40 -0
- package/dist/chunks/{debug-kBjDaVkQ.js → debug-2pVES-2G.js} +1 -1
- package/dist/chunks/detectRepository--luIRv5H.js +1 -0
- package/dist/chunks/{diff-Cv7tX2-P.js → diff--6gQCx_x.js} +1 -1
- package/dist/chunks/directoryCompletion-BC0qRmrz.js +1 -0
- package/dist/chunks/doctor-CQf8xPZH.js +1 -0
- package/dist/chunks/entry-DWYOrkFS.js +13 -0
- package/dist/chunks/{envUtils-DZ_SvEVz.js → envUtils-QyzA_cFM.js} +1 -1
- package/dist/chunks/{execFileNoThrow-BfZFnCGa.js → execFileNoThrow-DXSEj8ZO.js} +1 -1
- package/dist/chunks/{exit-OKEV_ddw.js → exit-uKtXb5U3.js} +1 -1
- package/dist/chunks/{extraUsage-BlRL3yeb.js → extraUsage-Dr0YXm1w.js} +1 -1
- package/dist/chunks/extractMemories-8yvMGZ1J.js +1 -0
- package/dist/chunks/fast-C5-lNCQi.js +1 -0
- package/dist/chunks/fast-aNkj6WvB.js +1 -0
- package/dist/chunks/fetchModelList-9w1E4Ue8.js +1 -0
- package/dist/chunks/fetchModelList-D2quBF6M.js +1 -0
- package/dist/chunks/fileSuggestions-BYD78vcF.js +3 -0
- package/dist/chunks/{fpsMetrics-Ixd0J4CH.js → fpsMetrics-DIpm2-xw.js} +1 -1
- package/dist/chunks/{gemini-BfVyavwQ.js → gemini-BNBptTET.js} +1 -1
- package/dist/chunks/generateSessionName-CO2484aJ.js +1 -0
- package/dist/chunks/{genericProcessUtils-CVtQOTO2.js → genericProcessUtils-GqURdVAv.js} +1 -1
- package/dist/chunks/{goal-BidR-GFa.js → goal-j0wdadwM.js} +1 -1
- package/dist/chunks/{grok-DLcuI-U7.js → grok-BpO1ZwK_.js} +1 -1
- package/dist/chunks/{help-CZuvYhXj.js → help-DwhA0qQ6.js} +1 -1
- package/dist/chunks/{history-BxPGftQw.js → history-CUrqO9rV.js} +1 -1
- package/dist/chunks/hooks-B5Wq-KxE.js +1 -0
- package/dist/chunks/{hooks-ehqfAM5F.js → hooks-DG4_WdZ2.js} +2 -2
- package/dist/chunks/install-BbmCNCuM.js +1 -0
- package/dist/chunks/{instrumentation-B9bfF2mA.js → instrumentation-DpPmDyNF.js} +4 -4
- package/dist/chunks/{job-Coztdn6A.js → job-GcmX1ALd.js} +1 -1
- package/dist/chunks/{keybindings-DwSdLpaE.js → keybindings-CxgQqQJe.js} +1 -1
- package/dist/chunks/{launchLocalMemory-DRzfpIOB.js → launchLocalMemory-CDgT5lst.js} +1 -1
- package/dist/chunks/{launchOnboarding-D2zFCJf-.js → launchOnboarding-uQ_ux9sS.js} +1 -1
- package/dist/chunks/loadAgentsDir-BBbIAiay.js +1 -0
- package/dist/chunks/{loadAgentsDir-DR5PVAc3.js → loadAgentsDir-uuZYOgKn.js} +392 -392
- package/dist/chunks/{loadPluginHooks-BiQgGfUJ.js → loadPluginHooks-QoVXsBjy.js} +1 -1
- package/dist/chunks/loader-BMAtuwRa.js +1 -0
- package/dist/chunks/localSearch-D6MhwvnR.js +1 -0
- package/dist/chunks/{localSearch-CzkxDuOR.js → localSearch-yVCDrVrf.js} +1 -1
- package/dist/chunks/{log-DWZny1vM.js → log-L1kqxa_P.js} +1 -1
- package/dist/chunks/{logoUtils-DR5T0pr3.js → logoUtils-B4wCDKs9.js} +1 -1
- package/dist/chunks/{magicDocs-BwBxjfLo.js → magicDocs-D53lV8b5.js} +2 -2
- package/dist/chunks/{main-Ryi27wYq.js → main-fy_XSXGj.js} +34 -34
- package/dist/chunks/{managedEnv-Do9fgLpk.js → managedEnv-B8YWmM4A.js} +1 -1
- package/dist/chunks/managedEnv-ulQBH73B.js +1 -0
- package/dist/chunks/{managedEnvConstants-CWcT7nYr.js → managedEnvConstants-BPY8yF1A.js} +1 -1
- package/dist/chunks/{mcp-BCpnF6wD.js → mcp--LmEVBRg.js} +1 -1
- package/dist/chunks/mcp-CZUVaPb3.js +5 -0
- package/dist/chunks/{mcp-CZBTxbhu.js → mcp-DCl-Tz-C.js} +1 -1
- package/dist/chunks/memory-Bu5ku7y9.js +1 -0
- package/dist/chunks/{modalContext-CBE8xuck.js → modalContext-sU2lfR08.js} +1 -1
- package/dist/chunks/{mode-wq70cR44.js → mode-Bteqe2QG.js} +1 -1
- package/dist/chunks/{model-DVk9-2dk.js → model-CHDU5yqH.js} +1 -1
- package/dist/chunks/model-CcHyMyBv.js +1 -0
- package/dist/chunks/modelOptions-CJV1R3Jt.js +1 -0
- package/dist/chunks/nativeInstaller-CIUYh1aD.js +1 -0
- package/dist/chunks/{notifications-dGBuNvFj.js → notifications-GLnjirCl.js} +1 -1
- package/dist/chunks/{observationStore-D0rm3GhP.js → observationStore-pnSSxec_.js} +1 -1
- package/dist/chunks/{onChangeAppState-B4K-rSaF.js → onChangeAppState-CxGW2d-l.js} +1 -1
- package/dist/chunks/{openai-DAwnAV9K.js → openai-BpGQT2Iv.js} +1 -1
- package/dist/chunks/{overlayContext-B6i_6y_0.js → overlayContext-7wgLio1O.js} +1 -1
- package/dist/chunks/{panel-C0CF3noE.js → panel-DNiXDhBX.js} +1 -1
- package/dist/chunks/{parser-DThLwgdM.js → parser-CTnaXFVJ.js} +1 -1
- package/dist/chunks/parser-Diihup2V.js +1 -0
- package/dist/chunks/{partition-BRQHofxD.js → partition-djFY9gGI.js} +1 -1
- package/dist/chunks/{pasteStore-BmehVo5j.js → pasteStore-njJCBMKr.js} +1 -1
- package/dist/chunks/permissions-DNedQyLg.js +3 -0
- package/dist/chunks/pidLock-CFUBtZck.js +3 -0
- package/dist/chunks/{plan-B6U3ioer.js → plan-DI0n7LIV.js} +1 -1
- package/dist/chunks/plugin-BQ8gRVYF.js +17 -0
- package/dist/chunks/pluginAutoupdate-CNrHb4RJ.js +1 -0
- package/dist/chunks/{pluginBlocklist-DAoUENwc.js → pluginBlocklist-CKCsgWdY.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CaHnj0C_.js → pluginCliCommands-CACeyIwz.js} +1 -1
- package/dist/chunks/{pluginFlagging-BCj9LJP3.js → pluginFlagging-CUvkKGOB.js} +1 -1
- package/dist/chunks/pluginOperations-Ca_T-HYn.js +2 -0
- package/dist/chunks/pluginStartupCheck-DftTiXct.js +1 -0
- package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +1 -0
- package/dist/chunks/{plugins-D7zyI9c4.js → plugins-Divl-P-X.js} +1 -1
- package/dist/chunks/{poorMode-Ocff_UT1.js → poorMode-CG2JNTD0.js} +1 -1
- package/dist/chunks/poorMode-eMIFCAC_.js +1 -0
- package/dist/chunks/print-DSHypGJa.js +13 -0
- package/dist/chunks/processBashCommand-BLcFmbyG.js +1 -0
- package/dist/chunks/processSlashCommand-Caif46Gi.js +5 -0
- package/dist/chunks/{projectContext-QN5U3Ggr.js → projectContext-BFfHgAMh.js} +1 -1
- package/dist/chunks/{projectContext-COeHKDrk.js → projectContext-DnJHynXv.js} +1 -1
- package/dist/chunks/{projectOnboardingState-KqcpRXls.js → projectOnboardingState-nTCycGCD.js} +1 -1
- package/dist/chunks/prompt-BZmu5CeK.js +1 -0
- package/dist/chunks/{prompt-CTByhpUI.js → prompt-BfXryFt-.js} +8 -8
- package/dist/chunks/prompt-Cogr_WZr.js +1 -0
- package/dist/chunks/promptEditor-14TB3MYt.js +4 -0
- package/dist/chunks/protocolHandler-VigBkAQQ.js +13 -0
- package/dist/chunks/{proxy-BtWuysHM.js → proxy--_NfbJhm.js} +1 -1
- package/dist/chunks/reconciler-B9XFdL4f.js +1 -0
- package/dist/chunks/{refresh-B4pqFp12.js → refresh-CBHbWTGg.js} +1 -1
- package/dist/chunks/reject-CBxnwckZ.js +1 -0
- package/dist/chunks/{reload-plugins-DXQqk7q6.js → reload-plugins-5eFWrQlL.js} +1 -1
- package/dist/chunks/{rename-D4XBmTBI.js → rename-Cw7cMerG.js} +1 -1
- package/dist/chunks/{renderOptions-DkP98P_d.js → renderOptions-B0RFpjRI.js} +1 -1
- package/dist/chunks/{resume-DzIev0JI.js → resume-U2D0ybfU.js} +1 -1
- package/dist/chunks/ripgrep-67m14ImZ.js +5 -0
- package/dist/chunks/ripgrep-DB7KB8RZ.js +1 -0
- package/dist/chunks/{runtimeObserver-BPqlbu0B.js → runtimeObserver-CWaYMJG8.js} +2 -2
- package/dist/chunks/{runtimeObserver-BUHs3qjs.js → runtimeObserver-DOYlxx9H.js} +1 -1
- package/dist/chunks/sandbox-adapter-Df7Wpt77.js +1 -0
- package/dist/chunks/sandbox-toggle-BtiPyjT3.js +1 -0
- package/dist/chunks/searchExtraTools-CbJVb_Zk.js +1 -0
- package/dist/chunks/select-BuTJbu_Q.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +1 -0
- package/dist/chunks/sessionObserver-BZVgzp3W.js +1 -0
- package/dist/chunks/{sessionObserver-B6xzxckA.js → sessionObserver-cfwD8pV8.js} +1 -1
- package/dist/chunks/sessionStorage-SC5RfnUP.js +1 -0
- package/dist/chunks/sessionTracing-DsdcOqvc.js +11 -0
- package/dist/chunks/settings-D4M13toi.js +104 -0
- package/dist/chunks/settings-Dfit5gGT.js +1 -0
- package/dist/chunks/setup-DR-KEmxL.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-D6R2OeoH.js → shadowedRuleDetection-DiZUDzxU.js} +1 -1
- package/dist/chunks/{sideQuestion-5jcbOMsR.js → sideQuestion-CdgUarC2.js} +1 -1
- package/dist/chunks/{sinks-B-kFqjjd.js → sinks-Cy3NqVbk.js} +1 -1
- package/dist/chunks/sinks-D41OiGE4.js +1 -0
- package/dist/chunks/{skillChangeDetector-103-nEle.js → skillChangeDetector-CVFCJcG7.js} +1 -1
- package/dist/chunks/{skillGapStore-DOz1KCqo.js → skillGapStore-BJV8ZIB1.js} +2 -2
- package/dist/chunks/{skillLifecycle-D9NkIwFQ.js → skillLifecycle-iO_3s9Ff.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DFiSZaJ4.js → skillSearchPanel-BL5gXTHU.js} +2 -2
- package/dist/chunks/skills-BEp3_RyT.js +1 -0
- package/dist/chunks/sleep-xKMbXTJe.js +1 -0
- package/dist/chunks/{src-WZ94ZKI3.js → src-BX54x08P.js} +1 -1
- package/dist/chunks/{src-Cy5_qH26.js → src-HB5wLari.js} +1 -1
- package/dist/chunks/{startupProfiler-DIM_Ihyp.js → startupProfiler-B9Qv2QGH.js} +1 -1
- package/dist/chunks/startupProfiler-DWcM4QBl.js +1 -0
- package/dist/chunks/{staticRender-RHUIg5ln.js → staticRender-Bt82RvGc.js} +1 -1
- package/dist/chunks/status-6JMz8jmM.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-DI45AH-c.js → statusNoticeHelpers-BoloSeXY.js} +1 -1
- package/dist/chunks/{stringUtils-D_xPrwGQ.js → stringUtils-Cs6E5f-B.js} +1 -1
- package/dist/chunks/switcher-95d4TrQH.js +1 -0
- package/dist/chunks/{switcher-DhZCaAun.js → switcher-DSt2cVjA.js} +1 -1
- package/dist/chunks/{tasks-6suPhqsK.js → tasks-DyBUXnQb.js} +1 -1
- package/dist/chunks/{templateJobs-BKVEWCsb.js → templateJobs-BBnReWWj.js} +7 -7
- package/dist/chunks/{terminalSetup-7PUR4hfo.js → terminalSetup-CDpFfqqV.js} +1 -1
- package/dist/chunks/{terminalSetup-Cqy5_PhJ.js → terminalSetup-DedaY1P7.js} +4 -4
- package/dist/chunks/{theme-B-HG2PUs.js → theme-BZOy9Iqh.js} +1 -1
- package/dist/chunks/tipRegistry-Cl5sdLRX.js +2 -0
- package/dist/chunks/{toolEventObserver-BY3QVnr6.js → toolEventObserver-ClwWmVbH.js} +1 -1
- package/dist/chunks/{toolPool-BcwIF8Q_.js → toolPool-DSTbgGmX.js} +1 -1
- package/dist/chunks/{udsClient-CCxgLiZy.js → udsClient-CWeoNrm3.js} +1 -1
- package/dist/chunks/{useDoublePress-DQBLKyzJ.js → useDoublePress-zA5QwIpO.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BgJrnuDl.js → useExitOnCtrlCDWithKeybindings-ClN4NJnB.js} +1 -1
- package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +1 -0
- package/dist/chunks/useManagePlugins-CxHz-gUP.js +1 -0
- package/dist/chunks/useMergedTools-BUuWew0-.js +1 -0
- package/dist/chunks/{useSearchInput-BITV_Txn.js → useSearchInput-BIQN_-Hm.js} +1 -1
- package/dist/chunks/{useSettingsErrors-CO0fTNzn.js → useSettingsErrors-BDJCLei_.js} +1 -1
- package/dist/chunks/util-BHr5l6Bx.js +1 -0
- package/dist/chunks/validatePlugin-fx1Y8vam.js +1 -0
- package/dist/chunks/{vim-qgMS88ss.js → vim-CYjMtnwH.js} +1 -1
- package/dist/chunks/worktree-CGu_58ue.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +0 -2
- package/dist/chunks/CustomSelect-CpMbxYbt.js +0 -1
- package/dist/chunks/Doctor-BU69VQzw.js +0 -1
- package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +0 -1
- package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +0 -1
- package/dist/chunks/MCPToolListView-BRxjOaOL.js +0 -1
- package/dist/chunks/MessageSelector-B7xAQqZI.js +0 -3
- package/dist/chunks/Messages-CxMsfjOa.js +0 -10
- package/dist/chunks/Onboarding-CkATe87e.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +0 -1
- package/dist/chunks/QueryEngine-Mdi_kUaL.js +0 -1
- package/dist/chunks/REPL-BgzQtSFF.js +0 -1
- package/dist/chunks/REPL-rirm6s_7.js +0 -124
- package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +0 -1
- package/dist/chunks/SelectMulti-BpAjjhsn.js +0 -1
- package/dist/chunks/Settings-B6DImvca.js +0 -2
- package/dist/chunks/Spinner-DhhSOFcN.js +0 -1
- package/dist/chunks/SpinnerGlyph-CmVXC-_9.js +0 -1
- package/dist/chunks/TrustDialog-CZ8JpySm.js +0 -1
- package/dist/chunks/agents-HIOBiw4w.js +0 -101
- package/dist/chunks/allErrors-CxPNR2WN.js +0 -1
- package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +0 -1
- package/dist/chunks/banner-DqFectPg.js +0 -2
- package/dist/chunks/branch-B_BL5N9N.js +0 -2
- package/dist/chunks/bundledMode-BxyD5cqq.js +0 -1
- package/dist/chunks/caches-5xZ4dSXt.js +0 -1
- package/dist/chunks/caches-Be9saXxV.js +0 -1
- package/dist/chunks/claudeDesktop-g8eUUY2E.js +0 -1
- package/dist/chunks/client-mnUISv_N.js +0 -1
- package/dist/chunks/client-wPqIdEVm.js +0 -1
- package/dist/chunks/commands-wfE12a4L.js +0 -1
- package/dist/chunks/config-D3K87Mm1.js +0 -3
- package/dist/chunks/config-DTga6Ku8.js +0 -1
- package/dist/chunks/config-DtmqWusU.js +0 -1
- package/dist/chunks/context-noninteractive-eIlneYiL.js +0 -1
- package/dist/chunks/conversation-CHesBfFZ.js +0 -1
- package/dist/chunks/conversationRecovery-OhitW-7g.js +0 -1
- package/dist/chunks/crossProjectResume-mmYx8PrZ.js +0 -40
- package/dist/chunks/detectRepository-M6K2wc7h.js +0 -1
- package/dist/chunks/directoryCompletion-BHyjyKAM.js +0 -1
- package/dist/chunks/doctor-DeBG5SL5.js +0 -1
- package/dist/chunks/entry-CbhyIWgj.js +0 -13
- package/dist/chunks/extractMemories-jnsv-_n_.js +0 -1
- package/dist/chunks/fast-4I_qPJCd.js +0 -1
- package/dist/chunks/fast-DiolM1M7.js +0 -1
- package/dist/chunks/fetchModelList-BRFTQim4.js +0 -1
- package/dist/chunks/fetchModelList-qPKAuu4m.js +0 -1
- package/dist/chunks/fileSuggestions-iWVXvvLB.js +0 -3
- package/dist/chunks/generateSessionName-CGaTTXCA.js +0 -1
- package/dist/chunks/hooks-Bg9WIjZQ.js +0 -1
- package/dist/chunks/install-ACGY0vhM.js +0 -1
- package/dist/chunks/loadAgentsDir-DqAbnpB-.js +0 -1
- package/dist/chunks/loader-6MqzNGmV.js +0 -1
- package/dist/chunks/localSearch-DW3JT2MA.js +0 -1
- package/dist/chunks/managedEnv-DCEJh3z3.js +0 -1
- package/dist/chunks/mcp-CJ6SDJEK.js +0 -6
- package/dist/chunks/memory-BQO6Y0ak.js +0 -1
- package/dist/chunks/model-D42epddJ.js +0 -1
- package/dist/chunks/modelOptions-beLgXORr.js +0 -1
- package/dist/chunks/nativeInstaller-ChGSz1lb.js +0 -1
- package/dist/chunks/parser-BZt0VFd_.js +0 -1
- package/dist/chunks/permissions-DkfWKN-B.js +0 -3
- package/dist/chunks/pidLock-YvAaIrIY.js +0 -3
- package/dist/chunks/platform-Vl9IynC3.js +0 -2
- package/dist/chunks/plugin-CTA2_-F7.js +0 -17
- package/dist/chunks/pluginAutoupdate-Dy5W3HWE.js +0 -1
- package/dist/chunks/pluginOperations-ClXNOOG6.js +0 -2
- package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +0 -1
- package/dist/chunks/pluginStartupCheck-U8_xk25t.js +0 -1
- package/dist/chunks/poorMode-DtzWNhsY.js +0 -1
- package/dist/chunks/print-BzljdXem.js +0 -13
- package/dist/chunks/processBashCommand-RUkmyAl4.js +0 -1
- package/dist/chunks/processSlashCommand-DRLO-jNV.js +0 -5
- package/dist/chunks/prompt-DTpfW6yP.js +0 -1
- package/dist/chunks/prompt-D__eHY_5.js +0 -1
- package/dist/chunks/promptEditor-CpUFgGzc.js +0 -4
- package/dist/chunks/protocolHandler-BQSLVGnG.js +0 -13
- package/dist/chunks/reconciler-D6BUq8WB.js +0 -1
- package/dist/chunks/reject-C6IvUvBt.js +0 -1
- package/dist/chunks/ripgrep-CYP26Fhg.js +0 -1
- package/dist/chunks/ripgrep-D1f1pbCz.js +0 -5
- package/dist/chunks/sandbox-adapter-CumL75tU.js +0 -1
- package/dist/chunks/sandbox-toggle-CTtET6Xq.js +0 -1
- package/dist/chunks/searchExtraTools-BMCU2zEf.js +0 -1
- package/dist/chunks/select-FrwoTzuc.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +0 -1
- package/dist/chunks/sessionObserver-CBrM4opL.js +0 -1
- package/dist/chunks/sessionStorage-C1EAxDWG.js +0 -1
- package/dist/chunks/sessionTracing-UFK96PxT.js +0 -11
- package/dist/chunks/settings-BK6gCko-.js +0 -1
- package/dist/chunks/settings-YIDksG5Z.js +0 -24
- package/dist/chunks/setup-BBvZyrfz.js +0 -3
- package/dist/chunks/sinks-DB_D4lmu.js +0 -1
- package/dist/chunks/skills-DgeLr52a.js +0 -1
- package/dist/chunks/sleep-BbWr_FL1.js +0 -1
- package/dist/chunks/startupProfiler-FpGsKWYk.js +0 -1
- package/dist/chunks/status-CKLecQZV.js +0 -1
- package/dist/chunks/switcher-D2Z2ZNQ0.js +0 -1
- package/dist/chunks/tipRegistry-BR_lSGRw.js +0 -2
- package/dist/chunks/types-CD25a50S.js +0 -81
- package/dist/chunks/use-select-navigation-CW5alA9r.js +0 -1
- package/dist/chunks/useMainLoopModel-BVgJo4hN.js +0 -1
- package/dist/chunks/useManagePlugins-CrWjzESW.js +0 -1
- package/dist/chunks/useMergedTools-r6GQq5mI.js +0 -1
- package/dist/chunks/util-_zo3I1y8.js +0 -1
- package/dist/chunks/validatePlugin-DFGdRhA-.js +0 -1
- package/dist/chunks/worktree-CR_M6Qfy.js +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{C as o,D as s,I as c,P as l,T as u,Wt as d,ai as f,di as p,fi as m,t as h,y as g}from"./src-BX54x08P.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as v,K as y,Qn as b,X as x,fn as ee,mn as S,nt as te,rn as C,rt as ne,tn as re}from"./settings-D4M13toi.js";import{hr as ie,mr as ae}from"./state-CXY-q5gr.js";import{$d as oe,$x as se,Ap as ce,Au as le,Bh as ue,Bv as de,By as fe,Cf as pe,Cp as me,Dc as he,Dl as ge,Dp as _e,Ec as ve,Ef as ye,El as be,Em as xe,F_ as Se,GS as Ce,Hh as we,I_ as Te,Ji as Ee,Mm as De,Mu as Oe,Nm as ke,Nu as Ae,Op as je,Pm as Me,Q as Ne,Rl as Pe,Rm as Fe,Sp as Ie,Tf as Le,Tl as Re,Tm as ze,X as Be,_m as Ve,_p as He,bp as Ue,c as We,dd as Ge,ef as Ke,et as qe,fw as Je,gm as Ye,gp as Xe,hd as w,jm as Ze,ju as Qe,l as $e,ld as et,md as T,mw as tt,nt,o as rt,pw as it,r as at,s as ot,t as st,tb as E,ty as ct,ua as lt,vp as ut,wf as dt,wl as ft,xp as pt,yp as mt,zh as ht,zl as gt,zm as _t,zv as vt,zy as yt}from"./loadAgentsDir-uuZYOgKn.js";import{n as bt,t as xt}from"./cwd-DrEEb4f5.js";import{H as St,I as Ct,N as wt,S as Tt,V as Et,Y as Dt,x as Ot}from"./debug-2pVES-2G.js";import{C as kt,T as At}from"./config-BDn2YIjC.js";import{o as jt,s as Mt}from"./log-L1kqxa_P.js";import{n as Nt}from"./analytics-COpjZpvd.js";import{S as Pt,_ as Ft}from"./startupProfiler-B9Qv2QGH.js";import{l as It,n as Lt,o as Rt}from"./stringUtils-Cs6E5f-B.js";import{_n as zt,vn as Bt}from"./prompt-BfXryFt-.js";import{n as Vt,t as Ht}from"./_baseSlice-D67_NpZ1.js";import{a as Ut,i as Wt,n as Gt,o as Kt,r as qt,t as Jt}from"./agentDisplay-np7CH47m.js";import{n as Yt,t as Xt}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as Zt,t as Qt}from"./TextInput-ZKU-x_FD.js";import{n as $t,t as en}from"./select-BuTJbu_Q.js";import{r as tn,t as nn}from"./Spinner-DOI8qqZi.js";import{n as rn,t as an}from"./useMergedTools-BUuWew0-.js";import{n as on,r as sn,t as cn}from"./promptEditor-14TB3MYt.js";import{n as ln,t as un}from"./useMainLoopModel-Bgxpmn2Q.js";import{join as D}from"path";import{mkdir as dn,open as fn,unlink as pn}from"fs/promises";function mn(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:Ht(e,t,n)}var hn=e((()=>{Vt()}));function gn(e){return _n.test(e)}var _n,vn=e((()=>{_n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`)}));function yn(e){return e.split(``)}var bn=e((()=>{}));function xn(e){return e.match(Rn)||[]}var Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn=e((()=>{Sn=`\\ud800-\\udfff`,Cn=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,wn=`\\ufe0e\\ufe0f`,Tn=`[`+Sn+`]`,En=`[`+Cn+`]`,Dn=`\\ud83c[\\udffb-\\udfff]`,On=`(?:`+En+`|`+Dn+`)`,kn=`[^`+Sn+`]`,An=`(?:\\ud83c[\\udde6-\\uddff]){2}`,jn=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Mn=`\\u200d`,Nn=On+`?`,Pn=`[`+wn+`]?`,Fn=`(?:`+Mn+`(?:`+[kn,An,jn].join(`|`)+`)`+Pn+Nn+`)*`,In=Pn+Nn+Fn,Ln=`(?:`+[kn+En+`?`,En,An,jn,Tn].join(`|`)+`)`,Rn=RegExp(Dn+`(?=`+Dn+`)|`+Ln+In,`g`)}));function Bn(e){return gn(e)?xn(e):yn(e)}var Vn=e((()=>{bn(),vn(),zn()}));function Hn(e){return function(t){t=ie(t);var n=gn(t)?Bn(t):void 0,r=n?n[0]:t.charAt(0),i=n?mn(n,1).join(``):t.slice(1);return r[e]()+i}}var Un=e((()=>{hn(),vn(),Vn(),ae()})),Wn,Gn=e((()=>{Un(),Wn=Hn(`toUpperCase`)}));function Kn(e){return Wn(ie(e).toLowerCase())}var qn=e((()=>{ae(),Gn()})),O,Jn=e((()=>{O={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function Yn(e,t,n,r,i,a,o){return`---
|
|
2
|
+
name: ${e}
|
|
3
|
+
description: "${t.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\\\n`)}"${n===void 0||n.length===1&&n[0]===`*`?``:`\ntools: ${n.join(`, `)}`}${a?`\nmodel: ${a}`:``}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
${r}
|
|
7
|
+
`}function Xn(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return D(n(),O.AGENTS_DIR);case`projectSettings`:return D(xt(),O.FOLDER_NAME,O.AGENTS_DIR);case`policySettings`:return D(re(),O.FOLDER_NAME,O.AGENTS_DIR);case`localSettings`:return D(xt(),O.FOLDER_NAME,O.AGENTS_DIR)}}function Zn(e){switch(e){case`projectSettings`:return D(`.`,O.FOLDER_NAME,O.AGENTS_DIR);default:return Xn(e)}}function Qn(e){return D(Xn(e.source),`${e.agentType}.md`)}function $n(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return D(Xn(e.source),`${e.filename||e.agentType}.md`)}function er(e){return e.source===`built-in`?`Built-in`:D(Zn(e.source),`${e.agentType}.md`)}function tr(e){return ot(e)?`Built-in`:$e(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:D(Zn(e.source),`${e.filename||e.agentType}.md`)}async function nr(e){let t=Xn(e);return await dn(t,{recursive:!0}),t}async function rr(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await nr(e);let l=Qn({source:e,agentType:t}),u=Yn(t,n,r,i,o,s,c);try{await or(l,u,a?`wx`:`w`)}catch(e){throw wt(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function ir(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await or($n(e),Yn(e.agentType,t,n,r,i,a,o))}async function ar(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=$n(e);try{await pn(t)}catch(e){if(wt(e)!==`ENOENT`)throw e}}async function or(e,t,n=`w`){let r=await fn(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var sr=e((()=>{C(),rt(),bt(),r(),Ct(),Jn()}));function cr({agent:e,tools:t,onBack:n}){let r=ut(e,t,!1),i=tr(e),o=pt(e.agentType);d(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function u(){return r.hasWildcard?(0,k.jsx)(l,{children:`All tools`}):!e.tools||e.tools.length===0?(0,k.jsx)(l,{children:`None`}):(0,k.jsxs)(k.Fragment,{children:[r.validTools.length>0&&(0,k.jsx)(l,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,k.jsxs)(l,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,k.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,k.jsx)(l,{dimColor:!0,children:i}),(0,k.jsxs)(c,{flexDirection:`column`,children:[(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]}),(0,k.jsx)(c,{marginLeft:2,children:(0,k.jsx)(l,{children:e.whenToUse})})]}),(0,k.jsxs)(c,{children:[(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Tools`}),`:`,` `]}),u()]}),(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Model`}),`: `,_e(e.model)]}),e.permissionMode&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Memory`}),`: `,Je(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),o&&(0,k.jsx)(c,{children:(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Color`}),`:`,` `,(0,k.jsxs)(l,{backgroundColor:o,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!ot(e)&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(c,{children:(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,k.jsx)(c,{marginLeft:2,marginRight:2,children:(0,k.jsx)(et,{children:e.getSystemPrompt()})})]})]})}var k,lr=e((()=>{i(),h(),E(),Ie(),it(),He(),rt(),ce(),Ge(),sr(),k=_()}));function ur({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,dr.useState)(Math.max(0,j.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:j.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<j.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=j[r];n(t===`automatic`?void 0:t)}},s=j[r];return(0,A.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,A.jsx)(c,{flexDirection:`column`,children:j.map((e,t)=>{let n=t===r;return(0,A.jsxs)(c,{flexDirection:`row`,gap:1,children:[(0,A.jsx)(l,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,A.jsx)(l,{bold:n,children:`Automatic color`}):(0,A.jsxs)(c,{gap:1,children:[(0,A.jsx)(l,{backgroundColor:Ue[e],color:`inverseText`,children:` `}),(0,A.jsx)(l,{bold:n,children:Lt(e)})]})]},e)})}),(0,A.jsxs)(c,{marginTop:1,children:[(0,A.jsx)(l,{children:`Preview: `}),s===void 0||s===`automatic`?(0,A.jsxs)(l,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,A.jsxs)(l,{backgroundColor:Ue[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var dr,A,j,fr=e((()=>{i(),dr=t(f(),1),h(),Ie(),Rt(),A=_(),j=[`automatic`,...mt]}));function pr({initialModel:e,onComplete:t,onCancel:n}){let r=mr.useMemo(()=>{let t=je();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,hr.jsxs)(c,{flexDirection:`column`,children:[(0,hr.jsx)(c,{marginBottom:1,children:(0,hr.jsx)(l,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,hr.jsx)(en,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var mr,hr,gr=e((()=>{mr=t(f(),1),h(),ce(),$t(),hr=_()}));function _r(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([Ze.name,ke.name,ft.name,yt.name,ze.name,Pe.name,be.name,Le.name,pe.name])},EDIT:{name:`Edit tools`,toolNames:new Set([Oe.name,Fe.name,le.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([Ye.name])},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function vr(e){let t=new Map;return e.forEach(e=>{if(Ke(e)){let n=ne(e.name);if(n?.serverName){let r=t.get(n.serverName)||[];r.push(e),t.set(n.serverName,r)}}}),Array.from(t.entries()).map(([e,t])=>({serverName:e,tools:t})).sort((e,t)=>e.serverName.localeCompare(t.serverName))}function yr({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,M.useMemo)(()=>Xe({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[s,u]=(0,M.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[f,p]=(0,M.useState)(0),[m,h]=(0,M.useState)(!1),g=(0,M.useMemo)(()=>{let e=new Set(i.map(e=>e.name));return s.filter(t=>e.has(t))},[s,i]),_=new Set(g),v=g.length===i.length&&i.length>0,y=e=>{e&&u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},x=(e,t)=>{u(n=>{if(t){let t=e.filter(e=>!n.includes(e));return[...n,...t]}else return n.filter(t=>!e.includes(t))})},ee=()=>{let e=i.map(e=>e.name);n(g.length===e.length&&e.every(e=>g.includes(e))?void 0:g)},S=(0,M.useMemo)(()=>{let e=_r(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{Ke(n)?t.mcp.push(n):e.READ_ONLY.toolNames.has(n.name)?t.readOnly.push(n):e.EDIT.toolNames.has(n.name)?t.edit.push(n):e.EXECUTION.toolNames.has(n.name)?t.execution.push(n):n.name!==`Agent`&&t.other.push(n)}),t},[i]),te=e=>{let t=b(e,e=>_.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);x(n,t)}},C=[];C.push({id:`continue`,label:`Continue`,action:ee,isContinue:!0}),C.push({id:`bucket-all`,label:`${v?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);x(e,!v)}});let re=_r();[{id:`bucket-readonly`,name:re.READ_ONLY.name,tools:S.readOnly},{id:`bucket-edit`,name:re.EDIT.name,tools:S.edit},{id:`bucket-execution`,name:re.EXECUTION.name,tools:S.execution},{id:`bucket-mcp`,name:re.MCP.name,tools:S.mcp},{id:`bucket-other`,name:re.OTHER.name,tools:S.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=b(n,e=>_.has(e.name))===n.length;C.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:te(n)})});let ie=C.length;C.push({id:`toggle-individual`,label:m?`Hide advanced options`:`Show advanced options`,action:()=>{h(!m),m&&f>ie&&p(ie)},isToggle:!0});let ae=(0,M.useMemo)(()=>vr(i),[i]);return m&&(ae.length>0&&(C.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),ae.forEach(({serverName:e,tools:t})=>{let n=b(t,e=>_.has(e.name))===t.length;C.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${It(t.length,`tool`)})`,action:()=>{let e=t.map(e=>e.name);x(e,!n)}})}),C.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=ne(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}C.push({id:`tool-${e.name}`,label:`${_.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>y(e.name)})})),d(`confirm:no`,(0,M.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,N.jsxs)(c,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=C[f];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=f-1;for(;t>0&&C[t]?.isHeader;)t--;p(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=f+1;for(;t<C.length-1&&C[t]?.isHeader;)t++;p(Math.min(C.length-1,t))}},children:[(0,N.jsxs)(l,{color:f===0?`suggestion`:void 0,bold:f===0,children:[f===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,N.jsx)(o,{width:40}),C.slice(1).map((e,t)=>{let n=t+1===f,r=e.isToggle,i=e.isHeader;return(0,N.jsxs)(M.Fragment,{children:[r&&(0,N.jsx)(o,{width:40}),i&&t>0&&(0,N.jsx)(c,{marginTop:1}),(0,N.jsxs)(l,{color:i?void 0:n?`suggestion`:void 0,dimColor:i,bold:r&&n,children:[i?``:n?`${a.pointer} `:` `,r?`[ ${e.label} ]`:e.label]})]},e.id)}),(0,N.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,N.jsx)(l,{dimColor:!0,children:v?`All tools selected`:`${_.size} of ${i.length} tools selected`})})]})}var M,N,br=e((()=>{i(),M=t(f(),1),te(),oe(),He(),x(),Ve(),Re(),Ae(),fe(),_t(),De(),Me(),ye(),Qe(),dt(),ge(),gt(),xe(),h(),E(),v(),Rt(),N=_()}));function xr(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:Kn(ee(e))}var Sr=e((()=>{qn(),S()}));function Cr({agent:e,tools:t,onSaved:n,onBack:r}){let i=we(),[o,s]=(0,P.useState)(`menu`),[u,f]=(0,P.useState)(0),[m,h]=(0,P.useState)(null),[g,_]=(0,P.useState)(e.color),v=(0,P.useCallback)(async()=>{let t=await cn($n(e));t.error?h(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),y=(0,P.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??g,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!We(e)&&!$e(e)?!1:(await ir(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&me(e.agentType,s),i(t=>{let n=t.agentDefinitions.allAgents.map(t=>t.agentType===e.agentType?{...t,tools:r??t.tools,color:s,model:o??t.model}:t);return{...t,agentDefinitions:{...t.agentDefinitions,activeAgents:at(n),allAgents:n}}}),n(`Updated agent: ${p.bold(e.agentType)}`),!0)}catch(e){return h(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,g,n,i]),b=(0,P.useMemo)(()=>[{label:`Open in editor`,action:v},{label:`Edit tools`,action:()=>s(`edit-tools`)},{label:`Edit model`,action:()=>s(`edit-model`)},{label:`Edit color`,action:()=>s(`edit-color`)}],[v]),x=(0,P.useCallback)(()=>{h(null),o===`menu`?r():s(`menu`)},[o,r]),ee=(0,P.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),f(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),f(e=>Math.min(b.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=b[u];t&&t.action()}},[b,u]);d(`confirm:no`,x,{context:`Confirmation`});let S=()=>(0,F.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ee,children:[(0,F.jsxs)(l,{dimColor:!0,children:[`Source: `,xr(e.source)]}),(0,F.jsx)(c,{marginTop:1,flexDirection:`column`,children:b.map((e,t)=>(0,F.jsxs)(l,{color:t===u?`suggestion`:void 0,children:[t===u?`${a.pointer} `:` `,e.label]},e.label))}),m&&(0,F.jsx)(c,{marginTop:1,children:(0,F.jsx)(l,{color:`error`,children:m})})]});switch(o){case`menu`:return S();case`edit-tools`:return(0,F.jsx)(yr,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await y({tools:e})}});case`edit-color`:return(0,F.jsx)(ur,{agentName:e.agentType,currentColor:g||e.color||`automatic`,onConfirm:async e=>{_(e),s(`menu`),await y({color:e})}});case`edit-model`:return(0,F.jsx)(pr,{initialModel:e.model,onComplete:async e=>{s(`menu`),await y({model:e})}});default:return null}}var P,F,wr=e((()=>{m(),i(),P=t(f(),1),ht(),h(),E(),Ie(),rt(),sn(),sr(),fr(),gr(),br(),Sr(),F=_()}));function Tr({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Yt();return(0,Er.jsx)(c,{marginLeft:2,children:(0,Er.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Er,Dr=e((()=>{Xt(),h(),Er=_()}));function Or({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:s}){let[u,d]=kr.useState(null),[f,p]=kr.useState(!0),m=kr.useMemo(()=>[...t].sort(Gt),[t]),h=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),_=()=>(0,I.jsxs)(c,{children:[(0,I.jsx)(l,{color:f?`suggestion`:void 0,children:f?`${a.pointer} `:` `}),(0,I.jsx)(l,{color:f?`suggestion`:void 0,children:`Create new agent`})]}),v=e=>{let t=e.source===`built-in`,n=!t&&!f&&u?.agentType===e.agentType&&u?.source===e.source,{isOverridden:r,overriddenBy:i}=h(e),o=t||r,s=!t&&n?`suggestion`:void 0,d=Ut(e);return(0,I.jsxs)(c,{children:[(0,I.jsx)(l,{dimColor:o&&!n,color:s,children:t?``:n?`${a.pointer} `:` `}),(0,I.jsx)(l,{dimColor:o&&!n,color:s,children:e.agentType}),d&&(0,I.jsxs)(l,{dimColor:!0,color:s,children:[` · `,d]}),e.memory&&(0,I.jsxs)(l,{dimColor:!0,color:s,children:[` · `,e.memory,` memory`]}),i&&(0,I.jsxs)(l,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,qt(i)]})]},`${e.agentType}-${e.source}`)},y=kr.useMemo(()=>{let t=m.filter(e=>e.source!==`built-in`);return e===`all`?Jt.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[m,e]);kr.useEffect(()=>{!u&&!f&&y.length>0&&(i?p(!0):d(y[0]||null))},[y,u,f,i]);let x=e=>{if(e.key===`return`){e.preventDefault(),f&&i?i():u&&r(u);return}if(e.key!==`up`&&e.key!==`down`)return;e.preventDefault();let t=!!i,n=y.length+ +!!t;if(n===0)return;let a=0;if(!f&&u){let e=y.findIndex(e=>e.agentType===u.agentType&&e.source===u.source);e>=0&&(a=t?e+1:e)}let o=e.key===`up`?a===0?n-1:a-1:a===n-1?0:a+1;if(t&&o===0)p(!0),d(null);else{let e=t?o-1:o,n=y[e];n&&(p(!1),d(n))}},ee=(e=`Built-in (always available):`)=>{let t=m.filter(e=>e.source===`built-in`);return(0,I.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,I.jsx)(l,{bold:!0,dimColor:!0,children:e}),t.map(v)]})},S=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,I.jsxs)(c,{flexDirection:`column`,marginBottom:1,children:[(0,I.jsxs)(c,{paddingLeft:2,children:[(0,I.jsx)(l,{bold:!0,dimColor:!0,children:e}),n&&(0,I.jsxs)(l,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>v(e))]})},te=xr(e),C=m.filter(e=>e.source===`built-in`);return!m.length||e!==`built-in`&&!m.some(e=>e.source!==`built-in`)?(0,I.jsx)(g,{title:te,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,I.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:x,children:[i&&(0,I.jsx)(c,{children:_()}),(0,I.jsx)(l,{dimColor:!0,children:`No agents found. Create specialized subagents that Work Mate can delegate to.`}),(0,I.jsx)(l,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,I.jsx)(l,{dimColor:!0,children:`Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer.`}),e!==`built-in`&&m.some(e=>e.source===`built-in`)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o,{}),ee()]})]})}):(0,I.jsxs)(g,{title:te,subtitle:`${b(m,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[s&&s.length>0&&(0,I.jsx)(c,{marginTop:1,children:(0,I.jsx)(l,{dimColor:!0,children:s[s.length-1]})}),(0,I.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:x,children:[i&&(0,I.jsx)(c,{marginBottom:1,children:_()}),e===`all`?(0,I.jsxs)(I.Fragment,{children:[Jt.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,I.jsx)(kr.Fragment,{children:S(e,m.filter(e=>e.source===t))},t)),C.length>0&&(0,I.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,I.jsxs)(l,{dimColor:!0,children:[(0,I.jsx)(l,{bold:!0,children:`Built-in agents`}),` (always available)`]}),C.map(v)]})]}):e===`built-in`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(l,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,I.jsx)(c,{marginTop:1,flexDirection:`column`,children:m.map(e=>v(e))})]}):(0,I.jsxs)(I.Fragment,{children:[m.filter(e=>e.source!==`built-in`).map(e=>v(e)),m.some(e=>e.source===`built-in`)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o,{}),ee()]})]})]})]})}var kr,I,Ar=e((()=>{i(),kr=t(f(),1),h(),Wt(),v(),Sr(),I=_()}));function jr({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,L.useState)(0),[l,u]=(0,L.useState)(t),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)([]);Yt(),(0,L.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,L.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,L.useCallback)(()=>{if(p.length>0){let e=p[p.length-1];e!==void 0&&(m(e=>e.slice(0,-1)),c(e))}else s>0?c(e=>e-1):r&&r()},[s,p,r]),_=(0,L.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,L.useCallback)(()=>{m([]),r&&r()},[r]),y=(0,L.useCallback)(e=>{u(t=>({...t,...e}))},[]),b=(0,L.useMemo)(()=>({currentStepIndex:s,totalSteps:e.length,wizardData:l,setWizardData:u,updateWizardData:y,goNext:h,goBack:g,goToStep:_,cancel:v,title:a,showStepCounter:o}),[s,e.length,l,y,h,g,_,v,a,o]),x=e[s];return!x||d?null:(0,Mr.jsx)(Nr.Provider,{value:b,children:i||(0,Mr.jsx)(x,{})})}var L,Mr,Nr,Pr=e((()=>{L=t(f(),1),Xt(),Mr=_(),Nr=(0,L.createContext)(null)}));function R(){let e=(0,Fr.useContext)(Nr);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var Fr,Ir=e((()=>{Fr=t(f(),1),Pr()}));function Lr({instructions:e=(0,z.jsxs)(u,{children:[(0,z.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,z.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,z.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Yt();return(0,z.jsx)(c,{marginLeft:3,marginTop:1,children:(0,z.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var z,Rr=e((()=>{Xt(),h(),w(),z=_()}));function B({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=R();return(0,zr.jsxs)(zr.Fragment,{children:[(0,zr.jsx)(g,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,zr.jsx)(Lr,{instructions:i})]})}var zr,V=e((()=>{h(),Ir(),Rr(),zr=_()})),H=e((()=>{Ir(),V(),Rr(),Pr()}));function Br(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R();return d(`confirm:no`,t,{context:`Confirmation`}),(0,U.jsx)(B,{subtitle:`Choose background color`,footerText:(0,U.jsxs)(u,{children:[(0,U.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,U.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,U.jsx)(c,{children:(0,U.jsx)(ur,{agentName:r.agentType||`agent`,currentColor:`automatic`,onConfirm:t=>{n({selectedColor:t,finalAgent:{agentType:r.agentType,whenToUse:r.whenToUse,getSystemPrompt:()=>r.systemPrompt,tools:r.selectedTools,...r.selectedModel?{model:r.selectedModel}:{},...t?{color:t}:{},source:r.location}}),e()}})})})}var U,Vr=e((()=>{h(),E(),w(),H(),V(),fr(),U=_()}));function Hr(e){return e?/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(e)?e.length<3?`Agent type must be at least 3 characters long`:e.length>50?`Agent type must be less than 50 characters`:null:`Agent type must start and end with alphanumeric characters and contain only letters, numbers, and hyphens`:`Agent type is required`}function Ur(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=Hr(e.agentType);t&&r.push(t);let i=n.find(t=>t.agentType===e.agentType&&t.source!==e.source);i&&r.push(`Agent type "${e.agentType}" already exists in ${xr(i.source)}`)}if(e.whenToUse?e.whenToUse.length<10?i.push(`Description should be more descriptive (at least 10 characters)`):e.whenToUse.length>5e3&&i.push(`Description is very long (over 5000 characters)`):r.push(`Description (description) is required`),e.tools!==void 0&&!Array.isArray(e.tools))r.push(`Tools must be an array`);else{e.tools===void 0?i.push(`Agent has access to all tools`):e.tools.length===0&&i.push(`No tools selected - agent will have very limited capabilities`);let n=ut(e,t,!1);n.invalidTools.length>0&&r.push(`Invalid tools: ${n.invalidTools.join(`, `)}`)}let a=e.getSystemPrompt();return a?a.length<20?r.push(`System prompt is too short (minimum 20 characters)`):a.length>1e4&&i.push(`System prompt is very long (over 10,000 characters)`):r.push(`System prompt is required`),{isValid:r.length===0,errors:r,warnings:i}}var Wr=e((()=>{He(),Sr()}));function Gr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=R();d(`confirm:no`,a,{context:`Confirmation`});let f=e=>{e.key===`s`||e.key===`return`?(e.preventDefault(),n()):e.key===`e`&&(e.preventDefault(),r())},p=o.finalAgent,m=Ur(p,e,t),h=Pt(p.getSystemPrompt(),240),g=Pt(p.whenToUse,240),_=e=>e===void 0?`All tools`:e.length===0?`None`:e.length===1?e[0]||`None`:e.length===2?e.join(` and `):`${e.slice(0,-1).join(`, `)}, and ${e[e.length-1]}`,v=At()?(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Memory`}),`: `,Je(p.memory)]}):null;return(0,W.jsx)(B,{subtitle:`Confirm and save`,footerText:(0,W.jsxs)(u,{children:[(0,W.jsx)(s,{shortcut:`s/Enter`,action:`save`}),(0,W.jsx)(s,{shortcut:`e`,action:`edit in your editor`}),(0,W.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,W.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Name`}),`: `,p.agentType]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Location`}),`:`,` `,er({source:o.location,agentType:p.agentType})]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Tools`}),`: `,_(p.tools)]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Model`}),`: `,_e(p.model)]}),v,(0,W.jsx)(c,{marginTop:1,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]})}),(0,W.jsx)(c,{marginLeft:2,marginTop:1,children:(0,W.jsx)(l,{children:g})}),(0,W.jsx)(c,{marginTop:1,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,W.jsx)(c,{marginLeft:2,marginTop:1,children:(0,W.jsx)(l,{children:h})}),m.warnings.length>0&&(0,W.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(l,{color:`warning`,children:`Warnings:`}),m.warnings.map((e,t)=>(0,W.jsxs)(l,{dimColor:!0,children:[` `,`• `,e]},t))]}),m.errors.length>0&&(0,W.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(l,{color:`error`,children:`Errors:`}),m.errors.map((e,t)=>(0,W.jsxs)(l,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,W.jsx)(c,{marginTop:1,children:(0,W.jsx)(l,{color:`error`,children:i})}),(0,W.jsx)(c,{marginTop:2,children:(0,W.jsxs)(l,{color:`success`,children:[`Press `,(0,W.jsx)(l,{bold:!0,children:`s`}),` or `,(0,W.jsx)(l,{bold:!0,children:`Enter`}),` to save, `,(0,W.jsx)(l,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var W,Kr=e((()=>{h(),E(),kt(),it(),Ft(),ce(),w(),H(),V(),sr(),Wr(),W=_()}));function qr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=R(),[i,a]=(0,Jr.useState)(null),o=we(),s=(0,Jr.useCallback)(async e=>{if(r?.finalAgent)try{await rr(r.location,r.finalAgent.agentType,r.finalAgent.whenToUse,r.finalAgent.tools,r.finalAgent.getSystemPrompt(),!0,r.finalAgent.color,r.finalAgent.model,r.finalAgent.memory),o(e=>{if(!r.finalAgent)return e;let t=e.agentDefinitions.allAgents.concat(r.finalAgent);return{...e,agentDefinitions:{...e.agentDefinitions,activeAgents:at(t),allAgents:t}}}),st(),e&&await cn(Qn({source:r.location,agentType:r.finalAgent.agentType})),r.finalAgent.agentType,r.wasGenerated,r.location,r.finalAgent.tools?.length,r.finalAgent.model,r.finalAgent.color,r.finalAgent.memory,r.finalAgent.memory,{...e?{opened_in_editor:!0}:{}},n(e?`Created agent: ${p.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${p.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,Yr.jsx)(Gr,{tools:e,existingAgents:t,onSave:(0,Jr.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,Jr.useCallback)(()=>s(!0),[s]),error:i})}var Jr,Yr,Xr=e((()=>{m(),Jr=t(f(),1),Nt(),ht(),rt(),sn(),H(),sr(),Kr(),Yr=_()}));function Zr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R(),[i,a]=(0,Qr.useState)(r.whenToUse||``),[o,f]=(0,Qr.useState)(i.length),[p,m]=(0,Qr.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,Qr.useCallback)(async()=>{let e=await on(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,G.jsx)(B,{subtitle:`Description (tell Work Mate when to use this agent)`,footerText:(0,G.jsxs)(u,{children:[(0,G.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,G.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,G.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,G.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,G.jsxs)(c,{flexDirection:`column`,children:[(0,G.jsx)(l,{children:`When should Work Mate use this agent?`}),(0,G.jsx)(c,{marginTop:1,children:(0,G.jsx)(Qt,{value:i,onChange:a,onSubmit:t=>{let r=t.trim();if(!r){m(`Description is required`);return}m(null),n({whenToUse:r}),e()},placeholder:`e.g., use this agent after you're done writing code...`,columns:80,cursorOffset:o,onChangeCursorOffset:f,focus:!0,showCursor:!0})}),p&&(0,G.jsx)(c,{marginTop:1,children:(0,G.jsx)(l,{color:`error`,children:p})})]})})}var Qr,G,$r=e((()=>{Qr=t(f(),1),h(),E(),sn(),w(),Zt(),H(),V(),G=_()}));async function ei(e,t,n,r){let i=se({content:`Create an agent configuration based on this request: "${e}".${n.length>0?`\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${n.join(`, `)}`:``}
|
|
8
|
+
Return ONLY the JSON object, no other text.`}),a=await Se(),o=nt([i],a),s=At()?ti+ni:ti,c=await Ne({messages:lt(o),systemPrompt:Ce([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>zt(),model:t,toolChoice:void 0,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,querySource:`agent_creation`,mcpTools:[]}}),l=(Array.isArray(c.message.content)?c.message.content:[]).filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
9
|
+
`),u;try{u=Tt(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=Tt(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return u.identifier,{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var ti,ni,ri=e((()=>{Te(),Be(),Bt(),x(),qe(),Ee(),kt(),Nt(),Ot(),ct(),ti=`You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
|
|
10
|
+
|
|
11
|
+
**Important Context**: You may have access to project-specific instructions from AGENTS.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
|
|
12
|
+
|
|
13
|
+
When a user describes what they want an agent to do, you will:
|
|
14
|
+
|
|
15
|
+
1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from AGENTS.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
|
|
16
|
+
|
|
17
|
+
2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
|
|
18
|
+
|
|
19
|
+
3. **Architect Comprehensive Instructions**: Develop a system prompt that:
|
|
20
|
+
- Establishes clear behavioral boundaries and operational parameters
|
|
21
|
+
- Provides specific methodologies and best practices for task execution
|
|
22
|
+
- Anticipates edge cases and provides guidance for handling them
|
|
23
|
+
- Incorporates any specific requirements or preferences mentioned by the user
|
|
24
|
+
- Defines output format expectations when relevant
|
|
25
|
+
- Aligns with project-specific coding standards and patterns from AGENTS.md
|
|
26
|
+
|
|
27
|
+
4. **Optimize for Performance**: Include:
|
|
28
|
+
- Decision-making frameworks appropriate to the domain
|
|
29
|
+
- Quality control mechanisms and self-verification steps
|
|
30
|
+
- Efficient workflow patterns
|
|
31
|
+
- Clear escalation or fallback strategies
|
|
32
|
+
|
|
33
|
+
5. **Create Identifier**: Design a concise, descriptive identifier that:
|
|
34
|
+
- Uses lowercase letters, numbers, and hyphens only
|
|
35
|
+
- Is typically 2-4 words joined by hyphens
|
|
36
|
+
- Clearly indicates the agent's primary function
|
|
37
|
+
- Is memorable and easy to type
|
|
38
|
+
- Avoids generic terms like "helper" or "assistant"
|
|
39
|
+
|
|
40
|
+
6 **Example agent descriptions**:
|
|
41
|
+
- in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
|
|
42
|
+
- examples should be of the form:
|
|
43
|
+
- <example>
|
|
44
|
+
Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
|
|
45
|
+
user: "Please write a function that checks if a number is prime"
|
|
46
|
+
assistant: "Here is the relevant function: "
|
|
47
|
+
<function call omitted for brevity only for this example>
|
|
48
|
+
<commentary>
|
|
49
|
+
Since a significant piece of code was written, use the ${y} tool to launch the test-runner agent to run the tests.
|
|
50
|
+
</commentary>
|
|
51
|
+
assistant: "Now let me use the test-runner agent to run the tests"
|
|
52
|
+
</example>
|
|
53
|
+
- <example>
|
|
54
|
+
Context: User is creating an agent to respond to the word "hello" with a friendly jok.
|
|
55
|
+
user: "Hello"
|
|
56
|
+
assistant: "I'm going to use the ${y} tool to launch the greeting-responder agent to respond with a friendly joke"
|
|
57
|
+
<commentary>
|
|
58
|
+
Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
|
|
59
|
+
</commentary>
|
|
60
|
+
</example>
|
|
61
|
+
- If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
|
|
62
|
+
- NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
|
|
63
|
+
|
|
64
|
+
Your output must be a valid JSON object with exactly these fields:
|
|
65
|
+
{
|
|
66
|
+
"identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
|
|
67
|
+
"whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
|
|
68
|
+
"systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Key principles for your system prompts:
|
|
72
|
+
- Be specific rather than generic - avoid vague instructions
|
|
73
|
+
- Include concrete examples when they would clarify behavior
|
|
74
|
+
- Balance comprehensiveness with clarity - every instruction should add value
|
|
75
|
+
- Ensure the agent has enough context to handle variations of the core task
|
|
76
|
+
- Make the agent proactive in seeking clarification when needed
|
|
77
|
+
- Build in quality assurance and self-correction mechanisms
|
|
78
|
+
|
|
79
|
+
Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
|
|
80
|
+
`,ni=`
|
|
81
|
+
|
|
82
|
+
7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.
|
|
83
|
+
|
|
84
|
+
Add a section like this to the systemPrompt, tailored to the agent's specific domain:
|
|
85
|
+
|
|
86
|
+
"**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
|
|
87
|
+
|
|
88
|
+
Examples of what to record:
|
|
89
|
+
- [domain-specific item 1]
|
|
90
|
+
- [domain-specific item 2]
|
|
91
|
+
- [domain-specific item 3]"
|
|
92
|
+
|
|
93
|
+
Examples of domain-specific memory instructions:
|
|
94
|
+
- For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
|
|
95
|
+
- For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
|
|
96
|
+
- For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
|
|
97
|
+
- For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
|
|
98
|
+
|
|
99
|
+
The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
|
|
100
|
+
`}));function ii(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=R(),[i,a]=(0,K.useState)(r.generationPrompt||``),[o,s]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(i.length),g=ln(),_=(0,K.useRef)(null);d(`confirm:no`,(0,K.useCallback)(()=>{_.current&&(_.current.abort(),_.current=null,s(!1),p(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),d(`chat:externalEditor`,(0,K.useCallback)(async()=>{let e=await on(i);e.content!==null&&(a(e.content),h(e.content.length))},[i]),{context:`Chat`,isActive:!o}),d(`confirm:no`,(0,K.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),p(null),t()},[e,t]),{context:`Settings`,isActive:!o});let v=async()=>{let t=i.trim();if(!t){p(`Please describe what the agent should do`);return}p(null),s(!0),e({generationPrompt:t,isGenerating:!0});let r=vt();_.current=r;try{let i=await ei(t,g,[],r.signal);e({agentType:i.identifier,whenToUse:i.whenToUse,systemPrompt:i.systemPrompt,generatedAgent:i,isGenerating:!1,wasGenerated:!0}),n(6)}catch(t){t instanceof Dt||t instanceof Error&&!t.message.includes(`No assistant message found`)&&p(t.message||`Failed to generate agent`),e({isGenerating:!1})}finally{s(!1),_.current=null}},y=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,q.jsx)(B,{subtitle:y,footerText:(0,q.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,q.jsxs)(c,{flexDirection:`row`,alignItems:`center`,children:[(0,q.jsx)(nn,{}),(0,q.jsx)(l,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,q.jsx)(B,{subtitle:y,footerText:(0,q.jsxs)(u,{children:[(0,q.jsx)(T,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,q.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,q.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,q.jsxs)(c,{flexDirection:`column`,children:[f&&(0,q.jsx)(c,{marginBottom:1,children:(0,q.jsx)(l,{color:`error`,children:f})}),(0,q.jsx)(Qt,{value:i,onChange:a,onSubmit:v,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:m,onChangeCursorOffset:h,focus:!0,showCursor:!0})]})})}var K,q,ai=e((()=>{St(),K=t(f(),1),un(),h(),E(),de(),sn(),w(),tn(),Zt(),H(),V(),ri(),q=_()}));function oi(){let{goNext:e,updateWizardData:t,cancel:n}=R();return(0,J.jsx)(B,{subtitle:`Choose location`,footerText:(0,J.jsxs)(u,{children:[(0,J.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,J.jsx)(c,{children:(0,J.jsx)(en,{options:[{label:`Project (.workmate/agents/)`,value:`projectSettings`},{label:`Personal (~/.workmate/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var J,si=e((()=>{h(),w(),$t(),H(),V(),J=_()}));function ci(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R();d(`confirm:no`,t,{context:`Confirmation`});let i=r.location===`userSettings`?[{label:`User scope (~/.workmate/agent-memory/) (Recommended)`,value:`user`},{label:`None (no persistent memory)`,value:`none`},{label:`Project scope (.workmate/agent-memory/)`,value:`project`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}]:[{label:`Project scope (.workmate/agent-memory/) (Recommended)`,value:`project`},{label:`None (no persistent memory)`,value:`none`},{label:`User scope (~/.workmate/agent-memory/)`,value:`user`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}];return(0,Y.jsx)(B,{subtitle:`Configure agent memory`,footerText:(0,Y.jsxs)(u,{children:[(0,Y.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Y.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsx)(c,{children:(0,Y.jsx)(en,{options:i,onChange:t=>{let i=t===`none`?void 0:t,a=r.finalAgent?.agentType;n({selectedMemory:i,finalAgent:r.finalAgent?{...r.finalAgent,memory:i,getSystemPrompt:At()&&i&&a?()=>`${r.systemPrompt}\n\n${tt(a,i)}`:()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Y,li=e((()=>{h(),E(),kt(),it(),w(),$t(),H(),V(),Y=_()}));function ui(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=R();return(0,X.jsx)(B,{subtitle:`Creation method`,footerText:(0,X.jsxs)(u,{children:[(0,X.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsx)(c,{children:(0,X.jsx)(en,{options:[{label:`Generate with Work Mate (recommended)`,value:`generate`},{label:`Manual configuration`,value:`manual`}],onChange:t=>{let i=t;n({method:i,wasGenerated:i===`generate`}),i===`generate`?e():r(3)},onCancel:()=>t()},`method-select`)})})}var X,di=e((()=>{h(),w(),$t(),H(),V(),X=_()}));function fi(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R();return(0,pi.jsx)(B,{subtitle:`Select model`,footerText:(0,pi.jsxs)(u,{children:[(0,pi.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,pi.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,pi.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,pi.jsx)(pr,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var pi,mi=e((()=>{w(),h(),H(),V(),gr(),pi=_()}));function hi(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R(),[i,a]=(0,gi.useState)(r.systemPrompt||``),[o,f]=(0,gi.useState)(i.length),[p,m]=(0,gi.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,gi.useCallback)(async()=>{let e=await on(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(B,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(u,{children:[(0,Z.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(c,{flexDirection:`column`,children:[(0,Z.jsx)(l,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(l,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(c,{marginTop:1,children:(0,Z.jsx)(Qt,{value:i,onChange:a,onSubmit:()=>{let t=i.trim();if(!t){m(`System prompt is required`);return}m(null),n({systemPrompt:t}),e()},placeholder:`You are a helpful code reviewer who...`,columns:80,cursorOffset:o,onChangeCursorOffset:f,focus:!0,showCursor:!0})}),p&&(0,Z.jsx)(c,{marginTop:1,children:(0,Z.jsx)(l,{color:`error`,children:p})})]})})}var gi,Z,_i=e((()=>{gi=t(f(),1),h(),E(),sn(),w(),Zt(),H(),V(),Z=_()}));function vi({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=R(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,yi.jsx)(B,{subtitle:`Select tools`,footerText:(0,yi.jsxs)(u,{children:[(0,yi.jsx)(s,{shortcut:`Enter`,action:`toggle selection`}),(0,yi.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,yi.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,yi.jsx)(yr,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var yi,bi=e((()=>{h(),w(),H(),V(),br(),yi=_()}));function xi(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=R(),[a,o]=(0,Si.useState)(i.agentType||``),[f,p]=(0,Si.useState)(null),[m,h]=(0,Si.useState)(a.length);return d(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(B,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(u,{children:[(0,Q.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(c,{flexDirection:`column`,children:[(0,Q.jsx)(l,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(Qt,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=Hr(n);if(i){p(i);return}p(null),r({agentType:n}),t()},placeholder:`e.g., test-runner, tech-lead, etc`,columns:60,cursorOffset:m,onChangeCursorOffset:h,focus:!0,showCursor:!0})}),f&&(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(l,{color:`error`,children:f})})]})})}var Si,Q,Ci=e((()=>{Si=t(f(),1),h(),E(),w(),Zt(),H(),V(),Wr(),Q=_()}));function wi({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Ti.jsx)(jr,{steps:[oi,ui,ii,()=>(0,Ti.jsx)(xi,{existingAgents:t}),hi,Zr,()=>(0,Ti.jsx)(vi,{tools:e}),fi,Br,...At()?[ci]:[],()=>(0,Ti.jsx)(qr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Ti,Ei=e((()=>{kt(),H(),Vr(),Xr(),$r(),ai(),si(),li(),di(),mi(),_i(),bi(),Ci(),Ti=_()}));function Di({tools:e,onExit:t}){let[n,r]=(0,Oi.useState)({mode:`list-agents`,source:`all`}),i=ue(e=>e.agentDefinitions),a=ue(e=>e.mcp.tools),o=ue(e=>e.toolPermissionContext),s=we(),{allAgents:u,activeAgents:d}=i,[f,m]=(0,Oi.useState)([]),h=rn(e,a,o);Yt();let _=(0,Oi.useMemo)(()=>({"built-in":u.filter(e=>e.source===`built-in`),userSettings:u.filter(e=>e.source===`userSettings`),projectSettings:u.filter(e=>e.source===`projectSettings`),policySettings:u.filter(e=>e.source===`policySettings`),localSettings:u.filter(e=>e.source===`localSettings`),flagSettings:u.filter(e=>e.source===`flagSettings`),plugin:u.filter(e=>e.source===`plugin`),all:u}),[u]),v=(0,Oi.useCallback)(e=>{m(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),y=(0,Oi.useCallback)(async e=>{try{await ar(e),s(t=>{let n=t.agentDefinitions.allAgents.filter(t=>!(t.agentType===e.agentType&&t.source===e.source));return{...t,agentDefinitions:{...t.agentDefinitions,allAgents:n,activeAgents:at(n)}}}),m(t=>[...t,`Deleted agent: ${p.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Mt(Et(e))}},[s]);switch(n.mode){case`list-agents`:{let e=Kt(n.source===`all`?[..._[`built-in`],..._.userSettings,..._.projectSettings,..._.localSettings,..._.policySettings,..._.flagSettings,..._.plugin]:_[n.source],d);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Or,{source:n.source,agents:e,onBack:()=>{t((f.length>0?`Agent changes:\n${f.join(`
|
|
101
|
+
`)}`:void 0)??`Agents dialog dismissed`,{display:f.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:f}),(0,$.jsx)(Tr,{})]})}case`create-agent`:return(0,$.jsx)(wi,{tools:h,existingAgents:d,onComplete:v,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent,t=[{label:`View agent`,value:`view`},...e.source!==`built-in`&&e.source!==`plugin`&&e.source!==`flagSettings`?[{label:`Edit agent`,value:`edit`},{label:`Delete agent`,value:`delete`}]:[],{label:`Back`,value:`back`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(c,{flexDirection:`column`,children:[(0,$.jsx)(en,{options:t,onChange:t=>{switch(t){case`view`:r({mode:`view-agent`,agent:e,previousMode:n.previousMode});break;case`edit`:r({mode:`edit-agent`,agent:e,previousMode:n});break;case`delete`:r({mode:`delete-confirm`,agent:e,previousMode:n});break;case`back`:r(n.previousMode);break}},onCancel:()=>r(n.previousMode)}),f.length>0&&(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(l,{dimColor:!0,children:f[f.length-1]})})]})}),(0,$.jsx)(Tr,{})]})}case`view-agent`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(cr,{agent:e,tools:h,allAgents:u,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(Tr,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(g,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(l,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(l,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(c,{marginTop:1,children:(0,$.jsxs)(l,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(en,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?y(n.agent):`previousMode`in n&&r(n.previousMode)},onCancel:()=>{`previousMode`in n&&r(n.previousMode)}})})]}),(0,$.jsx)(Tr,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(Cr,{agent:e,tools:h,onSaved:e=>{v(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Tr,{})]})}default:return null}}var Oi,$,ki=e((()=>{m(),Oi=t(f(),1),Xt(),an(),h(),ht(),Wt(),rt(),Ct(),jt(),$t(),lr(),wr(),Dr(),Ar(),sr(),Ei(),$=_()}));async function Ai(e,t){let n=t.getAppState().toolPermissionContext;return(0,ji.jsx)(Di,{tools:ve(n),onExit:e})}var ji;e((()=>{ki(),he(),ji=_()}))();export{Ai as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,m as n}from"./settings-D4M13toi.js";import{cf as r,uf as i}from"./loadAgentsDir-uuZYOgKn.js";function a(){let e=t(),n=[`user`,`project`,`local`].flatMap(e=>r(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{i(),n()}));export{o as n,a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,h as n,o as r}from"./config-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,h as n,o as r}from"./config-BDn2YIjC.js";import{o as i,s as a}from"./log-L1kqxa_P.js";import{i as o,t as s}from"./execFileNoThrow-DXSEj8ZO.js";import{homedir as c}from"os";import{join as l}from"path";import{stat as u}from"fs/promises";function d(e){n(t=>({...t,appleTerminalSetupInProgress:!0,appleTerminalBackupPath:e}))}function f(){n(e=>({...e,appleTerminalSetupInProgress:!1}))}function p(){let e=r();return{inProgress:e.appleTerminalSetupInProgress??!1,backupPath:e.appleTerminalBackupPath||null}}function m(){return l(c(),`Library`,`Preferences`,`com.apple.Terminal.plist`)}async function h(){let e=m(),t=`${e}.bak`;try{let{code:n}=await s(`defaults`,[`export`,`com.apple.Terminal`,e]);if(n!==0)return null;try{await u(e)}catch{return null}return await s(`defaults`,[`export`,`com.apple.Terminal`,t]),d(t),t}catch(e){return a(e),null}}async function g(){let{inProgress:e,backupPath:t}=p();if(!e)return{status:`no_backup`};if(!t)return f(),{status:`no_backup`};try{await u(t)}catch{return f(),{status:`no_backup`}}try{let{code:e}=await s(`defaults`,[`import`,`com.apple.Terminal`,t]);return e===0?(await s(`killall`,[`cfprefsd`]),f(),{status:`restored`}):{status:`failed`,backupPath:t}}catch(e){return a(Error(`Failed to restore Terminal.app settings with: ${e}`)),f(),{status:`failed`,backupPath:t}}}var _=e((()=>{t(),o(),i()}));export{f as a,_ as i,g as n,m as r,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./backgroundHousekeeping-BtEJ6TeC.js";export{e as startBackgroundHousekeeping};
|
package/dist/chunks/{backgroundHousekeeping-PyLNnGdw.js → backgroundHousekeeping-BtEJ6TeC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,o as t}from"./envUtils-
|
|
1
|
+
import{i as e,o as t}from"./envUtils-QyzA_cFM.js";import{_ as n,d as r,m as i}from"./settings-D4M13toi.js";import{P as a,Pt as o,z as s}from"./state-CXY-q5gr.js";import{Fu as c,Ru as l,St as u,db as d,ft as f,gr as p,ic as m,or as h,pb as g,rc as _}from"./loadAgentsDir-uuZYOgKn.js";import{c as v,f as y,i as b,u as x}from"./debug-2pVES-2G.js";import{_ as S,o as C,s as w,v as T}from"./log-L1kqxa_P.js";import{n as E}from"./analytics-COpjZpvd.js";import{r as D,t as O}from"./pasteStore-njJCBMKr.js";import{r as k}from"./magicDocs-D53lV8b5.js";import{i as A,t as j}from"./nativeInstaller-CIUYh1aD.js";import{n as M,t as N}from"./allErrors-DvcU0w0F.js";import{n as P,t as F}from"./pluginAutoupdate-CNrHb4RJ.js";import{join as I}from"path";o(),m(),k(),E(),T(),b(),t(),y(),l(),C(),D(),p(),M(),i(),g(),u();var L=30;function R(){let e=((r()||{}).cleanupPeriodDays??L)*24*60*60*1e3;return new Date(Date.now()-e)}function z(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function B(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function V(e,t,n){let r={messages:0,errors:0};try{let i=await x().readdir(e);for(let a of i)try{B(a.name)<t&&(await x().unlink(I(e,a.name)),n?r.messages++:r.errors++)}catch(e){w(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&w(e)}return r}async function H(){let e=x(),t=R(),n=S.errors(),r=S.baseLogs(),i=await V(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>I(r,e.name));for(let n of a)i=z(i,await V(n,t,!0)),await W(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&w(e)}return i}async function U(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function W(e,t){try{await t.rmdir(e)}catch{}}async function G(){let e=R(),t={messages:0,errors:0},n=h(),r=x(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=I(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await U(I(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=I(i,n.name),o=I(a,d),s;try{s=await r.readdir(o)}catch{await W(a,r);continue}for(let n of s)if(n.isFile())try{await U(I(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=I(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await U(I(i,n.name),e,r)&&t.messages++}catch{t.errors++}await W(i,r)}await W(o,r),await W(a,r)}await W(i,r)}return t}async function K(e,t,n=!0){let r=R(),i={messages:0,errors:0},a=x(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await U(I(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await W(e,a),i}function q(){return K(I(e(),`plans`),`.md`)}async function J(){let t=R(),n={messages:0,errors:0},r=x();try{let i=I(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>I(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await W(i,r)}catch(e){w(e)}return n}async function Y(){let t=R(),n={messages:0,errors:0},r=x();try{let i=I(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>I(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await W(i,r)}catch(e){w(e)}return n}async function X(){let t=R(),n={messages:0,errors:0},r=x(),i=I(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await U(I(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Z(){let{errors:e}=N();if(e.length>0&&n(`cleanupPeriodDays`)){v(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await H(),await G(),await q(),await J(),await Y(),await X(),await c(),await O(R()),await f(R())}j(),P();var Q=600*1e3;function $(){import(`./extractMemories-8yvMGZ1J.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),_(),F();let e=!0;async function t(){if(a()&&s()>Date.now()-1e3*60){setTimeout(t,Q).unref();return}if(e&&(e=!1,await Z()),a()&&s()>Date.now()-1e3*60){setTimeout(t,Q).unref();return}await A()}setTimeout(t,Q).unref()}export{$ as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Hr as e,In as t,Vn as n,ii as r,qr as i,ti as a,zr as o}from"./settings-D4M13toi.js";import{Pt as s,q as c}from"./state-CXY-q5gr.js";import{c as l,i as u}from"./debug-2pVES-2G.js";import{d,h as f,o as p}from"./config-BDn2YIjC.js";import{_ as m,f as h,p as g}from"./startupProfiler-B9Qv2QGH.js";import{n as _,r as v}from"./detectRepository--luIRv5H.js";import{homedir as y}from"os";import{join as b,sep as x}from"path";import{realpath as S,stat as C}from"fs/promises";s(),d(),u(),v(),t(),r(),i();async function w(){try{let e=await _();if(!e){l(`Not in a GitHub repository, skipping path mapping update`);return}let t=c(),n=o(t)??t,r;try{r=(await S(n)).normalize(`NFC`)}catch{r=n}let i=e.toLowerCase(),a=p().githubRepoPaths?.[i]??[];if(a[0]===r){l(`Path ${r} already tracked for repo ${i}`);return}let s=a.filter(e=>e!==r),u=[r,...s];f(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[i]:u}})),l(`Added ${r} to tracked paths for repo ${i}`)}catch(e){l(`Error updating repo path mapping: ${e}`)}}function T(e){let t=p(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function E(e){let t=await Promise.all(e.map(n));return e.filter((e,n)=>t[n])}m(),r(),i();var D=10080*60*1e3,O=1e3;function k(e){let t=[`This session was opened by an external deep link in ${M(e.cwd)}`];if(e.repo){let n=e.lastFetch?g(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>D;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>O?`The prompt below (${h(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
|
|
2
|
+
`)}async function A(t){let n=await e(t);if(!n)return;let r=await a(n),[i,o]=await Promise.all([j(b(n,`FETCH_HEAD`)),r?j(b(r,`FETCH_HEAD`)):Promise.resolve(void 0)]);return i&&o?i>o?i:o:i??o}async function j(e){try{let{mtime:t}=await C(e);return t}catch{return}}function M(e){let t=y();return e===t?`~`:e.startsWith(t+x)?`~${e.slice(t.length)}`:e}export{w as a,T as i,A as n,E as r,k as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{vn as t,yn as n}from"./settings-D4M13toi.js";import{Pt as r,at as i,q as a}from"./state-CXY-q5gr.js";import{Sr as o,ar as s,ei as c,fr as l,gr as u,oi as d,pr as f}from"./loadAgentsDir-uuZYOgKn.js";import{C as p,x as m}from"./debug-2pVES-2G.js";import{n as h}from"./analytics-COpjZpvd.js";import{i as g,o as _}from"./stringUtils-Cs6E5f-B.js";import{randomUUID as v}from"crypto";import{mkdir as y,readFile as b,writeFile as x}from"fs/promises";function S(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function C(e){let t=v(),r=i(),c=s(a()),u=f(t),d=l();await y(c,{recursive:!0,mode:448});let m;try{m=await b(d)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=n(m),g=h.filter(e=>o(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===r).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let S=null,C=[],w=[];for(let e of g){let n={...e,sessionId:t,parentUuid:S,isSidechain:!1,forkedFrom:{sessionId:r,messageUuid:e.uuid}},i={...e,sessionId:t};w.push(i),C.push(p(n)),e.type!==`progress`&&(S=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:t,replacements:_};C.push(p(e))}return await x(u,`${C.join(`
|
|
2
|
+
`)}\n`,{encoding:`utf8`,mode:384}),{sessionId:t,title:e,forkPath:u,serializedMessages:w,contentReplacementRecords:_}}async function w(e){let t=`${e} (Branch)`;if((await d(t,{exact:!0})).length===0)return t;let n=await d(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${g(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(i);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let a=2;for(;r.has(a);)a++;return`${e} (Branch ${a})`}async function T(e,t,n){let r=n?.trim()||void 0,a=i();try{let{sessionId:n,title:i,forkPath:o,serializedMessages:s,contentReplacementRecords:l}=await C(r),u=new Date,d=S(s.find(e=>e.type===`user`)),f=await w(i??d);await c(n,f,o),s.length;let p={date:u.toISOString().split(`T`)[0],messages:s,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:s.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=i?` "${i}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${a}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{r(),h(),t(),u(),m(),_()}))();export{T as call,S as deriveFirstPrompt};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-QyzA_cFM.js";import{F as r,Pt as i}from"./state-CXY-q5gr.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
|
|
2
2
|
`).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,`${JSON.stringify(r)}\n`,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
|
|
3
3
|
`)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
|
|
4
4
|
`)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: The prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
|
|
5
5
|
`)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
|
|
6
6
|
`)}}var y,b,x,S=e((()=>{i(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
|
|
7
|
-
`),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-
|
|
7
|
+
`),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-DNiXDhBX.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,bn as a,ot as o,t as s,vn as c,xt as l}from"./src-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,bn as a,ot as o,t as s,vn as c,xt as l}from"./src-BX54x08P.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{Gt as d}from"./settings-D4M13toi.js";import{Bv as f,F_ as p,GS as m,I_ as h,Ji as g,P_ as _,Rx as v,Us as y,Ws as b,dd as x,ld as S,ot as C,sb as w,st as T,ty as E,zv as D}from"./loadAgentsDir-uuZYOgKn.js";import{I as O,M as k}from"./debug-2pVES-2G.js";import{d as A,h as j}from"./config-BDn2YIjC.js";import{n as M,t as N}from"./SpinnerGlyph-BR_SiV9L.js";import{n as P,r as F}from"./sideQuestion-CdgUarC2.js";import{i as I,n as L}from"./modalContext-sU2lfR08.js";function R({question:e,context:t,onDone:i}){let[s,c]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(0),m=(0,H.useRef)(null),{rows:h}=I(o());a(()=>p(e=>e+1),s||u?null:80);function g(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),i(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),m.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),m.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=D();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?c(r.response):d(`No response received`))}catch(e){n.signal.aborted||d(k(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let _=Math.max(5,h-W-G);return(0,U.jsxs)(n,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[(0,U.jsxs)(n,{children:[(0,U.jsxs)(r,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(r,{dimColor:!0,children:e})]}),(0,U.jsx)(n,{marginTop:1,marginLeft:2,maxHeight:_,children:(0,U.jsx)(l,{ref:m,flexDirection:`column`,flexGrow:1,children:u?(0,U.jsx)(r,{color:`error`,children:u}):s?(0,U.jsx)(S,{children:s}):(0,U.jsxs)(n,{children:[(0,U.jsx)(N,{frame:f,messageColor:`warning`}),(0,U.jsx)(r,{color:`warning`,children:`Answering...`})]})})}),(s||u)&&(0,U.jsx)(n,{marginTop:1,children:(0,U.jsxs)(r,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=v(z(e.messages)),n=y();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,i,a]=await Promise.all([C(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),p(),_()]);return{systemPrompt:m(r),userContext:i,systemContext:a,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(j(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{H=t(i(),1),c(),x(),M(),d(),T(),L(),h(),w(),s(),f(),A(),O(),b(),g(),P(),E(),U=u(),W=5,G=6,K=3}))();export{V as call};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{f as r,u as i,w as a,x as o}from"./debug-2pVES-2G.js";import{r as s,t as c}from"./execa-CBhG1doD.js";import{o as l,s as u}from"./log-L1kqxa_P.js";import{release as d}from"os";import{readFile as f}from"fs/promises";import{execSync as p}from"child_process";function m(e,t){return a`execSync: ${e.slice(0,100)}`,p(e,t)}var h=e((()=>{o()}));async function g(e){if(process.platform===`win32`){let t=await c(`where.exe ${e}`,{shell:!0,stderr:`ignore`,reject:!1});return t.exitCode!==0||!t.stdout?null:t.stdout.trim().split(/\r?\n/)[0]||null}let t=await c(`which ${e}`,{shell:!0,stderr:`ignore`,reject:!1});return t.exitCode!==0||!t.stdout?null:t.stdout.trim()}function _(e){if(process.platform===`win32`)try{return m(`where.exe ${e}`,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`]}).toString().trim().split(/\r?\n/)[0]||null}catch{return null}try{return m(`which ${e}`,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`]}).toString().trim()||null}catch{return null}}var v,y,b,x=e((()=>{s(),h(),v=typeof Bun<`u`&&typeof Bun.which==`function`?Bun.which:null,y=v?async e=>v(e):g,b=v??_})),S,C,w=e((()=>{n(),r(),l(),S=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){u(e)}return`linux`}return`unknown`}catch(e){return u(e),`unknown`}}),C=t(()=>{if(process.platform===`linux`)try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t?.[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){u(e);return}}),t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:d()};try{let t=await f(`/etc/os-release`,`utf8`);for(let n of t.split(`
|
|
2
|
+
`)){let t=n.match(/^(ID|VERSION_ID)=(.*)$/);if(t?.[1]&&t[2]){let n=t[2].replace(/^"|"$/g,``);t[1]===`ID`?e.linuxDistroId=n:e.linuxDistroVersion=n}}}catch{}return e})}));function T(){return process.versions.bun!==void 0}function E(){return typeof Bun<`u`&&Array.isArray(Bun.embeddedFiles)&&Bun.embeddedFiles.length>0}var D=e((()=>{}));export{C as a,y as c,h as d,S as i,b as l,E as n,w as o,T as r,x as s,D as t,m as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./caches-Dn8yrJmL.js";e();export{t as clearSessionCaches};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ei as t,ii as n}from"./settings-D4M13toi.js";import{Pt as r,l as i,mn as a}from"./state-CXY-q5gr.js";import{Ay as o,Bi as s,Cb as c,Ci as l,F_ as u,G as d,I_ as f,Iu as p,L_ as m,Mi as h,Mp as g,N_ as _,P_ as v,R_ as y,Ru as b,Sb as x,Wi as S,hp as C,ky as w,lh as T,lm as E,ns as D,pp as O,q as k,sm as A,ts as j,uh as M,z_ as N}from"./loadAgentsDir-uuZYOgKn.js";import{a as P,n as F}from"./fileSuggestions-BYD78vcF.js";import{r as I,t as L}from"./magicDocs-D53lV8b5.js";import{r as R,t as z}from"./detectRepository--luIRv5H.js";function B(e=new Set){let n=e.size>0;u.cache.clear?.(),v.cache.clear?.(),_.cache.clear?.(),y.cache.clear?.(),F(),l(),n||C(),m(null),a(null),E(),D(),o(`session_start`),p(),z(),d(),i(e),t(),s(),M(),L(),x(),import(`./SearchExtraToolsTool-CdWB9sO8.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-BBbIAiay.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-BZmu5CeK.js`).then(({clearPromptCache:e})=>e())}var V=e((()=>{r(),h(),N(),f(),P(),g(),O(),A(),T(),I(),S(),j(),k(),w(),R(),n(),b(),c()}));export{V as n,B as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-Cjaftrrw.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy--_NfbJhm.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let t=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:t,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:n({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),t(),m=null}));export{f as n,h as r,p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./client-pA7fKk0-.js";e();export{t as getGrokClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./client-2w-g5kMx.js";e();export{t as clearOpenAIClientCache};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy--_NfbJhm.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";function a(e){if(s)return s;let t=new r({apiKey:process.env.GROK_API_KEY||process.env.XAI_API_KEY||``,baseURL:process.env.GROK_BASE_URL||o,maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:n({forAnthropicAPI:!1}),...e?.fetchOverride&&{fetch:e.fetchOverride}});return e?.fetchOverride||(s=t),t}var o,s,c=e((()=>{i(),t(),o=`https://api.x.ai/v1`,s=null}));export{c as n,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ci as e,Di as t,Mi as n}from"./loadAgentsDir-uuZYOgKn.js";n();export{e as clearCommandsCache,t as getCommands};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,fi as n}from"./src-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,fi as n}from"./src-BX54x08P.js";import{It as r,Pt as i}from"./state-CXY-q5gr.js";import{$_ as a,B_ as o,F_ as s,G_ as c,I_ as l,Jg as u,Ji as d,M_ as f,P_ as p,Rx as m,V_ as h,W_ as g,Xg as _,Zg as v,ab as y,av as b,j_ as x,lm as S,mn as C,mp as w,nd as T,nm as E,ob as D,ot as O,pp as k,qg as A,rm as j,sm as M,st as N,td as P}from"./loadAgentsDir-uuZYOgKn.js";import{F,I}from"./debug-2pVES-2G.js";import{o as L,s as R}from"./log-L1kqxa_P.js";function z(e,n){let r=P(`tip`),i=y(`app:toggleTranscript`,`Global`,`ctrl+o`),a=[...e.options.verbose?[]:[`(${i} to see full summary)`],...n?[n]:[],...r?[r]:[]];return t.dim(`Compacted ${a.join(`
|
|
2
2
|
`)}`)}async function B(e,t){let n=e.getAppState(),r=await O(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=x({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([s(),p()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{n(),i(),N(),l(),D(),k(),v(),g(),o(),M(),E(),a(),I(),C(),L(),d(),T(),f(),V=async(e,t)=>{let{abortController:n}=t,{messages:i}=t;if(i=m(i),i.length===0)throw Error(`No messages to compact`);let a=e.trim();try{if(!a){let e=await j(i,t.agentId);if(e)return s.cache.clear?.(),S(),w(t.options.querySource??`compact`,t.agentId),r(),c(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await h(i,t)).messages,n=await _(e,t,await B(t,e),!1,a,!1);return b(void 0),c(),s.cache.clear?.(),S(),{type:`compact`,compactionResult:n,displayText:z(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(u):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(A):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./isObject-C6qM3WEW.js";import{n as r,t as i}from"./memoize-BK3gG5ob.js";import{c as a,i as o,l as s,o as c}from"./envUtils-QyzA_cFM.js";import{Ai as l,Cn as u,Ei as d,In as ee,Kn as te,Rr as ne,Sn as re,Ti as ie,Xt as ae,Yt as f,bi as oe,bn as p,di as m,ki as se,kr as ce,m as le,mr as h,pr as ue,qr as de,rn as fe,s as g,t as pe,tn as me,ui as he,vn as ge,yi as _e}from"./settings-D4M13toi.js";import{Hr as ve,Jr as ye,Pt as be,Ur as xe,X as _,Xr as Se,Yr as Ce,Zr as we,_r as Te,ai as Ee,ar as De,cr as Oe,dr as ke,ei as Ae,fr as je,gr as Me,ii as Ne,ir as Pe,lr as Fe,pr as v,q as Ie,st as Le,ti as Re,ur as ze}from"./state-CXY-q5gr.js";import{n as Be,t as Ve}from"./cwd-DrEEb4f5.js";import{$ as He,C as y,I as Ue,N as b,O as x,S as We,c as S,et as Ge,f as Ke,i as qe,u as C,x as Je}from"./debug-2pVES-2G.js";import{d as Ye,o as Xe,s as Ze,u as Qe}from"./log-L1kqxa_P.js";import{n as $e}from"./analytics-COpjZpvd.js";import{i as et,n as tt}from"./lockfile-D_9vif6E.js";import{homedir as nt}from"os";import{basename as w,dirname as T,isAbsolute as rt,join as E,normalize as D,resolve as it,sep as at}from"path";import{unwatchFile as ot,watchFile as st}from"fs";import{randomBytes as ct}from"crypto";var O,lt=e((()=>{Ee(),oe(),Ce(),Se(),O=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Ne(t,ye(e)),e=_e(e);return t}:we}));function ut(e){return Ae(e,d,O)}var dt=e((()=>{Re(),lt(),ie()}));function ft(){let e=process.env.WORKMATE_DISABLE_AUTO_MEMORY;if(s(e))return!1;if(a(e))return!0;if(s(process.env.WORKMATE_SIMPLE)||s(process.env.WORKMATE_REMOTE)&&!process.env.WORKMATE_REMOTE_MEMORY_DIR)return!1;let t=pe();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function pt(){return!1}function mt(){return process.env.WORKMATE_REMOTE_MEMORY_DIR?process.env.WORKMATE_REMOTE_MEMORY_DIR:o()}function ht(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=D(e||`.`);if(t===`.`||t===`..`)return;n=E(nt(),e)}let r=D(n).replace(/[/\\]+$/,``);if(!(!rt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+at).normalize(`NFC`)}function gt(){return ht(process.env.WORKMATE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function _t(){return ht(g(`policySettings`)?.autoMemoryDirectory??g(`flagSettings`)?.autoMemoryDirectory??g(`localSettings`)?.autoMemoryDirectory??g(`userSettings`)?.autoMemoryDirectory,!0)}function vt(){return gt()!==void 0}function yt(){return ne(_())??_()}function bt(){return E(k(),Ct)}function xt(e){return D(e).startsWith(k())}var St,Ct,k,A=e((()=>{i(),be(),c(),de(),ue(),le(),St=`memory`,Ct=`MEMORY.md`,k=r(()=>(gt()??_t())||(E(E(mt(),`projects`),ce(yt()),St)+at).normalize(`NFC`),()=>_())}));function j(e,n,r,i){if(!t(e))return e;n=je(n,e);for(var a=-1,o=n.length,s=o-1,c=e;c!=null&&++a<o;){var l=ke(n[a]),u=r;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=t(d)?d:xe(n[a+1])?[]:{})}se(c,l,u),c=c[l]}return e}var M=e((()=>{l(),v(),ve(),n(),ze()}));function wt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Oe(e,o);n(s,o)&&j(a,je(o,e),s)}return a}var Tt=e((()=>{Fe(),M(),v()}));function N(e,t){if(e==null)return{};var n=Me(ut(e),function(e){return[e]});return t=Pe(t),wt(e,n,function(e,n){return t(e,n[0])})}var Et=e((()=>{Te(),De(),Tt(),dt()}));function P(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Dt(){return G||(G=Ot())}function Ot(){if(Le())return!0;let e=z(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=h(Ve());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=h(it(n,`..`));if(t===n)break;n=t}return!1}function F(e){let t=K.config;return t?t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0:!1}function I(e){let t=null;try{Nt(f(),P,n=>{let r=e(n);return r===n?n:(t={...r,projects:At(n.projects)},t)})&&t&&R(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=V(f(),P);if(F(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`});return}let i=e(r);if(i===r)return;t={...i,projects:At(r.projects)},Mt(f(),t,W),R(t)}}function kt(){let e=J+Y;e>0&&J/e,J=0,Y=0}function L(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function At(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function jt(){if(Z)return;Z=!0;let e=f();st(e,{interval:qt,persistent:!1},t=>{t.mtimeMs<=K.mtime||C().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=p(u(e));typeof n!=`object`||!n||(K={config:L({...P(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Ge(async()=>{ot(e),Z=!1})}function R(e){K={config:e,mtime:Date.now()},q=null}function z(){if(K.config)return J++,K.config;Y++;try{let e=null;try{e=C().statSync(f())}catch{}let t=L(V(f(),P));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,jt(),t}catch{return L(V(f(),P))}}function Mt(e,t,n){let r=T(e);C().mkdirSync(r),te(e,y(N(t,(e,t)=>y(e)!==y(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===f()&&X++}function Nt(e,t,n){let r=t(),i=T(e),a=C();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();if(o=et(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}}),Date.now()-s>100&&S(`Lock acquisition took longer than expected - another Work Mate instance may be running`),q&&e===f())try{let t=a.statSync(e);(t.mtimeMs!==q.mtime||t.size!==q.size)&&(q.mtime,t.mtimeMs,q.size,t.size)}catch(e){if(b(e)!==`ENOENT`)throw e}let c=V(e,t);if(e===f()&&F(c))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.workmate.json. See GH #3117.`,{level:`error`}),!1;let l=n(c);if(l===c)return!1;let u=N(l,(e,t)=>y(e)!==y(r[t]));try{let t=w(e),n=B();try{a.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=E(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(E(n,e))}catch{}}catch(e){b(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return te(e,y(u,null,2),{encoding:`utf-8`,mode:384}),e===f()&&X++,!0}finally{o&&o()}}function Pt(){if(Q)return;let e=Date.now();m(`info`,`enable_configs_started`),Q=!0,V(f(),P,!0),m(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function B(){return E(o(),`backups`)}function Ft(e){let t=C(),n=w(e),r=B();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return E(r,e)}catch{}let i=T(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return E(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function V(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=C();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=We(u(n));return{...t(),...e}}catch(n){throw new x(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=Ft(e);return n&&process.stderr.write(`\nWork Mate configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof x&&n)throw i;if(i instanceof x){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!H){H=!0;try{Ze(i);try{r.statSync(`${e}.backup`)}catch{}}finally{H=!1}}process.stderr.write(`\nWork Mate configuration file at ${e} is corrupted: ${i.message}\n`);let t=w(e),n=B();try{r.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(E(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=E(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=Ft(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
|
|
2
|
+
`),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
|
|
3
|
+
`)}return t()}}function It(){let e=$(),t=z();if(!t.projects)return U;let n=t.projects[e]??U;return typeof n.allowedTools==`string`&&(n.allowedTools=p(n.allowedTools)??[]),n}function Lt(e){let t=$(),n=null;try{Nt(f(),P,r=>{let i=r.projects?.[t]??U,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&R(n)}catch(r){S(`Failed to save config with lock: ${r}`,{level:`error`});let i=V(f(),P);if(F(i)){S(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`});return}let a=i.projects?.[t]??U,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Mt(f(),n,W),R(n)}}function Rt(){return Vt()!==null}function zt(){return Rt()&&!s(process.env.FORCE_AUTOUPDATE_PLUGINS)}function Bt(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function Vt(){if(!s(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(s(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=Qe();if(e)return{type:`env`,envVar:e};let t=z();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function Ht(){let e=z();if(e.userID)return e.userID;let t=ct(32).toString(`hex`);return I(e=>({...e,userID:t})),t}function Ut(){if(!z().firstStartTime){let e=new Date().toISOString();I(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function Wt(e){let t=Ie();switch(e){case`User`:return E(o(),`AGENTS.md`);case`Local`:return E(t,`AGENTS.local.md`);case`Project`:return E(t,`AGENTS.md`);case`Managed`:return E(me(),`AGENTS.md`);case`AutoMem`:return bt();default:return E(o(),`AGENTS.md`)}}function Gt(){return E(me(),`.workmate`,`rules`)}function Kt(){return E(o(),`rules`)}var H,U,W,G,K,q,J,Y,X,qt,Z,Q,$,Jt=e((()=>{i(),Et(),be(),A(),$e(),Be(),He(),qe(),he(),ae(),c(),Ue(),ee(),Ke(),de(),ge(),re(),tt(),Xe(),ue(),Ye(),fe(),Je(),H=!1,U={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!1},W=P(),G=!1,{...W},{...U},K={config:null,mtime:0},q=null,J=0,Y=0,X=0,Ge(async()=>{kt()}),qt=1e3,Z=!1,Q=!1,$=r(()=>{let e=Ie();return h(ne(e)||it(e))})}));export{lt as A,A as C,ut as D,pt as E,dt as O,vt as S,ft as T,j as _,It as a,k as b,Wt as c,Jt as d,Rt as f,zt as g,I as h,Vt as i,O as k,Ht as l,Lt as m,Pt as n,z as o,Ut as p,Bt as r,Gt as s,Dt as t,Kt as u,M as v,xt as w,mt as x,bt as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-DYKmPdbd.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,n as t}from"./config-BDn2YIjC.js";e();export{t as enableConfigs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{I as r,P as i,s as a,t as o}from"./src-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{I as r,P as i,s as a,t as o}from"./src-BX54x08P.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{In as c,Nn as l,mn as u,pn as d}from"./settings-D4M13toi.js";import{A_ as f,B_ as p,Ji as m,O_ as h,Rx as g,V_ as _}from"./loadAgentsDir-uuZYOgKn.js";import{_ as v,g as y}from"./startupProfiler-B9Qv2QGH.js";import{At as b,Ot as x,Yt as S,in as C,rn as w,tn as T}from"./prompt-BfXryFt-.js";import{n as E,t as D}from"./staticRender-Bt82RvGc.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),ee(e,t),N(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=L&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<P||r<F)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=y(t);switch(e){case w:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case x:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=P&&r>=F||a>=I&&n.resultTokens>=F&&t.push({severity:`info`,title:`File reads using ${y(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function ee(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=R&&n>=z){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${l(e.path)} (${y(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${y(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function N(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<L&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var P,F,I,L,R,z,B=e((()=>{C(),T(),b(),c(),v(),P=15,F=1e4,I=5,L=80,R=5,z=5e3}));function V({suggestions:e}){return e.length===0?null:(0,H.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(i,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,H.jsxs)(r,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,H.jsxs)(r,{children:[(0,H.jsx)(a,{status:e.severity,withSpace:!0}),(0,H.jsx)(i,{bold:!0,children:e.title}),e.savingsTokens?(0,H.jsxs)(i,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,y(e.savingsTokens)]}):null]}),(0,H.jsx)(r,{marginLeft:2,children:(0,H.jsx)(i,{dimColor:!0,children:e.detail})})]},t))]})}var H,U=e((()=>{t(),o(),v(),H=s()}));function W(){return null}function G(e){let t=new Map;for(let n of e){let e=d(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Y){let r=t.get(e);r&&n.set(e,r)}return n}function K({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:a,percentage:o,gridRows:s,model:c,memoryFiles:u,mcpTools:d,deferredBuiltinTools:f=[],agents:p,skills:m,cacheHitRate:h,cacheThreshold:g}=e,_=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==J&&!e.isDeferred),v=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===J);return(0,q.jsxs)(r,{flexDirection:`column`,paddingLeft:1,children:[(0,q.jsx)(i,{bold:!0,children:`Context Usage`}),(0,q.jsxs)(r,{flexDirection:`row`,gap:2,children:[(0,q.jsx)(r,{flexDirection:`column`,flexShrink:0,children:s.map((e,t)=>(0,q.jsx)(r,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,q.jsx)(i,{dimColor:!0,children:`⛶ `},t):e.categoryName===J?(0,q.jsx)(i,{color:e.color,children:`⛝ `},t):(0,q.jsx)(i,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,q.jsxs)(r,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,q.jsxs)(i,{dimColor:!0,children:[c,` · `,y(n),`/`,y(a),` tokens (`,o,`%)`]}),(0,q.jsx)(W,{}),h!==void 0&&g!==void 0&&(0,q.jsxs)(i,{color:h<g?`warning`:void 0,children:[`Cache hit rate: `,h.toFixed(0),`%`,h<g?` (below ${g}% threshold)`:``]}),(0,q.jsx)(i,{children:` `}),(0,q.jsx)(i,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),_.map((e,t)=>{let n=y(e.tokens),o=e.isDeferred?`N/A`:`${(e.tokens/a*100).toFixed(1)}%`,s=e.name===J,c=e.name,l=e.isDeferred?` `:s?`⛝`:`⛁`;return(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{color:e.color,children:l}),(0,q.jsxs)(i,{children:[` `,c,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[n,` tokens (`,o,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{dimColor:!0,children:`⛶`}),(0,q.jsx)(i,{children:` Free space: `}),(0,q.jsxs)(i,{dimColor:!0,children:[y(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/a*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{color:b.color,children:`⛝`}),(0,q.jsxs)(i,{dimColor:!0,children:[` `,b.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(b.tokens),` tokens (`,(b.tokens/a*100).toFixed(1),`%)`]})]})]})]}),(0,q.jsxs)(r,{flexDirection:`column`,marginLeft:-1,children:[d.length>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`MCP tools`}),(0,q.jsxs)(i,{dimColor:!0,children:[` · /mcp`,v?` (loaded on-demand)`:``]})]}),d.some(e=>e.isLoaded)&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:`Loaded`}),d.filter(e=>e.isLoaded).map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),v&&d.some(e=>!e.isLoaded)&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:`Available`}),d.filter(e=>!e.isLoaded).map((e,t)=>(0,q.jsx)(r,{children:(0,q.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!v&&d.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),p.length>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`Custom agents`}),(0,q.jsx)(i,{dimColor:!0,children:` · /agents`})]}),Array.from(G(p).entries()).map(([e,t])=>(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.agentType,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]}),u.length>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`Memory files`}),(0,q.jsx)(i,{dimColor:!0,children:` · /memory`})]}),u.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,l(e.path),`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),m&&m.tokens>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`Skills`}),(0,q.jsx)(i,{dimColor:!0,children:` · /skills`})]}),Array.from(G(m.skillFrontmatter).entries()).map(([e,t])=>(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,q.jsx)(V,{suggestions:O(e)})]})}var q,J,Y,X=e((()=>{o(),B(),c(),v(),u(),U(),q=s(),J=`Autocompact buffer`,Y=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Z(e){return g(e)}async function Q(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=Z(n),{messages:s}=await _(o),c=process.stdout.columns||80,l=r();return e(await E((0,$.jsx)(K,{data:await h(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{X(),p(),f(),m(),D(),$=s()}))();export{Q as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./context-noninteractive-CuHHniJn.js";t();export{n as call,e as collectContextData};
|
package/dist/chunks/{context-noninteractive-B1V2Mp26.js → context-noninteractive-CuHHniJn.js}
RENAMED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{mn as t,pn as n}from"./settings-D4M13toi.js";import{A_ as r,B_ as i,Ji as a,O_ as o,Rx as s,V_ as c}from"./loadAgentsDir-uuZYOgKn.js";import{_ as l,g as u}from"./startupProfiler-B9Qv2QGH.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:i,agentDefinitions:a,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=s(t),{messages:f}=await c(d),p=n();return o(f,r,async()=>p.toolPermissionContext,i,a,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:r,rawMaxTokens:i,percentage:a,model:o,memoryFiles:s,mcpTools:c,agents:l,skills:d}=e,f=`## Context Usage
|
|
2
2
|
|
|
3
|
-
`;f+=`**Model:** ${
|
|
3
|
+
`;f+=`**Model:** ${o} \n`,f+=`**Tokens:** ${u(r)} / ${u(i)} (${a}%)\n`,f+=`
|
|
4
4
|
`;let p=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(p.length>0){f+=`### Estimated usage by category
|
|
5
5
|
|
|
6
6
|
`,f+=`| Category | Tokens | Percentage |
|
|
7
7
|
`,f+=`|----------|--------|------------|
|
|
8
|
-
`;for(let e of p){let t=(e.tokens/
|
|
9
|
-
`}if(
|
|
8
|
+
`;for(let e of p){let t=(e.tokens/i*100).toFixed(1);f+=`| ${e.name} | ${u(e.tokens)} | ${t}% |\n`}let e=t.find(e=>e.name===`Free space`);if(e&&e.tokens>0){let t=(e.tokens/i*100).toFixed(1);f+=`| Free space | ${u(e.tokens)} | ${t}% |\n`}let n=t.find(e=>e.name===`Autocompact buffer`);if(n&&n.tokens>0){let e=(n.tokens/i*100).toFixed(1);f+=`| Autocompact buffer | ${u(n.tokens)} | ${e}% |\n`}f+=`
|
|
9
|
+
`}if(c.length>0){f+=`### MCP Tools
|
|
10
10
|
|
|
11
11
|
`,f+=`| Tool | Server | Tokens |
|
|
12
12
|
`,f+=`|------|--------|--------|
|
|
13
|
-
`;for(let e of
|
|
13
|
+
`;for(let e of c)f+=`| ${e.name} | ${e.serverName} | ${u(e.tokens)} |\n`;f+=`
|
|
14
14
|
`}if(l.length>0){f+=`### Custom Agents
|
|
15
15
|
|
|
16
16
|
`,f+=`| Agent Type | Source | Tokens |
|
|
17
17
|
`,f+=`|------------|--------|--------|
|
|
18
18
|
`;for(let e of l){let t;switch(e.source){case`projectSettings`:t=`Project`;break;case`userSettings`:t=`User`;break;case`localSettings`:t=`Local`;break;case`flagSettings`:t=`Flag`;break;case`policySettings`:t=`Policy`;break;case`plugin`:t=`Plugin`;break;case`built-in`:t=`Built-in`;break;default:t=String(e.source)}f+=`| ${e.agentType} | ${t} | ${u(e.tokens)} |\n`}f+=`
|
|
19
|
-
`}if(
|
|
19
|
+
`}if(s.length>0){f+=`### Memory Files
|
|
20
20
|
|
|
21
21
|
`,f+=`| Type | Path | Tokens |
|
|
22
22
|
`,f+=`|------|------|--------|
|
|
23
|
-
`;for(let e of
|
|
23
|
+
`;for(let e of s)f+=`| ${e.type} | ${e.path} | ${u(e.tokens)} |\n`;f+=`
|
|
24
24
|
`}if(d&&d.tokens>0&&d.skillFrontmatter.length>0){f+=`### Skills
|
|
25
25
|
|
|
26
26
|
`,f+=`| Skill | Source | Tokens |
|
|
27
27
|
`,f+=`|-------|--------|--------|
|
|
28
|
-
`;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${
|
|
29
|
-
`}return f}var m=e((()=>{
|
|
28
|
+
`;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${n(e.source)} | ${u(e.tokens)} |\n`;f+=`
|
|
29
|
+
`}return f}var m=e((()=>{i(),r(),l(),a(),t()}));export{d as n,m as r,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./conversation-Cjaftrrw.js";e();export{t as clearConversation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{B as n,Pt as r,Ut as i,Vt as a,dn as o,pn as s,q as c,un as l}from"./state-CXY-q5gr.js";import{Cn as u,En as d,Qn as f,Sg as p,St as m,Tn as h,WC as g,Wn as _,YC as v,Yr as y,_g as b,ai as x,bb as S,ci as C,cw as w,dh as T,gg as E,gr as D,mn as O,ms as k,n_ as A,on as j,ph as M,ps as N,qt as P,t_ as F,tw as I,wg as L,xb as R,yt as z}from"./loadAgentsDir-
|
|
1
|
+
import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{B as n,Pt as r,Ut as i,Vt as a,dn as o,pn as s,q as c,un as l}from"./state-CXY-q5gr.js";import{Cn as u,En as d,Qn as f,Sg as p,St as m,Tn as h,WC as g,Wn as _,YC as v,Yr as y,_g as b,ai as x,bb as S,ci as C,cw as w,dh as T,gg as E,gr as D,mn as O,ms as k,n_ as A,on as j,ph as M,ps as N,qt as P,t_ as F,tw as I,wg as L,xb as R,yt as z}from"./loadAgentsDir-uuZYOgKn.js";import{o as B,s as V}from"./log-L1kqxa_P.js";import{n as H}from"./analytics-COpjZpvd.js";import{n as U,t as W}from"./caches-Dn8yrJmL.js";import{randomUUID as G}from"crypto";async function K({setMessages:t,readFileState:r,discoveredSkillNames:d,loadedNestedMemoryPaths:m,getAppState:S,setAppState:w,setConversationId:E}){let O=j();await P(`clear`,{getAppState:S,setAppState:w,signal:AbortSignal.timeout(O),timeoutMs:O}),n();let M=new Set,N=[],F=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(S)for(let e of Object.values(S().tasks))F(e)||k(e)&&(M.add(e.agentId),N.push(e));t(()=>[]);let{setContextBlocked:L}=(g(),e(v));L(!1),E&&E(G()),W(M),l(null),o(null),s(null),i(),R(c()),r.clear(),d?.clear(),m?.clear(),w&&w(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!F(r)){t[n]=r;continue}try{r.status===`running`&&(b(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){V(e)}u(n)}return{...e,tasks:t,attribution:T(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),I(),_(),a({setCurrentAsParent:!0}),await y();for(let e of N)e.status===`running`&&h(e.id,f(p(e.agentId)));let{saveMode:B}=(D(),e(C));B(`normal`);let H=z();H&&x(H);let U=await A(`clear`);U.length>0&&t(()=>U)}var q=t((()=>{r(),H(),N(),E(),L(),M(),O(),B(),w(),S(),F(),D(),d(),m(),U()}));export{q as n,K as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ht as e,Ut as t}from"./settings-D4M13toi.js";import{Pt as n,t as r}from"./state-CXY-q5gr.js";import{$x as i,Cg as a,Gr as o,Gx as s,Ji as c,Ln as l,Nr as u,Or as d,Zh as f,_a as p,ag as m,br as h,cS as g,cw as _,gr as v,is as y,kr as b,la as x,lr as S,n_ as C,nr as w,oa as T,rs as E,rw as D,t_ as O,ts as k,va as A,wa as j,wg as M,zn as N}from"./loadAgentsDir-uuZYOgKn.js";import{n as P,t as F}from"./cwd-DrEEb4f5.js";import{o as I,s as L}from"./log-L1kqxa_P.js";import{relative as R}from"path";P(),n(),M(),t(),k(),m(),I(),c(),_(),O(),v();function z(e){if(e.type!==`attachment`)return e;let t=e.attachment;if(t.type===`new_file`)return{...e,attachment:{...t,type:`file`,displayPath:R(F(),t.filename)}};if(t.type===`new_directory`)return{...e,attachment:{...t,type:`directory`,displayPath:R(F(),t.path)}};if(!(`displayPath`in t)){let n=`filename`in t?t.filename:`path`in t?t.path:`skillDir`in t?t.skillDir:void 0;if(n)return{...e,attachment:{...t,displayPath:R(F(),n)}}}return e}function B(e){return V(e).messages}function V(t){try{let n=t.map(z),r=new Set(e);for(let e of n)e.type===`user`&&e.permissionMode!==void 0&&!r.has(e.permissionMode)&&(e.permissionMode=void 0);let a=T(p(A(n))),o=H(a),c;if(o.kind===`interrupted_turn`){let[e]=x([i({content:`Continue from where you left off.`,isMeta:!0})]);a.push(e),c={kind:`interrupted_prompt`,message:e}}else c=o;let l=a.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`);return l!==-1&&a[l].type===`user`&&a.splice(l+1,0,s({content:g})),{messages:a,turnInterruptionState:c}}catch(e){throw L(e),e}}function H(e){if(e.length===0)return{kind:`none`};let t=e.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`&&!(e.type===`assistant`&&e.isApiErrorMessage)),n=t===-1?void 0:e[t];return!n||n.type===`assistant`?{kind:`none`}:n.type===`user`?n.isMeta||n.isCompactSummary?{kind:`none`}:j(n)?{kind:`interrupted_turn`}:{kind:`interrupted_prompt`,message:n}:n.type===`attachment`?{kind:`interrupted_turn`}:{kind:`none`}}function U(e){for(let t of e)if(t.type===`attachment`){if(t.attachment.type===`invoked_skills`){let e=t.attachment.skills;for(let t of e)t.name&&t.path&&t.content&&r(t.name,t.path,t.content,null)}t.attachment.type===`skill_listing`&&y()}y(),E()}async function W(e){let{messages:t,leafUuids:n}=await u(e),r=null,i=0;for(let e of t.values()){if(e.isSidechain||!n.has(e.uuid))continue;let t=new Date(e.timestamp).getTime();t>i&&(i=t,r=e)}return r?{messages:o(l(t,r)),sessionId:r.sessionId}:{messages:[],sessionId:void 0}}async function G(e,t){try{let n=null,r=null,i;if(e===void 0){let e=b(),t=new Set;try{let{listAllLiveSessions:e}=await import(`./udsClient-CWeoNrm3.js`),n=await e();t=new Set(n.flatMap(e=>e.kind&&e.kind!==`interactive`&&e.sessionId?[e.sessionId]:[]))}catch{}n=(await e).find(e=>{let n=S(e);return!n||!t.has(n)})??null}else if(t){let e=await W(t);r=e.messages,i=e.sessionId}else typeof e==`string`?(n=await w(e),i=e):n=e;if(!n&&!r)return null;n&&(h(n)&&(n=await d(n)),i||(i=S(n)),i&&await D(n,a(i)),f(n),r=n.messages,N(r)),U(r);let o=V(r);r=o.messages;let s=await C(`resume`,{sessionId:i});return r.push(...s),{messages:r,turnInterruptionState:o.turnInterruptionState,fileHistorySnapshots:n?.fileHistorySnapshots,attributionSnapshots:n?.attributionSnapshots,contentReplacements:n?.contentReplacements,contextCollapseCommits:n?.contextCollapseCommits,contextCollapseSnapshot:n?.contextCollapseSnapshot,sessionId:i,agentName:n?.agentName,agentColor:n?.agentColor,agentSetting:n?.agentSetting,customTitle:n?.customTitle,tag:n?.tag,mode:n?.mode,worktreeSession:n?.worktreeSession,prNumber:n?.prNumber,prUrl:n?.prUrl,prRepository:n?.prRepository,fullPath:n?.fullPath,goal:n?.goal}}catch(e){throw L(e),e}}export{G as n,B as t};
|