@readmagic/workmate 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-mS8iUoWY.js → AddWorkspaceDirectory-DqlPtsVK.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-BHBkysy0.js → AgentsMdExternalIncludesDialog-rJS5l6yk.js} +1 -1
- package/dist/chunks/{App-D--vtCyq.js → App-DzRQpRKr.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-CBhSmdz_.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-DyqI98d2.js → BypassPermissionsModeDialog-zz-lnmJt.js} +1 -1
- package/dist/chunks/CustomSelect-CYmc4vRh.js +1 -0
- package/dist/chunks/{DiffDialog-BQAU2pJx.js → DiffDialog-CTUIAcEE.js} +6 -6
- package/dist/chunks/{Doctor-DJOMbSDE.js → Doctor-CLOYkPRR.js} +2 -2
- package/dist/chunks/Doctor-CiZNe_qx.js +1 -0
- package/dist/chunks/{ExitFlow-xBOnvhiW.js → ExitFlow-CATwJC4c.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-NiuhcaG5.js → InvalidConfigDialog-B-9Z58oD.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-DrromC1I.js → InvalidSettingsDialog-B4EWjbp7.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-Dzg77_Xn.js +1 -0
- package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +1 -0
- package/dist/chunks/MCPToolListView-C7HT6rrl.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BYG2yqjO.js → McpParsingWarnings-Dj_Fu5o-.js} +1 -1
- package/dist/chunks/MessageSelector-Dw_ERK_Z.js +3 -0
- package/dist/chunks/Messages-RBfRELKn.js +10 -0
- package/dist/chunks/Onboarding-BRSXxc2E.js +1 -0
- package/dist/chunks/{PermissionDialog-tEMMa5-a.js → PermissionDialog-DjCRuzSm.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-CPOaYnym.js → PressEnterToContinue-DE1RxMX_.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-CwqAsTI2.js → PromptInputFooterSuggestions-ChpyD9B7.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-CrTT8MKE.js +1 -0
- package/dist/chunks/{ProviderSetup-J6Ty-Wj8.js → ProviderSetup-BEV95bnz.js} +1 -1
- package/dist/chunks/QueryEngine-BBBkZWu2.js +1 -0
- package/dist/chunks/REPL-BDnZnm__.js +124 -0
- package/dist/chunks/REPL-BHk0vZDf.js +1 -0
- package/dist/chunks/{ResumeConversation-Cmsbo5m7.js → ResumeConversation-BuSqBrm1.js} +1 -1
- package/dist/chunks/{SearchBox-DQBLKyzJ.js → SearchBox-zA5QwIpO.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +1 -0
- package/dist/chunks/Settings-DYKmPdbd.js +2 -0
- package/dist/chunks/Spinner-DOI8qqZi.js +1 -0
- package/dist/chunks/SpinnerGlyph-BR_SiV9L.js +1 -0
- package/dist/chunks/{TextInput-BboKIug2.js → TextInput-ZKU-x_FD.js} +7 -7
- package/dist/chunks/{ThemePicker-DTpXbEY0.js → ThemePicker-B69oDgXN.js} +1 -1
- package/dist/chunks/TrustDialog-BSG8Ibh8.js +1 -0
- package/dist/chunks/{ValidationErrorsList-C_gDQfm1.js → ValidationErrorsList-BUYHEft4.js} +1 -1
- package/dist/chunks/{_baseEach-DGbaIpJA.js → _baseEach-P0u1zIx6.js} +1 -1
- package/dist/chunks/{add-dir-B576wzi9.js → add-dir-C8RmmyQK.js} +1 -1
- package/dist/chunks/{agentDisplay-ZuFoBZYu.js → agentDisplay-np7CH47m.js} +1 -1
- package/dist/chunks/{agents-Dy4_hDic.js → agents-DRQlR5M1.js} +1 -1
- package/dist/chunks/agents-DedoH0Q4.js +101 -0
- package/dist/chunks/allErrors-DvcU0w0F.js +1 -0
- package/dist/chunks/{appleTerminalBackup-C9kjzdM9.js → appleTerminalBackup-Bemd4RXh.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-PyLNnGdw.js → backgroundHousekeeping-BtEJ6TeC.js} +1 -1
- package/dist/chunks/banner-CuoceXzz.js +2 -0
- package/dist/chunks/branch-ClhlS7f8.js +2 -0
- package/dist/chunks/{break-cache-DL95nKZl.js → break-cache-B1nuWtD_.js} +2 -2
- package/dist/chunks/{btw-Y44ctueB.js → btw-B-FLxlx-.js} +1 -1
- package/dist/chunks/bundledMode-D9omqD3L.js +2 -0
- package/dist/chunks/caches-D7arwhaa.js +1 -0
- package/dist/chunks/caches-Dn8yrJmL.js +1 -0
- package/dist/chunks/{clear-DtTkA707.js → clear-BnWv0i65.js} +1 -1
- package/dist/chunks/{client-aJ2Nr_sh.js → client-2w-g5kMx.js} +1 -1
- package/dist/chunks/client-B0ngS4Uu.js +1 -0
- package/dist/chunks/client-BP4DOH3K.js +1 -0
- package/dist/chunks/{client-Bw_L3lSc.js → client-pA7fKk0-.js} +1 -1
- package/dist/chunks/commands-AcfFLgl5.js +1 -0
- package/dist/chunks/{compact-CvNOtu7J.js → compact-Banc-SNk.js} +1 -1
- package/dist/chunks/config-BDn2YIjC.js +3 -0
- package/dist/chunks/config-BhBcadjZ.js +1 -0
- package/dist/chunks/config-Bm5pVdCq.js +1 -0
- package/dist/chunks/{context-Opu4E8dL.js → context-BvDBAyJ9.js} +1 -1
- package/dist/chunks/context-noninteractive-BK2IDLSS.js +1 -0
- package/dist/chunks/{context-noninteractive-B1V2Mp26.js → context-noninteractive-CuHHniJn.js} +9 -9
- package/dist/chunks/conversation-B2dX3X4Z.js +1 -0
- package/dist/chunks/{conversation-CG_z7TLE.js → conversation-Cjaftrrw.js} +1 -1
- package/dist/chunks/conversationRecovery-NL05oJb1.js +1 -0
- package/dist/chunks/crossProjectResume-BzltC4NJ.js +40 -0
- package/dist/chunks/{debug-kBjDaVkQ.js → debug-2pVES-2G.js} +1 -1
- package/dist/chunks/detectRepository--luIRv5H.js +1 -0
- package/dist/chunks/{diff-Cv7tX2-P.js → diff--6gQCx_x.js} +1 -1
- package/dist/chunks/directoryCompletion-BC0qRmrz.js +1 -0
- package/dist/chunks/doctor-CQf8xPZH.js +1 -0
- package/dist/chunks/entry-DWYOrkFS.js +13 -0
- package/dist/chunks/{envUtils-DZ_SvEVz.js → envUtils-QyzA_cFM.js} +1 -1
- package/dist/chunks/{execFileNoThrow-BfZFnCGa.js → execFileNoThrow-DXSEj8ZO.js} +1 -1
- package/dist/chunks/{exit-OKEV_ddw.js → exit-uKtXb5U3.js} +1 -1
- package/dist/chunks/{extraUsage-BlRL3yeb.js → extraUsage-Dr0YXm1w.js} +1 -1
- package/dist/chunks/extractMemories-8yvMGZ1J.js +1 -0
- package/dist/chunks/fast-C5-lNCQi.js +1 -0
- package/dist/chunks/fast-aNkj6WvB.js +1 -0
- package/dist/chunks/fetchModelList-9w1E4Ue8.js +1 -0
- package/dist/chunks/fetchModelList-D2quBF6M.js +1 -0
- package/dist/chunks/fileSuggestions-BYD78vcF.js +3 -0
- package/dist/chunks/{fpsMetrics-Ixd0J4CH.js → fpsMetrics-DIpm2-xw.js} +1 -1
- package/dist/chunks/{gemini-BfVyavwQ.js → gemini-BNBptTET.js} +1 -1
- package/dist/chunks/generateSessionName-CO2484aJ.js +1 -0
- package/dist/chunks/{genericProcessUtils-CVtQOTO2.js → genericProcessUtils-GqURdVAv.js} +1 -1
- package/dist/chunks/{goal-BidR-GFa.js → goal-j0wdadwM.js} +1 -1
- package/dist/chunks/{grok-DLcuI-U7.js → grok-BpO1ZwK_.js} +1 -1
- package/dist/chunks/{help-CZuvYhXj.js → help-DwhA0qQ6.js} +1 -1
- package/dist/chunks/{history-BxPGftQw.js → history-CUrqO9rV.js} +1 -1
- package/dist/chunks/hooks-B5Wq-KxE.js +1 -0
- package/dist/chunks/{hooks-ehqfAM5F.js → hooks-DG4_WdZ2.js} +2 -2
- package/dist/chunks/install-BbmCNCuM.js +1 -0
- package/dist/chunks/{instrumentation-B9bfF2mA.js → instrumentation-DpPmDyNF.js} +4 -4
- package/dist/chunks/{job-Coztdn6A.js → job-GcmX1ALd.js} +1 -1
- package/dist/chunks/{keybindings-DwSdLpaE.js → keybindings-CxgQqQJe.js} +1 -1
- package/dist/chunks/{launchLocalMemory-DRzfpIOB.js → launchLocalMemory-CDgT5lst.js} +1 -1
- package/dist/chunks/{launchOnboarding-D2zFCJf-.js → launchOnboarding-uQ_ux9sS.js} +1 -1
- package/dist/chunks/loadAgentsDir-BBbIAiay.js +1 -0
- package/dist/chunks/{loadAgentsDir-DR5PVAc3.js → loadAgentsDir-uuZYOgKn.js} +392 -392
- package/dist/chunks/{loadPluginHooks-BiQgGfUJ.js → loadPluginHooks-QoVXsBjy.js} +1 -1
- package/dist/chunks/loader-BMAtuwRa.js +1 -0
- package/dist/chunks/localSearch-D6MhwvnR.js +1 -0
- package/dist/chunks/{localSearch-CzkxDuOR.js → localSearch-yVCDrVrf.js} +1 -1
- package/dist/chunks/{log-DWZny1vM.js → log-L1kqxa_P.js} +1 -1
- package/dist/chunks/{logoUtils-DR5T0pr3.js → logoUtils-B4wCDKs9.js} +1 -1
- package/dist/chunks/{magicDocs-BwBxjfLo.js → magicDocs-D53lV8b5.js} +2 -2
- package/dist/chunks/{main-Ryi27wYq.js → main-fy_XSXGj.js} +34 -34
- package/dist/chunks/{managedEnv-Do9fgLpk.js → managedEnv-B8YWmM4A.js} +1 -1
- package/dist/chunks/managedEnv-ulQBH73B.js +1 -0
- package/dist/chunks/{managedEnvConstants-CWcT7nYr.js → managedEnvConstants-BPY8yF1A.js} +1 -1
- package/dist/chunks/{mcp-BCpnF6wD.js → mcp--LmEVBRg.js} +1 -1
- package/dist/chunks/mcp-CZUVaPb3.js +5 -0
- package/dist/chunks/{mcp-CZBTxbhu.js → mcp-DCl-Tz-C.js} +1 -1
- package/dist/chunks/memory-Bu5ku7y9.js +1 -0
- package/dist/chunks/{modalContext-CBE8xuck.js → modalContext-sU2lfR08.js} +1 -1
- package/dist/chunks/{mode-wq70cR44.js → mode-Bteqe2QG.js} +1 -1
- package/dist/chunks/{model-DVk9-2dk.js → model-CHDU5yqH.js} +1 -1
- package/dist/chunks/model-CcHyMyBv.js +1 -0
- package/dist/chunks/modelOptions-CJV1R3Jt.js +1 -0
- package/dist/chunks/nativeInstaller-CIUYh1aD.js +1 -0
- package/dist/chunks/{notifications-dGBuNvFj.js → notifications-GLnjirCl.js} +1 -1
- package/dist/chunks/{observationStore-D0rm3GhP.js → observationStore-pnSSxec_.js} +1 -1
- package/dist/chunks/{onChangeAppState-B4K-rSaF.js → onChangeAppState-CxGW2d-l.js} +1 -1
- package/dist/chunks/{openai-DAwnAV9K.js → openai-BpGQT2Iv.js} +1 -1
- package/dist/chunks/{overlayContext-B6i_6y_0.js → overlayContext-7wgLio1O.js} +1 -1
- package/dist/chunks/{panel-C0CF3noE.js → panel-DNiXDhBX.js} +1 -1
- package/dist/chunks/{parser-DThLwgdM.js → parser-CTnaXFVJ.js} +1 -1
- package/dist/chunks/parser-Diihup2V.js +1 -0
- package/dist/chunks/{partition-BRQHofxD.js → partition-djFY9gGI.js} +1 -1
- package/dist/chunks/{pasteStore-BmehVo5j.js → pasteStore-njJCBMKr.js} +1 -1
- package/dist/chunks/permissions-DNedQyLg.js +3 -0
- package/dist/chunks/pidLock-CFUBtZck.js +3 -0
- package/dist/chunks/{plan-B6U3ioer.js → plan-DI0n7LIV.js} +1 -1
- package/dist/chunks/plugin-BQ8gRVYF.js +17 -0
- package/dist/chunks/pluginAutoupdate-CNrHb4RJ.js +1 -0
- package/dist/chunks/{pluginBlocklist-DAoUENwc.js → pluginBlocklist-CKCsgWdY.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CaHnj0C_.js → pluginCliCommands-CACeyIwz.js} +1 -1
- package/dist/chunks/{pluginFlagging-BCj9LJP3.js → pluginFlagging-CUvkKGOB.js} +1 -1
- package/dist/chunks/pluginOperations-Ca_T-HYn.js +2 -0
- package/dist/chunks/pluginStartupCheck-DftTiXct.js +1 -0
- package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +1 -0
- package/dist/chunks/{plugins-D7zyI9c4.js → plugins-Divl-P-X.js} +1 -1
- package/dist/chunks/{poorMode-Ocff_UT1.js → poorMode-CG2JNTD0.js} +1 -1
- package/dist/chunks/poorMode-eMIFCAC_.js +1 -0
- package/dist/chunks/print-DSHypGJa.js +13 -0
- package/dist/chunks/processBashCommand-BLcFmbyG.js +1 -0
- package/dist/chunks/processSlashCommand-Caif46Gi.js +5 -0
- package/dist/chunks/{projectContext-QN5U3Ggr.js → projectContext-BFfHgAMh.js} +1 -1
- package/dist/chunks/{projectContext-COeHKDrk.js → projectContext-DnJHynXv.js} +1 -1
- package/dist/chunks/{projectOnboardingState-KqcpRXls.js → projectOnboardingState-nTCycGCD.js} +1 -1
- package/dist/chunks/prompt-BZmu5CeK.js +1 -0
- package/dist/chunks/{prompt-CTByhpUI.js → prompt-BfXryFt-.js} +8 -8
- package/dist/chunks/prompt-Cogr_WZr.js +1 -0
- package/dist/chunks/promptEditor-14TB3MYt.js +4 -0
- package/dist/chunks/protocolHandler-VigBkAQQ.js +13 -0
- package/dist/chunks/{proxy-BtWuysHM.js → proxy--_NfbJhm.js} +1 -1
- package/dist/chunks/reconciler-B9XFdL4f.js +1 -0
- package/dist/chunks/{refresh-B4pqFp12.js → refresh-CBHbWTGg.js} +1 -1
- package/dist/chunks/reject-CBxnwckZ.js +1 -0
- package/dist/chunks/{reload-plugins-DXQqk7q6.js → reload-plugins-5eFWrQlL.js} +1 -1
- package/dist/chunks/{rename-D4XBmTBI.js → rename-Cw7cMerG.js} +1 -1
- package/dist/chunks/{renderOptions-DkP98P_d.js → renderOptions-B0RFpjRI.js} +1 -1
- package/dist/chunks/{resume-DzIev0JI.js → resume-U2D0ybfU.js} +1 -1
- package/dist/chunks/ripgrep-67m14ImZ.js +5 -0
- package/dist/chunks/ripgrep-DB7KB8RZ.js +1 -0
- package/dist/chunks/{runtimeObserver-BPqlbu0B.js → runtimeObserver-CWaYMJG8.js} +2 -2
- package/dist/chunks/{runtimeObserver-BUHs3qjs.js → runtimeObserver-DOYlxx9H.js} +1 -1
- package/dist/chunks/sandbox-adapter-Df7Wpt77.js +1 -0
- package/dist/chunks/sandbox-toggle-BtiPyjT3.js +1 -0
- package/dist/chunks/searchExtraTools-CbJVb_Zk.js +1 -0
- package/dist/chunks/select-BuTJbu_Q.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +1 -0
- package/dist/chunks/sessionObserver-BZVgzp3W.js +1 -0
- package/dist/chunks/{sessionObserver-B6xzxckA.js → sessionObserver-cfwD8pV8.js} +1 -1
- package/dist/chunks/sessionStorage-SC5RfnUP.js +1 -0
- package/dist/chunks/sessionTracing-DsdcOqvc.js +11 -0
- package/dist/chunks/settings-D4M13toi.js +104 -0
- package/dist/chunks/settings-Dfit5gGT.js +1 -0
- package/dist/chunks/setup-DR-KEmxL.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-D6R2OeoH.js → shadowedRuleDetection-DiZUDzxU.js} +1 -1
- package/dist/chunks/{sideQuestion-5jcbOMsR.js → sideQuestion-CdgUarC2.js} +1 -1
- package/dist/chunks/{sinks-B-kFqjjd.js → sinks-Cy3NqVbk.js} +1 -1
- package/dist/chunks/sinks-D41OiGE4.js +1 -0
- package/dist/chunks/{skillChangeDetector-103-nEle.js → skillChangeDetector-CVFCJcG7.js} +1 -1
- package/dist/chunks/{skillGapStore-DOz1KCqo.js → skillGapStore-BJV8ZIB1.js} +2 -2
- package/dist/chunks/{skillLifecycle-D9NkIwFQ.js → skillLifecycle-iO_3s9Ff.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DFiSZaJ4.js → skillSearchPanel-BL5gXTHU.js} +2 -2
- package/dist/chunks/skills-BEp3_RyT.js +1 -0
- package/dist/chunks/sleep-xKMbXTJe.js +1 -0
- package/dist/chunks/{src-WZ94ZKI3.js → src-BX54x08P.js} +1 -1
- package/dist/chunks/{src-Cy5_qH26.js → src-HB5wLari.js} +1 -1
- package/dist/chunks/{startupProfiler-DIM_Ihyp.js → startupProfiler-B9Qv2QGH.js} +1 -1
- package/dist/chunks/startupProfiler-DWcM4QBl.js +1 -0
- package/dist/chunks/{staticRender-RHUIg5ln.js → staticRender-Bt82RvGc.js} +1 -1
- package/dist/chunks/status-6JMz8jmM.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-DI45AH-c.js → statusNoticeHelpers-BoloSeXY.js} +1 -1
- package/dist/chunks/{stringUtils-D_xPrwGQ.js → stringUtils-Cs6E5f-B.js} +1 -1
- package/dist/chunks/switcher-95d4TrQH.js +1 -0
- package/dist/chunks/{switcher-DhZCaAun.js → switcher-DSt2cVjA.js} +1 -1
- package/dist/chunks/{tasks-6suPhqsK.js → tasks-DyBUXnQb.js} +1 -1
- package/dist/chunks/{templateJobs-BKVEWCsb.js → templateJobs-BBnReWWj.js} +7 -7
- package/dist/chunks/{terminalSetup-7PUR4hfo.js → terminalSetup-CDpFfqqV.js} +1 -1
- package/dist/chunks/{terminalSetup-Cqy5_PhJ.js → terminalSetup-DedaY1P7.js} +4 -4
- package/dist/chunks/{theme-B-HG2PUs.js → theme-BZOy9Iqh.js} +1 -1
- package/dist/chunks/tipRegistry-Cl5sdLRX.js +2 -0
- package/dist/chunks/{toolEventObserver-BY3QVnr6.js → toolEventObserver-ClwWmVbH.js} +1 -1
- package/dist/chunks/{toolPool-BcwIF8Q_.js → toolPool-DSTbgGmX.js} +1 -1
- package/dist/chunks/{udsClient-CCxgLiZy.js → udsClient-CWeoNrm3.js} +1 -1
- package/dist/chunks/{useDoublePress-DQBLKyzJ.js → useDoublePress-zA5QwIpO.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BgJrnuDl.js → useExitOnCtrlCDWithKeybindings-ClN4NJnB.js} +1 -1
- package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +1 -0
- package/dist/chunks/useManagePlugins-CxHz-gUP.js +1 -0
- package/dist/chunks/useMergedTools-BUuWew0-.js +1 -0
- package/dist/chunks/{useSearchInput-BITV_Txn.js → useSearchInput-BIQN_-Hm.js} +1 -1
- package/dist/chunks/{useSettingsErrors-CO0fTNzn.js → useSettingsErrors-BDJCLei_.js} +1 -1
- package/dist/chunks/util-BHr5l6Bx.js +1 -0
- package/dist/chunks/validatePlugin-fx1Y8vam.js +1 -0
- package/dist/chunks/{vim-qgMS88ss.js → vim-CYjMtnwH.js} +1 -1
- package/dist/chunks/worktree-CGu_58ue.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +0 -2
- package/dist/chunks/CustomSelect-CpMbxYbt.js +0 -1
- package/dist/chunks/Doctor-BU69VQzw.js +0 -1
- package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +0 -1
- package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +0 -1
- package/dist/chunks/MCPToolListView-BRxjOaOL.js +0 -1
- package/dist/chunks/MessageSelector-B7xAQqZI.js +0 -3
- package/dist/chunks/Messages-CxMsfjOa.js +0 -10
- package/dist/chunks/Onboarding-CkATe87e.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +0 -1
- package/dist/chunks/QueryEngine-Mdi_kUaL.js +0 -1
- package/dist/chunks/REPL-BgzQtSFF.js +0 -1
- package/dist/chunks/REPL-rirm6s_7.js +0 -124
- package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +0 -1
- package/dist/chunks/SelectMulti-BpAjjhsn.js +0 -1
- package/dist/chunks/Settings-B6DImvca.js +0 -2
- package/dist/chunks/Spinner-DhhSOFcN.js +0 -1
- package/dist/chunks/SpinnerGlyph-CmVXC-_9.js +0 -1
- package/dist/chunks/TrustDialog-CZ8JpySm.js +0 -1
- package/dist/chunks/agents-HIOBiw4w.js +0 -101
- package/dist/chunks/allErrors-CxPNR2WN.js +0 -1
- package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +0 -1
- package/dist/chunks/banner-DqFectPg.js +0 -2
- package/dist/chunks/branch-B_BL5N9N.js +0 -2
- package/dist/chunks/bundledMode-BxyD5cqq.js +0 -1
- package/dist/chunks/caches-5xZ4dSXt.js +0 -1
- package/dist/chunks/caches-Be9saXxV.js +0 -1
- package/dist/chunks/claudeDesktop-g8eUUY2E.js +0 -1
- package/dist/chunks/client-mnUISv_N.js +0 -1
- package/dist/chunks/client-wPqIdEVm.js +0 -1
- package/dist/chunks/commands-wfE12a4L.js +0 -1
- package/dist/chunks/config-D3K87Mm1.js +0 -3
- package/dist/chunks/config-DTga6Ku8.js +0 -1
- package/dist/chunks/config-DtmqWusU.js +0 -1
- package/dist/chunks/context-noninteractive-eIlneYiL.js +0 -1
- package/dist/chunks/conversation-CHesBfFZ.js +0 -1
- package/dist/chunks/conversationRecovery-OhitW-7g.js +0 -1
- package/dist/chunks/crossProjectResume-mmYx8PrZ.js +0 -40
- package/dist/chunks/detectRepository-M6K2wc7h.js +0 -1
- package/dist/chunks/directoryCompletion-BHyjyKAM.js +0 -1
- package/dist/chunks/doctor-DeBG5SL5.js +0 -1
- package/dist/chunks/entry-CbhyIWgj.js +0 -13
- package/dist/chunks/extractMemories-jnsv-_n_.js +0 -1
- package/dist/chunks/fast-4I_qPJCd.js +0 -1
- package/dist/chunks/fast-DiolM1M7.js +0 -1
- package/dist/chunks/fetchModelList-BRFTQim4.js +0 -1
- package/dist/chunks/fetchModelList-qPKAuu4m.js +0 -1
- package/dist/chunks/fileSuggestions-iWVXvvLB.js +0 -3
- package/dist/chunks/generateSessionName-CGaTTXCA.js +0 -1
- package/dist/chunks/hooks-Bg9WIjZQ.js +0 -1
- package/dist/chunks/install-ACGY0vhM.js +0 -1
- package/dist/chunks/loadAgentsDir-DqAbnpB-.js +0 -1
- package/dist/chunks/loader-6MqzNGmV.js +0 -1
- package/dist/chunks/localSearch-DW3JT2MA.js +0 -1
- package/dist/chunks/managedEnv-DCEJh3z3.js +0 -1
- package/dist/chunks/mcp-CJ6SDJEK.js +0 -6
- package/dist/chunks/memory-BQO6Y0ak.js +0 -1
- package/dist/chunks/model-D42epddJ.js +0 -1
- package/dist/chunks/modelOptions-beLgXORr.js +0 -1
- package/dist/chunks/nativeInstaller-ChGSz1lb.js +0 -1
- package/dist/chunks/parser-BZt0VFd_.js +0 -1
- package/dist/chunks/permissions-DkfWKN-B.js +0 -3
- package/dist/chunks/pidLock-YvAaIrIY.js +0 -3
- package/dist/chunks/platform-Vl9IynC3.js +0 -2
- package/dist/chunks/plugin-CTA2_-F7.js +0 -17
- package/dist/chunks/pluginAutoupdate-Dy5W3HWE.js +0 -1
- package/dist/chunks/pluginOperations-ClXNOOG6.js +0 -2
- package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +0 -1
- package/dist/chunks/pluginStartupCheck-U8_xk25t.js +0 -1
- package/dist/chunks/poorMode-DtzWNhsY.js +0 -1
- package/dist/chunks/print-BzljdXem.js +0 -13
- package/dist/chunks/processBashCommand-RUkmyAl4.js +0 -1
- package/dist/chunks/processSlashCommand-DRLO-jNV.js +0 -5
- package/dist/chunks/prompt-DTpfW6yP.js +0 -1
- package/dist/chunks/prompt-D__eHY_5.js +0 -1
- package/dist/chunks/promptEditor-CpUFgGzc.js +0 -4
- package/dist/chunks/protocolHandler-BQSLVGnG.js +0 -13
- package/dist/chunks/reconciler-D6BUq8WB.js +0 -1
- package/dist/chunks/reject-C6IvUvBt.js +0 -1
- package/dist/chunks/ripgrep-CYP26Fhg.js +0 -1
- package/dist/chunks/ripgrep-D1f1pbCz.js +0 -5
- package/dist/chunks/sandbox-adapter-CumL75tU.js +0 -1
- package/dist/chunks/sandbox-toggle-CTtET6Xq.js +0 -1
- package/dist/chunks/searchExtraTools-BMCU2zEf.js +0 -1
- package/dist/chunks/select-FrwoTzuc.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +0 -1
- package/dist/chunks/sessionObserver-CBrM4opL.js +0 -1
- package/dist/chunks/sessionStorage-C1EAxDWG.js +0 -1
- package/dist/chunks/sessionTracing-UFK96PxT.js +0 -11
- package/dist/chunks/settings-BK6gCko-.js +0 -1
- package/dist/chunks/settings-YIDksG5Z.js +0 -24
- package/dist/chunks/setup-BBvZyrfz.js +0 -3
- package/dist/chunks/sinks-DB_D4lmu.js +0 -1
- package/dist/chunks/skills-DgeLr52a.js +0 -1
- package/dist/chunks/sleep-BbWr_FL1.js +0 -1
- package/dist/chunks/startupProfiler-FpGsKWYk.js +0 -1
- package/dist/chunks/status-CKLecQZV.js +0 -1
- package/dist/chunks/switcher-D2Z2ZNQ0.js +0 -1
- package/dist/chunks/tipRegistry-BR_lSGRw.js +0 -2
- package/dist/chunks/types-CD25a50S.js +0 -81
- package/dist/chunks/use-select-navigation-CW5alA9r.js +0 -1
- package/dist/chunks/useMainLoopModel-BVgJo4hN.js +0 -1
- package/dist/chunks/useManagePlugins-CrWjzESW.js +0 -1
- package/dist/chunks/useMergedTools-r6GQq5mI.js +0 -1
- package/dist/chunks/util-_zo3I1y8.js +0 -1
- package/dist/chunks/validatePlugin-DFGdRhA-.js +0 -1
- package/dist/chunks/worktree-CR_M6Qfy.js +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
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-BX54x08P.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as v,Br as re,Qn as y,qr as ie}from"./settings-D4M13toi.js";import{Pt as b,at as ae,q as oe}from"./state-CXY-q5gr.js";import{Dc as x,Or as se,Tb as S,Tc as ce,bi as le,br as C,ei as ue,gr as w,hd as de,lr as T,md as E,sb as D,tb as fe,tr as pe,vS as O,vr as me,wb as he,yS as k,yi as ge}from"./loadAgentsDir-uuZYOgKn.js";import{S as _e,c as A,i as ve,x as j}from"./debug-2pVES-2G.js";import{a as M,o as ye,s as be}from"./log-L1kqxa_P.js";import{n as xe}from"./analytics-COpjZpvd.js";import{S as Se,_ as N,d as Ce,p as we}from"./startupProfiler-B9Qv2QGH.js";import{f as Te,u as Ee}from"./model-CcHyMyBv.js";import{n as De,t as P}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as F,t as Oe}from"./TextInput-ZKU-x_FD.js";import{n as ke,t as Ae}from"./select-BuTJbu_Q.js";import{r as je,t as Me}from"./Spinner-DOI8qqZi.js";import{l as Ne,u as Pe}from"./SpinnerGlyph-BR_SiV9L.js";import{t as Fe}from"./SearchBox-zA5QwIpO.js";import{n as Ie,t as Le}from"./useSearchInput-BIQN_-Hm.js";import{n as I,t as L}from"./Messages-RBfRELKn.js";function Re({log:e,onExit:t,onSelect:n}){let[i,a]=R.useState(null);R.useEffect(()=>{a(null),C(e)&&se(e).then(a)},[e]);let u=C(e)&&i===null,d=i??e,f=T(d)||``,p=ce();return l(`confirm:no`,t,{context:`Confirmation`}),l(`confirm:yes`,(0,R.useCallback)(()=>{n(i??e)},[n,i,e]),{context:`Confirmation`}),u?(0,z.jsxs)(o,{flexDirection:`column`,padding:1,children:[(0,z.jsx)(h,{message:`Loading session…`}),(0,z.jsx)(s,{dimColor:!0,children:(0,z.jsx)(c,{children:(0,z.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,z.jsxs)(o,{flexDirection:`column`,children:[(0,z.jsx)(L,{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,z.jsxs)(o,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,z.jsxs)(s,{children:[we(d.modified),` · `,d.messageCount,` messages`,d.gitBranch?` · ${d.gitBranch}`:``]}),(0,z.jsx)(s,{dimColor:!0,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(r,{shortcut:`Enter`,action:`resume`}),(0,z.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var R,z,ze=e((()=>{R=t(d(),1),g(),fe(),x(),N(),w(),de(),I(),z=_()}));function B(e,t){if(e===H)return 5;let n=i(e),r=t?Math.min(n,t-U-W):n;return Math.max(0,r)+U+W}function Be(e,t){let n=t-U-W;return i(e)<=n?e:n<=1?e.charAt(0):Se(e,n)}function Ve({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,c=Math.max(Ke,K),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=>B(e,d)),p=0,m=e.length;if(f.reduce((e,t,n)=>e+t+ +(n<f.length-1),0)>l){let t=l-Ge,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,V.jsxs)(o,{flexDirection:`row`,gap:1,children:[(0,V.jsx)(s,{color:`suggestion`,children:i}),ee>0&&(0,V.jsxs)(s,{dimColor:!0,children:[G,ee]}),ne.map((e,t)=>{let n=h[t]===u,r=e===H?e:`#${Be(e,d-U)}`;return(0,V.jsxs)(s,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),te>0?(0,V.jsxs)(s,{dimColor:!0,children:[He,te,Ue]}):(0,V.jsx)(s,{dimColor:!0,children:We})]})}var V,H,U,W,G,He,Ue,We,Ge,Ke,K,qe=e((()=>{g(),N(),V=_(),H=`All`,U=2,W=1,G=`← `,He=`→`,Ue=` (tab to cycle)`,We=`(tab to cycle)`,Ge=5,Ke=18,K=14}));function Je({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:s=`expanded`,isDisabled:c=!1,hideIndexes:l=!1,isNodeExpanded:u,onExpand:d,onCollapse:f,getParentPrefix:p,getChildPrefix:m,onUpFromFirstItem:ee}){let[te,ne]=q.useState(new Set),h=q.useRef(!1),g=q.useRef(null),_=q.useCallback(e=>u?u(e):te.has(e),[u,te]),v=q.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=_(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,_]),re=q.useCallback(e=>e?`▼ `:`▶ `,[]),y=q.useCallback(e=>` ▸ `,[]),ie=p??re,b=m??y,ae=q.useCallback(e=>{let t=``;return e.hasChildren?t=ie(e.isExpanded):e.depth>0&&(t=b(e.depth)),t+e.node.label},[ie,b]),oe=q.useMemo(()=>v.map(e=>({label:ae(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[v,ae]),x=q.useMemo(()=>{let e=new Map;return v.forEach(t=>e.set(t.node.id,t.node)),e},[v]),se=q.useCallback(e=>v.find(t=>t.node.id===e),[v]),S=q.useCallback((e,t)=>{se(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}))},[se,d,f]);return(0,Ye.jsx)(o,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||c)return;let t=se(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),S(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),S(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,S(t.parentId,!1),r)){let e=x.get(t.parentId);e&&r(e)}}}},children:(0,Ye.jsx)(Ae,{options:oe,onChange:q.useCallback(e=>{let n=x.get(e);n&&t(n)},[x,t]),onFocus:q.useCallback(e=>{if(h.current){h.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=x.get(e);t&&r(t)}},[r,x]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:s,isDisabled:c,hideIndexes:l,onUpFromFirstItem:ee})})}var q,Ye,Xe=e((()=>{q=t(d(),1),g(),ke(),Ye=_()}));function Ze(e,t){return Se(e.replace(/\s+/g,` `).trim(),t)}function Qe({before:e,match:t,after:n},r){return f.dim(e)+r(t)+f.dim(n)}function $e(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function et(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?st:i?ct:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${Ze(M(e),l)}${c}${s}`}function tt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=Ce(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function nt({logs:e,maxHeight:t=1/0,forceWidth:i,onCancel:d,onSelect:f,onLogsChanged:p,onLoadMore:h,initialSearchQuery:g,showAllProjects:_=!1,onToggleAllProjects:v,onAgenticSearch:y}){let ie=ne(),b=i===void 0?ie.columns:i,x=De(d),se=u(),S=me(),[ce]=a(),le=Ne(ce),C=J.useMemo(()=>e=>te(e,le.warning),[le.warning]),[w,de]=J.useState(null),[D,fe]=J.useState(!1),[O,he]=J.useState(!1),[k,_e]=J.useState(!1),A=J.useMemo(()=>oe(),[]),[ve,j]=J.useState(``),[ye,be]=J.useState(0),[xe,Se]=J.useState(new Set),[N,we]=J.useState(null),[Te,Ee]=J.useState(1),[P,F]=J.useState(`list`),[ke,je]=J.useState(null),Pe=J.useRef(null),[Fe,Le]=J.useState(0),[I,L]=J.useState({status:`idle`}),[R,z]=J.useState(!1),ze=J.useRef(null),{query:B,setQuery:Be,cursorOffset:V}=Ie({isActive:P===`search`&&I.status!==`searching`,onExit:()=>{F(`list`)},onExitUp:()=>{F(`list`)},passthroughCtrlKeys:[`n`],initialQuery:g||``}),H=J.useDeferredValue(B),[U,W]=J.useState(``);J.useEffect(()=>{if(!H){W(``);return}let e=setTimeout(W,300,H);return()=>clearTimeout(e)},[H]);let[G,He]=J.useState(null),[Ue,We]=J.useState(!1);J.useEffect(()=>{re().then(e=>de(e)),ge(A).then(e=>{_e(e.length>1)})},[A]);let Ge=J.useMemo(()=>new Map(e.map(e=>[e,it(e)])),[e]),Ke=J.useMemo(()=>null,[e,Ge,!1]),K=J.useMemo(()=>ot(e),[e]),qe=K.length>0,q=J.useMemo(()=>qe?[`All`,...K]:[],[qe,K]),Ye=q.length>0&&Fe<q.length?Fe:0,Xe=q[Ye],nt=Xe===`All`?void 0:Xe,rt=+!!qe,st=J.useMemo(()=>{let t=e;return S&&(t=e.filter(e=>{let t=ae(),n=T(e);return!!(t&&n===t||e.customTitle||pe(e.messages)||e.firstPrompt||e.customTitle)})),nt!==void 0&&(t=t.filter(e=>e.tag===nt)),D&&w&&(t=t.filter(e=>e.gitBranch===w)),k&&!O&&(t=t.filter(e=>e.projectPath===A)),t},[e,S,nt,D,w,k,O,A]),ct=J.useMemo(()=>{if(!B)return st;let e=B.toLowerCase();return st.filter(t=>{let n=M(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[st,B]);J.useEffect(()=>{},[H,U,!1]),J.useEffect(()=>{He(null),We(!1)},[U,Ke,!1]);let{filteredLogs:lt,snippets:X}=J.useMemo(()=>{let e=new Map,t=ct;if(G&&U&&G.query===U){for(let t of G.results)if(t.searchableText){let n=$e(t.searchableText,U,ut);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=G.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ct,G,U]),Z=J.useMemo(()=>I.status===`results`&&I.results.length>0?I.results:lt,[I,lt]),Q=Math.max(30,b-4),dt=J.useMemo(()=>{if(!S)return[];let e=at(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?Qe(i,C):null;if(t.length===1){let t=tt(n,{showProjectPath:_});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:et(n,Q),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=Z.indexOf(t),i=X.get(t),a=i?Qe(i,C):null,o=tt(t,{isChild:!0,showProjectPath:_});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:et(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=tt(n,{showProjectPath:_});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:et(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[S,Z,Q,_,X,C]),ft=J.useMemo(()=>S?[]:Z.map((e,t)=>{let n=Ze(M(e)+(e.isSidechain?` (sidechain)`:``),Q),r=Ce(e),i=_&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?Qe(a,C):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[S,Z,C,Q,_,X]),$=N?.value.log??null,pt=()=>{if(!S||!$)return``;let e=T($);if(!e)return``;let t=Z.filter(t=>T(t)===e);if(!(t.length>1))return``;let n=xe.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},mt=J.useCallback(async()=>{let e=$?T($):void 0;if(!$||!e){F(`list`),j(``);return}ve.trim()&&(await ue(e,ve.trim(),$.fullPath),S&&p&&p()),F(`list`),j(``)},[$,ve,p,S]),ht=J.useCallback(()=>{F(`list`)},[]),gt=J.useCallback(()=>{F(`search`)},[]),_t=J.useCallback(async()=>{if(!B.trim()||!y||!0)return;ze.current?.abort();let t=new AbortController;ze.current=t,L({status:`searching`}),B.length;try{let n=await y(B,e,t.signal);if(t.signal.aborted)return;L({status:`results`,results:n,query:B}),B.length,n.length}catch(e){if(t.signal.aborted)return;L({status:`error`,message:e instanceof Error?e.message:`Search failed`}),B.length}},[B,y,!1,e]);J.useEffect(()=>{I.status!==`idle`&&I.status!==`searching`&&(I.status===`results`&&I.query!==B||I.status===`error`)&&L({status:`idle`})},[B,I]),J.useEffect(()=>()=>{ze.current?.abort()},[]);let vt=J.useRef(I.status);J.useEffect(()=>{let e=vt.current;if(vt.current=I.status,e===`searching`&&I.status===`results`){if(S&&dt.length>0)we(dt[0]);else if(!S&&Z.length>0){let e=Z[0];we({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[I.status,S,dt,Z]);let yt=J.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Pe.current===t.toString()||(Pe.current=t.toString(),we({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Ee(t+1))},[Z]),bt=J.useCallback(e=>{we(e);let t=Z.findIndex(t=>T(t)===T(e.value.log));t>=0&&Ee(t+1)},[Z]);l(`confirm:no`,()=>{ze.current?.abort(),L({status:`idle`})},{context:`Confirmation`,isActive:P!==`preview`&&I.status===`searching`}),l(`confirm:no`,()=>{F(`list`),j(``)},{context:`Settings`,isActive:P===`rename`&&I.status!==`searching`}),l(`confirm:no`,()=>{Be(``),z(!1),d?.()},{context:`Confirmation`,isActive:P!==`preview`&&P!==`rename`&&P!==`search`&&R&&I.status!==`searching`}),m((e,t)=>{if(P!==`preview`&&I.status!==`searching`&&P!==`rename`)if(P===`search`)e.toLowerCase()===`n`&&t.ctrl?ht():(t.return||t.downArrow)&&B.trim();else{if(R){if(t.return){_t(),z(!1);return}else if(t.downArrow){z(!1);return}else if(t.upArrow){F(`search`),z(!1);return}}if(qe&&t.tab){let e=t.shift?-1:1;Le(t=>{let n=((t<q.length?t:0)+q.length+e)%q.length;return q[n],K.length,n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();r===`a`&&t.ctrl&&v?v():r===`b`&&t.ctrl?fe(!D):r===`w`&&t.ctrl&&k?he(!O):r===`/`&&n?F(`search`):r===`r`&&t.ctrl&&$?(F(`rename`),j(``)):r===`v`&&t.ctrl&&$?(je($),F(`preview`),$.messageCount):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(F(`search`),Be(e))}},{isActive:!0});let xt=[];D&&w&&xt.push(w),k&&!O&&xt.push(`current worktree`);let St=8+ +(xt.length>0&&P!==`search`)+rt,Ct=Math.max(1,Math.floor((t-St-2)/3));return J.useEffect(()=>{if(!h)return;let e=Ct*2;Te+e>=Z.length&&h(Ct*3)},[Te,Ct,Z.length,h]),e.length===0?null:P===`preview`&&ke&&S?(0,Y.jsx)(Re,{log:ke,onExit:()=>{F(`list`),je(null)},onSelect:f}):(0,Y.jsxs)(o,{flexDirection:`column`,height:t-1,children:[(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(n,{color:`suggestion`})}),(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(s,{children:` `})}),qe?(0,Y.jsx)(Ve,{tabs:q,selectedIndex:Ye,availableWidth:b,showAllProjects:_}):(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsxs)(s,{bold:!0,color:`suggestion`,children:[`Resume Session`,P===`list`&&Z.length>Ct&&(0,Y.jsxs)(s,{dimColor:!0,children:[` `,`(`,Te,` of `,Z.length,`)`]})]})}),(0,Y.jsx)(ee,{query:B,isFocused:P===`search`,isTerminalFocused:se,cursorOffset:V}),xt.length>0&&P!==`search`&&(0,Y.jsx)(o,{flexShrink:0,paddingLeft:2,children:(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsx)(c,{children:xt})})}),(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(s,{children:` `})}),I.status===`searching`&&(0,Y.jsxs)(o,{paddingLeft:1,flexShrink:0,children:[(0,Y.jsx)(Me,{}),(0,Y.jsx)(s,{children:` Searching…`})]}),I.status===`results`&&I.results.length>0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),I.status===`results`&&I.results.length===0&<.length===0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),I.status===`error`&<.length===0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!B.trim()&&y&&!1,I.status===`searching`?null:P===`rename`&&$?(0,Y.jsxs)(o,{paddingLeft:2,flexDirection:`column`,children:[(0,Y.jsx)(s,{bold:!0,children:`Rename session:`}),(0,Y.jsx)(o,{paddingTop:1,children:(0,Y.jsx)(Oe,{value:ve,onChange:j,onSubmit:mt,placeholder:M($,`Enter new session name`),columns:b,cursorOffset:ye,onChangeCursorOffset:be,showCursor:!0})})]}):S?(0,Y.jsx)(Je,{nodes:dt,onSelect:e=>{f(e.value.log)},onFocus:bt,onCancel:d,focusNodeId:N?.id,visibleOptionCount:Ct,layout:`expanded`,isDisabled:P===`search`||R,hideIndexes:!1,isNodeExpanded:e=>{if(P===`search`||D)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?xe.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Se(e=>new Set(e).add(t))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Se(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:gt}):(0,Y.jsx)(Ae,{options:ft,onChange:e=>{let t=Z[parseInt(e,10)];t&&f(t)},visibleOptionCount:Ct,onCancel:d,onFocus:yt,defaultFocusValue:N?.id.toString(),layout:`expanded`,isDisabled:P===`search`||R,onUpFromFirstItem:gt}),(0,Y.jsx)(o,{paddingLeft:2,children:x.pending?(0,Y.jsxs)(s,{dimColor:!0,children:[`Press `,x.keyName,` again to exit`]}):P===`rename`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(r,{shortcut:`Enter`,action:`save`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I.status===`searching`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(s,{children:`Searching with Work Mate…`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):R?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(r,{shortcut:`Enter`,action:`search`}),(0,Y.jsx)(r,{shortcut:`↓`,action:`skip`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P===`search`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(s,{children:`Type to Search`}),(0,Y.jsx)(r,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[v&&(0,Y.jsx)(r,{shortcut:`Ctrl+A`,action:`show ${_?`current dir`:`all projects`}`}),w&&(0,Y.jsx)(r,{shortcut:`Ctrl+B`,action:`toggle branch`}),k&&(0,Y.jsx)(r,{shortcut:`Ctrl+W`,action:`show ${O?`current worktree`:`all worktrees`}`}),(0,Y.jsx)(r,{shortcut:`Ctrl+V`,action:`preview`}),(0,Y.jsx)(r,{shortcut:`Ctrl+R`,action:`rename`}),(0,Y.jsx)(s,{children:`Type to search`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),pt()&&(0,Y.jsx)(s,{children:pt()})]})})})]})}function rt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function it(e){let t=(e.messages.length<=lt?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(rt).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>Z?n.slice(0,Z):n}function at(e){let t=new Map;for(let n of e){let e=T(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function ot(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var J,Y,st,ct,lt,X,Z,ut,Q=e((()=>{p(),J=t(d(),1),b(),P(),Le(),D(),g(),fe(),xe(),N(),le(),ie(),ye(),w(),Pe(),de(),ke(),Fe(),ze(),je(),qe(),F(),Xe(),Y=_(),st=2,ct=4,lt=2e3,X=1e3,Z=5e4,ut=50}));function dt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function ft(e){if(e.length===0)return``;let t=(e.length<=ht?e:[...e.slice(0,ht/2),...e.slice(-100/2)]).map(dt).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>mt?`${t.slice(0,mt)}…`:t}function $(e,t){return!!(M(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&ft(e.messages).toLowerCase().includes(t))}async function pt(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>$(e,r)),a;if(i.length>=gt)a=i.slice(0,gt);else{let e=t.filter(e=>!$(e,r)),n=gt-i.length;a=[...i,...e.slice(0,n)]}A(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${y(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(C(e))try{return await se(e)}catch(t){return be(t),e}return e}),s=await Promise.all(o);A(`Agentic search: loaded ${y(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
|
|
2
|
+
${s.map((e,t)=>{let n=[`${t}:`],r=M(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=ft(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
|
|
3
|
+
`)}
|
|
4
|
+
|
|
5
|
+
Search query: "${e}"
|
|
6
|
+
|
|
7
|
+
Find the sessions that are most relevant to this query.`;A(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=Ee();A(`Agentic search using model: ${e}`);let t=(await k({model:e,system:_t,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return A(`No text content in agentic search response`),[];A(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return A(`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 A(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return be(e),A(`Agentic search error: ${e}`),[]}}var mt,ht,gt,_t,vt=e((()=>{v(),ve(),ye(),Te(),w(),O(),j(),mt=2e3,ht=100,gt=100,_t=`Your goal is to find relevant sessions based on a user's search query.
|
|
8
|
+
|
|
9
|
+
You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
|
|
10
|
+
|
|
11
|
+
Each session may include:
|
|
12
|
+
- Title (display name or custom title)
|
|
13
|
+
- Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
|
|
14
|
+
- Branch (git branch name, shown as [branch: name])
|
|
15
|
+
- Summary (AI-generated summary)
|
|
16
|
+
- First message (beginning of the conversation)
|
|
17
|
+
- Transcript (excerpt of conversation content)
|
|
18
|
+
|
|
19
|
+
IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
|
|
20
|
+
|
|
21
|
+
For each session, consider (in order of priority):
|
|
22
|
+
1. Exact tag matches (highest priority - user explicitly categorized this session)
|
|
23
|
+
2. Partial tag matches or tag-related terms
|
|
24
|
+
3. Title matches (custom titles or first message content)
|
|
25
|
+
4. Branch name matches
|
|
26
|
+
5. Summary and transcript content matches
|
|
27
|
+
6. Semantic similarity and related concepts
|
|
28
|
+
|
|
29
|
+
CRITICAL: Be VERY inclusive in your matching. Include sessions that:
|
|
30
|
+
- Contain the query term anywhere in any field
|
|
31
|
+
- Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
|
|
32
|
+
- Discuss topics that could be related to the query
|
|
33
|
+
- Have transcripts that mention the concept even in passing
|
|
34
|
+
|
|
35
|
+
When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
|
|
36
|
+
|
|
37
|
+
Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
|
|
38
|
+
|
|
39
|
+
Respond with ONLY the JSON object, no markdown formatting:
|
|
40
|
+
{"relevant_indices": [2, 5, 0]}`}));function yt(e,t){let n=oe();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=T(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${S([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var bt=e((()=>{b(),he(),w()}));export{nt as a,vt as i,bt as n,Q as o,pt as r,yt as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-DZ_SvEVz.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{Pt as l,at as u}from"./state-CXY-q5gr.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r?.[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i?.[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,x=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new Fe({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Le(t,a,r,i,o):t===401?new Re(t,a,r,i,o):t===403?new ze(t,a,r,i,o):t===404?new Be(t,a,r,i,o):t===409?new Ve(t,a,r,i,o):t===422?new He(t,a,r,i,o):t===429?new Ue(t,a,r,i,o):t>=500?new We(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},Fe=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Ie=class extends Fe{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{},We=class extends y{}}));function Ge(e){return typeof e==`object`?e??{}:{}}function Ke(e){if(!e)return!0;for(let t in e)return!1;return!0}function qe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Je,Ye,Xe,Ze,Qe,$e,et=e((()=>{x(),Je=/^[a-z][a-z0-9+.-]*:/i,Ye=e=>Je.test(e),Xe=e=>(Xe=Array.isArray,Xe(e)),Ze=Xe,Qe=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},$e=e=>{try{return JSON.parse(e)}catch{return}}})),tt,nt=e((()=>{tt=e=>new Promise(t=>setTimeout(t,e))})),S,rt=e((()=>{S=`0.81.0`}));function it(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function at(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var ot,st,ct,lt,ut,dt,ft=e((()=>{rt(),ot=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,st=()=>{let e=it();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(Deno.build.os),"X-Stainless-Arch":ct(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(globalThis.process.platform??`unknown`),"X-Stainless-Arch":ct(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=at();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},ct=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,lt=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),dt=()=>ut??(ut=st())}));function pt(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function mt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ht(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return mt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function gt(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function _t(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var vt=e((()=>{})),yt,bt=e((()=>{yt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function xt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var St=e((()=>{x()}));function Ct(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function wt(e){let t;return(Et??(t=new globalThis.TextEncoder,Et=t.encode.bind(t)))(e)}function Tt(e){let t;return(Dt??(t=new globalThis.TextDecoder,Dt=t.decode.bind(t)))(e)}var Et,Dt,Ot=e((()=>{}));function kt(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function At(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var C,w,jt,Mt=e((()=>{_(),Ot(),jt=class{constructor(){C.set(this,void 0),w.set(this,void 0),h(this,C,new Uint8Array,`f`),h(this,w,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?wt(e):e;h(this,C,Ct([g(this,C,`f`),t]),`f`);let n=[],r;for(;(r=kt(g(this,C,`f`),g(this,w,`f`)))!=null;){if(r.carriage&&g(this,w,`f`)==null){h(this,w,r.index,`f`);continue}if(g(this,w,`f`)!=null&&(r.index!==g(this,w,`f`)+1||r.carriage)){n.push(Tt(g(this,C,`f`).subarray(0,g(this,w,`f`)-1))),h(this,C,g(this,C,`f`).subarray(g(this,w,`f`)),`f`),h(this,w,null,`f`);continue}let e=g(this,w,`f`)===null?r.preceding:r.preceding-1,t=Tt(g(this,C,`f`).subarray(0,e));n.push(t),h(this,C,g(this,C,`f`).subarray(r.index),`f`),h(this,w,null,`f`)}return n}flush(){return g(this,C,`f`).length?this.decode(`
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-QyzA_cFM.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{Pt as l,at as u}from"./state-CXY-q5gr.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r?.[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i?.[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,x=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new Fe({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Le(t,a,r,i,o):t===401?new Re(t,a,r,i,o):t===403?new ze(t,a,r,i,o):t===404?new Be(t,a,r,i,o):t===409?new Ve(t,a,r,i,o):t===422?new He(t,a,r,i,o):t===429?new Ue(t,a,r,i,o):t>=500?new We(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},Fe=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Ie=class extends Fe{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{},We=class extends y{}}));function Ge(e){return typeof e==`object`?e??{}:{}}function Ke(e){if(!e)return!0;for(let t in e)return!1;return!0}function qe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Je,Ye,Xe,Ze,Qe,$e,et=e((()=>{x(),Je=/^[a-z][a-z0-9+.-]*:/i,Ye=e=>Je.test(e),Xe=e=>(Xe=Array.isArray,Xe(e)),Ze=Xe,Qe=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},$e=e=>{try{return JSON.parse(e)}catch{return}}})),tt,nt=e((()=>{tt=e=>new Promise(t=>setTimeout(t,e))})),S,rt=e((()=>{S=`0.81.0`}));function it(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function at(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var ot,st,ct,lt,ut,dt,ft=e((()=>{rt(),ot=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,st=()=>{let e=it();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(Deno.build.os),"X-Stainless-Arch":ct(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(globalThis.process.platform??`unknown`),"X-Stainless-Arch":ct(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=at();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},ct=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,lt=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),dt=()=>ut??(ut=st())}));function pt(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function mt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ht(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return mt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function gt(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function _t(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var vt=e((()=>{})),yt,bt=e((()=>{yt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function xt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var St=e((()=>{x()}));function Ct(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function wt(e){let t;return(Et??(t=new globalThis.TextEncoder,Et=t.encode.bind(t)))(e)}function Tt(e){let t;return(Dt??(t=new globalThis.TextDecoder,Dt=t.decode.bind(t)))(e)}var Et,Dt,Ot=e((()=>{}));function kt(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function At(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var C,w,jt,Mt=e((()=>{_(),Ot(),jt=class{constructor(){C.set(this,void 0),w.set(this,void 0),h(this,C,new Uint8Array,`f`),h(this,w,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?wt(e):e;h(this,C,Ct([g(this,C,`f`),t]),`f`);let n=[],r;for(;(r=kt(g(this,C,`f`),g(this,w,`f`)))!=null;){if(r.carriage&&g(this,w,`f`)==null){h(this,w,r.index,`f`);continue}if(g(this,w,`f`)!=null&&(r.index!==g(this,w,`f`)+1||r.carriage)){n.push(Tt(g(this,C,`f`).subarray(0,g(this,w,`f`)-1))),h(this,C,g(this,C,`f`).subarray(g(this,w,`f`)),`f`),h(this,w,null,`f`);continue}let e=g(this,w,`f`)===null?r.preceding:r.preceding-1,t=Tt(g(this,C,`f`).subarray(0,e));n.push(t),h(this,C,g(this,C,`f`).subarray(r.index),`f`),h(this,w,null,`f`)}return n}flush(){return g(this,C,`f`).length?this.decode(`
|
|
2
2
|
`):[]}},C=new WeakMap,w=new WeakMap,jt.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),jt.NEWLINE_REGEXP=/\r\n|[\n\r]/g}));function Nt(){}function Pt(e,t,n){return!t||Ft[e]>Ft[n]?Nt:t[e].bind(t)}function T(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Lt;let r=Rt.get(t);if(r&&r[0]===n)return r[1];let i={error:Pt(`error`,t,n),warn:Pt(`warn`,t,n),info:Pt(`info`,t,n),debug:Pt(`debug`,t,n)};return Rt.set(t,[n,i]),i}var Ft,It,Lt,Rt,E,zt=e((()=>{et(),Ft={off:0,error:200,warn:300,info:400,debug:500},It=(e,t,n)=>{if(e){if(qe(Ft,e))return e;T(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Ft))}`)}},Lt={error:Nt,warn:Nt,info:Nt,debug:Nt},Rt=new WeakMap,E=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`x-api-key`||e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t]))),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e)}));async function*Bt(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new v(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new v(`Attempted to iterate over a response with no body`);let n=new Gt,r=new jt,i=gt(e.body);for await(let e of Vt(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Vt(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?wt(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=At(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function Ht(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}var Ut,Wt,Gt,Kt=e((()=>{_(),x(),vt(),Mt(),Pe(),et(),Ot(),zt(),Wt=class e{constructor(e,t,n){this.iterator=e,Ut.set(this,void 0),this.controller=t,h(this,Ut,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?T(r):console;async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let e of Bt(t,n)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event===`message_start`||e.event===`message_delta`||e.event===`message_stop`||e.event===`content_block_start`||e.event===`content_block_delta`||e.event===`content_block_stop`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let n=$e(e.data)??e.data,r=n?.error?.type;throw new y(void 0,n,void 0,t.headers,r)}}e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new jt,n=gt(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ut=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,g(this,Ut,`f`)),new e(()=>i(n),this.controller,g(this,Ut,`f`))]}toReadableStream(){let e=this,t;return mt({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=wt(JSON.stringify(n)+`
|
|
4
4
|
`);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}},Gt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Wr as t,qr as n}from"./settings-D4M13toi.js";import{n as r,t as i}from"./cwd-DrEEb4f5.js";import{c as a,i as o}from"./debug-2pVES-2G.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=i();if(f.has(e))return f.get(e)??null;try{let n=await t();if(a(`Git remote URL: ${n}`),!n)return a(`没找到 git remote URL`),f.set(e,null),null;let r=u(n);return a(`Parsed repository: ${r?`${r.host}/${r.owner}/${r.name}`:null} from URL: ${n}`),f.set(e,r),r}catch(t){return a(`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((()=>{r(),o(),n(),f=new Map}));export{c as n,p as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-CTUIAcEE.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$r as t,Qr as n,dr as r,pr as i}from"./settings-D4M13toi.js";import{n as a,t as o}from"./cwd-DrEEb4f5.js";import{f as s,u as c}from"./debug-2pVES-2G.js";import{o as l,s as u}from"./log-L1kqxa_P.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||o(),prefix:``};let n=r(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 c().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=o(),maxResults:r=10}=t,{directory:i,prefix:a}=h(e,n),s=await g(i),c=a.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 c().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=o(),maxResults:r=10,includeFiles:i=!0,includeHidden:a=!1}=t,{directory:s,prefix:c}=h(e,n),l=await y(s,a),u=c.toLowerCase(),d=l.filter(e=>!i&&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((()=>{t(),a(),s(),l(),i(),x=500,S=300*1e3,C=new n({max:x,ttl:S}),w=new n({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-CLOYkPRR.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{Gi as n,Ni as r,Or as i,Vi as a,Wi as o,Yi as s,Zi as c,ca as l,d as u,ea as d,ia as f,m as p,oa as m,sa as h,ta as g,ua as _,vr as v,wr as y}from"./settings-D4M13toi.js";import{$n as b,Hn as x,Pt as S,Qn as ee,Tn as C,ot as te,q as ne}from"./state-CXY-q5gr.js";import{B as re,Dc as ie,Di as ae,Ds as oe,Ec as se,Gv as ce,Mi as le,Os as ue,V as de,Vv as fe,Xl as pe,Yl as me,gr as he,i as ge,nr as w,o as _e}from"./loadAgentsDir-uuZYOgKn.js";import{d as ve,n as ye}from"./config-BDn2YIjC.js";import{f as be,s as xe}from"./model-CcHyMyBv.js";import{_n as Se,vn as Ce}from"./prompt-BfXryFt-.js";import{t as T}from"./conversationRecovery-NL05oJb1.js";import{t as we}from"./QueryEngine-BBBkZWu2.js";import{n as Te,r as Ee}from"./modelOptions-CJV1R3Jt.js";import{n as De,r as Oe}from"./managedEnv-B8YWmM4A.js";import{dirname as ke}from"node:path";import{randomUUID as E}from"node:crypto";import{Readable as Ae,Writable as je}from"node:stream";import{unlink as Me}from"node:fs/promises";import*as D from"node:path/posix";import{isAbsolute as Ne,resolve as Pe}from"node:path/posix";r();var O={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`},k={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`},Fe=g({_meta:f(m(),l()).nullish(),terminal:n().optional().default(!1)}),Ie=g({_meta:f(m(),l()).nullish(),label:m().nullish(),name:m(),optional:n().optional().default(!1),secret:n().optional().default(!0)}),Le=g({_meta:f(m(),l()).nullish(),description:m().nullish(),id:m(),name:m()}),Re=g({_meta:f(m(),l()).nullish(),description:m().nullish(),id:m(),link:m().nullish(),name:m(),vars:o(Ie)}),ze=g({_meta:f(m(),l()).nullish(),args:o(m()).optional(),description:m().nullish(),env:f(m(),m()).optional(),id:m(),name:m()}),Be=h([Re.and(g({type:c(`env_var`)})),ze.and(g({type:c(`terminal`)})),Le]),Ve=g({_meta:f(m(),l()).nullish(),methodId:m()}),He=g({_meta:f(m(),l()).nullish()}),Ue=g({_meta:f(m(),l()).nullish(),blob:m(),mimeType:m().nullish(),uri:m()}),We=g({default:n().nullish(),description:m().nullish(),title:m().nullish()}),Ge=g({_meta:f(m(),l()).nullish()}),Ke=g({_meta:f(m(),l()).nullish()}),qe=g({amount:d(),currency:m()}),Je=g({_meta:f(m(),l()).nullish(),terminalId:m()}),Ye=g({_meta:f(m(),l()).nullish(),newText:m(),oldText:m().nullish(),path:m()}),Xe=h([m(),d(),d(),n(),o(m())]),Ze=s(h([g({content:f(m(),Xe).nullish()}).and(g({action:c(`accept`)})),g({action:c(`decline`)}),g({action:c(`cancel`)})]),g({_meta:f(m(),l()).nullish()})),Qe=g({_meta:f(m(),l()).nullish()}),$e=m(),et=g({_meta:f(m(),l()).nullish(),elicitationId:$e}),tt=c(`object`),nt=c(`string`),rt=g({_meta:f(m(),l()).nullish()}),it=g({_meta:f(m(),l()).nullish(),form:Qe.nullish(),url:rt.nullish()}),at=g({const:m(),title:m()}),ot=g({_meta:f(m(),l()).nullish(),name:m(),value:m()}),st=g({code:h([c(-32700),c(-32600),c(-32601),c(-32602),c(-32603),c(-32800),c(-32e3),c(-32002),c(-32042),d().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:l().optional(),message:m()}),ct=l(),lt=l(),ut=l(),dt=g({_meta:f(m(),l()).nullish(),readTextFile:n().optional().default(!1),writeTextFile:n().optional().default(!1)}),ft=g({_meta:f(m(),l()).nullish(),name:m(),value:m()}),pt=g({_meta:f(m(),l()).nullish(),name:m(),title:m().nullish(),version:m()}),mt=g({default:d().nullish(),description:m().nullish(),maximum:d().nullish(),minimum:d().nullish(),title:m().nullish()}),ht=g({_meta:f(m(),l()).nullish()}),gt=g({_meta:f(m(),l()).nullish(),additionalDirectories:o(m()).optional(),cursor:m().nullish(),cwd:m().nullish()}),_t=g({_meta:f(m(),l()).nullish()}),vt=g({_meta:f(m(),l()).nullish(),logout:_t.nullish()}),yt=g({_meta:f(m(),l()).nullish()}),bt=g({_meta:f(m(),l()).nullish()}),xt=g({_meta:f(m(),l()).nullish(),http:n().optional().default(!1),sse:n().optional().default(!1)}),St=g({_meta:f(m(),l()).nullish(),headers:o(ft),name:m(),url:m()}),Ct=g({_meta:f(m(),l()).nullish(),headers:o(ft),name:m(),url:m()}),wt=g({_meta:f(m(),l()).nullish(),args:o(m()),command:m(),env:o(ot),name:m()}),A=h([St.and(g({type:c(`http`)})),Ct.and(g({type:c(`sse`)})),wt]),j=m(),Tt=g({_meta:f(m(),l()).nullish(),description:m().nullish(),modelId:j,name:m()}),Et=h([c(`error`),c(`warning`),c(`information`),c(`hint`)]),Dt=g({_meta:f(m(),l()).nullish()}),Ot=g({_meta:f(m(),l()).nullish()}),kt=g({_meta:f(m(),l()).nullish()}),At=g({_meta:f(m(),l()).nullish()}),jt=g({_meta:f(m(),l()).nullish()}),Mt=g({_meta:f(m(),l()).nullish(),maxCount:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Nt=g({diff:m(),uri:m()}),Pt=g({endLine:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:m()}),Ft=g({_meta:f(m(),l()).nullish()}),It=g({_meta:f(m(),l()).nullish()}),Lt=g({languageId:m(),text:m(),uri:m()}),Rt=g({_meta:f(m(),l()).nullish(),maxCount:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),zt=h([c(`rejected`),c(`ignored`),c(`replaced`),c(`cancelled`)]),Bt=g({excerpts:o(Pt),uri:m()}),Vt=g({_meta:f(m(),l()).nullish()}),Ht=g({_meta:f(m(),l()).nullish()}),Ut=g({name:m(),owner:m(),remoteUrl:m()}),Wt=g({_meta:f(m(),l()).nullish()}),Gt=g({_meta:f(m(),l()).nullish(),jump:Ft.nullish(),rename:Ht.nullish(),searchAndReplace:Wt.nullish()}),Kt=g({id:m(),isRegex:n().nullish(),replace:m(),search:m(),uri:m()}),qt=h([c(`automatic`),c(`diagnostic`),c(`manual`)]),Jt=g({_meta:f(m(),l()).nullish(),maxCount:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Yt=g({_meta:f(m(),l()).nullish(),diagnostics:Dt.nullish(),editHistory:Mt.nullish(),openFiles:It.nullish(),recentFiles:Rt.nullish(),relatedSnippets:Vt.nullish(),userActions:Jt.nullish()}),Xt=g({_meta:f(m(),l()).nullish(),additionalDirectories:o(m()).optional(),cwd:m(),mcpServers:o(A)}),Zt=g({default:d().nullish(),description:m().nullish(),maximum:d().nullish(),minimum:d().nullish(),title:m().nullish()}),Qt=m(),$t=h([c(`allow_once`),c(`allow_always`),c(`reject_once`),c(`reject_always`)]),en=g({_meta:f(m(),l()).nullish(),kind:$t,name:m(),optionId:Qt}),tn=h([c(`high`),c(`medium`),c(`low`)]),nn=h([c(`pending`),c(`in_progress`),c(`completed`)]),rn=g({_meta:f(m(),l()).nullish(),content:m(),priority:tn,status:nn}),an=g({_meta:f(m(),l()).nullish(),entries:o(rn)}),M=g({character:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),on=g({id:m(),position:M,uri:m()}),sn=g({id:m(),newName:m(),position:M,uri:m()}),cn=g({action:m(),position:M,timestampMs:d(),uri:m()}),ln=h([c(`utf-16`),c(`utf-32`),c(`utf-8`)]),un=g({_meta:f(m(),l()).nullish(),auth:Fe.optional().default({terminal:!1}),elicitation:it.nullish(),fs:dt.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Gt.nullish(),positionEncodings:o(ln).optional(),terminal:n().optional().default(!1)}),dn=g({_meta:f(m(),l()).nullish(),audio:n().optional().default(!1),embeddedContext:n().optional().default(!1),image:n().optional().default(!1)}),fn=d().int().gte(0).lte(65535),pn=g({_meta:f(m(),l()).nullish(),clientCapabilities:un.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:pt.nullish(),protocolVersion:fn}),N=g({end:M,start:M}),mn=g({message:m(),range:N,severity:Et,uri:m()}),hn=g({languageId:m(),lastFocusedMs:d().nullish(),uri:m(),visibleRange:N.nullish()}),gn=g({_meta:f(m(),l()).nullish(),diagnostics:o(mn).nullish(),editHistory:o(Nt).nullish(),openFiles:o(hn).nullish(),recentFiles:o(Lt).nullish(),relatedSnippets:o(Bt).nullish(),userActions:o(cn).nullish()}),_n=g({newText:m(),range:N}),vn=h([g({cursorPosition:M.nullish(),edits:o(_n),id:m(),uri:m()}).and(g({kind:c(`edit`)})),on.and(g({kind:c(`jump`)})),sn.and(g({kind:c(`rename`)})),Kt.and(g({kind:c(`searchAndReplace`)}))]),yn=g({_meta:f(m(),l()).nullish(),content:m()}),bn=g({_meta:f(m(),l()).nullish()}),P=h([d(),m()]).nullable();g({_meta:f(m(),l()).nullish(),requestId:P});var xn=g({requestId:P}),Sn=a([`assistant`,`user`]),F=g({_meta:f(m(),l()).nullish(),audience:o(Sn).nullish(),lastModified:m().nullish(),priority:d().nullish()}),Cn=g({_meta:f(m(),l()).nullish(),annotations:F.nullish(),data:m(),mimeType:m()}),wn=g({_meta:f(m(),l()).nullish(),annotations:F.nullish(),data:m(),mimeType:m(),uri:m().nullish()}),Tn=g({_meta:f(m(),l()).nullish(),annotations:F.nullish(),description:m().nullish(),mimeType:m().nullish(),name:m(),size:d().nullish(),title:m().nullish(),uri:m()}),En=g({_meta:f(m(),l()).nullish(),optionId:Qt}),Dn=h([g({outcome:c(`cancelled`)}),En.and(g({outcome:c(`selected`)}))]),On=g({_meta:f(m(),l()).nullish(),outcome:Dn}),kn=g({_meta:f(m(),l()).nullish()}),An=g({_meta:f(m(),l()).nullish()}),jn=g({currentValue:n()}),Mn=m(),Nn=m(),Pn=h([c(`mode`),c(`model`),c(`thought_level`),m()]),I=m(),Fn=g({_meta:f(m(),l()).nullish(),description:m().nullish(),name:m(),value:I}),In=g({_meta:f(m(),l()).nullish(),group:Mn,name:m(),options:o(Fn)}),L=s(h([g({currentValue:I,options:h([o(Fn),o(In)])}).and(g({type:c(`select`)})),jn.and(g({type:c(`boolean`)}))]),g({_meta:f(m(),l()).nullish(),category:Pn.nullish(),description:m().nullish(),id:Nn,name:m()})),Ln=g({_meta:f(m(),l()).nullish(),configOptions:o(L)}),Rn=g({_meta:f(m(),l()).nullish()}),R=m(),zn=g({_meta:f(m(),l()).nullish(),id:m(),sessionId:R}),Bn=g({_meta:f(m(),l()).nullish(),sessionId:R}),Vn=g({_meta:f(m(),l()).nullish(),sessionId:R}),Hn=g({_meta:f(m(),l()).nullish(),sessionId:R}),Un=g({_meta:f(m(),l()).nullish(),args:o(m()).optional(),command:m(),cwd:m().nullish(),env:o(ot).optional(),outputByteLimit:d().nullish(),sessionId:R}),Wn=g({_meta:f(m(),l()).nullish(),sessionId:R,uri:m()}),Gn=g({_meta:f(m(),l()).nullish(),position:M,sessionId:R,uri:m(),version:d(),visibleRange:N}),Kn=g({_meta:f(m(),l()).nullish(),languageId:m(),sessionId:R,text:m(),uri:m(),version:d()}),z=g({_meta:f(m(),l()).nullish(),sessionId:R,uri:m()}),qn=g({_meta:f(m(),l()).nullish(),additionalDirectories:o(m()).optional(),cwd:m(),mcpServers:o(A).optional(),sessionId:R}),Jn=g({_meta:f(m(),l()).nullish(),sessionId:R,terminalId:m()}),Yn=g({_meta:f(m(),l()).nullish(),additionalDirectories:o(m()).optional(),cwd:m(),mcpServers:o(A),sessionId:R}),Xn=g({_meta:f(m(),l()).nullish(),limit:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:m(),sessionId:R}),Zn=g({_meta:f(m(),l()).nullish(),id:m(),reason:zt.nullish(),sessionId:R}),Qn=g({_meta:f(m(),l()).nullish(),sessionId:R,terminalId:m()}),$n=g({_meta:f(m(),l()).nullish(),additionalDirectories:o(m()).optional(),cwd:m(),mcpServers:o(A).optional(),sessionId:R}),er=g({_meta:f(m(),l()).nullish(),additionalDirectories:o(m()).optional(),cwd:m(),sessionId:R,title:m().nullish(),updatedAt:m().nullish()}),tr=g({_meta:f(m(),l()).nullish(),nextCursor:m().nullish(),sessions:o(er)}),nr=g({_meta:f(m(),l()).nullish(),title:m().nullish(),updatedAt:m().nullish()}),rr=g({_meta:f(m(),l()).nullish()}),B=m(),ir=g({_meta:f(m(),l()).nullish(),currentModeId:B}),ar=g({_meta:f(m(),l()).nullish(),description:m().nullish(),id:B,name:m()}),V=g({_meta:f(m(),l()).nullish(),availableModes:o(ar),currentModeId:B}),H=g({_meta:f(m(),l()).nullish(),availableModels:o(Tt),currentModelId:j}),or=g({_meta:f(m(),l()).nullish(),configOptions:o(L).nullish(),models:H.nullish(),modes:V.nullish(),sessionId:R}),sr=g({_meta:f(m(),l()).nullish(),configOptions:o(L).nullish(),models:H.nullish(),modes:V.nullish()}),cr=g({_meta:f(m(),l()).nullish(),configOptions:o(L).nullish(),models:H.nullish(),modes:V.nullish(),sessionId:R}),lr=g({_meta:f(m(),l()).nullish(),configOptions:o(L).nullish(),models:H.nullish(),modes:V.nullish()}),ur=g({_meta:f(m(),l()).nullish()}),dr=g({_meta:f(m(),l()).nullish(),additionalDirectories:kn.nullish(),close:An.nullish(),fork:Rn.nullish(),list:rr.nullish(),resume:ur.nullish()}),fr=s(h([g({type:c(`boolean`),value:n()}),g({value:I})]),g({_meta:f(m(),l()).nullish(),configId:Nn,sessionId:R})),pr=g({_meta:f(m(),l()).nullish(),configOptions:o(L)}),mr=g({_meta:f(m(),l()).nullish(),modeId:B,sessionId:R}),hr=g({_meta:f(m(),l()).nullish()}),gr=g({_meta:f(m(),l()).nullish(),modelId:j,sessionId:R}),_r=g({_meta:f(m(),l()).nullish()}),vr=g({_meta:f(m(),l()).nullish(),sessionId:R}),yr=h([c(`end_turn`),c(`max_tokens`),c(`max_turn_requests`),c(`refusal`),c(`cancelled`)]),br=h([c(`email`),c(`uri`),c(`date`),c(`date-time`)]),xr=g({default:m().nullish(),description:m().nullish(),enum:o(m()).nullish(),format:br.nullish(),maxLength:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:o(at).nullish(),pattern:m().nullish(),title:m().nullish()}),Sr=g({_meta:f(m(),l()).nullish(),context:gn.nullish(),position:M,selection:N.nullish(),sessionId:R,triggerKind:qt,uri:m(),version:d()}),Cr=g({_meta:f(m(),l()).nullish(),suggestions:o(vn)}),wr=g({_meta:f(m(),l()).nullish(),terminalId:m()}),Tr=g({_meta:f(m(),l()).nullish(),exitCode:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:m().nullish()}),Er=g({_meta:f(m(),l()).nullish(),sessionId:R,terminalId:m()}),Dr=g({_meta:f(m(),l()).nullish(),exitStatus:Tr.nullish(),output:m(),truncated:n()}),Or=g({_meta:f(m(),l()).nullish(),annotations:F.nullish(),text:m()}),kr=g({range:N.nullish(),text:m()}),Ar=g({_meta:f(m(),l()).nullish(),contentChanges:o(kr),sessionId:R,uri:m(),version:d()});g({method:m(),params:h([Bn,Kn,Ar,Wn,z,Gn,zn,Zn,ct]).nullish()});var jr=h([c(`full`),c(`incremental`)]),Mr=g({_meta:f(m(),l()).nullish(),syncKind:jr}),Nr=g({_meta:f(m(),l()).nullish(),didChange:Mr.nullish(),didClose:Ot.nullish(),didFocus:kt.nullish(),didOpen:At.nullish(),didSave:jt.nullish()}),Pr=g({_meta:f(m(),l()).nullish(),document:Nr.nullish()}),Fr=g({_meta:f(m(),l()).nullish(),context:Yt.nullish(),events:Pr.nullish()}),Ir=g({_meta:f(m(),l()).nullish(),auth:vt.optional().default({}),loadSession:n().optional().default(!1),mcpCapabilities:xt.optional().default({http:!1,sse:!1}),nes:Fr.nullish(),positionEncoding:ln.nullish(),promptCapabilities:dn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:dr.optional().default({})}),Lr=g({_meta:f(m(),l()).nullish(),agentCapabilities:Ir.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:pt.nullish(),authMethods:o(Be).optional().default([]),protocolVersion:fn}),Rr=h([g({_meta:f(m(),l()).nullish(),mimeType:m().nullish(),text:m(),uri:m()}),Ue]),zr=g({_meta:f(m(),l()).nullish(),annotations:F.nullish(),resource:Rr}),U=h([Or.and(g({type:c(`text`)})),wn.and(g({type:c(`image`)})),Cn.and(g({type:c(`audio`)})),Tn.and(g({type:c(`resource_link`)})),zr.and(g({type:c(`resource`)}))]),Br=g({_meta:f(m(),l()).nullish(),content:U}),W=g({_meta:f(m(),l()).nullish(),content:U,messageId:m().nullish()}),Vr=g({_meta:f(m(),l()).nullish(),messageId:m().nullish(),prompt:o(U),sessionId:R}),Hr=g({anyOf:o(at)}),Ur=h([Br.and(g({type:c(`content`)})),Ye.and(g({type:c(`diff`)})),wr.and(g({type:c(`terminal`)}))]),G=m(),Wr=g({sessionId:R,toolCallId:G.nullish()}),Gr=s(h([Wr,xn]),g({elicitationId:$e,url:m().url()})),Kr=g({_meta:f(m(),l()).nullish(),line:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:m()}),qr=h([c(`pending`),c(`in_progress`),c(`completed`),c(`failed`)]),Jr=h([c(`read`),c(`edit`),c(`delete`),c(`move`),c(`search`),c(`execute`),c(`think`),c(`fetch`),c(`switch_mode`),c(`other`)]),Yr=g({_meta:f(m(),l()).nullish(),content:o(Ur).optional(),kind:Jr.optional(),locations:o(Kr).optional(),rawInput:l().optional(),rawOutput:l().optional(),status:qr.optional(),title:m(),toolCallId:G}),Xr=g({_meta:f(m(),l()).nullish(),content:o(Ur).nullish(),kind:Jr.nullish(),locations:o(Kr).nullish(),rawInput:l().optional(),rawOutput:l().optional(),status:qr.nullish(),title:m().nullish(),toolCallId:G}),Zr=g({_meta:f(m(),l()).nullish(),options:o(en),sessionId:R,toolCall:Xr}),Qr=g({_meta:f(m(),l()).nullish(),hint:m()}),$r=g({_meta:f(m(),l()).nullish(),description:m(),input:Qr.nullish(),name:m()}),ei=g({_meta:f(m(),l()).nullish(),availableCommands:o($r)}),ti=h([g({enum:o(m()),type:nt}),Hr]),ni=g({default:o(m()).nullish(),description:m().nullish(),items:ti,maxItems:d().nullish(),minItems:d().nullish(),title:m().nullish()}),ri=h([xr.and(g({type:c(`string`)})),Zt.and(g({type:c(`number`)})),mt.and(g({type:c(`integer`)})),We.and(g({type:c(`boolean`)})),ni.and(g({type:c(`array`)}))]),ii=g({description:m().nullish(),properties:f(m(),ri).optional().default({}),required:o(m()).nullish(),title:m().nullish(),type:tt.optional().default(`object`)}),ai=s(h([s(h([Wr,xn]),g({requestedSchema:ii})).and(g({mode:c(`form`)})),Gr.and(g({mode:c(`url`)}))]),g({_meta:f(m(),l()).nullish(),message:m()})),oi=g({cachedReadTokens:d().nullish(),cachedWriteTokens:d().nullish(),inputTokens:d(),outputTokens:d(),thoughtTokens:d().nullish(),totalTokens:d()});h([g({id:P,result:h([Lr,He,bt,cr,sr,tr,or,lr,Ke,hr,pr,g({_meta:f(m(),l()).nullish(),stopReason:yr,usage:oi.nullish(),userMessageId:m().nullish()}),_r,vr,Cr,Ge,ut])}),g({error:st,id:P})]);var si=g({_meta:f(m(),l()).nullish(),cost:qe.nullish(),size:d(),used:d()}),ci=h([W.and(g({sessionUpdate:c(`user_message_chunk`)})),W.and(g({sessionUpdate:c(`agent_message_chunk`)})),W.and(g({sessionUpdate:c(`agent_thought_chunk`)})),Yr.and(g({sessionUpdate:c(`tool_call`)})),Xr.and(g({sessionUpdate:c(`tool_call_update`)})),an.and(g({sessionUpdate:c(`plan`)})),ei.and(g({sessionUpdate:c(`available_commands_update`)})),ir.and(g({sessionUpdate:c(`current_mode_update`)})),Ln.and(g({sessionUpdate:c(`config_option_update`)})),nr.and(g({sessionUpdate:c(`session_info_update`)})),si.and(g({sessionUpdate:c(`usage_update`)}))]),li=g({_meta:f(m(),l()).nullish(),sessionId:R,update:ci});g({method:m(),params:h([li,et,ct]).nullish()});var ui=g({_meta:f(m(),l()).nullish(),sessionId:R,terminalId:m()}),di=g({_meta:f(m(),l()).nullish(),exitCode:d().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:m().nullish()}),fi=g({name:m(),uri:m()}),pi=g({_meta:f(m(),l()).nullish(),repository:Ut.nullish(),workspaceFolders:o(fi).nullish(),workspaceUri:m().nullish()});g({id:P,method:m(),params:h([pn,Ve,yt,Xt,Yn,gt,qn,$n,Hn,mr,fr,Vr,gr,pi,Sr,Vn,lt]).nullish()});var mi=g({_meta:f(m(),l()).nullish(),content:m(),path:m(),sessionId:R});g({id:P,method:m(),params:h([mi,Xn,Zr,Un,Er,Qn,ui,Jn,ai,lt]).nullish()}),h([g({id:P,result:h([g({_meta:f(m(),l()).nullish()}),yn,On,Je,Dr,bn,di,ht,Ze,ut])}),g({error:st,id:P})]),e();function hi(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()}}})}}r();var gi,_i=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case O.initialize:{let e=pn.parse(t);return r.initialize(e)}case O.session_new:{let e=Xt.parse(t);return r.newSession(e)}case O.session_load:{if(!r.loadSession)throw K.methodNotFound(e);let n=Yn.parse(t);return r.loadSession(n)}case O.session_list:{if(!r.listSessions)throw K.methodNotFound(e);let n=gt.parse(t);return r.listSessions(n)}case O.session_fork:{if(!r.unstable_forkSession)throw K.methodNotFound(e);let n=qn.parse(t);return r.unstable_forkSession(n)}case O.session_resume:{if(!r.unstable_resumeSession)throw K.methodNotFound(e);let n=$n.parse(t);return r.unstable_resumeSession(n)}case O.session_close:{if(!r.unstable_closeSession)throw K.methodNotFound(e);let n=Hn.parse(t);return r.unstable_closeSession(n)}case O.session_set_mode:{if(!r.setSessionMode)throw K.methodNotFound(e);let n=mr.parse(t);return await r.setSessionMode(n)??{}}case O.authenticate:{let e=Ve.parse(t);return await r.authenticate(e)??{}}case O.logout:{if(!r.unstable_logout)throw K.methodNotFound(e);let n=yt.parse(t);return await r.unstable_logout(n)??{}}case O.session_prompt:{let e=Vr.parse(t);return r.prompt(e)}case O.session_set_model:{if(!r.unstable_setSessionModel)throw K.methodNotFound(e);let n=gr.parse(t);return await r.unstable_setSessionModel(n)??{}}case O.session_set_config_option:{if(!r.setSessionConfigOption)throw K.methodNotFound(e);let n=fr.parse(t);return r.setSessionConfigOption(n)}case O.nes_start:{if(!r.unstable_startNes)throw K.methodNotFound(e);let n=pi.parse(t);return r.unstable_startNes(n)}case O.nes_suggest:{if(!r.unstable_suggestNes)throw K.methodNotFound(e);let n=Sr.parse(t);return r.unstable_suggestNes(n)}case O.nes_close:{if(!r.unstable_closeNes)throw K.methodNotFound(e);let n=Vn.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw K.methodNotFound(e)}},a=async(e,t)=>{switch(e){case O.session_cancel:{let e=Bn.parse(t);return r.cancel(e)}case O.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Kn.parse(t);return r.unstable_didOpenDocument(e)}case O.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Ar.parse(t);return r.unstable_didChangeDocument(e)}case O.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Wn.parse(t);return r.unstable_didCloseDocument(e)}case O.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=z.parse(t);return r.unstable_didSaveDocument(e)}case O.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Gn.parse(t);return r.unstable_didFocusDocument(e)}case O.nes_accept:{if(!r.unstable_acceptNes)return;let e=zn.parse(t);return r.unstable_acceptNes(e)}case O.nes_reject:{if(!r.unstable_rejectNes)return;let e=Zn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw K.methodNotFound(e)}};this.connection=new yi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(k.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(k.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(k.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(k.fs_write_text_file,e)??{}}async createTerminal(e){return new vi((await this.connection.sendRequest(k.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(k.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(k.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}};gi=Symbol.asyncDispose;var vi=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(k.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(k.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(k.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(k.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[gi](){await this.release()}},yi=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 K)return e.toResult();if(e instanceof _)return K.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 K.internalError(t?JSON.parse(t):{}).toResult()}catch{return K.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof K)return e.toResult();if(e instanceof _)return K.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 K.internalError(t?JSON.parse(t):{}).toResult()}catch{return K.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 K(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}},K=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(),S(),p(),Ce(),ve(),ce(),ie(),ue(),le(),de(),_e(),Oe();function q(e,t){if(e)return t?Ne(e)?e:Pe(t,e):e}var bi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,xi={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function Si(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=xi[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!bi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Ci(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var wi=256;function Ti(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=wi?t:`${t.slice(0,wi-1)}…`}function J(e,t){if(!t)return e;let n=D.resolve(t),r=D.resolve(e);return r.startsWith(n+D.sep)||r===n?D.relative(n,r):e}function Ei(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?J(t,n):`File`,c=q(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?J(e,n):void 0,a=q(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?J(e,n):void 0,o=q(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=q(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:Ei(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:Ei(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=E());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=E()),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=E();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:E()});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 re(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}be(),Ee(),me(),y(),e(),he();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||ne(),n=await v(t),r=await pe({dir:t}),i=[];for(let e of r){if(!e.cwd||await v(e.cwd)!==n)continue;let t=Ti(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 i(e.sessionId);if(t)try{await Me(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 K.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 w(e);n&&n.messages.length>0&&(t=T(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 Si(e,t)}function qi(e){if(e!=null)try{return Si(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})}S();function ea(){return u().permissions?.defaultMode}async function ta(e,t={}){ye();let n=t.sessionId??E(),r=e.cwd;x(n,te()),C(r);let i=process.cwd(),a=!1;try{process.chdir(r),a=!0}catch{}b(),De();try{let i=Se(),a=se(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={...oe(),toolPermissionContext:{...i,mode:c,isBypassPermissionsModeAvailable:f}},[m,h]=await Promise.all([ae(r),ge(r)]);p.agentDefinitions=h;let g=new we({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 fe(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`}]},v=Te(),y=xe(),b={availableModels:v.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:y};g.setModel(y);let x=Zi(_,b),S={queryEngine:g,cancelled:!1,cancelGeneration:0,cwd:r,modes:_,models:b,configOptions:x,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:l,appState:p,commands:m,sessionFingerprint:Ci({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,S),{sessionId:n,modes:_,models:b,configOptions:x}}finally{a&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:ta}),he(),S(),y();async function na(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Ci({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await i(e.sessionId,e.cwd);return x(e.sessionId,r?ke(r.filePath):null),C(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 i(e.sessionId,e.cwd),a=r?ke(r.filePath):null;x(e.sessionId,a),C(e.cwd);let o;if(r)try{let t=await w(e.sessionId);t&&t.messages.length>0&&(o=T(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let s=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:o});if(t&&o&&o.length>0){let t=this.sessions.get(e.sessionId);t&&await Ri(e.sessionId,o,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:s.sessionId,modes:s.modes,models:s.models,configOptions:s.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 w(e.sessionId);if(!t||t.messages.length===0)return;let n=T(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)}}S();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=E();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(),x(e.sessionId,te());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=Ti(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}),ve(),Oe();function ma(e,t){let n=Ae.toWeb(e);return hi(je.toWeb(t),n)}async function ha(){ye(),De();let e=ma(process.stdin,process.stdout),t,n=new _i(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 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{homedir as r}from"os";import{join as i}from"path";function a(e){let t=process.env.NODE_OPTIONS;return t?t.split(/\s+/).includes(e):!1}function o(e){if(!e)return!1;if(typeof e==`boolean`)return e;let t=e.toLowerCase().trim();return[`1`,`true`,`yes`,`on`].includes(t)}function s(e){if(e===void 0)return!1;if(typeof e==`boolean`)return!e;if(!e)return!1;let t=e.toLowerCase().trim();return[`0`,`false`,`no`,`off`].includes(t)}function c(){return o(process.env.WORKMATE_SIMPLE)||process.argv.includes(`--bare`)}function l(e){let t={};if(e)for(let n of e){let[e,...r]=n.split(`=`);if(!e||r.length===0)throw Error(`Invalid environment variable format: ${n}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`);t[e]=r.join(`=`)}return t}function u(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||`us-east-1`}function d(){return process.env.CLOUD_ML_REGION||`us-east5`}function f(){return o(process.env.
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{homedir as r}from"os";import{join as i}from"path";function a(e){let t=process.env.NODE_OPTIONS;return t?t.split(/\s+/).includes(e):!1}function o(e){if(!e)return!1;if(typeof e==`boolean`)return e;let t=e.toLowerCase().trim();return[`1`,`true`,`yes`,`on`].includes(t)}function s(e){if(e===void 0)return!1;if(typeof e==`boolean`)return!e;if(!e)return!1;let t=e.toLowerCase().trim();return[`0`,`false`,`no`,`off`].includes(t)}function c(){return o(process.env.WORKMATE_SIMPLE)||process.argv.includes(`--bare`)}function l(e){let t={};if(e)for(let n of e){let[e,...r]=n.split(`=`);if(!e||r.length===0)throw Error(`Invalid environment variable format: ${n}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`);t[e]=r.join(`=`)}return t}function u(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||`us-east-1`}function d(){return process.env.CLOUD_ML_REGION||`us-east5`}function f(){return o(process.env.WORKMATE_BASH_MAINTAIN_PROJECT_WORKING_DIR)}function p(){return!1}function m(e){if(e){let t=g.find(([t])=>e.startsWith(t));if(t)return process.env[t[1]]||d()}return d()}var h,g,_=e((()=>{n(),h=t(()=>(process.env.WORKMATE_CONFIG_DIR??i(r(),`.workmate`)).normalize(`NFC`),()=>process.env.WORKMATE_CONFIG_DIR),g=[[`claude-haiku-4-5`,`VERTEX_REGION_CLAUDE_HAIKU_4_5`],[`claude-3-5-haiku`,`VERTEX_REGION_CLAUDE_3_5_HAIKU`],[`claude-3-5-sonnet`,`VERTEX_REGION_CLAUDE_3_5_SONNET`],[`claude-3-7-sonnet`,`VERTEX_REGION_CLAUDE_3_7_SONNET`],[`claude-opus-4-1`,`VERTEX_REGION_CLAUDE_4_1_OPUS`],[`claude-opus-4`,`VERTEX_REGION_CLAUDE_4_0_OPUS`],[`claude-sonnet-4-6`,`VERTEX_REGION_CLAUDE_4_6_SONNET`],[`claude-sonnet-4-5`,`VERTEX_REGION_CLAUDE_4_5_SONNET`],[`claude-sonnet-4`,`VERTEX_REGION_CLAUDE_4_0_SONNET`]]}));export{a,s as c,l as d,f,h as i,o as l,d as n,_ as o,m as r,c as s,u as t,p as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-DrEEb4f5.js";import{w as r,x as i}from"./debug-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-DrEEb4f5.js";import{w as r,x as i}from"./debug-2pVES-2G.js";import{n as a,r as o,t as s}from"./execa-CBhG1doD.js";import{o as c,s as l}from"./log-L1kqxa_P.js";function u(e,t,i=10*h*m){let o;o=t===void 0?{}:t instanceof AbortSignal?{abortSignal:t,timeout:i}:t;let{abortSignal:s,timeout:c=10*h*m,input:l,stdio:u=[`ignore`,`pipe`,`pipe`]}=o;s?.throwIfAborted(),r`exec: ${e.slice(0,200)}`;try{let t=a(e,{env:process.env,maxBuffer:1e6,timeout:c,cwd:n(),stdio:u,shell:!0,reject:!1,input:l});return t.stdout&&t.stdout.trim()||null}catch{return null}}function d(e,t,r={timeout:10*h*m,preserveOutputOnError:!0,useCwd:!0}){return p(e,t,{abortSignal:r.abortSignal,timeout:r.timeout,preserveOutputOnError:r.preserveOutputOnError,cwd:r.useCwd?n():void 0,env:r.env,stdin:r.stdin,input:r.input})}function f(e,t){return e.shortMessage?e.shortMessage:typeof e.signal==`string`?e.signal:String(t)}function p(e,t,{abortSignal:n,timeout:r=10*h*m,preserveOutputOnError:i=!0,cwd:a,env:o,maxBuffer:c,shell:u,stdin:d,input:p}={timeout:10*h*m,preserveOutputOnError:!0,maxBuffer:1e6}){return new Promise(m=>{s(e,t,{maxBuffer:c,cancelSignal:n,timeout:r,cwd:a,env:o,shell:u,stdin:d,input:p,reject:!1}).then(e=>{if(e.failed)if(i){let t=e.exitCode??1;m({stdout:e.stdout||``,stderr:e.stderr||``,code:t,error:f(e,t)})}else m({stdout:``,stderr:``,code:e.exitCode??1});else m({stdout:e.stdout,stderr:e.stderr,code:0})}).catch(e=>{l(e),m({stdout:``,stderr:``,code:1})})})}var m,h,g=e((()=>{o(),t(),c(),i(),m=1e3,h=60}));export{g as i,p as n,u as r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{St as n,Xs as r,Zs as i,gi as a,mC as o,mi as s,pC as c,yt as l}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{St as n,Xs as r,Zs as i,gi as a,mC as o,mi as s,pC as c,yt as l}from"./loadAgentsDir-uuZYOgKn.js";import{n as u,t as d}from"./ExitFlow-CATwJC4c.js";import{spawnSync as f}from"child_process";function p(){return o(g)??`Goodbye!`}async function m(e){if(i())return e(),f(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=l()!==null;return t?(0,h.jsx)(d,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(p()),await s(0,`prompt_input_exit`),null)}var h,g;e((()=>{c(),u(),r(),a(),n(),h=t(),g=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{m as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{D as n,Gt as r,I as i,P as a,T as o,ai as s,t as c,x as l}from"./src-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{D as n,Gt as r,I as i,P as a,T as o,ai as s,t as c,x as l}from"./src-BX54x08P.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{AC as d,Bh as f,CC as p,MC as m,NC as h,hd as g,jC as _,md as v,tb as y,zh as b}from"./loadAgentsDir-uuZYOgKn.js";import{at as x,f as S,g as C,it as w}from"./model-CcHyMyBv.js";import{n as T,t as E}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{t as D}from"./select-BuTJbu_Q.js";import{n as O,r as k,t as A}from"./modelOptions-CJV1R3Jt.js";import{t as j}from"./CustomSelect-CYmc4vRh.js";import{n as M,t as N}from"./fetchModelList-9w1E4Ue8.js";function P({initial:e,sessionModel:t,onSelect:s,onCancel:c,isStandaloneCommand:u,showFastModeNotice:d,headerText:g}){let y=T(),b=e===null?L:e,[x,S]=(0,F.useState)(b),E=f(e=>h()?e.fastMode:!1),[k,j]=(0,F.useState)(()=>new Set(w(b)?[b.replace(/\[1m\]/i,``)]:[])),M=(0,F.useCallback)(()=>{if(!x||x===L)return;let e=x.replace(/\[1m\]/i,``);j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[x]),P=(0,F.useMemo)(()=>O(E??!1),[E]),[R,z]=(0,F.useState)(null),[B,V]=(0,F.useState)(!1);(0,F.useEffect)(()=>{let e=!1;return V(!1),N().then(t=>{if(!e){if(!t||t.length===0){z(null),V(!0);return}z(t)}}).catch(()=>{e||V(!0)}),()=>{e=!0}},[]);let H=(0,F.useMemo)(()=>R?A(R,E??!1):null,[R,E]),U=R===null&&!B,W=(0,F.useMemo)(()=>{let t=H??P;return e!==null&&!t.some(t=>t.value===e)?[...t,{value:e,label:C(e),description:`Current model`}]:t},[H,P,e]),G=(0,F.useMemo)(()=>W.map(e=>({...e,value:e.value===null?L:e.value})),[W]),K=(0,F.useMemo)(()=>G.some(e=>e.value===b)?b:G[0]?.value??void 0,[G,b]),q=Math.min(10,G.length),J=Math.max(0,G.length-q),Y=G.find(e=>e.value===x)?.label,X=x!==void 0&&x!==L&&k.has(x.replace(/\[1m\]/i,``)),Z=(0,F.useCallback)(e=>{S(e)},[]);r({"modelPicker:toggle1M":()=>M()},{context:`ModelPicker`});function Q(e){if(e===L){s(null);return}let t=e.replace(/\[1m\]/i,``);s(k.has(t)?`${t}[1m]`:t)}let $=(0,I.jsxs)(i,{flexDirection:`column`,children:[(0,I.jsxs)(i,{flexDirection:`column`,children:[(0,I.jsxs)(i,{marginBottom:1,flexDirection:`column`,children:[(0,I.jsx)(a,{color:`remember`,bold:!0,children:`Select model`}),(0,I.jsx)(a,{dimColor:!0,children:g??`Choose a model for this and future sessions. Use Space to toggle 1M context.`}),t&&(0,I.jsxs)(a,{dimColor:!0,children:[`Currently using `,C(t),` for this session (set by plan mode). Selecting a model will undo this.`]})]}),(0,I.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,I.jsx)(i,{flexDirection:`column`,children:(0,I.jsx)(D,{defaultValue:b,defaultFocusValue:K,options:G,onChange:Q,onFocus:Z,onCancel:c??(()=>{}),visibleOptionCount:q})}),J>0&&(0,I.jsx)(i,{paddingLeft:3,children:(0,I.jsxs)(a,{dimColor:!0,children:[`and `,J,` more…`]})}),U&&(0,I.jsx)(i,{paddingLeft:3,children:(0,I.jsx)(a,{dimColor:!0,children:`正在从 API 拉取可用模型列表…`})}),B&&R===null&&(0,I.jsx)(i,{paddingLeft:3,children:(0,I.jsx)(a,{dimColor:!0,children:`API 拉取失败,使用内置列表`})})]}),(0,I.jsx)(i,{marginBottom:1,flexDirection:`column`,children:X?(0,I.jsxs)(a,{dimColor:!0,children:[`1M context on`,(0,I.jsx)(a,{color:`subtle`,children:` · Space to toggle`})]}):(0,I.jsxs)(a,{color:`subtle`,children:[`1M context off`,Y?` for ${Y}`:``,(0,I.jsx)(a,{color:`subtle`,children:` · Space to toggle`})]})}),h()?d?(0,I.jsx)(i,{marginBottom:1,children:(0,I.jsxs)(a,{dimColor:!0,children:[`Fast mode is `,(0,I.jsx)(a,{bold:!0,children:`ON`}),` and available with `,p,` only (/fast). Switching to other models turn off fast mode.`]})}):_()&&!m()?(0,I.jsx)(i,{marginBottom:1,children:(0,I.jsxs)(a,{dimColor:!0,children:[`Use `,(0,I.jsx)(a,{bold:!0,children:`/fast`}),` to turn on Fast mode (`,p,` only).`]})}):null:null]}),u&&(0,I.jsx)(a,{dimColor:!0,italic:!0,children:y.pending?(0,I.jsxs)(I.Fragment,{children:[`Press `,y.keyName,` again to exit`]}):(0,I.jsxs)(o,{children:[(0,I.jsx)(n,{shortcut:`Enter`,action:`confirm`}),(0,I.jsx)(v,{action:`select:cancel`,context:`Select`,fallback:`Esc`,description:`exit`})]})})]});return u?(0,I.jsx)(l,{color:`permission`,children:$}):$}var F,I,L,R=e((()=>{F=t(s(),1),x(),E(),d(),c(),y(),b(),S(),k(),M(),g(),j(),I=u(),L=`__NO_PREFERENCE__`}));function z(e,t,n){return!1}var B=e((()=>{}));export{R as i,z as n,P as r,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{cc as e,dc as t,lc as n,uc as r}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as drainPendingExtraction,n as executeExtractMemories,r as initExtractMemories};
|
|
@@ -0,0 +1 @@
|
|
|
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-BX54x08P.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Gt as p,m,y as h}from"./settings-D4M13toi.js";import{AC as g,Bh as _,CC as v,EC as y,Hh as b,NC as x,OC as S,PC as C,TC as w,_y as T,gy as E,tb as D,vy as O,wC as k,zC as A,zh as j}from"./loadAgentsDir-uuZYOgKn.js";import{d as M,o as N}from"./config-BDn2YIjC.js";import{n as P}from"./analytics-COpjZpvd.js";import{_ as F,l as I}from"./startupProfiler-B9Qv2QGH.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(),p(),u(),M(),R(),V=f()}));function U(e,t){k(),h(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!C(e.mainLoopModel);return{...e,...t?{mainLoopModel:w(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function W({onDone:e,unavailableReason:t}){let o=_(e=>e.mainLoopModel),s=_(e=>e.fastMode),c=b(),[l,u]=(0,q.useState)(s??!1),f=y(),p=f.status===`cooldown`,m=t!==null,h=E(T(!0));function g(){m||(U(l,c),l?e(`${B(l)} Fast mode ON${C(o)?``:` · model set to ${v}`} · ${h}`):(c(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function x(){if(m){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 S(){m||u(e=>!e)}return n({"confirm:yes":g,"confirm:nextField":S,"confirm:next":S,"confirm:previous":S,"confirm:cycleMode":S,"confirm:toggle":S},{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 ${v}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:x,color:`fastMode`,inputGuide:e=>e.pending?(0,J.jsxs)(a,{children:[`Press `,e.keyName,` again to exit`]}):m?(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:h})]})}),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=S();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return U(e,n),e?`${B(!0)} Fast mode ON${C(i)?``:` · model set to ${v}`} · ${E(T(!0))}`:`Fast mode OFF`}async function K(e,t,n){if(!x())return null;await A();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await G(r===`on`,t.getAppState,t.setAppState)),null;let i=S();return(0,J.jsx)(W,{onDone:e,unavailableReason:i})}var q,J,Y=e((()=>{q=t(o(),1),u(),H(),D(),P(),j(),g(),F(),O(),m(),J=f()}));export{H as a,B as i,K as n,Y as r,W as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./fast-C5-lNCQi.js";t();export{n as FastModePicker,e as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Yr as t,Zr as n}from"./settings-D4M13toi.js";import{c as r,i}from"./debug-2pVES-2G.js";import{Mt as a,Pt as o,W as s,dt as c,q as l,ut as u}from"./model-CcHyMyBv.js";import{n as d,r as f}from"./client-2w-g5kMx.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-B0ngS4Uu.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(),t(),l(),o(),m=300*1e3,h=n(p,m)}));export{g as n,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./fetchModelList-9w1E4Ue8.js";e();export{t as fetchAvailableModels};
|
|
@@ -0,0 +1,3 @@
|
|
|
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{Kr as a,dr as o,m as s,pr as c,qr as l,t as u,zr as d}from"./settings-D4M13toi.js";import{Gn as f,Kn as p}from"./state-CXY-q5gr.js";import{Mt as m,Rt as h,_ as g,g as _,mn as v,p as ee}from"./loadAgentsDir-uuZYOgKn.js";import{n as y,t as b}from"./cwd-DrEEb4f5.js";import{I as x,M as te,c as S,f as ne,i as re,u as ie}from"./debug-2pVES-2G.js";import{d as ae,o as oe}from"./config-BDn2YIjC.js";import{o as se,s as C}from"./log-L1kqxa_P.js";import{i as ce,n as le}from"./execFileNoThrow-DXSEj8ZO.js";import{n as ue}from"./analytics-COpjZpvd.js";import{a as de,s as fe}from"./ripgrep-67m14ImZ.js";import*as w from"path";import{statSync as pe}from"fs";function me(e,t,n){if(t===0)return n?D:0;let r=e.charCodeAt(t-1);return he(r)?be:ge(r)&&_e(e.charCodeAt(t))?xe:0}function he(e){return e===47||e===92||e===45||e===95||e===46||e===32}function ge(e){return e>=97&&e<=122}function _e(e){return e>=65&&e<=90}function T(){return new Promise(e=>setImmediate(e))}function ve(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 ye,be,xe,E,D,O,k,A,j,M,N,Se=e((()=>{n(),ye=16,be=8,xe=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 T(),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 T(),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=ve(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*ye+o-n;f+=me(v,M[0],!0);for(let e=1;e<i;e++)f+=me(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=d(b());if(!e)return null;try{return pe(w.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function I(e,t,n){return n===t?e:e.map(e=>{let r=w.join(t,e);return w.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){S(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await z.loadFromFileListAsync(n).done,Q=r,S(`[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=ie(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,ze.default)(),s=!1,c=a.flatMap(e=>i.map(t=>w.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,S(`[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();S(`[FileIndex] getFilesUsingGit called`);let r=b(),i=d(r);if(!i)return S(`[FileIndex] not a git repo, returning null`),null;try{let o=Date.now(),s=await le(a(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(S(`[FileIndex] git ls-files (tracked) took ${Date.now()-o}ms`),s.code!==0)return S(`[FileIndex] git ls-files failed (code=${s.code}, stderr=${s.stderr}), falling back to ripgrep`),null;let c=I(s.stdout.trim().split(`
|
|
2
|
+
`).filter(Boolean),i,r),l=await Ee(i,r);if(l){let e=c.length;c=l.filter(c),S(`[FileIndex] applied ignore patterns: ${e} -> ${c.length} files`)}W=c;let u=Date.now()-n;if(S(`[FileIndex] git ls-files: ${c.length} tracked files in ${u}ms`),c.length,c.length,!U){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=H;U=le(a(),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),S(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}S(`[FileIndex] background untracked fetch: ${t.length} files`),Te(t)}}).catch(e=>{S(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{U=null})}return c}catch(e){return S(`[FileIndex] git ls-files error: ${te(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 T(),n=performance.now());return[...t].map(e=>e+w.sep)}function ke(e,t,n,r){for(let i=t;i<n;i++){let t=w.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=w.dirname(t);if(e===t)break;r.add(t),t=e}}}async function Ae(e){return(await Promise.all(ee.map(t=>g(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function je(e,t){S(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await De(e,t);if(n!==null)return S(`[FileIndex] using git ls-files result (${n.length} files)`),n;S(`[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 fe(i,`.`,e)).map(e=>w.relative(b(),e)),o=Date.now()-r;return S(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),a.length,a}async function Me(){let e=AbortSignal.timeout(1e4),t=P();try{let n=u(),r=oe(),i=n.respectGitignore??r.respectGitignore??!0,a=b(),[o,s]=await Promise.all([je(e,i),Ae(a)]);G=s;let c=[...o,...s],l=await Oe(c);K=l;let d=[...l,...c],f=F(d);f===Z?S(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(d).done,Z=f,Q=null)}catch(e){C(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(),S(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(S(`[FileIndex] Cache refresh failed: ${te(e)}`),C(e),t===H&&(B=null),P()))}async function Ie(){let e=ie(),t=b();try{return(await e.readdir(t)).map(e=>{let n=w.join(t,e.name),r=w.relative(t,n);return e.isDirectory()?r+w.sep:r})}catch(e){return C(e),[]}}async function Le(e,t=!1){if(!e&&!t)return[];if(u().fileSuggestion?.type===`command`)return(await h({...m(),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=`.${w.sep}`;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=o(r));let a=z?Fe(z,r):[],s=Date.now()-n;return S(`[FileIndex] generateFileSuggestions: ${a.length} results in ${s}ms (${t?`partial`:`full`} index)`),a.length,e.length,a}catch(e){return C(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),_(),Se(),ue(),ae(),y(),re(),x(),ce(),ne(),l(),v(),se(),c(),de(),s(),p(),z=null,B=null,V=f(),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 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-BX54x08P.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";var r=e(t(),1),i=n(),a=(0,r.createContext)(void 0);function o({getFpsMetrics:e,children:t}){return(0,i.jsx)(a.Provider,{value:e,children:t})}function s(){return(0,r.useContext)(a)}export{s as n,o as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AS as t,BS as n,FS as r,Ji as i,LS as a,MS as o,NS as s,Wx as c,bS as l,ca as u,et as d,rt as f,ua as p}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AS as t,BS as n,FS as r,Ji as i,LS as a,MS as o,NS as s,Wx as c,bS as l,ca as u,et as d,rt as f,ua as p}from"./loadAgentsDir-uuZYOgKn.js";import{I as m,M as h,c as g,i as _}from"./debug-2pVES-2G.js";import{c as v,i as y}from"./proxy--_NfbJhm.js";import{randomUUID as b}from"crypto";function x(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={};for(let e of a.split(`
|
|
2
2
|
`)){let t=e[e.length-1]===`\r`?e.slice(0,-1):e;if(t.startsWith(`:`))continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n),i=t[n+1]===` `?t.slice(n+2):t.slice(n+1);r===`data`&&(o.data=o.data?`${o.data}\n${i}`:i)}o.data&&t.push(o)}return{frames:t,remaining:e.slice(n)}}function S(){return(process.env.GEMINI_BASE_URL||T).replace(/\/+$/,``)}function C(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*w(e){let t=await(e.fetchOverride??fetch)(`${S()}/${C(e.model)}:streamGenerateContent?alt=sse`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-goog-api-key":process.env.GEMINI_API_KEY||``},body:JSON.stringify(e.body),signal:e.signal,...y({forAnthropicAPI:!1})});if(!t.ok){let e=await t.text();throw Error(`Gemini API request failed (${t.status} ${t.statusText}): ${e||`empty response body`}`)}if(!t.body)throw Error(`Gemini API returned no response body`);let n=t.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,E);let{frames:a,remaining:o}=x(i);i=o;for(let e of a)if(!(!e.data||e.data===`[DONE]`))try{yield JSON.parse(e.data)}catch(e){throw Error(`Failed to parse Gemini SSE payload: ${h(e)}`)}}i+=r.decode();let{frames:e}=x(i);for(let t of e)if(!(!t.data||t.data===`[DONE]`))try{yield JSON.parse(t.data)}catch(e){throw Error(`Failed to parse trailing Gemini SSE payload: ${h(e)}`)}}finally{n.releaseLock()}}var T,E,D=e((()=>{m(),v(),T=`https://generativelanguage.googleapis.com/v1beta`,E={stream:!0}}));async function*O(e,i,l,d,m,h){try{let c=n(m.model),_=p(e,l),v=(await Promise.all(l.map(e=>f(e,{getToolPermissionContext:m.getToolPermissionContext,tools:l,agents:m.agents,allowedAgentTypes:m.allowedAgentTypes,model:m.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),{contents:y,systemInstruction:x}=r(_,i),S=s(v),C=o(m.toolChoice),T=w({model:c,signal:d,fetchOverride:m.fetchOverride,body:{contents:y,...x&&{systemInstruction:x},...S.length>0&&{tools:S},...C&&{toolConfig:{functionCallingConfig:C}},generationConfig:{...m.temperatureOverride!==void 0&&{temperature:m.temperatureOverride},...h.type!==`disabled`&&{thinkingConfig:{includeThoughts:!0,...h.type===`enabled`&&{thinkingBudget:h.budgetTokens}}}}}});g(`[Gemini] Calling model=${c}, messages=${y.length}, tools=${S.length}`);let E=t(T,c),D={},O=null,k=0,A=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,k=Date.now()-A;break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.type===`thinking`?r.signature=n.signature:r[a]=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:u([t],l,m.agentId)},requestId:void 0,type:`assistant`,uuid:b(),timestamp:new Date().toISOString()};break}case`message_delta`:case`message_stop`:break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:k}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);g(`[Gemini] Error: ${t}`,{level:`error`}),yield c({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{d(),_(),i(),D(),l()}))();export{O as queryModelGemini};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{bn as t,vn as n}from"./settings-D4M13toi.js";import{Fx as r,GS as i,Ji as a,X as o,Z as s,ty as c}from"./loadAgentsDir-uuZYOgKn.js";import{I as l,M as u,c as d,i as f}from"./debug-2pVES-2G.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,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-DXSEj8ZO.js";function i(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function a(e){try{let t=String(e),n=r(process.platform===`win32`?`powershell.exe -NoProfile -Command "(Get-CimInstance Win32_Process -Filter \\"ProcessId=${t}\\").CommandLine"`:`ps -o command= -p ${t}`,{timeout:1e3});return n?n.trim():null}catch{return null}}async function o(e,t=10){if(process.platform===`win32`){let r=await n(`powershell.exe`,[`-NoProfile`,`-Command`,`
|
|
2
2
|
$currentPid = ${String(e)}
|
|
3
3
|
$commands = @()
|
|
4
4
|
for ($i = 0; $i -lt ${t}; $i++) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,t as r}from"./src-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,t as r}from"./src-BX54x08P.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{$c as a,Av as o,Fv as s,al as c,el as l,fl as u,il as d,ll as f,ml as p,nl as m,ol as h,pl as g,rl as _,sl as v,tl as y,ul as b}from"./loadAgentsDir-uuZYOgKn.js";import{t as x}from"./select-BuTJbu_Q.js";import{t as S}from"./CustomSelect-CYmc4vRh.js";import{n as C,t as w}from"./PermissionDialog-DjCRuzSm.js";function T({currentGoal:e,newObjective:r,onConfirm:i,onCancel:a}){function o(e){e===`yes`?i():a()}let s=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`;return(0,E.jsx)(w,{color:`warning`,title:`Replace active goal?`,children:(0,E.jsxs)(t,{flexDirection:`column`,marginTop:1,paddingX:1,children:[(0,E.jsx)(n,{children:`A goal is already in progress. Replacing it will reset all progress and counters.`}),(0,E.jsxs)(t,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(n,{dimColor:!0,children:`Current goal:`}),(0,E.jsxs)(n,{children:[(0,E.jsx)(n,{dimColor:!0,children:`· Objective: `}),e.objective]}),(0,E.jsxs)(n,{children:[(0,E.jsx)(n,{dimColor:!0,children:`· Status: `}),h(e.status)]}),(0,E.jsxs)(n,{children:[(0,E.jsx)(n,{dimColor:!0,children:`· Time: `}),c(e)]}),(0,E.jsxs)(n,{children:[(0,E.jsx)(n,{dimColor:!0,children:`· Tokens: `}),s]})]}),(0,E.jsxs)(t,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(n,{dimColor:!0,children:`New objective:`}),(0,E.jsx)(n,{children:r})]}),(0,E.jsx)(t,{marginTop:1,children:(0,E.jsx)(x,{options:[{label:`Yes, replace the goal`,value:`yes`},{label:`No, keep the current goal`,value:`no`}],onChange:o,onCancel:a})})]})})}var E,D=e((()=>{r(),S(),C(),b(),E=i()}));function O(e){let t=e.split(`
|
|
2
2
|
`)[0]??e;return t.length<=F?t:`${t.slice(0,F)}…`}function k(){s(e=>e.origin===`goal-continuation`||e.origin===`goal-budget-limit`)}function A(){let e=v();if(!e)return"No active goal. Set one with `/goal <objective>`.";let t=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`,n=[`Goal: ${e.objective}`,`Status: ${h(e.status)}`,`Time: ${c(e)}`,`Tokens: ${t}`,`Continuation turns: ${e.turnsExecuted}`];return e.status===`max_turns`&&n.push("Hint: Max continuation turns reached (150). Run `/goal continue` to reset and continue."),n.join(`
|
|
3
3
|
`)}function j(e){return p(e),f(),l(),`Goal set.`}async function M(e,t,n){let r=n.trim();if(!r||r.toLowerCase()===`status`)return e(A(),{display:`system`}),null;let i=r.toLowerCase();if(i===`clear`){let t=m();return t&&(y(),k()),e(t?`Goal cleared.`:`No active goal to clear.`,{display:`system`}),null}if(i===`pause`){let t=u();return t&&(l(),k()),e(t?`Goal paused.`:`No active goal to pause.`,{display:`system`}),null}if(i===`resume`){if(v()?.status===`max_turns`)return e("Goal reached max continuation turns (150). Run `/goal continue` to reset turn counter and continue.",{display:`system`}),null;let t=g();return t&&l(),e(t?`Goal resumed.`:`No paused goal to resume.`,{display:`system`,shouldQuery:!!t}),null}if(i===`continue`){let t=d();return t&&l(),e(t?`Goal continuation counter reset (0/150). Continuing...`:`Current goal is not in max-turns state.`,{display:`system`,shouldQuery:!!t}),null}if(i===`complete`){let t=_();return t&&(l(),k()),e(t?`Goal marked complete.`:`No active goal to complete.`,{display:`system`}),null}if(r.length>P)return e(`Goal objective is too long (${r.length} chars; limit ${P}). Save the detailed instructions to a file and reference it from a shorter objective.`,{display:`system`}),null;let a=v();return a&&a.status!==`complete`?(0,N.jsx)(T,{currentGoal:a,newObjective:r,onConfirm:()=>{k(),e(j(r),{display:`system`,shouldQuery:!0,displayArgs:O(r),metaMessages:[`<goal-objective-updated>\n${r}\n</goal-objective-updated>`]})},onCancel:()=>{e(`Kept the current goal. New objective discarded.`,{display:`system`})}}):(e(j(r),{display:`system`,shouldQuery:!0,displayArgs:O(r),metaMessages:[`<goal-objective-updated>\n${r}\n</goal-objective-updated>`]}),null)}var N,P,F;e((()=>{b(),a(),o(),D(),N=i(),P=4e3,F=80}))();export{M as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{CS as t,ES as n,HS as r,Ji as i,Wx as a,bS as o,ca as s,dy as c,et as l,hy as u,rt as d,sy as f,ua as p,vy as m,wS as h,xS as g}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{CS as t,ES as n,HS as r,Ji as i,Wx as a,bS as o,ca as s,dy as c,et as l,hy as u,rt as d,sy as f,ua as p,vy as m,wS as h,xS as g}from"./loadAgentsDir-uuZYOgKn.js";import{c as _,i as v}from"./debug-2pVES-2G.js";import{n as y,t as b}from"./client-pA7fKk0-.js";import{n as x,t as S}from"./openaiShared-G2-w4gJt.js";import{randomUUID as C}from"crypto";async function*w(e,i,o,c,l){try{let a=r(l.model),m=p(e,o),v=(await Promise.all(o.map(e=>d(e,{getToolPermissionContext:l.getToolPermissionContext,tools:o,agents:l.agents,allowedAgentTypes:l.allowedAgentTypes,model:l.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),y=n(m,i),S=h(v),w=t(l.toolChoice),T=b({maxRetries:0,fetchOverride:l.fetchOverride,source:l.querySource});_(`[Grok] Calling model=${a}, messages=${y.length}, tools=${S.length}`);let E=g(await T.chat.completions.create({model:a,messages:y,...S.length>0&&{tools:S,...w&&{tool_choice:w}},stream:!0,stream_options:{include_usage:!0},...l.temperatureOverride!==void 0&&{temperature:l.temperatureOverride}},{signal:c}),a),D={},O=null,k={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},A=0,j=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,A=Date.now()-j,e.message.usage&&(k=x(k,e.message.usage));break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:s([t],o,l.agentId)},requestId:void 0,type:`assistant`,uuid:C(),timestamp:new Date().toISOString()};break}case`message_delta`:{let t=e.usage;t&&(k=x(k,t));break}case`message_stop`:break}e.type===`message_stop`&&k.input_tokens+k.output_tokens>0&&f(u(a,k),k,l.model),yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:A}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);_(`[Grok] Error: ${t}`,{level:`error`}),yield a({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{y(),S(),o(),i(),l(),v(),c(),m()}))();export{w as queryModelGrok};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,Wt as a,a as o,ai as s,n as c,ot as l,r as u,t as d,x as f}from"./src-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,Wt as a,a as o,ai as s,n as c,ot as l,r as u,t as d,x as f}from"./src-BX54x08P.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Mi as m,Ti as h,nb as g,rb as _,sb as v,tb as y,xi as b}from"./loadAgentsDir-uuZYOgKn.js";import{v as x,y as S}from"./startupProfiler-B9Qv2QGH.js";import{n as C,t as w}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as T,t as E}from"./select-BuTJbu_Q.js";import{n as D,r as O}from"./modalContext-sU2lfR08.js";import{n as k,t as A}from"./PromptInputHelpMenu-CrTT8MKE.js";function j({commands:e,maxHeight:t,columns:r,title:a,onCancel:s,emptyMessage:c}){let{headerFocused:l,focusHeader:u}=o(),d=Math.max(1,r-10),f=Math.max(1,Math.floor((t-10)/2)),p=(0,M.useMemo)(()=>{let t=new Set;return e.filter(e=>t.has(e.name)?!1:(t.add(e.name),!0)).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({label:`/${e.name}`,value:e.name,description:S(h(e),d,!0)}))},[e,d]);return(0,N.jsx)(n,{flexDirection:`column`,paddingY:1,children:e.length===0&&c?(0,N.jsx)(i,{dimColor:!0,children:c}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(i,{children:a}),(0,N.jsx)(n,{marginTop:1,children:(0,N.jsx)(E,{options:p,visibleOptionCount:f,onCancel:s,disableSelection:!0,hideIndexes:!0,layout:`compact-vertical`,onUpFromFirstItem:u,isDisabled:l})})]})})}var M,N,P=e((()=>{M=t(s(),1),m(),x(),d(),T(),N=p()}));function F(){return(0,I.jsxs)(n,{flexDirection:`column`,paddingY:1,gap:1,children:[(0,I.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,I.jsx)(i,{bold:!0,children:`Getting started`}),(0,I.jsxs)(n,{flexDirection:`column`,children:[(0,I.jsxs)(i,{children:[(0,I.jsx)(i,{bold:!0,children:`1. `}),(0,I.jsx)(i,{children:`Ask a question or describe a task — Work Mate will explore your code and respond.`})]}),(0,I.jsxs)(i,{children:[(0,I.jsx)(i,{bold:!0,children:`2. `}),(0,I.jsx)(i,{children:`When Work Mate wants to edit files or run commands, you review and approve each action.`})]}),(0,I.jsxs)(i,{children:[(0,I.jsx)(i,{bold:!0,children:`3. `}),(0,I.jsx)(i,{children:`Type `}),(0,I.jsx)(i,{bold:!0,children:`/help`}),(0,I.jsx)(i,{children:` for commands, or `}),(0,I.jsx)(i,{bold:!0,children:`?`}),(0,I.jsx)(i,{children:` for shortcuts.`})]})]})]}),(0,I.jsxs)(n,{flexDirection:`column`,children:[(0,I.jsx)(n,{children:(0,I.jsx)(i,{bold:!0,children:`Shortcuts`})}),(0,I.jsx)(A,{gap:2,fixedWidth:!0})]})]})}var I,L=e((()=>{d(),k(),I=p()}));function R({onClose:e,commands:t}){let{rows:o,columns:s}=l(),d=Math.floor(o/2),p=O(),m=()=>e(`Help dialog dismissed`,{display:`system`});a(`help:dismiss`,m,{context:`Help`});let h=C(m),g=_(`help:dismiss`,`Help`,`esc`),v=b(),y=t.filter(e=>v.has(e.name)&&!e.isHidden),x=t.filter(e=>!v.has(e.name)&&!e.isHidden),S=[(0,z.jsx)(c,{title:`general`,children:(0,z.jsx)(F,{})},`general`)];return S.push((0,z.jsx)(c,{title:`commands`,children:(0,z.jsx)(j,{commands:y,maxHeight:d,columns:s,title:`Browse default commands:`,onCancel:m})},`commands`)),S.push((0,z.jsx)(c,{title:`custom-commands`,children:(0,z.jsx)(j,{commands:x,maxHeight:d,columns:s,title:`Browse custom commands:`,emptyMessage:`No custom commands found`,onCancel:m})},`custom`)),(0,z.jsx)(n,{flexDirection:`column`,height:p?void 0:d,children:(0,z.jsxs)(f,{color:`professionalBlue`,children:[(0,z.jsx)(u,{title:`Work Mate v0.0.27`,color:`professionalBlue`,defaultTab:`general`,children:S}),(0,z.jsx)(n,{marginTop:1,children:(0,z.jsxs)(i,{children:[`For more help: `,(0,z.jsx)(r,{url:`https://code.workmate.com/docs/en/overview`})]})}),(0,z.jsx)(n,{marginTop:1,children:(0,z.jsx)(i,{dimColor:!0,children:h.pending?(0,z.jsxs)(z.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,z.jsxs)(i,{italic:!0,children:[g,` to cancel`]})})})]})})}var z,B=e((()=>{w(),g(),m(),D(),v(),d(),y(),P(),L(),z=p()})),V,H;e((()=>{B(),V=p(),H=async(e,{options:{commands:t}})=>(0,V.jsx)(R,{commands:t,onClose:e})}))();export{H as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,l as n,o as r}from"./envUtils-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,l as n,o as r}from"./envUtils-QyzA_cFM.js";import{Pt as i,X as a,at as o}from"./state-CXY-q5gr.js";import{$ as s,C as c,I as l,N as u,S as d,c as f,et as p,f as m,h,i as g,x as _}from"./debug-2pVES-2G.js";import{n as v,r as y}from"./lockfile-D_9vif6E.js";import{n as b,t as x}from"./sleep-xKMbXTJe.js";import{a as S,i as C,n as w,r as T}from"./pasteStore-njJCBMKr.js";import{join as E}from"path";import{appendFile as D,writeFile as O}from"fs/promises";function k(e){return(e.match(/\r\n|\r|\n/g)||[]).length}function A(e,t){return t===0?`[Pasted text #${e}]`:`[Pasted text #${e} +${t} lines]`}function j(e){return`[Image #${e}]`}function M(e){return[...e.matchAll(/\[(Pasted text|Image|\.\.\.Truncated text) #(\d+)(?: \+\d+ lines)?(\.)*\]/g)].map(e=>({id:parseInt(e[2]||`0`,10),match:e[0],index:e.index})).filter(e=>e.id>0)}function N(e,t){let n=M(e),r=e;for(let e=n.length-1;e>=0;e--){let i=n[e],a=t[i.id];a?.type===`text`&&(r=r.slice(0,i.index)+a.content+r.slice(i.index+i.match.length))}return r}function P(e){return d(e)}async function*F(){let e=o();for(let e=q.length-1;e>=0;e--)yield q[e];let n=E(t(),`history.jsonl`);try{for await(let t of h(n))try{let n=P(t);if(n.sessionId===e&&Q.has(n.timestamp))continue;yield n}catch(e){f(`Failed to parse history line: ${e}`)}}catch(e){if(u(e)===`ENOENT`)return;throw e}}async function*I(){for await(let e of F())yield await z(e)}async function*L(){let e=a(),t=o(),n=[],r=0;for await(let i of F())if(!(!i||typeof i.project!=`string`)&&i.project===e&&(i.sessionId===t?(yield await z(i),r++):n.push(i),r+n.length>=G))break;for(let e of n){if(r>=G)return;yield await z(e),r++}}async function R(e){if(e.content)return{id:e.id,type:e.type,content:e.content,mediaType:e.mediaType,filename:e.filename};if(e.contentHash){let t=await C(e.contentHash);if(t)return{id:e.id,type:e.type,content:t,mediaType:e.mediaType,filename:e.filename}}return null}async function z(e){let t={};for(let[n,r]of Object.entries(e.pastedContents||{})){let e=await R(r);e&&(t[Number(n)]=e)}return{display:e.display,pastedContents:t}}async function B(){if(q.length===0)return;let e;try{let n=E(t(),`history.jsonl`);await O(n,``,{encoding:`utf8`,mode:384,flag:`a`}),e=await y(n,{stale:1e4,retries:{retries:3,minTimeout:50}});let r=q.map(e=>`${c(e)}\n`);q=[],await D(n,r.join(``),{mode:384})}catch(e){f(`Failed to write prompt history: ${e}`)}finally{e&&await e()}}async function V(e){if(!(J||q.length===0)&&!(e>5)){J=!0;try{await B()}finally{J=!1,q.length>0&&(await b(500),V(e+1))}}}async function H(e){let t=typeof e==`string`?{display:e,pastedContents:{}}:e,n={};if(t.pastedContents){for(let[e,r]of Object.entries(t.pastedContents))if(r.type!==`image`)if(r.content.length<=K)n[Number(e)]={id:r.id,type:r.type,content:r.content,mediaType:r.mediaType,filename:r.filename};else{let t=w(r.content);n[Number(e)]={id:r.id,type:r.type,contentHash:t,mediaType:r.mediaType,filename:r.filename},S(t,r.content)}}let r={...t,pastedContents:n,timestamp:Date.now(),project:a(),sessionId:o()};q.push(r),Z=r,Y=V(0)}function U(e){n(process.env.WORKMATE_SKIP_PROMPT_HISTORY)||(X||(X=!0,p(async()=>{Y&&await Y,q.length>0&&await B()})),H(e))}function W(){if(!Z)return;let e=Z;Z=null;let t=q.lastIndexOf(e);t===-1?Q.add(e.timestamp):q.splice(t,1)}var G,K,q,J,Y,X,Z,Q,$=e((()=>{i(),s(),g(),r(),l(),m(),v(),T(),x(),_(),G=100,K=1024,q=[],J=!1,Y=null,X=!1,Z=null,Q=new Set}));export{L as a,I as c,A as i,M as l,N as n,k as o,j as r,$ as s,U as t,W as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mn as e,on as t,qt as n}from"./loadAgentsDir-uuZYOgKn.js";e();export{n as executeSessionEndHooks,t as getSessionEndHookTimeoutMs};
|