@readmagic/workmate 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/AddWorkspaceDirectory-Y5S_lMjD.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-DVbU-BaD.js +1 -0
- package/dist/chunks/App-B8q8PV77.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-DjqGAL4C.js +1 -0
- package/dist/chunks/CustomSelect-BvTftqEH.js +1 -0
- package/dist/chunks/DiffDialog-v5r8cBKW.js +6 -0
- package/dist/chunks/Doctor-DKpBnbuI.js +1 -0
- package/dist/chunks/Doctor-uvO6NM5m.js +3 -0
- package/dist/chunks/ExitFlow-Dh9QdaYK.js +2 -0
- package/dist/chunks/InvalidConfigDialog-C9boykQn.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-iwh8H52b.js → InvalidSettingsDialog-UN5mleCK.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +1 -0
- package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +1 -0
- package/dist/chunks/MCPToolListView-De1W4jpj.js +1 -0
- package/dist/chunks/McpParsingWarnings-zkM_lGd0.js +1 -0
- package/dist/chunks/MessageSelector-DW_itlX-.js +3 -0
- package/dist/chunks/Messages-BFsCpACq.js +10 -0
- package/dist/chunks/Onboarding-BT90cFkn.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-CCTZYbWI.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +1 -0
- package/dist/chunks/{ProviderSetup-BCSPsvfv.js → ProviderSetup-yIj8YOKF.js} +1 -1
- package/dist/chunks/QueryEngine-egz5mbaW.js +1 -0
- package/dist/chunks/REPL-D27CE4WN.js +124 -0
- package/dist/chunks/REPL-e8wAT1wN.js +1 -0
- package/dist/chunks/ResumeConversation-CWA27Lke.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +1 -0
- package/dist/chunks/{SelectMulti-BQRHed-d.js → SelectMulti-BW7Ffk1G.js} +1 -1
- package/dist/chunks/Settings-axHLvYIy.js +3 -0
- package/dist/chunks/Spinner-VjwI7m_g.js +1 -0
- package/dist/chunks/{SpinnerGlyph-CmkRUvHe.js → SpinnerGlyph-CqrOK3Mx.js} +1 -1
- package/dist/chunks/TextInput-Cev5Awdd.js +22 -0
- package/dist/chunks/ThemePicker-CtQYHmOr.js +1 -0
- package/dist/chunks/TrustDialog-8Sjmuu0e.js +1 -0
- package/dist/chunks/{ValidationErrorsList-DgNzJQUP.js → ValidationErrorsList-INwwoerV.js} +1 -1
- package/dist/chunks/_baseEach-DrPH_FGo.js +1 -0
- package/dist/chunks/add-dir-D3RMaYxy.js +1 -0
- package/dist/chunks/{agentDisplay-M4pfwbMC.js → agentDisplay-B3npXoCS.js} +1 -1
- package/dist/chunks/{agents-DddX7lLX.js → agents-2mPGmeq6.js} +1 -1
- package/dist/chunks/agents-DEnmg8Xo.js +101 -0
- package/dist/chunks/allErrors-C9kx6lnk.js +1 -0
- package/dist/chunks/analytics-COpjZpvd.js +1 -0
- package/dist/chunks/{appleTerminalBackup-BArZWB21.js → appleTerminalBackup-CT7g8yOs.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-BkFxfjOf.js +1 -0
- package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +1 -0
- package/dist/chunks/banner-DHpTmEO7.js +2 -0
- package/dist/chunks/branch-Be_yDFU8.js +2 -0
- package/dist/chunks/{break-cache-BMXqFTeS.js → break-cache-UUt6Dkf2.js} +2 -2
- package/dist/chunks/btw-DUml5L1w.js +1 -0
- package/dist/chunks/caches-DWjwe-DN.js +1 -0
- package/dist/chunks/caches-VLs1tQkZ.js +1 -0
- package/dist/chunks/{claudeDesktop-D8ml2767.js → claudeDesktop-mBGFDbI6.js} +1 -1
- package/dist/chunks/{clear-B8ZtFPOK.js → clear-CrGjNe6E.js} +1 -1
- package/dist/chunks/{client-CpTCeWba.js → client-BDuhbzLD.js} +1 -1
- package/dist/chunks/{client-4iqhC8xq.js → client-BYFVVMcf.js} +1 -1
- package/dist/chunks/client-CO_6v4yl.js +1 -0
- package/dist/chunks/client-DO-O441l.js +1 -0
- package/dist/chunks/commands-Cn1P7Tms.js +1 -0
- package/dist/chunks/compact-DGUhdXcc.js +2 -0
- package/dist/chunks/config-C7GTF4iI.js +1 -0
- package/dist/chunks/config-CWPHVTic.js +3 -0
- package/dist/chunks/config-Cox0TM2Z.js +1 -0
- package/dist/chunks/context-mV5zjqmc.js +1 -0
- package/dist/chunks/context-noninteractive--OuiZUzL.js +1 -0
- package/dist/chunks/{context-noninteractive-C7wrRZnM.js → context-noninteractive-DvfVvmSE.js} +2 -2
- package/dist/chunks/conversation--y8PD2Lk.js +1 -0
- package/dist/chunks/conversation-BIPJEOwO.js +1 -0
- package/dist/chunks/conversationRecovery-BBJzrA0g.js +1 -0
- package/dist/chunks/crossProjectResume-CwZb3cEU.js +40 -0
- package/dist/chunks/cwd-BZMp3CZ8.js +1 -0
- package/dist/chunks/cwd-BvNt_018.js +1 -0
- package/dist/chunks/debug-CRnGsZOV.js +39 -0
- package/dist/chunks/{detectRepository-CfX8Lc0A.js → detectRepository-CsJLbVEe.js} +1 -1
- package/dist/chunks/{diff-DdpHThJ7.js → diff-DUEoNCnJ.js} +1 -1
- package/dist/chunks/{directoryCompletion-D_Rtg-4j.js → directoryCompletion-Bgi8DBT5.js} +1 -1
- package/dist/chunks/doctor-4NiE46ZG.js +1 -0
- package/dist/chunks/entry-D1iD76SW.js +13 -0
- package/dist/chunks/{esm-CGx9qY3q.js → esm-DUH16IqH.js} +1 -1
- package/dist/chunks/execAsync-D6SA-YsV.js +1 -0
- package/dist/chunks/{execFileNoThrow-BTachNBI.js → execFileNoThrow-BgRsj_SW.js} +3 -3
- package/dist/chunks/exit-CrsQsjbx.js +1 -0
- package/dist/chunks/extraUsage-BtHE-SBX.js +1 -0
- package/dist/chunks/extractMemories-kogJzpit.js +1 -0
- package/dist/chunks/fast-CuNVwVTr.js +1 -0
- package/dist/chunks/fast-RlFnwGRV.js +1 -0
- package/dist/chunks/fetchModelList-Cjow_QGy.js +1 -0
- package/dist/chunks/fetchModelList-uiCPVqbJ.js +1 -0
- package/dist/chunks/fileSuggestions-C96V9-Ne.js +3 -0
- package/dist/chunks/firstPartyEventLogger-CN9UOmEC.js +1 -0
- package/dist/chunks/firstPartyEventLogger-RR5rvDtk.js +1 -0
- package/dist/chunks/{gemini-C_ApXgwc.js → gemini-4YGElN3H.js} +2 -2
- package/dist/chunks/generateSessionName-BHIKyXpz.js +1 -0
- package/dist/chunks/{genericProcessUtils-DwQFuna9.js → genericProcessUtils-BNlr-QxM.js} +1 -1
- package/dist/chunks/getMachineId-bsd-DTYGimUN.js +1 -0
- package/dist/chunks/getMachineId-darwin-DqIFUVvd.js +2 -0
- package/dist/chunks/getMachineId-linux-CnCTmdzd.js +1 -0
- package/dist/chunks/getMachineId-unsupported-Cx21ssu1.js +1 -0
- package/dist/chunks/getMachineId-win-vZhex7KX.js +1 -0
- package/dist/chunks/goal-ePK_jLo3.js +3 -0
- package/dist/chunks/grok-DnmklTrm.js +1 -0
- package/dist/chunks/help-B7xRle-V.js +1 -0
- package/dist/chunks/history-kOw3CcLT.js +1 -0
- package/dist/chunks/hooks-BDY1jMbS.js +1 -0
- package/dist/chunks/{hooks-DR3IYPJ3.js → hooks-BN5f58HY.js} +2 -2
- package/dist/chunks/install-DrMiHa2Q.js +1 -0
- package/dist/chunks/instrumentation-Oj5xagJG.js +21 -0
- package/dist/chunks/{job-YhJQWgE0.js → job-D9ypO0cd.js} +1 -1
- package/dist/chunks/keybindings-BRRN_eap.js +1 -0
- package/dist/chunks/launchLocalMemory-DliLezJw.js +3 -0
- package/dist/chunks/launchOnboarding-A-kk-7ID.js +8 -0
- package/dist/chunks/loadAgentsDir-CJAK4kif.js +1 -0
- package/dist/chunks/{loadAgentsDir-B0Anodo0.js → loadAgentsDir-DGozQu_6.js} +550 -550
- package/dist/chunks/{loadPluginHooks-BSwCtQ6T.js → loadPluginHooks-BiHPKDaY.js} +1 -1
- package/dist/chunks/{loader-CICGtLp2.js → loader-CtoR-vO-.js} +1 -1
- package/dist/chunks/{localSearch-BxLYi6w_.js → localSearch-BU02Qsv9.js} +1 -1
- package/dist/chunks/localSearch-DyaB2Rm-.js +1 -0
- package/dist/chunks/{log-D2TIwHBV.js → log-DoSpAwRP.js} +1 -1
- package/dist/chunks/logoUtils-DLd6JKqW.js +1 -0
- package/dist/chunks/{magicDocs-Bkz7ZcmL.js → magicDocs-Bj8LYrN2.js} +2 -2
- package/dist/chunks/main-B_09WbaG.js +345 -0
- package/dist/chunks/managedEnv-BJGfe3m7.js +1 -0
- package/dist/chunks/{managedEnv-OPlzUPbJ.js → managedEnv-CIWJsuty.js} +1 -1
- package/dist/chunks/mcp-1nBvcNxw.js +1 -0
- package/dist/chunks/mcp-7DXpXMdT.js +2 -0
- package/dist/chunks/mcp-kw99WVi2.js +6 -0
- package/dist/chunks/memory-CjWvzR_9.js +1 -0
- package/dist/chunks/mode-CBKawxnD.js +2 -0
- package/dist/chunks/model-DpZaKZMb.js +1 -0
- package/dist/chunks/model-DwbqvCY2.js +1 -0
- package/dist/chunks/modelOptions-CXBfKFXA.js +1 -0
- package/dist/chunks/nativeInstaller-SmPeEisk.js +1 -0
- package/dist/chunks/{notifications-Bc6k-Ozy.js → notifications-ql0eSo0Y.js} +1 -1
- package/dist/chunks/onChangeAppState-D85b33R5.js +1 -0
- package/dist/chunks/open-Cyrr4E5x.js +1 -0
- package/dist/chunks/openai-D_j7-KW6.js +2 -0
- package/dist/chunks/overlayContext-CLjlCFBl.js +1 -0
- package/dist/chunks/{panel-CVS4SK_E.js → panel-DMZkOEiU.js} +1 -1
- package/dist/chunks/parser-2usBI4G-.js +1 -0
- package/dist/chunks/{parser-Cg6hSCmn.js → parser-UqADrvxF.js} +1 -1
- package/dist/chunks/partition-CwxTlmMd.js +1 -0
- package/dist/chunks/{pasteStore-P0zP-ch0.js → pasteStore-ovtxMVR5.js} +1 -1
- package/dist/chunks/permissions-CgsvWOk_.js +3 -0
- package/dist/chunks/pidLock-B-SW3Nhx.js +3 -0
- package/dist/chunks/plan-BJrWtXEh.js +1 -0
- package/dist/chunks/platform-DsMIk3eq.js +2 -0
- package/dist/chunks/plugin-D97VJAxW.js +17 -0
- package/dist/chunks/{pluginAutoupdate-ennb9k8_.js → pluginAutoupdate-DQqYDPVg.js} +1 -1
- package/dist/chunks/{pluginBlocklist-9OrNEh--.js → pluginBlocklist-BAr9WTup.js} +1 -1
- package/dist/chunks/pluginCliCommands-CUGPc853.js +1 -0
- package/dist/chunks/{pluginFlagging-js_-WmYj.js → pluginFlagging-BO_3qjfs.js} +1 -1
- package/dist/chunks/pluginOperations-rTrzu6Vg.js +2 -0
- package/dist/chunks/pluginStartupCheck-BRHnXlym.js +1 -0
- package/dist/chunks/{pluginStartupCheck-SRXOyqr7.js → pluginStartupCheck-BX6cv-vs.js} +1 -1
- package/dist/chunks/plugins-9crasx2V.js +4 -0
- package/dist/chunks/poorMode-BaS0DBUO.js +1 -0
- package/dist/chunks/{poorMode-B0QGV6Ci.js → poorMode-DmvzFAz_.js} +1 -1
- package/dist/chunks/print-Bi3xVdB3.js +13 -0
- package/dist/chunks/processBashCommand-BBtnCx-7.js +1 -0
- package/dist/chunks/processSlashCommand-jzF0GmLO.js +5 -0
- package/dist/chunks/{projectOnboardingState-B5YATuc6.js → projectOnboardingState--L3BKjOE.js} +1 -1
- package/dist/chunks/prompt-CmijKW7G.js +1 -0
- package/dist/chunks/prompt-DYBx_D0H.js +1 -0
- package/dist/chunks/{prompt-CJ1l3XXk.js → prompt-DzO1um1h.js} +4 -4
- package/dist/chunks/{promptEditor-DoGHJN_W.js → promptEditor-B6S_Rzcu.js} +2 -2
- package/dist/chunks/protocolHandler-BWgH1jaF.js +13 -0
- package/dist/chunks/{proxy-CDBfZjO7.js → proxy-BjkGlmBu.js} +1 -1
- package/dist/chunks/reconciler-CVMmAaCy.js +1 -0
- package/dist/chunks/refresh-CAGv8BJY.js +1 -0
- package/dist/chunks/reject-CEUkoI2G.js +1 -0
- package/dist/chunks/{reload-plugins-CQZFQLWP.js → reload-plugins-DeyJTx4s.js} +1 -1
- package/dist/chunks/rename-DPFis9g_.js +1 -0
- package/dist/chunks/{renderOptions-DV0dn0IW.js → renderOptions-DRS2EslG.js} +1 -1
- package/dist/chunks/resume-N4O5YI-S.js +2 -0
- package/dist/chunks/ripgrep-3omwGI-l.js +1 -0
- package/dist/chunks/ripgrep-CgQrN3XX.js +5 -0
- package/dist/chunks/{runtimeObserver-DEuR8z0f.js → runtimeObserver-C0CJvA3q.js} +1 -1
- package/dist/chunks/{runtimeObserver-PJ1o8GRA.js → runtimeObserver-DMSzdFWt.js} +4 -4
- package/dist/chunks/sandbox-adapter-D15jjHJR.js +1 -0
- package/dist/chunks/sandbox-toggle-Tbbaw18C.js +1 -0
- package/dist/chunks/searchExtraTools-BoFc__Eg.js +1 -0
- package/dist/chunks/select-Fq6g2Ejk.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +1 -0
- package/dist/chunks/{sessionObserver-BtKjvteq.js → sessionObserver-CRie77tp.js} +2 -2
- package/dist/chunks/sessionObserver-PcaVCVkX.js +1 -0
- package/dist/chunks/sessionStorage-Dkf7FRgA.js +1 -0
- package/dist/chunks/sessionTracing-D7rekMdW.js +11 -0
- package/dist/chunks/settings-8fwIkMDV.js +1 -0
- package/dist/chunks/settings-CodSADx8.js +24 -0
- package/dist/chunks/setup-DBiIrXrh.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-Bg_aIc5Z.js → shadowedRuleDetection-CTnYVrmP.js} +1 -1
- package/dist/chunks/{sideQuestion-D49GsfH7.js → sideQuestion-Cl8m2qYx.js} +3 -3
- package/dist/chunks/sinks-CiupmfTg.js +1 -0
- package/dist/chunks/sinks-DH83d_kd.js +1 -0
- package/dist/chunks/skillChangeDetector-BrrZaFkT.js +1 -0
- package/dist/chunks/{skillGapStore-CcFoHNLl.js → skillGapStore-es3K-aYe.js} +2 -2
- package/dist/chunks/{skillLifecycle-Bnz_4wE5.js → skillLifecycle-BcgoOQBk.js} +2 -2
- package/dist/chunks/{skillSearchPanel-C_5yUhqn.js → skillSearchPanel-CuDDb1L-.js} +4 -4
- package/dist/chunks/skills-BRtgqnLz.js +1 -0
- package/dist/chunks/{src-CiJCsqUl.js → src-C8gyNm5a.js} +1 -1
- package/dist/chunks/src-Db7K3F_i.js +3 -0
- package/dist/chunks/startupProfiler-D1NRu2nj.js +1 -0
- package/dist/chunks/startupProfiler-DF0AjiDf.js +3 -0
- package/dist/chunks/{state-B4jiUise.js → state-BQ4BEGin.js} +1 -1
- package/dist/chunks/state-D3gvDiu8.js +1 -0
- package/dist/chunks/status-WXA16wIM.js +1 -0
- package/dist/chunks/statusNoticeHelpers-BfmIub5L.js +1 -0
- package/dist/chunks/{stringUtils-C718f5ey.js → stringUtils-Bu_lJH5c.js} +1 -1
- package/dist/chunks/switcher-5gilU5_R.js +1 -0
- package/dist/chunks/{switcher-DZwUo5Ed.js → switcher-DMfuKuw_.js} +1 -1
- package/dist/chunks/{tasks-DdcUQEeD.js → tasks-B6gYXxOx.js} +1 -1
- package/dist/chunks/{templateJobs-C8qsPrLj.js → templateJobs-BW6TaqEC.js} +1 -1
- package/dist/chunks/{terminalSetup-B_10N_gE.js → terminalSetup-BgIXFBpd.js} +4 -4
- package/dist/chunks/{terminalSetup-qc2PlvOm.js → terminalSetup-C-g9Xvj3.js} +1 -1
- package/dist/chunks/{theme-f1h2QI8J.js → theme-9AZceq_m.js} +1 -1
- package/dist/chunks/tipRegistry-DtO1H_Wo.js +2 -0
- package/dist/chunks/{toolEventObserver-7QP38x4t.js → toolEventObserver-DTuJcREC.js} +1 -1
- package/dist/chunks/toolPool-DHS8jWaL.js +1 -0
- package/dist/chunks/{types-Dx7P7JLQ.js → types-97nL3naE.js} +16 -16
- package/dist/chunks/{udsClient-cQz6nJ_T.js → udsClient-CmYHFiBD.js} +1 -1
- package/dist/chunks/{use-select-navigation-hWL5VHnL.js → use-select-navigation-BStVRvcX.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-DWRFdFoU.js +1 -0
- package/dist/chunks/useMainLoopModel-DSN5HjV1.js +1 -0
- package/dist/chunks/useManagePlugins-ntnOf5OU.js +1 -0
- package/dist/chunks/useMergedTools-C5Yns9Ij.js +1 -0
- package/dist/chunks/useSearchInput-B_mY9wBq.js +1 -0
- package/dist/chunks/useSettingsErrors-CM7tThcp.js +1 -0
- package/dist/chunks/util-Bb2S6g9N.js +1 -0
- package/dist/chunks/{validatePlugin-BMSoeb_b.js → validatePlugin-D8WQ5z4W.js} +1 -1
- package/dist/chunks/vim-Dpnhgoz_.js +1 -0
- package/dist/chunks/worktree-a5oOPSYl.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -12
- package/dist/chunks/AddWorkspaceDirectory-Ch8IcWXO.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-Cyia0s4g.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-LjI_H_Au.js +0 -1
- package/dist/chunks/App-BOqh_1tN.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CSEuuoq9.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-CwfCwUr9.js +0 -1
- package/dist/chunks/CustomSelect-wmZ9jz0W.js +0 -1
- package/dist/chunks/DiffDialog-BpXIEWiE.js +0 -6
- package/dist/chunks/Doctor-CMpr7tdf.js +0 -1
- package/dist/chunks/Doctor-DqW6j3_B.js +0 -3
- package/dist/chunks/ExitFlow-DacaBTlk.js +0 -2
- package/dist/chunks/Grove-CNqYPWI6.js +0 -11
- package/dist/chunks/InvalidConfigDialog-0TMJItCC.js +0 -1
- package/dist/chunks/KeybindingProviderSetup-D49HHTXD.js +0 -1
- package/dist/chunks/MCPConnectionManager-Cie77ZAK.js +0 -1
- package/dist/chunks/MCPToolListView-B4ehtkXd.js +0 -1
- package/dist/chunks/McpParsingWarnings-Bff66RtJ.js +0 -1
- package/dist/chunks/MessageSelector-Dpd6Iywp.js +0 -3
- package/dist/chunks/Messages-DN7M3oS_.js +0 -10
- package/dist/chunks/Onboarding-CQmE3rUf.js +0 -1
- package/dist/chunks/PromptInputFooterSuggestions-HI6HH3TP.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-3QNUC2Cg.js +0 -1
- package/dist/chunks/QueryEngine-DdLWvJv6.js +0 -1
- package/dist/chunks/REPL-BqO9KcK_.js +0 -124
- package/dist/chunks/REPL-CmZmypfF.js +0 -1
- package/dist/chunks/ResumeConversation-DBqX7gva.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BsSoILFj.js +0 -1
- package/dist/chunks/Settings-B-7yBewS.js +0 -3
- package/dist/chunks/Spinner-ByQXTvAA.js +0 -1
- package/dist/chunks/TextInput-B8ruWRf2.js +0 -22
- package/dist/chunks/ThemePicker-BQErFFW1.js +0 -1
- package/dist/chunks/TrustDialog-BIhz6AZE.js +0 -1
- package/dist/chunks/_baseEach-CsIRoaTH.js +0 -1
- package/dist/chunks/add-dir-CrUDs19x.js +0 -1
- package/dist/chunks/agents-CGaCQeLw.js +0 -101
- package/dist/chunks/allErrors-BF73lon8.js +0 -1
- package/dist/chunks/analytics-DJobLaWP.js +0 -1
- package/dist/chunks/backgroundHousekeeping-Bq3LMsVR.js +0 -17
- package/dist/chunks/backgroundHousekeeping-Cl3Ox7Qh.js +0 -1
- package/dist/chunks/banner-Cu2-XUek.js +0 -2
- package/dist/chunks/branch-Yg_taNlT.js +0 -2
- package/dist/chunks/btw-udbprVvu.js +0 -1
- package/dist/chunks/caches-ChjIEcdd.js +0 -1
- package/dist/chunks/caches-DLJ6urv-.js +0 -1
- package/dist/chunks/client-BiqbIkwr.js +0 -1
- package/dist/chunks/client-CZ8nyVh5.js +0 -1
- package/dist/chunks/commands-CVCpJo7M.js +0 -1
- package/dist/chunks/compact-izk6RKHQ.js +0 -2
- package/dist/chunks/config-C-Y2qtB2.js +0 -3
- package/dist/chunks/config-CFqpXMFX.js +0 -1
- package/dist/chunks/config-DD8fCYXn.js +0 -1
- package/dist/chunks/context-BbVm4SWK.js +0 -1
- package/dist/chunks/context-noninteractive-x0HAzWhc.js +0 -1
- package/dist/chunks/conversation-DouVzO0K.js +0 -1
- package/dist/chunks/conversation-DrVkifKy.js +0 -1
- package/dist/chunks/conversationRecovery-DliPBo_z.js +0 -1
- package/dist/chunks/crossProjectResume-DxMy05_P.js +0 -40
- package/dist/chunks/cwd-Dc3NV7s8.js +0 -1
- package/dist/chunks/cwd-Pa83R95t.js +0 -1
- package/dist/chunks/datadog-Cu3s7P48.js +0 -1
- package/dist/chunks/debug-Bglx1aTu.js +0 -39
- package/dist/chunks/doctor-D_kV_D_l.js +0 -1
- package/dist/chunks/entry-Bxseqbi_.js +0 -13
- package/dist/chunks/esm-BXTZz3av.js +0 -1
- package/dist/chunks/execAsync-Bv2yxuGe.js +0 -1
- package/dist/chunks/exit-C_R_FgzR.js +0 -1
- package/dist/chunks/extraUsage-xMuDiNKh.js +0 -1
- package/dist/chunks/extractMemories-D4Dl1itt.js +0 -1
- package/dist/chunks/fast-DH-C5IZs.js +0 -1
- package/dist/chunks/fast-bopOPrtf.js +0 -1
- package/dist/chunks/fetchModelList-DC4VQpqa.js +0 -1
- package/dist/chunks/fetchModelList-FE8tzTDc.js +0 -1
- package/dist/chunks/fileSuggestions-C-9unnoJ.js +0 -3
- package/dist/chunks/firstPartyEventLogger-QmjjQmgt.js +0 -3
- package/dist/chunks/firstPartyEventLogger-lFeqhtfh.js +0 -1
- package/dist/chunks/generateSessionName-CQ03xlYI.js +0 -1
- package/dist/chunks/getMachineId-bsd-Cut1kHoA.js +0 -1
- package/dist/chunks/getMachineId-darwin-CsRhaP3y.js +0 -2
- package/dist/chunks/getMachineId-linux-Bd7UBNRQ.js +0 -1
- package/dist/chunks/getMachineId-unsupported-vFGP8E_8.js +0 -1
- package/dist/chunks/getMachineId-win-DamF2CH_.js +0 -1
- package/dist/chunks/goal-CdL29Y8C.js +0 -3
- package/dist/chunks/grok-C6WAslUT.js +0 -1
- package/dist/chunks/grove-O6qp7ITR.js +0 -1
- package/dist/chunks/help-DxanITNN.js +0 -1
- package/dist/chunks/history-BMycjPTT.js +0 -1
- package/dist/chunks/hooks-D9ApLkBp.js +0 -1
- package/dist/chunks/install-0D9u2dZw.js +0 -1
- package/dist/chunks/instrumentation-BFiGwntt.js +0 -21
- package/dist/chunks/keybindings-DZrF9iNd.js +0 -1
- package/dist/chunks/launchLocalMemory-DhJ56KDc.js +0 -3
- package/dist/chunks/launchOnboarding-DmMoZwv5.js +0 -8
- package/dist/chunks/loadAgentsDir-BbUR6pqH.js +0 -1
- package/dist/chunks/localSearch-zfn7jgrh.js +0 -1
- package/dist/chunks/logoUtils-CRxTutvr.js +0 -1
- package/dist/chunks/main-9ksgUUY_.js +0 -345
- package/dist/chunks/managedEnv-BEqrGqn1.js +0 -1
- package/dist/chunks/mcp-ChF12reQ.js +0 -1
- package/dist/chunks/mcp-DoEl5uah.js +0 -2
- package/dist/chunks/mcp-hp9qqjAy.js +0 -6
- package/dist/chunks/memory-Qv-wGNQ5.js +0 -1
- package/dist/chunks/mode-bFXPCR2P.js +0 -2
- package/dist/chunks/model-6lkW4o2c.js +0 -1
- package/dist/chunks/model-BvQFFOf8.js +0 -1
- package/dist/chunks/modelOptions-BBvF3wHK.js +0 -1
- package/dist/chunks/nativeInstaller-CdjmE9Zy.js +0 -1
- package/dist/chunks/onChangeAppState-DLjZ1x95.js +0 -1
- package/dist/chunks/open-BtQHzzL9.js +0 -1
- package/dist/chunks/openai-D46QvESE.js +0 -2
- package/dist/chunks/overlayContext-8--_fbvY.js +0 -1
- package/dist/chunks/parser-CG5RuOCK.js +0 -1
- package/dist/chunks/partition-DznN4XZH.js +0 -1
- package/dist/chunks/permissions-DmGFViHI.js +0 -3
- package/dist/chunks/pidLock-Cm4sW35f.js +0 -3
- package/dist/chunks/plan-CzGBz_87.js +0 -1
- package/dist/chunks/platform-BacQ6ACS.js +0 -2
- package/dist/chunks/plugin-CluR79xX.js +0 -17
- package/dist/chunks/pluginCliCommands-CJv5uhOG.js +0 -1
- package/dist/chunks/pluginOperations-CcUSHAIa.js +0 -2
- package/dist/chunks/pluginStartupCheck-CRBUO9gP.js +0 -1
- package/dist/chunks/plugins-IwwaCDba.js +0 -4
- package/dist/chunks/poorMode-G-pnu6NM.js +0 -1
- package/dist/chunks/print-CgszM1ea.js +0 -13
- package/dist/chunks/processBashCommand-D098WsqY.js +0 -1
- package/dist/chunks/processSlashCommand-DOQFjJ88.js +0 -5
- package/dist/chunks/prompt-BKPmDAuL.js +0 -1
- package/dist/chunks/prompt-CgOklk7z.js +0 -1
- package/dist/chunks/protocolHandler-DjQALaU2.js +0 -13
- package/dist/chunks/reconciler-ykkSPR-i.js +0 -1
- package/dist/chunks/refresh-Dn_I1R4v.js +0 -1
- package/dist/chunks/registerProtocol-CAsDme_E.js +0 -1
- package/dist/chunks/reject-DtcCfuZV.js +0 -1
- package/dist/chunks/rename-DyEfsZiq.js +0 -1
- package/dist/chunks/resume-BcXEDUqZ.js +0 -2
- package/dist/chunks/ripgrep-DLs8MraF.js +0 -1
- package/dist/chunks/ripgrep-Dl3y5r4m.js +0 -5
- package/dist/chunks/sandbox-adapter-DfB9kgQD.js +0 -1
- package/dist/chunks/sandbox-toggle-D9GDUsTl.js +0 -1
- package/dist/chunks/searchExtraTools-D4gMMQv0.js +0 -1
- package/dist/chunks/select-DIxfl_VN.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-lbgHnVvi.js +0 -1
- package/dist/chunks/sessionObserver-D6qzEdGJ.js +0 -1
- package/dist/chunks/sessionStorage-C_7gow_z.js +0 -1
- package/dist/chunks/sessionTracing-CtbeAD0s.js +0 -11
- package/dist/chunks/settings-B2jvL8Dp.js +0 -24
- package/dist/chunks/settings-CisDe8DB.js +0 -1
- package/dist/chunks/setup-qecdf-ES.js +0 -3
- package/dist/chunks/sinks-C-lP7uyO.js +0 -1
- package/dist/chunks/sinks-De-B1lPQ.js +0 -1
- package/dist/chunks/skillChangeDetector-DkOJoNhT.js +0 -1
- package/dist/chunks/skills-BE5scC-g.js +0 -1
- package/dist/chunks/src-CHw1lvBc.js +0 -3
- package/dist/chunks/startupProfiler-BH0FoI66.js +0 -1
- package/dist/chunks/startupProfiler-CJdr3SxP.js +0 -3
- package/dist/chunks/state-BhOKSFi5.js +0 -1
- package/dist/chunks/status-Dw09WZLd.js +0 -1
- package/dist/chunks/statusNoticeHelpers-BRQpUIlH.js +0 -1
- package/dist/chunks/switcher-CgZVah7U.js +0 -1
- package/dist/chunks/tipRegistry-B71o4qWr.js +0 -2
- package/dist/chunks/toolPool-V-7Yv0GA.js +0 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-BKwzUpgb.js +0 -1
- package/dist/chunks/useMainLoopModel-DxvV70Ru.js +0 -1
- package/dist/chunks/useManagePlugins-BXLXazrR.js +0 -1
- package/dist/chunks/useMergedTools-CCgnBJzO.js +0 -1
- package/dist/chunks/useSearchInput-CzopttqC.js +0 -1
- package/dist/chunks/useSettingsErrors-SFPWfxsA.js +0 -1
- package/dist/chunks/util-Cbb3S6SX.js +0 -1
- package/dist/chunks/vim-CoRp9lY1.js +0 -1
- package/dist/chunks/worktree-Vm-SNY5x.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./REPL-BqO9KcK_.js";export{e as REPL};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$s as t,Dr as n,Ip as r,Ln as i,Lp as a,Mr as o,Xr as ee,Ys as s,Zr as te,_r as c,bb as l,bm as ne,mb as u,o_ as d,qn as re,s_ as f,xm as p,yr as m,zp as ie,zr as ae}from"./loadAgentsDir-B0Anodo0.js";import{I as h,P as g,Wt as _,ai as v,dr as oe,ot as se,t as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{It as x,Wn as S}from"./state-B4jiUise.js";import{o as C,s as w}from"./log-D2TIwHBV.js";import{n as T,r as E}from"./analytics-DJobLaWP.js";import{n as ce}from"./conversationRecovery-DliPBo_z.js";import{r as D,t as O}from"./Spinner-ByQXTvAA.js";import{a as le,n as ue,s as de}from"./skillChangeDetector-DkOJoNhT.js";import{t as fe}from"./REPL-BqO9KcK_.js";import{a as pe,i as k,n as A,o as j,r as M,t as N}from"./crossProjectResume-DxMy05_P.js";import{dirname as P}from"path";var F=e(v(),1);l(),x(),j(),D(),d(),y(),u(),T(),r(),p(),k(),s(),A(),C(),c();var I=b();function L(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function R({commands:e,worktreePaths:r,initialTools:s,mcpClients:c,dynamicMcpConfig:l,debug:u,mainThreadAgentDefinition:d,autoConnectIdeFlag:p,strictMcpConfig:_=!1,systemPrompt:v,appendSystemPrompt:y,initialSearchQuery:b,disableSlashCommands:x=!1,forkSession:C,taskListId:T,filterByPr:D,thinkingConfig:k,onTurnComplete:A}){let{rows:j}=se(),R=a(e=>e.agentDefinitions),V=ie(),[H,U]=F.useState([]),[me,W]=F.useState(!0),[he,ge]=F.useState(!1),[G,_e]=F.useState(!1),[K,ve]=F.useState(null),[q,J]=F.useState(null),Y=F.useRef(null),X=F.useRef(0),Z=F.useMemo(()=>{let e=H.filter(e=>!e.isSidechain);if(D!==void 0){if(D===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof D==`number`)e=e.filter(e=>e.prNumber===D);else if(typeof D==`string`){let t=L(D);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[H,D]),ye=m();F.useEffect(()=>{o(r).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs),W(!1)}).catch(e=>{w(e),W(!1)})},[r]);let Q=F.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||re(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),U(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=F.useCallback(e=>{W(!0),(e?n():o(r)).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs)}).catch(e=>{w(e)}).finally(()=>{W(!1)})},[r]),be=F.useCallback(()=>{let e=!G;_e(e),$(e)},[G,$]);function xe(){process.exit(1)}async function Se(e){ge(!0);let n=performance.now(),r=N(e,G);if(r.isCrossProject&&!r.isSameRepoWorktree){let e=r.command,t=await oe(e);t&&process.stdout.write(t),J(e);return}try{let r=await ce(e,void 0);if(!r)throw Error(`Failed to load conversation`);r.sessionId&&!C?(S(ne(r.sessionId),e.fullPath?P(e.fullPath):null),await ee(),f(r.sessionId)):C&&r.contentReplacements?.length&&await ae(r.contentReplacements);let{agentDefinition:a}=le(r.agentSetting,d,R);V(e=>({...e,agent:a?.agentType}));let o=ue(r.agentName,r.agentColor);o&&V(e=>({...e,standaloneAgentContext:o})),t(r.agentName),te(C?{...r,worktreeSession:void 0}:r),C||(de(r.worktreeSession),r.sessionId&&i()),E(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-n)}),U([]),ve({messages:r.messages,fileHistorySnapshots:r.fileHistorySnapshots,contentReplacements:r.contentReplacements,agentName:r.agentName,agentColor:r.agentColor==="default"?void 0:r.agentColor,mainThreadAgentDefinition:a})}catch(e){throw E(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),w(e),e}}return q?(0,I.jsx)(B,{command:q}):K?(0,I.jsx)(fe,{debug:u,commands:e,initialTools:s,initialMessages:K.messages,initialFileHistorySnapshots:K.fileHistorySnapshots,initialContentReplacements:K.contentReplacements,initialAgentName:K.agentName,initialAgentColor:K.agentColor,mcpClients:c,dynamicMcpConfig:l,strictMcpConfig:_,systemPrompt:v,appendSystemPrompt:y,mainThreadAgentDefinition:K.mainThreadAgentDefinition,autoConnectIdeFlag:p,disableSlashCommands:x,taskListId:T,thinkingConfig:k,onTurnComplete:A}):me?(0,I.jsxs)(h,{children:[(0,I.jsx)(O,{}),(0,I.jsx)(g,{children:` Loading conversations…`})]}):he?(0,I.jsxs)(h,{children:[(0,I.jsx)(O,{}),(0,I.jsx)(g,{children:` Resuming conversation…`})]}):Z.length===0?(0,I.jsx)(z,{}):(0,I.jsx)(pe,{logs:Z,maxHeight:j,onCancel:xe,onSelect:Se,onLogsChanged:ye?()=>$(G):void 0,onLoadMore:Q,initialSearchQuery:b,showAllProjects:G,onToggleAllProjects:be,onAgenticSearch:M})}function z(){return _(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,I.jsxs)(h,{flexDirection:`column`,children:[(0,I.jsx)(g,{children:`No conversations found to resume.`}),(0,I.jsx)(g,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function B({command:e}){return F.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,I.jsxs)(h,{flexDirection:`column`,gap:1,children:[(0,I.jsx)(g,{children:`This conversation is from a different directory.`}),(0,I.jsxs)(h,{flexDirection:`column`,children:[(0,I.jsx)(g,{children:`To resume, run:`}),(0,I.jsxs)(g,{children:[` `,e]})]}),(0,I.jsx)(g,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{R as ResumeConversation};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{lh as e,uh as t}from"./loadAgentsDir-B0Anodo0.js";t();export{e as clearSearchExtraToolsDescriptionCache};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,n as r,o as i,t as a}from"./envUtils-DfkgIdYf.js";import{n as o,t as s}from"./figures-5ThXQEtq.js";import{Da as ee,I_ as te,Ip as c,L_ as ne,Lp as l,M_ as u,N_ as re,Oa as d,Op as f,P_ as p,Rp as ie,__ as ae,_r as m,b as h,bb as oe,g_ as g,h_ as se,j as ce,ka as le,kp as ue,mb as de,md as _,p_ as fe,pd as v,tr as pe,v_ as me,y_ as y,z_ as he,zp as ge}from"./loadAgentsDir-B0Anodo0.js";import{D as b,Gt as _e,H as ve,I as x,P as S,T as C,U as ye,Wt as be,Xn as xe,a as Se,ai as w,di as T,fi as E,j as D,k as Ce,n as O,ot as we,r as Te,t as k,x as Ee,y as De}from"./src-DL3w8VPk.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{It as j,st as Oe}from"./state-B4jiUise.js";import{n as ke,t as Ae}from"./cwd-Pa83R95t.js";import{Ft as je,Nt as Me,Pt as Ne,Rt as Pe,an as Fe,b as M,h as N,i as Ie,in as P,jt as Le,ln as Re,n as ze,s as Be,t as Ve,wn as He,xn as Ue,zt as We}from"./settings-B2jvL8Dp.js";import{_ as F,a as Ge,i as Ke,o as qe,p as Je,s as I}from"./config-C-Y2qtB2.js";import{o as L,s as Ye}from"./log-D2TIwHBV.js";import{n as Xe,r as R}from"./analytics-DJobLaWP.js";import{_ as Ze,f as z}from"./startupProfiler-CJdr3SxP.js";import{F as Qe,G as $e,H as B,K as et,N as tt,P as nt,U as rt,Yt as V,Zt as it,d as at,h as ot,m as st}from"./model-BvQFFOf8.js";import{a as ct,c as lt,f as ut,m as dt}from"./proxy-CDBfZjO7.js";import{n as ft,t as H}from"./TextInput-B8ruWRf2.js";import{n as pt,t as mt}from"./useExitOnCtrlCDWithKeybindings-BKwzUpgb.js";import{n as ht,t as gt}from"./select-DIxfl_VN.js";import{i as U,n as _t,r as vt}from"./modalContext-DDZdU1J8.js";import{g as yt,h as bt}from"./pidLock-Cm4sW35f.js";import{n as W,t as xt}from"./nativeInstaller-CdjmE9Zy.js";import{n as St,t as Ct}from"./allErrors-BF73lon8.js";import{t as wt}from"./CustomSelect-wmZ9jz0W.js";import{n as Tt,t as Et}from"./ThemePicker-BQErFFW1.js";import{i as Dt,n as Ot,r as kt,t as At}from"./extraUsage-xMuDiNKh.js";import{n as jt,t as Mt}from"./AgentsMdExternalIncludesDialog-LjI_H_Au.js";import{t as Nt}from"./SearchBox-C9xxQzh1.js";import{n as Pt,t as Ft}from"./useSearchInput-CzopttqC.js";function It(){return[]}function Lt(e,t=null,n){let r=e?.find(e=>e.name===`ide`);if(t){let e=he(t.ideType),i=te(t.ideType)?`plugin`:`extension`;if(t.error)return[{label:`IDE`,value:(0,Kt.jsxs)(S,{children:[D(`error`,n)(s.cross),` Error installing `,e,` `,i,`:`,` `,t.error,`
|
|
2
|
-
`,`Please restart your IDE and try again.`]})}];if(t.installed)return r&&r.type===`connected`?t.installedVersion===r.serverInfo?.version?[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion}`}]:[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion} (server version: ${r.serverInfo?.version})`}]:[{label:`IDE`,value:`Installed ${e} ${i}`}]}else if(r){let e=u(r)??`IDE`;return r.type===`connected`?[{label:`IDE`,value:`Connected to ${e} extension`}]:[{label:`IDE`,value:`${D(`error`,n)(s.cross)} Not connected to ${e}`}]}return[]}function Rt(e=[],t){let n=e.filter(e=>e.name!==`ide`);if(!n.length)return[];let r={connected:0,pending:0,needsAuth:0,failed:0};for(let e of n)e.type===`connected`?r.connected++:e.type===`pending`?r.pending++:e.type===`needs-auth`?r.needsAuth++:r.failed++;let i=[];return r.connected&&i.push(D(`success`,t)(`${r.connected} connected`)),r.needsAuth&&i.push(D(`warning`,t)(`${r.needsAuth} need auth`)),r.pending&&i.push(D(`inactive`,t)(`${r.pending} pending`)),r.failed&&i.push(D(`error`,t)(`${r.failed} failed`)),[{label:`MCP servers`,value:`${i.join(`, `)} ${D(`inactive`,t)(`· /mcp`)}`}]}async function zt(){let e=g(await ae()),t=[];return e.forEach(e=>{let n=Ue(e.path);t.push(`Large ${n} will impact performance (${z(e.content.length)} chars > ${z(fe)})`)}),t}function Bt(){return[{label:`Setting sources`,value:P().filter(e=>{let t=Be(e);return t!==null&&Object.keys(t).length>0}).map(e=>{if(e===`policySettings`){let e=Ie();if(e===null)return null;switch(e){case`plist`:return`Enterprise managed settings (plist)`;case`hklm`:return`Enterprise managed settings (HKLM)`;case`file`:{let{hasBase:e,hasDropIns:t}=ze();return e&&t?`Enterprise managed settings (file + drop-ins)`:t?`Enterprise managed settings (drop-ins)`:`Enterprise managed settings (file)`}case`hkcu`:return`Enterprise managed settings (HKCU)`}}return Fe(e)}).filter(e=>e!==null)}]}async function Vt(){return(await W()).map(e=>e.message)}async function Ht(){let e=await bt(),t=[],{errors:n}=Ct();if(n.length>0){let e=Array.from(new Set(n.map(e=>e.file))).join(`, `);t.push(`Found invalid settings files: ${e}. They will be ignored.`)}return e.warnings.forEach(e=>{t.push(e.issue)}),e.hasUpdatePermissions===!1&&t.push(`No write permissions for auto-updates (requires sudo)`),t}function Ut(){return[]}function Wt(){let e=V(),t=[];if(e!==`firstParty`){let n={bedrock:`AWS Bedrock`,vertex:`Google Vertex AI`,foundry:`Microsoft Foundry`,gemini:`Gemini API`,grok:`Grok API`,openai:`OpenAI API`}[e];t.push({label:`API provider`,value:n})}if(e===`firstParty`){let e=process.env.ANTHROPIC_BASE_URL;e&&t.push({label:`API base URL`,value:e})}else if(e===`bedrock`){let e=process.env.BEDROCK_BASE_URL;e&&t.push({label:`Bedrock base URL`,value:e}),t.push({label:`AWS region`,value:a()}),n(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&t.push({value:`AWS auth skipped`})}else if(e===`vertex`){let e=process.env.VERTEX_BASE_URL;e&&t.push({label:`Vertex base URL`,value:e});let i=process.env.ANTHROPIC_VERTEX_PROJECT_ID;i&&t.push({label:`GCP project`,value:i}),t.push({label:`Default region`,value:r()}),n(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&t.push({value:`GCP auth skipped`})}else if(e===`foundry`){let e=process.env.ANTHROPIC_FOUNDRY_BASE_URL;e&&t.push({label:`Microsoft Foundry base URL`,value:e});let r=process.env.ANTHROPIC_FOUNDRY_RESOURCE;r&&t.push({label:`Microsoft Foundry resource`,value:r}),n(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH)&&t.push({value:`Microsoft Foundry auth skipped`})}else if(e===`gemini`){let e=process.env.GEMINI_BASE_URL||`https://generativelanguage.googleapis.com/v1beta`;t.push({label:`Gemini base URL`,value:e})}else if(e===`grok`){let e=process.env.GROK_BASE_URL;t.push({label:`Grok base URL`,value:e})}else if(e===`openai`){let e=process.env.OPENAI_BASE_URL;t.push({label:`OpenAI base URL`,value:e})}let i=ct();i&&t.push({label:`Proxy`,value:i});let o=ut();return process.env.NODE_EXTRA_CA_CERTS&&t.push({label:`Additional CA cert(s)`,value:process.env.NODE_EXTRA_CA_CERTS}),o&&(o.cert&&process.env.CLAUDE_CODE_CLIENT_CERT&&t.push({label:`mTLS client cert`,value:process.env.CLAUDE_CODE_CLIENT_CERT}),o.key&&process.env.CLAUDE_CODE_CLIENT_KEY&&t.push({label:`mTLS client key`,value:process.env.CLAUDE_CODE_CLIENT_KEY})),t}function Gt(e){return ot(e)}var Kt,qt=e((()=>{o(),k(),y(),yt(),i(),He(),Ze(),p(),at(),it(),dt(),xt(),lt(),St(),Re(),N(),Kt=A()}));function Jt(){let e=Oe();return[{label:`Version`,value:`0.0.24`},{label:`Session name`,value:pe(e)??(0,G.jsx)(S,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:Ae()},...Ut(),...Wt()]}function Yt({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:Gt(e)},...Lt(t.clients,r.options.ideInstallationStatus,n),...Rt(t.clients,n),...It(),...Bt()]}async function Xt(){return[...await Vt(),...await Ht(),...await zt()]}function Zt({value:e}){return Array.isArray(e)?(0,G.jsx)(x,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,G.jsxs)(S,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,G.jsx)(S,{children:e}):e}function Qt({context:e,diagnosticsPromise:t}){let n=l(e=>e.mainLoopModel),r=l(e=>e.mcp),[i]=ve(),a=en.useMemo(()=>[Jt(),Yt({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=vt()?1:void 0;return(0,G.jsxs)(x,{flexDirection:`column`,flexGrow:o,children:[(0,G.jsxs)(x,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,G.jsx)(x,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,G.jsxs)(x,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,G.jsxs)(S,{bold:!0,children:[e,`:`]}),(0,G.jsx)(Zt,{value:t})]},n))},t)),(0,G.jsx)(tn.Suspense,{fallback:null,children:(0,G.jsx)($t,{promise:t})})]}),(0,G.jsx)(S,{dimColor:!0,children:(0,G.jsx)(v,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function $t({promise:e}){let t=(0,tn.use)(e);return t.length===0?null:(0,G.jsxs)(x,{flexDirection:`column`,paddingBottom:1,children:[(0,G.jsx)(S,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,G.jsxs)(x,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,G.jsx)(S,{color:`error`,children:s.warning}),typeof e==`string`?(0,G.jsx)(S,{wrap:`wrap`,children:e}):e]},t))]})}var en,tn,G,nn=e((()=>{o(),en=t(w(),1),tn=t(w(),1),j(),_t(),k(),c(),ke(),m(),qt(),_(),G=A()}));function rn({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,K.jsxs)(De,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,K.jsxs)(S,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,K.jsx)(S,{dimColor:!0,children:`How would you like to handle this?`}),(0,K.jsx)(gt,{options:[{label:`Allow possible downgrade to stable version`,value:`downgrade`},{label:`Stay on current version (${e}) until stable catches up`,value:`stay`}],onChange:n})]})}var K,an=e((()=>{k(),wt(),K=A()}));function on(e){return Object.entries(e).map(([e,t])=>({label:t?.name??ln,value:e,description:t?.description??un}))}function sn({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,cn.useState)([]),[o,s]=(0,cn.useState)(!0);(0,cn.useEffect)(()=>{d(Ae()).then(e=>{let t=on(e);a(t),s(!1)}).catch(()=>{let e=on(ee);a(e),s(!1)})},[]);let te=(0,cn.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(De,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(x,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(x,{marginTop:1,children:(0,q.jsx)(S,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,q.jsx)(S,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(gt,{options:i,onChange:te,visibleOptionCount:10,defaultValue:e})]})})}var cn,q,ln,un,dn=e((()=>{cn=t(w(),1),le(),k(),ke(),ht(),q=A(),ln=`Default`,un=`Work Mate completes coding tasks efficiently and provides concise responses`}));function fn({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,pn.useState)(e),[a,o]=(0,pn.useState)((e??``).length);be(`confirm:no`,n,{context:`Settings`});function ee(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(x,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(S,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(x,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(S,{children:s.pointer}),(0,J.jsx)(H,{value:r??``,onChange:i,onSubmit:ee,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${s.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:o})]}),(0,J.jsx)(S,{dimColor:!0,children:`Leave empty for default (English)`})]})}var pn,J,mn=e((()=>{o(),pn=t(w(),1),k(),de(),ft(),J=A()}));function hn({onClose:e,context:t,setTabsHidden:r,onIsSearchModeChange:i,contentHeight:a}){let{headerFocused:o,focusHeader:ee}=Se(),te=vt(),[,c]=ve(),u=ye(),[d,f]=(0,X.useState)(I()),p=Y.useRef(I()),[m,h]=(0,X.useState)(Ve()),oe=Y.useRef(Ve()),[g,le]=(0,X.useState)(m?.outputStyle||`default`),de=Y.useRef(g),[_,fe]=(0,X.useState)(m?.language),pe=Y.useRef(_),[y,he]=(0,X.useState)(0),[w,E]=(0,X.useState)(0),[D,O]=(0,X.useState)(!1),Te=xe(),{rows:k}=we(),Ee=a??Math.min(Math.floor(k*.8),30),A=Math.max(5,Ee-10),j=l(e=>e.mainLoopModel),Oe=l(e=>e.verbose),ke=l(e=>e.thinkingEnabled),Ae=l(e=>$e()?e.fastMode:!1);l(e=>e.promptSuggestionEnabled);let Fe=Ne(m?.permissions?.defaultMode??`default`),N=ge(),[Ie,P]=(0,X.useState)({}),Le=Y.useRef(ke),[Re]=(0,X.useState)(()=>Be(`localSettings`)),[ze]=(0,X.useState)(()=>Be(`userSettings`)),He=Y.useRef(u),Ue=ie(),[Je]=(0,X.useState)(()=>{let e=Ue.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,settings:e.settings}}),L=Y.useRef(!1),[Xe,Ze]=(0,X.useState)(!1),[z,B]=(0,X.useState)(null),{query:V,setQuery:it,cursorOffset:at}=Pt({isActive:D&&z===null&&!o,onExit:()=>O(!1),onExitUp:ee,passthroughCtrlKeys:[`c`,`d`]}),ct=D&&!o;Y.useEffect(()=>{i?.(ct)},[ct,i]);let lt=re(t.options.mcpClients),ut=!n(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),dt=Y.use(ae(!0)),ft=me(dt),H=Ge();function pt(e){R(`tengu_config_model_changed`,{from_model:j,to_model:e}),N(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),P(t=>{let n=ot(e)+(Ot(e,!1,st())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function mt(e){F(t=>({...t,verbose:e})),f({...I(),verbose:e}),N(t=>({...t,verbose:e})),P(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let ht=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:d.autoCompactEnabled,type:`boolean`,onChange(e){F(t=>({...t,autoCompactEnabled:e})),f({...I(),autoCompactEnabled:e}),R(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:m?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{spinnerTipsEnabled:e}),h(t=>({...t,spinnerTipsEnabled:e})),R(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:m?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{cacheWarningEnabled:e}),h(t=>({...t,cacheWarningEnabled:e})),R(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:m?.prefersReducedMotion??!1,type:`boolean`,onChange(e){M(`localSettings`,{prefersReducedMotion:e}),h(t=>({...t,prefersReducedMotion:e})),N(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}})),R(`tengu_reduce_motion_setting_changed`,{enabled:e})}},{id:`thinkingEnabled`,label:`Thinking mode`,value:ke??!0,type:`boolean`,onChange(e){N(t=>({...t,thinkingEnabled:e})),M(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),R(`tengu_thinking_toggled`,{enabled:e})}},...$e()&&rt()?[{id:`fastMode`,label:`Fast mode (${tt} only)`,value:!!Ae,type:`boolean`,onChange(e){nt(),M(`userSettings`,{fastMode:e?!0:void 0}),e?(N(e=>({...e,mainLoopModel:Qe(),mainLoopModelForSession:null,fastMode:!0})),P(e=>({...e,model:Qe(),"Fast mode":`ON`}))):(N(e=>({...e,fastMode:!1})),P(e=>({...e,"Fast mode":`OFF`})))}}]:[],...ut?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:d.fileCheckpointingEnabled,type:`boolean`,onChange(e){F(t=>({...t,fileCheckpointingEnabled:e})),f({...I(),fileCheckpointingEnabled:e}),R(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Oe,type:`boolean`,onChange:mt},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:d.terminalProgressBarEnabled,type:`boolean`,onChange(e){F(t=>({...t,terminalProgressBarEnabled:e})),f({...I(),terminalProgressBarEnabled:e}),R(`tengu_terminal_progress_bar_setting_changed`,{enabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:d.showTurnDuration,type:`boolean`,onChange(e){F(t=>({...t,showTurnDuration:e})),f({...I(),showTurnDuration:e}),R(`tengu_show_turn_duration_setting_changed`,{enabled:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:Fe,options:(()=>{let e=[`default`,`plan`];return[...e,...We.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=Ne(e),n=t===`auto`?t:Me(t)?Pe(t):t,r=M(`userSettings`,{permissions:{...m?.permissions,defaultMode:n}});if(r.error){Ye(r.error);return}h(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),P(t=>({...t,defaultPermissionMode:e})),R(`tengu_config_changed`,{setting:`defaultPermissionMode`,value:e})}},{id:`respectGitignore`,label:`Respect .gitignore in file picker`,value:d.respectGitignore,type:`boolean`,onChange(e){F(t=>({...t,respectGitignore:e})),f({...I(),respectGitignore:e}),R(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...ue()?[{id:`copyOnSelect`,label:`Copy on select`,value:d.copyOnSelect??!0,type:`boolean`,onChange(e){F(t=>({...t,copyOnSelect:e})),f({...I(),copyOnSelect:e}),R(`tengu_config_changed`,{setting:`copyOnSelect`,value:String(e)})}}]:[],H?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:m?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:u,type:`managedEnum`,onChange:c},{id:`notifChannel`,label:`Notifications`,value:d.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){F(t=>({...t,preferredNotifChannel:e})),f({...I(),preferredNotifChannel:e})}},{id:`outputStyle`,label:`Output style`,value:g,type:`managedEnum`,onChange:()=>{}},{id:`language`,label:`Language`,value:_??`Default (English)`,type:`managedEnum`,onChange:()=>{}},{id:`editorMode`,label:`Editor mode`,value:d.editorMode===`emacs`?`normal`:d.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){F(t=>({...t,editorMode:e})),f({...I(),editorMode:e}),R(`tengu_editor_mode_changed`,{mode:e,source:`config_panel`})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:d.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){F(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),f({...I(),prStatusFooterEnabled:e}),R(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:j===null?`Default (recommended)`:j,type:`managedEnum`,onChange:pt},...lt?[{id:`diffTool`,label:`Diff tool`,value:d.diffTool??`auto`,options:[`terminal`,`auto`],type:`enum`,onChange(e){F(t=>({...t,diffTool:e})),f({...I(),diffTool:e}),R(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...ne()?[]:[{id:`autoConnectIde`,label:`Auto-connect to IDE (external terminal)`,value:d.autoConnectIde??!1,type:`boolean`,onChange(e){F(t=>({...t,autoConnectIde:e})),f({...I(),autoConnectIde:e}),R(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...ne()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:d.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){F(t=>({...t,autoInstallIdeExtension:e})),f({...I(),autoInstallIdeExtension:e}),R(`tengu_auto_install_ide_extension_changed`,{enabled:e,source:`config_panel`})}}]:[],...ft?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:qe().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[]],U=Y.useMemo(()=>{if(!V)return ht;let e=V.toLowerCase();return ht.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[ht,V]);Y.useEffect(()=>{if(y>=U.length){let e=Math.max(0,U.length-1);he(e),E(Math.max(0,e-A+1));return}E(e=>y<e?y:y>=e+A?y-A+1:e)},[U.length,y,A]);let _t=(0,X.useCallback)(e=>{E(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),yt=(0,X.useCallback)(()=>{if(z!==null)return;let t=Object.entries(Ie).map(([e,t])=>(R(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${T.bold(t)}`));d.theme!==p.current.theme&&t.push(`Set theme to ${T.bold(d.theme)}`),d.preferredNotifChannel!==p.current.preferredNotifChannel&&t.push(`Set notifications to ${T.bold(d.preferredNotifChannel)}`),g!==de.current&&t.push(`Set output style to ${T.bold(g)}`),_!==pe.current&&t.push(`Set response language to ${T.bold(_??`Default (English)`)}`),d.editorMode!==p.current.editorMode&&t.push(`Set editor mode to ${T.bold(d.editorMode||`emacs`)}`),d.diffTool!==p.current.diffTool&&t.push(`Set diff tool to ${T.bold(d.diffTool)}`),d.autoConnectIde!==p.current.autoConnectIde&&t.push(`${d.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),d.autoInstallIdeExtension!==p.current.autoInstallIdeExtension&&t.push(`${d.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),d.autoCompactEnabled!==p.current.autoCompactEnabled&&t.push(`${d.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),d.respectGitignore!==p.current.respectGitignore&&t.push(`${d.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),d.copyOnSelect!==p.current.copyOnSelect&&t.push(`${d.copyOnSelect?`Enabled`:`Disabled`} copy on select`),d.terminalProgressBarEnabled!==p.current.terminalProgressBarEnabled&&t.push(`${d.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),d.showStatusInTerminalTab!==p.current.showStatusInTerminalTab&&t.push(`${d.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),d.showTurnDuration!==p.current.showTurnDuration&&t.push(`${d.showTurnDuration?`Enabled`:`Disabled`} turn duration`),m?.autoUpdatesChannel!==oe.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${T.bold(m?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
|
|
3
|
-
`)):e(`Config dialog dismissed`,{display:`system`})},[z,Ie,d,j,g,_,m?.autoUpdatesChannel,$e()?m?.fastMode:void 0,e]),bt=(0,X.useCallback)(()=>{u!==He.current&&c(He.current),F(()=>p.current);let e=Re;M(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=ze;M(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=Je;N(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,settings:n.settings,toolPermissionContext:ce(e.toolPermissionContext)}))},[u,c,Re,ze,Je,N]);be(`confirm:no`,(0,X.useCallback)(()=>{z===null&&(L.current&&bt(),e(`Config dialog dismissed`,{display:`system`}))},[z,bt,e]),{context:`Settings`,isActive:z===null&&!D&&!o}),be(`settings:close`,yt,{context:`Settings`,isActive:z===null&&!D&&!o});let W=(0,X.useCallback)(()=>{let e=U[y];if(e?.onChange){if(e.type===`boolean`){L.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===Le.current?Ze(!1):t.messages.some(e=>e.type===`assistant`)&&Ze(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:B(`Theme`),r(!0);return;case`model`:B(`Model`),r(!0);return;case`showExternalIncludesDialog`:B(`ExternalIncludes`),r(!0);return;case`outputStyle`:B(`OutputStyle`),r(!0);return;case`language`:B(`Language`),r(!0);return}if(e.id===`autoUpdatesChannel`){if(H){B(`EnableAutoUpdates`),r(!0);return}(m?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),r(!0)):(L.current=!0,M(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),h(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})),R(`tengu_autoupdate_channel_changed`,{channel:`latest`}));return}if(e.type===`enum`){L.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[H,U,y,m?.autoUpdatesChannel,r]),xt=e=>{Ze(!1);let t=Math.max(0,Math.min(U.length-1,y+e));he(t),_t(t)};return _e({"select:previous":()=>{y===0?(Ze(!1),O(!0),E(0)):xt(-1)},"select:next":()=>xt(1),"scroll:lineUp":()=>xt(-1),"scroll:lineDown":()=>xt(1),"select:accept":W,"select:previousValue":()=>W(),"select:nextValue":()=>W(),"settings:search":()=>{O(!0),it(``)}},{context:`Settings`,isActive:z===null&&!D&&!o}),(0,Z.jsx)(x,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!o){if(D){if(e.key===`escape`){e.preventDefault(),V.length>0?it(``):O(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),O(!1),he(0),E(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),W();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),O(!0),it(e.key))}},[z,o,D,V,it,W]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Et,{onThemeSelect:e=>{L.current=!0,c(e),B(null),r(!1)},onCancel:()=>{B(null),r(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(x,{children:(0,Z.jsx)(S,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kt,{initial:j,onSelect:e=>{L.current=!0,pt(e),B(null),r(!1)},onCancel:()=>{B(null),r(!1)},showFastModeNotice:$e()?Ae&&et(j)&&rt():!1}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Mt,{onDone:()=>{B(null),r(!1)},externalIncludes:se(dt)}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):z===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sn,{initialStyle:g,onComplete:e=>{L.current=!0,le(e??`default`),B(null),r(!1),M(`localSettings`,{outputStyle:e}),R(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{B(null),r(!1)}}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fn,{initialLanguage:_,onComplete:e=>{L.current=!0,fe(e),B(null),r(!1),M(`userSettings`,{language:e}),R(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{B(null),r(!1)}}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):z===`EnableAutoUpdates`?(0,Z.jsx)(De,{title:`Enable Auto-Updates`,onCancel:()=>{B(null),r(!1)},hideBorder:!0,hideInputGuide:!0,children:H?.type===`config`?(0,Z.jsx)(gt,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{L.current=!0,B(null),r(!1),F(e=>({...e,autoUpdates:!0})),f({...I(),autoUpdates:!0}),M(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),h(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0})),R(`tengu_autoupdate_enabled`,{channel:e})}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(S,{children:H?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),H?.type===`env`&&(0,Z.jsxs)(S,{dimColor:!0,children:[`Unset `,H.envVar,` to re-enable auto-updates.`]})]})}):z===`ChannelDowngrade`?(0,Z.jsx)(rn,{currentVersion:`0.0.24`,onChoice:e=>{if(B(null),r(!1),e===`cancel`)return;L.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.24`),M(`userSettings`,t),h(e=>({...e,...t})),R(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(x,{flexDirection:`column`,gap:1,marginY:te?void 0:1,children:[(0,Z.jsx)(Ce,{query:V,isFocused:D&&!o,isTerminalFocused:Te,cursorOffset:at,placeholder:`Search settings…`}),(0,Z.jsx)(x,{flexDirection:`column`,children:U.length===0?(0,Z.jsxs)(S,{dimColor:!0,italic:!0,children:[`No settings match "`,V,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[w>0&&(0,Z.jsxs)(S,{dimColor:!0,children:[s.arrowUp,` `,w,` more above`]}),U.slice(w,w+A).map((e,t)=>{let n=w+t===y&&!o&&!D;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(x,{width:`100%`,children:[(0,Z.jsx)(x,{width:44,children:(0,Z.jsxs)(S,{color:n?`suggestion`:void 0,children:[n?s.pointer:` `,` `,e.label]})}),(0,Z.jsx)(x,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:e.value.toString()}),Xe&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(S,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:_n[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(gn,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:je(e.value)}):e.id===`autoUpdatesChannel`&&H?(0,Z.jsxs)(x,{flexDirection:`column`,children:[(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(S,{dimColor:!0,children:[`(`,Ke(H),`)`]})]}):(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),w+A<U.length&&(0,Z.jsxs)(S,{dimColor:!0,children:[s.arrowDown,` `,U.length-w-A,` more below`]})]})}),o?(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(b,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):D?(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(S,{children:`Type to filter`}),(0,Z.jsx)(b,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(b,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(v,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(v,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(v,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function gn({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(S,{children:[`iTerm2 `,(0,Z.jsx)(S,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(S,{children:[`Terminal Bell `,(0,Z.jsx)(S,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(S,{children:[`Kitty `,(0,Z.jsx)(S,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(S,{children:[`Ghostty `,(0,Z.jsx)(S,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var Y,X,Z,_n,vn=e((()=>{k(),Y=t(w(),1),X=t(w(),1),de(),o(),Je(),E(),Le(),h(),L(),Xe(),Tt(),c(),Dt(),at(),At(),jt(),an(),wt(),dn(),mn(),y(),_(),_t(),Nt(),p(),N(),le(),i(),Ft(),oe(),B(),f(),Z=A(),_n={auto:`Auto (match terminal)`,dark:`Dark mode`,light:`Light mode`,"dark-daltonized":`Dark mode (colorblind-friendly)`,"light-daltonized":`Light mode (colorblind-friendly)`,"dark-ansi":`Dark mode (ANSI colors only)`,"light-ansi":`Light mode (ANSI colors only)`}}));function yn({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[s,ee]=(0,Q.useState)(!1),te=vt(),{rows:c}=U(we()),ne=te?c+1:Math.max(15,Math.min(Math.floor(c*.8),30)),[l]=(0,Q.useState)(()=>Xt().catch(()=>[]));return pt(),be(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&s)}),(0,$.jsx)(Ee,{color:`permission`,children:(0,$.jsx)(Te,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||te?void 0:ne,children:[(0,$.jsx)(O,{title:`Status`,children:(0,$.jsx)(Qt,{context:t,diagnosticsPromise:l})},`status`),(0,$.jsx)(O,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(hn,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:ee,contentHeight:ne})})},`config`)]})})}var Q,$,bn=e((()=>{Q=t(w(),1),de(),mt(),oe(),_t(),k(),nn(),vn(),$=A()}));export{bn as n,yn as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as f,t as p}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{n as m,t as h}from"./figures-5ThXQEtq.js";import{AC as g,Gy as _,Ip as v,Jy as y,Ky as b,Lp as ee,Mp as x,Np as te,Xy as S,Yy as C,Zy as ne,bb as w,fs as re,jC as ie,nb as ae,ps as oe,qy as T,rb as se,zp as ce}from"./loadAgentsDir-B0Anodo0.js";import{Gr as E,H as le,I as D,P as O,T as ue,ai as k,mt as de,ot as fe,t as A}from"./src-DL3w8VPk.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{It as M,Jn as pe,m as me,qn as he}from"./state-B4jiUise.js";import{Hn as ge,Vn as N,h as _e,t as P}from"./settings-B2jvL8Dp.js";import{p as ve,s as ye}from"./config-C-Y2qtB2.js";import{n as be,o as xe}from"./intl-D2kgJmX7.js";import{S as Se,_ as Ce,f as we,l as Te}from"./startupProfiler-CJdr3SxP.js";import{o as Ee}from"./TextInput-B8ruWRf2.js";import{a as De,c as Oe,l as ke,n as Ae,o as je,r as Me,s as Ne,t as Pe,u as Fe}from"./SpinnerGlyph-CmkRUvHe.js";import{watch as Ie}from"fs";var Le,Re,ze=e((()=>{M(),n(),Le=class e{constructor(e){r(this,`activeOperations`,new Set),r(this,`lastUserActivityTime`,0),r(this,`lastCLIRecordedTime`,void 0),r(this,`isCLIActive`,!1),r(this,`USER_ACTIVITY_TIMEOUT_MS`,5e3),r(this,`getNow`,void 0),r(this,`getActiveTimeCounter`,void 0),this.getNow=e?.getNow??(()=>Date.now()),this.getActiveTimeCounter=e?.getActiveTimeCounter??me,this.lastCLIRecordedTime=this.getNow()}static getInstance(){return e.instance||(e.instance=new e),e.instance}static resetInstance(){e.instance=null}static createInstance(t){return e.instance=new e(t),e.instance}recordUserActivity(){if(!this.isCLIActive&&this.lastUserActivityTime!==0){let e=(this.getNow()-this.lastUserActivityTime)/1e3;if(e>0){let t=this.getActiveTimeCounter();t&&e<this.USER_ACTIVITY_TIMEOUT_MS/1e3&&t.add(e,{type:`user`})}}this.lastUserActivityTime=this.getNow()}startCLIActivity(e){this.activeOperations.has(e)&&this.endCLIActivity(e);let t=this.activeOperations.size===0;this.activeOperations.add(e),t&&(this.isCLIActive=!0,this.lastCLIRecordedTime=this.getNow())}endCLIActivity(e){if(this.activeOperations.delete(e),this.activeOperations.size===0){let e=this.getNow(),t=(e-this.lastCLIRecordedTime)/1e3;if(t>0){let e=this.getActiveTimeCounter();e&&e.add(t,{type:`cli`})}this.lastCLIRecordedTime=e,this.isCLIActive=!1}}async trackOperation(e,t){this.startCLIActivity(e);try{return await t()}finally{this.endCLIActivity(e)}}getActivityStates(){return{isUserActive:(this.getNow()-this.lastUserActivityTime)/1e3<this.USER_ACTIVITY_TIMEOUT_MS/1e3,isCLIActive:this.isCLIActive,activeOperationCount:this.activeOperations.size}}},r(Le,`instance`,null),Re=Le.getInstance()}));function Be(){let e=P().spinnerVerbs;return e?e.mode===`replace`?e.verbs.length>0?e.verbs:Ve:[...Ve,...e.verbs]:Ve}var Ve,He=e((()=>{_e(),Ve=`Accomplishing.Actioning.Actualizing.Architecting.Baking.Beaming.Beboppin'.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Bunning.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Dilly-dallying.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Fiddle-faddling.Finagling.Flambéing.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Gesticulating.Germinating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Mustering.Musing.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzle-dazzling.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Sautéing.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Sock-hopping.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Topsy-turvying.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`)}));function F(e,t){let n=parseInt(e.id,10),r=parseInt(t.id,10);return!isNaN(n)&&!isNaN(r)?n-r:e.id.localeCompare(t.id)}function Ue({tasks:e,isStandalone:t=!1}){let[,n]=I.useState(0),{rows:r,columns:i}=fe(),a=I.useRef(new Map),o=I.useRef(null);o.current===null&&(o.current=new Set(e.filter(e=>e.status===`completed`).map(e=>e.id)));let s=r<=10?0:Math.min(10,Math.max(3,r-14)),c=new Set(e.filter(e=>e.status===`completed`).map(e=>e.id)),l=Date.now();for(let e of c)o.current.has(e)||a.current.set(e,l);for(let e of a.current.keys())c.has(e)||a.current.delete(e);if(o.current=c,I.useEffect(()=>{if(a.current.size===0)return;let e=Date.now(),t=1/0;for(let n of a.current.values()){let r=n+Ke;r>e&&r<t&&(t=r)}if(t===1/0)return;let r=setTimeout(e=>e(e=>e+1),t-e,n);return()=>clearTimeout(r)},[e]),!y()||e.length===0)return null;let u=N(e,e=>e.status===`completed`),d=N(e,e=>e.status===`pending`),f=e.length-u-d,p=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id)),m=e.length>s,h,g;if(m){let t=[],n=[];for(let r of e.filter(e=>e.status===`completed`)){let e=a.current.get(r.id);e&&l-e<Ke?t.push(r):n.push(r)}t.sort(F),n.sort(F);let r=e.filter(e=>e.status===`in_progress`).sort(F),i=e.filter(e=>e.status===`pending`).sort((e,t)=>{let n=e.blockedBy.some(e=>p.has(e));return n===t.blockedBy.some(e=>p.has(e))?F(e,t):n?1:-1}),o=[...t,...r,...i,...n];h=o.slice(0,s),g=o.slice(s)}else h=[...e].sort(F),g=[];let _=``;if(g.length>0){let e=[],t=N(g,e=>e.status===`pending`),n=N(g,e=>e.status===`in_progress`),r=N(g,e=>e.status===`completed`);n>0&&e.push(`${n} in progress`),t>0&&e.push(`${t} pending`),r>0&&e.push(`${r} completed`),_=` … +${e.join(`, `)}`}let v=(0,L.jsxs)(L.Fragment,{children:[h.map(e=>(0,L.jsx)(Ge,{task:e,openBlockers:e.blockedBy.filter(e=>p.has(e)),columns:i},e.id)),s>0&&_&&(0,L.jsx)(O,{dimColor:!0,children:_})]});return t?(0,L.jsxs)(D,{flexDirection:`column`,marginTop:1,marginLeft:2,children:[(0,L.jsx)(D,{children:(0,L.jsxs)(O,{dimColor:!0,children:[(0,L.jsx)(O,{bold:!0,children:e.length}),` tasks (`,(0,L.jsx)(O,{bold:!0,children:u}),` done, `,f>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(O,{bold:!0,children:f}),` in progress, `]}),(0,L.jsx)(O,{bold:!0,children:d}),` open)`]})}),v]}):(0,L.jsx)(D,{flexDirection:`column`,children:v})}function We(e){switch(e){case`completed`:return{icon:h.tick,color:`success`};case`in_progress`:return{icon:h.squareSmallFilled,color:`claude`};case`pending`:return{icon:h.squareSmall,color:void 0}}}function Ge({task:e,openBlockers:t,columns:n}){let r=e.status===`completed`,i=e.status===`in_progress`,a=t.length>0,{icon:o,color:s}=We(e.status),c=Math.max(15,n-15),l=Se(e.subject,c);return(0,L.jsx)(D,{flexDirection:`column`,children:(0,L.jsxs)(D,{children:[(0,L.jsxs)(O,{color:s,children:[o,` `]}),(0,L.jsx)(O,{bold:i,strikethrough:r,dimColor:r||a,children:l}),a&&(0,L.jsxs)(O,{dimColor:!0,children:[` `,h.pointerSmall,` blocked by`,` `,[...t].sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>`#${e}`).join(`, `)]})]})})}var I,L,Ke,qe=e((()=>{m(),I=t(k(),1),w(),A(),ge(),Ce(),T(),L=j(),Ke=3e4}));function Je(){l(ot,this).emit()}function Ye(e){if(!(e===l(V,this)&&l(B,this)!==null)){l(B,this)?.close(),d(B,this,null),d(V,this,e);try{d(B,this,Ie(e,l(st,this))),l(B,this).unref()}catch{}}}function Xe(e){d(H,this,null);let t=_();t===e&&C(t).then(async e=>{e.length>0&&e.every(e=>e.status===`completed`)&&(await ne(t),d(R,this,[]),d(z,this,!0)),i(J,this,Je).call(this)})}function Ze(){l(H,this)&&(clearTimeout(l(H,this)),d(H,this,null))}function Qe(){l(B,this)?.close(),d(B,this,null),d(V,this,null),l(G,this)?.call(this),d(G,this,null),i(J,this,Ze).call(this),l(U,this)&&clearTimeout(l(U,this)),l(W,this)&&clearTimeout(l(W,this)),d(U,this,null),d(W,this,null),d(q,this,!1)}function $e(){return ut??(ut=new lt)}function et(){let e=y()?$e():null;return(0,nt.useSyncExternalStore)(e?e.subscribe:ft,e?e.getSnapshot:pt)}function tt(){let e=et(),t=ce(),n=e===void 0;return(0,nt.useEffect)(()=>{n&&t(e=>e.expandedView===`tasks`?{...e,expandedView:`none`}:e)},[n,t]),e}var nt,rt,it,at,R,z,B,V,H,U,W,G,ot,K,q,J,st,ct,lt,ut,dt,ft,pt,mt=e((()=>{nt=t(k(),1),v(),pe(),T(),f(),a(),n(),o(),s(),c(),rt=5e3,it=50,at=5e3,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,ot=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakSet,st=new WeakMap,ct=new WeakMap,lt=class{constructor(){p(this,J),u(this,R,void 0),u(this,z,!1),u(this,B,null),u(this,V,null),u(this,H,null),u(this,U,null),u(this,W,null),u(this,G,null),u(this,ot,he()),u(this,K,0),u(this,q,!1),r(this,`getSnapshot`,()=>l(z,this)?void 0:l(R,this)),r(this,`subscribe`,e=>{var t;let n=l(ot,this).subscribe(e);d(K,this,(t=l(K,this),t++,t)),l(q,this)||(d(q,this,!0),d(G,this,S(l(st,this))),l(ct,this).call(this));let r=!1;return()=>{var e;r||(r=!0,n(),d(K,this,(e=l(K,this),e--,e)),l(K,this)===0&&i(J,this,Qe).call(this))}}),u(this,st,()=>{l(U,this)&&clearTimeout(l(U,this)),d(U,this,setTimeout(()=>void l(ct,this).call(this),it)),l(U,this).unref()}),u(this,ct,async()=>{let e=_();i(J,this,Ye).call(this,b(e));let t=(await C(e)).filter(e=>!e.metadata?._internal);d(R,this,t);let n=t.some(e=>e.status!==`completed`);n||t.length===0?(d(z,this,t.length===0),i(J,this,Ze).call(this)):l(H,this)===null&&!l(z,this)&&(d(H,this,setTimeout(i(J,this,Xe).bind(this,e),rt)),l(H,this).unref()),i(J,this,Je).call(this),l(W,this)&&(clearTimeout(l(W,this)),d(W,this,null)),n&&(d(W,this,setTimeout(l(st,this),at)),l(W,this).unref())})}},ut=null,dt=()=>{},ft=()=>dt,pt=()=>void 0})),ht=e((()=>{A(),Fe(),j()}));function gt({message:e,mode:t,messageColor:n,glimmerIndex:r,flashOpacity:i,shimmerColor:a,stalledIntensity:o=0}){let[s]=le(),c=ke(s),{segments:l,messageWidth:u}=_t.useMemo(()=>{let t=[];for(let{segment:n}of be().segment(e))t.push({segment:n,width:E(n)});return{segments:t,messageWidth:E(e)}},[e]);if(!e)return null;if(o>0){let t=c[n],r=t?Ne(t):null;if(r){let t=Oe(je(r,vt,o));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{color:t,children:e}),(0,Y.jsx)(O,{color:t,children:` `})]})}let i=o>.5?`error`:n;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{color:i,children:e}),(0,Y.jsx)(O,{color:i,children:` `})]})}if(t===`tool-use`){let t=c[n],r=c[a],o=t?Ne(t):null,s=r?Ne(r):null;return o&&s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{color:Oe(je(o,s,i)),children:e}),(0,Y.jsx)(O,{color:n,children:` `})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{color:i>.5?a:n,children:e}),(0,Y.jsx)(O,{color:n,children:` `})]})}let d=r-1,f=r+1;if(d>=u||f<0)return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{color:n,children:e}),(0,Y.jsx)(O,{color:n,children:` `})]});let p=Math.max(0,d),m=0,h=``,g=``,_=``;for(let{segment:e,width:t}of l)m+t<=p?h+=e:m>f?_+=e:g+=e,m+=t;return(0,Y.jsxs)(Y.Fragment,{children:[h&&(0,Y.jsx)(O,{color:n,children:h}),(0,Y.jsx)(O,{color:a,children:g}),_&&(0,Y.jsx)(O,{color:n,children:_}),(0,Y.jsx)(O,{color:n,children:` `})]})}var _t,Y,vt,yt=e((()=>{_t=t(k(),1),A(),xe(),Fe(),De(),Y=j(),vt={r:171,g:43,b:63}}));function bt(e,t,n){let r=e===`requesting`?50:200,[i,a]=de(n?null:r),o=(0,xt.useMemo)(()=>E(t),[t]);if(n)return[i,-100];let s=Math.floor(a/r),c=o+20;return e===`requesting`?[i,s%c-10]:[i,o+10-s%c]}var xt,St=e((()=>{xt=t(k(),1),A()}));function Ct(e,t,n=!1,r=!1){let i=(0,X.useRef)(e),a=(0,X.useRef)(t),o=(0,X.useRef)(e),s=(0,X.useRef)(0),c=(0,X.useRef)(e);t>a.current&&(i.current=e,a.current=t,s.current=0,c.current=e);let l;n?(l=0,i.current=e):l=t>0?e-i.current:e-o.current;let u=l>3e3&&!n,d=u?Math.min((l-3e3)/2e3,1):0;if(!r&&(d>0||s.current>0)){let t=e-c.current;if(t>=50){let n=Math.floor(t/50),r=s.current;for(let e=0;e<n;e++){let e=d-r;if(Math.abs(e)<.01){r=d;break}r+=e*.1}s.current=r,c.current=e}}else s.current=d,c.current=e;return{isStalled:u,stalledIntensity:r?d:s.current}}var X,wt=e((()=>{X=t(k(),1)})),Tt=e((()=>{ht(),yt(),Ee(),Ae(),St(),wt(),De()}));function Et({mode:e,reducedMotion:t,hasActiveTools:n,responseLengthRef:r,message:i,messageColor:a,shimmerColor:o,overrideColor:s,loadingStartTimeRef:c,totalPausedMsRef:l,pauseStartTimeRef:u,spinnerSuffix:d,verbose:f,columns:p,agentTokens:m,leaderIsIdle:g=!1,thinkingStatus:_}){let[v,y]=de(t?null:50),b=Date.now(),ee=u.current===null?b-c.current-l.current:u.current-c.current-l.current,x=r.current,{isStalled:te,stalledIntensity:S}=Ct(y,x,n||g,t),C=t?0:Math.floor(y/120),ne=e===`requesting`?50:200,w=(0,Ot.useMemo)(()=>E(i),[i]),re=w+20,ie=Math.floor(y/ne),ae=t||te?-100:e===`requesting`?ie%re-10:w+10-ie%re,oe=t?0:e===`tool-use`?(Math.sin(y/1e3*Math.PI)+1)/2:0,T=(0,Ot.useRef)(x);if(t)T.current=x;else{let e=x-T.current;if(e>0){let t;t=e<70?3:e<200?Math.max(8,Math.ceil(e*.15)):50,T.current=Math.min(T.current+t,x)}}let se=T.current,ce=Math.round(se/4),le=Te(ee),k=E(le),fe=ce+m,A=we(fe),j=E(`${h.arrowDown} ${A} tokens`),M=_===`thinking`?`thinking`:typeof _==`number`?`thought for ${Math.max(1,Math.round(_/1e3))}s`:null,pe=M?E(M):0,me=w+2,he=kt,ge=_!==null,N=f||ee>jt,_e=p-me-5,P=ge&&_e>pe;!P&&ge&&_===`thinking`&&_e>At&&(M=`thinking`,pe=At,P=!0);let ve=P?pe+he:0,ye=N&&_e>ve+k,be=ve+(ye?k+he:0),xe=N&&fe>0&&_e>be+j,Se=P&&_===`thinking`&&!d&&!ye&&!xe&&!0,Ce=(y-Pt)/1e3,Ee=y<Pt?0:(Math.sin(Ce*Math.PI*2/Ft)+1)/2,De=Oe(je(Mt,Nt,Ee)),ke=[...d?[(0,Z.jsx)(O,{dimColor:!0,children:d},`suffix`)]:[],...ye?[(0,Z.jsx)(O,{dimColor:!0,children:le},`elapsedTime`)]:[],...xe?[(0,Z.jsxs)(D,{flexDirection:`row`,children:[(0,Z.jsx)(Dt,{mode:e}),(0,Z.jsxs)(O,{dimColor:!0,children:[A,` tokens`]})]},`tokens`)]:[],...P&&M?[_===`thinking`&&!t?(0,Z.jsx)(O,{color:De,children:Se?`(${M})`:M},`thinking`):(0,Z.jsx)(O,{dimColor:!0,children:M},`thinking`)]:[]],Ae=ke.length>0?Se?(0,Z.jsx)(ue,{children:ke}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(O,{dimColor:!0,children:`(`}),(0,Z.jsx)(ue,{children:ke}),(0,Z.jsx)(O,{dimColor:!0,children:`)`})]}):null;return(0,Z.jsxs)(D,{ref:v,flexDirection:`row`,flexWrap:`wrap`,marginTop:1,width:`100%`,children:[(0,Z.jsx)(Pe,{frame:C,messageColor:a,stalledIntensity:s?0:S,reducedMotion:t,time:y}),(0,Z.jsx)(gt,{message:i,mode:e,messageColor:a,glimmerIndex:ae,flashOpacity:oe,shimmerColor:o,stalledIntensity:s?0:S}),Ae]})}function Dt({mode:e}){switch(e){case`tool-input`:case`tool-use`:case`responding`:case`thinking`:return(0,Z.jsx)(D,{width:2,children:(0,Z.jsx)(O,{dimColor:!0,children:h.arrowDown})});case`requesting`:return(0,Z.jsx)(D,{width:2,children:(0,Z.jsx)(O,{dimColor:!0,children:h.arrowUp})})}}var Ot,Z,kt,At,jt,Mt,Nt,Pt,Ft,It=e((()=>{m(),Ot=t(k(),1),A(),Ce(),yt(),Ae(),wt(),De(),Z=j(),kt=E(` · `),At=E(`thinking`),jt=3e4,Mt={r:153,g:153,b:153},Nt={r:185,g:185,b:185},Pt=3e3,Ft=2}));function Lt(e){return(0,$.jsx)(Rt,{...e})}function Rt({mode:e,loadingStartTimeRef:t,totalPausedMsRef:n,pauseStartTimeRef:r,spinnerTip:i,responseLengthRef:a,overrideColor:o,overrideShimmerColor:s,overrideMessage:c,spinnerSuffix:l,verbose:u,hasActiveTools:d=!1,leaderIsIdle:f=!1}){let p=te(),m=p.prefersReducedMotion??!1,h=ee(e=>e.tasks),g=ee(e=>e.expandedView)===`tasks`,{columns:_}=fe(),v=et(),[y,b]=(0,Q.useState)(null),x=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let t=null,n=null;if(e===`thinking`)x.current===null&&(x.current=Date.now(),b(`thinking`));else if(x.current!==null){let e=Date.now()-x.current,r=Date.now()-x.current,i=Math.max(0,2e3-r);x.current=null;let a=()=>{b(e),n=setTimeout(b,2e3,null)};i>0?t=setTimeout(a,i):a()}return()=>{t&&clearTimeout(t),n&&clearTimeout(n)}},[e]);let S=v?.find(e=>e.status!==`pending`&&e.status!==`completed`),C=Bt(v),[ne]=(0,Q.useState)(()=>ie(Be())),w=`${c??S?.activeForm??S?.subject??ne}…`;(0,Q.useEffect)(()=>{let t=`spinner-${e}`;return Re.startCLIActivity(t),()=>{Re.endCLIActivity(t)}},[e]);let re=0;for(let e of Object.values(h))e.status===`running`&&oe(e)&&e.progress?.tokenCount&&(re+=e.progress.tokenCount);let T=r.current===null?Date.now()-t.current-n.current:r.current-t.current-n.current,se=o??`claude`,ce=s??`claudeShimmer`,E=p.spinnerTipsEnabled!==!1,le=E&&T>18e5,ue=E&&T>3e4&&!ye().btwUseCount,k=le&&!C?`Use /clear to start fresh when switching topics and free up context`:ue&&!C?`Use /btw to ask a quick side question without interrupting Work Mate's current work`:i;return(0,$.jsxs)(D,{flexDirection:`column`,width:`100%`,alignItems:`flex-start`,children:[(0,$.jsx)(Et,{mode:e,reducedMotion:m,hasActiveTools:d,responseLengthRef:a,message:w,messageColor:se,shimmerColor:ce,overrideColor:o,loadingStartTimeRef:t,totalPausedMsRef:n,pauseStartTimeRef:r,spinnerSuffix:l,verbose:u,columns:_,agentTokens:re,leaderIsIdle:f,thinkingStatus:y}),g&&v&&v.length>0?(0,$.jsx)(D,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(ae,{children:(0,$.jsx)(Ue,{tasks:v})})}):C||k?(0,$.jsxs)(D,{width:`100%`,flexDirection:`column`,children:[null,(C||k)&&(0,$.jsx)(ae,{children:(0,$.jsx)(O,{dimColor:!0,children:C?`Next: ${C.subject}`:`Tip: ${k}`})})]}):null]})}function zt(){let e=te().prefersReducedMotion??!1,[t,n]=de(e?null:120);if(e)return(0,$.jsx)(D,{ref:t,flexWrap:`wrap`,height:1,width:2,children:(0,$.jsx)(O,{color:`text`,children:`●`})});let r=Math.floor(n/120)%Ht.length;return(0,$.jsx)(D,{ref:t,flexWrap:`wrap`,height:1,width:2,children:(0,$.jsx)(O,{color:`text`,children:Ht[r]})})}function Bt(e){if(!e)return;let t=e.filter(e=>e.status===`pending`);if(t.length===0)return;let n=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id));return t.find(e=>!e.blockedBy.some(e=>n.has(e)))??t[0]}var Q,$,Vt,Ht,Ut=e((()=>{A(),Q=t(k(),1),g(),Ce(),ze(),He(),se(),qe(),mt(),v(),w(),Tt(),It(),x(),re(),M(),ve(),$=j(),Vt=Me(),Ht=[...Vt,...[...Vt].reverse()]}));export{bt as a,tt as c,Re as d,ze as f,St as i,Ue as l,Lt as n,mt as o,Ut as r,et as s,zt as t,qe as u};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{l as r,o as i}from"./envUtils-DfkgIdYf.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{Mp as s,Np as c,Op as l,ax as u,cx as d,kp as f,nx as p,ox as m,rx as h,sx as g,vb as _,yb as v}from"./loadAgentsDir-B0Anodo0.js";import{Fr as y,Ft as b,G as x,Gr as S,H as C,Hr as w,I as T,Kr as E,Lr as ee,P as D,Pr as te,Vr as ne,Xn as re,ai as O,di as k,et as ie,fi as ae,hn as oe,j as se,mt as ce,qr as le,t as A,vn as ue,yn as de,zr as fe}from"./src-DL3w8VPk.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{c as pe,f as me,i as he,u as M}from"./debug-Bglx1aTu.js";import{Wt as ge,qt as _e}from"./settings-B2jvL8Dp.js";import{a as N,i as ve,n as ye,s as be}from"./execFileNoThrow-BTachNBI.js";import{o as xe,s as P}from"./log-D2TIwHBV.js";import{i as Se,o as Ce}from"./platform-BacQ6ACS.js";import{a as we,n as F,o as Te,t as Ee}from"./intl-D2kgJmX7.js";import{n as De,t as Oe}from"./notifications-Bc6k-Ozy.js";import{i as ke,o as Ae}from"./terminalSetup-B_10N_gE.js";import{s as je,t as Me}from"./history-BMycjPTT.js";import{r as Ne,t as Pe}from"./modifiersNative-BYHdmWw1.js";import{t as Fe}from"./useDoublePress-C9xxQzh1.js";import{tmpdir as Ie}from"os";import{basename as Le,extname as Re,isAbsolute as ze,join as Be}from"path";import{randomBytes as Ve}from"crypto";function He(){let e=process.platform,t=process.env.CLAUDE_CODE_TMPDIR||(e===`win32`?process.env.TEMP||`C:\\Temp`:Ie()),n=`claude_cli_latest_screenshot.png`,r={darwin:Be(t,n),linux:Be(t,n),win32:Be(t,n)},i=r[e]||r.linux,a={darwin:{checkImage:`osascript -e 'the clipboard as «class PNGf»'`,saveImage:`osascript -e 'set png_data to (the clipboard as «class PNGf»)' -e 'set fp to open for access POSIX file "${i}" with write permission' -e 'write png_data to fp' -e 'close access fp'`,getPath:`osascript -e 'get POSIX path of (the clipboard as «class furl»)'`,deleteFile:`rm -f "${i}"`},linux:{checkImage:`xclip -selection clipboard -t TARGETS -o 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)" || wl-paste -l 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)"`,saveImage:`xclip -selection clipboard -t image/png -o > "${i}" 2>/dev/null || wl-paste --type image/png > "${i}" 2>/dev/null || xclip -selection clipboard -t image/bmp -o > "${i}" 2>/dev/null || wl-paste --type image/bmp > "${i}"`,getPath:`xclip -selection clipboard -t text/plain -o 2>/dev/null || wl-paste 2>/dev/null`,deleteFile:`rm -f "${i}"`},win32:{checkImage:`powershell -NoProfile -Command "(Get-Clipboard -Format Image) -ne $null"`,saveImage:`powershell -NoProfile -Command "$img = Get-Clipboard -Format Image; if ($img) { $img.Save('${i.replace(/\\/g,`\\\\`)}', [System.Drawing.Imaging.ImageFormat]::Png) }"`,getPath:`powershell -NoProfile -Command "Get-Clipboard"`,deleteFile:`del /f "${i}"`}};return{commands:a[e]||a.linux,screenshotPath:i}}async function Ue(){return process.platform===`darwin`&&(await ye(`osascript`,[`-e`,`the clipboard as «class PNGf»`])).code===0}async function We(){let{commands:e,screenshotPath:t}=He();try{if((await N(e.checkImage,{shell:!0,reject:!1})).exitCode!==0||(await N(e.saveImage,{shell:!0,reject:!1})).exitCode!==0)return null;let n=M().readFileBytesSync(t);n.length>=2&&n[0]===66&&n[1]===77&&(n=await(await m())(n).png().toBuffer());let r=await u(n,n.length,`png`),i=r.buffer.toString(`base64`),a=p(i);return N(e.deleteFile,{shell:!0,reject:!1}),{base64:i,mediaType:a,dimensions:r.dimensions}}catch{return null}}async function Ge(){let{commands:e}=He();try{let t=await N(e.getPath,{shell:!0,reject:!1});return t.exitCode!==0||!t.stdout?null:t.stdout.trim()}catch(e){return P(e),null}}function Ke(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function qe(e){if(process.platform===`win32`)return e;let t=`__DOUBLE_BACKSLASH_${Ve(8).toString(`hex`)}__`;return e.replace(/\\\\/g,t).replace(/\\(.)/g,`$1`).replace(new RegExp(t,`g`),`\\`)}function I(e){let t=qe(Ke(e.trim()));return Xe.test(t)}function Je(e){let t=qe(Ke(e.trim()));return Xe.test(t)?t:null}async function Ye(e){let t=Je(e);if(!t)return null;let n=t,r;try{if(ze(n))r=M().readFileBytesSync(n);else{let e=await Ge();e&&n===Le(e)&&(r=M().readFileBytesSync(e))}}catch(e){return P(e),null}if(!r)return null;if(r.length===0)return pe(`Image file is empty: ${n}`,{level:`warn`}),null;r.length>=2&&r[0]===66&&r[1]===77&&(r=await(await m())(r).png().toBuffer());let i=Re(n).slice(1).toLowerCase()||`png`,a=await u(r,r.length,i),o=a.buffer.toString(`base64`);return{path:n,base64:o,mediaType:p(o),dimensions:a.dimensions}}var Xe,Ze=t((()=>{be(),d(),g(),he(),ve(),me(),h(),xe(),Xe=/\.(png|jpe?g|gif|webp)$/i}));function Qe(e,t){let{addNotification:n}=De(),r=(0,L.useRef)(e),i=(0,L.useRef)(0),a=(0,L.useRef)(null);(0,L.useEffect)(()=>{let o=r.current;if(r.current=e,!(!t||!e||o))return a.current&&clearTimeout(a.current),a.current=setTimeout(async(e,t,n)=>{e.current=null;let r=Date.now();r-t.current<tt||await Ue()&&(t.current=r,n({key:$e,text:`Image in clipboard · ${_(`chat:imagePaste`,`Chat`,`ctrl+v`)} to paste`,priority:`immediate`,timeoutMs:8e3}))},et,a,i,n),()=>{a.current&&(clearTimeout(a.current),a.current=null)}},[e,t,n])}var L,$e,et,tt,nt=t((()=>{L=n(O(),1),Oe(),v(),Ze(),$e=`clipboard-image-hint`,et=1e3,tt=3e4}));function rt(e,t){switch(t){case`bash`:return`!${e}`;default:return e}}function it(e){return e.startsWith(`!`)?`bash`:`prompt`}function at(e){return it(e)===`prompt`?e:e.slice(1)}function ot(e){return e===`!`}var st=t((()=>{}));function R(e,t=`append`){e.length>0&&(V&&z.length>0?t===`prepend`?z[0]=e+z[0]:z[0]+=e:(z.unshift(e),z.length>mt&&z.pop()),V=!0,U=!1)}function ct(){return z[0]??``}function lt(){V=!1}function ut(e,t){ht=e,H=t,U=!0,B=0}function dt(){return!U||z.length<=1?null:(B=(B+1)%z.length,{text:z[B]??``,start:ht,length:H})}function ft(e){H=e}function pt(){U=!1}var mt,z,B,V,ht,H,U,gt,W,G,_t,K,q,J,vt,yt=t((()=>{A(),Te(),a(),mt=10,z=[],B=0,V=!1,ht=0,H=0,U=!1,gt=/^[\p{L}\p{N}\p{M}_]$/u,W=/\s/,G=e=>gt.test(e),_t=e=>W.test(e),K=e=>e.length>0&&!_t(e)&&!G(e),q=class e{constructor(e,t=0,n=0){o(this,`measuredText`,void 0),o(this,`selection`,void 0),o(this,`offset`,void 0),this.measuredText=e,this.selection=n,this.offset=Math.max(0,Math.min(this.text.length,t))}static fromText(t,n,r=0,i=0){return new e(new vt(t,n-1),r,i)}getViewportStartLine(e){if(e===void 0||e<=0)return 0;let{line:t}=this.getPosition(),n=this.measuredText.getWrappedText();if(n.length<=e)return 0;let r=Math.floor(e/2),i=Math.max(0,t-r),a=Math.min(n.length,i+e);return a-i<e&&(i=Math.max(0,a-e)),i}getViewportCharOffset(e){let t=this.getViewportStartLine(e);return t===0?0:this.measuredText.getWrappedLines()[t]?.startOffset??0}getViewportCharEnd(e){let t=this.getViewportStartLine(e),n=this.measuredText.getWrappedLines();if(e===void 0||e<=0)return this.text.length;let r=Math.min(n.length,t+e);return r>=n.length?this.text.length:n[r]?.startOffset??this.text.length}render(e,t,n,r,i){let{line:a,column:o}=this.getPosition(),s=this.measuredText.getWrappedText(),c=this.getViewportStartLine(i),l=i!==void 0&&i>0?Math.min(s.length,c+i):s.length;return s.slice(c,l).map((i,l)=>{let u=l+c,d=i;if(t){let e=Array.from(F().segment(i));if(u===s.length-1){let n=Math.min(6,e.length),r=e.length-n,a=e.length>n?e[r].index:0;d=t.repeat(r)+i.slice(a)}else d=t.repeat(e.length)}if(a!==u)return d.trimEnd();let f=``,p=e,m=``,h=0,g=!1;for(let{segment:e}of F().segment(d)){if(g){m+=e;continue}let t=h+S(e);t>o?(p=e,g=!0):(h=t,f+=e)}let _,v=``;if(r&&u===s.length-1&&this.isAtEnd()&&r.text.length>0){let t=Ee(r.text)||r.text[0];_=e?n(t):t;let i=r.text.slice(t.length);i.length>0&&(v=r.dim(i))}else _=e?n(p):p;return f+_+v+m.trimEnd()}).join(`
|
|
2
|
-
`)}left(){if(this.offset===0)return this;let t=this.imageRefEndingAt(this.offset);if(t)return new e(this.measuredText,t.start);let n=this.measuredText.prevOffset(this.offset);return new e(this.measuredText,n)}right(){if(this.offset>=this.text.length)return this;let t=this.imageRefStartingAt(this.offset);if(t)return new e(this.measuredText,t.end);let n=this.measuredText.nextOffset(this.offset);return new e(this.measuredText,Math.min(n,this.text.length))}imageRefEndingAt(e){let t=this.text.slice(0,e).match(/\[Image #\d+\]$/);return t?{start:e-t[0].length,end:e}:null}imageRefStartingAt(e){let t=this.text.slice(e).match(/^\[Image #\d+\]/);return t?{start:e,end:e+t[0].length}:null}snapOutOfImageRef(e,t){let n=/\[Image #\d+\]/g,r;for(;(r=n.exec(this.text))!==null;){let n=r.index,i=n+r[0].length;if(e>n&&e<i)return t===`start`?n:i}return e}up(){let{line:t,column:n}=this.getPosition();if(t===0)return this;let r=this.measuredText.getWrappedText()[t-1];if(r===void 0)return this;let i=S(r);if(n>i){let n=this.getOffset({line:t-1,column:i});return new e(this.measuredText,n,0)}let a=this.getOffset({line:t-1,column:n});return new e(this.measuredText,a,0)}down(){let{line:t,column:n}=this.getPosition();if(t>=this.measuredText.lineCount-1)return this;let r=this.measuredText.getWrappedText()[t+1];if(r===void 0)return this;let i=S(r);if(n>i){let n=this.getOffset({line:t+1,column:i});return new e(this.measuredText,n,0)}let a=this.getOffset({line:t+1,column:n});return new e(this.measuredText,a,0)}startOfCurrentLine(){let{line:t}=this.getPosition();return new e(this.measuredText,this.getOffset({line:t,column:0}),0)}startOfLine(){let{line:t,column:n}=this.getPosition();return n===0&&t>0?new e(this.measuredText,this.getOffset({line:t-1,column:0}),0):this.startOfCurrentLine()}firstNonBlankInLine(){let{line:t}=this.getPosition(),n=(this.measuredText.getWrappedText()[t]||``).match(/^\s*\S/),r=n?.index?n.index+n[0].length-1:0,i=this.getOffset({line:t,column:r});return new e(this.measuredText,i,0)}endOfLine(){let{line:t}=this.getPosition(),n=this.measuredText.getLineLength(t),r=this.getOffset({line:t,column:n});return new e(this.measuredText,r,0)}findLogicalLineStart(e=this.offset){let t=this.text.lastIndexOf(`
|
|
3
|
-
`,e-1);return t===-1?0:t+1}findLogicalLineEnd(e=this.offset){let t=this.text.indexOf(`
|
|
4
|
-
`,e);return t===-1?this.text.length:t}getLogicalLineBounds(){return{start:this.findLogicalLineStart(),end:this.findLogicalLineEnd()}}createCursorWithColumn(t,n,r){let i=n-t,a=t+Math.min(r,i),o=this.measuredText.snapToGraphemeBoundary(a);return new e(this.measuredText,o,0)}endOfLogicalLine(){return new e(this.measuredText,this.findLogicalLineEnd(),0)}startOfLogicalLine(){return new e(this.measuredText,this.findLogicalLineStart(),0)}firstNonBlankInLogicalLine(){let{start:t,end:n}=this.getLogicalLineBounds(),r=t+(this.text.slice(t,n).match(/\S/)?.index??0);return new e(this.measuredText,r,0)}upLogicalLine(){let{start:t}=this.getLogicalLineBounds();if(t===0)return new e(this.measuredText,0,0);let n=this.offset-t,r=t-1,i=this.findLogicalLineStart(r);return this.createCursorWithColumn(i,r,n)}downLogicalLine(){let{start:t,end:n}=this.getLogicalLineBounds();if(n>=this.text.length)return new e(this.measuredText,this.text.length,0);let r=this.offset-t,i=n+1,a=this.findLogicalLineEnd(i);return this.createCursorWithColumn(i,a,r)}nextWord(){if(this.isAtEnd())return this;let t=this.measuredText.getWordBoundaries();for(let n of t)if(n.isWordLike&&n.start>this.offset)return new e(this.measuredText,n.start);return new e(this.measuredText,this.text.length)}endOfWord(){if(this.isAtEnd())return this;let t=this.measuredText.getWordBoundaries();for(let n of t)if(n.isWordLike){if(this.offset>=n.start&&this.offset<n.end-1)return new e(this.measuredText,n.end-1);if(this.offset===n.end-1){for(let n of t)if(n.isWordLike&&n.start>this.offset)return new e(this.measuredText,n.end-1);return this}}for(let n of t)if(n.isWordLike&&n.start>this.offset)return new e(this.measuredText,n.end-1);return this}prevWord(){if(this.isAtStart())return this;let t=this.measuredText.getWordBoundaries(),n=null;for(let r of t)if(r.isWordLike&&r.start<this.offset){if(this.offset>r.start&&this.offset<=r.end)return new e(this.measuredText,r.start);n=r.start}return n===null?new e(this.measuredText,0):new e(this.measuredText,n)}nextVimWord(){if(this.isAtEnd())return this;let t=this.offset,n=e=>this.measuredText.nextOffset(e),r=this.graphemeAt(t);if(!r)return this;if(G(r))for(;t<this.text.length&&G(this.graphemeAt(t));)t=n(t);else if(K(r))for(;t<this.text.length&&K(this.graphemeAt(t));)t=n(t);for(;t<this.text.length&&W.test(this.graphemeAt(t));)t=n(t);return new e(this.measuredText,t)}endOfVimWord(){if(this.isAtEnd())return this;let t=this.text,n=this.offset,r=e=>this.measuredText.nextOffset(e);if(this.graphemeAt(n)===``)return this;for(n=r(n);n<t.length&&W.test(this.graphemeAt(n));)n=r(n);if(n>=t.length)return new e(this.measuredText,t.length);let i=this.graphemeAt(n);if(G(i))for(;n<t.length;){let e=r(n);if(e>=t.length||!G(this.graphemeAt(e)))break;n=e}else if(K(i))for(;n<t.length;){let e=r(n);if(e>=t.length||!K(this.graphemeAt(e)))break;n=e}return new e(this.measuredText,n)}prevVimWord(){if(this.isAtStart())return this;let t=this.offset,n=e=>this.measuredText.prevOffset(e);for(t=n(t);t>0&&W.test(this.graphemeAt(t));)t=n(t);if(t===0&&W.test(this.graphemeAt(0)))return new e(this.measuredText,0);let r=this.graphemeAt(t);if(G(r))for(;t>0;){let e=n(t);if(!G(this.graphemeAt(e)))break;t=e}else if(K(r))for(;t>0;){let e=n(t);if(!K(this.graphemeAt(e)))break;t=e}return new e(this.measuredText,t)}nextWORD(){let e=this;for(;!e.isOverWhitespace()&&!e.isAtEnd();)e=e.right();for(;e.isOverWhitespace()&&!e.isAtEnd();)e=e.right();return e}endOfWORD(){if(this.isAtEnd())return this;let e=this;if(!e.isOverWhitespace()&&(e.right().isOverWhitespace()||e.right().isAtEnd()))return e=e.right(),e.endOfWORD();for(e.isOverWhitespace()&&(e=e.nextWORD());!e.right().isOverWhitespace()&&!e.isAtEnd();)e=e.right();return e}prevWORD(){let e=this;for(e.left().isOverWhitespace()&&(e=e.left());e.isOverWhitespace()&&!e.isAtStart();)e=e.left();if(!e.isOverWhitespace())for(;!e.left().isOverWhitespace()&&!e.isAtStart();)e=e.left();return e}modifyText(t,n=``){let r=this.offset,i=t.offset,a=this.text.slice(0,r)+n+this.text.slice(i);return e.fromText(a,this.columns,r+n.normalize(`NFC`).length)}insert(e){return this.modifyText(this,e)}del(){return this.isAtEnd()?this:this.modifyText(this.right())}backspace(){return this.isAtStart()?this:this.left().modifyText(this)}deleteToLineStart(){if(this.offset>0&&this.text[this.offset-1]===`
|
|
5
|
-
`)return{cursor:this.left().modifyText(this),killed:`
|
|
6
|
-
`};let e=this.startOfLine(),t=this.text.slice(e.offset,this.offset);return{cursor:e.modifyText(this),killed:t}}deleteToLineEnd(){if(this.text[this.offset]===`
|
|
7
|
-
`)return{cursor:this.modifyText(this.right()),killed:`
|
|
8
|
-
`};let e=this.endOfLine(),t=this.text.slice(this.offset,e.offset);return{cursor:this.modifyText(e),killed:t}}deleteToLogicalLineEnd(){return this.text[this.offset]===`
|
|
9
|
-
`?this.modifyText(this.right()):this.modifyText(this.endOfLogicalLine())}deleteWordBefore(){if(this.isAtStart())return{cursor:this,killed:``};let t=this.snapOutOfImageRef(this.prevWord().offset,`start`),n=new e(this.measuredText,t),r=this.text.slice(n.offset,this.offset);return{cursor:n.modifyText(this),killed:r}}deleteTokenBefore(){let t=this.imageRefStartingAt(this.offset);if(t){let n=this.text[t.end]===` `?t.end+1:t.end;return this.modifyText(new e(this.measuredText,n))}if(this.isAtStart())return null;let n=this.text[this.offset];if(n!==void 0&&!/\s/.test(n))return null;let r=this.text.slice(0,this.offset).match(/(^|\s)\[(Pasted text #\d+(?: \+\d+ lines)?|Image #\d+|\.\.\.Truncated text #\d+ \+\d+ lines\.\.\.)\]$/);if(r){let t=r.index+r[1].length;return new e(this.measuredText,t).modifyText(this)}return null}deleteWordAfter(){if(this.isAtEnd())return this;let t=this.snapOutOfImageRef(this.nextWord().offset,`end`);return this.modifyText(new e(this.measuredText,t))}graphemeAt(e){if(e>=this.text.length)return``;let t=this.measuredText.nextOffset(e);return this.text.slice(e,t)}isOverWhitespace(){let e=this.text[this.offset]??``;return/\s/.test(e)}equals(e){return this.offset===e.offset&&this.measuredText===e.measuredText}isAtStart(){return this.offset===0}isAtEnd(){return this.offset>=this.text.length}startOfFirstLine(){return new e(this.measuredText,0,0)}startOfLastLine(){let t=this.text.lastIndexOf(`
|
|
10
|
-
`);return t===-1?this.startOfLine():new e(this.measuredText,t+1,0)}goToLine(t){let n=this.text.split(`
|
|
11
|
-
`),r=Math.min(Math.max(0,t-1),n.length-1),i=0;for(let e=0;e<r;e++)i+=(n[e]?.length??0)+1;return new e(this.measuredText,i,0)}endOfFile(){return new e(this.measuredText,this.text.length,0)}get text(){return this.measuredText.text}get columns(){return this.measuredText.columns+1}getPosition(){return this.measuredText.getPositionFromOffset(this.offset)}getOffset(e){return this.measuredText.getOffsetFromPosition(e)}findCharacter(e,t,n=1){let r=this.text,i=t===`f`||t===`t`,a=t===`t`||t===`T`,o=0;if(i){let t=this.measuredText.nextOffset(this.offset);for(;t<r.length;){if(this.graphemeAt(t)===e&&(o++,o===n))return a?Math.max(this.offset,this.measuredText.prevOffset(t)):t;t=this.measuredText.nextOffset(t)}}else{if(this.offset===0)return null;let t=this.measuredText.prevOffset(this.offset);for(;t>=0;){if(this.graphemeAt(t)===e&&(o++,o===n))return a?Math.min(this.offset,this.measuredText.nextOffset(t)):t;if(t===0)break;t=this.measuredText.prevOffset(t)}}return null}},J=class{constructor(e,t,n,r=!1){o(this,`text`,void 0),o(this,`startOffset`,void 0),o(this,`isPrecededByNewline`,void 0),o(this,`endsWithNewline`,void 0),this.text=e,this.startOffset=t,this.isPrecededByNewline=n,this.endsWithNewline=r}equals(e){return this.text===e.text&&this.startOffset===e.startOffset}get length(){return this.text.length+ +!!this.endsWithNewline}},vt=class{constructor(e,t){o(this,`columns`,void 0),o(this,`_wrappedLines`,void 0),o(this,`text`,void 0),o(this,`navigationCache`,void 0),o(this,`graphemeBoundaries`,void 0),o(this,`wordBoundariesCache`,void 0),this.columns=t,this.text=e.normalize(`NFC`),this.navigationCache=new Map}get wrappedLines(){return this._wrappedLines||(this._wrappedLines=this.measureWrappedText()),this._wrappedLines}getGraphemeBoundaries(){if(!this.graphemeBoundaries){this.graphemeBoundaries=[];for(let{index:e}of F().segment(this.text))this.graphemeBoundaries.push(e);this.graphemeBoundaries.push(this.text.length)}return this.graphemeBoundaries}getWordBoundaries(){if(!this.wordBoundariesCache){this.wordBoundariesCache=[];for(let e of we().segment(this.text))this.wordBoundariesCache.push({start:e.index,end:e.index+e.segment.length,isWordLike:e.isWordLike??!1})}return this.wordBoundariesCache}binarySearchBoundary(e,t,n){let r=0,i=e.length-1,a=n?this.text.length:0;for(;r<=i;){let o=Math.floor((r+i)/2),s=e[o];if(s===void 0)break;n?s>t?(a=s,i=o-1):r=o+1:s<t?(a=s,r=o+1):i=o-1}return a}stringIndexToDisplayWidth(e,t){return t<=0?0:t>=e.length?S(e):S(e.substring(0,t))}displayWidthToStringIndex(e,t){if(t<=0||!e)return 0;if(e===this.text)return this.offsetAtDisplayWidth(t);let n=0,r=0;for(let{segment:i,index:a}of F().segment(e)){let e=S(i);if(n+e>t)break;n+=e,r=a+i.length}return r}offsetAtDisplayWidth(e){if(e<=0)return 0;let t=0,n=this.getGraphemeBoundaries();for(let r=0;r<n.length-1;r++){let i=n[r],a=n[r+1];if(i===void 0||a===void 0)continue;let o=S(this.text.substring(i,a));if(t+o>e)return i;t+=o}return this.text.length}measureWrappedText(){let e=te(this.text,this.columns,{hard:!0,trim:!1}),t=[],n=0,r=-1,i=e.split(`
|
|
12
|
-
`);for(let e=0;e<i.length;e++){let a=i[e],o=t=>e===0||t>0&&this.text[t-1]===`
|
|
13
|
-
`;if(a.length===0)if(r=this.text.indexOf(`
|
|
14
|
-
`,r+1),r!==-1){let e=r;t.push(new J(a,e,o(e),!0))}else{let e=this.text.length;t.push(new J(a,e,o(e),!1))}else{let e=this.text.indexOf(a,n);if(e===-1)throw Error(`Failed to find wrapped line in text`);n=e+a.length;let i=e+a.length,s=i<this.text.length&&this.text[i]===`
|
|
15
|
-
`;s&&(r=i),t.push(new J(a,e,o(e),s))}}return t}getWrappedText(){return this.wrappedLines.map(e=>e.isPrecededByNewline?e.text:e.text.trimStart())}getWrappedLines(){return this.wrappedLines}getLine(e){let t=this.wrappedLines;return t[Math.max(0,Math.min(e,t.length-1))]}getOffsetFromPosition(e){let t=this.getLine(e.line);if(t.text.length===0&&t.endsWithNewline)return t.startOffset;let n=t.isPrecededByNewline?0:t.text.length-t.text.trimStart().length,r=e.column+n,i=this.displayWidthToStringIndex(t.text,r),a=t.startOffset+i,o=t.startOffset+t.text.length,s=o,c=S(t.text);return t.endsWithNewline&&e.column>c&&(s=o+1),Math.min(a,s)}getLineLength(e){return S(this.getLine(e).text)}getPositionFromOffset(e){let t=this.wrappedLines;for(let n=0;n<t.length;n++){let r=t[n],i=t[n+1];if(e>=r.startOffset&&(!i||e<i.startOffset)){let t=e-r.startOffset,i;if(r.isPrecededByNewline)i=this.stringIndexToDisplayWidth(r.text,t);else{let e=r.text.length-r.text.trimStart().length;if(t<e)i=0;else{let n=r.text.trimStart(),a=t-e;i=this.stringIndexToDisplayWidth(n,a)}}return{line:n,column:Math.max(0,i)}}}let n=t.length-1,r=this.wrappedLines[n];return{line:n,column:S(r.text)}}get lineCount(){return this.wrappedLines.length}withCache(e,t){let n=this.navigationCache.get(e);if(n!==void 0)return n;let r=t();return this.navigationCache.set(e,r),r}nextOffset(e){return this.withCache(`next:${e}`,()=>{let t=this.getGraphemeBoundaries();return this.binarySearchBoundary(t,e,!0)})}prevOffset(e){return e<=0?0:this.withCache(`prev:${e}`,()=>{let t=this.getGraphemeBoundaries();return this.binarySearchBoundary(t,e,!1)})}snapToGraphemeBoundary(e){if(e<=0)return 0;if(e>=this.text.length)return this.text.length;let t=this.getGraphemeBoundaries(),n=0,r=t.length-1;for(;n<r;){let i=n+r+1>>1;t[i]<=e?n=i:r=i-1}return t[n]}}}));function bt(){St||process.platform!==`darwin`||(St=!0,import(`./modifiersNative-D7nm70eq.js`).then(({prewarm:e})=>e()).catch(()=>{}))}function xt(t){if(process.platform!==`darwin`)return!1;try{let{isModifierPressed:n}=(Pe(),e(Ne));return n(t)}catch{return!1}}var St,Ct=t((()=>{St=!1}));function wt(e){let t=new Map(e);return e=>(t.get(e)??Y)(e)}function Tt({value:e,onChange:t,onSubmit:n,onExit:r,onExitMessage:i,onHistoryUp:a,onHistoryDown:o,onHistoryReset:s,onClearInput:c,mask:l=``,multiline:u=!1,cursorChar:d,invert:p,columns:m,onImagePaste:h,disableCursorMovementForUpDownKeys:g=!1,disableEscapeDoublePress:_=!1,maxVisibleLines:v,externalOffset:y,onOffsetChange:b,inputFilter:x,inlineGhostText:S,dim:C}){ge.terminal===`Apple_Terminal`&&bt();let w=y,T=b,E=q.fromText(e,m,w),{addNotification:ee,removeNotification:D}=De(),te=ie(e=>{i?.(e,`Ctrl-C`)},()=>r?.(),()=>{e&&(t(``),T(0),s?.())}),ne=ie(t=>{!e||!t||ee({key:`escape-again-to-clear`,text:`Esc again to clear`,priority:`immediate`,timeoutMs:1e3})},()=>{D(`escape-again-to-clear`),c?.(),e&&(e.trim()!==``&&Me(e),t(``),T(0),s?.())}),re=ie(t=>{e===``&&i?.(t,`Ctrl-D`)},()=>{e===``&&r?.()});function O(){return E.text===``?(re(),E):E.del()}function k(){let{cursor:e,killed:t}=E.deleteToLineEnd();return R(t,`append`),e}function ae(){let{cursor:e,killed:t}=E.deleteToLineStart();return R(t,`prepend`),e}function oe(){let{cursor:e,killed:t}=E.deleteWordBefore();return R(t,`prepend`),e}function se(){let e=ct();if(e.length>0){let t=E.offset,n=E.insert(e);return ut(t,e.length),n}return E}function ce(){let e=dt();if(!e)return E;let{text:t,start:n,length:r}=e,i=E.text.slice(0,n),a=E.text.slice(n+r),o=i+t+a,s=n+t.length;return ft(t.length),q.fromText(o,m,s)}let A=wt([[`a`,()=>E.startOfLine()],[`b`,()=>E.left()],[`c`,te],[`d`,O],[`e`,()=>E.endOfLine()],[`f`,()=>E.right()],[`h`,()=>E.deleteTokenBefore()??E.backspace()],[`k`,k],[`n`,()=>j()],[`p`,()=>fe()],[`u`,ae],[`w`,oe],[`y`,se]]),ue=wt([[`b`,()=>E.prevWord()],[`f`,()=>E.nextWord()],[`d`,()=>E.deleteWordAfter()],[`y`,ce]]);function de(t){if(u&&E.offset>0&&E.text[E.offset-1]===`\\`)return Ae(),E.backspace().insert(`
|
|
16
|
-
`);if(t.meta||t.shift||ge.terminal===`Apple_Terminal`&&xt(`shift`))return E.insert(`
|
|
17
|
-
`);n?.(e)}function fe(){if(g)return a?.(),E;let e=E.up();if(!e.equals(E))return e;if(u){let e=E.upLogicalLine();if(!e.equals(E))return e}return a?.(),E}function j(){if(g)return o?.(),E;let e=E.down();if(!e.equals(E))return e;if(u){let e=E.downLogicalLine();if(!e.equals(E))return e}return o?.(),E}function pe(e){switch(!0){case e.escape:return()=>(_||ne(),E);case e.leftArrow&&(e.ctrl||e.meta||e.fn):return()=>E.prevWord();case e.rightArrow&&(e.ctrl||e.meta||e.fn):return()=>E.nextWord();case e.backspace:return e.meta||e.ctrl?oe:()=>E.deleteTokenBefore()??E.backspace();case e.delete:return e.meta?k:()=>E.del();case e.ctrl:return A;case e.home:return()=>E.startOfLine();case e.end:return()=>E.endOfLine();case e.pageDown:return f()?Y:()=>E.endOfLine();case e.pageUp:return f()?Y:()=>E.startOfLine();case e.wheelUp:case e.wheelDown:return Y;case e.return:return()=>de(e);case e.meta:return ue;case e.tab:return()=>E;case e.upArrow&&!e.shift:return fe;case e.downArrow&&!e.shift:return j;case e.leftArrow:return()=>E.left();case e.rightArrow:return()=>E.right();default:return e=>{switch(!0){case e===`\x1B[H`||e===`\x1B[1~`:return E.startOfLine();case e===`\x1B[F`||e===`\x1B[4~`:return E.endOfLine();default:{let t=le(e).replace(/(?<=[^\\\r\n])\r$/,``).replace(/\r/g,`
|
|
18
|
-
`);return E.isAtStart()&&ot(e)?E.insert(t).left():E.insert(t)}}}}}function me(e,t){return!!(e.ctrl&&(t===`k`||t===`u`||t===`w`)||e.meta&&(e.backspace||e.delete))}function he(e,t){return(e.ctrl||e.meta)&&t===`y`}function M(e,r){let i=x?x(e,r):e;if(i===``&&e!==``)return;if(!r.backspace&&!r.delete&&e.includes(``)){let n=(e.match(/\x7f/g)||[]).length,r=E;for(let e=0;e<n;e++)r=r.deleteTokenBefore()??r.backspace();E.equals(r)||(E.text!==r.text&&t(r.text),T(r.offset)),lt(),pt();return}me(r,i)||lt(),he(r,i)||pt();let a=pe(r)(i);a&&(E.equals(a)||(E.text!==a.text&&t(a.text),T(a.offset)),i.length>1&&i.endsWith(`\r`)&&!i.slice(0,-1).includes(`\r`)&&i[i.length-2]!==`\\`&&n?.(a.text))}let _e=S&&C&&S.insertPosition===w?{text:S.text,dim:C}:void 0,N=E.getPosition();return{onInput:M,renderedValue:E.render(d,l,p,_e,v),offset:w,setOffset:T,cursorLine:N.line-E.getViewportStartLine(v),cursorColumn:N.column,viewportCharOffset:E.getViewportCharOffset(v),viewportCharEnd:E.getViewportCharEnd(v)}}var Y,Et=t((()=>{st(),Oe(),E(),ke(),je(),yt(),_e(),l(),Ct(),Fe(),Y=()=>{}}));function Dt({placeholder:e,value:t,showCursor:n,focus:r,terminalFocus:i=!0,invert:a=k.inverse,hidePlaceholderText:o=!1}){let s;e&&(o?s=n&&r&&i?a(` `):``:(s=k.dim(e),n&&r&&i&&(s=e.length>0?a(e[0])+k.dim(e.slice(1)):a(` `))));let c=t.length===0&&!!e;return{renderedPlaceholder:s,showPlaceholder:c}}var Ot=t((()=>{ae()}));function kt({onPaste:e,onInput:t,onImagePaste:n}){let[r,i]=X.useState({chunks:[],timeoutId:null}),[a,o]=X.useState(!1),s=X.useRef(!0),c=X.useRef(!1),l=X.useMemo(()=>Se()===`macos`,[]);X.useEffect(()=>()=>{s.current=!1},[]);let u=de(X.useCallback(()=>{!n||!s.current||We().then(e=>{e&&s.current&&n(e.base64,e.mediaType,void 0,e.dimensions)}).catch(e=>{s.current&&P(e)}).finally(()=>{s.current&&o(!1)})},[n]),At),d=X.useCallback(t=>(t&&clearTimeout(t),setTimeout((e,t,n,r,i,a,o)=>{o.current=!1,e(({chunks:e})=>{let o=e.join(``).replace(/\[I$/,``).replace(/\[O$/,``),s=o.split(/ (?=\/|[A-Za-z]:\\)/).flatMap(e=>e.split(`
|
|
19
|
-
`)).filter(e=>e.trim()),c=s.filter(e=>I(e));if(t&&c.length>0){let e=/\/TemporaryItems\/.*screencaptureui.*\/Screenshot/i.test(o);return Promise.all(c.map(e=>Ye(e))).then(c=>{let l=c.filter(e=>e!==null);if(l.length>0){for(let e of l){let n=Le(e.path);t(e.base64,e.mediaType,n,e.dimensions,e.path)}let e=s.filter(e=>!I(e));e.length>0&&n&&n(e.join(`
|
|
20
|
-
`)),r(!1)}else e&&a?i():(n&&n(o),r(!1))}),{chunks:[],timeoutId:null}}return a&&t&&o.length===0?(i(),{chunks:[],timeoutId:null}):(n&&n(o),r(!1),{chunks:[],timeoutId:null})})},jt,i,n,e,o,u,l,c)),[u,l,n,e]);return{wrappedOnInput:(r,a,s)=>{let f=s.keypress.isPasted;f&&o(!0);let p=r.split(/ (?=\/|[A-Za-z]:\\)/).flatMap(e=>e.split(`
|
|
21
|
-
`)).some(e=>I(e.trim()));if(f&&r.length===0&&l&&n){u(),o(!1);return}if(e&&(r.length>800||c.current||p||f||r.length>=3&&!a.return&&!a.tab&&!a.escape&&!a.upArrow&&!a.downArrow&&!a.leftArrow&&!a.rightArrow)){c.current=!0,i(({chunks:e,timeoutId:t})=>({chunks:[...e,r],timeoutId:d(t)}));return}t(r,a),r.length>10&&o(!1)},pasteState:r,isPasting:a}}var X,At,jt,Mt=t((()=>{X=n(O(),1),xe(),ue(),Ze(),Ce(),At=50,jt=100}));function Nt(e,t){if(t.length===0)return[{text:e,start:0}];let n=[...t].sort((e,t)=>e.start===t.start?t.priority-e.priority:e.start-t.start),r=[],i=[];for(let e of n)e.start!==e.end&&(i.some(t=>e.start>=t.start&&e.start<t.end||e.end>t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end)||(r.push(e),i.push({start:e.start,end:e.end})));return new Ft(e).segment(r)}function Pt(e){return ne(e).filter(e=>e.code!==e.endCode)}var Ft,It=t((()=>{y(),a(),Ft=class{constructor(e){o(this,`text`,void 0),o(this,`tokens`,void 0),o(this,`visiblePos`,0),o(this,`stringPos`,0),o(this,`tokenIdx`,0),o(this,`charIdx`,0),o(this,`codes`,[]),this.text=e,this.tokens=ee(e)}segment(e){let t=[];for(let n of e){let e=this.segmentTo(n.start);e&&t.push(e);let r=this.segmentTo(n.end);r&&(r.highlight=n,t.push(r))}let n=this.segmentTo(1/0);return n&&t.push(n),t}segmentTo(e){if(this.tokenIdx>=this.tokens.length||e<=this.visiblePos)return null;let t=this.visiblePos;for(;this.tokenIdx<this.tokens.length;){let e=this.tokens[this.tokenIdx];if(e.type!==`ansi`)break;this.codes.push(e),this.stringPos+=e.code.length,this.tokenIdx++}let n=this.stringPos,r=[...this.codes];for(;this.visiblePos<e&&this.tokenIdx<this.tokens.length;){let t=this.tokens[this.tokenIdx];if(t.type===`ansi`)this.codes.push(t),this.stringPos+=t.code.length,this.tokenIdx++;else{let n=e-this.visiblePos,r=t.value.length-this.charIdx,i=Math.min(n,r);this.stringPos+=i,this.visiblePos+=i,this.charIdx+=i,this.charIdx>=t.value.length&&(this.tokenIdx++,this.charIdx=0)}}if(this.stringPos===n)return null;let i=Pt(r),a=Pt(this.codes);this.codes=a;let o=w(i),s=w(fe(a));return{text:o+this.text.substring(n,this.stringPos)+s,start:t}}}}));function Lt({char:e,index:t,glimmerIndex:n,messageColor:r,shimmerColor:i}){let a=t===n,o=Math.abs(t-n)===1;return(0,Rt.jsx)(D,{color:a||o?i:r,children:e})}var Rt,zt=t((()=>{A(),Rt=j()}));function Bt({text:e,highlights:t}){let{lines:n,hasShimmer:r,sweepStart:i,cycleLength:a}=Vt.useMemo(()=>{let n=Nt(e,t),r=[[]],i=0;for(let e of n){let t=e.text.split(`
|
|
22
|
-
`);for(let n=0;n<t.length;n++){n>0&&(r.push([]),i+=1);let a=t[n];a.length>0&&r[r.length-1].push({text:a,highlight:e.highlight,start:i}),i+=a.length}}let a=t.some(e=>e.shimmerColor),o=0,s=1;if(a){let e=1/0,n=-1/0;for(let r of t)r.shimmerColor&&(e=Math.min(e,r.start),n=Math.max(n,r.end));o=e-10,s=n-e+20}return{lines:r,hasShimmer:a,sweepStart:o,cycleLength:s}},[e,t]),[o,s]=ce(r?50:null),c=r?i+Math.floor(s/50)%a:-100;return(0,Z.jsx)(T,{ref:o,flexDirection:`column`,children:n.map((e,t)=>(0,Z.jsx)(T,{children:e.length===0?(0,Z.jsx)(D,{children:` `}):e.map((e,t)=>e.highlight?.shimmerColor&&e.highlight.color?(0,Z.jsx)(D,{children:e.text.split(``).map((t,n)=>(0,Z.jsx)(Lt,{char:t,index:e.start+n,glimmerIndex:c,messageColor:e.highlight.color,shimmerColor:e.highlight.shimmerColor},n))},t):(0,Z.jsx)(D,{color:e.highlight?.color,dimColor:e.highlight?.dimColor,inverse:e.highlight?.inverse,children:(0,Z.jsx)(b,{children:e.text})},t))},t))})}var Vt,Z,Ht=t((()=>{Vt=n(O(),1),A(),It(),zt(),Z=j()}));function Ut({inputState:e,children:t,terminalFocus:n,invert:r,hidePlaceholderText:i,...a}){let{onInput:o,renderedValue:s,cursorLine:c,cursorColumn:l}=e,u=x({line:c,column:l,active:!!(a.focus&&a.showCursor&&n)}),{wrappedOnInput:d,isPasting:f}=kt({onPaste:a.onPaste,onInput:(e,t)=>{f&&t.return||o(e,t)},onImagePaste:a.onImagePaste}),{onIsPastingChange:p}=a;Wt.useEffect(()=>{p&&p(f)},[f,p]);let{showPlaceholder:m,renderedPlaceholder:h}=Dt({placeholder:a.placeholder,value:a.value,showCursor:a.showCursor,focus:a.focus,terminalFocus:n,invert:r,hidePlaceholderText:i});oe(d,{isActive:a.focus});let g=a.value&&a.value.trim().indexOf(` `)===-1||a.value?.endsWith(` `),_=!!(a.argumentHint&&a.value&&g&&a.value.startsWith(`/`)),v=a.showCursor&&a.highlights?a.highlights.filter(e=>e.dimColor||a.cursorOffset<e.start||a.cursorOffset>=e.end):a.highlights,{viewportCharOffset:y,viewportCharEnd:S}=e,C=v&&y>0?v.filter(e=>e.end>y&&e.start<S).map(e=>({...e,start:Math.max(0,e.start-y),end:e.end-y})):v;return C&&C.length>0?(0,Q.jsxs)(T,{ref:u,children:[(0,Q.jsx)(Bt,{text:s,highlights:C}),_&&(0,Q.jsxs)(D,{dimColor:!0,children:[a.value?.endsWith(` `)?``:` `,a.argumentHint]}),t]}):(0,Q.jsx)(T,{ref:u,children:(0,Q.jsxs)(D,{wrap:`truncate-end`,dimColor:a.dimColor,children:[m&&a.placeholderElement?a.placeholderElement:m&&h?(0,Q.jsx)(b,{children:h}):(0,Q.jsx)(b,{children:s}),_&&(0,Q.jsxs)(D,{dimColor:!0,children:[a.value?.endsWith(` `)?``:` `,a.argumentHint]}),t]})})}var Wt,Q,Gt=t((()=>{Wt=n(O(),1),Ot(),Mt(),A(),Ht(),Q=j()}));function Kt(e){let[t]=C(),n=re(),i=(0,qt.useMemo)(()=>r(process.env.CLAUDE_CODE_ACCESSIBILITY),[]);c().prefersReducedMotion,Qe(n,!!e.onImagePaste);let a=n&&!i?k.inverse:e=>e;return(0,$.jsx)(T,{children:(0,$.jsx)(Ut,{inputState:Tt({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:a,themeText:se(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,inlineGhostText:e.inlineGhostText,dim:k.dim}),terminalFocus:n,highlights:e.highlights,invert:a,...e})})}var qt,$,Jt=t((()=>{ae(),qt=n(O(),1),nt(),s(),Et(),A(),i(),Gt(),$=j()}));export{st as C,We as D,Qe as E,Ze as O,at as S,nt as T,lt as _,Lt as a,dt as b,Tt as c,yt as d,K as f,ut as g,R as h,Gt as i,q as l,G as m,Jt as n,zt as o,_t as p,Ut as r,Et as s,Kt as t,ct as u,pt as v,rt as w,it as x,ft as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Cp as t,Ip as n,Lp as r,Sp as i,_b as a,_i as o,bb as s,gb as c,hb as l,hi as u,mb as d,vp as f,wp as p,yp as m,zp as h}from"./loadAgentsDir-B0Anodo0.js";import{D as g,H as _,I as v,P as y,T as b,U as x,V as S,Wt as C,Xt as w,ot as T,t as E}from"./src-DL3w8VPk.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{b as O,h as k}from"./settings-B2jvL8Dp.js";import{n as A,t as j}from"./useExitOnCtrlCDWithKeybindings-BKwzUpgb.js";import{t as M}from"./select-DIxfl_VN.js";import{t as N}from"./CustomSelect-wmZ9jz0W.js";function P({onThemeSelect:e,showIntroText:n=!1,helpText:a=``,showHelpTextBelow:o=!1,hideEscToCancel:s=!1,skipExitHandling:l=!1,onCancel:d}){let[p]=_(),m=x(),{columns:E}=T(),D=i(),k=D===null?t(p):null,{setPreviewTheme:j,savePreview:N,cancelPreview:P}=S(),I=r(e=>e.settings.syntaxHighlightingDisabled)??!1,L=h();w(`ThemePicker`);let R=c(`theme:toggleSyntaxHighlighting`,`ThemePicker`,`ctrl+t`);C(`theme:toggleSyntaxHighlighting`,()=>{if(D===null){let e=!I;O(`userSettings`,{syntaxHighlightingDisabled:e}),L(t=>({...t,settings:{...t.settings,syntaxHighlightingDisabled:e}}))}},{context:`ThemePicker`});let z=A(l?()=>{}:void 0),B=[{label:`Dark mode`,value:`dark`},{label:`Light mode`,value:`light`},{label:`Dark mode (colorblind-friendly)`,value:`dark-daltonized`},{label:`Light mode (colorblind-friendly)`,value:`light-daltonized`},{label:`Dark mode (ANSI colors only)`,value:`dark-ansi`},{label:`Light mode (ANSI colors only)`,value:`light-ansi`}],V=(0,F.jsxs)(v,{flexDirection:`column`,gap:1,children:[(0,F.jsxs)(v,{flexDirection:`column`,gap:1,children:[n?(0,F.jsx)(y,{children:`Let's get started.`}):(0,F.jsx)(y,{bold:!0,color:`permission`,children:`Theme`}),(0,F.jsxs)(v,{flexDirection:`column`,children:[(0,F.jsx)(y,{bold:!0,children:`Choose the text style that looks best with your terminal`}),a&&!o&&(0,F.jsx)(y,{dimColor:!0,children:a})]}),(0,F.jsx)(M,{options:B,onFocus:e=>{j(e)},onChange:t=>{N(),e(t)},onCancel:l?()=>{P(),d?.()}:async()=>{P(),await u(0)},visibleOptionCount:B.length,defaultValue:m,defaultFocusValue:m})]}),(0,F.jsxs)(v,{flexDirection:`column`,width:`100%`,children:[(0,F.jsx)(v,{flexDirection:`column`,borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:`dashed`,borderColor:`subtle`,children:(0,F.jsx)(f,{patch:{oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[` function greet() {`,`- console.log("Hello, World!");`,`+ console.log("Hello, Work Mate!");`,` }`]},dim:!1,filePath:`demo.js`,firstLine:null,width:E})}),(0,F.jsxs)(y,{dimColor:!0,children:[` `,D===`env`?`Syntax highlighting disabled (via CLAUDE_CODE_SYNTAX_HIGHLIGHT=${process.env.CLAUDE_CODE_SYNTAX_HIGHLIGHT})`:I?`Syntax highlighting disabled (${R} to enable)`:k?`Syntax theme: ${k.theme}${k.source?` (from ${k.source})`:``} (${R} to disable)`:`Syntax highlighting enabled (${R} to disable)`]})]})]});return n?V:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v,{flexDirection:`column`,children:V}),(0,F.jsxs)(v,{marginTop:1,children:[o&&a&&(0,F.jsx)(v,{marginLeft:3,children:(0,F.jsx)(y,{dimColor:!0,children:a})}),!s&&(0,F.jsx)(v,{children:(0,F.jsx)(y,{dimColor:!0,italic:!0,children:z.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):(0,F.jsxs)(b,{children:[(0,F.jsx)(g,{shortcut:`Enter`,action:`select`}),(0,F.jsx)(g,{shortcut:`Esc`,action:`cancel`})]})})})]})]})}var F,I=e((()=>{j(),s(),E(),a(),d(),l(),n(),o(),k(),N(),p(),m(),F=D()}));export{I as n,P as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dv as t,Nm as n,Pm as r,Tv as i,_i as a,gi as o,mb as s}from"./loadAgentsDir-B0Anodo0.js";import{I as c,P as l,Wt as u,ai as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{It as m,Rn as h}from"./state-B4jiUise.js";import{n as g,t as _}from"./cwd-Pa83R95t.js";import{f as v,u as y}from"./debug-Bglx1aTu.js";import{h as b,s as x}from"./settings-B2jvL8Dp.js";import{g as S,n as C,p as w}from"./config-C-Y2qtB2.js";import{n as T,r as E}from"./analytics-DJobLaWP.js";import{in as D}from"./prompt-CJ1l3XXk.js";import{n as O,t as k}from"./useExitOnCtrlCDWithKeybindings-BKwzUpgb.js";import{t as A}from"./select-DIxfl_VN.js";import{t as j}from"./CustomSelect-wmZ9jz0W.js";import{n as M,t as N}from"./PermissionDialog-BaibiQae.js";import{n as P,t as F}from"./managedEnvConstants-BPwL2aWI.js";import{homedir as I}from"os";var L=e(d(),1),R=p();f(),m(),g(),v(),T(),w(),s(),t(),a(),k(),j(),M(),b(),D(),P(),r();function z(e){if(e===null||e.disableAllHooks)return!1;if(e.statusLine||e.fileSuggestion)return!0;if(!e.hooks)return!1;for(let t of Object.values(e.hooks))if(t.length>0)return!0;return!1}function B(){let e=[];return z(x(`projectSettings`))&&e.push(`.workmate/settings.json`),z(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function V(e){return e.some(e=>e.ruleBehavior===`allow`&&(e.ruleValue.toolName===`Bash`||e.ruleValue.toolName.startsWith(`Bash(`)))}function H(){let e=[];return V(n(`projectSettings`))&&e.push(`.workmate/settings.json`),V(n(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function U(e){return e?.env?Object.keys(e.env).some(e=>!F.has(e.toUpperCase())):!1}function W(){let e=[];return U(x(`projectSettings`))&&e.push(`.workmate/settings.json`),U(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}D();function G({onDone:e,commands:t}){let{servers:n}=i(`project`),r=Object.keys(n).length>0,a=B().length>0,s=H(),d=W().length>0,f=t?.some(e=>e.type===`prompt`&&e.loadedFrom===`commands_DEPRECATED`&&(e.source===`projectSettings`||e.source===`localSettings`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,p=t?.some(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`)&&(e.source===`projectSettings`||e.source===`localSettings`||e.source===`plugin`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,m=s.length>0||f||p,g=C(),[v,b]=L.useState(null);L.useEffect(()=>{if(v!==null){let e=v,t=setTimeout(()=>o(e));return()=>clearTimeout(t)}},[v]),L.useEffect(()=>{E(`tengu_trust_dialog_shown`,{isHomeDir:I()===_(),hasMcpServers:r,hasHooks:a,hasBashExecution:m,hasDangerousEnvVars:d})},[r,a,m,d]);function x(t){if(t===`exit`){b(1);return}let n=I()===_();E(`tengu_trust_dialog_accept`,{isHomeDir:n,hasMcpServers:r,hasHooks:a,hasBashExecution:m,hasDangerousEnvVars:d}),n?h(!0):S(e=>({...e,hasTrustDialogAccepted:!0})),e()}let w=O(()=>b(1));return u(`confirm:no`,()=>{b(0)},{context:`Confirmation`}),v===null?g?(setTimeout(e),null):(0,R.jsx)(N,{color:`warning`,titleColor:`warning`,title:`Accessing workspace:`,children:(0,R.jsxs)(c,{flexDirection:`column`,gap:1,paddingTop:1,children:[(0,R.jsx)(l,{bold:!0,children:y().cwd()}),(0,R.jsx)(l,{children:`Is this a project you trust? (Your own code, a well-known open source project, or work from your team).`}),(0,R.jsx)(l,{children:`Once trusted, Work Mate can read, edit, and run commands in this folder.`}),(0,R.jsx)(A,{options:[{label:`Yes, I trust this folder`,value:`enable_all`},{label:`No, exit`,value:`exit`}],onChange:e=>x(e),onCancel:()=>x(`exit`)}),(0,R.jsx)(l,{dimColor:!0,children:w.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,w.keyName,` again to exit`]}):(0,R.jsx)(R.Fragment,{children:`Enter to confirm · Esc to cancel`})})]})}):null}export{G as TrustDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{IC as t,LC as n}from"./loadAgentsDir-B0Anodo0.js";import{Ar as r,jr as i}from"./state-B4jiUise.js";function a(e,t){return function(n,r){if(n==null)return n;if(!i(n))return e(n,r);for(var a=n.length,o=t?a:-1,s=Object(n);(t?o--:++o<a)&&r(s[o],o,s)!==!1;);return n}}var o=e((()=>{r()})),s,c=e((()=>{n(),o(),s=a(t)}));export{c as n,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Am as i,Em as a,F as o,N as s,P as c,gC as l,km as u,nb as d,rb as f,yC as p}from"./loadAgentsDir-B0Anodo0.js";import{I as m,P as h,ai as g,di as _,fi as v,t as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{It as x,Yt as S,h as C}from"./state-B4jiUise.js";import{n as w,t as T}from"./AddWorkspaceDirectory-Ch8IcWXO.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(m,{flexDirection:`column`,children:[(0,k.jsxs)(h,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(d,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),c=t.getAppState(),u=async(n,r=!1)=>{let o={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},s=a(t.getAppState().toolPermissionContext,o);t.setAppState(e=>({...e,toolPermissionContext:s}));let c=C();c.includes(n)||S([...c,n]),l.refreshConfig();let u;if(r)try{i(o),u=`Added ${_.bold(n)} as a working directory and saved to local settings`}catch(e){u=`Added ${_.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else u=`Added ${_.bold(n)} as a working directory for this session`;e(`${u} ${_.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:c.toolPermissionContext,onAddDirectory:u,onCancel:()=>{e(`Did not add a working directory.`)}});let d=await o(r,c.toolPermissionContext);if(d.resultType!==`success`){let t=s(d);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:d.absolutePath,permissionContext:c.toolPermissionContext,onAddDirectory:u,onCancel:()=>{e(`Did not add ${_.bold(d.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{v(),n(),O=t(g(),1),x(),f(),w(),y(),u(),p(),c(),k=b()}))();export{D as call};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$y as o,Ad as s,Au as c,Cl as l,Dd as u,Ec as d,El as f,Fw as p,Gf as m,Ip as h,Iw as g,Kf as _,Lf as ee,Ll as v,Lp as te,Md as y,Mh as ne,Mu as re,Nd as ie,Nh as ae,Od as oe,Of as se,Pd as ce,Pw as le,Q as ue,Qy as de,RC as fe,Rd as pe,Rf as me,Rl as he,Tc as ge,Tl as _e,Uf as ve,Vd as ye,Wf as be,X as xe,Xf as Se,Yi as Ce,Zf as we,_v as Te,aC as Ee,ay as De,c as Oe,cd as ke,da as Ae,et as je,gv as Me,iy as Ne,jd as Pe,ju as Fe,kd as Ie,kf as Le,ku as Re,l as ze,mb as b,md as x,nt as Be,ny as Ve,o as He,oy as Ue,pS as We,pd as S,qg as Ge,r as Ke,ry as qe,s as Je,t as Ye,ty as Xe,ud as Ze,wl as Qe,zC as $e,zd as et,zp as tt}from"./loadAgentsDir-B0Anodo0.js";import{C as nt,D as C,I as w,P as T,T as E,Wt as D,ai as O,di as rt,fi as it,t as k,y as at}from"./src-DL3w8VPk.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{n as ot,t as st}from"./cwd-Pa83R95t.js";import{H as ct,I as lt,N as ut,S as dt,V as ft,Y as pt,x as mt}from"./debug-Bglx1aTu.js";import{Hn as ht,Qt as gt,Vn as _t,Xt as vt,Z as yt,it as bt,ln as xt,q as St,rt as Ct,sn as wt}from"./settings-B2jvL8Dp.js";import{A as Tt,O as Et}from"./config-C-Y2qtB2.js";import{o as Dt,s as Ot}from"./log-D2TIwHBV.js";import{l as kt,n as At,o as jt}from"./stringUtils-C718f5ey.js";import{n as Mt,r as Nt}from"./analytics-DJobLaWP.js";import{S as Pt,_ as Ft}from"./startupProfiler-CJdr3SxP.js";import{_n as It,vn as Lt}from"./prompt-CJ1l3XXk.js";import{a as Rt,i as zt,n as Bt,o as Vt,r as Ht,t as Ut}from"./agentDisplay-M4pfwbMC.js";import{n as Wt,t as Gt}from"./TextInput-B8ruWRf2.js";import{n as Kt,t as qt}from"./useExitOnCtrlCDWithKeybindings-BKwzUpgb.js";import{n as Jt,t as Yt}from"./select-DIxfl_VN.js";import{r as Xt,t as Zt}from"./Spinner-ByQXTvAA.js";import{n as Qt,t as $t}from"./useMergedTools-CCgnBJzO.js";import{n as en,r as tn,t as nn}from"./promptEditor-DoGHJN_W.js";import{n as rn,t as an}from"./useMainLoopModel-DxvV70Ru.js";import{join as j}from"path";import{mkdir as on,open as sn,unlink as cn}from"fs/promises";var M,ln=e((()=>{M={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function un(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 dn(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return j(n(),M.AGENTS_DIR);case`projectSettings`:return j(st(),M.FOLDER_NAME,M.AGENTS_DIR);case`policySettings`:return j(vt(),M.FOLDER_NAME,M.AGENTS_DIR);case`localSettings`:return j(st(),M.FOLDER_NAME,M.AGENTS_DIR)}}function fn(e){switch(e){case`projectSettings`:return j(`.`,M.FOLDER_NAME,M.AGENTS_DIR);default:return dn(e)}}function pn(e){return j(dn(e.source),`${e.agentType}.md`)}function mn(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return j(dn(e.source),`${e.filename||e.agentType}.md`)}function hn(e){return e.source===`built-in`?`Built-in`:j(fn(e.source),`${e.agentType}.md`)}function gn(e){return Je(e)?`Built-in`:ze(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:j(fn(e.source),`${e.filename||e.agentType}.md`)}async function _n(e){let t=dn(e);return await on(t,{recursive:!0}),t}async function vn(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await _n(e);let l=pn({source:e,agentType:t}),u=un(t,n,r,i,o,s,c);try{await xn(l,u,a?`wx`:`w`)}catch(e){throw ut(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function yn(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await xn(mn(e),un(e.agentType,t,n,r,i,a,o))}async function bn(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=mn(e);try{await cn(t)}catch(e){if(ut(e)!==`ENOENT`)throw e}}async function xn(e,t,n=`w`){let r=await sn(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var Sn=e((()=>{gt(),He(),ot(),r(),lt(),ln()}));function Cn({agent:e,tools:t,onBack:n}){let r=Ie(e,t,!1),i=gn(e),o=y(e.agentType);D(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function c(){return r.hasWildcard?(0,N.jsx)(T,{children:`All tools`}):!e.tools||e.tools.length===0?(0,N.jsx)(T,{children:`None`}):(0,N.jsxs)(N.Fragment,{children:[r.validTools.length>0&&(0,N.jsx)(T,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,N.jsxs)(T,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,N.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,N.jsx)(T,{dimColor:!0,children:i}),(0,N.jsxs)(w,{flexDirection:`column`,children:[(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]}),(0,N.jsx)(w,{marginLeft:2,children:(0,N.jsx)(T,{children:e.whenToUse})})]}),(0,N.jsxs)(w,{children:[(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Tools`}),`:`,` `]}),c()]}),(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Model`}),`: `,pe(e.model)]}),e.permissionMode&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Memory`}),`: `,le(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),o&&(0,N.jsx)(w,{children:(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Color`}),`:`,` `,(0,N.jsxs)(T,{backgroundColor:o,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!Je(e)&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(w,{children:(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`System prompt`}),`:`]})}),(0,N.jsx)(w,{marginLeft:2,marginRight:2,children:(0,N.jsx)(ke,{children:e.getSystemPrompt()})})]})]})}var N,wn=e((()=>{i(),k(),b(),ie(),p(),oe(),He(),ye(),Ze(),Sn(),N=A()}));function Tn({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,En.useState)(Math.max(0,Dn.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:Dn.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<Dn.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=Dn[r];n(t===`automatic`?void 0:t)}},s=Dn[r];return(0,P.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,P.jsx)(w,{flexDirection:`column`,children:Dn.map((e,t)=>{let n=t===r;return(0,P.jsxs)(w,{flexDirection:`row`,gap:1,children:[(0,P.jsx)(T,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,P.jsx)(T,{bold:n,children:`Automatic color`}):(0,P.jsxs)(w,{gap:1,children:[(0,P.jsx)(T,{backgroundColor:Pe[e],color:`inverseText`,children:` `}),(0,P.jsx)(T,{bold:n,children:At(e)})]})]},e)})}),(0,P.jsxs)(w,{marginTop:1,children:[(0,P.jsx)(T,{children:`Preview: `}),s===void 0||s===`automatic`?(0,P.jsxs)(T,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,P.jsxs)(T,{backgroundColor:Pe[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var En,P,Dn,On=e((()=>{i(),En=t(O(),1),k(),ie(),jt(),P=A(),Dn=[`automatic`,...s]}));function kn({initialModel:e,onComplete:t,onCancel:n}){let r=An.useMemo(()=>{let t=et();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,jn.jsxs)(w,{flexDirection:`column`,children:[(0,jn.jsx)(w,{marginBottom:1,children:(0,jn.jsx)(T,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,jn.jsx)(Yt,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var An,jn,Mn=e((()=>{An=t(O(),1),k(),ye(),Jt(),jn=A()}));function Nn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([ve.name,m.name,l.name,de.name,ee.name,v.name,_e.name,De.name,qe.name])},EDIT:{name:`Edit tools`,toolNames:new Set([Fe.name,Se.name,Re.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([se.name])},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function Pn(e){let t=new Map;return e.forEach(e=>{if(Te(e)){let n=bt(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 Fn({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,F.useMemo)(()=>u({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[o,s]=(0,F.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[c,l]=(0,F.useState)(0),[d,f]=(0,F.useState)(!1),p=(0,F.useMemo)(()=>{let e=new Set(i.map(e=>e.name));return o.filter(t=>e.has(t))},[o,i]),m=new Set(p),h=p.length===i.length&&i.length>0,g=e=>{e&&s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},_=(e,t)=>{s(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(p.length===e.length&&e.every(e=>p.includes(e))?void 0:p)},v=(0,F.useMemo)(()=>{let e=Nn(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{Te(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=_t(e,e=>m.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);_(n,t)}},y=[];y.push({id:`continue`,label:`Continue`,action:ee,isContinue:!0}),y.push({id:`bucket-all`,label:`${h?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);_(e,!h)}});let ne=Nn();[{id:`bucket-readonly`,name:ne.READ_ONLY.name,tools:v.readOnly},{id:`bucket-edit`,name:ne.EDIT.name,tools:v.edit},{id:`bucket-execution`,name:ne.EXECUTION.name,tools:v.execution},{id:`bucket-mcp`,name:ne.MCP.name,tools:v.mcp},{id:`bucket-other`,name:ne.OTHER.name,tools:v.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=_t(n,e=>m.has(e.name))===n.length;y.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:te(n)})});let re=y.length;y.push({id:`toggle-individual`,label:d?`Hide advanced options`:`Show advanced options`,action:()=>{f(!d),d&&c>re&&l(re)},isToggle:!0});let ie=(0,F.useMemo)(()=>Pn(i),[i]);return d&&(ie.length>0&&(y.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),ie.forEach(({serverName:e,tools:t})=>{let n=_t(t,e=>m.has(e.name))===t.length;y.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${kt(t.length,`tool`)})`,action:()=>{let e=t.map(e=>e.name);_(e,!n)}})}),y.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=bt(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}y.push({id:`tool-${e.name}`,label:`${m.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>g(e.name)})})),D(`confirm:no`,(0,F.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,I.jsxs)(w,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=y[c];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=c-1;for(;t>0&&y[t]?.isHeader;)t--;l(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=c+1;for(;t<y.length-1&&y[t]?.isHeader;)t++;l(Math.min(y.length-1,t))}},children:[(0,I.jsxs)(T,{color:c===0?`suggestion`:void 0,bold:c===0,children:[c===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,I.jsx)(nt,{width:40}),y.slice(1).map((e,t)=>{let n=t+1===c,r=e.isToggle,i=e.isHeader;return(0,I.jsxs)(F.Fragment,{children:[r&&(0,I.jsx)(nt,{width:40}),i&&t>0&&(0,I.jsx)(w,{marginTop:1}),(0,I.jsxs)(T,{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,I.jsx)(w,{marginTop:1,flexDirection:`column`,children:(0,I.jsx)(T,{dimColor:!0,children:h?`All tools selected`:`${m.size} of ${i.length} tools selected`})})]})}var F,I,In=e((()=>{i(),F=t(O(),1),Ct(),Me(),oe(),yt(),Le(),Qe(),re(),o(),we(),be(),_(),Ue(),c(),Ne(),f(),he(),me(),k(),b(),ht(),jt(),I=A()}));function Ln(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:fe(wt(e))}var Rn=e((()=>{$e(),xt()}));function zn({agent:e,tools:t,onSaved:n,onBack:r}){let i=tt(),[o,s]=(0,L.useState)(`menu`),[c,l]=(0,L.useState)(0),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(e.color),m=(0,L.useCallback)(async()=>{let t=await nn(mn(e));t.error?d(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),h=(0,L.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??f,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!Oe(e)&&!ze(e)?!1:(await yn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&ce(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:Ke(n),allAgents:n}}}),n(`Updated agent: ${rt.bold(e.agentType)}`),!0)}catch(e){return d(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,f,n,i]),g=(0,L.useMemo)(()=>[{label:`Open in editor`,action:m},{label:`Edit tools`,action:()=>s(`edit-tools`)},{label:`Edit model`,action:()=>s(`edit-model`)},{label:`Edit color`,action:()=>s(`edit-color`)}],[m]),_=(0,L.useCallback)(()=>{d(null),o===`menu`?r():s(`menu`)},[o,r]),ee=(0,L.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),l(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),l(e=>Math.min(g.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=g[c];t&&t.action()}},[g,c]);D(`confirm:no`,_,{context:`Confirmation`});let v=()=>(0,R.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ee,children:[(0,R.jsxs)(T,{dimColor:!0,children:[`Source: `,Ln(e.source)]}),(0,R.jsx)(w,{marginTop:1,flexDirection:`column`,children:g.map((e,t)=>(0,R.jsxs)(T,{color:t===c?`suggestion`:void 0,children:[t===c?`${a.pointer} `:` `,e.label]},e.label))}),u&&(0,R.jsx)(w,{marginTop:1,children:(0,R.jsx)(T,{color:`error`,children:u})})]});switch(o){case`menu`:return v();case`edit-tools`:return(0,R.jsx)(Fn,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await h({tools:e})}});case`edit-color`:return(0,R.jsx)(Tn,{agentName:e.agentType,currentColor:f||e.color||`automatic`,onConfirm:async e=>{p(e),s(`menu`),await h({color:e})}});case`edit-model`:return(0,R.jsx)(kn,{initialModel:e.model,onComplete:async e=>{s(`menu`),await h({model:e})}});default:return null}}var L,R,Bn=e((()=>{it(),i(),L=t(O(),1),h(),k(),b(),ie(),He(),tn(),Sn(),On(),Mn(),In(),Rn(),R=A()}));function Vn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Kt();return(0,Hn.jsx)(w,{marginLeft:2,children:(0,Hn.jsx)(T,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Hn,Un=e((()=>{qt(),k(),Hn=A()}));function Wn({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:o}){let[s,c]=Gn.useState(null),[l,u]=Gn.useState(!0),d=Gn.useMemo(()=>[...t].sort(Bt),[t]),f=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),p=()=>(0,z.jsxs)(w,{children:[(0,z.jsx)(T,{color:l?`suggestion`:void 0,children:l?`${a.pointer} `:` `}),(0,z.jsx)(T,{color:l?`suggestion`:void 0,children:`Create new agent`})]}),m=e=>{let t=e.source===`built-in`,n=!t&&!l&&s?.agentType===e.agentType&&s?.source===e.source,{isOverridden:r,overriddenBy:i}=f(e),o=t||r,c=!t&&n?`suggestion`:void 0,u=Rt(e);return(0,z.jsxs)(w,{children:[(0,z.jsx)(T,{dimColor:o&&!n,color:c,children:t?``:n?`${a.pointer} `:` `}),(0,z.jsx)(T,{dimColor:o&&!n,color:c,children:e.agentType}),u&&(0,z.jsxs)(T,{dimColor:!0,color:c,children:[` · `,u]}),e.memory&&(0,z.jsxs)(T,{dimColor:!0,color:c,children:[` · `,e.memory,` memory`]}),i&&(0,z.jsxs)(T,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,Ht(i)]})]},`${e.agentType}-${e.source}`)},h=Gn.useMemo(()=>{let t=d.filter(e=>e.source!==`built-in`);return e===`all`?Ut.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[d,e]);Gn.useEffect(()=>{!s&&!l&&h.length>0&&(i?u(!0):c(h[0]||null))},[h,s,l,i]);let g=e=>{if(e.key===`return`){e.preventDefault(),l&&i?i():s&&r(s);return}if(e.key!==`up`&&e.key!==`down`)return;e.preventDefault();let t=!!i,n=h.length+ +!!t;if(n===0)return;let a=0;if(!l&&s){let e=h.findIndex(e=>e.agentType===s.agentType&&e.source===s.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)u(!0),c(null);else{let e=t?o-1:o,n=h[e];n&&(u(!1),c(n))}},_=(e=`Built-in (always available):`)=>{let t=d.filter(e=>e.source===`built-in`);return(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,z.jsx)(T,{bold:!0,dimColor:!0,children:e}),t.map(m)]})},ee=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,z.jsxs)(w,{paddingLeft:2,children:[(0,z.jsx)(T,{bold:!0,dimColor:!0,children:e}),n&&(0,z.jsxs)(T,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>m(e))]})},v=Ln(e),te=d.filter(e=>e.source===`built-in`);return!d.length||e!==`built-in`&&!d.some(e=>e.source!==`built-in`)?(0,z.jsx)(at,{title:v,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,z.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,z.jsx)(w,{children:p()}),(0,z.jsx)(T,{dimColor:!0,children:`No agents found. Create specialized subagents that Work Mate can delegate to.`}),(0,z.jsx)(T,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,z.jsx)(T,{dimColor:!0,children:`Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer.`}),e!==`built-in`&&d.some(e=>e.source===`built-in`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(nt,{}),_()]})]})}):(0,z.jsxs)(at,{title:v,subtitle:`${_t(d,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[o&&o.length>0&&(0,z.jsx)(w,{marginTop:1,children:(0,z.jsx)(T,{dimColor:!0,children:o[o.length-1]})}),(0,z.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,z.jsx)(w,{marginBottom:1,children:p()}),e===`all`?(0,z.jsxs)(z.Fragment,{children:[Ut.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,z.jsx)(Gn.Fragment,{children:ee(e,d.filter(e=>e.source===t))},t)),te.length>0&&(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,z.jsxs)(T,{dimColor:!0,children:[(0,z.jsx)(T,{bold:!0,children:`Built-in agents`}),` (always available)`]}),te.map(m)]})]}):e===`built-in`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,z.jsx)(w,{marginTop:1,flexDirection:`column`,children:d.map(e=>m(e))})]}):(0,z.jsxs)(z.Fragment,{children:[d.filter(e=>e.source!==`built-in`).map(e=>m(e)),d.some(e=>e.source===`built-in`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(nt,{}),_()]})]})]})]})}var Gn,z,Kn=e((()=>{i(),Gn=t(O(),1),k(),zt(),ht(),Rn(),z=A()}));function qn({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,B.useState)(0),[l,u]=(0,B.useState)(t),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)([]);Kt(),(0,B.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,B.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,B.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,B.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),ee=(0,B.useCallback)(()=>{m([]),r&&r()},[r]),v=(0,B.useCallback)(e=>{u(t=>({...t,...e}))},[]),te=(0,B.useMemo)(()=>({currentStepIndex:s,totalSteps:e.length,wizardData:l,setWizardData:u,updateWizardData:v,goNext:h,goBack:g,goToStep:_,cancel:ee,title:a,showStepCounter:o}),[s,e.length,l,v,h,g,_,ee,a,o]),y=e[s];return!y||d?null:(0,Jn.jsx)(Yn.Provider,{value:te,children:i||(0,Jn.jsx)(y,{})})}var B,Jn,Yn,Xn=e((()=>{B=t(O(),1),qt(),Jn=A(),Yn=(0,B.createContext)(null)}));function V(){let e=(0,Zn.useContext)(Yn);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var Zn,Qn=e((()=>{Zn=t(O(),1),Xn()}));function $n({instructions:e=(0,er.jsxs)(E,{children:[(0,er.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,er.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,er.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Kt();return(0,er.jsx)(w,{marginLeft:3,marginTop:1,children:(0,er.jsx)(T,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var er,tr=e((()=>{qt(),k(),x(),er=A()}));function H({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=V();return(0,nr.jsxs)(nr.Fragment,{children:[(0,nr.jsx)(at,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,nr.jsx)($n,{instructions:i})]})}var nr,U=e((()=>{k(),Qn(),tr(),nr=A()})),W=e((()=>{Qn(),U(),tr(),Xn()}));function rr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();return D(`confirm:no`,t,{context:`Confirmation`}),(0,G.jsx)(H,{subtitle:`Choose background color`,footerText:(0,G.jsxs)(E,{children:[(0,G.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,G.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,G.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,G.jsx)(w,{children:(0,G.jsx)(Tn,{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 G,ir=e((()=>{k(),b(),x(),W(),U(),On(),G=A()}));function ar(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 or(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=ar(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 ${Ln(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=Ie(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 sr=e((()=>{oe(),Rn()}));function cr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=V();D(`confirm:no`,a,{context:`Confirmation`});let s=e=>{e.key===`s`||e.key===`return`?(e.preventDefault(),n()):e.key===`e`&&(e.preventDefault(),r())},c=o.finalAgent,l=or(c,e,t),u=Pt(c.getSystemPrompt(),240),d=Pt(c.whenToUse,240),f=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]}`,p=Tt()?(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Memory`}),`: `,le(c.memory)]}):null;return(0,K.jsx)(H,{subtitle:`Confirm and save`,footerText:(0,K.jsxs)(E,{children:[(0,K.jsx)(C,{shortcut:`s/Enter`,action:`save`}),(0,K.jsx)(C,{shortcut:`e`,action:`edit in your editor`}),(0,K.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,K.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Name`}),`: `,c.agentType]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Location`}),`:`,` `,hn({source:o.location,agentType:c.agentType})]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Tools`}),`: `,f(c.tools)]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Model`}),`: `,pe(c.model)]}),p,(0,K.jsx)(w,{marginTop:1,children:(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]})}),(0,K.jsx)(w,{marginLeft:2,marginTop:1,children:(0,K.jsx)(T,{children:d})}),(0,K.jsx)(w,{marginTop:1,children:(0,K.jsxs)(T,{children:[(0,K.jsx)(T,{bold:!0,children:`System prompt`}),`:`]})}),(0,K.jsx)(w,{marginLeft:2,marginTop:1,children:(0,K.jsx)(T,{children:u})}),l.warnings.length>0&&(0,K.jsxs)(w,{marginTop:1,flexDirection:`column`,children:[(0,K.jsx)(T,{color:`warning`,children:`Warnings:`}),l.warnings.map((e,t)=>(0,K.jsxs)(T,{dimColor:!0,children:[` `,`• `,e]},t))]}),l.errors.length>0&&(0,K.jsxs)(w,{marginTop:1,flexDirection:`column`,children:[(0,K.jsx)(T,{color:`error`,children:`Errors:`}),l.errors.map((e,t)=>(0,K.jsxs)(T,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,K.jsx)(w,{marginTop:1,children:(0,K.jsx)(T,{color:`error`,children:i})}),(0,K.jsx)(w,{marginTop:2,children:(0,K.jsxs)(T,{color:`success`,children:[`Press `,(0,K.jsx)(T,{bold:!0,children:`s`}),` or `,(0,K.jsx)(T,{bold:!0,children:`Enter`}),` to save, `,(0,K.jsx)(T,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var K,lr=e((()=>{k(),b(),Et(),p(),Ft(),ye(),x(),W(),U(),Sn(),sr(),K=A()}));function ur({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=V(),[i,a]=(0,dr.useState)(null),o=tt(),s=(0,dr.useCallback)(async e=>{if(r?.finalAgent)try{await vn(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:Ke(t),allAgents:t}}}),Ye(),e&&await nn(pn({source:r.location,agentType:r.finalAgent.agentType})),Nt(`tengu_agent_created`,{agent_type:r.finalAgent.agentType,generation_method:r.wasGenerated?`generated`:`manual`,source:r.location,tool_count:r.finalAgent.tools?.length??`all`,has_custom_model:!!r.finalAgent.model,has_custom_color:!!r.finalAgent.color,has_memory:!!r.finalAgent.memory,memory_scope:r.finalAgent.memory??`none`,...e?{opened_in_editor:!0}:{}}),n(e?`Created agent: ${rt.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${rt.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,fr.jsx)(cr,{tools:e,existingAgents:t,onSave:(0,dr.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,dr.useCallback)(()=>s(!0),[s]),error:i})}var dr,fr,pr=e((()=>{it(),dr=t(O(),1),Mt(),h(),He(),tn(),W(),Sn(),lr(),fr=A()}));function mr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V(),[i,a]=(0,hr.useState)(r.whenToUse||``),[o,s]=(0,hr.useState)(i.length),[c,l]=(0,hr.useState)(null);return D(`confirm:no`,t,{context:`Settings`}),D(`chat:externalEditor`,(0,hr.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,q.jsx)(H,{subtitle:`Description (tell Work Mate when to use this agent)`,footerText:(0,q.jsxs)(E,{children:[(0,q.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,q.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,q.jsx)(S,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,q.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,q.jsxs)(w,{flexDirection:`column`,children:[(0,q.jsx)(T,{children:`When should Work Mate use this agent?`}),(0,q.jsx)(w,{marginTop:1,children:(0,q.jsx)(Gt,{value:i,onChange:a,onSubmit:t=>{let r=t.trim();if(!r){l(`Description is required`);return}l(null),n({whenToUse:r}),e()},placeholder:`e.g., use this agent after you're done writing code...`,columns:80,cursorOffset:o,onChangeCursorOffset:s,focus:!0,showCursor:!0})}),c&&(0,q.jsx)(w,{marginTop:1,children:(0,q.jsx)(T,{color:`error`,children:c})})]})})}var hr,q,gr=e((()=>{hr=t(O(),1),k(),b(),tn(),x(),Wt(),W(),U(),q=A()}));async function _r(e,t,n,r){let i=We({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 ne(),o=Be([i],a),s=Tt()?vr+yr:vr,c=await ue({messages:Ae(o),systemPrompt:Ee([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>It(),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=dt(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=dt(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return Nt(`tengu_agent_definition_generated`,{agent_identifier:u.identifier}),{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var vr,yr,br=e((()=>{ae(),xe(),Lt(),yt(),je(),Ce(),Et(),Mt(),mt(),Ge(),vr=`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 ${St} 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 ${St} 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
|
-
`,yr=`
|
|
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 xr(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=V(),[i,a]=(0,J.useState)(r.generationPrompt||``),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(i.length),f=rn(),p=(0,J.useRef)(null);D(`confirm:no`,(0,J.useCallback)(()=>{p.current&&(p.current.abort(),p.current=null,s(!1),l(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),D(`chat:externalEditor`,(0,J.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),d(e.content.length))},[i]),{context:`Chat`,isActive:!o}),D(`confirm:no`,(0,J.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),l(null),t()},[e,t]),{context:`Settings`,isActive:!o});let m=async()=>{let t=i.trim();if(!t){l(`Please describe what the agent should do`);return}l(null),s(!0),e({generationPrompt:t,isGenerating:!0});let r=Xe();p.current=r;try{let i=await _r(t,f,[],r.signal);e({agentType:i.identifier,whenToUse:i.whenToUse,systemPrompt:i.systemPrompt,generatedAgent:i,isGenerating:!1,wasGenerated:!0}),n(6)}catch(t){t instanceof pt||t instanceof Error&&!t.message.includes(`No assistant message found`)&&l(t.message||`Failed to generate agent`),e({isGenerating:!1})}finally{s(!1),p.current=null}},h=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,Y.jsx)(H,{subtitle:h,footerText:(0,Y.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,Y.jsxs)(w,{flexDirection:`row`,alignItems:`center`,children:[(0,Y.jsx)(Zt,{}),(0,Y.jsx)(T,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,Y.jsx)(H,{subtitle:h,footerText:(0,Y.jsxs)(E,{children:[(0,Y.jsx)(S,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,Y.jsx)(S,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Y.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsxs)(w,{flexDirection:`column`,children:[c&&(0,Y.jsx)(w,{marginBottom:1,children:(0,Y.jsx)(T,{color:`error`,children:c})}),(0,Y.jsx)(Gt,{value:i,onChange:a,onSubmit:m,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:u,onChangeCursorOffset:d,focus:!0,showCursor:!0})]})})}var J,Y,Sr=e((()=>{ct(),J=t(O(),1),an(),k(),b(),Ve(),tn(),x(),Xt(),Wt(),W(),U(),br(),Y=A()}));function Cr(){let{goNext:e,updateWizardData:t,cancel:n}=V();return(0,X.jsx)(H,{subtitle:`Choose location`,footerText:(0,X.jsxs)(E,{children:[(0,X.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,X.jsx)(w,{children:(0,X.jsx)(Yt,{options:[{label:`Project (.workmate/agents/)`,value:`projectSettings`},{label:`Personal (~/.workmate/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var X,wr=e((()=>{k(),x(),Jt(),W(),U(),X=A()}));function Tr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();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,Er.jsx)(H,{subtitle:`Configure agent memory`,footerText:(0,Er.jsxs)(E,{children:[(0,Er.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Er.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,Er.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Er.jsx)(w,{children:(0,Er.jsx)(Yt,{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:Tt()&&i&&a?()=>`${r.systemPrompt}\n\n${g(a,i)}`:()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Er,Dr=e((()=>{k(),b(),Et(),p(),x(),Jt(),W(),U(),Er=A()}));function Or(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=V();return(0,kr.jsx)(H,{subtitle:`Creation method`,footerText:(0,kr.jsxs)(E,{children:[(0,kr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,kr.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,kr.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,kr.jsx)(w,{children:(0,kr.jsx)(Yt,{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 kr,Ar=e((()=>{k(),x(),Jt(),W(),U(),kr=A()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();return(0,Mr.jsx)(H,{subtitle:`Select model`,footerText:(0,Mr.jsxs)(E,{children:[(0,Mr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Mr.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,Mr.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Mr.jsx)(kn,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Mr,Nr=e((()=>{x(),k(),W(),U(),Mn(),Mr=A()}));function Pr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V(),[i,a]=(0,Fr.useState)(r.systemPrompt||``),[o,s]=(0,Fr.useState)(i.length),[c,l]=(0,Fr.useState)(null);return D(`confirm:no`,t,{context:`Settings`}),D(`chat:externalEditor`,(0,Fr.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(H,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(E,{children:[(0,Z.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(S,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(w,{flexDirection:`column`,children:[(0,Z.jsx)(T,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(T,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(w,{marginTop:1,children:(0,Z.jsx)(Gt,{value:i,onChange:a,onSubmit:()=>{let t=i.trim();if(!t){l(`System prompt is required`);return}l(null),n({systemPrompt:t}),e()},placeholder:`You are a helpful code reviewer who...`,columns:80,cursorOffset:o,onChangeCursorOffset:s,focus:!0,showCursor:!0})}),c&&(0,Z.jsx)(w,{marginTop:1,children:(0,Z.jsx)(T,{color:`error`,children:c})})]})})}var Fr,Z,Ir=e((()=>{Fr=t(O(),1),k(),b(),tn(),x(),Wt(),W(),U(),Z=A()}));function Lr({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=V(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Rr.jsx)(H,{subtitle:`Select tools`,footerText:(0,Rr.jsxs)(E,{children:[(0,Rr.jsx)(C,{shortcut:`Enter`,action:`toggle selection`}),(0,Rr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Rr.jsx)(S,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Rr.jsx)(Fn,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Rr,zr=e((()=>{k(),x(),W(),U(),In(),Rr=A()}));function Br(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=V(),[a,o]=(0,Vr.useState)(i.agentType||``),[s,c]=(0,Vr.useState)(null),[l,u]=(0,Vr.useState)(a.length);return D(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(H,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(E,{children:[(0,Q.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(S,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(w,{flexDirection:`column`,children:[(0,Q.jsx)(T,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(w,{marginTop:1,children:(0,Q.jsx)(Gt,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=ar(n);if(i){c(i);return}c(null),r({agentType:n}),t()},placeholder:`e.g., test-runner, tech-lead, etc`,columns:60,cursorOffset:l,onChangeCursorOffset:u,focus:!0,showCursor:!0})}),s&&(0,Q.jsx)(w,{marginTop:1,children:(0,Q.jsx)(T,{color:`error`,children:s})})]})})}var Vr,Q,Hr=e((()=>{Vr=t(O(),1),k(),b(),x(),Wt(),W(),U(),sr(),Q=A()}));function Ur({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Wr.jsx)(qn,{steps:[Cr,Or,xr,()=>(0,Wr.jsx)(Br,{existingAgents:t}),Pr,mr,()=>(0,Wr.jsx)(Lr,{tools:e}),jr,rr,...Tt()?[Tr]:[],()=>(0,Wr.jsx)(ur,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Wr,Gr=e((()=>{Et(),W(),ir(),pr(),gr(),Sr(),wr(),Dr(),Ar(),Nr(),Ir(),zr(),Hr(),Wr=A()}));function Kr({tools:e,onExit:t}){let[n,r]=(0,qr.useState)({mode:`list-agents`,source:`all`}),i=te(e=>e.agentDefinitions),a=te(e=>e.mcp.tools),o=te(e=>e.toolPermissionContext),s=tt(),{allAgents:c,activeAgents:l}=i,[u,d]=(0,qr.useState)([]),f=Qt(e,a,o);Kt();let p=(0,qr.useMemo)(()=>({"built-in":c.filter(e=>e.source===`built-in`),userSettings:c.filter(e=>e.source===`userSettings`),projectSettings:c.filter(e=>e.source===`projectSettings`),policySettings:c.filter(e=>e.source===`policySettings`),localSettings:c.filter(e=>e.source===`localSettings`),flagSettings:c.filter(e=>e.source===`flagSettings`),plugin:c.filter(e=>e.source===`plugin`),all:c}),[c]),m=(0,qr.useCallback)(e=>{d(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),h=(0,qr.useCallback)(async e=>{try{await bn(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:Ke(n)}}}),d(t=>[...t,`Deleted agent: ${rt.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Ot(ft(e))}},[s]);switch(n.mode){case`list-agents`:{let e=Vt(n.source===`all`?[...p[`built-in`],...p.userSettings,...p.projectSettings,...p.localSettings,...p.policySettings,...p.flagSettings,...p.plugin]:p[n.source],l);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Wn,{source:n.source,agents:e,onBack:()=>{t((u.length>0?`Agent changes:\n${u.join(`
|
|
101
|
-
`)}`:void 0)??`Agents dialog dismissed`,{display:u.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:u}),(0,$.jsx)(Vn,{})]})}case`create-agent`:return(0,$.jsx)(Ur,{tools:f,existingAgents:l,onComplete:m,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=c.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)(at,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(w,{flexDirection:`column`,children:[(0,$.jsx)(Yt,{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)}),u.length>0&&(0,$.jsx)(w,{marginTop:1,children:(0,$.jsx)(T,{dimColor:!0,children:u[u.length-1]})})]})}),(0,$.jsx)(Vn,{})]})}case`view-agent`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(at,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(Cn,{agent:e,tools:f,allAgents:c,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(Vn,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(at,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(T,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(T,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(w,{marginTop:1,children:(0,$.jsxs)(T,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(w,{marginTop:1,children:(0,$.jsx)(Yt,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?h(n.agent):`previousMode`in n&&r(n.previousMode)},onCancel:()=>{`previousMode`in n&&r(n.previousMode)}})})]}),(0,$.jsx)(Vn,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(at,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(zn,{agent:e,tools:f,onSaved:e=>{m(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Vn,{})]})}default:return null}}var qr,$,Jr=e((()=>{it(),qr=t(O(),1),qt(),$t(),k(),h(),zt(),He(),lt(),Dt(),Jt(),wn(),Bn(),Un(),Kn(),Sn(),Gr(),$=A()}));async function Yr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Xr.jsx)(Kr,{tools:ge(n),onExit:e})}var Xr;e((()=>{Jr(),d(),Xr=A()}))();export{Yr as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dv as t,Tv as n}from"./loadAgentsDir-B0Anodo0.js";import{h as r,l as i}from"./settings-B2jvL8Dp.js";function a(){let e=i(),t=[`user`,`project`,`local`].flatMap(e=>n(e).errors);return{settings:e.settings,errors:[...e.errors,...t]}}var o=e((()=>{t(),r()}));export{o as n,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(e){let t;for(let n in e)n.startsWith(`_PROTO_`)&&(t===void 0&&(t={...e}),delete t[n]);return t??e}function n(e){if(a===null&&(a=e,i.length>0)){let e=[...i];i.length=0,queueMicrotask(()=>{for(let t of e)t.async?a.logEventAsync(t.eventName,t.metadata):a.logEvent(t.eventName,t.metadata)})}}function r(e,t){if(a===null){i.push({eventName:e,metadata:t,async:!1});return}a.logEvent(e,t)}var i,a,o=e((()=>{i=[],a=null}));export{t as i,o as n,r,n as t};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{i as e,o as t}from"./envUtils-DfkgIdYf.js";import{Eb as n,Jd as r,Jx as i,Lu as a,Pu as o,Q as s,X as c,Yi as l,Yx as ee,_r as u,aC as te,nc as d,ny as ne,pS as re,qg as f,rc as p,sr as m,ty as h,ut as g,wb as ie,xt as ae}from"./loadAgentsDir-B0Anodo0.js";import{B as _,F as v,It as y}from"./state-B4jiUise.js";import{n as oe,t as se}from"./cwd-Pa83R95t.js";import{I as b,V as x,c as S,f as C,i as w,u as T,x as E}from"./debug-Bglx1aTu.js";import{d as D,h as O,v as k}from"./settings-B2jvL8Dp.js";import{b as A}from"./config-C-Y2qtB2.js";import{_ as j,o as M,s as N,v as P}from"./log-D2TIwHBV.js";import{n as F,r as I}from"./analytics-DJobLaWP.js";import{d as L,l as R}from"./model-BvQFFOf8.js";import{_n as z,vn as B}from"./prompt-CJ1l3XXk.js";import{r as V,t as H}from"./pasteStore-P0zP-ch0.js";import{r as U}from"./magicDocs-Bkz7ZcmL.js";import{i as W,t as G}from"./nativeInstaller-CdjmE9Zy.js";import{n as K,t as ce}from"./allErrors-BF73lon8.js";import{n as le,t as ue}from"./pluginAutoupdate-ennb9k8_.js";import{n as de}from"./registerProtocol-CAsDme_E.js";import"os";import{join as q}from"path";import"crypto";t(),y(),oe(),E(),C(),w(),P(),O(),B(),L(),p(),u(),U(),c(),M(),b(),l(),f(),c(),ne(),b(),M(),l(),f(),r();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),a=n(se(),`.workmate`,`skills`,e,`SKILL.md`),o;try{o=await r.readFile(a,`utf-8`)}catch{N(Error(`Failed to read skill file for improvement: ${a}`));return}let c=t.map(e=>`- ${e.section}: ${e.change}`).join(`
|
|
2
|
-
`),l=R(),u=await s({messages:[re({content:`You are editing a skill definition file. Apply the following improvements to the skill.
|
|
3
|
-
|
|
4
|
-
<current_skill_file>
|
|
5
|
-
${o}
|
|
6
|
-
</current_skill_file>
|
|
7
|
-
|
|
8
|
-
<improvements>
|
|
9
|
-
${c}
|
|
10
|
-
</improvements>
|
|
11
|
-
|
|
12
|
-
Rules:
|
|
13
|
-
- Integrate the improvements naturally into the existing structure
|
|
14
|
-
- Preserve frontmatter (--- block) exactly as-is
|
|
15
|
-
- Preserve the overall format and style
|
|
16
|
-
- Do not remove existing content unless an improvement explicitly replaces it
|
|
17
|
-
- Output the complete updated file inside <updated_file> tags`})],systemPrompt:te([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:h().signal,options:{getToolPermissionContext:async()=>z(),model:l,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),d=i(ee(Array.isArray(u.message.content)?u.message.content:[]).trim(),`updated_file`);if(!d){N(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(a,d,`utf-8`)}catch(e){N(x(e))}}F(),a(),A(),M(),G(),V(),K(),n(),ae();var pe=30;function J(){let e=((D()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(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 Y(e,t,n){let r={messages:0,errors:0};try{let i=await T().readdir(e);for(let a of i)try{he(a.name)<t&&(await T().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){N(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&N(e)}return r}async function ge(){let e=T(),t=J(),n=j.errors(),r=j.baseLogs(),i=await Y(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=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&N(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=m(),r=T(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(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 X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,ie),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=T(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=T();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(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 Z(i,r)}catch(e){N(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=T();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(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 Z(i,r)}catch(e){N(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=T(),i=q(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 X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=ce();if(e.length>0&&k(`cleanupPeriodDays`)){S(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await o(),await H(J());let t=await g(J());t>0&&I(`tengu_worktree_cleanup`,{removed:t})}y(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-D4Dl1itt.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),d(),ue(),v()&&de();let e=!0;async function t(){if(v()&&_()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),v()&&_()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./backgroundHousekeeping-Bq3LMsVR.js";export{e as startBackgroundHousekeeping};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{It as e,J as t}from"./state-B4jiUise.js";import{c as n,i as r}from"./debug-Bglx1aTu.js";import{Br as i,Lr as a,Or as o,Ur as s,jr as c,kn as l,wn as u}from"./settings-B2jvL8Dp.js";import{_ as d,p as f,s as p}from"./config-C-Y2qtB2.js";import{_ as m,f as h,p as g}from"./startupProfiler-CJdr3SxP.js";import{n as _,r as v}from"./detectRepository-CfX8Lc0A.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";e(),f(),r(),v(),u(),s(),a();async function w(){try{let e=await _();if(!e){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=t(),i=o(r)??r,a;try{a=(await S(i)).normalize(`NFC`)}catch{a=i}let s=e.toLowerCase(),c=p().githubRepoPaths?.[s]??[];if(c[0]===a){n(`Path ${a} already tracked for repo ${s}`);return}let l=c.filter(e=>e!==a),u=[a,...l];d(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:u}})),n(`Added ${a} to tracked paths for repo ${s}`)}catch(e){n(`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(l));return e.filter((e,n)=>t[n])}m(),s(),a();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(e){let t=await c(e);if(!t)return;let n=await i(t),[r,a]=await Promise.all([j(b(t,`FETCH_HEAD`)),n?j(b(n,`FETCH_HEAD`)):Promise.resolve(void 0)]);return r&&a?r>a?r:a:r??a}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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Cr as t,_r as n,mr as r,or as i,pr as a,si as o,ti as s}from"./loadAgentsDir-B0Anodo0.js";import{l as c,u as l}from"./types-Dx7P7JLQ.js";import{It as u,J as d,st as f}from"./state-B4jiUise.js";import{C as p,x as m}from"./debug-Bglx1aTu.js";import{i as h,o as g}from"./stringUtils-C718f5ey.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(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 w(e){let n=y(),o=f(),s=i(d()),c=r(n),u=a();await b(s,{recursive:!0,mode:448});let m;try{m=await x(u)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=l(m),g=h.filter(e=>t(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===o).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let t={...e,sessionId:n,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:o,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(p(t)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:n,replacements:_};C.push(p(e))}return await S(c,`${C.join(`
|
|
2
|
-
`)}\n`,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:c,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let t=`${e} (Branch)`;if((await o(t,{exact:!0})).length===0)return t;let n=await o(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${h(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 E(e,t,n){let r=n?.trim()||void 0,i=f();try{let{sessionId:n,title:a,forkPath:o,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(a??d);await s(n,f,o),v(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!a});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=a?` "${a}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${i}`}`;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((()=>{u(),_(),c(),n(),m(),g()}))();export{E as call,C as deriveFirstPrompt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Hs as n,Mh as r,Nh as i,Qx as a,Us as o,Yi as s,aC as c,at as l,bb as u,cd as d,it as f,jh as p,ny as m,qg as h,ty as g,ud as _}from"./loadAgentsDir-B0Anodo0.js";import{I as v,P as y,ai as b,bn as x,ot as S,t as C,vn as w,xt as T}from"./src-DL3w8VPk.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{I as D,M as O}from"./debug-Bglx1aTu.js";import{Ht as k}from"./settings-B2jvL8Dp.js";import{_ as A,p as j}from"./config-C-Y2qtB2.js";import{n as M,t as N}from"./SpinnerGlyph-CmkRUvHe.js";import{n as P,r as F}from"./sideQuestion-D49GsfH7.js";import{i as I,n as L}from"./modalContext-DDZdU1J8.js";function R({question:e,context:t,onDone:n}){let[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(0),l=(0,H.useRef)(null),{rows:u}=I(S());x(()=>c(e=>e+1),r||a?null:80);function f(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),l.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),l.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=g();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?i(r.response):o(`No response received`))}catch(e){n.signal.aborted||o(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let p=Math.max(5,u-W-G);return(0,U.jsxs)(v,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,U.jsxs)(v,{children:[(0,U.jsxs)(y,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(y,{dimColor:!0,children:e})]}),(0,U.jsx)(v,{marginTop:1,marginLeft:2,maxHeight:p,children:(0,U.jsx)(T,{ref:l,flexDirection:`column`,flexGrow:1,children:a?(0,U.jsx)(y,{color:`error`,children:a}):r?(0,U.jsx)(d,{children:r}):(0,U.jsxs)(v,{children:[(0,U.jsx)(N,{frame:s,messageColor:`warning`}),(0,U.jsx)(y,{color:`warning`,children:`Answering...`})]})})}),(r||a)&&(0,U.jsx)(v,{marginTop:1,children:(0,U.jsxs)(y,{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=a(z(e.messages)),i=n();if(i)return{systemPrompt:i.systemPrompt,userContext:i.userContext,systemContext:i.systemContext,toolUseContext:e,forkContextMessages:t};let[o,s,l]=await Promise.all([f(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),r(),p()]);return{systemPrompt:c(o),userContext:s,systemContext:l,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(A(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(b(),1),w(),_(),M(),k(),l(),L(),i(),u(),C(),m(),j(),D(),o(),s(),P(),h(),U=E(),W=5,G=6,K=3}))();export{V as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./caches-DLJ6urv-.js";e();export{t as clearSessionCaches};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ah as t,Fb as n,Fh as r,Fu as i,G as a,Gi as o,Ib as s,Ih as c,Lu as l,Mh as u,Nh as d,Ni as f,Ph as p,Ud as m,Vi as h,b_ as g,es as _,ig as v,jh as y,og as b,op as x,q as S,sp as C,ts as w,wi as T,xf as E,y_ as D,yf as O}from"./loadAgentsDir-B0Anodo0.js";import{It as k,gn as A,l as j}from"./state-B4jiUise.js";import{Ur as M,zr as N}from"./settings-B2jvL8Dp.js";import{a as P,n as F}from"./fileSuggestions-C-9unnoJ.js";import{r as I,t as L}from"./magicDocs-Bkz7ZcmL.js";import{r as R,t as z}from"./detectRepository-CfX8Lc0A.js";function B(e=new Set){let o=e.size>0;u.cache.clear?.(),y.cache.clear?.(),t.cache.clear?.(),r.cache.clear?.(),F(),T(),o||b(),p(null),A(null),E(),w(),g(`session_start`),i(),z(),a(),j(e),N(),h(),C(),L(),n(),import(`./SearchExtraToolsTool-BsSoILFj.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-BbUR6pqH.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-CgOklk7z.js`).then(({clearPromptCache:e})=>e())}var V=e((()=>{k(),f(),c(),d(),P(),m(),v(),O(),x(),I(),o(),_(),S(),D(),R(),M(),l(),s()}));export{V as n,B as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./client-CpTCeWba.js";e();export{t as getGrokClient};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./client-4iqhC8xq.js";e();export{t as clearOpenAIClientCache};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ni as e,Oi as t,wi as n}from"./loadAgentsDir-B0Anodo0.js";e();export{n as clearCommandsCache,t as getCommands};
|