@readmagic/workmate 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-mS8iUoWY.js → AddWorkspaceDirectory-DqlPtsVK.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-BHBkysy0.js → AgentsMdExternalIncludesDialog-rJS5l6yk.js} +1 -1
- package/dist/chunks/{App-D--vtCyq.js → App-DzRQpRKr.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-CBhSmdz_.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-DyqI98d2.js → BypassPermissionsModeDialog-zz-lnmJt.js} +1 -1
- package/dist/chunks/CustomSelect-CYmc4vRh.js +1 -0
- package/dist/chunks/{DiffDialog-BQAU2pJx.js → DiffDialog-CTUIAcEE.js} +6 -6
- package/dist/chunks/{Doctor-DJOMbSDE.js → Doctor-CLOYkPRR.js} +2 -2
- package/dist/chunks/Doctor-CiZNe_qx.js +1 -0
- package/dist/chunks/{ExitFlow-xBOnvhiW.js → ExitFlow-CATwJC4c.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-NiuhcaG5.js → InvalidConfigDialog-B-9Z58oD.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-DrromC1I.js → InvalidSettingsDialog-B4EWjbp7.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-Dzg77_Xn.js +1 -0
- package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +1 -0
- package/dist/chunks/MCPToolListView-C7HT6rrl.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BYG2yqjO.js → McpParsingWarnings-Dj_Fu5o-.js} +1 -1
- package/dist/chunks/MessageSelector-Dw_ERK_Z.js +3 -0
- package/dist/chunks/Messages-RBfRELKn.js +10 -0
- package/dist/chunks/Onboarding-BRSXxc2E.js +1 -0
- package/dist/chunks/{PermissionDialog-tEMMa5-a.js → PermissionDialog-DjCRuzSm.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-CPOaYnym.js → PressEnterToContinue-DE1RxMX_.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-CwqAsTI2.js → PromptInputFooterSuggestions-ChpyD9B7.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-CrTT8MKE.js +1 -0
- package/dist/chunks/{ProviderSetup-J6Ty-Wj8.js → ProviderSetup-BEV95bnz.js} +1 -1
- package/dist/chunks/QueryEngine-BBBkZWu2.js +1 -0
- package/dist/chunks/REPL-BDnZnm__.js +124 -0
- package/dist/chunks/REPL-BHk0vZDf.js +1 -0
- package/dist/chunks/{ResumeConversation-Cmsbo5m7.js → ResumeConversation-BuSqBrm1.js} +1 -1
- package/dist/chunks/{SearchBox-DQBLKyzJ.js → SearchBox-zA5QwIpO.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +1 -0
- package/dist/chunks/Settings-DYKmPdbd.js +2 -0
- package/dist/chunks/Spinner-DOI8qqZi.js +1 -0
- package/dist/chunks/SpinnerGlyph-BR_SiV9L.js +1 -0
- package/dist/chunks/{TextInput-BboKIug2.js → TextInput-ZKU-x_FD.js} +7 -7
- package/dist/chunks/{ThemePicker-DTpXbEY0.js → ThemePicker-B69oDgXN.js} +1 -1
- package/dist/chunks/TrustDialog-BSG8Ibh8.js +1 -0
- package/dist/chunks/{ValidationErrorsList-C_gDQfm1.js → ValidationErrorsList-BUYHEft4.js} +1 -1
- package/dist/chunks/{_baseEach-DGbaIpJA.js → _baseEach-P0u1zIx6.js} +1 -1
- package/dist/chunks/{add-dir-B576wzi9.js → add-dir-C8RmmyQK.js} +1 -1
- package/dist/chunks/{agentDisplay-ZuFoBZYu.js → agentDisplay-np7CH47m.js} +1 -1
- package/dist/chunks/{agents-Dy4_hDic.js → agents-DRQlR5M1.js} +1 -1
- package/dist/chunks/agents-DedoH0Q4.js +101 -0
- package/dist/chunks/allErrors-DvcU0w0F.js +1 -0
- package/dist/chunks/{appleTerminalBackup-C9kjzdM9.js → appleTerminalBackup-Bemd4RXh.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-PyLNnGdw.js → backgroundHousekeeping-BtEJ6TeC.js} +1 -1
- package/dist/chunks/banner-CuoceXzz.js +2 -0
- package/dist/chunks/branch-ClhlS7f8.js +2 -0
- package/dist/chunks/{break-cache-DL95nKZl.js → break-cache-B1nuWtD_.js} +2 -2
- package/dist/chunks/{btw-Y44ctueB.js → btw-B-FLxlx-.js} +1 -1
- package/dist/chunks/bundledMode-D9omqD3L.js +2 -0
- package/dist/chunks/caches-D7arwhaa.js +1 -0
- package/dist/chunks/caches-Dn8yrJmL.js +1 -0
- package/dist/chunks/{clear-DtTkA707.js → clear-BnWv0i65.js} +1 -1
- package/dist/chunks/{client-aJ2Nr_sh.js → client-2w-g5kMx.js} +1 -1
- package/dist/chunks/client-B0ngS4Uu.js +1 -0
- package/dist/chunks/client-BP4DOH3K.js +1 -0
- package/dist/chunks/{client-Bw_L3lSc.js → client-pA7fKk0-.js} +1 -1
- package/dist/chunks/commands-AcfFLgl5.js +1 -0
- package/dist/chunks/{compact-CvNOtu7J.js → compact-Banc-SNk.js} +1 -1
- package/dist/chunks/config-BDn2YIjC.js +3 -0
- package/dist/chunks/config-BhBcadjZ.js +1 -0
- package/dist/chunks/config-Bm5pVdCq.js +1 -0
- package/dist/chunks/{context-Opu4E8dL.js → context-BvDBAyJ9.js} +1 -1
- package/dist/chunks/context-noninteractive-BK2IDLSS.js +1 -0
- package/dist/chunks/{context-noninteractive-B1V2Mp26.js → context-noninteractive-CuHHniJn.js} +9 -9
- package/dist/chunks/conversation-B2dX3X4Z.js +1 -0
- package/dist/chunks/{conversation-CG_z7TLE.js → conversation-Cjaftrrw.js} +1 -1
- package/dist/chunks/conversationRecovery-NL05oJb1.js +1 -0
- package/dist/chunks/crossProjectResume-BzltC4NJ.js +40 -0
- package/dist/chunks/{debug-kBjDaVkQ.js → debug-2pVES-2G.js} +1 -1
- package/dist/chunks/detectRepository--luIRv5H.js +1 -0
- package/dist/chunks/{diff-Cv7tX2-P.js → diff--6gQCx_x.js} +1 -1
- package/dist/chunks/directoryCompletion-BC0qRmrz.js +1 -0
- package/dist/chunks/doctor-CQf8xPZH.js +1 -0
- package/dist/chunks/entry-DWYOrkFS.js +13 -0
- package/dist/chunks/{envUtils-DZ_SvEVz.js → envUtils-QyzA_cFM.js} +1 -1
- package/dist/chunks/{execFileNoThrow-BfZFnCGa.js → execFileNoThrow-DXSEj8ZO.js} +1 -1
- package/dist/chunks/{exit-OKEV_ddw.js → exit-uKtXb5U3.js} +1 -1
- package/dist/chunks/{extraUsage-BlRL3yeb.js → extraUsage-Dr0YXm1w.js} +1 -1
- package/dist/chunks/extractMemories-8yvMGZ1J.js +1 -0
- package/dist/chunks/fast-C5-lNCQi.js +1 -0
- package/dist/chunks/fast-aNkj6WvB.js +1 -0
- package/dist/chunks/fetchModelList-9w1E4Ue8.js +1 -0
- package/dist/chunks/fetchModelList-D2quBF6M.js +1 -0
- package/dist/chunks/fileSuggestions-BYD78vcF.js +3 -0
- package/dist/chunks/{fpsMetrics-Ixd0J4CH.js → fpsMetrics-DIpm2-xw.js} +1 -1
- package/dist/chunks/{gemini-BfVyavwQ.js → gemini-BNBptTET.js} +1 -1
- package/dist/chunks/generateSessionName-CO2484aJ.js +1 -0
- package/dist/chunks/{genericProcessUtils-CVtQOTO2.js → genericProcessUtils-GqURdVAv.js} +1 -1
- package/dist/chunks/{goal-BidR-GFa.js → goal-j0wdadwM.js} +1 -1
- package/dist/chunks/{grok-DLcuI-U7.js → grok-BpO1ZwK_.js} +1 -1
- package/dist/chunks/{help-CZuvYhXj.js → help-DwhA0qQ6.js} +1 -1
- package/dist/chunks/{history-BxPGftQw.js → history-CUrqO9rV.js} +1 -1
- package/dist/chunks/hooks-B5Wq-KxE.js +1 -0
- package/dist/chunks/{hooks-ehqfAM5F.js → hooks-DG4_WdZ2.js} +2 -2
- package/dist/chunks/install-BbmCNCuM.js +1 -0
- package/dist/chunks/{instrumentation-B9bfF2mA.js → instrumentation-DpPmDyNF.js} +4 -4
- package/dist/chunks/{job-Coztdn6A.js → job-GcmX1ALd.js} +1 -1
- package/dist/chunks/{keybindings-DwSdLpaE.js → keybindings-CxgQqQJe.js} +1 -1
- package/dist/chunks/{launchLocalMemory-DRzfpIOB.js → launchLocalMemory-CDgT5lst.js} +1 -1
- package/dist/chunks/{launchOnboarding-D2zFCJf-.js → launchOnboarding-uQ_ux9sS.js} +1 -1
- package/dist/chunks/loadAgentsDir-BBbIAiay.js +1 -0
- package/dist/chunks/{loadAgentsDir-DR5PVAc3.js → loadAgentsDir-uuZYOgKn.js} +392 -392
- package/dist/chunks/{loadPluginHooks-BiQgGfUJ.js → loadPluginHooks-QoVXsBjy.js} +1 -1
- package/dist/chunks/loader-BMAtuwRa.js +1 -0
- package/dist/chunks/localSearch-D6MhwvnR.js +1 -0
- package/dist/chunks/{localSearch-CzkxDuOR.js → localSearch-yVCDrVrf.js} +1 -1
- package/dist/chunks/{log-DWZny1vM.js → log-L1kqxa_P.js} +1 -1
- package/dist/chunks/{logoUtils-DR5T0pr3.js → logoUtils-B4wCDKs9.js} +1 -1
- package/dist/chunks/{magicDocs-BwBxjfLo.js → magicDocs-D53lV8b5.js} +2 -2
- package/dist/chunks/{main-Ryi27wYq.js → main-fy_XSXGj.js} +34 -34
- package/dist/chunks/{managedEnv-Do9fgLpk.js → managedEnv-B8YWmM4A.js} +1 -1
- package/dist/chunks/managedEnv-ulQBH73B.js +1 -0
- package/dist/chunks/{managedEnvConstants-CWcT7nYr.js → managedEnvConstants-BPY8yF1A.js} +1 -1
- package/dist/chunks/{mcp-BCpnF6wD.js → mcp--LmEVBRg.js} +1 -1
- package/dist/chunks/mcp-CZUVaPb3.js +5 -0
- package/dist/chunks/{mcp-CZBTxbhu.js → mcp-DCl-Tz-C.js} +1 -1
- package/dist/chunks/memory-Bu5ku7y9.js +1 -0
- package/dist/chunks/{modalContext-CBE8xuck.js → modalContext-sU2lfR08.js} +1 -1
- package/dist/chunks/{mode-wq70cR44.js → mode-Bteqe2QG.js} +1 -1
- package/dist/chunks/{model-DVk9-2dk.js → model-CHDU5yqH.js} +1 -1
- package/dist/chunks/model-CcHyMyBv.js +1 -0
- package/dist/chunks/modelOptions-CJV1R3Jt.js +1 -0
- package/dist/chunks/nativeInstaller-CIUYh1aD.js +1 -0
- package/dist/chunks/{notifications-dGBuNvFj.js → notifications-GLnjirCl.js} +1 -1
- package/dist/chunks/{observationStore-D0rm3GhP.js → observationStore-pnSSxec_.js} +1 -1
- package/dist/chunks/{onChangeAppState-B4K-rSaF.js → onChangeAppState-CxGW2d-l.js} +1 -1
- package/dist/chunks/{openai-DAwnAV9K.js → openai-BpGQT2Iv.js} +1 -1
- package/dist/chunks/{overlayContext-B6i_6y_0.js → overlayContext-7wgLio1O.js} +1 -1
- package/dist/chunks/{panel-C0CF3noE.js → panel-DNiXDhBX.js} +1 -1
- package/dist/chunks/{parser-DThLwgdM.js → parser-CTnaXFVJ.js} +1 -1
- package/dist/chunks/parser-Diihup2V.js +1 -0
- package/dist/chunks/{partition-BRQHofxD.js → partition-djFY9gGI.js} +1 -1
- package/dist/chunks/{pasteStore-BmehVo5j.js → pasteStore-njJCBMKr.js} +1 -1
- package/dist/chunks/permissions-DNedQyLg.js +3 -0
- package/dist/chunks/pidLock-CFUBtZck.js +3 -0
- package/dist/chunks/{plan-B6U3ioer.js → plan-DI0n7LIV.js} +1 -1
- package/dist/chunks/plugin-BQ8gRVYF.js +17 -0
- package/dist/chunks/pluginAutoupdate-CNrHb4RJ.js +1 -0
- package/dist/chunks/{pluginBlocklist-DAoUENwc.js → pluginBlocklist-CKCsgWdY.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CaHnj0C_.js → pluginCliCommands-CACeyIwz.js} +1 -1
- package/dist/chunks/{pluginFlagging-BCj9LJP3.js → pluginFlagging-CUvkKGOB.js} +1 -1
- package/dist/chunks/pluginOperations-Ca_T-HYn.js +2 -0
- package/dist/chunks/pluginStartupCheck-DftTiXct.js +1 -0
- package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +1 -0
- package/dist/chunks/{plugins-D7zyI9c4.js → plugins-Divl-P-X.js} +1 -1
- package/dist/chunks/{poorMode-Ocff_UT1.js → poorMode-CG2JNTD0.js} +1 -1
- package/dist/chunks/poorMode-eMIFCAC_.js +1 -0
- package/dist/chunks/print-DSHypGJa.js +13 -0
- package/dist/chunks/processBashCommand-BLcFmbyG.js +1 -0
- package/dist/chunks/processSlashCommand-Caif46Gi.js +5 -0
- package/dist/chunks/{projectContext-QN5U3Ggr.js → projectContext-BFfHgAMh.js} +1 -1
- package/dist/chunks/{projectContext-COeHKDrk.js → projectContext-DnJHynXv.js} +1 -1
- package/dist/chunks/{projectOnboardingState-KqcpRXls.js → projectOnboardingState-nTCycGCD.js} +1 -1
- package/dist/chunks/prompt-BZmu5CeK.js +1 -0
- package/dist/chunks/{prompt-CTByhpUI.js → prompt-BfXryFt-.js} +8 -8
- package/dist/chunks/prompt-Cogr_WZr.js +1 -0
- package/dist/chunks/promptEditor-14TB3MYt.js +4 -0
- package/dist/chunks/protocolHandler-VigBkAQQ.js +13 -0
- package/dist/chunks/{proxy-BtWuysHM.js → proxy--_NfbJhm.js} +1 -1
- package/dist/chunks/reconciler-B9XFdL4f.js +1 -0
- package/dist/chunks/{refresh-B4pqFp12.js → refresh-CBHbWTGg.js} +1 -1
- package/dist/chunks/reject-CBxnwckZ.js +1 -0
- package/dist/chunks/{reload-plugins-DXQqk7q6.js → reload-plugins-5eFWrQlL.js} +1 -1
- package/dist/chunks/{rename-D4XBmTBI.js → rename-Cw7cMerG.js} +1 -1
- package/dist/chunks/{renderOptions-DkP98P_d.js → renderOptions-B0RFpjRI.js} +1 -1
- package/dist/chunks/{resume-DzIev0JI.js → resume-U2D0ybfU.js} +1 -1
- package/dist/chunks/ripgrep-67m14ImZ.js +5 -0
- package/dist/chunks/ripgrep-DB7KB8RZ.js +1 -0
- package/dist/chunks/{runtimeObserver-BPqlbu0B.js → runtimeObserver-CWaYMJG8.js} +2 -2
- package/dist/chunks/{runtimeObserver-BUHs3qjs.js → runtimeObserver-DOYlxx9H.js} +1 -1
- package/dist/chunks/sandbox-adapter-Df7Wpt77.js +1 -0
- package/dist/chunks/sandbox-toggle-BtiPyjT3.js +1 -0
- package/dist/chunks/searchExtraTools-CbJVb_Zk.js +1 -0
- package/dist/chunks/select-BuTJbu_Q.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +1 -0
- package/dist/chunks/sessionObserver-BZVgzp3W.js +1 -0
- package/dist/chunks/{sessionObserver-B6xzxckA.js → sessionObserver-cfwD8pV8.js} +1 -1
- package/dist/chunks/sessionStorage-SC5RfnUP.js +1 -0
- package/dist/chunks/sessionTracing-DsdcOqvc.js +11 -0
- package/dist/chunks/settings-D4M13toi.js +104 -0
- package/dist/chunks/settings-Dfit5gGT.js +1 -0
- package/dist/chunks/setup-DR-KEmxL.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-D6R2OeoH.js → shadowedRuleDetection-DiZUDzxU.js} +1 -1
- package/dist/chunks/{sideQuestion-5jcbOMsR.js → sideQuestion-CdgUarC2.js} +1 -1
- package/dist/chunks/{sinks-B-kFqjjd.js → sinks-Cy3NqVbk.js} +1 -1
- package/dist/chunks/sinks-D41OiGE4.js +1 -0
- package/dist/chunks/{skillChangeDetector-103-nEle.js → skillChangeDetector-CVFCJcG7.js} +1 -1
- package/dist/chunks/{skillGapStore-DOz1KCqo.js → skillGapStore-BJV8ZIB1.js} +2 -2
- package/dist/chunks/{skillLifecycle-D9NkIwFQ.js → skillLifecycle-iO_3s9Ff.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DFiSZaJ4.js → skillSearchPanel-BL5gXTHU.js} +2 -2
- package/dist/chunks/skills-BEp3_RyT.js +1 -0
- package/dist/chunks/sleep-xKMbXTJe.js +1 -0
- package/dist/chunks/{src-WZ94ZKI3.js → src-BX54x08P.js} +1 -1
- package/dist/chunks/{src-Cy5_qH26.js → src-HB5wLari.js} +1 -1
- package/dist/chunks/{startupProfiler-DIM_Ihyp.js → startupProfiler-B9Qv2QGH.js} +1 -1
- package/dist/chunks/startupProfiler-DWcM4QBl.js +1 -0
- package/dist/chunks/{staticRender-RHUIg5ln.js → staticRender-Bt82RvGc.js} +1 -1
- package/dist/chunks/status-6JMz8jmM.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-DI45AH-c.js → statusNoticeHelpers-BoloSeXY.js} +1 -1
- package/dist/chunks/{stringUtils-D_xPrwGQ.js → stringUtils-Cs6E5f-B.js} +1 -1
- package/dist/chunks/switcher-95d4TrQH.js +1 -0
- package/dist/chunks/{switcher-DhZCaAun.js → switcher-DSt2cVjA.js} +1 -1
- package/dist/chunks/{tasks-6suPhqsK.js → tasks-DyBUXnQb.js} +1 -1
- package/dist/chunks/{templateJobs-BKVEWCsb.js → templateJobs-BBnReWWj.js} +7 -7
- package/dist/chunks/{terminalSetup-7PUR4hfo.js → terminalSetup-CDpFfqqV.js} +1 -1
- package/dist/chunks/{terminalSetup-Cqy5_PhJ.js → terminalSetup-DedaY1P7.js} +4 -4
- package/dist/chunks/{theme-B-HG2PUs.js → theme-BZOy9Iqh.js} +1 -1
- package/dist/chunks/tipRegistry-Cl5sdLRX.js +2 -0
- package/dist/chunks/{toolEventObserver-BY3QVnr6.js → toolEventObserver-ClwWmVbH.js} +1 -1
- package/dist/chunks/{toolPool-BcwIF8Q_.js → toolPool-DSTbgGmX.js} +1 -1
- package/dist/chunks/{udsClient-CCxgLiZy.js → udsClient-CWeoNrm3.js} +1 -1
- package/dist/chunks/{useDoublePress-DQBLKyzJ.js → useDoublePress-zA5QwIpO.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BgJrnuDl.js → useExitOnCtrlCDWithKeybindings-ClN4NJnB.js} +1 -1
- package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +1 -0
- package/dist/chunks/useManagePlugins-CxHz-gUP.js +1 -0
- package/dist/chunks/useMergedTools-BUuWew0-.js +1 -0
- package/dist/chunks/{useSearchInput-BITV_Txn.js → useSearchInput-BIQN_-Hm.js} +1 -1
- package/dist/chunks/{useSettingsErrors-CO0fTNzn.js → useSettingsErrors-BDJCLei_.js} +1 -1
- package/dist/chunks/util-BHr5l6Bx.js +1 -0
- package/dist/chunks/validatePlugin-fx1Y8vam.js +1 -0
- package/dist/chunks/{vim-qgMS88ss.js → vim-CYjMtnwH.js} +1 -1
- package/dist/chunks/worktree-CGu_58ue.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +0 -2
- package/dist/chunks/CustomSelect-CpMbxYbt.js +0 -1
- package/dist/chunks/Doctor-BU69VQzw.js +0 -1
- package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +0 -1
- package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +0 -1
- package/dist/chunks/MCPToolListView-BRxjOaOL.js +0 -1
- package/dist/chunks/MessageSelector-B7xAQqZI.js +0 -3
- package/dist/chunks/Messages-CxMsfjOa.js +0 -10
- package/dist/chunks/Onboarding-CkATe87e.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +0 -1
- package/dist/chunks/QueryEngine-Mdi_kUaL.js +0 -1
- package/dist/chunks/REPL-BgzQtSFF.js +0 -1
- package/dist/chunks/REPL-rirm6s_7.js +0 -124
- package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +0 -1
- package/dist/chunks/SelectMulti-BpAjjhsn.js +0 -1
- package/dist/chunks/Settings-B6DImvca.js +0 -2
- package/dist/chunks/Spinner-DhhSOFcN.js +0 -1
- package/dist/chunks/SpinnerGlyph-CmVXC-_9.js +0 -1
- package/dist/chunks/TrustDialog-CZ8JpySm.js +0 -1
- package/dist/chunks/agents-HIOBiw4w.js +0 -101
- package/dist/chunks/allErrors-CxPNR2WN.js +0 -1
- package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +0 -1
- package/dist/chunks/banner-DqFectPg.js +0 -2
- package/dist/chunks/branch-B_BL5N9N.js +0 -2
- package/dist/chunks/bundledMode-BxyD5cqq.js +0 -1
- package/dist/chunks/caches-5xZ4dSXt.js +0 -1
- package/dist/chunks/caches-Be9saXxV.js +0 -1
- package/dist/chunks/claudeDesktop-g8eUUY2E.js +0 -1
- package/dist/chunks/client-mnUISv_N.js +0 -1
- package/dist/chunks/client-wPqIdEVm.js +0 -1
- package/dist/chunks/commands-wfE12a4L.js +0 -1
- package/dist/chunks/config-D3K87Mm1.js +0 -3
- package/dist/chunks/config-DTga6Ku8.js +0 -1
- package/dist/chunks/config-DtmqWusU.js +0 -1
- package/dist/chunks/context-noninteractive-eIlneYiL.js +0 -1
- package/dist/chunks/conversation-CHesBfFZ.js +0 -1
- package/dist/chunks/conversationRecovery-OhitW-7g.js +0 -1
- package/dist/chunks/crossProjectResume-mmYx8PrZ.js +0 -40
- package/dist/chunks/detectRepository-M6K2wc7h.js +0 -1
- package/dist/chunks/directoryCompletion-BHyjyKAM.js +0 -1
- package/dist/chunks/doctor-DeBG5SL5.js +0 -1
- package/dist/chunks/entry-CbhyIWgj.js +0 -13
- package/dist/chunks/extractMemories-jnsv-_n_.js +0 -1
- package/dist/chunks/fast-4I_qPJCd.js +0 -1
- package/dist/chunks/fast-DiolM1M7.js +0 -1
- package/dist/chunks/fetchModelList-BRFTQim4.js +0 -1
- package/dist/chunks/fetchModelList-qPKAuu4m.js +0 -1
- package/dist/chunks/fileSuggestions-iWVXvvLB.js +0 -3
- package/dist/chunks/generateSessionName-CGaTTXCA.js +0 -1
- package/dist/chunks/hooks-Bg9WIjZQ.js +0 -1
- package/dist/chunks/install-ACGY0vhM.js +0 -1
- package/dist/chunks/loadAgentsDir-DqAbnpB-.js +0 -1
- package/dist/chunks/loader-6MqzNGmV.js +0 -1
- package/dist/chunks/localSearch-DW3JT2MA.js +0 -1
- package/dist/chunks/managedEnv-DCEJh3z3.js +0 -1
- package/dist/chunks/mcp-CJ6SDJEK.js +0 -6
- package/dist/chunks/memory-BQO6Y0ak.js +0 -1
- package/dist/chunks/model-D42epddJ.js +0 -1
- package/dist/chunks/modelOptions-beLgXORr.js +0 -1
- package/dist/chunks/nativeInstaller-ChGSz1lb.js +0 -1
- package/dist/chunks/parser-BZt0VFd_.js +0 -1
- package/dist/chunks/permissions-DkfWKN-B.js +0 -3
- package/dist/chunks/pidLock-YvAaIrIY.js +0 -3
- package/dist/chunks/platform-Vl9IynC3.js +0 -2
- package/dist/chunks/plugin-CTA2_-F7.js +0 -17
- package/dist/chunks/pluginAutoupdate-Dy5W3HWE.js +0 -1
- package/dist/chunks/pluginOperations-ClXNOOG6.js +0 -2
- package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +0 -1
- package/dist/chunks/pluginStartupCheck-U8_xk25t.js +0 -1
- package/dist/chunks/poorMode-DtzWNhsY.js +0 -1
- package/dist/chunks/print-BzljdXem.js +0 -13
- package/dist/chunks/processBashCommand-RUkmyAl4.js +0 -1
- package/dist/chunks/processSlashCommand-DRLO-jNV.js +0 -5
- package/dist/chunks/prompt-DTpfW6yP.js +0 -1
- package/dist/chunks/prompt-D__eHY_5.js +0 -1
- package/dist/chunks/promptEditor-CpUFgGzc.js +0 -4
- package/dist/chunks/protocolHandler-BQSLVGnG.js +0 -13
- package/dist/chunks/reconciler-D6BUq8WB.js +0 -1
- package/dist/chunks/reject-C6IvUvBt.js +0 -1
- package/dist/chunks/ripgrep-CYP26Fhg.js +0 -1
- package/dist/chunks/ripgrep-D1f1pbCz.js +0 -5
- package/dist/chunks/sandbox-adapter-CumL75tU.js +0 -1
- package/dist/chunks/sandbox-toggle-CTtET6Xq.js +0 -1
- package/dist/chunks/searchExtraTools-BMCU2zEf.js +0 -1
- package/dist/chunks/select-FrwoTzuc.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +0 -1
- package/dist/chunks/sessionObserver-CBrM4opL.js +0 -1
- package/dist/chunks/sessionStorage-C1EAxDWG.js +0 -1
- package/dist/chunks/sessionTracing-UFK96PxT.js +0 -11
- package/dist/chunks/settings-BK6gCko-.js +0 -1
- package/dist/chunks/settings-YIDksG5Z.js +0 -24
- package/dist/chunks/setup-BBvZyrfz.js +0 -3
- package/dist/chunks/sinks-DB_D4lmu.js +0 -1
- package/dist/chunks/skills-DgeLr52a.js +0 -1
- package/dist/chunks/sleep-BbWr_FL1.js +0 -1
- package/dist/chunks/startupProfiler-FpGsKWYk.js +0 -1
- package/dist/chunks/status-CKLecQZV.js +0 -1
- package/dist/chunks/switcher-D2Z2ZNQ0.js +0 -1
- package/dist/chunks/tipRegistry-BR_lSGRw.js +0 -2
- package/dist/chunks/types-CD25a50S.js +0 -81
- package/dist/chunks/use-select-navigation-CW5alA9r.js +0 -1
- package/dist/chunks/useMainLoopModel-BVgJo4hN.js +0 -1
- package/dist/chunks/useManagePlugins-CrWjzESW.js +0 -1
- package/dist/chunks/useMergedTools-r6GQq5mI.js +0 -1
- package/dist/chunks/util-_zo3I1y8.js +0 -1
- package/dist/chunks/validatePlugin-DFGdRhA-.js +0 -1
- package/dist/chunks/worktree-CR_M6Qfy.js +0 -1
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{C as n,D as r,Gr as i,H as a,I as o,P as s,T as c,Wt as l,Xn as u,ai as d,di as f,fi as p,hn as m,k as ee,oi as te,ot as ne,p as h,t as g}from"./src-WZ94ZKI3.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as v,at as re,q as ie}from"./state-CXY-q5gr.js";import{Dc as y,Or as ae,Tb as b,Tc as oe,bi as x,br as S,ei as se,gr as ce,hd as le,lr as C,md as w,sb as ue,tb as T,tr as de,vS as fe,vr as pe,wb as me,yS as he,yi as ge}from"./loadAgentsDir-DR5PVAc3.js";import{S as E,c as D,i as O,x as _e}from"./debug-kBjDaVkQ.js";import{Bn as ve,Dr as ye,Pr as be,zn as k}from"./settings-YIDksG5Z.js";import{a as A,o as xe,s as Se}from"./log-DWZny1vM.js";import{n as Ce}from"./analytics-COpjZpvd.js";import{S as we,_ as j,d as Te,p as Ee}from"./startupProfiler-DIM_Ihyp.js";import{f as De,u as Oe}from"./model-D42epddJ.js";import{n as M,t as ke}from"./TextInput-BboKIug2.js";import{n as Ae,t as N}from"./useExitOnCtrlCDWithKeybindings-BgJrnuDl.js";import{n as je,t as Me}from"./select-FrwoTzuc.js";import{r as Ne,t as Pe}from"./Spinner-DhhSOFcN.js";import{l as Fe,u as Ie}from"./SpinnerGlyph-CmVXC-_9.js";import{t as Le}from"./SearchBox-DQBLKyzJ.js";import{n as Re,t as ze}from"./useSearchInput-BITV_Txn.js";import{n as P,t as F}from"./Messages-CxMsfjOa.js";function Be({log:e,onExit:t,onSelect:n}){let[i,a]=I.useState(null);I.useEffect(()=>{a(null),S(e)&&ae(e).then(a)},[e]);let u=S(e)&&i===null,d=i??e,f=C(d)||``,p=oe();return l(`confirm:no`,t,{context:`Confirmation`}),l(`confirm:yes`,(0,I.useCallback)(()=>{n(i??e)},[n,i,e]),{context:`Confirmation`}),u?(0,L.jsxs)(o,{flexDirection:`column`,padding:1,children:[(0,L.jsx)(h,{message:`Loading session…`}),(0,L.jsx)(s,{dimColor:!0,children:(0,L.jsx)(c,{children:(0,L.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,L.jsxs)(o,{flexDirection:`column`,children:[(0,L.jsx)(F,{messages:d.messages,tools:p,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:f,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,L.jsxs)(o,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,L.jsxs)(s,{children:[Ee(d.modified),` · `,d.messageCount,` messages`,d.gitBranch?` · ${d.gitBranch}`:``]}),(0,L.jsx)(s,{dimColor:!0,children:(0,L.jsxs)(c,{children:[(0,L.jsx)(r,{shortcut:`Enter`,action:`resume`}),(0,L.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var I,L,Ve=e((()=>{I=t(d(),1),g(),T(),y(),j(),ce(),le(),P(),L=_()}));function R(e,t){if(e===B)return 5;let n=i(e),r=t?Math.min(n,t-V-H):n;return Math.max(0,r)+V+H}function He(e,t){let n=t-V-H;return i(e)<=n?e:n<=1?e.charAt(0):we(e,n)}function Ue({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,c=Math.max(Je,W),l=n-a-c-2,u=Math.max(0,Math.min(t,e.length-1)),d=Math.max(20,Math.floor(l/2)),f=e.map(e=>R(e,d)),p=0,m=e.length;if(f.reduce((e,t,n)=>e+t+ +(n<f.length-1),0)>l){let t=l-qe,n=f[u]??0;for(p=u,m=u+1;p>0||m<e.length;){let r=p>0,i=m<e.length;if(r){let e=(f[p-1]??0)+1;if(n+e<=t){p--,n+=e;continue}}if(i){let e=(f[m]??0)+1;if(n+e<=t){m++,n+=e;continue}}break}}let ee=p,te=e.length-m,ne=e.slice(p,m),h=ne.map((e,t)=>p+t);return(0,z.jsxs)(o,{flexDirection:`row`,gap:1,children:[(0,z.jsx)(s,{color:`suggestion`,children:i}),ee>0&&(0,z.jsxs)(s,{dimColor:!0,children:[U,ee]}),ne.map((e,t)=>{let n=h[t]===u,r=e===B?e:`#${He(e,d-V)}`;return(0,z.jsxs)(s,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),te>0?(0,z.jsxs)(s,{dimColor:!0,children:[We,te,Ge]}):(0,z.jsx)(s,{dimColor:!0,children:Ke})]})}var z,B,V,H,U,We,Ge,Ke,qe,Je,W,G=e((()=>{g(),j(),z=_(),B=`All`,V=2,H=1,U=`← `,We=`→`,Ge=` (tab to cycle)`,Ke=`(tab to cycle)`,qe=5,Je=18,W=14}));function Ye({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:s=`expanded`,isDisabled:c=!1,hideIndexes:l=!1,isNodeExpanded:u,onExpand:d,onCollapse:f,getParentPrefix:p,getChildPrefix:m,onUpFromFirstItem:ee}){let[te,ne]=K.useState(new Set),h=K.useRef(!1),g=K.useRef(null),_=K.useCallback(e=>u?u(e):te.has(e),[u,te]),v=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=_(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,_]),re=K.useCallback(e=>e?`▼ `:`▶ `,[]),ie=K.useCallback(e=>` ▸ `,[]),y=p??re,ae=m??ie,b=K.useCallback(e=>{let t=``;return e.hasChildren?t=y(e.isExpanded):e.depth>0&&(t=ae(e.depth)),t+e.node.label},[y,ae]),oe=K.useMemo(()=>v.map(e=>({label:b(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[v,b]),x=K.useMemo(()=>{let e=new Map;return v.forEach(t=>e.set(t.node.id,t.node)),e},[v]),S=K.useCallback(e=>v.find(t=>t.node.id===e),[v]),se=K.useCallback((e,t)=>{S(e)?.hasChildren&&(t?d?d(e):ne(t=>new Set(t).add(e)):f?f(e):ne(t=>{let n=new Set(t);return n.delete(e),n}))},[S,d,f]);return(0,Xe.jsx)(o,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||c)return;let t=S(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),se(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),se(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,se(t.parentId,!1),r)){let e=x.get(t.parentId);e&&r(e)}}}},children:(0,Xe.jsx)(Me,{options:oe,onChange:K.useCallback(e=>{let n=x.get(e);n&&t(n)},[x,t]),onFocus:K.useCallback(e=>{if(h.current){h.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=x.get(e);t&&r(t)}},[r,x]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:s,isDisabled:c,hideIndexes:l,onUpFromFirstItem:ee})})}var K,Xe,Ze=e((()=>{K=t(d(),1),g(),je(),Xe=_()}));function Qe(e,t){return we(e.replace(/\s+/g,` `).trim(),t)}function $e({before:e,match:t,after:n},r){return f.dim(e)+r(t)+f.dim(n)}function et(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function tt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?ct:i?lt:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${Qe(A(e),l)}${c}${s}`}function nt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=Te(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function rt({logs:e,maxHeight:t=1/0,forceWidth:i,onCancel:d,onSelect:f,onLogsChanged:p,onLoadMore:h,initialSearchQuery:g,showAllProjects:_=!1,onToggleAllProjects:v,onAgenticSearch:y}){let ae=ne(),b=i===void 0?ae.columns:i,oe=Ae(d),x=u(),S=pe(),[ce]=a(),le=Fe(ce),ue=q.useMemo(()=>e=>te(e,le.warning),[le.warning]),[T,fe]=q.useState(null),[me,he]=q.useState(!1),[E,D]=q.useState(!1),[O,_e]=q.useState(!1),ve=q.useMemo(()=>ie(),[]),[be,k]=q.useState(``),[xe,Se]=q.useState(0),[Ce,we]=q.useState(new Set),[j,Ee]=q.useState(null),[De,Oe]=q.useState(1),[M,N]=q.useState(`list`),[je,Ne]=q.useState(null),Ie=q.useRef(null),[Le,ze]=q.useState(0),[P,F]=q.useState({status:`idle`}),[I,L]=q.useState(!1),Ve=q.useRef(null),{query:R,setQuery:He,cursorOffset:z}=Re({isActive:M===`search`&&P.status!==`searching`,onExit:()=>{N(`list`)},onExitUp:()=>{N(`list`)},passthroughCtrlKeys:[`n`],initialQuery:g||``}),B=q.useDeferredValue(R),[V,H]=q.useState(``);q.useEffect(()=>{if(!B){H(``);return}let e=setTimeout(H,300,B);return()=>clearTimeout(e)},[B]);let[U,We]=q.useState(null),[Ge,Ke]=q.useState(!1);q.useEffect(()=>{ye().then(e=>fe(e)),ge(ve).then(e=>{_e(e.length>1)})},[ve]);let qe=q.useMemo(()=>new Map(e.map(e=>[e,at(e)])),[e]),Je=q.useMemo(()=>null,[e,qe,!1]),W=q.useMemo(()=>st(e),[e]),G=W.length>0,K=q.useMemo(()=>G?[`All`,...W]:[],[G,W]),Xe=K.length>0&&Le<K.length?Le:0,Ze=K[Xe],rt=Ze===`All`?void 0:Ze,it=+!!G,ct=q.useMemo(()=>{let t=e;return S&&(t=e.filter(e=>{let t=re(),n=C(e);return!!(t&&n===t||e.customTitle||de(e.messages)||e.firstPrompt||e.customTitle)})),rt!==void 0&&(t=t.filter(e=>e.tag===rt)),me&&T&&(t=t.filter(e=>e.gitBranch===T)),O&&!E&&(t=t.filter(e=>e.projectPath===ve)),t},[e,S,rt,me,T,O,E,ve]),lt=q.useMemo(()=>{if(!R)return ct;let e=R.toLowerCase();return ct.filter(t=>{let n=A(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[ct,R]);q.useEffect(()=>{},[B,V,!1]),q.useEffect(()=>{We(null),Ke(!1)},[V,Je,!1]);let{filteredLogs:ut,snippets:Y}=q.useMemo(()=>{let e=new Map,t=lt;if(U&&V&&U.query===V){for(let t of U.results)if(t.searchableText){let n=et(t.searchableText,V,dt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=U.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[lt,U,V]),X=q.useMemo(()=>P.status===`results`&&P.results.length>0?P.results:ut,[P,ut]),Z=Math.max(30,b-4),ft=q.useMemo(()=>{if(!S)return[];let e=ot(X);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=X.indexOf(n),i=Y.get(n),a=i?$e(i,ue):null;if(t.length===1){let t=nt(n,{showProjectPath:_});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:tt(n,Z),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=X.indexOf(t),i=Y.get(t),a=i?$e(i,ue):null,o=nt(t,{isChild:!0,showProjectPath:_});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:tt(t,Z,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=nt(n,{showProjectPath:_});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:tt(n,Z,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[S,X,Z,_,Y,ue]),pt=q.useMemo(()=>S?[]:X.map((e,t)=>{let n=Qe(A(e)+(e.isSidechain?` (sidechain)`:``),Z),r=Te(e),i=_&&e.projectPath?` · ${e.projectPath}`:``,a=Y.get(e),o=a?$e(a,ue):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[S,X,ue,Z,_,Y]),Q=j?.value.log??null,mt=()=>{if(!S||!Q)return``;let e=C(Q);if(!e)return``;let t=X.filter(t=>C(t)===e);if(!(t.length>1))return``;let n=Ce.has(e);return t.indexOf(Q)>0||n?`← to collapse`:`→ to expand`},ht=q.useCallback(async()=>{let e=Q?C(Q):void 0;if(!Q||!e){N(`list`),k(``);return}be.trim()&&(await se(e,be.trim(),Q.fullPath),S&&p&&p()),N(`list`),k(``)},[Q,be,p,S]),gt=q.useCallback(()=>{N(`list`)},[]),_t=q.useCallback(()=>{N(`search`)},[]),vt=q.useCallback(async()=>{if(!R.trim()||!y||!0)return;Ve.current?.abort();let t=new AbortController;Ve.current=t,F({status:`searching`}),R.length;try{let n=await y(R,e,t.signal);if(t.signal.aborted)return;F({status:`results`,results:n,query:R}),R.length,n.length}catch(e){if(t.signal.aborted)return;F({status:`error`,message:e instanceof Error?e.message:`Search failed`}),R.length}},[R,y,!1,e]);q.useEffect(()=>{P.status!==`idle`&&P.status!==`searching`&&(P.status===`results`&&P.query!==R||P.status===`error`)&&F({status:`idle`})},[R,P]),q.useEffect(()=>()=>{Ve.current?.abort()},[]);let yt=q.useRef(P.status);q.useEffect(()=>{let e=yt.current;if(yt.current=P.status,e===`searching`&&P.status===`results`){if(S&&ft.length>0)Ee(ft[0]);else if(!S&&X.length>0){let e=X[0];Ee({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[P.status,S,ft,X]);let bt=q.useCallback(e=>{let t=parseInt(e,10),n=X[t];!n||Ie.current===t.toString()||(Ie.current=t.toString(),Ee({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Oe(t+1))},[X]),xt=q.useCallback(e=>{Ee(e);let t=X.findIndex(t=>C(t)===C(e.value.log));t>=0&&Oe(t+1)},[X]);l(`confirm:no`,()=>{Ve.current?.abort(),F({status:`idle`})},{context:`Confirmation`,isActive:M!==`preview`&&P.status===`searching`}),l(`confirm:no`,()=>{N(`list`),k(``)},{context:`Settings`,isActive:M===`rename`&&P.status!==`searching`}),l(`confirm:no`,()=>{He(``),L(!1),d?.()},{context:`Confirmation`,isActive:M!==`preview`&&M!==`rename`&&M!==`search`&&I&&P.status!==`searching`}),m((e,t)=>{if(M!==`preview`&&P.status!==`searching`&&M!==`rename`)if(M===`search`)e.toLowerCase()===`n`&&t.ctrl?gt():(t.return||t.downArrow)&&R.trim();else{if(I){if(t.return){vt(),L(!1);return}else if(t.downArrow){L(!1);return}else if(t.upArrow){N(`search`),L(!1);return}}if(G&&t.tab){let e=t.shift?-1:1;ze(t=>{let n=((t<K.length?t:0)+K.length+e)%K.length;return K[n],W.length,n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();r===`a`&&t.ctrl&&v?v():r===`b`&&t.ctrl?he(!me):r===`w`&&t.ctrl&&O?D(!E):r===`/`&&n?N(`search`):r===`r`&&t.ctrl&&Q?(N(`rename`),k(``)):r===`v`&&t.ctrl&&Q?(Ne(Q),N(`preview`),Q.messageCount):Q&&n&&e.length>0&&!/^\s+$/.test(e)&&(N(`search`),He(e))}},{isActive:!0});let St=[];me&&T&&St.push(T),O&&!E&&St.push(`current worktree`);let Ct=8+ +(St.length>0&&M!==`search`)+it,$=Math.max(1,Math.floor((t-Ct-2)/3));return q.useEffect(()=>{if(!h)return;let e=$*2;De+e>=X.length&&h($*3)},[De,$,X.length,h]),e.length===0?null:M===`preview`&&je&&S?(0,J.jsx)(Be,{log:je,onExit:()=>{N(`list`),Ne(null)},onSelect:f}):(0,J.jsxs)(o,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsx)(n,{color:`suggestion`})}),(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsx)(s,{children:` `})}),G?(0,J.jsx)(Ue,{tabs:K,selectedIndex:Xe,availableWidth:b,showAllProjects:_}):(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsxs)(s,{bold:!0,color:`suggestion`,children:[`Resume Session`,M===`list`&&X.length>$&&(0,J.jsxs)(s,{dimColor:!0,children:[` `,`(`,De,` of `,X.length,`)`]})]})}),(0,J.jsx)(ee,{query:R,isFocused:M===`search`,isTerminalFocused:x,cursorOffset:z}),St.length>0&&M!==`search`&&(0,J.jsx)(o,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsx)(c,{children:St})})}),(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsx)(s,{children:` `})}),P.status===`searching`&&(0,J.jsxs)(o,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(Pe,{}),(0,J.jsx)(s,{children:` Searching…`})]}),P.status===`results`&&P.results.length>0&&(0,J.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),P.status===`results`&&P.results.length===0&&ut.length===0&&(0,J.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),P.status===`error`&&ut.length===0&&(0,J.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!R.trim()&&y&&!1,P.status===`searching`?null:M===`rename`&&Q?(0,J.jsxs)(o,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(s,{bold:!0,children:`Rename session:`}),(0,J.jsx)(o,{paddingTop:1,children:(0,J.jsx)(ke,{value:be,onChange:k,onSubmit:ht,placeholder:A(Q,`Enter new session name`),columns:b,cursorOffset:xe,onChangeCursorOffset:Se,showCursor:!0})})]}):S?(0,J.jsx)(Ye,{nodes:ft,onSelect:e=>{f(e.value.log)},onFocus:xt,onCancel:d,focusNodeId:j?.id,visibleOptionCount:$,layout:`expanded`,isDisabled:M===`search`||I,hideIndexes:!1,isNodeExpanded:e=>{if(M===`search`||me)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Ce.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&we(e=>new Set(e).add(t))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&we(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:_t}):(0,J.jsx)(Me,{options:pt,onChange:e=>{let t=X[parseInt(e,10)];t&&f(t)},visibleOptionCount:$,onCancel:d,onFocus:bt,defaultFocusValue:j?.id.toString(),layout:`expanded`,isDisabled:M===`search`||I,onUpFromFirstItem:_t}),(0,J.jsx)(o,{paddingLeft:2,children:oe.pending?(0,J.jsxs)(s,{dimColor:!0,children:[`Press `,oe.keyName,` again to exit`]}):M===`rename`?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(r,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P.status===`searching`?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(s,{children:`Searching with Work Mate…`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(r,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(r,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):M===`search`?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(s,{children:`Type to Search`}),(0,J.jsx)(r,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[v&&(0,J.jsx)(r,{shortcut:`Ctrl+A`,action:`show ${_?`current dir`:`all projects`}`}),T&&(0,J.jsx)(r,{shortcut:`Ctrl+B`,action:`toggle branch`}),O&&(0,J.jsx)(r,{shortcut:`Ctrl+W`,action:`show ${E?`current worktree`:`all worktrees`}`}),(0,J.jsx)(r,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(r,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(s,{children:`Type to search`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),mt()&&(0,J.jsx)(s,{children:mt()})]})})})]})}function it(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function at(e){let t=(e.messages.length<=ut?e.messages:[...e.messages.slice(0,Y),...e.messages.slice(-1e3)]).map(it).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>X?n.slice(0,X):n}function ot(e){let t=new Map;for(let n of e){let e=C(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function st(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var q,J,ct,lt,ut,Y,X,dt,Z=e((()=>{p(),q=t(d(),1),v(),N(),ze(),ue(),g(),T(),Ce(),j(),x(),be(),xe(),ce(),Ie(),le(),je(),Le(),Ve(),Ne(),G(),M(),Ze(),J=_(),ct=2,lt=4,ut=2e3,Y=1e3,X=5e4,dt=50}));function ft(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function pt(e){if(e.length===0)return``;let t=(e.length<=gt?e:[...e.slice(0,gt/2),...e.slice(-100/2)]).map(ft).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>ht?`${t.slice(0,ht)}…`:t}function Q(e,t){return!!(A(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&pt(e.messages).toLowerCase().includes(t))}async function mt(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>Q(e,r)),a;if(i.length>=_t)a=i.slice(0,_t);else{let e=t.filter(e=>!Q(e,r)),n=_t-i.length;a=[...i,...e.slice(0,n)]}D(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${k(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(S(e))try{return await ae(e)}catch(t){return Se(t),e}return e}),s=await Promise.all(o);D(`Agentic search: loaded ${k(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
|
|
2
|
-
${s.map((e,t)=>{let n=[`${t}:`],r=A(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=pt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
|
|
3
|
-
`)}
|
|
4
|
-
|
|
5
|
-
Search query: "${e}"
|
|
6
|
-
|
|
7
|
-
Find the sessions that are most relevant to this query.`;D(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=Oe();D(`Agentic search using model: ${e}`);let t=(await he({model:e,system:vt,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return D(`No text content in agentic search response`),[];D(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return D(`Could not find JSON in agentic search response`),[];let i=(E(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return D(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return Se(e),D(`Agentic search error: ${e}`),[]}}var ht,gt,_t,vt,yt=e((()=>{ve(),O(),xe(),De(),ce(),fe(),_e(),ht=2e3,gt=100,_t=100,vt=`Your goal is to find relevant sessions based on a user's search query.
|
|
8
|
-
|
|
9
|
-
You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
|
|
10
|
-
|
|
11
|
-
Each session may include:
|
|
12
|
-
- Title (display name or custom title)
|
|
13
|
-
- Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
|
|
14
|
-
- Branch (git branch name, shown as [branch: name])
|
|
15
|
-
- Summary (AI-generated summary)
|
|
16
|
-
- First message (beginning of the conversation)
|
|
17
|
-
- Transcript (excerpt of conversation content)
|
|
18
|
-
|
|
19
|
-
IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
|
|
20
|
-
|
|
21
|
-
For each session, consider (in order of priority):
|
|
22
|
-
1. Exact tag matches (highest priority - user explicitly categorized this session)
|
|
23
|
-
2. Partial tag matches or tag-related terms
|
|
24
|
-
3. Title matches (custom titles or first message content)
|
|
25
|
-
4. Branch name matches
|
|
26
|
-
5. Summary and transcript content matches
|
|
27
|
-
6. Semantic similarity and related concepts
|
|
28
|
-
|
|
29
|
-
CRITICAL: Be VERY inclusive in your matching. Include sessions that:
|
|
30
|
-
- Contain the query term anywhere in any field
|
|
31
|
-
- Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
|
|
32
|
-
- Discuss topics that could be related to the query
|
|
33
|
-
- Have transcripts that mention the concept even in passing
|
|
34
|
-
|
|
35
|
-
When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
|
|
36
|
-
|
|
37
|
-
Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
|
|
38
|
-
|
|
39
|
-
Respond with ONLY the JSON object, no markdown formatting:
|
|
40
|
-
{"relevant_indices": [2, 5, 0]}`}));function bt(e,t){let n=ie();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=C(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${b([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var xt=e((()=>{v(),me(),ce()}));export{rt as a,yt as i,xt as n,Z as o,mt as r,bt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-DrEEb4f5.js";import{c as r,i}from"./debug-kBjDaVkQ.js";import{Pr as a,jr as o}from"./settings-YIDksG5Z.js";function s(){f.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=n();if(f.has(e))return f.get(e)??null;try{let t=await o();if(r(`Git remote URL: ${t}`),!t)return r(`No git remote URL found`),f.set(e,null),null;let n=u(t);return r(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),f.set(e,n),n}catch(t){return r(`Error detecting repository: ${t}`),f.set(e,null),null}}function u(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return d(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return d(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function d(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var f,p=e((()=>{t(),i(),a(),f=new Map}));export{c as n,p as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{v as t,y as n}from"./types-CD25a50S.js";import{n as r,t as i}from"./cwd-DrEEb4f5.js";import{f as a,u as o}from"./debug-kBjDaVkQ.js";import{Qn as s,er as c}from"./settings-YIDksG5Z.js";import{o as l,s as u}from"./log-DWZny1vM.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||i(),prefix:``};let n=s(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:n,prefix:``}:{directory:f(n),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await o().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return u(e),[]}}async function _(e,t={}){let{basePath:n=i(),maxResults:r=10}=t,{directory:a,prefix:o}=h(e,n),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,r).map(e=>({id:e.path,displayText:`${e.name}/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,r=w.get(n);if(r)return r;try{let r=(await o().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,r),r}catch(e){return u(e),[]}}async function b(e,t={}){let{basePath:n=i(),maxResults:r=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,n),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,r),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.${m}`))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?`${t}/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{n(),r(),a(),l(),c(),x=500,S=300*1e3,C=new t({max:x,ttl:S}),w=new t({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-DJOMbSDE.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{B as n,J as r,N as i,P as a,Q as o,R as s,U as c,W as l,X as u,Z as d,b as f,et as p,k as m}from"./types-CD25a50S.js";import{$n as h,Hn as g,Pt as _,Qn as ee,Tn as v,ot as y,q as b}from"./state-CXY-q5gr.js";import{B as te,Dc as ne,Di as re,Ds as ie,Ec as ae,Gv as oe,Mi as se,Os as ce,V as le,Vv as ue,Xl as de,Yl as fe,gr as x,i as pe,nr as S,o as me}from"./loadAgentsDir-DR5PVAc3.js";import{ar as he,d as ge,dr as _e,hr as C,m as ve}from"./settings-YIDksG5Z.js";import{d as ye,n as be}from"./config-D3K87Mm1.js";import{f as xe,s as Se}from"./model-D42epddJ.js";import{_n as Ce,vn as we}from"./prompt-CTByhpUI.js";import{t as w}from"./conversationRecovery-OhitW-7g.js";import{t as Te}from"./QueryEngine-Mdi_kUaL.js";import{n as Ee,r as De}from"./modelOptions-beLgXORr.js";import{n as Oe,r as ke}from"./managedEnv-Do9fgLpk.js";import{dirname as Ae}from"node:path";import{randomUUID as T}from"node:crypto";import{Readable as je,Writable as Me}from"node:stream";import{unlink as Ne}from"node:fs/promises";import*as E from"node:path/posix";import{isAbsolute as Pe,resolve as Fe}from"node:path/posix";f();var D={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},O={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},Ie=l({_meta:r(u(),o()).nullish(),terminal:a().optional().default(!1)}),Le=l({_meta:r(u(),o()).nullish(),label:u().nullish(),name:u(),optional:a().optional().default(!1),secret:a().optional().default(!0)}),Re=l({_meta:r(u(),o()).nullish(),description:u().nullish(),id:u(),name:u()}),ze=l({_meta:r(u(),o()).nullish(),description:u().nullish(),id:u(),link:u().nullish(),name:u(),vars:i(Le)}),Be=l({_meta:r(u(),o()).nullish(),args:i(u()).optional(),description:u().nullish(),env:r(u(),u()).optional(),id:u(),name:u()}),Ve=d([ze.and(l({type:n(`env_var`)})),Be.and(l({type:n(`terminal`)})),Re]),He=l({_meta:r(u(),o()).nullish(),methodId:u()}),Ue=l({_meta:r(u(),o()).nullish()}),We=l({_meta:r(u(),o()).nullish(),blob:u(),mimeType:u().nullish(),uri:u()}),Ge=l({default:a().nullish(),description:u().nullish(),title:u().nullish()}),Ke=l({_meta:r(u(),o()).nullish()}),qe=l({_meta:r(u(),o()).nullish()}),Je=l({amount:c(),currency:u()}),Ye=l({_meta:r(u(),o()).nullish(),terminalId:u()}),Xe=l({_meta:r(u(),o()).nullish(),newText:u(),oldText:u().nullish(),path:u()}),Ze=d([u(),c(),c(),a(),i(u())]),Qe=s(d([l({content:r(u(),Ze).nullish()}).and(l({action:n(`accept`)})),l({action:n(`decline`)}),l({action:n(`cancel`)})]),l({_meta:r(u(),o()).nullish()})),$e=l({_meta:r(u(),o()).nullish()}),et=u(),tt=l({_meta:r(u(),o()).nullish(),elicitationId:et}),nt=n(`object`),rt=n(`string`),it=l({_meta:r(u(),o()).nullish()}),at=l({_meta:r(u(),o()).nullish(),form:$e.nullish(),url:it.nullish()}),ot=l({const:u(),title:u()}),st=l({_meta:r(u(),o()).nullish(),name:u(),value:u()}),ct=l({code:d([n(-32700),n(-32600),n(-32601),n(-32602),n(-32603),n(-32800),n(-32e3),n(-32002),n(-32042),c().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:o().optional(),message:u()}),lt=o(),ut=o(),dt=o(),ft=l({_meta:r(u(),o()).nullish(),readTextFile:a().optional().default(!1),writeTextFile:a().optional().default(!1)}),pt=l({_meta:r(u(),o()).nullish(),name:u(),value:u()}),mt=l({_meta:r(u(),o()).nullish(),name:u(),title:u().nullish(),version:u()}),ht=l({default:c().nullish(),description:u().nullish(),maximum:c().nullish(),minimum:c().nullish(),title:u().nullish()}),gt=l({_meta:r(u(),o()).nullish()}),_t=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cursor:u().nullish(),cwd:u().nullish()}),vt=l({_meta:r(u(),o()).nullish()}),yt=l({_meta:r(u(),o()).nullish(),logout:vt.nullish()}),bt=l({_meta:r(u(),o()).nullish()}),xt=l({_meta:r(u(),o()).nullish()}),St=l({_meta:r(u(),o()).nullish(),http:a().optional().default(!1),sse:a().optional().default(!1)}),Ct=l({_meta:r(u(),o()).nullish(),headers:i(pt),name:u(),url:u()}),wt=l({_meta:r(u(),o()).nullish(),headers:i(pt),name:u(),url:u()}),Tt=l({_meta:r(u(),o()).nullish(),args:i(u()),command:u(),env:i(st),name:u()}),k=d([Ct.and(l({type:n(`http`)})),wt.and(l({type:n(`sse`)})),Tt]),A=u(),Et=l({_meta:r(u(),o()).nullish(),description:u().nullish(),modelId:A,name:u()}),Dt=d([n(`error`),n(`warning`),n(`information`),n(`hint`)]),Ot=l({_meta:r(u(),o()).nullish()}),kt=l({_meta:r(u(),o()).nullish()}),At=l({_meta:r(u(),o()).nullish()}),jt=l({_meta:r(u(),o()).nullish()}),Mt=l({_meta:r(u(),o()).nullish()}),Nt=l({_meta:r(u(),o()).nullish(),maxCount:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=l({diff:u(),uri:u()}),Ft=l({endLine:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:u()}),It=l({_meta:r(u(),o()).nullish()}),Lt=l({_meta:r(u(),o()).nullish()}),Rt=l({languageId:u(),text:u(),uri:u()}),zt=l({_meta:r(u(),o()).nullish(),maxCount:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Bt=d([n(`rejected`),n(`ignored`),n(`replaced`),n(`cancelled`)]),Vt=l({excerpts:i(Ft),uri:u()}),Ht=l({_meta:r(u(),o()).nullish()}),Ut=l({_meta:r(u(),o()).nullish()}),Wt=l({name:u(),owner:u(),remoteUrl:u()}),Gt=l({_meta:r(u(),o()).nullish()}),Kt=l({_meta:r(u(),o()).nullish(),jump:It.nullish(),rename:Ut.nullish(),searchAndReplace:Gt.nullish()}),qt=l({id:u(),isRegex:a().nullish(),replace:u(),search:u(),uri:u()}),Jt=d([n(`automatic`),n(`diagnostic`),n(`manual`)]),Yt=l({_meta:r(u(),o()).nullish(),maxCount:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Xt=l({_meta:r(u(),o()).nullish(),diagnostics:Ot.nullish(),editHistory:Nt.nullish(),openFiles:Lt.nullish(),recentFiles:zt.nullish(),relatedSnippets:Ht.nullish(),userActions:Yt.nullish()}),Zt=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k)}),Qt=l({default:c().nullish(),description:u().nullish(),maximum:c().nullish(),minimum:c().nullish(),title:u().nullish()}),$t=u(),en=d([n(`allow_once`),n(`allow_always`),n(`reject_once`),n(`reject_always`)]),tn=l({_meta:r(u(),o()).nullish(),kind:en,name:u(),optionId:$t}),nn=d([n(`high`),n(`medium`),n(`low`)]),rn=d([n(`pending`),n(`in_progress`),n(`completed`)]),an=l({_meta:r(u(),o()).nullish(),content:u(),priority:nn,status:rn}),on=l({_meta:r(u(),o()).nullish(),entries:i(an)}),j=l({character:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),sn=l({id:u(),position:j,uri:u()}),cn=l({id:u(),newName:u(),position:j,uri:u()}),ln=l({action:u(),position:j,timestampMs:c(),uri:u()}),M=d([n(`utf-16`),n(`utf-32`),n(`utf-8`)]),un=l({_meta:r(u(),o()).nullish(),auth:Ie.optional().default({terminal:!1}),elicitation:at.nullish(),fs:ft.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Kt.nullish(),positionEncodings:i(M).optional(),terminal:a().optional().default(!1)}),dn=l({_meta:r(u(),o()).nullish(),audio:a().optional().default(!1),embeddedContext:a().optional().default(!1),image:a().optional().default(!1)}),fn=c().int().gte(0).lte(65535),pn=l({_meta:r(u(),o()).nullish(),clientCapabilities:un.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:mt.nullish(),protocolVersion:fn}),N=l({end:j,start:j}),mn=l({message:u(),range:N,severity:Dt,uri:u()}),hn=l({languageId:u(),lastFocusedMs:c().nullish(),uri:u(),visibleRange:N.nullish()}),gn=l({_meta:r(u(),o()).nullish(),diagnostics:i(mn).nullish(),editHistory:i(Pt).nullish(),openFiles:i(hn).nullish(),recentFiles:i(Rt).nullish(),relatedSnippets:i(Vt).nullish(),userActions:i(ln).nullish()}),_n=l({newText:u(),range:N}),vn=d([l({cursorPosition:j.nullish(),edits:i(_n),id:u(),uri:u()}).and(l({kind:n(`edit`)})),sn.and(l({kind:n(`jump`)})),cn.and(l({kind:n(`rename`)})),qt.and(l({kind:n(`searchAndReplace`)}))]),yn=l({_meta:r(u(),o()).nullish(),content:u()}),bn=l({_meta:r(u(),o()).nullish()}),P=d([c(),u()]).nullable();l({_meta:r(u(),o()).nullish(),requestId:P});var xn=l({requestId:P}),Sn=m([`assistant`,`user`]),F=l({_meta:r(u(),o()).nullish(),audience:i(Sn).nullish(),lastModified:u().nullish(),priority:c().nullish()}),Cn=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),data:u(),mimeType:u()}),wn=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),data:u(),mimeType:u(),uri:u().nullish()}),Tn=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),description:u().nullish(),mimeType:u().nullish(),name:u(),size:c().nullish(),title:u().nullish(),uri:u()}),En=l({_meta:r(u(),o()).nullish(),optionId:$t}),Dn=d([l({outcome:n(`cancelled`)}),En.and(l({outcome:n(`selected`)}))]),On=l({_meta:r(u(),o()).nullish(),outcome:Dn}),kn=l({_meta:r(u(),o()).nullish()}),An=l({_meta:r(u(),o()).nullish()}),jn=l({currentValue:a()}),Mn=u(),Nn=u(),Pn=d([n(`mode`),n(`model`),n(`thought_level`),u()]),I=u(),Fn=l({_meta:r(u(),o()).nullish(),description:u().nullish(),name:u(),value:I}),In=l({_meta:r(u(),o()).nullish(),group:Mn,name:u(),options:i(Fn)}),L=s(d([l({currentValue:I,options:d([i(Fn),i(In)])}).and(l({type:n(`select`)})),jn.and(l({type:n(`boolean`)}))]),l({_meta:r(u(),o()).nullish(),category:Pn.nullish(),description:u().nullish(),id:Nn,name:u()})),Ln=l({_meta:r(u(),o()).nullish(),configOptions:i(L)}),Rn=l({_meta:r(u(),o()).nullish()}),R=u(),zn=l({_meta:r(u(),o()).nullish(),id:u(),sessionId:R}),Bn=l({_meta:r(u(),o()).nullish(),sessionId:R}),Vn=l({_meta:r(u(),o()).nullish(),sessionId:R}),Hn=l({_meta:r(u(),o()).nullish(),sessionId:R}),Un=l({_meta:r(u(),o()).nullish(),args:i(u()).optional(),command:u(),cwd:u().nullish(),env:i(st).optional(),outputByteLimit:c().nullish(),sessionId:R}),Wn=l({_meta:r(u(),o()).nullish(),sessionId:R,uri:u()}),Gn=l({_meta:r(u(),o()).nullish(),position:j,sessionId:R,uri:u(),version:c(),visibleRange:N}),Kn=l({_meta:r(u(),o()).nullish(),languageId:u(),sessionId:R,text:u(),uri:u(),version:c()}),qn=l({_meta:r(u(),o()).nullish(),sessionId:R,uri:u()}),Jn=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k).optional(),sessionId:R}),Yn=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),Xn=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k),sessionId:R}),Zn=l({_meta:r(u(),o()).nullish(),limit:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:u(),sessionId:R}),Qn=l({_meta:r(u(),o()).nullish(),id:u(),reason:Bt.nullish(),sessionId:R}),$n=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),er=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),mcpServers:i(k).optional(),sessionId:R}),tr=l({_meta:r(u(),o()).nullish(),additionalDirectories:i(u()).optional(),cwd:u(),sessionId:R,title:u().nullish(),updatedAt:u().nullish()}),nr=l({_meta:r(u(),o()).nullish(),nextCursor:u().nullish(),sessions:i(tr)}),rr=l({_meta:r(u(),o()).nullish(),title:u().nullish(),updatedAt:u().nullish()}),ir=l({_meta:r(u(),o()).nullish()}),z=u(),ar=l({_meta:r(u(),o()).nullish(),currentModeId:z}),or=l({_meta:r(u(),o()).nullish(),description:u().nullish(),id:z,name:u()}),B=l({_meta:r(u(),o()).nullish(),availableModes:i(or),currentModeId:z}),V=l({_meta:r(u(),o()).nullish(),availableModels:i(Et),currentModelId:A}),sr=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),cr=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish()}),lr=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),ur=l({_meta:r(u(),o()).nullish(),configOptions:i(L).nullish(),models:V.nullish(),modes:B.nullish()}),dr=l({_meta:r(u(),o()).nullish()}),fr=l({_meta:r(u(),o()).nullish(),additionalDirectories:kn.nullish(),close:An.nullish(),fork:Rn.nullish(),list:ir.nullish(),resume:dr.nullish()}),pr=s(d([l({type:n(`boolean`),value:a()}),l({value:I})]),l({_meta:r(u(),o()).nullish(),configId:Nn,sessionId:R})),mr=l({_meta:r(u(),o()).nullish(),configOptions:i(L)}),hr=l({_meta:r(u(),o()).nullish(),modeId:z,sessionId:R}),gr=l({_meta:r(u(),o()).nullish()}),_r=l({_meta:r(u(),o()).nullish(),modelId:A,sessionId:R}),vr=l({_meta:r(u(),o()).nullish()}),yr=l({_meta:r(u(),o()).nullish(),sessionId:R}),br=d([n(`end_turn`),n(`max_tokens`),n(`max_turn_requests`),n(`refusal`),n(`cancelled`)]),xr=d([n(`email`),n(`uri`),n(`date`),n(`date-time`)]),Sr=l({default:u().nullish(),description:u().nullish(),enum:i(u()).nullish(),format:xr.nullish(),maxLength:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:i(ot).nullish(),pattern:u().nullish(),title:u().nullish()}),Cr=l({_meta:r(u(),o()).nullish(),context:gn.nullish(),position:j,selection:N.nullish(),sessionId:R,triggerKind:Jt,uri:u(),version:c()}),wr=l({_meta:r(u(),o()).nullish(),suggestions:i(vn)}),Tr=l({_meta:r(u(),o()).nullish(),terminalId:u()}),Er=l({_meta:r(u(),o()).nullish(),exitCode:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:u().nullish()}),Dr=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),Or=l({_meta:r(u(),o()).nullish(),exitStatus:Er.nullish(),output:u(),truncated:a()}),kr=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),text:u()}),Ar=l({range:N.nullish(),text:u()}),jr=l({_meta:r(u(),o()).nullish(),contentChanges:i(Ar),sessionId:R,uri:u(),version:c()});l({method:u(),params:d([Bn,Kn,jr,Wn,qn,Gn,zn,Qn,lt]).nullish()});var Mr=d([n(`full`),n(`incremental`)]),Nr=l({_meta:r(u(),o()).nullish(),syncKind:Mr}),Pr=l({_meta:r(u(),o()).nullish(),didChange:Nr.nullish(),didClose:kt.nullish(),didFocus:At.nullish(),didOpen:jt.nullish(),didSave:Mt.nullish()}),Fr=l({_meta:r(u(),o()).nullish(),document:Pr.nullish()}),Ir=l({_meta:r(u(),o()).nullish(),context:Xt.nullish(),events:Fr.nullish()}),Lr=l({_meta:r(u(),o()).nullish(),auth:yt.optional().default({}),loadSession:a().optional().default(!1),mcpCapabilities:St.optional().default({http:!1,sse:!1}),nes:Ir.nullish(),positionEncoding:M.nullish(),promptCapabilities:dn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:fr.optional().default({})}),Rr=l({_meta:r(u(),o()).nullish(),agentCapabilities:Lr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:mt.nullish(),authMethods:i(Ve).optional().default([]),protocolVersion:fn}),zr=d([l({_meta:r(u(),o()).nullish(),mimeType:u().nullish(),text:u(),uri:u()}),We]),Br=l({_meta:r(u(),o()).nullish(),annotations:F.nullish(),resource:zr}),H=d([kr.and(l({type:n(`text`)})),wn.and(l({type:n(`image`)})),Cn.and(l({type:n(`audio`)})),Tn.and(l({type:n(`resource_link`)})),Br.and(l({type:n(`resource`)}))]),Vr=l({_meta:r(u(),o()).nullish(),content:H}),U=l({_meta:r(u(),o()).nullish(),content:H,messageId:u().nullish()}),Hr=l({_meta:r(u(),o()).nullish(),messageId:u().nullish(),prompt:i(H),sessionId:R}),Ur=l({anyOf:i(ot)}),Wr=d([Vr.and(l({type:n(`content`)})),Xe.and(l({type:n(`diff`)})),Tr.and(l({type:n(`terminal`)}))]),W=u(),Gr=l({sessionId:R,toolCallId:W.nullish()}),Kr=s(d([Gr,xn]),l({elicitationId:et,url:u().url()})),qr=l({_meta:r(u(),o()).nullish(),line:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:u()}),Jr=d([n(`pending`),n(`in_progress`),n(`completed`),n(`failed`)]),Yr=d([n(`read`),n(`edit`),n(`delete`),n(`move`),n(`search`),n(`execute`),n(`think`),n(`fetch`),n(`switch_mode`),n(`other`)]),Xr=l({_meta:r(u(),o()).nullish(),content:i(Wr).optional(),kind:Yr.optional(),locations:i(qr).optional(),rawInput:o().optional(),rawOutput:o().optional(),status:Jr.optional(),title:u(),toolCallId:W}),Zr=l({_meta:r(u(),o()).nullish(),content:i(Wr).nullish(),kind:Yr.nullish(),locations:i(qr).nullish(),rawInput:o().optional(),rawOutput:o().optional(),status:Jr.nullish(),title:u().nullish(),toolCallId:W}),Qr=l({_meta:r(u(),o()).nullish(),options:i(tn),sessionId:R,toolCall:Zr}),$r=l({_meta:r(u(),o()).nullish(),hint:u()}),ei=l({_meta:r(u(),o()).nullish(),description:u(),input:$r.nullish(),name:u()}),ti=l({_meta:r(u(),o()).nullish(),availableCommands:i(ei)}),ni=d([l({enum:i(u()),type:rt}),Ur]),ri=l({default:i(u()).nullish(),description:u().nullish(),items:ni,maxItems:c().nullish(),minItems:c().nullish(),title:u().nullish()}),ii=d([Sr.and(l({type:n(`string`)})),Qt.and(l({type:n(`number`)})),ht.and(l({type:n(`integer`)})),Ge.and(l({type:n(`boolean`)})),ri.and(l({type:n(`array`)}))]),ai=l({description:u().nullish(),properties:r(u(),ii).optional().default({}),required:i(u()).nullish(),title:u().nullish(),type:nt.optional().default(`object`)}),oi=s(d([s(d([Gr,xn]),l({requestedSchema:ai})).and(l({mode:n(`form`)})),Kr.and(l({mode:n(`url`)}))]),l({_meta:r(u(),o()).nullish(),message:u()})),si=l({cachedReadTokens:c().nullish(),cachedWriteTokens:c().nullish(),inputTokens:c(),outputTokens:c(),thoughtTokens:c().nullish(),totalTokens:c()});d([l({id:P,result:d([Rr,Ue,xt,lr,cr,nr,sr,ur,qe,gr,mr,l({_meta:r(u(),o()).nullish(),stopReason:br,usage:si.nullish(),userMessageId:u().nullish()}),vr,yr,wr,Ke,dt])}),l({error:ct,id:P})]);var ci=l({_meta:r(u(),o()).nullish(),cost:Je.nullish(),size:c(),used:c()}),li=d([U.and(l({sessionUpdate:n(`user_message_chunk`)})),U.and(l({sessionUpdate:n(`agent_message_chunk`)})),U.and(l({sessionUpdate:n(`agent_thought_chunk`)})),Xr.and(l({sessionUpdate:n(`tool_call`)})),Zr.and(l({sessionUpdate:n(`tool_call_update`)})),on.and(l({sessionUpdate:n(`plan`)})),ti.and(l({sessionUpdate:n(`available_commands_update`)})),ar.and(l({sessionUpdate:n(`current_mode_update`)})),Ln.and(l({sessionUpdate:n(`config_option_update`)})),rr.and(l({sessionUpdate:n(`session_info_update`)})),ci.and(l({sessionUpdate:n(`usage_update`)}))]),ui=l({_meta:r(u(),o()).nullish(),sessionId:R,update:li});l({method:u(),params:d([ui,tt,lt]).nullish()});var di=l({_meta:r(u(),o()).nullish(),sessionId:R,terminalId:u()}),fi=l({_meta:r(u(),o()).nullish(),exitCode:c().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:u().nullish()}),pi=l({name:u(),uri:u()}),mi=l({_meta:r(u(),o()).nullish(),repository:Wt.nullish(),workspaceFolders:i(pi).nullish(),workspaceUri:u().nullish()});l({id:P,method:u(),params:d([pn,He,bt,Zt,Xn,_t,Jn,er,Hn,hr,pr,Hr,_r,mi,Cr,Vn,ut]).nullish()});var hi=l({_meta:r(u(),o()).nullish(),content:u(),path:u(),sessionId:R});l({id:P,method:u(),params:d([hi,Zn,Qr,Un,Dr,$n,di,Yn,oi,ut]).nullish()}),d([l({id:P,result:d([l({_meta:r(u(),o()).nullish()}),yn,On,Ye,Or,bn,fi,gt,Qe,dt])}),l({error:ct,id:P})]),e();function gi(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
|
|
2
|
-
`);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}let t=n.trim();if(t)try{let n=JSON.parse(t);e.enqueue(n)}catch(e){console.error(`Failed to parse JSON message:`,t,e)}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
|
|
3
|
-
`,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}f();var _i,vi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case D.initialize:{let e=pn.parse(t);return r.initialize(e)}case D.session_new:{let e=Zt.parse(t);return r.newSession(e)}case D.session_load:{if(!r.loadSession)throw G.methodNotFound(e);let n=Xn.parse(t);return r.loadSession(n)}case D.session_list:{if(!r.listSessions)throw G.methodNotFound(e);let n=_t.parse(t);return r.listSessions(n)}case D.session_fork:{if(!r.unstable_forkSession)throw G.methodNotFound(e);let n=Jn.parse(t);return r.unstable_forkSession(n)}case D.session_resume:{if(!r.unstable_resumeSession)throw G.methodNotFound(e);let n=er.parse(t);return r.unstable_resumeSession(n)}case D.session_close:{if(!r.unstable_closeSession)throw G.methodNotFound(e);let n=Hn.parse(t);return r.unstable_closeSession(n)}case D.session_set_mode:{if(!r.setSessionMode)throw G.methodNotFound(e);let n=hr.parse(t);return await r.setSessionMode(n)??{}}case D.authenticate:{let e=He.parse(t);return await r.authenticate(e)??{}}case D.logout:{if(!r.unstable_logout)throw G.methodNotFound(e);let n=bt.parse(t);return await r.unstable_logout(n)??{}}case D.session_prompt:{let e=Hr.parse(t);return r.prompt(e)}case D.session_set_model:{if(!r.unstable_setSessionModel)throw G.methodNotFound(e);let n=_r.parse(t);return await r.unstable_setSessionModel(n)??{}}case D.session_set_config_option:{if(!r.setSessionConfigOption)throw G.methodNotFound(e);let n=pr.parse(t);return r.setSessionConfigOption(n)}case D.nes_start:{if(!r.unstable_startNes)throw G.methodNotFound(e);let n=mi.parse(t);return r.unstable_startNes(n)}case D.nes_suggest:{if(!r.unstable_suggestNes)throw G.methodNotFound(e);let n=Cr.parse(t);return r.unstable_suggestNes(n)}case D.nes_close:{if(!r.unstable_closeNes)throw G.methodNotFound(e);let n=Vn.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw G.methodNotFound(e)}},a=async(e,t)=>{switch(e){case D.session_cancel:{let e=Bn.parse(t);return r.cancel(e)}case D.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Kn.parse(t);return r.unstable_didOpenDocument(e)}case D.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=jr.parse(t);return r.unstable_didChangeDocument(e)}case D.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Wn.parse(t);return r.unstable_didCloseDocument(e)}case D.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=qn.parse(t);return r.unstable_didSaveDocument(e)}case D.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Gn.parse(t);return r.unstable_didFocusDocument(e)}case D.nes_accept:{if(!r.unstable_acceptNes)return;let e=zn.parse(t);return r.unstable_acceptNes(e)}case D.nes_reject:{if(!r.unstable_rejectNes)return;let e=Qn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw G.methodNotFound(e)}};this.connection=new bi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(O.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(O.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(O.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(O.fs_write_text_file,e)??{}}async createTerminal(e){return new yi((await this.connection.sendRequest(O.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(O.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(O.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};_i=Symbol.asyncDispose;var yi=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(O.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(O.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(O.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(O.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[_i](){await this.release()}},bi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof p)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof p)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new G(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},G=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};ee(),_(),ve(),we(),ye(),oe(),ne(),ce(),se(),le(),me(),ke();function K(e,t){if(e)return t?Pe(e)?e:Fe(t,e):e}var xi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,Si={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function Ci(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=Si[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!xi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function wi(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ti=256;function Ei(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ti?t:`${t.slice(0,Ti-1)}…`}function q(e,t){if(!t)return e;let n=E.resolve(t),r=E.resolve(e);return r.startsWith(n+E.sep)||r===n?E.relative(n,r):e}function J(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return`${t}\n${e}${e.endsWith(`
|
|
4
|
-
`)?``:`
|
|
5
|
-
`}${t}`}function Y(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let e=i?.command??`Terminal`,t=i?.description;return{title:e,kind:`execute`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Read`:{let e=i?.file_path,t=e??`File`,r=i?.offset,a=i?.limit,o=``;a&&a>0?o=` (${r??1} - ${(r??1)+a-1})`:r&&(o=` (from line ${r})`);let s=t?q(t,n):`File`,c=K(e,n);return{title:`Read ${s}${o}`,kind:`read`,locations:c?[{path:c,line:r??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?q(e,n):void 0,a=K(e,n);return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:a?[{type:`diff`,path:a,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:a?[{path:a}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?q(e,n):void 0,o=K(e,n);return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:o?[{type:`diff`,path:o,oldText:t||null,newText:r}]:[],locations:o?[{path:o}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,r=K(e,n),a=`Find`;return e&&(a+=` \`${e}\``),t&&(a+=` \`${t}\``),{title:a,kind:`search`,content:[],locations:r?[{path:r}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function Di(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:Oi(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function Oi(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`resource_link`:{let t=e.uri;return{type:`resource_link`,uri:t,name:e.name??t,mimeType:e.mimeType}}case`resource`:{let t=e.resource;return{type:`resource`,resource:{uri:t?.uri??``,mimeType:t?.mimeType,...typeof t?.text==`string`?{text:t.text}:{},...typeof t?.blob==`string`?{blob:t.blob}:{}}}}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
|
|
6
|
-
`)||``)}case`text_editor_code_execution_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);default:try{return{type:`text`,text:JSON.stringify(e)}}catch{return{type:`text`,text:`[content]`}}}}function ki(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Di(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:J(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:J(e.text)}:Oi(e,!1)}))}:{};case`Bash`:{let e=``;if(i&&typeof i==`object`&&!Array.isArray(i)&&i.type===`bash_code_execution_result`){let t=i;e=[t.stdout,t.stderr].filter(Boolean).join(`
|
|
7
|
-
`)}else typeof i==`string`?e=i:Array.isArray(i)&&i.length>0&&(e=i.map(e=>e.type===`text`?e.text:``).join(`
|
|
8
|
-
`));return e.trim()?{content:[{type:`content`,content:{type:`text`,text:`\`\`\`console\n${e.trimEnd()}\n\`\`\``}}]}:{}}case`Edit`:case`Write`:return{};case`ExitPlanMode`:return{title:`Exited Plan Mode`};default:return Di(i??``,r)}}function Ai(e){return e===`in_progress`?`in_progress`:e===`completed`?`completed`:`pending`}function X(e,t,n,r,i,a,o){let s=[];for(let i of e){let e=i.type,a=null;switch(e){case`text`:case`text_delta`:{let e=i.text??``;a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`thinking`:case`thinking_delta`:{let e=i.thinking??``;a={sessionUpdate:`agent_thought_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`image`:{let e=i.source;e?.type===`base64`&&(a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`image`,data:e.data,mimeType:e.media_type}});break}case`tool_use`:case`server_tool_use`:case`mcp_tool_use`:{let t=i.id??``,n=i.name??`unknown`,s=i.input,c=t in r;if(r[t]={type:e,id:t,name:n,input:s},n===`TodoWrite`){let e=s?.todos;Array.isArray(e)&&(a={sessionUpdate:`plan`,entries:e.map(e=>({content:e.content,status:Ai(e.status),priority:`medium`}))})}else{let e=s?{...s}:{};a=c?{_meta:{workMate:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call_update`,status:`in_progress`,rawInput:e,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}:{_meta:{workMate:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call`,rawInput:e,status:`pending`,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}}break}case`tool_result`:case`mcp_tool_result`:{let e=i.tool_use_id??``,t=r[e];if(!t)break;if(t.name!==`TodoWrite`){let n=ki(i,{name:t.name,id:t.id},!1);a={_meta:{workMate:{toolName:t.name}},toolCallId:e,sessionUpdate:`tool_call_update`,status:i.is_error===!0?`failed`:`completed`,rawOutput:i.content,...n}}break}case`redacted_thinking`:case`input_json_delta`:case`citations_delta`:case`signature_delta`:case`container_upload`:case`compaction`:case`compaction_delta`:break}if(a){if(o?.parentToolUseId){let e=a._meta;a._meta={...e,workMate:{...e?.workMate??{},parentToolUseId:o.parentToolUseId}}}s.push({sessionId:n,update:a})}}return s}function ji(e,t,n,r,i){let a=e.message;if(!a)return[];let o=a.content;if(!o)return[];if(typeof o==`string`)return[{sessionId:t,update:{sessionUpdate:`agent_message_chunk`,...i?.messageId?{messageId:i.messageId}:{},content:{type:`text`,text:o}}}];let s=i?.streamingActive?o.filter(e=>e.type!==`text`&&e.type!==`thinking`):o;return s.length===0?[]:X(s,`assistant`,t,n,r,void 0,i)}function Mi(e,t,n,r,i){let a=e.event;if(!a)return[];switch(a.type){case`content_block_start`:{let o=a.content_block;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`content_block_delta`:{let o=a.delta;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`message_start`:case`message_delta`:case`message_stop`:case`content_block_stop`:return[];default:return[]}}function Ni(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;return n}function Pi(e,t){let n=null,r=0;for(let i of Object.keys(e)){let e=Ni(i,t);e>r&&(r=e,n=i)}return n?e[n]??null:null}var Fi=console;function Ii(e,t){if(t.aborted)return Promise.resolve({done:!0,value:void 0});let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e.next(),r]).finally(()=>{n&&t.removeEventListener(`abort`,n)})}async function Li(e,t,n,r,i,a,o,s){let c=`end_turn`,l={inputTokens:0,outputTokens:0,cachedReadTokens:0,cachedWriteTokens:0},u=null,d=null,f=2e5,p=!1,m=null;try{for(;!r.aborted;){let s=await Ii(t,r);if(s.done||r.aborted)break;let h=s.value;if(h==null)continue;let g=h;switch(g.type){case`system`:g.subtype===`compact_boundary`&&(u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
9
|
-
|
|
10
|
-
Compacting completed.`}}}));break;case`result`:{let t=g.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=g.modelUsage;if(i&&d){let e=Pi(i,d);e?.contextWindow&&(f=e.contextWindow)}u!==null&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:u,size:f}});let a=g.subtype,o=g.is_error;if(r.aborted){c=`cancelled`;break}switch(a){case`success`:{let e=g.stop_reason;c=e===`max_tokens`?`max_tokens`:e===`refusal`?`refusal`:`end_turn`,o&&(c=`end_turn`);break}case`error_during_execution`:c=g.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=g.parent_tool_use_id;t===null&&m===null&&(m=T());let r=Mi(g,e,i,n,{clientCapabilities:a,cwd:o,messageId:t===null?m??void 0:void 0});for(let e of r)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=g.message,r=g.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s;r===null&&(m===null&&(m=T()),s=m);let c=ji(g,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p,messageId:s});for(let e of c)await n.sessionUpdate(e);r===null&&(m=null);break}case`user`:break;case`progress`:{let t=g.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
11
|
-
|
|
12
|
-
Compacting completed.`}}});break;default:Fi.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function Ri(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Fi.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=T();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=X(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:T()});for(let e of t)await n.sessionUpdate(e)}}}function zi(e,t,n,r,i,a,o,s){return async(n,c,l,u,d,f)=>{let p=Vi(r);if(n.name===`ExitPlanMode`)return Bi(e,t,d,c,p,i,a,o,s);if(f!==void 0)return f;try{let e=await te(n,c,l,u,d);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:d}}let m=Y({name:n.name,id:d,input:c},p,i),h={toolCallId:d,title:m.title,kind:m.kind,status:`pending`,rawInput:c},g=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:h,options:g});if(n.outcome.outcome===`cancelled`)return s?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:d};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:c}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Bi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=Y({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Vi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}xe(),De(),fe(),_e(),e(),x();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`workmate`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{workMate:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||b(),n=await he(t),r=await de({dir:t}),i=[];for(let e of r){if(!e.cwd||await he(e.cwd)!==n)continue;let t=Ei(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Hi(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await C(e.sessionId);if(t)try{await Ne(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw G.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Hi(e){let t;try{let n=await S(e);n&&n.messages.length>0&&(t=w(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Ui=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Wi(e){return Ui.includes(e)}function Gi(e,t,n){if(t){let t=Ki(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Yi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return qi(n)??`default`}function Ki(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return Ci(e,t)}function qi(e){if(e!=null)try{return Ci(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Ji(e,t){return!!e&&Object.hasOwn(e,t)}function Yi(){return Xi()}function Xi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Zi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function Qi(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function $i(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}_();function ea(){return ge().permissions?.defaultMode}async function ta(e,t={}){be();let n=t.sessionId??T(),r=e.cwd;g(n,y()),v(r);let i=process.cwd(),a=!1;try{process.chdir(r),a=!0}catch{}h(),Oe();try{let i=Ce(),a=ae(i),o=e._meta,s=Ji(o,`permissionMode`),c=Gi(s?o?.permissionMode:void 0,s,ea()),l=$(this),u=this.conn,d=zi(u,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,l,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),f=Yi(),p={...ie(),toolPermissionContext:{...i,mode:c,isBypassPermissionsModeAvailable:f}},[m,h]=await Promise.all([re(r),pe(r)]);p.agentDefinitions=h;let g=new Te({cwd:r,tools:a,commands:m,mcpClients:[],agents:h.activeAgents,canUseTool:d,getAppState:()=>p,setAppState:e=>{let t=e(p);Object.assign(p,t)},readFileCache:new ue(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),_={currentModeId:c,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},...f?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},ee=Ee(),v=Se(),y={availableModels:ee.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:v};g.setModel(v);let b=Zi(_,y),te={queryEngine:g,cancelled:!1,cancelGeneration:0,cwd:r,modes:_,models:y,configOptions:b,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:l,appState:p,commands:m,sessionFingerprint:wi({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,te),{sessionId:n,modes:_,models:y,configOptions:b}}finally{a&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:ta}),x(),_(),_e();async function na(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(wi({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await C(e.sessionId,e.cwd);return g(e.sessionId,r?Ae(r.filePath):null),v(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await C(e.sessionId,e.cwd),i=r?Ae(r.filePath):null;g(e.sessionId,i),v(e.cwd);let a;if(r)try{let t=await S(e.sessionId);t&&t.messages.length>0&&(a=w(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let o=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await Ri(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:o.sessionId,modes:o.modes,models:o.models,configOptions:o.configOptions}}async function ra(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function ia(e){try{let t=await S(e.sessionId);if(!t||t.messages.length===0)return;let n=w(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await Ri(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function aa(e,t){if(!Wi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function oa(e,t,n){let r=this.sessions.get(e);r&&($i(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:na,teardownSession:ra,replaySessionHistory:ia,applySessionMode:aa,updateConfigOption:oa});function sa(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(ca(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
|
|
13
|
-
`)}function ca(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function la(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),ua(e),n}ua(e)}function ua(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}_();async function da(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=sa(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=T();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),g(e.sessionId,y());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Li(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await pa(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{workMate:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Work Mate Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=la(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=Qi(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),$i(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function pa(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=Ei(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:da,setSessionConfigOption:fa}),ye(),ke();function ma(e,t){let n=je.toWeb(e);return gi(Me.toWeb(t),n)}async function ha(){be(),Oe();let e=ma(process.stdin,process.stdout),t,n=new vi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ha as runAcpAgent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cc as e,dc as t,lc as n,uc as r}from"./loadAgentsDir-DR5PVAc3.js";t();export{e as drainPendingExtraction,n as executeExtractMemories,r as initExtractMemories};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./fast-DiolM1M7.js";t();export{n as FastModePicker,e as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,I as r,Lt as i,P as a,ai as o,di as s,fi as c,j as l,t as u,y as d}from"./src-WZ94ZKI3.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{AC as p,Bh as m,CC as h,EC as g,Hh as _,NC as v,OC as y,PC as b,TC as x,_y as S,gy as C,tb as w,vy as T,wC as E,zC as D,zh as O}from"./loadAgentsDir-DR5PVAc3.js";import{Vt as k,m as A,y as j}from"./settings-YIDksG5Z.js";import{d as M,o as N}from"./config-D3K87Mm1.js";import{n as P}from"./analytics-COpjZpvd.js";import{_ as F,l as I}from"./startupProfiler-DIM_Ihyp.js";import{n as L,t as R}from"./systemTheme-Ceakddth.js";function z({cooldown:e}){return e?(0,V.jsx)(a,{color:`promptBorder`,dimColor:!0,children:`↯`}):(0,V.jsx)(a,{color:`fastMode`,children:`↯`})}function B(e=!0,t=!1){if(!e)return`↯`;let n=L(N().theme);return t?s.dim(l(`promptBorder`,n)(`↯`)):l(`fastMode`,n)(`↯`)}var V,H=e((()=>{c(),k(),u(),M(),R(),V=f()}));function U(e,t){E(),j(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!b(e.mainLoopModel);return{...e,...t?{mainLoopModel:x(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function W({onDone:e,unavailableReason:t}){let o=m(e=>e.mainLoopModel),s=m(e=>e.fastMode),c=_(),[l,u]=(0,q.useState)(s??!1),f=g(),p=f.status===`cooldown`,v=t!==null,y=C(S(!0));function x(){v||(U(l,c),l?e(`${B(l)} Fast mode ON${b(o)?``:` · model set to ${h}`} · ${y}`):(c(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function w(){if(v){s&&U(!1,c),e(`Fast mode OFF`,{display:`system`});return}e(s?`${B()} Kept Fast mode ON`:`Kept Fast mode OFF`,{display:`system`})}function T(){v||u(e=>!e)}return n({"confirm:yes":x,"confirm:nextField":T,"confirm:next":T,"confirm:previous":T,"confirm:cycleMode":T,"confirm:toggle":T},{context:`Confirmation`}),(0,J.jsxs)(d,{title:(0,J.jsxs)(a,{children:[(0,J.jsx)(z,{cooldown:p}),` Fast mode (research preview)`]}),subtitle:`High-speed mode for ${h}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:w,color:`fastMode`,inputGuide:e=>e.pending?(0,J.jsxs)(a,{children:[`Press `,e.keyName,` again to exit`]}):v?(0,J.jsx)(a,{children:`Esc to cancel`}):(0,J.jsx)(a,{children:`Tab to toggle · Enter to confirm · Esc to cancel`}),children:[t?(0,J.jsx)(r,{marginLeft:2,children:(0,J.jsx)(a,{color:`error`,children:t})}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(r,{flexDirection:`column`,gap:0,marginLeft:2,children:(0,J.jsxs)(r,{flexDirection:`row`,gap:2,children:[(0,J.jsx)(a,{bold:!0,children:`Fast mode`}),(0,J.jsx)(a,{color:l?`fastMode`:void 0,bold:l,children:l?`ON `:`OFF`}),(0,J.jsx)(a,{dimColor:!0,children:y})]})}),p&&f.status===`cooldown`&&(0,J.jsx)(r,{marginLeft:2,children:(0,J.jsxs)(a,{color:`warning`,children:[f.reason===`overloaded`?`Fast mode overloaded and is temporarily unavailable`:`You've hit your fast limit`,` · resets in `,I(f.resetAt-Date.now(),{hideTrailingZeros:!0})]})})]}),(0,J.jsxs)(a,{dimColor:!0,children:[`Learn more:`,` `,(0,J.jsx)(i,{url:`https://code.workmate.com/docs/en/fast-mode`,children:`https://code.workmate.com/docs/en/fast-mode`})]})]})}async function G(e,t,n){let r=y();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return U(e,n),e?`${B(!0)} Fast mode ON${b(i)?``:` · model set to ${h}`} · ${C(S(!0))}`:`Fast mode OFF`}async function K(e,t,n){if(!v())return null;await D();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await G(r===`on`,t.getAppState,t.setAppState)),null;let i=y();return(0,J.jsx)(W,{onDone:e,unavailableReason:i})}var q,J,Y=e((()=>{q=t(o(),1),u(),H(),w(),P(),O(),p(),F(),T(),A(),J=f()}));export{H as a,B as i,K as n,Y as r,W as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{_ as t,h as n}from"./types-CD25a50S.js";import{c as r,i}from"./debug-kBjDaVkQ.js";import{Mt as a,Pt as o,W as s,dt as c,q as l,ut as u}from"./model-D42epddJ.js";import{n as d,r as f}from"./client-aJ2Nr_sh.js";async function p(){let e=a();try{switch(e){case`firstParty`:{let e=await u({maxRetries:1}),t=[];for await(let n of e.models.list())t.push({value:n.id,label:n.display_name??n.id,description:n.id});return t.length>0?t:null}case`openai`:{let e=d({maxRetries:1}),t=[];for await(let n of e.models.list())t.push({value:n.id,label:n.id,description:`via openai-compat`});return t.length>0?t:null}case`grok`:{let{getGrokClient:e}=await import(`./client-wPqIdEVm.js`),t=e({maxRetries:1}),n=[];for await(let e of t.models.list())n.push({value:e.id,label:e.id,description:`via grok`});return n.length>0?n:null}case`bedrock`:{let e=(await s()).map(e=>({value:e,label:e,description:`Bedrock inference profile`}));return e.length>0?e:null}case`gemini`:case`vertex`:case`foundry`:return null}}catch(t){return r(`[fetchModelList] ${e} failed: ${t instanceof Error?t.message:`unknown`}`),null}return null}var m,h,g=e((()=>{c(),f(),i(),n(),l(),o(),m=300*1e3,h=t(p,m)}));export{g as n,h as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./fetchModelList-BRFTQim4.js";e();export{t as fetchAvailableModels};
|
|
@@ -1,3 +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{m as i}from"./zod-CuNujUwx.js";import{Gn as a,Kn as o}from"./state-CXY-q5gr.js";import{Mt as s,Rt as c,_ as l,g as u,mn as d,p as f}from"./loadAgentsDir-DR5PVAc3.js";import{n as p,t as m}from"./cwd-DrEEb4f5.js";import{I as h,M as g,c as _,f as v,i as ee,u as y}from"./debug-kBjDaVkQ.js";import{Er as b,Nr as x,Pr as te,Qn as ne,er as re,m as ie,t as ae}from"./settings-YIDksG5Z.js";import{d as oe,o as se}from"./config-D3K87Mm1.js";import{o as ce,s as S}from"./log-DWZny1vM.js";import{i as le,n as ue}from"./execFileNoThrow-BfZFnCGa.js";import{n as de}from"./analytics-COpjZpvd.js";import{a as fe,s as pe}from"./ripgrep-D1f1pbCz.js";import*as C from"path";import{statSync as me}from"fs";function he(e,t,n){if(t===0)return n?D:0;let r=e.charCodeAt(t-1);return ge(r)?xe:_e(r)&&ve(e.charCodeAt(t))?T:0}function ge(e){return e===47||e===92||e===45||e===95||e===46||e===32}function _e(e){return e>=97&&e<=122}function ve(e){return e>=65&&e<=90}function w(){return new Promise(e=>setImmediate(e))}function ye(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var be,xe,T,E,D,O,k,A,j,M,N,Se=e((()=>{n(),be=16,xe=8,T=6,E=4,D=8,O=3,k=1,A=100,j=64,M=new Int32Array(j),N=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await w(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await w(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=ye(e,A)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,j),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*24+D+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:p,readyCount:m}=this;for(let e=0;e<m;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],m=a[0],h=0,g=[],_=r.indexOf(m);if(_===-1)continue;g[h++]=_;for(let e=_+1;e<r.length;e++){if(r.charCodeAt(e)!==m.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(g[h++]=e)}let v=u[e],ee=p[e],y=Math.max(0,32-(ee>>2)),b=-1/0;for(let e=0;e<h;e++){M[0]=g[e];let n=0,o=0,u=M[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}M[e]=t;let i=t-u-1;i===0?o+=E:n+=O+i*k,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*be+o-n;f+=he(v,M[0],!0);for(let e=1;e<i;e++)f+=he(v,M[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:v,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let h=c.length,g=Math.max(h,1),_=Array(h);for(let e=0;e<h;e++){let t=c[e].path,n=e/g;_[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return _}}}));function P(){return z||(z=new N),z}function Ce(){z=null,B=null,H++,U=null,W=[],G=[],K=[],V.clear(),q=null,J=null,Y=0,X=null,Z=null,Q=null}function F(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function we(){let e=b(m());if(!e)return null;try{return me(C.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function I(e,t,n){return n===t?e:e.map(e=>{let r=C.join(t,e);return C.relative(n,r)})}async function Te(e){if(e.length===0||!z||W.length===0)return;let t=await Oe(e),n=[...W,...G,...K,...e,...t],r=F(n);if(r===Q){_(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await z.loadFromFileListAsync(n).done,Q=r,_(`[FileIndex] rebuilt index with ${W.length} tracked + ${e.length} untracked files`)}async function Ee(e,t){let n=`${e}:${t}`;if(J===n)return q;let r=y(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,ze.default)(),s=!1,c=a.flatMap(e=>i.map(t=>C.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,_(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return q=u,J=n,u}async function De(e,t){let n=Date.now();_(`[FileIndex] getFilesUsingGit called`);let r=m(),i=b(r);if(!i)return _(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await ue(x(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(_(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return _(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=I(o.stdout.trim().split(`
|
|
2
|
-
`).filter(Boolean),i,r),c=await Ee(i,r);if(c){let e=s.length;s=c.filter(s),_(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}W=s;let l=Date.now()-n;if(_(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),s.length,s.length,!U){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=H;U=ue(x(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===H&&e.code===0){let t=I(e.stdout.trim().split(`
|
|
3
|
-
`).filter(Boolean),i,r),n=await Ee(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),_(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}_(`[FileIndex] background untracked fetch: ${t.length} files`),Te(t)}}).catch(e=>{_(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{U=null})}return s}catch(e){return _(`[FileIndex] git ls-files error: ${g(e)}`),null}}async function Oe(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)ke(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await w(),n=performance.now());return[...t].map(e=>e+C.sep)}function ke(e,t,n,r){for(let i=t;i<n;i++){let t=C.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=C.dirname(t);if(e===t)break;r.add(t),t=e}}}async function Ae(e){return(await Promise.all(f.map(t=>l(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function je(e,t){_(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await De(e,t);if(n!==null)return _(`[FileIndex] using git ls-files result (${n.length} files)`),n;_(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await pe(i,`.`,e)).map(e=>C.relative(m(),e)),o=Date.now()-r;return _(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),a.length,a}async function Me(){let e=AbortSignal.timeout(1e4),t=P();try{let n=ae(),r=se(),i=n.respectGitignore??r.respectGitignore??!0,a=m(),[o,s]=await Promise.all([je(e,i),Ae(a)]);G=s;let c=[...o,...s],l=await Oe(c);K=l;let u=[...l,...c],d=F(u);d===Z?_(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,Z=d,Q=null)}catch(e){S(e)}return t}function Ne(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function Pe(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=Ne(n,r),n===``)return``}return n}function L(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Fe(e,t){return e.search(t,$).map(e=>L(e.path,e.score))}function R(){if(B)return;let e=we();if(z&&!(e!==null&&e!==X)&&Date.now()-Y<Ve)return;let t=H,n=Date.now();P(),B=Me().then(r=>t===H?(B=null,V.emit(),X=e,Y=Date.now(),_(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(_(`[FileIndex] Cache refresh failed: ${g(e)}`),S(e),t===H&&(B=null),P()))}async function Ie(){let e=y(),t=m();try{return(await e.readdir(t)).map(e=>{let n=C.join(t,e.name),r=C.relative(t,n);return e.isDirectory()?r+C.sep:r})}catch(e){return S(e),[]}}async function Le(e,t=!1){if(!e&&!t)return[];if(ae().fileSuggestion?.type===`command`)return(await c({...s(),query:e})).slice(0,$).map(L);if(e===``||e===`.`||e===`./`){let e=await Ie();return R(),e.slice(0,$).map(L)}let n=Date.now();try{let t=B!==null;R();let r=e,i=`.${C.sep}`;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=ne(r));let a=z?Fe(z,r):[],o=Date.now()-n;return _(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),a.length,e.length,a}catch(e){return S(e),[]}}function Re(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var ze,z,B,V,Be,H,U,W,G,K,q,J,Y,X,Z,Q,$,Ve,He=e((()=>{ze=t(i(),1),u(),Se(),de(),oe(),p(),ee(),h(),le(),v(),te(),d(),ce(),re(),fe(),ie(),o(),z=null,B=null,V=a(),Be=V.subscribe,H=0,U=null,W=[],G=[],K=[],q=null,J=null,Y=0,X=null,Z=null,Q=null,$=15,Ve=5e3}));export{He as a,Le as i,Ce as n,Be as o,Pe as r,R as s,Re as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,l as n}from"./types-CD25a50S.js";import{Fx as r,GS as i,Ji as a,X as o,Z as s,ty as c}from"./loadAgentsDir-DR5PVAc3.js";import{I as l,M as u,c as d,i as f}from"./debug-kBjDaVkQ.js";import{r as p,t as m}from"./sessionTitle-k4wpUS5l.js";async function h(e,n){let a=m(e);if(!a)return null;try{let e=await s({systemPrompt:i([`Generate a short kebab-case name (2-4 words) that captures the main topic of this conversation. Use lowercase words separated by hyphens. Examples: "fix-login-bug", "add-auth-feature", "refactor-api-client", "debug-test-failures". Return JSON with a "name" field.`]),userPrompt:a,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{name:{type:`string`}},required:[`name`],additionalProperties:!1}},signal:n,options:{querySource:`rename_generate_name`,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,mcpTools:[]}}),o=t(Array.isArray(e.message.content)?r(e.message.content):e.message.content);return o&&typeof o==`object`&&`name`in o&&typeof o.name==`string`?o.name:null}catch(e){return d(`generateSessionName failed: ${u(e)}`,{level:`error`}),null}}var g=e((()=>{o(),f(),l(),n(),a(),p(),c()}));export{g as n,h as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{mn as e,on as t,qt as n}from"./loadAgentsDir-DR5PVAc3.js";e();export{n as executeSessionEndHooks,t as getSessionEndHookTimeoutMs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kn as i,s as a,t as o}from"./src-WZ94ZKI3.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{I as c,M as l,c as u,i as d}from"./debug-kBjDaVkQ.js";import{Kt as f,Ut as p,m,t as h,y as g}from"./settings-YIDksG5Z.js";import{n as _}from"./analytics-COpjZpvd.js";import{a as v,n as y,r as b,s as x,t as S}from"./nativeInstaller-ChGSz1lb.js";import{join as C}from"node:path";import{homedir as w}from"node:os";var T=e(r(),1);_(),o(),d(),f(),c(),S(),m();var E=s();function D(){let e=p.platform===`win32`,t=w();return e?C(t,`.local`,`bin`,`claude.exe`).replace(/\//g,`\\`):`~/.local/bin/claude`}function O({messages:e}){return e.length===0?null:(0,E.jsxs)(t,{flexDirection:`column`,gap:0,marginBottom:1,children:[(0,E.jsx)(t,{children:(0,E.jsxs)(n,{color:`warning`,children:[(0,E.jsx)(a,{status:`warning`,withSpace:!0}),`Setup notes:`]})}),e.map((e,r)=>(0,E.jsx)(t,{marginLeft:2,children:(0,E.jsxs)(n,{dimColor:!0,children:[`• `,e]})},r))]})}function k({onDone:e,force:r,target:i}){let[o,s]=(0,T.useState)({type:`checking`});return(0,T.useEffect)(()=>{async function e(){try{u(`Install: Starting installation process (force=${r}, target=${i})`);let e=i||h()?.autoUpdatesChannel||`latest`;s({type:`installing`,version:e}),u(`Install: Calling installLatest(channelOrVersion=${e}, forceReinstall=${r})`);let t=await x(e,r);if(u(`Install: installLatest returned version=${t.latestVersion}, wasUpdated=${t.wasUpdated}, lockFailed=${t.lockFailed}`),t.lockFailed)throw Error(`Could not install - another process is currently installing Work Mate. Please try again in a moment.`);t.latestVersion||u(`Install: Failed to retrieve version information during install`,{level:`error`}),t.wasUpdated||u(`Install: Already up to date`),s({type:`setting-up`});let n=await y(!0);u(`Install: Setup launcher completed with ${n.length} messages`),n.length>0&&n.forEach(e=>u(`Install: Setup message: ${e.message}`)),u(`Install: Cleaning up npm installations after successful install`);let{removed:a,errors:o,warnings:c}=await b();a>0&&u(`Cleaned up ${a} npm installation(s)`),o.length>0&&u(`Cleanup errors: ${o.join(`, `)}`);let l=await v();l.length>0&&u(`Shell alias cleanup: ${l.map(e=>e.message).join(`; `)}`),+!!t.latestVersion,(i===`latest`||i===`stable`)&&(g(`userSettings`,{autoUpdatesChannel:i}),u(`Install: Saved autoUpdatesChannel=${i} to user settings`));let d=[...c,...l.map(e=>e.message)];n.length>0?(s({type:`set-up`,messages:n.map(e=>e.message)}),setTimeout(s,2e3,{type:`success`,version:t.latestVersion||`current`,setupMessages:[...n.map(e=>e.message),...d]})):(u(`Install: Shell PATH already configured`),s({type:`success`,version:t.latestVersion||`current`,setupMessages:d.length>0?d:void 0}))}catch(e){u(`Install command failed: ${e}`,{level:`error`}),s({type:`error`,message:l(e)})}}e()},[r,i]),(0,T.useEffect)(()=>{o.type===`success`?setTimeout(e,2e3,`Work Mate installation completed successfully`,{display:`system`}):o.type===`error`&&setTimeout(e,3e3,`Work Mate installation failed`,{display:`system`})},[o,e]),(0,E.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[o.type===`checking`&&(0,E.jsx)(n,{color:`claude`,children:`Checking installation status...`}),o.type===`cleaning-npm`&&(0,E.jsx)(n,{color:`warning`,children:`Cleaning up old npm installations...`}),o.type===`installing`&&(0,E.jsxs)(n,{color:`claude`,children:[`Installing Work Mate native build `,o.version,`...`]}),o.type===`setting-up`&&(0,E.jsx)(n,{color:`claude`,children:`Setting up launcher and shell integration...`}),o.type===`set-up`&&(0,E.jsx)(O,{messages:o.messages}),o.type===`success`&&(0,E.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,E.jsxs)(t,{children:[(0,E.jsx)(a,{status:`success`,withSpace:!0}),(0,E.jsx)(n,{color:`success`,bold:!0,children:`Work Mate successfully installed!`})]}),(0,E.jsxs)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:[o.version!==`current`&&(0,E.jsxs)(t,{children:[(0,E.jsx)(n,{dimColor:!0,children:`Version: `}),(0,E.jsx)(n,{color:`claude`,children:o.version})]}),(0,E.jsxs)(t,{children:[(0,E.jsx)(n,{dimColor:!0,children:`Location: `}),(0,E.jsx)(n,{color:`text`,children:D()})]})]}),(0,E.jsx)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:(0,E.jsxs)(t,{marginTop:1,children:[(0,E.jsx)(n,{dimColor:!0,children:`Next: Run `}),(0,E.jsx)(n,{color:`claude`,bold:!0,children:`claude --help`}),(0,E.jsx)(n,{dimColor:!0,children:` to get started`})]})}),o.setupMessages&&(0,E.jsx)(O,{messages:o.setupMessages})]}),o.type===`error`&&(0,E.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,E.jsxs)(t,{children:[(0,E.jsx)(a,{status:`error`,withSpace:!0}),(0,E.jsx)(n,{color:`error`,children:`Installation failed`})]}),(0,E.jsx)(n,{color:`error`,children:o.message}),(0,E.jsx)(t,{marginTop:1,children:(0,E.jsx)(n,{dimColor:!0,children:`Try running with --force to override checks`})})]})]})}var A={type:`local-jsx`,name:`install`,description:`安装 Work Mate 原生构建`,argumentHint:`[options]`,async call(e,t,n){let r=n.includes(`--force`),a=n.filter(e=>!e.startsWith(`--`))[0],{unmount:o}=await i((0,E.jsx)(k,{onDone:(t,n)=>{o(),e(t,n)},force:r,target:a}))}};export{A as install};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./loadAgentsDir-DR5PVAc3.js";e();export{t as clearAgentDefinitionsCache};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DZ_SvEVz.js";import{N as r,S as i,W as a,X as o,k as s}from"./types-CD25a50S.js";import{o as c,s as l}from"./log-DWZny1vM.js";import{dirname as u,join as d}from"path";import{existsSync as f,readFileSync as p,renameSync as m,unlinkSync as h,writeFileSync as g}from"fs";import{randomBytes as _}from"node:crypto";var v=e((()=>{i(),i()})),y,b,x,S=e((()=>{v(),y=s([`openai-compat`,`anthropic-compat`]),b=a({id:o().min(1).regex(/^[a-z0-9-]+$/,`id must be kebab-case`),kind:y,baseUrl:o().url(),apiKey:o().min(1).optional(),apiKeyEnv:o().min(1).optional(),defaultModel:o().min(1).default(`gpt-4o-mini`)}).refine(e=>!!e.apiKey||!!e.apiKeyEnv,`either apiKey or apiKeyEnv is required`),x=r(b)}));function C(){return d(t(),`providers.json`)}function w(){k=null}function T(){if(k!==null)return k;let e=E();return k=e.providers,e.providers}function E(){let e=C();if(!f(e))return{providers:[]};let t;try{t=p(e,`utf-8`)}catch(t){let n=`loadProviders: failed to read ${e}: ${t instanceof Error?t.message:String(t)}`;return l(Error(n)),{providers:[],error:n}}if(!t.trim())return{providers:[]};let n;try{n=JSON.parse(t)}catch{let t=`loadProviders: ${e} is not valid JSON. Ignoring.`;return l(Error(t)),{providers:[],error:t}}let r=x.safeParse(n);if(!r.success){let t=`loadProviders: ${e} failed schema validation: ${r.error.message}. Ignoring.`;return l(Error(t)),{providers:[],error:t}}return{providers:r.data}}function D(e,t){return(t??T()).find(t=>t.id===e)}function O(e){let t=C(),n=d(u(t),`.providers-${_(8).toString(`hex`)}.tmp`);try{g(n,JSON.stringify(e,null,2),`utf-8`),m(n,t)}catch(e){try{h(n)}catch{}throw e}return w(),e}var k,A=e((()=>{c(),n(),S(),k=null}));export{v as a,O as i,A as n,T as r,D as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,o as t,s as n,t as r}from"./localSearch-CzkxDuOR.js";t();export{r as clearSkillIndexCache,e as getSkillIndex,n as searchSkills};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./managedEnv-Do9fgLpk.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{D as t,H as n,I as r,P as i,T as a,ai as o,j as s,kn as c,t as l,y as ee}from"./src-WZ94ZKI3.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{d,l as f}from"./types-CD25a50S.js";import{$d as p,Ad as m,Df as h,Hd as g,Id as _,Lh as te,Of as ne,Pd as re,Qd as v,Vd as y,cf as b,gi as x,hd as S,md as C,mf as w,mi as T,nf as E,of as D,sf as O,uf as k,zh as A}from"./loadAgentsDir-DR5PVAc3.js";import{I as j,z as M}from"./debug-kBjDaVkQ.js";import{a as N,d as P,m as F,o as I}from"./config-D3K87Mm1.js";import{n as L,o as R}from"./process-gEbdy6uY.js";import{i as z,n as B}from"./platform-Vl9IynC3.js";import{n as V}from"./analytics-COpjZpvd.js";import{l as H,o as U}from"./stringUtils-D_xPrwGQ.js";import{n as ie,t as W}from"./SelectMulti-BpAjjhsn.js";import{t as G}from"./KeybindingProviderSetup-CSUkJHTT.js";import{n as K,t as q}from"./exit-s9XGerrH.js";import{stat as J}from"fs/promises";import{cwd as Y}from"process";h();var X=e(o(),1);x(),L(),l(),k(),U(),S(),ie();var Z=u();function ae({servers:e,scope:o,onDone:c}){let l=Object.keys(e),[u,d]=(0,X.useState)({});(0,X.useEffect)(()=>{D().then(({servers:e})=>d(e))},[]);let f=l.filter(e=>u[e]!==void 0);async function p(t){let n=0;for(let r of t){let t=e[r];if(t){let e=r;if(u[e]!==void 0){let t=1;for(;u[`${r}_${t}`]!==void 0;)t++;e=`${r}_${t}`}await E(e,t,o),n++}}h(n)}let[m]=n(),h=(0,X.useCallback)(e=>{R(e>0?`\n${s(`success`,m)(`Successfully imported ${e} MCP ${H(e,`server`)} to ${o} config.`)}\n`:`
|
|
2
|
-
No servers were imported.`),c(),T()},[m,o,c]),g=(0,X.useCallback)(()=>{h(0)},[h]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ee,{title:`Import MCP Servers from Work Mate Desktop`,subtitle:`Found ${l.length} MCP ${H(l.length,`server`)} in Work Mate Desktop.`,color:`success`,onCancel:g,hideInputGuide:!0,children:[f.length>0&&(0,Z.jsx)(i,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(i,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(W,{options:l.map(e=>({label:`${e}${f.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:l.filter(e=>!f.includes(e)),onSubmit:p,onCancel:g,hideIndexes:!0})]}),(0,Z.jsx)(r,{paddingX:1,children:(0,Z.jsx)(i,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(a,{children:[(0,Z.jsx)(t,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(t,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}l(),V(),_(),k(),p(),A(),P(),j(),x(),f(),z();async function Q(e,t){try{let n=await m(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function oe({debug:e,verbose:t}){let n=Y();try{await J(n)}catch(e){throw M(e)&&q(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-BBvZyrfz.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-CZBTxbhu.js`);await i(n,e??!1,t??!1)}catch(e){q(`Error: Failed to start MCP server: ${e}`)}}async function se(e,t){O(e);try{if(t.scope){let n=g(t.scope);await w(e,n),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),K(`File modified: ${y(n)}`)}let n=N(),r=I(),{servers:i}=b(`project`),a=!!i[e],o=[];if(n.mcpServers?.[e]&&o.push(`local`),a&&o.push(`project`),r.mcpServers?.[e]&&o.push(`user`),o.length===0)q(`No MCP server found with name: "${e}"`);else if(o.length===1){let t=o[0];await w(e,t),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),K(`File modified: ${y(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),o.forEach(e=>{process.stderr.write(` - ${v(e)} (${y(e)})\n`)}),process.stderr.write(`
|
|
3
|
-
To remove from a specific scope, use:
|
|
4
|
-
`),o.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),q()}catch(e){q(e.message)}}async function ce(){let{servers:e}=await D();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
-
`);let t=await ne(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:re()});for(let{name:e,server:n,status:r}of t)if(n.type===`sse`)console.log(`${e}: ${n.url} (SSE) - ${r}`);else if(n.type===`http`)console.log(`${e}: ${n.url} (HTTP) - ${r}`);else if(n.type===`claudeai-proxy`)console.log(`${e}: ${n.url} - ${r}`);else if(!n.type||n.type===`stdio`){let t=n,i=Array.isArray(t.args)?t.args:[];console.log(`${e}: ${t.command} ${i.join(` `)} - ${r}`)}}await T(0)}async function le(e){let t=O(e);t||q(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${v(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await T(0)}async function $(e,t,n){try{let r=g(n.scope),i=d(t);await E(e,i,r),K(`Added ${i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`} MCP server ${e} to ${r} config`)}catch(e){q(e.message)}}async function ue(e){try{let t=g(e.scope);B();let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-g8eUUY2E.js`),r=await n();Object.keys(r).length===0&&K(`No MCP servers found in Work Mate Desktop configuration or configuration file does not exist.`);let{unmount:i}=await c((0,Z.jsx)(te,{children:(0,Z.jsx)(G,{children:(0,Z.jsx)(ae,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){q(e.message)}}async function de(){F(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),K(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
-
You will be prompted for approval next time you start Work Mate.`)}export{ue as mcpAddFromDesktopHandler,$ as mcpAddJsonHandler,le as mcpGetHandler,ce as mcpListHandler,se as mcpRemoveHandler,de as mcpResetChoicesHandler,oe as mcpServeHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DZ_SvEVz.js";import{I as i,Lt as a,P as o,Wt as s,_ as c,ai as l,di as ee,fi as u,t as d,y as f}from"./src-WZ94ZKI3.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as m,q as h}from"./state-CXY-q5gr.js";import{Bh as g,Dy as _,Kl as v,dw as te,fc as y,ky as b,pc as ne,pw as x,ql as re,tb as S,wy as C,xu as ie,yu as w,zh as T}from"./loadAgentsDir-DR5PVAc3.js";import{n as E,t as D}from"./cwd-DrEEb4f5.js";import{I as O,N as k}from"./debug-kBjDaVkQ.js";import{Cn as A,Er as j,Pr as M,bn as ae,m as N,y as P}from"./settings-YIDksG5Z.js";import{C as F,T as I,b as oe}from"./config-D3K87Mm1.js";import{o as L,s as se}from"./log-DWZny1vM.js";import{n as ce}from"./analytics-COpjZpvd.js";import{_ as le,p as R}from"./startupProfiler-DIM_Ihyp.js";import{n as z,t as B}from"./useExitOnCtrlCDWithKeybindings-BgJrnuDl.js";import{t as V}from"./select-FrwoTzuc.js";import{r as H,t as U}from"./promptEditor-CpUFgGzc.js";import{t as ue}from"./CustomSelect-CpMbxYbt.js";import{homedir as de}from"os";import{join as W,relative as fe}from"path";import{mkdir as G,writeFile as pe}from"fs/promises";function me(e){return j(e)!==null}var he=e((()=>{M()}));function ge({onSelect:e,onCancel:t}){let r=(0,K.use)(_()),a=W(n(),`AGENTS.md`),l=W(h(),`AGENTS.md`),u=r.some(e=>e.path===a),d=r.some(e=>e.path===l),f=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...u?[]:[{path:a,type:`User`,content:``,exists:!1}],...d?[]:[{path:l,type:`Project`,content:``,exists:!1}]],p=new Map,m=f.map(e=>{let t=ae(e.path),n=e.exists?``:` (new)`,r=e.parent?(p.get(e.parent)??0)+1:0;p.set(e.path,r);let i=r>0?` `.repeat(r-1):``,o;o=e.type===`User`&&!e.isNested&&e.path===a?`User memory`:e.type===`Project`&&!e.isNested&&e.path===l?`Project memory`:r>0?`${i}L ${t}${n}`:`${t}`;let s,c=me(h());return s=e.type===`User`&&!e.isNested?`Saved in ~/.workmate/AGENTS.md`:e.type===`Project`&&!e.isNested&&e.path===l?`${c?`Checked in at`:`Saved in`} ./AGENTS.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:o,value:e.path,description:s}}),v=[],y=g(e=>e.agentDefinitions);if(I()){v.push({label:`Open auto-memory folder`,value:`${Y}${oe()}`,description:``});for(let e of y.activeAgents)if(e.memory){let t=te(e.agentType,e.memory);v.push({label:`Open ${ee.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}m.push(...v);let b=J&&m.some(e=>e.value===J)?J:m[0]?.value||``,[x,S]=(0,K.useState)(I),[C,w]=(0,K.useState)(ne),[T]=(0,K.useState)(I),E=g(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[D,O]=(0,K.useState)(null);(0,K.useEffect)(()=>{T&&re().then(O)},[T,E]);let k=E?`running`:D===null?``:D===0?`never`:`last ran ${R(new Date(D))}`,[A,j]=(0,K.useState)(null),M=A!==null,N=+!!T;function F(){let e=!x;P(`userSettings`,{autoMemoryEnabled:e}),S(e)}function L(){let e=!C;P(`userSettings`,{autoDreamEnabled:e}),w(e)}return z(),s(`confirm:no`,t,{context:`Confirmation`}),s(`confirm:yes`,()=>{A===0?F():A===1&&L()},{context:`Confirmation`,isActive:M}),s(`select:next`,()=>{j(e=>e!==null&&e<N?e+1:null)},{context:`Select`,isActive:M}),s(`select:previous`,()=>{j(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:M}),(0,q.jsxs)(i,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(c,{isFocused:A===0,children:(0,q.jsxs)(o,{children:[`Auto-memory: `,x?`on`:`off`]})}),T&&(0,q.jsx)(c,{isFocused:A===1,styled:!1,children:(0,q.jsxs)(o,{color:A===1?`suggestion`:void 0,children:[`Auto-dream: `,C?`on`:`off`,k&&(0,q.jsxs)(o,{dimColor:!0,children:[` · `,k]}),!E&&C&&(0,q.jsx)(o,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(V,{defaultFocusValue:b,options:m,isDisabled:M,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>ie(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>j(N)})]})}var K,q,J,Y,X=e((()=>{u(),K=t(l(),1),m(),B(),d(),S(),F(),ce(),y(),v(),T(),x(),w(),b(),r(),A(),le(),he(),N(),ue(),q=p(),Y=`__open_folder__`}));function _e(e){let t=de(),n=D(),r=e.startsWith(t)?`~${e.slice(t.length)}`:null,i=e.startsWith(n)?`./${fe(n,e)}`:null;return r&&i?r.length<=i.length?r:i:r||i||e}var ve=e((()=>{d(),E(),p()}));function ye({onDone:e}){let t=async t=>{try{t.includes(n())&&await G(n(),{recursive:!0});try{await pe(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(k(e)!==`EEXIST`)throw e}await U(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r==="default"?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${_e(t)}\n\n${o}`,{display:`system`})}catch(t){se(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(f,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(i,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(ge,{onSelect:t,onCancel:r})}),(0,Q.jsx)(i,{marginTop:1,children:(0,Q.jsxs)(o,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(a,{url:`https://code.workmate.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(l(),1),d(),X(),ve(),b(),r(),O(),L(),H(),Q=p(),$=async e=>(C(),await _(),(0,Q.jsx)(ye,{onDone:e}))}))();export{$ as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o,r as ee,t as s}from"./envUtils-DZ_SvEVz.js";import{N as c,U as l,W as u,X as te,b as d,d as f,l as p,o as ne,s as re}from"./types-CD25a50S.js";import{G as m,Pt as ie,Sn as ae,U as oe,at as se,vr as ce,yr as le}from"./state-CXY-q5gr.js";import{C as ue,H as de,U as fe,c as h,i as pe,o as g,x as me}from"./debug-kBjDaVkQ.js";import{d as he,m as _,t as ge}from"./settings-YIDksG5Z.js";import{d as _e,o as ve}from"./config-D3K87Mm1.js";import{d as ye,f as be,o as xe,s as v}from"./log-DWZny1vM.js";import{n as Se,o as Ce}from"./stringUtils-D_xPrwGQ.js";import{c as we,i as Te,r as Ee}from"./proxy-BtWuysHM.js";import{join as De}from"path";import{readFileSync as Oe}from"fs";import{randomUUID as ke}from"crypto";import{mkdir as Ae,writeFile as je}from"fs/promises";import{AsyncLocalStorage as Me}from"async_hooks";function y(e=ge()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:a(process.env.WORKMATE_USE_BEDROCK)?`bedrock`:a(process.env.WORKMATE_USE_VERTEX)?`vertex`:a(process.env.WORKMATE_USE_FOUNDRY)?`foundry`:a(process.env.WORKMATE_USE_OPENAI)?`openai`:a(process.env.WORKMATE_USE_GEMINI)?`gemini`:a(process.env.WORKMATE_USE_GROK)?`grok`:`firstParty`}function Ne(){return y()}function b(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{return new URL(e).host===`api.anthropic.com`}catch{return!1}}var x=e((()=>{_(),o()}));function Pe(){return S.getStore()?.workload}function Fe(e,t){return S.run({workload:e},t)}var S,Ie=e((()=>{S=new Me})),Le,C,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye=e((()=>{Le=`workmate-20250219`,C=`interleaved-thinking-2025-05-14`,Re=`context-1m-2025-08-07`,ze=`context-management-2025-06-27`,Be=`structured-outputs-2025-12-15`,Ve=`tool-search-tool-2025-10-19`,He=`task-budgets-2026-03-13`,Ue=`prompt-caching-scope-2026-01-05`,We=`fast-mode-2026-02-01`,Ge=`redact-thinking-2026-02-12`,Ke=`advisor-tool-2026-03-01`,qe=new Set([C,Re,Ve]),Je=new Set([Le,C,ze])}));function Xe(e,t){return ce(e,t)}var Ze=e((()=>{le()}));function Qe(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=Pe(),r=n?`, workload/${n}`:``;return`claude-cli/0.0.26 (external, ${process.env.WORKMATE_ENTRYPOINT??`cli`}${e}${t}${r})`}function $e(){let e=[];return process.env.WORKMATE_ENTRYPOINT&&e.push(process.env.WORKMATE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`workmate/0.0.26${e.length>0?` (${e.join(`, `)})`:``}`}var et=e((()=>{Ie()}));function w(){return{error:(e,...t)=>console.error(`[SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[SDK DEBUG]`,e,...t)}}async function tt({apiKey:e,maxRetries:n,model:r,fetchOverride:i,source:o}){let c=process.env.WORKMATE_CONTAINER_ID,l=process.env.WORKMATE_REMOTE_SESSION_ID,u=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,te=nt(),d={"x-app":`cli`,"User-Agent":Qe(),"X-Work-Mate-Session-Id":se(),...te,...c?{"x-claude-remote-container-id":c}:{},...l?{"x-claude-remote-session-id":l}:{},...u?{"x-client-app":u}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};h(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!te.Authorization}`),a(process.env.WORKMATE_ADDITIONAL_PROTECTION)&&(d[`x-anthropic-additional-protection`]=`true`);let f=rt(i,o),p={defaultHeaders:d,maxRetries:n,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:Te({forAnthropicAPI:!0}),...f&&{fetch:f}};if(a(process.env.WORKMATE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-CfiDN-kF.js`),t=r===sn()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:s(),n={...p,awsRegion:t,...a(process.env.WORKMATE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...g()&&{logger:w()}};return process.env.AWS_BEARER_TOKEN_BEDROCK&&(n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`}),new e(n)}if(a(process.env.WORKMATE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BdeF2aBu.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(a(process.env.WORKMATE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-DUH16IqH.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...p,...t&&{azureADTokenProvider:t},...g()&&{logger:w()}})}if(a(process.env.WORKMATE_USE_VERTEX)){let[{AnthropicVertex:e},{GoogleAuth:n}]=await Promise.all([import(`./vertex-sdk-DjXcZ2J7.js`),import(`./src-C8gyNm5a.js`).then(e=>t(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,o=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,s=a(process.env.WORKMATE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new n({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||o?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...p,region:ee(r),googleAuth:s,...g()&&{logger:w()}})}return new fe({...e?{apiKey:e}:{},...p,...g()&&{logger:w()}})}function nt(){let e={},t=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!t)return e;let n=t.split(/\n|\r\n/);for(let t of n){if(!t.trim())continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n).trim(),i=t.slice(n+1).trim();r&&(e[r]=i)}return e}function rt(e,t){let n=e??globalThis.fetch,r=y()===`firstParty`&&b();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(T,ke());try{let n=e instanceof Request?e.url:String(e),r=a.get(T);h(`[API REQUEST] ${new URL(n).pathname}${r?` ${T}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var T,it=e((()=>{de(),et(),$(),x(),we(),ie(),pe(),o(),T=`x-client-request-id`}));function at(){return De(i(),`cache`)}function ot(){return De(at(),`model-capabilities.json`)}function st(){return!(y()!==`firstParty`||!b())}function ct(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function lt(e){if(!st())return;let t=D(ot());if(!t||t.length===0)return;let n=e.toLowerCase();return t.find(e=>e.id.toLowerCase()===n)||t.find(e=>n.includes(e.id.toLowerCase()))}async function ut(){if(st()&&!be())try{let e=await tt({maxRetries:1}),t=[];for await(let n of e.models.list()){let e=E().safeParse(n);e.success&&t.push(e.data)}if(t.length===0)return;let n=ot(),r=ct(t);if(Xe(D(n),r)){h(`[modelCapabilities] cache unchanged, skipping write`);return}await Ae(at(),{recursive:!0}),await je(n,ue({models:r,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),D.cache.delete(n),h(`[modelCapabilities] cached ${r.length} models`)}catch(e){h(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var E,dt,D,ft=e((()=>{Ze(),r(),d(),it(),pe(),o(),p(),ne(),ye(),me(),x(),E=re(()=>u({id:te(),max_input_tokens:l().optional(),max_tokens:l().optional()}).strip()),dt=re(()=>u({models:c(E()),timestamp:l()})),D=n(e=>{try{let t=Oe(e,`utf-8`),n=dt().safeParse(f(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function O(){return a(process.env.WORKMATE_DISABLE_1M_CONTEXT)}function k(e){return!O()&&/\[1m\]/i.test(e)}function pt(e){if(O())return!1;let t=Z(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function mt(e,t){if(k(e))return 1e6;let n=lt(e);return n?.max_input_tokens&&n.max_input_tokens>=1e5?n.max_input_tokens>2e5&&O()?A:n.max_input_tokens:t?.includes(`context-1m-2025-08-07`)&&pt(e)||ht(e)?1e6:A}function ht(e){return O()||k(e)||!Z(e).includes(`sonnet-4-6`)?!1:ve().clientDataCache?.coral_reef_sonnet===`true`}function gt(e,t){if(!e)return{used:null,remaining:null};let n=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;if(n===0)return{used:null,remaining:null};let r=Math.round(n/t*100),i=Math.min(100,Math.max(0,r));return{used:i,remaining:100-i}}function _t(e){let t,n,r=Z(e);r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=bt,n=xt);let i=lt(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function vt(e){return _t(e).upperLimit-1}var A,yt,bt,xt,St,Ct=e((()=>{Ye(),_e(),o(),$(),ft(),A=2e5,yt=2e4,bt=32e3,xt=64e3,St=8e3}));function wt(e){let t=[],n=!1;async function r(){if(!n&&t.length!==0){for(n=!0;t.length>0;){let{args:n,resolve:r,reject:i,context:a}=t.shift();try{r(await e.apply(a,n))}catch(e){i(e)}}n=!1,t.length>0&&r()}}return function(...e){return new Promise((n,i)=>{t.push({args:e,resolve:n,reject:i,context:this}),r()})}}var Tt=e((()=>{}));function Et(e,t){return e.find(e=>e.includes(t))??null}async function Dt(){let{BedrockClient:e}=await import(`./dist-es-BXXmyhQ2.js`),t=s(),n=a(process.env.WORKMATE_SKIP_BEDROCK_AUTH);return new e({region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Ee(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}})}async function Ot(){let{BedrockRuntimeClient:e}=await import(`./dist-es-CzTYn7xo.js`),t=s(),n=a(process.env.WORKMATE_SKIP_BEDROCK_AUTH);return new e({region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Ee(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}})}function kt(e){return e.startsWith(`anthropic.`)}function At(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function jt(e){let t=At(e);for(let e of Pt)if(t.startsWith(`${e}.anthropic.`))return e}function Mt(e,t){let n=jt(e);return n?e.replace(`${n}.`,`${t}.`):kt(e)?`${t}.${e}`:e}var j,Nt,Pt,Ft=e((()=>{r(),o(),xe(),we(),j=n(async()=>{let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Dt(),import(`./dist-es-BXXmyhQ2.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw v(e),e}}),Nt=n(async e=>{try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Dt(),import(`./dist-es-BXXmyhQ2.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return v(e),null}}),Pt=[`us`,`eu`,`apac`,`global`]})),M,N,P,F,I,L,R,z,B,It,Lt,Rt,V,zt,Bt=e((()=>{M={firstParty:`claude-3-7-sonnet-20250219`,bedrock:`us.anthropic.claude-3-7-sonnet-20250219-v1:0`,vertex:`claude-3-7-sonnet@20250219`,foundry:`claude-3-7-sonnet`,openai:`claude-3-7-sonnet-20250219`,gemini:`claude-3-7-sonnet-20250219`,grok:`claude-3-7-sonnet-20250219`},N={firstParty:`claude-3-5-sonnet-20241022`,bedrock:`anthropic.claude-3-5-sonnet-20241022-v2:0`,vertex:`claude-3-5-sonnet-v2@20241022`,foundry:`claude-3-5-sonnet`,openai:`claude-3-5-sonnet-20241022`,gemini:`claude-3-5-sonnet-20241022`,grok:`claude-3-5-sonnet-20241022`},P={firstParty:`claude-3-5-haiku-20241022`,bedrock:`us.anthropic.claude-3-5-haiku-20241022-v1:0`,vertex:`claude-3-5-haiku@20241022`,foundry:`claude-3-5-haiku`,openai:`claude-3-5-haiku-20241022`,gemini:`claude-3-5-haiku-20241022`,grok:`claude-3-5-haiku-20241022`},F={firstParty:`claude-haiku-4-5-20251001`,bedrock:`us.anthropic.claude-haiku-4-5-20251001-v1:0`,vertex:`claude-haiku-4-5@20251001`,foundry:`claude-haiku-4-5`,openai:`claude-haiku-4-5-20251001`,gemini:`claude-haiku-4-5-20251001`,grok:`claude-haiku-4-5-20251001`},I={firstParty:`claude-sonnet-4-20250514`,bedrock:`us.anthropic.claude-sonnet-4-20250514-v1:0`,vertex:`claude-sonnet-4@20250514`,foundry:`claude-sonnet-4`,openai:`claude-sonnet-4-20250514`,gemini:`claude-sonnet-4-20250514`,grok:`claude-sonnet-4-20250514`},L={firstParty:`claude-sonnet-4-5-20250929`,bedrock:`us.anthropic.claude-sonnet-4-5-20250929-v1:0`,vertex:`claude-sonnet-4-5@20250929`,foundry:`claude-sonnet-4-5`,openai:`claude-sonnet-4-5-20250929`,gemini:`claude-sonnet-4-5-20250929`,grok:`claude-sonnet-4-5-20250929`},R={firstParty:`claude-opus-4-20250514`,bedrock:`us.anthropic.claude-opus-4-20250514-v1:0`,vertex:`claude-opus-4@20250514`,foundry:`claude-opus-4`,openai:`claude-opus-4-20250514`,gemini:`claude-opus-4-20250514`,grok:`claude-opus-4-20250514`},z={firstParty:`claude-opus-4-1-20250805`,bedrock:`us.anthropic.claude-opus-4-1-20250805-v1:0`,vertex:`claude-opus-4-1@20250805`,foundry:`claude-opus-4-1`,openai:`claude-opus-4-1-20250805`,gemini:`claude-opus-4-1-20250805`,grok:`claude-opus-4-1-20250805`},B={firstParty:`claude-opus-4-5-20251101`,bedrock:`us.anthropic.claude-opus-4-5-20251101-v1:0`,vertex:`claude-opus-4-5@20251101`,foundry:`claude-opus-4-5`,openai:`claude-opus-4-5-20251101`,gemini:`claude-opus-4-5-20251101`,grok:`claude-opus-4-5-20251101`},It={firstParty:`claude-opus-4-6`,bedrock:`us.anthropic.claude-opus-4-6-v1`,vertex:`claude-opus-4-6`,foundry:`claude-opus-4-6`,openai:`claude-opus-4-6`,gemini:`claude-opus-4-6`,grok:`claude-opus-4-6`},Lt={firstParty:`claude-opus-4-7`,bedrock:`us.anthropic.claude-opus-4-7-v1`,vertex:`claude-opus-4-7`,foundry:`claude-opus-4-7`,openai:`claude-opus-4-7`,gemini:`claude-opus-4-7`,grok:`claude-opus-4-7`},Rt={firstParty:`claude-sonnet-4-6`,bedrock:`us.anthropic.claude-sonnet-4-6`,vertex:`claude-sonnet-4-6`,foundry:`claude-sonnet-4-6`,openai:`claude-sonnet-4-6`,gemini:`claude-sonnet-4-6`,grok:`claude-sonnet-4-6`},V={haiku35:P,haiku45:F,sonnet35:N,sonnet37:M,sonnet40:I,sonnet45:L,sonnet46:Rt,opus40:R,opus41:z,opus45:B,opus46:It,opus47:Lt},Object.values(V).map(e=>e.firstParty),zt=Object.fromEntries(Object.entries(V).map(([e,t])=>[t.firstParty,e]))}));function H(e){let t={};for(let n of Kt)t[n]=V[n][e];return t}async function Vt(){let e=H(`bedrock`),t;try{t=await j()}catch(t){return v(t),e}if(!t?.length)return e;let n={};for(let r of Kt){let i=V[r].firstParty;n[r]=Et(t,i)||e[r]}return n}function Ht(e){let t=ge().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=zt[e];t&&r&&(n[t]=r)}return n}function Ut(e){let t;try{t=ge().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function Wt(){if(m()===null){if(y()!==`bedrock`){ae(H(y()));return}qt()}}function U(){let e=m();return e===null?(Wt(),Ht(H(y()))):Ht(e)}async function Gt(){if(m()===null){if(y()!==`bedrock`){ae(H(y()));return}await qt()}}var Kt,qt,W=e((()=>{ie(),xe(),Tt(),_(),Ft(),Bt(),x(),Kt=Object.keys(V),qt=wt(async()=>{if(m()===null)try{ae(await Vt())}catch(e){v(e)}})}));function G(e){return Jt.includes(e)}function K(e){return Yt.includes(e)}var Jt,Yt,Xt=e((()=>{Jt=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],Yt=[`sonnet`,`opus`,`haiku`]}));function Zt(e,t){return e.includes(t)?!0:G(e)?Q(e).toLowerCase().includes(t):!1}function Qt(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function $t(e,t){let n=G(e)?Q(e).toLowerCase():e;return!!(Qt(n,t)||!t.startsWith(`claude-`)&&Qt(n,`claude-${t}`))}function en(e,t){for(let n of t){if(K(n))continue;let t=n.indexOf(e);if(t===-1)continue;let r=t+e.length;if(r===n.length||n[r]===`-`)return!0}return!1}function tn(e){let{availableModels:t}=he()||{};if(!t)return!0;if(t.length===0)return!1;let n=Ut(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!K(n)||!en(n,r)))return!0;for(let e of r)if(K(e)&&!en(e,r)&&Zt(n,e))return!0;if(G(n)){let e=Q(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!K(e)&&G(e)&&Q(e).toLowerCase()===n)return!0;for(let e of r)if(!K(e)&&!G(e)&&$t(n,e))return!0;return!1}var nn=e((()=>{_(),Xt(),$(),W()}));function q(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}var rn,an,on=e((()=>{rn=`gpt-5.5`,an=`gpt-5.4-mini`}));function sn(){let e=y();return e===`openai`&&q()?process.env.OPENAI_SMALL_FAST_MODEL??`gpt-5.4-mini`:e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||fn()}function cn(e){return e===U().opus40||e===U().opus41||e===U().opus45||e===U().opus46||e===U().opus47}function J(){let e,t=oe();if(t!==void 0)e=t;else{let t=he()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!tn(e)))return e}function ln(){let e=J();return e==null?hn():Q(e)}function un(){return Y()}function dn(){let e=y();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function Y(){let e=y();return e===`openai`&&q()?rn:e===`openai`&&process.env.OPENAI_DEFAULT_OPUS_MODEL?process.env.OPENAI_DEFAULT_OPUS_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:dn()||U().opus47}function X(){let e=y();return e===`openai`&&q()?rn:e===`openai`&&process.env.OPENAI_DEFAULT_SONNET_MODEL?process.env.OPENAI_DEFAULT_SONNET_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:dn()||(e===`firstParty`?U().sonnet46:U().sonnet45)}function fn(){let e=y();return e===`openai`&&q()?an:e===`openai`&&process.env.OPENAI_DEFAULT_HAIKU_MODEL?process.env.OPENAI_DEFAULT_HAIKU_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:dn()||U().haiku45}function pn(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return J()===`opusplan`&&t===`plan`&&!r?Y():J()===`haiku`&&t===`plan`?X():n}function mn(){return X()}function hn(){return Q(mn())}function gn(e){if(e=e.toLowerCase(),e.includes(`claude-opus-4-7`))return`claude-opus-4-7`;if(e.includes(`claude-opus-4-6`))return`claude-opus-4-6`;if(e.includes(`claude-opus-4-5`))return`claude-opus-4-5`;if(e.includes(`claude-opus-4-1`))return`claude-opus-4-1`;if(e.includes(`claude-opus-4`))return`claude-opus-4`;if(e.includes(`claude-sonnet-4-6`))return`claude-sonnet-4-6`;if(e.includes(`claude-sonnet-4-5`))return`claude-sonnet-4-5`;if(e.includes(`claude-sonnet-4`))return`claude-sonnet-4`;if(e.includes(`claude-haiku-4-5`))return`claude-haiku-4-5`;if(e.includes(`claude-3-7-sonnet`))return`claude-3-7-sonnet`;if(e.includes(`claude-3-5-sonnet`))return`claude-3-5-sonnet`;if(e.includes(`claude-3-5-haiku`))return`claude-3-5-haiku`;if(e.includes(`claude-3-opus`))return`claude-3-opus`;if(e.includes(`claude-3-sonnet`))return`claude-3-sonnet`;if(e.includes(`claude-3-haiku`))return`claude-3-haiku`;let t=e.match(/(claude-(\d+-\d+-)?\w+)/);return t?.[1]?t[1]:e}function Z(e){return gn(Ut(e))}function _n(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:xn(Q(e))}function vn(){return!(O()||y()!==`firstParty`||!b())}function yn(e){return e===`opusplan`?`Opus Plan`:G(e)?Se(e):xn(e)}function bn(e){switch(e){case U().opus47:return`Opus 4.7`;case`${U().opus47}[1m]`:return`Opus 4.7 (1M context)`;case U().opus46:return`Opus 4.6`;case`${U().opus46}[1m]`:return`Opus 4.6 (1M context)`;case U().opus45:return`Opus 4.5`;case U().opus41:return`Opus 4.1`;case U().opus40:return`Opus 4`;case`${U().sonnet46}[1m]`:return`Sonnet 4.6 (1M context)`;case U().sonnet46:return`Sonnet 4.6`;case`${U().sonnet45}[1m]`:return`Sonnet 4.5 (1M context)`;case U().sonnet45:return`Sonnet 4.5`;case U().sonnet40:return`Sonnet 4`;case`${U().sonnet40}[1m]`:return`Sonnet 4 (1M context)`;case U().sonnet37:return`Sonnet 3.7`;case U().sonnet35:return`Sonnet 3.5`;case U().haiku45:return`Haiku 4.5`;case U().haiku35:return`Haiku 3.5`;default:return null}}function xn(e){return bn(e)||e}function Q(e){let t=e.trim(),n=t.toLowerCase(),r=k(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(G(i))switch(i){case`opusplan`:return X()+(r?`[1m]`:``);case`sonnet`:return X()+(r?`[1m]`:``);case`haiku`:return fn()+(r?`[1m]`:``);case`opus`:return Y()+(r?`[1m]`:``);case`best`:return un();default:}return y()===`firstParty`&&Cn(i)&&wn()?Y()+(r?`[1m]`:``):r?`${t.replace(/\[1m\]$/i,``).trim()}[1m]`:t}function Sn(e,t){return k(e)||!k(t)?e:pt(Q(e))?`${e}[1m]`:e}function Cn(e){return On.includes(e)}function wn(){return!a(process.env.WORKMATE_DISABLE_LEGACY_MODEL_REMAP)}function Tn(e){if(e===null)return`Default (${hn()})`;let t=Q(e);return e===t?t:`${e} (${t})`}function En(e){if(y()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Z(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`Work Mate 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Work Mate 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Work Mate 3.5 Haiku`}function Dn(e){return e.replace(/\[(1|2)m\]/gi,``)}var On,$=e((()=>{ie(),Ct(),o(),W(),_(),x(),nn(),Xt(),Ce(),on(),On=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));export{gt as $,P as A,Ie as At,I as B,nn as C,Ge as Ct,Gt as D,Le as Dt,Xt as E,Je as Et,B as F,b as Ft,jt as G,Mt as H,It as I,kt as J,Nt as K,R as L,M,y as Mt,F as N,Ne as Nt,U as O,Ye as Ot,z as P,x as Pt,yt as Q,L as R,Sn as S,Ue as St,Jt as T,He as Tt,Ot as U,Bt as V,j as W,wt as X,Tt as Y,St as Z,Dn as _,qe as _t,Y as a,Ct as at,xn as b,We as bt,En as c,ut as ct,J as d,it as dt,mt as et,$ as f,$e as ft,Tn as g,Ke as gt,vn as h,Xe as ht,mn as i,k as it,N as j,Fe as jt,W as k,Pe as kt,pn as l,T as lt,cn as m,Ze as mt,Z as n,_t as nt,X as o,O as ot,wn as p,et as pt,Ft as q,hn as r,ht as rt,ln as s,ft as st,gn as t,vt as tt,sn as u,tt as ut,Q as v,Re as vt,tn as w,Be as wt,yn as x,C as xt,_n as y,ze as yt,Rt as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,j as n}from"./state-CXY-q5gr.js";import{gy as r,my as i,vy as a}from"./loadAgentsDir-DR5PVAc3.js";import{d as o,m as s}from"./settings-YIDksG5Z.js";import{d as c,o as l}from"./config-D3K87Mm1.js";import{C as u,Mt as d,Pt as f,d as p,f as m,i as h,w as g,y as _}from"./model-D42epddJ.js";function v(e=!1){let t=d()!==`firstParty`;return{value:null,label:`Default (recommended)`,description:`Use the default model (currently ${_(h())})${t?``:` · ${r(i)}`}`}}function y(e=!1){let t=[v(e)],r=process.env.ANTHROPIC_CUSTOM_MODEL_OPTION;r&&!t.some(e=>e.value===r)&&t.push({value:r,label:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME??r,description:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION??`Custom model (${r})`});for(let e of l().additionalModelOptionsCache??[])t.some(t=>t.value===e.value)||t.push(e);let i=null,a=p(),o=n();return a==null?o!==null&&(i=o):i=a,i!==null&&!t.some(e=>e.value===i)&&t.push({value:i,label:i,description:`Custom model`}),b(t)}function b(e){return(o()||{}).availableModels?e.filter(e=>e.value===null||e.value!==null&&g(e.value)):e}function x(e,t){return e.length===0?null:b([v(t),...e])}var S=e((()=>{t(),c(),a(),s(),u(),m(),f()}));export{y as n,S as r,x as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DZ_SvEVz.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{$ as a,I as o,M as s,N as c,R as l,V as u,c as d,et as f,f as p,i as m,u as ee}from"./debug-kBjDaVkQ.js";import{Kt as te,Ut as ne}from"./settings-YIDksG5Z.js";import{d as re,h as ie,o as ae}from"./config-D3K87Mm1.js";import{o as h,s as g}from"./log-DWZny1vM.js";import{i as _,n as v}from"./execFileNoThrow-BfZFnCGa.js";import{n as y}from"./analytics-COpjZpvd.js";import{n as oe,r as b,t as se}from"./lockfile-D_9vif6E.js";import{b as ce,n as le,t as ue,v as de,y as fe}from"./sleep-BbWr_FL1.js";import{j as pe,k as me}from"./sessionTracing-UFK96PxT.js";import{C as he,E as ge,S as _e,T as ve,_ as ye,a as x,b as be,c as xe,d as Se,f as Ce,g as we,i as Te,l as Ee,m as De,n as Oe,o as S,p as ke,s as Ae,t as je,u as Me,v as Ne,w as Pe,x as C,y as Fe}from"./pidLock-YvAaIrIY.js";import{homedir as w}from"os";import{basename as Ie,delimiter as Le,dirname as T,join as E,resolve as D}from"path";import{constants as Re}from"fs";import{createHash as ze}from"crypto";import{access as O,chmod as k,copyFile as A,mkdir as j,readdir as M,readlink as N,rename as P,rm as F,rmdir as Be,stat as I,symlink as Ve,unlink as L,writeFile as R}from"fs/promises";async function He(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return Date.now()-i,a.data.trim()}catch(n){Date.now()-i;let a=n instanceof Error?n.message:String(n);r.isAxiosError(n)&&n.response&&n.response.status,a.includes(`timeout`);let o=Error(`Failed to fetch version from ${t}/${e}: ${a}`);throw g(o),o}}async function Ue(e){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(e)){let t=e.startsWith(`v`)?e.slice(1):e;if(/^99\.99\./.test(t))throw Error(`Version ${t} is not available for installation. Use 'stable' or 'latest'.`);return t}let t=e;if(t!==`stable`&&t!==`latest`)throw Error(`Invalid channel: ${e}. Use 'stable' or 'latest'`);return He(t,z)}function We(){return Number(process.env.WORKMATE_STALL_TIMEOUT_MS_FOR_TESTING)||B}async function Ge(e,t,n,i={}){let a;for(let o=1;o<=V;o++){let s=new AbortController,c,l=()=>{c&&(clearTimeout(c),c=void 0)},f=()=>{l(),c=setTimeout(e=>e.abort(),We(),s)};try{f();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{f()},...i});l();let o=ze(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await R(n,Buffer.from(a.data)),await k(n,493);return}catch(e){l();let t=r.isCancel(e);if(a=t?new H:u(e),t&&o<V){d(`Download stalled on attempt ${o}/${V}, retrying...`),await le(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ke(e,t,n,i){let a=ee();await a.rm(t,{recursive:!0,force:!0});let o=U(),s=Date.now(),c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){Date.now()-s;let i=t instanceof Error?t.message:String(t);throw r.isAxiosError(t)&&t.response&&t.response.status,i.includes(`timeout`),g(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${i}`)),t}let l=c.platforms[o];if(!l)throw Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=W(o),f=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let p=E(t,d);try{await Ge(f,u,p,i||{}),Date.now()-s}catch(e){Date.now()-s;let t=e instanceof Error?e.message:String(e);throw r.isAxiosError(e)&&e.response&&e.response.status,t.includes(`timeout`),t.includes(`Checksum mismatch`),g(Error(`Failed to download binary from ${f}: ${t}`)),e}}async function qe(e,t){return await Ke(e,t,z),`binary`}var z,B,V,H,Je=e((()=>{i(),y(),m(),o(),_(),p(),h(),ue(),$(),z=`https://downloads.workmate.ai/native-releases`,B=6e4,V=3,H=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function U(){let e=ne.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw d(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&me.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function W(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function G(){let e=W(U());return{versions:E(Se(),`claude`,`versions`),staging:E(Me(),`claude`,`staging`),locks:E(Ce(),`claude`,`locks`),executable:E(Ee(),e)}}async function K(e){try{let t=await I(e);return!t.isFile()||t.size===0?!1:(await O(e,Re.X_OK),!0)}catch{return!1}}async function q(e){let t=G(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>j(e,{recursive:!0}))),await j(T(t.executable),{recursive:!0});let r=E(t.versions,e);try{await I(r)}catch{await R(r,``,{encoding:`utf8`})}return{stagingPath:E(t.staging,e),installPath:r}}async function Ye(e,t,n=0){let r=G(),i=J(r,e);if(await j(r.locks,{recursive:!0}),S()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await xe(e,i,async()=>{try{await t()}catch(e){throw g(e),e}}))return r+1,!0;r++,r<a&&await le(Math.min(o*2**(r-1),s))}return Y(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await b(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{d(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return Y(e,t),!1}try{return await t(),!0}catch(e){throw g(e),e}}finally{a&&await a()}}async function Xe(e,t){await j(T(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await A(e,n),await k(n,493),await P(n,t),d(`Atomically installed binary to ${t}`)}catch(e){try{await L(n)}catch{}throw e}}async function Ze(e,t){try{let n=E(e,`node_modules`,`@anthropic-ai`),r=(await M(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw Error(`Could not find platform-specific native package`);let i=E(n,r,`cli`);try{await I(i)}catch{throw Error(`Native binary not found in staged package`)}await Xe(i,t),await F(e,{recursive:!0,force:!0})}catch(e){let t=s(e);throw!t.includes(`Could not find platform-specific`)&&t.includes(`Native binary not found`),g(u(e)),e}}async function Qe(e,t){try{let n=E(e,W(U()));try{await I(n)}catch{throw Error(`Staged binary not found`)}await Xe(n,t),await F(e,{recursive:!0,force:!0})}catch(e){throw s(e).includes(`Staged binary not found`),g(u(e)),e}}async function $e(e,t,n){n===`npm`?await Ze(e,t):await Qe(e,t)}async function et(e,n){let{stagingPath:r,installPath:i}=await q(e),{executable:a}=G(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await tt(e)||n;if(s?(d(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await $e(o,i,await qe(e,o))):d(`Version ${e} already installed, updating symlink`),await rt(a),await it(a,i),!await K(a)){let e=!1;try{await I(i),e=!0}catch{}throw Error(`Failed to create executable at ${a}. Source file exists: ${e}. Check write permissions to ${a}.`)}return s}async function tt(e){let{installPath:t}=await q(e);return K(t)}async function nt(e,n=!1){let r=Date.now(),i=await Ue(e),{executable:a}=G();if(d(`Checking for native installer update to version ${i}`),!n){let e=await ye();if(e&&de(i,e)){if(d(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),fe(`0.0.26`,e))return d(`Native installer: current version 0.0.26 is already at or above maxVersion ${e}, skipping update`),Date.now()-r,{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.26`&&await tt(i)&&await K(a))return d(`Found ${i} at ${a}, skipping install`),Date.now()-r,{success:!0,latestVersion:i};if(!n&&Fe(i))return Date.now()-r,{success:!0,latestVersion:i};if(t(process.env.ENABLE_LOCKLESS_UPDATES))await et(i,n),Date.now()-r;else{let{installPath:e}=await q(i);n&&await ut(e);let t=await Ye(e,async()=>{await et(i,n)},3);if(Date.now()-r,!t){let t=G(),n;if(S()){let r=J(t,e);x(r)&&(n=Ae(r)?.pid)}return{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return d(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function rt(e){try{await Be(e),d(`Removed empty directory at ${e}`)}catch(t){let n=c(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&d(`Could not remove directory at ${e}: ${t}`)}}async function it(e,t){if(U().startsWith(`win32`))try{await j(T(e),{recursive:!0});let n;try{n=await I(e)}catch{}if(n){try{let e=await I(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await P(e,r);try{await A(t,e);try{await L(r)}catch{}}catch(t){try{await P(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw g(n),n}throw t}}else try{await A(t,e)}catch(e){throw l(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return g(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=T(e);try{await j(n,{recursive:!0}),d(`Created directory ${n} for symlink`)}catch(e){return g(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await I(e),n=!0}catch{}if(n){try{let n=await N(e);if(D(T(e),n)===D(t))return!1}catch{}await L(e)}}catch(e){g(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await Ve(t,r),await P(r,e),d(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await L(r)}catch{}return g(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function at(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await De();if(n===`development`||!(e||n===`native`))return[];let r=G(),i=[],a=T(r.executable),o=D(a),s=U().startsWith(`win32`);try{await O(a)}catch{i.push({message:`installMethod is native, but directory ${a} does not exist`,userActionRequired:!0,type:`error`})}if(s)await K(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await N(r.executable);await K(D(T(r.executable),e))||i.push({message:`Work Mate symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){l(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await K(r.executable)||i.push({message:`${r.executable} exists but is not a valid Work Mate binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Le).some(e=>{try{let t=D(e);return s?t.toLowerCase()===o.toLowerCase():t===o}catch{return!1}}))if(s){let e=a.replace(/\//g,`\\`);i.push({message:`Native installation exists but ${e} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:`path`})}else{let e=ve(),t=C()[e],n=t?t.replace(w(),`~`):`your shell config file`;i.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run:\n\necho 'export PATH="$HOME/.local/bin:$PATH"' >> ${n} && source ${n}`,userActionRequired:!0,type:`path`})}return i}function ot(e,t=!1){if(t)return st(e,t);if(Q)return d(`installLatest: joining in-flight call`),Q;let n=st(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function st(e,t=!1){let n=await nt(e,t);return n.success?(ae().installMethod!==`native`&&(ie(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),d(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),X(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function ct(e){try{let t=await N(e),n=D(T(e),t);if(await K(n))return n}catch{}return null}function J(e,t){let n=Ie(t);return E(e.locks,`${n}.lock`)}async function lt(){let e=G();if(!process.execPath.includes(e.versions))return;let t=D(process.execPath);try{let n=J(e,t);if(await j(e.locks,{recursive:!0}),S()){if(!await je(t,n)){Y(t,Error(`Lock already held by another process`));return}d(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await b(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{d(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),d(`Acquired mtime-based lock on running version: ${t}`),f(async()=>{try{await e?.()}catch{}})}catch(e){if(l(e)){d(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}Y(t,e);return}}}catch(e){if(l(e)){d(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}d(`NON-FATAL: Failed to lock current version during execution ${s(e)}`,{level:`info`})}}function Y(e,t){g(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function ut(e){let t=J(G(),e);try{await L(t),d(`Force-removed lock file at ${t}`)}catch(e){d(`Failed to force-remove lock file: ${s(e)}`)}}async function X(){await Promise.resolve();let e=G(),t=Date.now()-36e5;if(U().startsWith(`win32`)){let t=T(e.executable);try{let e=await M(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await L(E(t,r)),n++}catch{}n>0&&d(`Cleaned up ${n} old Windows executables on startup`)}catch(e){l(e)||d(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await M(e.staging),r=0;for(let i of n){let n=E(e.staging,i);try{(await I(n)).mtime.getTime()<t&&(await F(n,{recursive:!0,force:!0}),r++,d(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&d(`Cleaned up ${r} orphaned staging directories`)}catch(e){l(e)||d(`Failed to clean up staging directories: ${e}`)}if(S()){let t=Oe(e.locks);t>0&&d(`Cleaned up ${t} stale version locks`)}let n;try{n=await M(e.versions)}catch(e){l(e)||d(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=E(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await I(n)).mtime.getTime()<t&&(await L(n),i++,d(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await I(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:D(n),mtime:e.mtime})}catch{}}if(i>0&&d(`Cleaned up ${i} orphaned temp install files`),r.length!==0)try{let t=process.execPath,n=new Set;t?.includes(e.versions)&&n.add(D(t));let i=await ct(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=J(e,t.resolvedPath),i=!1;if(S())i=x(r);else try{i=await se(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),d(`Protecting locked version from cleanup: ${t.name}`))}let a=r.filter(e=>!n.has(e.resolvedPath)).sort((e,t)=>t.mtime.getTime()-e.mtime.getTime()).slice(2);if(a.length===0){r.length,n.size;return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await Ye(e.path,async()=>{await L(e.path)})?o++:(s++,d(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,g(Error(`Failed to delete version ${e.name}: ${t}`))}})),r.length,n.size}catch(e){l(e)||g(Error(`Version cleanup failed: ${e}`))}}async function dt(){let e=[],t=C();for(let[n,r]of Object.entries(t))try{let t=await he(r);if(!t)continue;let{filtered:i,hadAlias:a}=be(t);a&&(await Pe(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),d(`Cleaned up claude alias from ${n} config`))}catch(t){g(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function ft(e){try{let t=await v(`npm`,[`config`,`get`,`prefix`]);if(t.code!==0||!t.stdout)return{success:!1,error:`Failed to get npm global prefix`};let n=t.stdout.trim(),r=!1;async function i(e,t){try{return await L(e),d(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(U().startsWith(`win32`)){let e=E(n,`claude.cmd`),t=E(n,`claude.ps1`),a=E(n,`claude`);await i(e,`bin script`)&&(r=!0),await i(t,`PowerShell script`)&&(r=!0),await i(a,`bin executable`)&&(r=!0)}else await i(E(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(d(`Successfully removed ${e} manually`),{success:!0,warning:`${e} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${U().startsWith(`win32`)?E(n,`node_modules`,e):E(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return d(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function pt(e){let{code:t,stderr:n}=await v(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return d(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){d(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),d(`Attempting manual removal due to ENOTEMPTY error`);let t=await ft(e);if(t.success)return{success:!0,warning:t.warning};if(t.error)return{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}. Manual removal also failed: ${t.error}`}}return d(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}`}}return{success:!1}}async function mt(){let e=[],t=[],n=0,r=await pt(`@anthropic-ai/workmate`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=E(w(),`.workmate`,`local`);try{await F(i,{recursive:!0}),n++,d(`Removed local installation at ${i}`)}catch(t){l(t)||(e.push(`Failed to remove ${i}: ${t}`),d(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{y(),Ne(),a(),re(),m(),we(),te(),pe(),n(),o(),_(),ge(),oe(),h(),ce(),_e(),ue(),ke(),Je(),Te(),Z=10080*60*1e3,Q=null})),ht=e((()=>{$()}));export{dt as a,lt as c,X as i,at as n,$ as o,mt as r,ot as s,ht as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./parser-DThLwgdM.js";t();export{e as parseCommand};
|
|
@@ -1,3 +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{I as i,P as a,Wt as o,Xn as s,a as c,ai as l,di as u,fi as d,hn as f,k as p,kt as m,n as h,o as ee,ot as g,r as te,s as ne,t as _,x as re,y as v}from"./src-WZ94ZKI3.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as ie,q as b}from"./state-CXY-q5gr.js";import{Bh as ae,H as x,Hh as oe,I as se,Ji as S,Jx as C,L as ce,Mg as w,Ng as le,R as ue,V as T,_m as E,aC as D,gm as O,kg as de,sC as k,sb as fe,tb as pe,z as me,zh as A}from"./loadAgentsDir-DR5PVAc3.js";import{C as j,x as M}from"./debug-kBjDaVkQ.js";import{B as N,L as P,a as F,cn as I,m as L,nn as R,z as he}from"./settings-YIDksG5Z.js";import{l as z,o as ge}from"./stringUtils-D_xPrwGQ.js";import{n as _e,t as ve}from"./TextInput-BboKIug2.js";import{n as B,t as ye}from"./useExitOnCtrlCDWithKeybindings-BgJrnuDl.js";import{n as V,t as H}from"./select-FrwoTzuc.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-mS8iUoWY.js";import{t as Se}from"./SearchBox-DQBLKyzJ.js";import{n as Ce,t as we}from"./useSearchInput-BITV_Txn.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-D6R2OeoH.js";function De(){return U}var U,Oe=e((()=>{U=[]}));function ke({ruleValue:e}){switch(e.toolName){case O.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(a,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(a,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(a,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(a,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(a,{bold:!0,children:e.toolName}),` tool`]})}}var W,Ae=e((()=>{_(),E(),W=y()}));function je(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${F(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${F(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.workmate/settings.json`,value:e}}}function Me({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:o,setToolPermissionContext:s}){let c=R.map(je),l=(0,Ne.useCallback)(i=>{if(i===`cancel`){t();return}else if(R.includes(i)){let t=i,a=de(o,{type:`addRules`,rules:n,behavior:r,destination:t});le({type:`addRules`,rules:n,behavior:r,destination:t}),s(a);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(a,{sandboxAutoAllowEnabled:D.isSandboxingEnabled()&&D.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,o,s]);return(0,G.jsxs)(v,{title:`Add ${r} permission ${z(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(i,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(i,{flexDirection:`column`,children:[(0,G.jsx)(a,{bold:!0,children:N(e)}),(0,G.jsx)(ke,{ruleValue:e})]},N(e)))}),(0,G.jsxs)(i,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(a,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(H,{options:c,onChange:l})]})]})}var Ne,G,Pe=e((()=>{Ne=t(l(),1),V(),_(),w(),P(),Te(),k(),I(),L(),ge(),Ae(),G=y()}));function Fe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[s,c]=(0,Ie.useState)(``),[l,u]=(0,Ie.useState)(0),d=B();o(`confirm:no`,e,{context:`Settings`});let{columns:f}=g(),p=f-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(a,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(i,{flexDirection:`column`,children:[(0,K.jsxs)(a,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(m,{}),`e.g., `,(0,K.jsx)(a,{bold:!0,children:N({toolName:O.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:N({toolName:O.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(ve,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(he(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:p,cursorOffset:l,onChangeCursorOffset:u})})]})]}),(0,K.jsx)(i,{marginLeft:3,children:d.pending?(0,K.jsxs)(a,{dimColor:!0,children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsx)(a,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Ie,K,Le=e((()=>{n(),Ie=t(l(),1),_e(),ye(),fe(),_(),pe(),E(),P(),K=y()}));function Re({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=c();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[o]=(0,q.useState)(()=>De()),[s,l]=(0,q.useState)(()=>new Set),[u,d]=(0,q.useState)(()=>new Set),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:s,retry:u,denials:o})},[s,u,o,t]);let h=(0,q.useCallback)(e=>{let t=Number(e);l(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),ee=(0,q.useCallback)(e=>{m(Number(e))},[]);if(f((e,t)=>{e===`r`&&(d(e=>{let t=new Set(e);return t.has(p)?t.delete(p):t.add(p),t}),l(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t}))},{isActive:o.length>0}),o.length===0)return(0,J.jsx)(a,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let g=o.map((e,t)=>{let n=s.has(t),r=u.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(a,{children:[(0,J.jsx)(ne,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(a,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(i,{flexDirection:`column`,children:[(0,J.jsx)(a,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(i,{marginTop:1,children:(0,J.jsx)(H,{options:g,onChange:h,onFocus:ee,visibleOptionCount:Math.min(10,g.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,ze=e((()=>{q=t(l(),1),_(),Oe(),V(),J=y()}));function Be({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Ve.useCallback)(()=>{o(de(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,o,t]),c=(0,Ve.useCallback)(e=>{e===`yes`?s():n()},[s,n]);return(0,Y.jsxs)(v,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(i,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(a,{bold:!0,children:e})}),(0,Y.jsx)(a,{children:`Work Mate will no longer have access to files in this directory.`}),(0,Y.jsx)(H,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Ve,Y,He=e((()=>{Ve=t(l(),1),V(),_(),w(),Y=y()}));function Ue({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:o,onHeaderFocusChange:s}){let{headerFocused:l,focusHeader:u}=c();(0,X.useEffect)(()=>{s?.(l)},[l,s]);let d=We.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),f=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=d.find(t=>t.path===e);t?.isDeletable&&o(t.path)},[d,n,o]),p=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),m=We.useMemo(()=>{let e=d.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[d]);return(0,Z.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(a,{children:`- ${b()}`}),(0,Z.jsx)(a,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(H,{options:m,onChange:f,onCancel:p,visibleOptionCount:Math.min(10,m.length),onUpFromFirstItem:u,isDisabled:l})]})}var We,X,Z,Ge=e((()=>{n(),We=t(l(),1),X=t(l(),1),ie(),V(),_(),Z=y()}));function Ke({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${x(e.source)}`})}function qe(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Je({rule:e,onDelete:t,onCancel:n}){let r=B();o(`confirm:no`,n,{context:`Confirmation`});let s=(0,$.jsxs)(i,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(a,{bold:!0,children:N(e.ruleValue)}),(0,$.jsx)(ke,{ruleValue:e.ruleValue}),(0,$.jsx)(Ke,{rule:e})]}),c=(0,$.jsx)(i,{marginLeft:3,children:r.pending?(0,$.jsxs)(a,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(a,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(a,{bold:!0,color:`permission`,children:`Rule details`}),s,(0,$.jsxs)(a,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
-
`,`Contact your system administrator for more information.`]})]}),c]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(a,{bold:!0,color:`error`,children:[`Delete `,qe(e.ruleBehavior),` tool?`]}),s,(0,$.jsx)(a,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(H,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),c]})}function Ye(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:a,onSelect:o,onCancel:s,lastFocusedRuleKey:l,cursorOffset:u,onHeaderFocusChange:d}=e,f=ee(),{headerFocused:m,focusHeader:h,blurHeader:g}=c();return(0,Q.useEffect)(()=>{r&&m&&g()},[r,m,g]),(0,Q.useEffect)(()=>{d?.(m)},[m,d]),(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(i,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(p,{query:n,isFocused:r&&!m,isTerminalFocused:a,width:f,cursorOffset:u})}),(0,$.jsx)(H,{options:t,onChange:o,onCancel:s,visibleOptionCount:Math.min(10,t.length),isDisabled:r||m,defaultFocusValue:l,onUpFromFirstItem:h})]})}function Xe({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(i,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(a,{children:{allow:`Work Mate won't ask before using allowed tools.`,ask:`Work Mate will always ask for confirmation before using these tools.`,deny:`Work Mate will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Ye,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Ze({onExit:e,initialTab:t,onRetryDenials:n}){let c=De().length>0,l=t??(c?`recent`:`allow`),[d,f]=(0,Q.useState)([]),p=ae(e=>e.toolPermissionContext),m=oe(),ee=s(),g=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),ne=(0,Q.useCallback)(e=>{g.current=e},[]),[_,v]=(0,Q.useState)(),[y,ie]=(0,Q.useState)(),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[fe,pe]=(0,Q.useState)(!0),A=(0,Q.useCallback)(e=>{pe(e)},[]),M=(0,Q.useMemo)(()=>{let e=new Map;return ce(p).forEach(t=>{e.set(j(t),t)}),e},[p]),P=(0,Q.useMemo)(()=>{let e=new Map;return me(p).forEach(t=>{e.set(j(t),t)}),e},[p]),F=(0,Q.useMemo)(()=>{let e=new Map;return ue(p).forEach(t=>{e.set(j(t),t)}),e},[p]),I=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return M;case`deny`:return P;case`ask`:return F;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=N(r.ruleValue).toLowerCase(),t=N(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=N(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[M,P,F]),L=B(),R=!_&&!b&&!S&&!w&&!E,{query:he,setQuery:z,cursorOffset:ge}=Ce({isActive:R&&O,onExit:()=>{k(!1)}}),_e=(0,Q.useCallback)(e=>{R&&(O||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),k(!0),z(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),k(!0),z(e.key))))},[R,O,z]),ve=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){x(t);return}else{v(n.get(e));return}},[I]),ye=(0,Q.useCallback)(()=>{x(null)},[]),V=(0,Q.useCallback)((e,t)=>{C({ruleValue:e,ruleBehavior:t}),x(null)},[]),H=(0,Q.useCallback)((e,t)=>{C(null);for(let t of e)f(e=>[...e,`Added ${t.ruleBehavior} rule ${u.bold(N(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;f(n=>[...n,u.yellow(`${r.warning} Warning: ${N(e.rule.ruleValue)} is ${t}`),u.dim(` ${e.reason}`),u.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{C(null)},[]),Se=(0,Q.useCallback)(()=>T(!0),[]),we=(0,Q.useCallback)(e=>D(e),[]),Te=(0,Q.useCallback)(()=>{let t=g.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||d.length>0?e([...a.length>0?[`Approved ${a.map(e=>u.bold(e.display)).join(`, `)}`]:[],...d].join(`
|
|
3
|
-
`)):e(`Permissions dialog dismissed`,{display:`system`})},[d,e,n]);o(`confirm:no`,Te,{context:`Settings`,isActive:R&&!O});let Ee=()=>{if(!_)return;let{options:e}=I(_.ruleBehavior),t=j(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),ie(i),se({rule:_,initialContext:p,setToolPermissionContext(e){m(t=>({...t,toolPermissionContext:e}))}}),f(e=>[...e,`Deleted ${_.ruleBehavior} rule ${u.bold(N(_.ruleValue))}`]),v(void 0)};if(_)return(0,$.jsx)(Je,{rule:_,onDelete:Ee,onCancel:()=>v(void 0)});if(b&&b!==`workspace`&&b!==`recent`)return(0,$.jsx)(Fe,{onCancel:ye,onSubmit:V,ruleBehavior:b});if(S)return(0,$.jsx)(Me,{onAddRules:H,onCancel:be,ruleValues:[S.ruleValue],ruleBehavior:S.ruleBehavior,initialContext:p,setToolPermissionContext:e=>{m(t=>({...t,toolPermissionContext:e}))}});if(w)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=de(p,n);m(e=>({...e,toolPermissionContext:r})),t&&le(n),f(n=>[...n,`Added directory ${u.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),T(!1)},onCancel:()=>T(!1),permissionContext:p});if(E)return(0,$.jsx)(Be,{directoryPath:E,onRemove:()=>{f(e=>[...e,`Removed directory ${u.bold(E)} from workspace`]),D(null)},onCancel:()=>D(null),permissionContext:p,setPermissionContext:e=>{m(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:he,isSearchMode:O,isFocused:ee,onCancel:Te,lastFocusedRuleKey:y,cursorOffset:ge,getRulesOptions:I,handleToolSelect:ve,onHeaderFocusChange:A};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:_e,children:(0,$.jsxs)(re,{color:`permission`,children:[(0,$.jsxs)(te,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!_||!!b||!!S||w||!!E,initialHeaderFocused:!c,navFromContent:!O,children:[(0,$.jsx)(h,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Re,{onHeaderFocusChange:A,onStateChange:ne})}),(0,$.jsx)(h,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Xe,{tab:`allow`,...U})}),(0,$.jsx)(h,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Xe,{tab:`ask`,...U})}),(0,$.jsx)(h,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Xe,{tab:`deny`,...U})}),(0,$.jsx)(h,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(a,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(Ue,{onExit:e,toolPermissionContext:p,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:A})]})})]}),(0,$.jsx)(i,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(a,{dimColor:!0,children:L.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):fe?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):O?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):c&&l===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Qe=e((()=>{d(),n(),Q=t(l(),1),A(),w(),V(),ye(),we(),_(),pe(),Oe(),P(),T(),M(),Se(),Pe(),be(),Ae(),Le(),ze(),He(),Ge(),$=y()})),$e,et;e((()=>{Qe(),S(),$e=y(),et=async(e,t)=>(0,$e.jsx)(Ze,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,C(e)])}})}))();export{et as call};
|