@readmagic/workmate 0.0.18 → 0.0.20
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-Wa6Q24nu.js → AddWorkspaceDirectory-BYNvxNrD.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-3I_KlOLv.js → AgentsMdExternalIncludesDialog-CMEGV4Md.js} +1 -1
- package/dist/chunks/{App-BgPs1Bu8.js → App-W_9d1DjK.js} +1 -1
- package/dist/chunks/{ApproveApiKey-BxpapUq0.js → ApproveApiKey-Bf1Rb8Ql.js} +1 -1
- package/dist/chunks/ApproveApiKey-wpdvXpFr.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-lGn1Wj1k.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-8Cq982M0.js → BypassPermissionsModeDialog-CjVjyNf8.js} +1 -1
- package/dist/chunks/{DiffDialog-DwQTDWYh.js → DiffDialog-DCpchgp5.js} +2 -2
- package/dist/chunks/Doctor-6SjW91rd.js +1 -0
- package/dist/chunks/Doctor-FPYTivHw.js +3 -0
- package/dist/chunks/ExitFlow-Dy8_1D8J.js +2 -0
- package/dist/chunks/{Grove-_QX_wR9C.js → Grove-Dd6rjs5P.js} +1 -1
- package/dist/chunks/{HybridTransport-BG2VIIBC.js → HybridTransport-CJVkWa2u.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-BDdMkuaL.js → InvalidConfigDialog-Bisj9ic_.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-DSCqbVER.js → InvalidSettingsDialog-DyTPNRQR.js} +1 -1
- package/dist/chunks/MCPConnectionManager-DfyoZaiu.js +1 -0
- package/dist/chunks/MCPToolListView-Dioupv8F.js +1 -0
- package/dist/chunks/{McpParsingWarnings-Cr_n2QR6.js → McpParsingWarnings-BUlgpZAF.js} +1 -1
- package/dist/chunks/MessageSelector-D8fylxPg.js +3 -0
- package/dist/chunks/Messages-BZDFMYBT.js +10 -0
- package/dist/chunks/{Onboarding-Cz3CfOTl.js → Onboarding-BKLomZYo.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-GhA5Qa1I.js → PromptInputFooterSuggestions-DCum89fF.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-sX_yHORM.js → PromptInputHelpMenu-DG2lRqis.js} +1 -1
- package/dist/chunks/QueryEngine-CyGHpX7M.js +1 -0
- package/dist/chunks/REPL-BDsz8KIx.js +1 -0
- package/dist/chunks/REPL-CCBNfZfs.js +128 -0
- package/dist/chunks/RemoteSessionManager-BfsOv4K6.js +2 -0
- package/dist/chunks/{ResumeConversation-e5sISbWn.js → ResumeConversation-pC8NLq0F.js} +1 -1
- package/dist/chunks/{SSETransport-BuDKErlN.js → SSETransport-B3K6eH9I.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +1 -0
- package/dist/chunks/Settings-CKaGmKg2.js +2 -0
- package/dist/chunks/{TeleportProgress-BUtze4qa.js → TeleportProgress-CkgSp1cs.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-Dp7rzrrz.js → TeleportRepoMismatchDialog-DdO_rECq.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-Ch2osY21.js → TeleportResumeWrapper-BeG4N-2z.js} +1 -1
- package/dist/chunks/{ThemePicker-AA-0hjpq.js → ThemePicker-iD9ufy99.js} +1 -1
- package/dist/chunks/{TrustDialog-rO5dZ8G-.js → TrustDialog-qO5OdQt8.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-DayOwxq9.js → ValidationErrorsList-BfZ5gcIv.js} +1 -1
- package/dist/chunks/add-dir-C4eSVlZ6.js +1 -0
- package/dist/chunks/{agentDisplay-nVTmC7tL.js → agentDisplay-BM4QG_RX.js} +1 -1
- package/dist/chunks/{agents-BQwi-6GV.js → agents-BbDBN5l9.js} +1 -1
- package/dist/chunks/agents-D3APE_8d.js +101 -0
- package/dist/chunks/allErrors-BkgB7JNK.js +1 -0
- package/dist/chunks/api-BHBK9axp.js +1 -0
- package/dist/chunks/{api-DAyhTxgY.js → api-DyUWfg3a.js} +1 -1
- package/dist/chunks/{auth-BzrroWLq.js → auth-0rn1U4Eq.js} +1 -1
- package/dist/chunks/auth-BEoTPSgC.js +1 -0
- package/dist/chunks/auth-BPug7U_u.js +1 -0
- package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +1 -0
- package/dist/chunks/backgroundHousekeeping-km82qEh0.js +17 -0
- package/dist/chunks/{banner-BfIcVEUU.js → banner-BkUdig-T.js} +1 -1
- package/dist/chunks/{bg-C15c_rMK.js → bg-tGgpwpYx.js} +2 -2
- package/dist/chunks/branch-CQ38cx5n.js +2 -0
- package/dist/chunks/{break-cache-XKbOAw-u.js → break-cache-CcwOjTKt.js} +3 -3
- package/dist/chunks/{bridgeConfig-Bxkrv8ZL.js → bridgeConfig-C5L-7KaP.js} +1 -1
- package/dist/chunks/bridgeConfig-CJMjDoaP.js +1 -0
- package/dist/chunks/{bridgeMessaging-BcSjIPCZ.js → bridgeMessaging-DVC3qj-C.js} +1 -1
- package/dist/chunks/{bridgePointer-CGhOBNMg.js → bridgePointer-DfTOjgtX.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-DBWBTU31.js → bridgeStatusUtil-Cex6VowM.js} +1 -1
- package/dist/chunks/btw-_P96ffHR.js +1 -0
- package/dist/chunks/caches-DH-q8Fjf.js +1 -0
- package/dist/chunks/caches-Dq0pJFDP.js +1 -0
- package/dist/chunks/{capacityWake-C24_KT1x.js → capacityWake-BpP6c7x3.js} +1 -1
- package/dist/chunks/{ccrClient-CH6PsxJJ.js → ccrClient-DO563xlf.js} +1 -1
- package/dist/chunks/{claudeDesktop-CovdLe-b.js → claudeDesktop-DPc_SaVn.js} +1 -1
- package/dist/chunks/{clear-D72LxXA6.js → clear-DmqQBNKg.js} +1 -1
- package/dist/chunks/{cliLaunch-DDA65zeR.js → cliLaunch-DDtwAolw.js} +1 -1
- package/dist/chunks/{client-o5_awagP.js → client-9uHzAmFH.js} +1 -1
- package/dist/chunks/client-BVal_QII.js +1 -0
- package/dist/chunks/client-C19cqYQS.js +1 -0
- package/dist/chunks/{client-eLOYyeES.js → client-C_jBL1yC.js} +1 -1
- package/dist/chunks/client-Dd7CKMRX.js +1 -0
- package/dist/chunks/commands-BkpqHY9F.js +1 -0
- package/dist/chunks/{compact--fnu8Zd-.js → compact-DuVIvqMu.js} +2 -2
- package/dist/chunks/config-DMP6-Ccr.js +1 -0
- package/dist/chunks/{config-BybjRr09.js → config-DRy1I12M.js} +2 -2
- package/dist/chunks/{config-BlQhL9Bh.js → config-e0Goy478.js} +1 -1
- package/dist/chunks/{context-D6PaqwrR.js → context-DjgMzIfe.js} +1 -1
- package/dist/chunks/{context-noninteractive-CxoMCfR4.js → context-noninteractive-BzDVMnWC.js} +5 -5
- package/dist/chunks/context-noninteractive-DV7bIJCm.js +1 -0
- package/dist/chunks/conversation-BBOE_EoE.js +1 -0
- package/dist/chunks/conversation-WxH5pb2z.js +1 -0
- package/dist/chunks/{createSSHSession-B3FdForb.js → createSSHSession-LVGVXHXL.js} +1 -1
- package/dist/chunks/createSession-BUzna9-E.js +1 -0
- package/dist/chunks/{createSession-C0e_DHsW.js → createSession-Dgwxk1WA.js} +1 -1
- package/dist/chunks/crossProjectResume-6B2NYy8a.js +40 -0
- package/dist/chunks/cwd-DLK3znO7.js +1 -0
- package/dist/chunks/cwd-Nh5IZNKO.js +1 -0
- package/dist/chunks/{datadog-ZxeaKwKd.js → datadog-Bc6wkPne.js} +1 -1
- package/dist/chunks/{debug-D7OBvqC2.js → debug-D58GQBDG.js} +1 -1
- package/dist/chunks/{debugUtils-B-GMBTBk.js → debugUtils-DXBRbwCE.js} +1 -1
- package/dist/chunks/{detached-uMuMcLsV.js → detached-Biz-xhu0.js} +1 -1
- package/dist/chunks/{detectRepository-AVEUw4lk.js → detectRepository-CDOJ-M7h.js} +1 -1
- package/dist/chunks/detectRepository-Cv9-k6dg.js +1 -0
- package/dist/chunks/{diff-BA2vN7sD.js → diff-DIg66U_d.js} +1 -1
- package/dist/chunks/{directoryCompletion-CLcmLin8.js → directoryCompletion-BDGcGDuv.js} +1 -1
- package/dist/chunks/doctor-BhUmhHQU.js +1 -0
- package/dist/chunks/{entry-cou5DS53.js → entry-B-Y-AYeK.js} +4 -4
- package/dist/chunks/{esm-D9-9wS1F.js → esm-CvHtYRrr.js} +1 -1
- package/dist/chunks/{execFileNoThrow-BHDSgTpZ.js → execFileNoThrow-Bmb5HEFz.js} +1 -1
- package/dist/chunks/{execSyncWrapper-pYxQXqb-.js → execSyncWrapper-C3ZFV9od.js} +1 -1
- package/dist/chunks/{exit-DdZJHhy2.js → exit-CW2eqUrR.js} +1 -1
- package/dist/chunks/{extraUsage-CHnG6JNH.js → extraUsage-CkTon7ib.js} +1 -1
- package/dist/chunks/extractMemories-CfmbvayQ.js +1 -0
- package/dist/chunks/fast-ByahC7Gw.js +1 -0
- package/dist/chunks/{fast-Bl_0cs9e.js → fast-xtIP4u4y.js} +1 -1
- package/dist/chunks/fetchModelList-D9aePIPW.js +1 -0
- package/dist/chunks/{fetchModelList-CheIBH5f.js → fetchModelList-Dy-x4h3G.js} +1 -1
- package/dist/chunks/{fileSuggestions-Dl87JhBr.js → fileSuggestions-CFkJktgc.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-Cw9Bc3on.js → firstPartyEventLogger-DqGSujCz.js} +2 -2
- package/dist/chunks/{flushGate-BD3Tk3_k.js → flushGate-BjKW7PFC.js} +1 -1
- package/dist/chunks/{gemini-BARUjH_t.js → gemini-NnmxBoEp.js} +1 -1
- package/dist/chunks/{generateSessionName-CHaK44K-.js → generateSessionName-EpqGW-T2.js} +1 -1
- package/dist/chunks/{genericProcessUtils-D5hCZ2ho.js → genericProcessUtils-6E7fB1dI.js} +1 -1
- package/dist/chunks/{git-CNhyfMtb.js → git-By_J4XJL.js} +1 -1
- package/dist/chunks/git-zJCasBa6.js +1 -0
- package/dist/chunks/githubRepoPathMapping-CzgPGOHQ.js +1 -0
- package/dist/chunks/{goal-fTQFogdl.js → goal-DbS8yJfB.js} +1 -1
- package/dist/chunks/{grok-D0J4IiCe.js → grok-BxZ4vTDw.js} +1 -1
- package/dist/chunks/{grove-mDH4wkhM.js → grove-CYE1Cfcz.js} +1 -1
- package/dist/chunks/{help-Dr7st1Yv.js → help-DatnwM25.js} +1 -1
- package/dist/chunks/{hooks-DCfpFhl2.js → hooks-7iyENdDG.js} +2 -2
- package/dist/chunks/hooks-DjbqtbUV.js +1 -0
- package/dist/chunks/initReplBridge-BEZW5PEY.js +1 -0
- package/dist/chunks/install-DJukI-kL.js +1 -0
- package/dist/chunks/{instrumentation-DS2S1m1a.js → instrumentation-2HH15DPu.js} +4 -4
- package/dist/chunks/{job-Dry-GMc5.js → job-CXz7SLZp.js} +1 -1
- package/dist/chunks/{jwtUtils-ClCcC8lO.js → jwtUtils-C_LG1txt.js} +1 -1
- package/dist/chunks/keybindings-C9l5il16.js +1 -0
- package/dist/chunks/{launchLocalMemory-_T0oHfh9.js → launchLocalMemory-BfGenqj1.js} +1 -1
- package/dist/chunks/{launchOnboarding-D4fS6pLc.js → launchOnboarding-DjMmXeQE.js} +1 -1
- package/dist/chunks/{loadAgentsDir-DnsldjYU.js → loadAgentsDir-DaNpxaO-.js} +588 -623
- package/dist/chunks/loadAgentsDir-DcI-8FQF.js +1 -0
- package/dist/chunks/{loadPluginHooks-CRoYa_il.js → loadPluginHooks-CGgpcyEC.js} +1 -1
- package/dist/chunks/{loader-C-PQ3onD.js → loader-C33o_5kS.js} +1 -1
- package/dist/chunks/{localSearch-nuNjYVKq.js → localSearch-C2SZ9bGW.js} +1 -1
- package/dist/chunks/localSearch-CTTwYTU1.js +1 -0
- package/dist/chunks/{log-CR0v5KUR.js → log-CZ7ploQm.js} +1 -1
- package/dist/chunks/{logoV2Utils-CZwL_VX1.js → logoUtils-CbIqOFrX.js} +1 -1
- package/dist/chunks/{magicDocs-D0rjtxup.js → magicDocs-CrTwULyJ.js} +2 -2
- package/dist/chunks/{main-DKqCPH3G.js → main-Blm02_Js.js} +2 -2
- package/dist/chunks/{main-C8n_p7yX.js → main-bJXadFi0.js} +30 -30
- package/dist/chunks/managedEnv-CUsdYhAI.js +1 -0
- package/dist/chunks/managedEnv-DXeaUDSK.js +1 -0
- package/dist/chunks/{mappers-BIDALdjB.js → mappers-_B-s9fNz.js} +1 -1
- package/dist/chunks/mcp-BbbYzWpy.js +6 -0
- package/dist/chunks/mcp-D91sH9a8.js +1 -0
- package/dist/chunks/mcp-Dx-zgUgu.js +2 -0
- package/dist/chunks/{memoize-C7xmvAQ0.js → memoize-CumjjK2Q.js} +1 -1
- package/dist/chunks/memory-BeL7ui9m.js +1 -0
- package/dist/chunks/{mode-CajUX4Uz.js → mode-D695kgLI.js} +1 -1
- package/dist/chunks/model-DX0TtzqX.js +1 -0
- package/dist/chunks/{model-xI2MbgRj.js → model-Do0f476p.js} +1 -1
- package/dist/chunks/model-DpcM8dz5.js +1 -0
- package/dist/chunks/{modelOptions-Ct80yABl.js → modelOptions-B3nis9cC.js} +1 -1
- package/dist/chunks/{src-l6_O0K-a.js → modifiersNative-BYHdmWw1.js} +1 -1
- package/dist/chunks/modifiersNative-D7nm70eq.js +1 -0
- package/dist/chunks/{nativeInstaller-C6aWHxve.js → nativeInstaller-CymO8TNe.js} +1 -1
- package/dist/chunks/omit-DO61BHZu.js +1 -0
- package/dist/chunks/onChangeAppState-vKml_lit.js +1 -0
- package/dist/chunks/{openai-wsPCDwGL.js → openai-DdupGVdC.js} +2 -2
- package/dist/chunks/{panel-BKMLX5AR.js → panel-CVd1dzYl.js} +1 -1
- package/dist/chunks/parser-Cq9X7HMP.js +1 -0
- package/dist/chunks/{parser-Dy-RMf4a.js → parser-eVu-cTRs.js} +1 -1
- package/dist/chunks/partition-BivH9MBJ.js +1 -0
- package/dist/chunks/permissions-C9iqR4_N.js +3 -0
- package/dist/chunks/pidLock-DiKz5Tza.js +3 -0
- package/dist/chunks/{plan-CTiLy_c4.js → plan-KDN5IGWY.js} +1 -1
- package/dist/chunks/{platform-BZm4WVLM.js → platform-DMQxcm4K.js} +1 -1
- package/dist/chunks/plugin-D0rzUb8E.js +17 -0
- package/dist/chunks/{pluginAutoupdate-DzK-fXJC.js → pluginAutoupdate-C2xTKLR_.js} +1 -1
- package/dist/chunks/{pluginBlocklist-B3JVl1h2.js → pluginBlocklist-xdiUmUpt.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CubOvlhc.js → pluginCliCommands-CIDDvVN7.js} +1 -1
- package/dist/chunks/{pluginFlagging-Dp7W2eL8.js → pluginFlagging-DRA0m76J.js} +1 -1
- package/dist/chunks/pluginOperations-BEYsarAn.js +2 -0
- package/dist/chunks/{pluginStartupCheck-CL24_zVV.js → pluginStartupCheck-BF1N4Lih.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +1 -0
- package/dist/chunks/{plugins-DA3lpRU4.js → plugins-CWWU4BKs.js} +4 -4
- package/dist/chunks/poorMode-BTIe8W_H.js +1 -0
- package/dist/chunks/poorMode-CKQfWf3S.js +1 -0
- package/dist/chunks/print-B5H2xbBS.js +14 -0
- package/dist/chunks/processBashCommand-EQ9EWaRV.js +1 -0
- package/dist/chunks/processSlashCommand-C4PKNyFT.js +5 -0
- package/dist/chunks/{prompt-CzQkcxfg.js → prompt-8u06WVES.js} +17 -17
- package/dist/chunks/prompt-B9sDzLPK.js +1 -0
- package/dist/chunks/prompt-WsoTRhoh.js +1 -0
- package/dist/chunks/{promptEditor-C6w1vT5E.js → promptEditor-Cr4w-4Bz.js} +1 -1
- package/dist/chunks/{protocolHandler-B3bQyB6W.js → protocolHandler-DzHVaPl3.js} +2 -2
- package/dist/chunks/{proxy-DFIxRT0i.js → proxy-BhIc7-mj.js} +1 -1
- package/dist/chunks/reconciler-RIKmaPg7.js +1 -0
- package/dist/chunks/refresh-CCSCAjgz.js +1 -0
- package/dist/chunks/registerProtocol-C0IlPEoa.js +1 -0
- package/dist/chunks/{reload-plugins-BnZzcRcd.js → reload-plugins-DC-tbXVv.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-DAK9KSWp.js → remoteBridgeCore-NGTnhQgw.js} +1 -1
- package/dist/chunks/remoteManagedSettings-BoOYHzYP.js +1 -0
- package/dist/chunks/{rename-OSN3Ua2J.js → rename-DS1AmW-F.js} +1 -1
- package/dist/chunks/{renderOptions-XgkOdKCJ.js → renderOptions-D-aQZbzS.js} +1 -1
- package/dist/chunks/resume-Cf5PSoPw.js +2 -0
- package/dist/chunks/{ripgrep-C_XuTqp3.js → ripgrep-C3jtZL7k.js} +1 -1
- package/dist/chunks/ripgrep-CBUbn6Po.js +1 -0
- package/dist/chunks/{runtimeObserver-CuTsWhhF.js → runtimeObserver-DzesbvgI.js} +1 -1
- package/dist/chunks/{runtimeObserver-D9sujsqj.js → runtimeObserver-L6041elO.js} +2 -2
- package/dist/chunks/sandbox-adapter-Z4Phj31K.js +1 -0
- package/dist/chunks/{sandbox-toggle-oasrWfbj.js → sandbox-toggle-COZE8Lo4.js} +1 -1
- package/dist/chunks/sanitization-DV-94a9Z.js +1 -0
- package/dist/chunks/searchExtraTools-CvkRbL2m.js +1 -0
- package/dist/chunks/{session-c46jULDV.js → session-BvA99K4j.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +1 -0
- package/dist/chunks/{sessionObserver-Cu7vykWp.js → sessionObserver-0D8xFoRK.js} +1 -1
- package/dist/chunks/sessionObserver-CRWUBJEY.js +1 -0
- package/dist/chunks/{sessionState-B3tFm9SC.js → sessionState-CQhbGfmh.js} +2 -2
- package/dist/chunks/sessionStorage-DqEuxDlb.js +1 -0
- package/dist/chunks/{sessionTracing-BRp_Ej-e.js → sessionTracing-BoOZsXU2.js} +1 -1
- package/dist/chunks/{settings-DUyIag_5.js → settings-3xZ0fsvE.js} +4 -4
- package/dist/chunks/settings-Crx1cI1u.js +1 -0
- package/dist/chunks/settingsSync-rkWmClKS.js +1 -0
- package/dist/chunks/setup-D8L275fT.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-ChoqK1Iq.js → shadowedRuleDetection-Cy9tsuKc.js} +1 -1
- package/dist/chunks/{shellQuote-C-7PluUY.js → shellQuote-Ddgr1vif.js} +1 -1
- package/dist/chunks/{sideQuestion-CkC27Pf3.js → sideQuestion-Ds7Elgs4.js} +1 -1
- package/dist/chunks/{sinks-C9qCsi94.js → sinks-BXX72cbf.js} +1 -1
- package/dist/chunks/sinks-DMp6uEzM.js +1 -0
- package/dist/chunks/skillChangeDetector-CtithJ4a.js +1 -0
- package/dist/chunks/{skillGapStore-DC8s2Whn.js → skillGapStore-BxCxKPev.js} +2 -2
- package/dist/chunks/{skillLifecycle-BaqH5lw_.js → skillLifecycle-CfyNC3sW.js} +2 -2
- package/dist/chunks/{skillSearchPanel-Dtvyo2Dk.js → skillSearchPanel-CMNJFIEC.js} +3 -3
- package/dist/chunks/{skills-DXW57WeY.js → skills-DXMk-498.js} +1 -1
- package/dist/chunks/{startupProfiler-BqUlQEaV.js → startupProfiler-CbzxVmbv.js} +1 -1
- package/dist/chunks/startupProfiler-uHetQush.js +1 -0
- package/dist/chunks/state-BStOuCh4.js +1 -0
- package/dist/chunks/{state-B3zvBu4R.js → state-D5D6QpTX.js} +1 -1
- package/dist/chunks/{stats-vvwEVnon.js → stats-Ce15gc3E.js} +1 -1
- package/dist/chunks/{status-g_dhM6Ep.js → status-CFrLuGbf.js} +2 -2
- package/dist/chunks/status-D5OCkMZG.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-B235FWru.js → statusNoticeHelpers-CZoOse-_.js} +1 -1
- package/dist/chunks/{stringUtils-CGZoOfer.js → stringUtils-CKD8qDqx.js} +1 -1
- package/dist/chunks/switcher-AiMcRzoi.js +1 -0
- package/dist/chunks/{switcher-OAeeTHHt.js → switcher-DQF5ZNal.js} +1 -1
- package/dist/chunks/syncCache-qWJ_VfBo.js +1 -0
- package/dist/chunks/{tasks--7yJk7MD.js → tasks-C8pb6ftc.js} +1 -1
- package/dist/chunks/{teleport-ja50aVy3.js → teleport-Bi_1VFIZ.js} +1 -1
- package/dist/chunks/{templateJobs-DSM3tNDS.js → templateJobs-DJ4dcfcL.js} +1 -1
- package/dist/chunks/{terminalSetup-C735-5lZ.js → terminalSetup-7PdC4fV5.js} +1 -1
- package/dist/chunks/{terminalSetup-BpZXqE_G.js → terminalSetup-kWdZRKWq.js} +1 -1
- package/dist/chunks/{theme-BX54e0r7.js → theme-CEKOCSLw.js} +1 -1
- package/dist/chunks/{tmux-BIdWN33b.js → tmux-CpGd0Aca.js} +1 -1
- package/dist/chunks/{toolEventObserver-O6ljakS9.js → toolEventObserver-D2nk8ZbW.js} +1 -1
- package/dist/chunks/toolPool-Df5iUqJ-.js +1 -0
- package/dist/chunks/{trustedDevice-Kyid5Fuy.js → trustedDevice-CB6rNzl-.js} +1 -1
- package/dist/chunks/trustedDevice-DXGePUAC.js +1 -0
- package/dist/chunks/{types-DDku8UKF.js → types-APu4OCXJ.js} +1 -1
- package/dist/chunks/{udsClient-B2yCKNgT.js → udsClient-U7MEfYj7.js} +1 -1
- package/dist/chunks/{upstreamproxy--RTAcgrE.js → upstreamproxy-CTOuotLO.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BnmDpMkm.js → useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js} +1 -1
- package/dist/chunks/useMainLoopModel-CIG2cjS2.js +1 -0
- package/dist/chunks/useManagePlugins-MSHw-qHx.js +1 -0
- package/dist/chunks/{useMergedTools-ChLA8dsy.js → useMergedTools-Bb-INJa2.js} +1 -1
- package/dist/chunks/{useSearchInput-DqymtQhH.js → useSearchInput-QL_VtdJD.js} +1 -1
- package/dist/chunks/useSettingsErrors-Dvi6zLCr.js +1 -0
- package/dist/chunks/{userAgent-D8vvjitA.js → userAgent-i-oGzf40.js} +1 -1
- package/dist/chunks/{util-CC-NRn16.js → util-CLQvtXuD.js} +1 -1
- package/dist/chunks/validatePlugin-1mTZ3TJR.js +1 -0
- package/dist/chunks/{vim-CIK2DjfK.js → vim-BagKUX4j.js} +1 -1
- package/dist/chunks/{which-3MmqfsNV.js → which-BxQ1hpjp.js} +1 -1
- package/dist/chunks/{windowsPaths-x-CxdtFP.js → windowsPaths-BdhjMYTm.js} +1 -1
- package/dist/chunks/windowsPaths-DtGZ83kH.js +1 -0
- package/dist/chunks/{workSecret-BsolC5S7.js → workSecret-CaM2yIJD.js} +1 -1
- package/dist/chunks/{workerRegistry-DE4Ghp-n.js → workerRegistry-BjxoZ12l.js} +2 -2
- package/dist/chunks/worktree-DpksgxdF.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -5
- package/dist/chunks/AgentsMdExternalIncludesDialog-h150UBir.js +0 -1
- package/dist/chunks/ApproveApiKey-DIIIi6U8.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-nfRmiGl3.js +0 -2
- package/dist/chunks/Doctor-Beo5yEMD.js +0 -1
- package/dist/chunks/Doctor-BxXAGr-Z.js +0 -3
- package/dist/chunks/ExitFlow-CVIuvrHT.js +0 -2
- package/dist/chunks/MCPConnectionManager-Cer1UawR.js +0 -1
- package/dist/chunks/MCPToolListView-DndNWDr1.js +0 -1
- package/dist/chunks/MessageSelector-BfmbAG8E.js +0 -3
- package/dist/chunks/Messages-CUJJ6nHV.js +0 -10
- package/dist/chunks/QueryEngine-C6Dx_-U8.js +0 -1
- package/dist/chunks/REPL-BPig-OIh.js +0 -128
- package/dist/chunks/REPL-e5wWV2Sl.js +0 -1
- package/dist/chunks/RemoteSessionManager-Cax4g0GH.js +0 -2
- package/dist/chunks/SearchExtraToolsTool-B_z74zwG.js +0 -1
- package/dist/chunks/Settings-B9rxF2wR.js +0 -2
- package/dist/chunks/add-dir-Cz33IGht.js +0 -1
- package/dist/chunks/agents-rfuJUSSc.js +0 -101
- package/dist/chunks/allErrors-YIRWFBD9.js +0 -1
- package/dist/chunks/api-CGk-0H2x.js +0 -1
- package/dist/chunks/attributionHooks-C0aXyx9L.js +0 -1
- package/dist/chunks/auth-DWWb8STf.js +0 -1
- package/dist/chunks/auth-DsqlBO-Q.js +0 -1
- package/dist/chunks/backgroundHousekeeping-CXv_Pm5h.js +0 -17
- package/dist/chunks/backgroundHousekeeping-Crx3oXIu.js +0 -1
- package/dist/chunks/branch-BEaujq-M.js +0 -2
- package/dist/chunks/bridgeConfig-Ctl7I_RR.js +0 -1
- package/dist/chunks/btw-8JqSG3o7.js +0 -1
- package/dist/chunks/caches-dnO4Ae_m.js +0 -1
- package/dist/chunks/caches-lPzD_yGv.js +0 -1
- package/dist/chunks/client-BFjMSlp7.js +0 -1
- package/dist/chunks/client-Byat5HpG.js +0 -1
- package/dist/chunks/client-Dzx24jGZ.js +0 -1
- package/dist/chunks/commands-D3lQbt9p.js +0 -1
- package/dist/chunks/config-CPGSP_1Z.js +0 -1
- package/dist/chunks/context-noninteractive-CwlOID3q.js +0 -1
- package/dist/chunks/conversation-BLEWB1BE.js +0 -1
- package/dist/chunks/conversation-Bos7yTIv.js +0 -1
- package/dist/chunks/createSession-B4wkDNam.js +0 -1
- package/dist/chunks/crossProjectResume-C5QtstD6.js +0 -40
- package/dist/chunks/cwd-BfiQQAqr.js +0 -1
- package/dist/chunks/cwd-Dj2ynhWd.js +0 -1
- package/dist/chunks/detectRepository-CWI2xcdR.js +0 -1
- package/dist/chunks/doctor-BV6zhneX.js +0 -1
- package/dist/chunks/extractMemories-DxGHxoNO.js +0 -1
- package/dist/chunks/fast-Bf-g-wR6.js +0 -1
- package/dist/chunks/fetchModelList-vk-RMDfG.js +0 -1
- package/dist/chunks/firstPartyEventLogger-DvsZdBy2.js +0 -1
- package/dist/chunks/git-Bujlb5tq.js +0 -1
- package/dist/chunks/githubRepoPathMapping-Dhz4cvw2.js +0 -1
- package/dist/chunks/hooks-C5YSYzSl.js +0 -1
- package/dist/chunks/initReplBridge-BFYTAFlT.js +0 -1
- package/dist/chunks/install-CjacxFXg.js +0 -1
- package/dist/chunks/keybindings-D01jzjKu.js +0 -1
- package/dist/chunks/loadAgentsDir-xG1HswS_.js +0 -1
- package/dist/chunks/localSearch-B17Mzd84.js +0 -1
- package/dist/chunks/managedEnv-C7bVtcgA.js +0 -1
- package/dist/chunks/managedEnv-d7HliQYg.js +0 -1
- package/dist/chunks/mcp-BcEApfqn.js +0 -1
- package/dist/chunks/mcp-CBbVcOTy.js +0 -2
- package/dist/chunks/mcp-DYtfHeRa.js +0 -6
- package/dist/chunks/memory-CijapyZk.js +0 -1
- package/dist/chunks/model-CyF5u3zH.js +0 -1
- package/dist/chunks/model-DaYZWYJe.js +0 -1
- package/dist/chunks/omit-BhPlISSj.js +0 -1
- package/dist/chunks/onChangeAppState-BOJd4Yce.js +0 -1
- package/dist/chunks/parser-B-QFQfSO.js +0 -1
- package/dist/chunks/partition-_qZZlGjS.js +0 -1
- package/dist/chunks/permissions-CcjGscyg.js +0 -3
- package/dist/chunks/pidLock-Cm9FWa4w.js +0 -3
- package/dist/chunks/plugin-D7vjs6Hu.js +0 -17
- package/dist/chunks/pluginOperations-BxHoy0pC.js +0 -2
- package/dist/chunks/pluginStartupCheck-CtX6QkdO.js +0 -1
- package/dist/chunks/poorMode-DyAWNRRM.js +0 -1
- package/dist/chunks/poorMode-aMzKXz6G.js +0 -1
- package/dist/chunks/postCommitAttribution-DoSP9wZD.js +0 -1
- package/dist/chunks/print-BrqZ3AgP.js +0 -14
- package/dist/chunks/processBashCommand-C6mBgRVz.js +0 -1
- package/dist/chunks/processSlashCommand-t0-BVku8.js +0 -5
- package/dist/chunks/prompt-BJ3xYAvE.js +0 -1
- package/dist/chunks/prompt-Di2lNwYp.js +0 -1
- package/dist/chunks/reconciler-p4lAu9ft.js +0 -1
- package/dist/chunks/refresh-DCQChX5A.js +0 -1
- package/dist/chunks/registerProtocol-CrzdmgCD.js +0 -1
- package/dist/chunks/remoteManagedSettings-DkLfclxa.js +0 -1
- package/dist/chunks/resume-K9q5B1li.js +0 -2
- package/dist/chunks/ripgrep-DLPH9MP9.js +0 -1
- package/dist/chunks/sandbox-adapter-CRxZBMAP.js +0 -1
- package/dist/chunks/searchExtraTools-BAYzzTE8.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-CwnjOk6S.js +0 -1
- package/dist/chunks/sessionObserver-DNjDoJmy.js +0 -1
- package/dist/chunks/sessionStorage-CVZ0MUSE.js +0 -1
- package/dist/chunks/settings-DsqFBv6J.js +0 -1
- package/dist/chunks/settingsSync-yE43qjMS.js +0 -1
- package/dist/chunks/setup-CFOc-hPM.js +0 -3
- package/dist/chunks/sinks-B64r_OBE.js +0 -1
- package/dist/chunks/skillChangeDetector-CLnn22Jo.js +0 -1
- package/dist/chunks/src-DPUAq5Ty.js +0 -1
- package/dist/chunks/startupProfiler-yBU6FaAV.js +0 -1
- package/dist/chunks/state-mHtumqEo.js +0 -1
- package/dist/chunks/status--Ql7l0VG.js +0 -1
- package/dist/chunks/switcher-Cb9R9247.js +0 -1
- package/dist/chunks/syncCache-BiqQEess.js +0 -1
- package/dist/chunks/toolPool-H_kXc8vo.js +0 -1
- package/dist/chunks/trustedDevice-Dm_SY3Ko.js +0 -1
- package/dist/chunks/useMainLoopModel-DG8pghH7.js +0 -1
- package/dist/chunks/useManagePlugins-HMHtjIY-.js +0 -1
- package/dist/chunks/useSettingsErrors-Bs9uyzW4.js +0 -1
- package/dist/chunks/validatePlugin-yCb8gsVF.js +0 -1
- package/dist/chunks/windowsPaths-Dd_S96Bq.js +0 -1
- package/dist/chunks/worktree-D-CgffvU.js +0 -1
- /package/dist/chunks/{src-DLz3FZm1.js → urlHandler-DLz3FZm1.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,m as n,r,u as i}from"./git-CNhyfMtb.js";n();export{r as findGitRoot,t as getBranch,e as getDefaultBranch,i as getRemoteUrl};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Wt as e,et as t}from"./state-B3zvBu4R.js";import{c as n,i as r}from"./debug-D7OBvqC2.js";import{kn as i,wn as a}from"./settings-DUyIag_5.js";import{c as o,h as s,y as c}from"./config-BybjRr09.js";import{S as l,m as u,r as d,x as f}from"./git-CNhyfMtb.js";import{a as p,i as m,n as h}from"./detectRepository-AVEUw4lk.js";import{realpath as g}from"fs/promises";e(),s(),r(),m(),a(),l(),u();async function _(){try{let e=await h();if(!e){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=t(),i=d(r)??r,a;try{a=(await g(i)).normalize(`NFC`)}catch{a=i}let s=e.toLowerCase(),l=o().githubRepoPaths?.[s]??[];if(l[0]===a){n(`Path ${a} already tracked for repo ${s}`);return}let u=l.filter(e=>e!==a),f=[a,...u];c(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:f}})),n(`Added ${a} to tracked paths for repo ${s}`)}catch(e){n(`Error updating repo path mapping: ${e}`)}}function v(e){let t=o(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function y(e){let t=await Promise.all(e.map(i));return e.filter((e,n)=>t[n])}async function b(e,t){try{let n=await f(e);if(!n)return!1;let r=p(n);return r?r.toLowerCase()===t.toLowerCase():!1}catch{return!1}}function x(e,t){let r=o(),i=e.toLowerCase(),a=r.githubRepoPaths?.[i]??[],s=a.filter(e=>e!==t);if(s.length===a.length)return;let l={...r.githubRepoPaths};s.length===0?delete l[i]:l[i]=s,c(e=>({...e,githubRepoPaths:l})),n(`Removed ${t} from tracked paths for repo ${i}`)}export{b as a,_ as i,v as n,x as r,y as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hn as e,mn as t,qt as n,sn as r}from"./loadAgentsDir-DnsldjYU.js";e();export{n as executeSessionEndHooks,r as getSessionEndHookTimeoutMs,t as hasWorktreeCreateHook};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as e,o as t,u as n}from"./envUtils-DcaKZlRU.js";import{Da as r,La as i,Va as a,af as o,br as s,hc as c,ka as l,lf as u,nE as d,rE as f,rf as p,rr as m,yc as h}from"./loadAgentsDir-DnsldjYU.js";import{Wt as g,et as _,pt as v}from"./state-B3zvBu4R.js";import{P as y,R as b,c as x,i as S,nt as ee,tt as C}from"./debug-D7OBvqC2.js";import{c as te,h as ne,y as re}from"./config-BybjRr09.js";import{O as w,i as ie,k as T,m as E,u as D}from"./git-CNhyfMtb.js";import{g as O,m as k}from"./log-CR0v5KUR.js";import{n as A,r as j}from"./analytics-DJobLaWP.js";import{At as ae,Dr as M,Or as N,Pt as oe,St as se,ct as P,dn as F,fn as I}from"./model-xI2MbgRj.js";import{C as L,c as ce,n as R,w as le}from"./sessionState-B3tFm9SC.js";import{a as ue,i as de,r as fe,t as z}from"./sessionIdCompat-Dgp6PW_1.js";import{a as B,i as pe,n as V,o as me,t as H}from"./bridgeConfig-Bxkrv8ZL.js";import{a as U,o as W,r as G,s as K}from"./debugUtils-B-GMBTBk.js";import{a as q,i as J,n as he,t as Y}from"./createSession-C0e_DHsW.js";import{n as ge,o as X}from"./mappers-BIDALdjB.js";import{n as _e,r as Z,t as Q}from"./sessionTitle-k4wpUS5l.js";import{a as ve,d as ye,f as be,i as xe,l as Se,n as Ce,o as we,r as Te,t as Ee,u as De}from"./bridgeMessaging-BcSjIPCZ.js";import{i as Oe,n as ke,r as Ae,t as je}from"./flushGate-BD3Tk3_k.js";import{n as Me,t as Ne}from"./pollConfig-2nFzv6Hy.js";import{n as Pe,t as Fe}from"./rcDebugLog-DSchf3Hs.js";import{a as Ie,i as Le,n as $,o as Re,r as ze,t as Be}from"./capacityWake-C24_KT1x.js";import{a as Ve,n as He,r as Ue,t as We}from"./workSecret-BsolC5S7.js";import{i as Ge}from"./trustedDevice-Kyid5Fuy.js";import{t as Ke}from"./HybridTransport-BG2VIIBC.js";import{hostname as qe}from"os";import{randomUUID as Je}from"crypto";g(),k(),E(),ne(),N(),oe(),f(),p(),i(),s(),B(),J(),ge(),Z(),S(),Fe(),w(),A(),C(),z(),c(),L(),R(),t(),W(),b(),F();var Ye=2e3,Xe=6e4,Ze=900*1e3,Qe=0;async function $e(t){let{dir:r,machineName:i,branch:a,gitRepoUrl:o,title:s,baseUrl:c,sessionIngressUrl:l,workerType:u,getAccessToken:d,createSession:f,archiveSession:p,getCurrentTitle:m=()=>s,toSDKMessages:g=()=>{throw Error(`BridgeCoreParams.toSDKMessages not provided. Pass it if you use writeMessages() or initialMessages — daemon callers that only use writeSdkMessages() never hit this path.`)},onAuth401:_,getPollIntervalConfig:v=()=>Me,initialHistoryCap:b=200,initialMessages:S,previouslyFlushedUUIDs:C,onInboundMessage:te,onPermissionResponse:ne,onInterrupt:re,onSetModel:w,onSetMaxThinkingTokens:ie,onSetPermissionMode:E,onStateChange:D,onUserMessage:O,perpetual:k,initialSSESequenceNum:A=0}=t,ae=++Qe,{writeBridgePointer:M,clearBridgePointer:N,readBridgePointer:oe}=await import(`./bridgePointer-CGhOBNMg.js`),se=k?await oe(r):null,P=se?.source===`repl`?se:null;x(`[bridge:repl] initBridgeCore #${ae} starting (initialMessages=${S?.length??0}${P?` perpetual prior=env:${P.environmentId}`:``})`);let F=ze({baseUrl:c,getAccessToken:d,runnerVersion:`0.0.18`,onDebug:x,onAuth401:_,getTrustedDeviceToken:Ge}),I={dir:r,machineName:i,branch:a,gitRepoUrl:o,maxSessions:1,spawnMode:`single-session`,verbose:!1,sandbox:!1,bridgeId:Je(),workerType:u,environmentId:Je(),reuseEnvironmentId:P?.environmentId,apiBaseUrl:c,sessionIngressUrl:l},L,R;try{let e=await F.registerBridgeEnvironment(I);L=e.environment_id,R=e.environment_secret}catch(e){return K(`registration_failed`,`[bridge:repl] Environment registration failed: ${y(e)}`),P&&await N(r),D?.(`failed`,y(e)),null}x(`[bridge:repl] Environment registered: ${L}`),T(`info`,`bridge_repl_env_registered`),j(`tengu_bridge_repl_env_registered`,{});async function fe(e,t){if(L!==e)return x(`[bridge:repl] Env mismatch (requested ${e}, got ${L}) — cannot reconnect in place`),!1;let n=ue(t),r=n===t?[t]:[t,n];for(let e of r)try{return await F.reconnectSession(L,e),x(`[bridge:repl] Reconnected session ${e} in place on env ${L}`),!0}catch(t){x(`[bridge:repl] reconnectSession(${e}) failed: ${y(t)}`)}return x(`[bridge:repl] reconnectSession exhausted — falling through to fresh session`),!1}let z=P?await fe(P.environmentId,P.sessionId):!1;P&&!z&&await N(r);let B;if(z&&P){if(B=P.sessionId,x(`[bridge:repl] Perpetual session reused: ${B}`),S&&C)for(let e of S)C.add(e.uuid)}else{let e=await f({environmentId:L,title:s,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});if(!e)return x(`[bridge:repl] Session creation failed, deregistering environment`),j(`tengu_bridge_repl_session_failed`,{}),await F.deregisterEnvironment(L).catch(()=>{}),D?.(`failed`,`Session creation failed`),null;B=e,x(`[bridge:repl] Session created: ${B}`)}await M(r,{sessionId:B,environmentId:L,source:`repl`}),T(`info`,`bridge_repl_session_created`),j(`tengu_bridge_repl_started`,{has_initial_messages:!!(S&&S.length>0),inProtectedNamespace:n()});let pe=new Set;if(S)for(let e of S)pe.add(e.uuid);let V=new Ee(2e3);for(let e of pe)V.add(e);let me=new Ee(2e3),H=new AbortController,U=null;ce(e=>{H.signal.aborted||U?.reportMetadata(e)},{replayCurrent:!0});let W=0,G=z?A:0,q=null,J=null,he=Be(H.signal),Y=he.wake,ge=he.signal,X=new je,_e=!O,Z=0,Q=null;async function ye(){if(Q)return Q;Q=be();try{return await Q}finally{Q=null}}async function be(){if(Z++,Pe(`doReconnect: attempt=${Z}/3 envId=${L} sessionId=${B} workId=${q}`),W++,x(`[bridge:repl] Reconnecting after env lost (attempt ${Z}/3)`),Z>3)return x(`[bridge:repl] Environment reconnect limit reached (3), giving up`),!1;if(U){let e=U.getLastSequenceNum();e>G&&(G=e),U.close(),U=null}if(Y(),X.drop(),q){let e=q;if(await F.stopWork(L,e,!1).catch(()=>{}),q!==e)return x(`[bridge:repl] Poll loop recovered during stopWork await — deferring to it`),Z=0,!0;q=null,J=null}if(H.signal.aborted)return x(`[bridge:repl] Reconnect aborted by teardown`),!1;let e=L;I.reuseEnvironmentId=e;try{let e=await F.registerBridgeEnvironment(I);L=e.environment_id,R=e.environment_secret}catch(e){return I.reuseEnvironmentId=void 0,x(`[bridge:repl] Environment re-registration failed: ${y(e)}`),!1}if(I.reuseEnvironmentId=void 0,x(`[bridge:repl] Re-registered: requested=${e} got=${L}`),H.signal.aborted)return x(`[bridge:repl] Reconnect aborted after env registration, cleaning up`),await F.deregisterEnvironment(L).catch(()=>{}),!1;if(U!==null)return x(`[bridge:repl] Poll loop recovered during registerBridgeEnvironment await — deferring to it`),Z=0,!0;if(await fe(e,B))return j(`tengu_bridge_repl_reconnected_in_place`,{}),Z=0,!0;if(L!==e&&j(`tengu_bridge_repl_env_expired_fresh_session`,{}),await p(B),H.signal.aborted)return x(`[bridge:repl] Reconnect aborted after archive, cleaning up`),await F.deregisterEnvironment(L).catch(()=>{}),!1;let t=m(),n=await f({environmentId:L,title:t,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});return n?H.signal.aborted?(x(`[bridge:repl] Reconnect aborted after session creation, cleaning up`),await p(n),!1):(B=n,h(de(n)).catch(()=>{}),G=0,me.clear(),_e=!O,x(`[bridge:repl] Re-created session: ${B}`),await M(r,{sessionId:B,environmentId:L,source:`repl`}),C?.clear(),Z=0,!0):(x(`[bridge:repl] Session creation failed during reconnection`),!1)}function Se(){return d()}function De(){let e=X.end();if(e.length===0)return;if(!U){x(`[bridge:repl] Cannot drain ${e.length} pending message(s): no transport`);return}for(let t of e)V.add(t.uuid);let t=g(e).map(e=>({...e,session_id:B}));x(`[bridge:repl] Drained ${e.length} pending message(s) after flush`),U.writeBatch(t)}let Oe=null;function Ne(){Oe?.()}function Fe(e){if(Pe(`handleTransportPermanentClose: code=${e} transport=${U?`exists`:`null`} pollAborted=${H.signal.aborted}`),x(`[bridge:repl] Transport permanently closed: code=${e}`),j(`tengu_bridge_repl_ws_closed`,{code:e}),U){let e=U.getLastSequenceNum();e>G&&(G=e),U=null}Y();let t=X.drop();if(t>0&&x(`[bridge:repl] Dropping ${t} pending message(s) on transport close (code=${e})`,{level:`warn`}),e===1e3){D?.(`failed`,`session ended`),H.abort(),Ne();return}D?.(`reconnecting`,`Remote Control connection lost (code ${e})`),x(`[bridge:repl] Transport reconnect budget exhausted (code=${e}), attempting env reconnect`),ye().then(t=>{t||H.signal.aborted||(x(`[bridge:repl] reconnectEnvironmentWithSession resolved false — tearing down`),j(`tengu_bridge_repl_reconnect_failed`,{close_code:e}),D?.(`failed`,`reconnection failed`),Ne())})}et({api:F,getCredentials:()=>({environmentId:L,environmentSecret:R}),signal:H.signal,getPollIntervalConfig:v,onStateChange:D,getWsState:()=>U?.getStateLabel()??`null`,isAtCapacity:()=>U!==null,capacitySignal:ge,onFatalError:Ne,getHeartbeatInfo:()=>!q||!J?null:{environmentId:L,workId:q,sessionToken:J},onHeartbeatFatal:e=>{if(x(`[bridge:repl] heartbeatWork fatal (status=${e.status}) — tearing down work item for fast re-dispatch`),U){let e=U.getLastSequenceNum();e>G&&(G=e),U.close(),U=null}X.drop(),q&&F.stopWork(L,q,!1).catch(e=>{x(`[bridge:repl] stopWork after heartbeat fatal: ${y(e)}`)}),q=null,J=null,Y(),D?.(`reconnecting`,`Work item lease expired, fetching fresh token`)},async onEnvironmentLost(){return await ye()?{environmentId:L,environmentSecret:R}:null},onWorkReceived:(t,n,i,a)=>{if(U?.isConnectedStatus()&&x(`[bridge:repl] Work received while transport connected, replacing with fresh token (workId=${i})`),x(`[bridge:repl] Work received: workId=${i} workSessionId=${t} currentSessionId=${B} match=${Ve(t,B)}`),M(r,{sessionId:B,environmentId:L,source:`repl`}),!Ve(t,B)){x(`[bridge:repl] Rejecting foreign session: expected=${B} got=${t}`);return}q=i,J=n;let o=a||e(process.env.CLAUDE_BRIDGE_USE_CCR_V2),s;if(!o){if(s=Se(),!s){x(`[bridge:repl] No OAuth token available for session ingress, skipping work`);return}le(s)}if(j(`tengu_bridge_repl_work_received`,{}),U){let e=U;U=null;let t=e.getLastSequenceNum();t>G&&(G=t),e.close()}X.deactivate();let u=e=>xe(e,{transport:U,sessionId:B,onInterrupt:re,onSetModel:w,onSetMaxThinkingTokens:ie,onSetPermissionMode:E}),d=!1,f=e=>{U=e,e.setOnConnect(()=>{if(U===e){if(x(`[bridge:repl] Ingress transport connected`),j(`tengu_bridge_repl_ws_connected`,{}),!o){let e=Se();e&&le(e)}if(Re=!1,!d&&S&&S.length>0){d=!0;let t=b,n=S.filter(e=>ve(e)&&!C?.has(e.uuid)),r=t>0&&n.length>t?n.slice(-t):n;r.length<n.length&&(x(`[bridge:repl] Capped initial flush: ${n.length} -> ${r.length} (cap=${t})`),j(`tengu_bridge_repl_history_capped`,{eligible_count:n.length,capped_count:r.length}));let i=g(r);if(i.length>0){x(`[bridge:repl] Flushing ${i.length} initial message(s) via transport`);let t=i.map(e=>({...e,session_id:B})),n=e.droppedBatchCount;e.writeBatch(t).then(()=>{if(e.droppedBatchCount>n){x(`[bridge:repl] Initial flush dropped ${e.droppedBatchCount-n} batch(es) — not marking ${i.length} UUID(s) as flushed`);return}if(C)for(let e of i)e.uuid&&C.add(e.uuid)}).catch(e=>x(`[bridge:repl] Initial flush failed: ${e}`)).finally(()=>{U===e&&(De(),D?.(`connected`))})}else De(),D?.(`connected`)}else X.active||D?.(`connected`)}}),e.setOnData(e=>{try{let t=JSON.parse(e);Pe(`ingress: type=${t.type}${t.type===`control_request`?` subtype=${t.request?.subtype} request_id=${t.request_id}`:``}${t.type===`control_response`?` subtype=${t.response?.subtype} request_id=${t.response?.request_id}`:``}${t.type===`user`?` uuid=${t.uuid}`:``}${t.type===`keep_alive`?``:` len=${e.length}`}`)}catch{Pe(`ingress (non-JSON): ${String(e).slice(0,200)}`)}Te(e,V,me,te,ne,u)}),e.setOnClose(t=>{U===e&&(Pe(`transport onClose: code=${t} connected=${e.isConnectedStatus()} state=${e.getStateLabel()} seq=${e.getLastSequenceNum()}`),Fe(t))}),!d&&S&&S.length>0&&X.start(),e.connect()};if(W++,o){let e=We(c,t),r=W;x(`[bridge:repl] CCR v2: sessionUrl=${e} session=${t} gen=${r}`),Ae({sessionUrl:e,ingressToken:n,sessionId:t,initialSequenceNum:G}).then(e=>{if(H.signal.aborted){e.close();return}if(r!==W){x(`[bridge:repl] CCR v2: discarding stale handshake gen=${r} current=${W}`),e.close();return}f(e)},e=>{x(`[bridge:repl] CCR v2: createV2ReplTransport failed: ${y(e)}`,{level:`error`}),j(`tengu_bridge_repl_ccr_v2_init_failed`,{}),r===W&&(q&&(F.stopWork(L,q,!1).catch(e=>{x(`[bridge:repl] stopWork after v2 init failure: ${y(e)}`)}),q=null,J=null),Y())})}else{let e=He(l,t);x(`[bridge:repl] Ingress URL: ${e}`),x(`[bridge:repl] Creating HybridTransport: session=${t}`);let n=s??``;f(ke(new Ke(new URL(e),{Authorization:`Bearer ${n}`,"anthropic-version":`2023-06-01`},t,()=>({Authorization:`Bearer ${Se()??n}`,"anthropic-version":`2023-06-01`}),{maxConsecutiveFailures:50,isBridge:!0,onBatchDropped:()=>{D?.(`reconnecting`,`Lost sync with Remote Control — events could not be delivered`),Y()}})))}}});let Ie=k?setInterval(()=>{Q||M(r,{sessionId:B,environmentId:L,source:`repl`})},60*6e4):null;Ie?.unref?.();let Le=v().session_keepalive_interval_v2_ms,$=Le>0?setInterval(()=>{U&&(x(`[bridge:repl] keep_alive sent`),U.write({type:`keep_alive`}).catch(e=>{x(`[bridge:repl] keep_alive write failed: ${y(e)}`)}))},Le):null;$?.unref?.();let Re=!1;Oe=async()=>{if(Re){x(`[bridge:repl] Teardown already in progress, skipping duplicate call env=${L} session=${B}`);return}Re=!0;let e=Date.now();if(x(`[bridge:repl] Teardown starting: env=${L} session=${B} workId=${q??`none`} transportState=${U?.getStateLabel()??`null`}`),Ie!==null&&clearInterval(Ie),$!==null&&clearInterval($),H.abort(),x(`[bridge:repl] Teardown: poll loop aborted`),U){let e=U.getLastSequenceNum();e>G&&(G=e)}if(k){U=null,X.drop(),await M(r,{sessionId:B,environmentId:L,source:`repl`}),x(`[bridge:repl] Teardown (perpetual): leaving env=${L} session=${B} alive on server, duration=${Date.now()-e}ms`);return}let t=U;if(U=null,X.drop(),t){let e={...we(B),session_id:B};t.write(e)}let n=q?F.stopWork(L,q,!0).then(()=>{x(`[bridge:repl] Teardown: stopWork completed`)}).catch(e=>{x(`[bridge:repl] Teardown stopWork failed: ${y(e)}`)}):Promise.resolve();await Promise.all([n,p(B)]),t?.close(),x(`[bridge:repl] Teardown: transport closed`),await F.deregisterEnvironment(L).catch(e=>{x(`[bridge:repl] Teardown deregister failed: ${y(e)}`)}),await N(r),x(`[bridge:repl] Teardown complete: env=${L} duration=${Date.now()-e}ms`)};let Ue=ee(()=>Oe?.());return x(`[bridge:repl] Ready: env=${L} session=${B}`),D?.(`ready`),{get bridgeSessionId(){return B},get environmentId(){return L},getSSESequenceNum(){let e=U?.getLastSequenceNum()??0;return Math.max(G,e)},sessionIngressUrl:l,writeMessages(e){let t=e.filter(e=>ve(e)&&!pe.has(e.uuid)&&!V.has(e.uuid));if(t.length===0)return;if(!_e)for(let e of t){let t=Ce(e);if(t!==void 0&&O?.(t,B)){_e=!0;break}}if(X.enqueue(...t)){x(`[bridge:repl] Queued ${t.length} message(s) during initial flush`);return}if(!U){let e=t.map(e=>e.type).join(`,`);x(`[bridge:repl] Transport not configured, dropping ${t.length} message(s) [${e}] for session=${B}`,{level:`warn`});return}for(let e of t)V.add(e.uuid);x(`[bridge:repl] Sending ${t.length} message(s) via transport`);let n=g(t).map(e=>({...e,session_id:B}));U.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!V.has(e.uuid));if(t.length===0)return;if(!U){x(`[bridge:repl] Transport not configured, dropping ${t.length} SDK message(s) for session=${B}`,{level:`warn`});return}for(let e of t)e.uuid&&V.add(e.uuid);let n=t.map(e=>({...e,session_id:B}));U.writeBatch(n)},sendControlRequest(e){if(!U){x(`[bridge:repl] Transport not configured, skipping control_request`);return}let t={...e,session_id:B};U.write(t),x(`[bridge:repl] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(!U){x(`[bridge:repl] Transport not configured, skipping control_response`);return}let t={...e,session_id:B};U.write(t),x(`[bridge:repl] Sent control_response`)},sendControlCancelRequest(e){if(!U){x(`[bridge:repl] Transport not configured, skipping control_cancel_request`);return}let t={type:`control_cancel_request`,request_id:e,session_id:B};U.write(t),x(`[bridge:repl] Sent control_cancel_request request_id=${e}`)},sendResult(){if(!U){x(`[bridge:repl] sendResult: skipping, transport not configured session=${B}`);return}U.reportState(`idle`);let e={...we(B),session_id:B};U.write(e),x(`[bridge:repl] Sent result for session=${B}`)},async teardown(){Ue(),await Oe?.(),x(`[bridge:repl] Torn down`),j(`tengu_bridge_repl_teardown`,{})}}}async function et({api:e,getCredentials:t,signal:n,onStateChange:r,onWorkReceived:i,onEnvironmentLost:a,getWsState:o,isAtCapacity:s,capacitySignal:c,onFatalError:l,getPollIntervalConfig:u=()=>Me,getHeartbeatInfo:d,onHeartbeatFatal:f}){x(`[bridge:repl] Starting work poll loop for env=${t().environmentId}`);let p=0,m=null,h=null,g=0,_=!1;for(;!n.aborted;){let{environmentId:v,environmentSecret:b}=t(),S=u();try{let t=await e.pollForWork(v,b,n,S.reclaim_older_than_ms);if(g=0,p>0&&(x(`[bridge:repl] Poll recovered after ${p} consecutive error(s)`),p=0,m=null,h=null,r?.(`ready`)),!t){let t=_;if(_=!1,s?.()&&c&&!t){let t=S.poll_interval_ms_at_capacity;if(S.non_exclusive_heartbeat_interval_ms>0&&d){j(`tengu_bridge_heartbeat_mode_entered`,{heartbeat_interval_ms:S.non_exclusive_heartbeat_interval_ms});let r=t>0?Date.now()+t:null,i=!1,a=0;for(;!n.aborted&&s()&&(r===null||Date.now()<r);){let t=u();if(t.non_exclusive_heartbeat_interval_ms<=0)break;let n=d();if(!n)break;let r=c();try{await e.heartbeatWork(n.environmentId,n.workId,n.sessionToken)}catch(e){if(x(`[bridge:repl:heartbeat] Failed: ${y(e)}`),e instanceof $){r.cleanup(),j(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),f?(f(e),x(`[bridge:repl:heartbeat] Fatal (status=${e.status}), work state cleared — fast-polling for re-dispatch`)):i=!0;break}}a++,await I(t.non_exclusive_heartbeat_interval_ms,r.signal),r.cleanup()}let o=i?`error`:n.aborted?`shutdown`:s()?r!==null&&Date.now()>=r?`poll_due`:`config_disabled`:`capacity_changed`;if(j(`tengu_bridge_heartbeat_mode_exited`,{reason:o,heartbeat_cycles:a}),!i){o===`poll_due`&&x(`[bridge:repl] Heartbeat poll_due after ${a} cycles — falling through to pollForWork`);continue}}let r=t>0?t:S.non_exclusive_heartbeat_interval_ms;if(r>0){let e=c(),t=Date.now();await I(r,e.signal),e.cleanup();let n=Date.now()-t-r;n>6e4&&(x(`[bridge:repl] At-capacity sleep overran by ${Math.round(n/1e3)}s — process suspension detected, forcing one fast-poll cycle`),j(`tengu_bridge_repl_suspension_detected`,{overrun_ms:n}),_=!0)}}else await I(S.poll_interval_ms_not_at_capacity,n);continue}let a;try{a=Ue(t.secret)}catch(n){x(`[bridge:repl] Failed to decode work secret: ${y(n)}`),j(`tengu_bridge_repl_work_secret_failed`,{}),await e.stopWork(v,t.id,!1).catch(()=>{});continue}x(`[bridge:repl] Acknowledging workId=${t.id}`);try{await e.acknowledgeWork(v,t.id,a.session_ingress_token)}catch(e){x(`[bridge:repl] Acknowledge failed workId=${t.id}: ${y(e)}`)}if(t.data.type===`healthcheck`){x(`[bridge:repl] Healthcheck received`);continue}if(t.data.type===`session`){let e=t.data.id;try{Re(e,`session_id`)}catch{x(`[bridge:repl] Invalid session_id in work: ${e}`);continue}i(e,a.session_ingress_token,t.id,a.use_code_sessions===!0),x(`[bridge:repl] Work accepted, continuing poll loop`)}}catch(i){if(n.aborted)break;if(i instanceof $&&i.status===404&&a){let e=t().environmentId;if(v!==e){x(`[bridge:repl] Stale poll error for old env=${v}, current env=${e} — skipping onEnvironmentLost`),p=0,m=null;continue}if(g++,x(`[bridge:repl] Environment deleted, attempting re-registration (attempt ${g}/3)`),j(`tengu_bridge_repl_env_lost`,{attempt:g}),g>3){x(`[bridge:repl] Environment re-registration limit reached (3), giving up`),r?.(`failed`,`Environment deleted and re-registration limit reached`),l?.();break}r?.(`reconnecting`,`environment lost, recreating session`);let i=await a();if(n.aborted)break;if(i){p=0,m=null,r?.(`ready`),x(`[bridge:repl] Re-registered environment: ${i.environmentId}`);continue}r?.(`failed`,`Environment deleted and re-registration failed`),l?.();break}if(i instanceof $){let e=Le(i.errorType),t=Ie(i);x(`[bridge:repl] Fatal poll error: ${i.message} (status=${i.status}, type=${i.errorType??`unknown`})${t?` (suppressed)`:``}`),j(`tengu_bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),T(e?`info`:`error`,`bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),t||r?.(`failed`,e?`session expired · /remote-control to reconnect`:i.message),l?.();break}let s=Date.now();h!==null&&s-h>6e4*2&&(x(`[bridge:repl] Detected system sleep (${Math.round((s-h)/1e3)}s gap), resetting poll error budget`),T(`info`,`bridge_repl_poll_sleep_detected`,{gapMs:s-h}),p=0,m=null),h=s,p++,m===null&&(m=s);let c=s-m,f=U(i),_=G(i),y=o?.()??`unknown`;if(x(`[bridge:repl] Poll error (attempt ${p}, elapsed ${Math.round(c/1e3)}s, ws=${y}): ${_}`),j(`tengu_bridge_repl_poll_error`,{status:f,consecutiveErrors:p,elapsedMs:c}),p===1&&r?.(`reconnecting`,_),c>=9e5){x(`[bridge:repl] Poll failures exceeded ${Ze/1e3}s (${p} errors), giving up`),T(`info`,`bridge_repl_poll_give_up`),j(`tengu_bridge_repl_poll_give_up`,{consecutiveErrors:p,elapsedMs:c,lastStatus:f}),r?.(`failed`,`connection to server lost`);break}let b=Math.min(Ye*2**(p-1),Xe);if(u().non_exclusive_heartbeat_interval_ms>0){let t=d?.();if(t)try{await e.heartbeatWork(t.environmentId,t.workId,t.sessionToken)}catch{}}await I(b,n)}}x(`[bridge:repl] Work poll loop ended (aborted=${n.aborted}) env=${t().environmentId}`)}S(),b(),W(),z();async function tt(e){let{onInboundMessage:t,onPermissionResponse:n,onInterrupt:i,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:f,onStateChange:p,initialMessages:h,getMessages:g,previouslyFlushedUUIDs:b,initialName:S,perpetual:ee,outboundOnly:C,tags:ne}=e??{};if(fe(ye),!await De())return K(`not_enabled`,`[bridge:repl] Skipping: bridge not enabled`),null;if(!H())return K(`no_oauth`,`[bridge:repl] Skipping: no OAuth tokens`),p?.(`failed`,`authentication required`),null;if(await u(),!o(`allow_remote_control`))return K(`policy_denied`,`[bridge:repl] Skipping: allow_remote_control policy not allowed`),p?.(`failed`,`disabled by your organization's policy`),null;if(!pe()){let e=te();if(e.bridgeOauthDeadExpiresAt!=null&&(e.bridgeOauthDeadFailCount??0)>=3&&se()?.expiresAt===e.bridgeOauthDeadExpiresAt)return x(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${e.bridgeOauthDeadFailCount} times)`),null;await P();let t=se();if(t&&t.expiresAt!==null&&t.expiresAt<=Date.now()){K(`oauth_expired_unrefreshable`,`[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)`),p?.(`failed`,`authentication required`);let e=t.expiresAt;return re(t=>({...t,bridgeOauthDeadExpiresAt:e,bridgeOauthDeadFailCount:t.bridgeOauthDeadExpiresAt===e?(t.bridgeOauthDeadFailCount??0)+1:1})),null}}let w=V(),T=`remote-control-${d()}`,E=!1,O=!1;if(S)T=S,E=!0,O=!0;else{let e=v(),t=e?m(e):void 0;if(t)T=t,E=!0,O=!0;else if(h&&h.length>0)for(let e=h.length-1;e>=0;e--){let t=h[e];if(t.type!==`user`||t.isMeta||t.toolUseResult||t.isCompactSummary||t.origin&&t.origin.kind!==`human`||a(t))continue;let n=r(t.message.content);if(!n)continue;let i=rt(n);if(i){T=i,E=!0;break}}}let k=0,A,j=0,N=(e,t,n)=>{E=!0,T=e,x(`[bridge:repl] derived title from message ${n}: ${e}`),q(t,e,{baseUrl:w,getAccessToken:H}).catch(()=>{})},oe=(e,t)=>{let n=++j,r=k;_e(e,AbortSignal.timeout(15e3)).then(e=>{e&&n===j&&A===t&&!m(v())&&N(e,t,r)})},F=(e,t)=>{if(O||m(v()))return!0;if(A!==void 0&&A!==t&&(k=0),A=t,k++,k===1&&!E){let n=rt(e);n&&N(n,t,k),oe(e,t)}else if(k===3){let n=g?.(),r=n?Q(l(n)):e;oe(r,t)}return k>=3},I=me()?`self-hosted`:await M();if(!I)return K(`no_org_uuid`,`[bridge:repl] Skipping: no org UUID`),p?.(`failed`,`/login`),null;if(be()&&!ee){let e=await Oe();if(e)return K(`version_too_old`,`[bridge:repl] Skipping: ${e}`,!0),p?.(`failed`,"run `claude update` to upgrade"),null;x(`[bridge:repl] Using env-less bridge path (tengu_bridge_repl_v2)`);let{initEnvLessBridgeCore:r}=await import(`./remoteBridgeCore-DAK9KSWp.js`);return r({baseUrl:w,orgUUID:I,title:T,getAccessToken:H,onAuth401:ae,toSDKMessages:X,initialHistoryCap:200,initialMessages:h,onInboundMessage:t,onUserMessage:F,onPermissionResponse:n,onInterrupt:i,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:f,onStateChange:p,outboundOnly:C,tags:ne})}let L=Se();if(L)return K(`version_too_old`,`[bridge:repl] Skipping: ${L}`),p?.(`failed`,"run `claude update` to upgrade"),null;let ce=await ie(),R=await D(),le=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||w;return $e({dir:_(),machineName:qe(),branch:ce,gitRepoUrl:R,title:T,baseUrl:w,sessionIngressUrl:le,workerType:`claude_code`,getAccessToken:H,createSession:e=>he({...e,events:[],baseUrl:w,getAccessToken:H}),archiveSession:e=>Y(e,{baseUrl:w,getAccessToken:H,timeoutMs:1500}).catch(e=>{x(`[bridge:repl] archiveBridgeSession threw: ${y(e)}`,{level:`error`})}),getCurrentTitle:()=>m(v())??T,onUserMessage:F,toSDKMessages:X,onAuth401:ae,getPollIntervalConfig:Ne,initialHistoryCap:200,initialMessages:h,previouslyFlushedUUIDs:b,onInboundMessage:t,onPermissionResponse:n,onInterrupt:i,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:f,onStateChange:p,perpetual:ee})}var nt=50;function rt(e){let t=O(e),n=(/^(.*?[.!?])\s/.exec(t)?.[1]??t).replace(/\s+/g,` `).trim();if(n)return n.length>nt?`${n.slice(0,nt-1)}\u2026`:n}export{tt as initReplBridge};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kn as i,s as a,t as o}from"./src-DL3w8VPk2.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{P as c,R as l,c as u,i as d}from"./debug-D7OBvqC2.js";import{Kt as f,Yt as p,g as m,n as h,x as g}from"./settings-DUyIag_5.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{a as y,n as b,r as x,s as S,t as C}from"./nativeInstaller-C6aWHxve.js";import{join as w}from"node:path";import{homedir as T}from"node:os";var E=e(r(),1);_(),o(),d(),p(),l(),C(),m();var D=s();function O(){let e=f.platform===`win32`,t=T();return e?w(t,`.local`,`bin`,`claude.exe`).replace(/\//g,`\\`):`~/.local/bin/claude`}function k({messages:e}){return e.length===0?null:(0,D.jsxs)(t,{flexDirection:`column`,gap:0,marginBottom:1,children:[(0,D.jsx)(t,{children:(0,D.jsxs)(n,{color:`warning`,children:[(0,D.jsx)(a,{status:`warning`,withSpace:!0}),`Setup notes:`]})}),e.map((e,r)=>(0,D.jsx)(t,{marginLeft:2,children:(0,D.jsxs)(n,{dimColor:!0,children:[`• `,e]})},r))]})}function A({onDone:e,force:r,target:i}){let[o,s]=(0,E.useState)({type:`checking`});return(0,E.useEffect)(()=>{async function e(){try{u(`Install: Starting installation process (force=${r}, target=${i})`);let e=i||h()?.autoUpdatesChannel||`latest`;s({type:`installing`,version:e}),u(`Install: Calling installLatest(channelOrVersion=${e}, forceReinstall=${r})`);let t=await S(e,r);if(u(`Install: installLatest returned version=${t.latestVersion}, wasUpdated=${t.wasUpdated}, lockFailed=${t.lockFailed}`),t.lockFailed)throw Error(`Could not install - another process is currently installing Work Mate. Please try again in a moment.`);t.latestVersion||u(`Install: Failed to retrieve version information during install`,{level:`error`}),t.wasUpdated||u(`Install: Already up to date`),s({type:`setting-up`});let n=await b(!0);u(`Install: Setup launcher completed with ${n.length} messages`),n.length>0&&n.forEach(e=>u(`Install: Setup message: ${e.message}`)),u(`Install: Cleaning up npm installations after successful install`);let{removed:a,errors:o,warnings:c}=await x();a>0&&u(`Cleaned up ${a} npm installation(s)`),o.length>0&&u(`Cleanup errors: ${o.join(`, `)}`);let l=await y();l.length>0&&u(`Shell alias cleanup: ${l.map(e=>e.message).join(`; `)}`),v(`tengu_claude_install_command`,{has_version:+!!t.latestVersion,forced:+!!r}),(i===`latest`||i===`stable`)&&(g(`userSettings`,{autoUpdatesChannel:i}),u(`Install: Saved autoUpdatesChannel=${i} to user settings`));let d=[...c,...l.map(e=>e.message)];n.length>0?(s({type:`set-up`,messages:n.map(e=>e.message)}),setTimeout(s,2e3,{type:`success`,version:t.latestVersion||`current`,setupMessages:[...n.map(e=>e.message),...d]})):(u(`Install: Shell PATH already configured`),s({type:`success`,version:t.latestVersion||`current`,setupMessages:d.length>0?d:void 0}))}catch(e){u(`Install command failed: ${e}`,{level:`error`}),s({type:`error`,message:c(e)})}}e()},[r,i]),(0,E.useEffect)(()=>{o.type===`success`?setTimeout(e,2e3,`Work Mate installation completed successfully`,{display:`system`}):o.type===`error`&&setTimeout(e,3e3,`Work Mate installation failed`,{display:`system`})},[o,e]),(0,D.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[o.type===`checking`&&(0,D.jsx)(n,{color:`claude`,children:`Checking installation status...`}),o.type===`cleaning-npm`&&(0,D.jsx)(n,{color:`warning`,children:`Cleaning up old npm installations...`}),o.type===`installing`&&(0,D.jsxs)(n,{color:`claude`,children:[`Installing Work Mate native build `,o.version,`...`]}),o.type===`setting-up`&&(0,D.jsx)(n,{color:`claude`,children:`Setting up launcher and shell integration...`}),o.type===`set-up`&&(0,D.jsx)(k,{messages:o.messages}),o.type===`success`&&(0,D.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,D.jsxs)(t,{children:[(0,D.jsx)(a,{status:`success`,withSpace:!0}),(0,D.jsx)(n,{color:`success`,bold:!0,children:`Work Mate successfully installed!`})]}),(0,D.jsxs)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:[o.version!==`current`&&(0,D.jsxs)(t,{children:[(0,D.jsx)(n,{dimColor:!0,children:`Version: `}),(0,D.jsx)(n,{color:`claude`,children:o.version})]}),(0,D.jsxs)(t,{children:[(0,D.jsx)(n,{dimColor:!0,children:`Location: `}),(0,D.jsx)(n,{color:`text`,children:O()})]})]}),(0,D.jsx)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:(0,D.jsxs)(t,{marginTop:1,children:[(0,D.jsx)(n,{dimColor:!0,children:`Next: Run `}),(0,D.jsx)(n,{color:`claude`,bold:!0,children:`claude --help`}),(0,D.jsx)(n,{dimColor:!0,children:` to get started`})]})}),o.setupMessages&&(0,D.jsx)(k,{messages:o.setupMessages})]}),o.type===`error`&&(0,D.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,D.jsxs)(t,{children:[(0,D.jsx)(a,{status:`error`,withSpace:!0}),(0,D.jsx)(n,{color:`error`,children:`Installation failed`})]}),(0,D.jsx)(n,{color:`error`,children:o.message}),(0,D.jsx)(t,{marginTop:1,children:(0,D.jsx)(n,{dimColor:!0,children:`Try running with --force to override checks`})})]})]})}var j={type:`local-jsx`,name:`install`,description:`安装 Work Mate 原生构建`,argumentHint:`[options]`,async call(e,t,n){let r=n.includes(`--force`),a=n.filter(e=>!e.startsWith(`--`))[0],{unmount:o}=await i((0,D.jsx)(A,{onDone:(t,n)=>{o(),e(t,n)},force:r,target:a}))}};export{j as install};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{FT as t,HT as n,IT as r,PT as i,UT as a,VT as o,WT as s,zT as c}from"./loadAgentsDir-DnsldjYU.js";import{C as l,F as u,R as d,x as f}from"./debug-D7OBvqC2.js";import{r as p,t as m}from"./promptEditor-C6w1vT5E.js";import{dirname as h}from"path";import{mkdir as g,writeFile as _}from"fs/promises";function v(e){let t=new Set(c.map(e=>n(e.key)));return e.map(e=>{let r={};for(let[i,a]of Object.entries(e.bindings))t.has(n(i))||(r[i]=a);return{context:e.context,bindings:r}}).filter(e=>Object.keys(e.bindings).length>0)}function y(){return`${l({$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.workmate.com/docs/en/keybindings`,bindings:v(a)},null,2)}\n`}var b=e((()=>{f(),s(),o()}));async function x(){if(!r())return{type:`text`,value:`Keybinding customization is not enabled. This feature is currently in preview.`};let e=i(),t=!1;await g(h(e),{recursive:!0});try{await _(e,y(),{encoding:`utf-8`,flag:`wx`})}catch(e){if(u(e)===`EEXIST`)t=!0;else throw e}let n=await m(e);return n.error?{type:`text`,value:`${t?`Opened`:`Created`} ${e}. Could not open in editor: ${n.error}`}:{type:`text`,value:t?`Opened ${e} in your editor.`:`Created ${e} with template. Opened in your editor.`}}e((()=>{t(),b(),d(),p()}))();export{x as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./loadAgentsDir-DnsldjYU.js";e();export{t as clearAgentDefinitionsCache};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,o as t,s as n,t as r}from"./localSearch-nuNjYVKq.js";t();export{r as clearSkillIndexCache,e as getSkillIndex,n as searchSkills};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{c as r,f as i,g as a,ln as o,un as s}from"./settings-DUyIag_5.js";import{c,h as l}from"./config-BybjRr09.js";import{d as u,g as d,h as f,l as p,n as m,t as h,v as g}from"./proxy-DFIxRT0i.js";import{n as _,t as v}from"./loader-C-PQ3onD.js";import{n as y,t as b}from"./syncCache-BiqQEess.js";import{n as x,r as S,t as C}from"./managedEnvConstants-BPwL2aWI.js";function w(e){if(!e||!process.env.ANTHROPIC_UNIX_SOCKET)return e||{};let{ANTHROPIC_UNIX_SOCKET:t,ANTHROPIC_BASE_URL:n,ANTHROPIC_API_KEY:r,ANTHROPIC_AUTH_TOKEN:i,CLAUDE_CODE_OAUTH_TOKEN:a,...o}=e;return o}function T(e){if(!e)return{};if(!t(process.env.CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST))return e;let n={};for(let[t,r]of Object.entries(e))S(t)||(n[t]=r);return n}function E(e){if(!e||!j)return e||{};let t={};for(let[n,r]of Object.entries(e))j.has(n)||(t[n]=r);return t}function D(e){if(!e)return{};let t=r(`userSettings`)?.activeProviderId;if(!t||!v(t))return e;let n={};for(let[t,r]of Object.entries(e))M.has(t.toUpperCase())||(n[t]=r);return n}function O(e){return E(T(D(w(e))))}function k(){j===void 0&&(j=process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`?new Set(Object.keys(process.env)):null),Object.assign(process.env,O(c().env));for(let e of N)e!==`policySettings`&&s(e)&&Object.assign(process.env,O(r(e)?.env));y(),Object.assign(process.env,O(r(`policySettings`)?.env));let e=O(i()?.env);for(let[t,n]of Object.entries(e))C.has(t.toUpperCase())&&(process.env[t]=n)}function A(){Object.assign(process.env,O(c().env)),Object.assign(process.env,O(i()?.env)),d(),u(),h(),m()}var j,M,N,P=e((()=>{_(),b(),g(),l(),n(),x(),f(),p(),o(),a(),M=new Set([`ANTHROPIC_BASE_URL`,`ANTHROPIC_API_KEY`,`ANTHROPIC_MODEL`,`CLAUDE_CODE_USE_OPENAI`,`OPENAI_BASE_URL`,`OPENAI_API_KEY`,`OPENAI_MODEL`]),N=[`userSettings`,`flagSettings`,`policySettings`]}));export{k as n,P as r,A as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./managedEnv-C7bVtcgA.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Cx as i,Dp as a,Jb as o,Mu as s,Op as c,Pu as l,Qh as u,Qu as d,Ub as f,Wb as p,Xh as m,Yb as h,Zh as g,Zu as _,bx as v,dx as y,hC as b,vx as ee}from"./loadAgentsDir-DnsldjYU.js";import{D as x,Gt as te,H as S,I as C,Lt as w,P as T,T as E,Wt as D,ai as O,j as k,t as A,y as j}from"./src-DL3w8VPk2.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{a as ne,i as re}from"./debug-D7OBvqC2.js";import{l as ie,n as ae,o as N}from"./stringUtils-CGZoOfer.js";import{C as oe,S as se}from"./sessionState-B3tFm9SC.js";import{i as ce,n as P,r as le}from"./MCPConnectionManager-Cer1UawR.js";import{n as ue,t as de}from"./McpParsingWarnings-Cr_n2QR6.js";import{a as fe,c as F,i as I,n as L,o as R,r as pe,s as me,t as he}from"./MCPToolListView-DndNWDr1.js";function ge({agentServer:e,onCancel:t,onComplete:n}){let[i]=S(),[o,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),[p,m]=(0,z.useState)(null),g=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>g.current?.abort(),[]),D(`confirm:no`,(0,z.useCallback)(()=>{o&&(g.current?.abort(),g.current=null,c(!1),m(null))},[o]),{context:`Confirmation`,isActive:o});let _=(0,z.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;c(!0),u(null);let t=new AbortController;g.current=t;try{let r={type:e.transport,url:e.url};await h(e.name,r,m,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof f)&&u(e.message)}finally{c(!1),g.current=null}},[e,n]),v=ae(String(e.name));if(o)return(0,B.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,B.jsxs)(T,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,B.jsxs)(C,{children:[(0,B.jsx)(s,{}),(0,B.jsx)(T,{children:` A browser window will open for authentication`})]}),p&&(0,B.jsxs)(C,{flexDirection:`column`,children:[(0,B.jsx)(T,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,B.jsx)(w,{url:p})]}),(0,B.jsx)(C,{marginLeft:3,children:(0,B.jsxs)(T,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,B.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let y=[];return e.needsAuth&&y.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),y.push({label:`Back`,value:`back`}),(0,B.jsxs)(j,{title:`${v} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,B.jsxs)(T,{children:[`Press `,e.keyName,` again to exit`]}):(0,B.jsxs)(E,{children:[(0,B.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,B.jsx)(x,{shortcut:`Enter`,action:`confirm`}),(0,B.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,B.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Type: `}),(0,B.jsx)(T,{dimColor:!0,children:e.transport})]}),e.url&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`URL: `}),(0,B.jsx)(T,{dimColor:!0,children:e.url})]}),e.command&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Command: `}),(0,B.jsx)(T,{dimColor:!0,children:e.command})]}),(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Used by: `}),(0,B.jsx)(T,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,B.jsxs)(C,{marginTop:1,children:[(0,B.jsx)(T,{bold:!0,children:`Status: `}),(0,B.jsxs)(T,{children:[k(`inactive`,i)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,B.jsxs)(T,{children:[k(`success`,i)(r.tick),` authenticated`]}):(0,B.jsxs)(T,{children:[k(`warning`,i)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,B.jsx)(C,{children:(0,B.jsx)(T,{dimColor:!0,children:`This server connects only when running the agent.`})}),l&&(0,B.jsx)(C,{children:(0,B.jsxs)(T,{color:`error`,children:[`Error: `,l]})}),(0,B.jsx)(C,{children:(0,B.jsx)(d,{options:y,onChange:async e=>{switch(e){case`auth`:await _();break;case`back`:t();break}},onCancel:t})})]})}var z,B,_e=e((()=>{n(),z=t(O(),1),A(),b(),o(),N(),c(),_(),l(),B=M()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:y(e)};case`user`:return{label:`User MCPs`,path:y(e)};case`local`:return{label:`Local MCPs`,path:y(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function ve(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function ye({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:i,onComplete:o}){let[s]=S(),[c,l]=(0,H.useState)(0),u=H.useMemo(()=>ve(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),d=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),f=H.useMemo(()=>(u.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[u]),p=V(`dynamic`),m=H.useMemo(()=>{let e=[];for(let t of W){let n=u.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of d)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of f)e.push({type:`server`,server:t});return e},[u,d,t,f]),h=(0,H.useCallback)(()=>{o(`MCP dialog dismissed`,{display:`system`})},[o]);te({"confirm:previous":()=>l(e=>e===0?m.length-1:e-1),"confirm:next":()=>l(e=>e===m.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=m[c];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&i&&i(e.agentServer))},[m,c,n,i]),"confirm:no":h},{context:`Confirmation`});let g=e=>m.findIndex(t=>t.type===`server`&&t.server===e),_=e=>m.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),v=ne(),y=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let b=e=>{let t=g(e),n=c===t,i=``,a=``;if(e.client.type===`disabled`)i=k(`inactive`,s)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=k(`success`,s)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=k(`inactive`,s)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=k(`warning`,s)(r.triangleUpOutline),a=`needs authentication`):(i=k(`error`,s)(r.cross),a=`failed`);return(0,U.jsxs)(C,{children:[(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(T,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(T,{dimColor:!n,children:a})]},`${e.name}-${t}`)},ee=e=>{let t=_(e),n=c===t,i=e.needsAuth?k(`warning`,s)(r.triangleUpOutline):k(`inactive`,s)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(C,{children:[(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(T,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(T,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},D=e.length+t.length;return(0,U.jsxs)(C,{flexDirection:`column`,children:[(0,U.jsx)(de,{}),(0,U.jsx)(j,{title:`Manage MCP servers`,subtitle:`${D} ${ie(D,`server`)}`,onCancel:h,hideInputGuide:!0,children:(0,U.jsxs)(C,{flexDirection:`column`,children:[W.map(e=>{let t=u.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(C,{paddingLeft:2,children:[(0,U.jsx)(T,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(T,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>b(e))]},e)}),d.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsx)(T,{bold:!0,children:`claude.ai`})}),d.map(e=>b(e))]}),t.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsx)(T,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsxs)(T,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>ee(e))]},e))]}),f.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(C,{paddingLeft:2,children:[(0,U.jsx)(T,{bold:!0,children:p.label}),p.path&&(0,U.jsxs)(T,{dimColor:!0,children:[` (`,p.path,`)`]})]}),f.map(e=>b(e))]}),(0,U.jsxs)(C,{flexDirection:`column`,children:[y&&(0,U.jsx)(T,{dimColor:!0,children:v?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(T,{dimColor:!0,children:[(0,U.jsx)(w,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(C,{paddingX:1,children:(0,U.jsx)(T,{dimColor:!0,italic:!0,children:(0,U.jsxs)(E,{children:[(0,U.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(x,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(O(),1),A(),b(),i(),re(),N(),c(),ue(),U=M(),W=[`project`,`local`,`user`,`enterprise`]}));function be({serverName:e,onComplete:t}){let[n]=S(),i=u(),a=le(),[o,c]=(0,K.useState)(!0),[l,d]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){d(`MCP server "${e}" not found`),c(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:c(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:d(`${e} requires authentication`),c(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:d(`Failed to reconnect to ${e}`),c(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);d(n),c(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),o?(0,q.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(T,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(T,{bold:!0,children:e})]}),(0,q.jsxs)(C,{children:[(0,q.jsx)(s,{}),(0,q.jsx)(T,{children:` Establishing connection to MCP server`})]})]}):l?(0,q.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(C,{children:[(0,q.jsxs)(T,{children:[k(`error`,n)(r.cross),` `]}),(0,q.jsxs)(T,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(T,{dimColor:!0,children:[`Error: `,l]})]}):null}var K,q,J=e((()=>{n(),K=t(O(),1),A(),P(),m(),l(),q=M()}));function Y({onComplete:e}){let t=g(e=>e.mcp),n=g(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>ee(n.allAgents),[n.allAgents]),l=X.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(X.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;if(r||i){let n=await new p(e.name,e.config).tokens(),r=se()!==null&&e.type===`connected`,i=e.type===`connected`&&v(t.tools,e.name).length>0;o=!!n||r||i}let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.workmate.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(ye,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=v(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(0,Z.jsx)(fe,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(me,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(he,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=v(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(pe,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(ge,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,xe=e((()=>{X=t(O(),1),o(),i(),m(),oe(),_e(),G(),F(),R(),I(),L(),Z=M()})),Se=e((()=>{_e(),G(),J(),F(),xe(),R(),I(),L()}));function Ce({action:e,target:t,onComplete:n}){let r=g(e=>e.mcp.clients),i=ce(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function we(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(be,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Ce,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(O(),1),Se(),J(),P(),m(),$=M()}))();export{we as call};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$y as e,AS as t,B as n,BS as r,B_ as i,Bb as a,Bl as o,CS as s,DS as c,ES as l,FC as u,FS as d,IS as f,JS as p,KS as m,Kc as h,LS as ee,La as te,MS as ne,NS as g,OS as _,PC as v,PS as y,Qs as b,Qy as x,RS as S,SS as C,TS as w,US as T,V as E,Vl as D,WS as O,XS as k,YS as A,Zs as j,_S as M,bS as N,gS as P,hS as F,mS as re,ma as I,pS as L,qS as R,qc as z,vS as B,wS as V,xS as H,yS as U,zS as W,z_ as G,zb as K}from"./loadAgentsDir-DnsldjYU.js";import{C as q,x as J}from"./debug-D7OBvqC2.js";import{o as Y,s as X}from"./log-CR0v5KUR.js";import{_ as ie,u as ae}from"./model-xI2MbgRj.js";import{_n as oe,vn as Z,yn as se}from"./prompt-CzQkcxfg.js";import Q from"node:process";p(),C(),N(),m();var ce=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},l,t)}elicitInputStream(e,n){let r=this._server.getClientCapabilities(),i=e.mode??`form`;switch(i){case`url`:if(!r?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!r?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let a=i===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:a},t,n)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};m(),B();var le=class extends H{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(W.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new U,this.setRequestHandler(y,e=>this._oninitialize(e)),this.setNotificationHandler(d,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(O,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=W.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ce(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=s(this._capabilities,e)}setRequestHandler(e,t){let n=R(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let i;if(A(n)){let e=n;i=e._zod?.def?.value??e.value}else{let e=n;i=e._def?.value??e.value}if(typeof i!=`string`)throw Error(`Schema method literal must be a string`);return i===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let i=k(V,e);if(!i.success){let e=i.error instanceof Error?i.error.message:String(i.error);throw new r(g.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=i.data,o=await Promise.resolve(t(e,n));if(a.task){let e=k(_,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new r(g.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=k(w,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new r(g.InvalidParams,`Invalid tools/call result: ${e}`)}return s.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){P(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&M(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:T.includes(t)?t:f,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},ne)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},c,t):this.request({method:`sampling/createMessage`,params:e},l,t)}async elicitInput(e,n){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let r=e;return this.request({method:`elicitation/create`,params:r},t,n)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let i=e.mode===`form`?e:{...e,mode:`form`},a=await this.request({method:`elicitation/create`,params:i},t,n);if(a.action===`accept`&&a.content&&i.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!e.valid)throw new r(g.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof r?e:new r(g.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},ee,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};re();var $=class{constructor(e=Q.stdin,t=Q.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new L,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=F(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};m(),b(),se(),z(),a(),e(),Y(),te(),ie(),E(),v(),J(),D(),G();var ue=[];async function de(e,t,r){let a=x(100);u(e);let s=new le({name:`claude/tengu`,version:`0.0.18`},{capabilities:{tools:{}}});s.setRequestHandler(S,async()=>{let e=Z(),t=h(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=i(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:i(n.inputSchema),outputSchema:r}}))}}),s.setRequestHandler(V,async({params:{name:e,arguments:i}})=>{let s=h(Z()),c=oe(s,e);if(!c)throw Error(`Tool ${e} not found`);let l={abortController:K(),options:{commands:ue,tools:s,mainLoopModel:ae(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:t,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>j(),setAppState:()=>{},messages:[],readFileState:a,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!c.isEnabled())throw Error(`Tool ${e} is not enabled`);let t=await c.validateInput?.(i??{},l);if(t&&!t.result)throw Error(`Tool ${e} input is invalid: ${`message`in t?t.message:String(t)}`);let r=await c.call(i??{},l,n,I({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:q(r.data)}]}}catch(e){return X(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?o(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
-
`).trim()||`Error`}]}}});async function c(){let e=new $;await s.connect(e)}return await c()}export{de as startMCPServer};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Bx as n,Cx as r,Dp as i,Ex as a,Gb as o,Ix as s,Jb as c,Kb as l,Mx as u,Nx as d,Op as f,Ou as p,Qb as m,Sx as h,Tb as ee,Xb as te,Xh as ne,Yh as g,Zd as _,dx as v,ed as re,fx as y,jb as ie,jx as b,kb as ae,ku as oe,qb as x,td as se,vE as S,yE as C}from"./loadAgentsDir-DnsldjYU.js";import{D as w,H as T,I as E,P as D,T as O,ai as k,j as A,kn as j,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{R as F,V as I}from"./debug-D7OBvqC2.js";import{c as L,h as R,o as z,v as B}from"./config-BybjRr09.js";import{n as V,o as ce}from"./process-gEbdy6uY.js";import{i as H,o as U}from"./platform-BZm4WVLM.js";import{s as W,u as G}from"./types-DDku8UKF.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-CGZoOfer.js";import{n as J,t as Y}from"./exit-s9XGerrH.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";S();var X=e(k(),1);t(),V(),M(),s(),ue(),f(),se();var Z=P();function pe({servers:e,scope:t,onDone:n}){let r=Object.keys(e),[o,s]=(0,X.useState)({});(0,X.useEffect)(()=>{b().then(({servers:e})=>s(e))},[]);let c=r.filter(e=>o[e]!==void 0);async function l(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(o[e]!==void 0){let t=1;for(;o[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await a(e,n,t),r++}}d(r)}let[u]=T(),d=(0,X.useCallback)(e=>{ce(e>0?`\n${A(`success`,u)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
|
|
2
|
-
No servers were imported.`),n(),_()},[u,t,n]),f=(0,X.useCallback)(()=>{d(0)},[d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Work Mate Desktop`,subtitle:`Found ${r.length} MCP ${q(r.length,`server`)} in Work Mate Desktop.`,color:`success`,onCancel:f,hideInputGuide:!0,children:[c.length>0&&(0,Z.jsx)(D,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(D,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(re,{options:r.map(e=>({label:`${e}${c.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:r.filter(e=>!c.includes(e)),onSubmit:l,onCancel:f,hideIndexes:!0})]}),(0,Z.jsx)(E,{paddingX:1,children:(0,Z.jsx)(D,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(w,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(w,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),oe(),le(),c(),ie(),s(),r(),ne(),R(),F(),t(),W(),U();async function Q(e,t){try{let n=await ee(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw I(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-CFOc-hPM.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-CBbVcOTy.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let r=u(e),i=()=>{r&&(r.type===`sse`||r.type===`http`)&&(l(e,r),o(e,r))};try{if(t.scope){let r=y(t.scope);K(`tengu_mcp_delete`,{name:e,scope:r}),await n(e,r),i(),process.stdout.write(`Removed MCP server ${e} from ${r} config\n`),J(`File modified: ${v(r)}`)}let r=z(),a=L(),{servers:o}=d(`project`),s=!!o[e],c=[];if(r.mcpServers?.[e]&&c.push(`local`),s&&c.push(`project`),a.mcpServers?.[e]&&c.push(`user`),c.length===0)Y(`No MCP server found with name: "${e}"`);else if(c.length===1){let t=c[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await n(e,t),i(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${v(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),c.forEach(e=>{process.stderr.write(` - ${h(e)} (${v(e)})\n`)}),process.stderr.write(`
|
|
3
|
-
To remove from a specific scope, use:
|
|
4
|
-
`),c.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){K(`tengu_mcp_list`,{});let{servers:e}=await b();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
-
`);let t=await C(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:ae()});for(let{name:e,server:n,status:r}of t)if(n.type===`sse`)console.log(`${e}: ${n.url} (SSE) - ${r}`);else if(n.type===`http`)console.log(`${e}: ${n.url} (HTTP) - ${r}`);else if(n.type===`claudeai-proxy`)console.log(`${e}: ${n.url} - ${r}`);else if(!n.type||n.type===`stdio`){let t=n,i=Array.isArray(t.args)?t.args:[];console.log(`${e}: ${t.command} ${i.join(` `)} - ${r}`)}}await _(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=u(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${h(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),x(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),x(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await _(0)}async function _e(e,t,n){try{let r=y(n.scope),i=G(t),o=n.clientSecret&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&`oauth`in i&&i.oauth&&typeof i.oauth==`object`&&`clientId`in i.oauth?await te():void 0;await a(e,i,r);let s=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;o&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&m(e,{type:i.type,url:i.url},o),K(`tengu_mcp_add`,{scope:r,source:`json`,type:s}),J(`Added ${s} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=y(e.scope);K(`tengu_mcp_add`,{scope:t,platform:H(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-CovdLe-b.js`),r=await n();Object.keys(r).length===0&&J(`No MCP servers found in Work Mate Desktop configuration or configuration file does not exist.`);let{unmount:i}=await j((0,Z.jsx)(g,{children:(0,Z.jsx)(p,{children:(0,Z.jsx)(pe,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){K(`tengu_mcp_reset_mcpjson_choices`,{}),B(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
-
You will be prompted for approval next time you start Work Mate.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{Ky as i,Mc as a,Nc as o,Qu as s,Vy as c,Wy as l,Xh as u,Zh as d,Zu as f,aE as ee,aS as p,ff as m,hC as h,pf as te,sE as g,sS as ne}from"./loadAgentsDir-DnsldjYU.js";import{I as _,Lt as v,P as y,Wt as b,_ as x,ai as S,di as re,fi as C,t as w,y as T}from"./src-DL3w8VPk2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as D,et as O}from"./state-B3zvBu4R.js";import{n as k,t as A}from"./cwd-Dj2ynhWd.js";import{F as j,R as M}from"./debug-D7OBvqC2.js";import{g as N,wn as P,x as F,xn as ie}from"./settings-DUyIag_5.js";import{M as I,P as L,k as ae}from"./config-BybjRr09.js";import{m as R,r as z}from"./git-CNhyfMtb.js";import{o as oe,s as se}from"./log-CR0v5KUR.js";import{n as ce,r as B}from"./analytics-DJobLaWP.js";import{m as le,v as V}from"./startupProfiler-BqUlQEaV.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-BnmDpMkm.js";import{r as ue,t as de}from"./promptEditor-C6w1vT5E.js";import{homedir as fe}from"os";import{join as W,relative as pe}from"path";import{mkdir as G,writeFile as me}from"fs/promises";function he(e){return z(e)!==null}var ge=e((()=>{R()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(l()),i=W(n(),`AGENTS.md`),a=W(O(),`AGENTS.md`),c=r.some(e=>e.path===i),u=r.some(e=>e.path===a),f=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...c?[]:[{path:i,type:`User`,content:``,exists:!1}],...u?[]:[{path:a,type:`Project`,content:``,exists:!1}]],p=new Map,m=f.map(e=>{let t=ie(e.path),n=e.exists?``:` (new)`,r=e.parent?(p.get(e.parent)??0)+1:0;p.set(e.path,r);let o=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===i?`User memory`:e.type===`Project`&&!e.isNested&&e.path===a?`Project memory`:r>0?`${o}L ${t}${n}`:`${t}`;let c,l=he(O());return c=e.type===`User`&&!e.isNested?`Saved in ~/.workmate/AGENTS.md`:e.type===`Project`&&!e.isNested&&e.path===a?`${l?`Checked in at`:`Saved in`} ./AGENTS.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),h=[],g=d(e=>e.agentDefinitions);if(L()){h.push({label:`Open auto-memory folder`,value:`${Y}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=ee(e.agentType,e.memory);h.push({label:`Open ${re.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}m.push(...h);let v=J&&m.some(e=>e.value===J)?J:m[0]?.value||``,[S,C]=(0,K.useState)(L),[w,T]=(0,K.useState)(o),[E]=(0,K.useState)(L),D=d(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{E&&te().then(A)},[E,D]);let j=D?`running`:k===null?``:k===0?`never`:`last ran ${le(new Date(k))}`,[M,N]=(0,K.useState)(null),P=M!==null,I=+!!E;function R(){let e=!S;F(`userSettings`,{autoMemoryEnabled:e}),C(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!w;F(`userSettings`,{autoDreamEnabled:e}),T(e),B(`tengu_auto_dream_toggled`,{enabled:e})}return H(),b(`confirm:no`,t,{context:`Confirmation`}),b(`confirm:yes`,()=>{M===0?R():M===1&&z()},{context:`Confirmation`,isActive:P}),b(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:P}),b(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,q.jsxs)(_,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(x,{isFocused:M===0,children:(0,q.jsxs)(y,{children:[`Auto-memory: `,S?`on`:`off`]})}),E&&(0,q.jsx)(x,{isFocused:M===1,styled:!1,children:(0,q.jsxs)(y,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(y,{dimColor:!0,children:[` · `,j]}),!D&&w&&(0,q.jsx)(y,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(s,{defaultFocusValue:v,options:m,isDisabled:P,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>ne(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var K,q,J,Y,ve=e((()=>{C(),K=t(S(),1),D(),U(),w(),h(),I(),ce(),a(),m(),u(),g(),p(),i(),r(),P(),V(),ge(),N(),f(),q=E(),Y=`__open_folder__`}));function ye(e){let t=fe(),n=A(),r=e.startsWith(t)?`~${e.slice(t.length)}`:null,i=e.startsWith(n)?`./${pe(n,e)}`:null;return r&&i?r.length<=i.length?r:i:r||i||e}var X=e((()=>{w(),k(),E()}));function be({onDone:e}){let t=async t=>{try{t.includes(n())&&await G(n(),{recursive:!0});try{await me(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(j(e)!==`EEXIST`)throw e}await de(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r==="default"?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${ye(t)}\n\n${o}`,{display:`system`})}catch(t){se(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(T,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(_,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(_e,{onSelect:t,onCancel:r})}),(0,Q.jsx)(_,{marginTop:1,children:(0,Q.jsxs)(y,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(v,{url:`https://code.workmate.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(S(),1),w(),ve(),X(),i(),r(),M(),oe(),ue(),Q=E(),$=async e=>(c(),await l(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Kw as r,Xh as i,Zh as a,bp as o,qw as s,xp as c,yp as l}from"./loadAgentsDir-DnsldjYU.js";import{ai as u,di as d,fi as f}from"./src-DL3w8VPk2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{D as m,E as h,q as g}from"./log-CR0v5KUR.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{A as y,B as b,J as x,O as S,Q as C,Y as w,Z as T,_ as E,b as D,j as O,k,s as A,w as j}from"./model-xI2MbgRj.js";import{i as M,r as N}from"./switcher-OAeeTHHt.js";import{i as P,n as F,r as I,t as L}from"./extraUsage-CHnG6JNH.js";function R({onDone:e}){let t=a(e=>e.mainLoopModel),r=a(e=>e.mainLoopModelForSession),i=a(e=>e.fastMode),o=n();function s(){v(`tengu_model_command_menu`,{action:`cancel`});let n=W(t);e(`Kept model as ${d.bold(n)}`,{display:`system`})}async function c(n){v(`tengu_model_command_menu`,{action:n,from_model:t,to_model:n}),o(e=>({...e,mainLoopModel:n,mainLoopModelForSession:null}));let r=`Set model to ${d.bold(W(n))}`,a;if(T()&&(b(),!C(n)&&i?(o(e=>({...e,fastMode:!1})),a=!1):C(n)&&w()&&i&&(r+=` · Fast mode ON`,a=!0)),F(n,a===!0,D())&&(r+=` · Billed as extra usage`),a===!1&&(r+=` · Fast mode OFF`),n){let e=await M(n);e.kind===`updated`&&(r+=` · Provider "${e.providerId}" default model updated`)}e(r)}return(0,K.jsx)(I,{initial:t,sessionModel:r,onSelect:c,onCancel:s,isStandaloneCommand:!0,showFastModeNotice:T()&&i&&C(t)&&w()})}function z({args:e,onDone:t}){let r=a(e=>e.fastMode),i=n(),o=e==="default"?null:e;return G.useEffect(()=>{async function e(){if(o&&!k(o)){t(`Model '${o}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(o&&V(o)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(o&&H(o)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!o){n(null);return}if(B(o)){await n(o);return}try{let{valid:e,error:r}=await s(o);e?await n(o):t(r||`Model '${o}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}async function n(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let n=`Set model to ${d.bold(W(e))}`,a;if(T()&&(b(),!C(e)&&r?(i(e=>({...e,fastMode:!1})),a=!1):C(e)&&r&&(n+=` · Fast mode ON`,a=!0)),F(e,a===!0,D())&&(n+=` · Billed as extra usage`),a===!1&&(n+=` · Fast mode OFF`),e){let t=await M(e);t.kind===`updated`&&(n+=` · Provider "${t.providerId}" default model updated`)}t(n)}e()},[o,t,i]),null}function B(e){return y.includes(e.toLowerCase().trim())}function V(e){let t=e.toLowerCase();return!l()&&!D()&&t.includes(`opus`)&&t.includes(`[1m]`)}function H(e){let t=e.toLowerCase();return!o()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function U({onDone:e}){let t=a(e=>e.mainLoopModel),n=a(e=>e.mainLoopModelForSession),r=W(t);return e(n?`Current model: ${d.bold(W(n))} (session override from plan mode)\nBase model: ${r}`:`Current model: ${r}`),null}function W(e){let t=j(e??A());return e===null?`${t} (default)`:t}var G,K,q;e((()=>{f(),G=t(u(),1),P(),g(),_(),i(),L(),x(),O(),c(),E(),S(),r(),N(),K=p(),q=async(e,t,n)=>{if(n=n?.trim()||``,m.includes(n))return v(`tengu_model_command_inline_help`,{args:n}),(0,K.jsx)(U,{onDone:e});if(h.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(v(`tengu_model_command_inline`,{args:n}),(0,K.jsx)(z,{args:n,onDone:e})):(0,K.jsx)(R,{onDone:e})}}))();export{q as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,u as t}from"./model-xI2MbgRj.js";e();export{t as getMainLoopModel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{AT as r,CT as i,_E as a,gE as o,kT as s,wT as c}from"./loadAgentsDir-DnsldjYU.js";import{Ar as l,Ci as u,Dr as d,Er as f,Fr as p,Or as m,Pr as h,Si as g,bi as _,di as v,jr as y,kr as b,ui as x,xi as S}from"./state-B3zvBu4R.js";import{$n as C,Er as w,Qn as T,Tr as E,Zn as D,er as O,nr as k,tr as A}from"./settings-DUyIag_5.js";import{I as j,L as M}from"./config-BybjRr09.js";function N(e){return S(e)||v(e)||!!(P&&e&&e[P])}var P,F=e((()=>{n(),x(),_(),P=t?t.isConcatSpreadable:void 0}));function I(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=N),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?I(s,t-1,n,r,i):g(i,s):r||(i[i.length]=s)}return i}var L=e((()=>{u(),F()}));function R(e){return e!=null&&e.length?I(e,1):[]}var z=e((()=>{L()}));function B(e){return T(O(e,void 0,R),e+``)}var V=e((()=>{z(),C(),D()}));function H(e,t){return t.length<2?e:f(e,s(t,0,-1))}var U=e((()=>{d(),r()}));function W(e,t){t=l(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=b(t[n]);if(i===`__proto__`&&!G.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=H(e,t);return a==null||delete a[b(c(t))]}var G,K=e((()=>{y(),i(),U(),m(),G=Object.prototype.hasOwnProperty}));function q(e){return k(e)?void 0:e}var J=e((()=>{A()})),Y,X,Z,Q,$=e((()=>{p(),a(),K(),y(),w(),J(),V(),M(),Y=1,X=2,Z=4,Q=B(function(e,t){var n={};if(e==null)return n;var r=!1;t=h(t,function(t){return t=l(t,e),r||(r=t.length>1),t}),E(e,j(e),n),r&&(n=o(n,Y|X|Z,q));for(var i=t.length;i--;)W(n,t[i]);return n})}));export{Q as n,$ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Mn as e,Wt as t}from"./state-B3zvBu4R.js";import{R as n,U as r}from"./debug-D7OBvqC2.js";import{Ft as i,Mt as a,zt as o}from"./settings-DUyIag_5.js";import{c as s,h as c,y as l}from"./config-BybjRr09.js";import{o as u,s as d}from"./log-CR0v5KUR.js";import{Pt as f,dt as p,ft as m,ut as h}from"./model-xI2MbgRj.js";import{a as g,i as _,n as v}from"./sessionState-B3tFm9SC.js";import{r as y,t as b}from"./managedEnv-C7bVtcgA.js";t(),f(),c(),n(),u(),y(),a(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:i(e.permission_mode)}}:{}})}function S({newState:t,oldState:n}){let i=n.toolPermissionContext.mode,a=t.toolPermissionContext.mode;if(i!==a){let e=o(i),t=o(a);e!==t&&g({permission_mode:t}),_(a)}if(t.mainLoopModel!==n.mainLoopModel&&e(t.mainLoopModel),t.expandedView!==n.expandedView){let e=t.expandedView===`tasks`;s().showExpandedTodos!==e&&l(t=>({...t,showExpandedTodos:e}))}if(t.verbose!==n.verbose&&s().verbose!==t.verbose){let e=t.verbose;l(t=>({...t,verbose:e}))}if(t.settings!==n.settings)try{h(),p(),m(),t.settings.env!==n.settings.env&&b()}catch(e){d(r(e))}}export{S as n,x as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./parser-Dy-RMf4a.js";t();export{e as parseCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ET as t,TT as n}from"./loadAgentsDir-DnsldjYU.js";import{Cr as r,Sr as i,bi as a,xi as o}from"./state-B3zvBu4R.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,t,r,i){return n(e,function(e,n,a){t(i,e,r(e),a)}),i}var u=e((()=>{t()}));function d(e,t){return function(n,r){var a=o(n)?s:l,c=t?t():{};return a(n,e,i(r,2),c)}}var f=e((()=>{c(),u(),r(),a()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,$u as a,Gg as o,H as s,Hg as c,I as l,Kg as u,L as d,La as f,Qu as p,R as m,Um as h,V as ee,Wm as g,Xh as te,Zh as ne,_a as _,cd as v,hC as re,ld as ie,oT as y,rT as b,xC as x,z as ae}from"./loadAgentsDir-DnsldjYU.js";import{I as S,P as C,Wt as oe,Xn as se,a as w,ai as T,di as E,fi as D,hn as O,k,kt as A,n as j,o as M,ot as ce,r as le,s as ue,t as N,x as de,y as P}from"./src-DL3w8VPk2.js";import{t as F}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as fe,et as I}from"./state-B3zvBu4R.js";import{C as L,x as pe}from"./debug-D7OBvqC2.js";import{H as R,V as z,g as me,ln as B,o as he,rn as ge,z as V}from"./settings-DUyIag_5.js";import{l as _e,o as ve}from"./stringUtils-CGZoOfer.js";import{n as ye,t as be}from"./useExitOnCtrlCDWithKeybindings-BnmDpMkm.js";import{n as xe,t as Se}from"./AddWorkspaceDirectory-Wa6Q24nu.js";import{t as Ce}from"./SearchBox-CwwV0W-w.js";import{n as we,t as Te}from"./useSearchInput-DqymtQhH.js";import{n as H,t as Ee}from"./shadowedRuleDetection-ChoqK1Iq.js";function De(){return U}var U,Oe=e((()=>{U=[]}));function ke({ruleValue:e}){switch(e.toolName){case h.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(C,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(C,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(C,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(C,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(C,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(C,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(C,{bold:!0,children:e.toolName}),` tool`]})}}var W,Ae=e((()=>{N(),g(),W=F()}));function je(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${he(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${he(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.workmate/settings.json`,value:e}}}function Me({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=ge.map(je),s=(0,Ne.useCallback)(o=>{if(o===`cancel`){t();return}else if(ge.includes(o)){let t=o,s=c(i,{type:`addRules`,rules:n,behavior:r,destination:t});u({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let l=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),d=Ee(s,{sandboxAutoAllowEnabled:b.isSandboxingEnabled()&&b.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(l,d.length>0?d:void 0)}},[e,t,n,r,i,a]);return(0,G.jsxs)(P,{title:`Add ${r} permission ${_e(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(S,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(S,{flexDirection:`column`,children:[(0,G.jsx)(C,{bold:!0,children:R(e)}),(0,G.jsx)(ke,{ruleValue:e})]},R(e)))}),(0,G.jsxs)(S,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(C,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(p,{options:o,onChange:s})]})]})}var Ne,G,Pe=e((()=>{Ne=t(T(),1),a(),N(),o(),V(),H(),y(),B(),me(),ve(),Ae(),G=F()}));function Fe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[i,a]=(0,Ie.useState)(``),[o,s]=(0,Ie.useState)(0),c=ye();oe(`confirm:no`,e,{context:`Settings`});let{columns:l}=ce(),u=l-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(S,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(C,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(S,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(A,{}),`e.g., `,(0,K.jsx)(C,{bold:!0,children:R({toolName:h.name})}),(0,K.jsx)(C,{bold:!1,children:` or `}),(0,K.jsx)(C,{bold:!0,children:R({toolName:h.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(S,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(v,{showCursor:!0,value:i,onChange:a,onSubmit:e=>{let r=e.trim();r.length!==0&&t(z(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:u,cursorOffset:o,onChangeCursorOffset:s})})]})]}),(0,K.jsx)(S,{marginLeft:3,children:c.pending?(0,K.jsxs)(C,{dimColor:!0,children:[`Press `,c.keyName,` again to exit`]}):(0,K.jsx)(C,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Ie,K,Le=e((()=>{n(),Ie=t(T(),1),ie(),be(),x(),N(),re(),g(),V(),K=F()}));function Re({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=w();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,q.useState)(()=>De()),[a,o]=(0,q.useState)(()=>new Set),[s,c]=(0,q.useState)(()=>new Set),[l,u]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,q.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),f=(0,q.useCallback)(e=>{u(Number(e))},[]);if(O((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,J.jsx)(C,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let m=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(C,{children:[(0,J.jsx)(ue,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(C,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(S,{flexDirection:`column`,children:[(0,J.jsx)(C,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(S,{marginTop:1,children:(0,J.jsx)(p,{options:m,onChange:d,onFocus:f,visibleOptionCount:Math.min(10,m.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,ze=e((()=>{q=t(T(),1),N(),Oe(),a(),J=F()}));function Be({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,Ve.useCallback)(()=>{i(c(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,Ve.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,Y.jsxs)(P,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(S,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(C,{bold:!0,children:e})}),(0,Y.jsx)(C,{children:`Work Mate will no longer have access to files in this directory.`}),(0,Y.jsx)(p,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Ve,Y,He=e((()=>{Ve=t(T(),1),a(),N(),o(),Y=F()}));function Ue({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=w();(0,X.useEffect)(()=>{a?.(o)},[o,a]);let c=We.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t?.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=We.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,Z.jsxs)(S,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(S,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(C,{children:`- ${I()}`}),(0,Z.jsx)(C,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(p,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var We,X,Z,Ge=e((()=>{n(),We=t(T(),1),X=t(T(),1),fe(),a(),N(),Z=F()}));function Ke({rule:e}){return(0,$.jsx)(C,{dimColor:!0,children:`From ${s(e.source)}`})}function qe(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Je({rule:e,onDelete:t,onCancel:n}){let r=ye();oe(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(S,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(C,{bold:!0,children:R(e.ruleValue)}),(0,$.jsx)(ke,{ruleValue:e.ruleValue}),(0,$.jsx)(Ke,{rule:e})]}),a=(0,$.jsx)(S,{marginLeft:3,children:r.pending?(0,$.jsxs)(C,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(C,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(S,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(C,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(C,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
-
`,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(S,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(C,{bold:!0,color:`error`,children:[`Delete `,qe(e.ruleBehavior),` tool?`]}),i,(0,$.jsx)(C,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(p,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),a]})}function Ye(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,u=M(),{headerFocused:d,focusHeader:f,blurHeader:m}=w();return(0,Q.useEffect)(()=>{r&&d&&m()},[r,d,m]),(0,Q.useEffect)(()=>{l?.(d)},[d,l]),(0,$.jsxs)(S,{flexDirection:`column`,children:[(0,$.jsx)(S,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(k,{query:n,isFocused:r&&!d,isTerminalFocused:i,width:u,cursorOffset:c})}),(0,$.jsx)(p,{options:t,onChange:a,onCancel:o,visibleOptionCount:Math.min(10,t.length),isDisabled:r||d,defaultFocusValue:s,onUpFromFirstItem:f})]})}function Xe({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(S,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(C,{children:{allow:`Work Mate won't ask before using allowed tools.`,ask:`Work Mate will always ask for confirmation before using these tools.`,deny:`Work Mate will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Ye,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Ze({onExit:e,initialTab:t,onRetryDenials:n}){let a=De().length>0,o=t??(a?`recent`:`allow`),[s,f]=(0,Q.useState)([]),p=ne(e=>e.toolPermissionContext),h=i(),ee=se(),g=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),te=(0,Q.useCallback)(e=>{g.current=e},[]),[_,v]=(0,Q.useState)(),[re,ie]=(0,Q.useState)(),[y,b]=(0,Q.useState)(null),[x,w]=(0,Q.useState)(null),[T,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,M]=(0,Q.useState)(!1),[ce,ue]=(0,Q.useState)(!0),N=(0,Q.useCallback)(e=>{ue(e)},[]),P=(0,Q.useMemo)(()=>{let e=new Map;return d(p).forEach(t=>{e.set(L(t),t)}),e},[p]),F=(0,Q.useMemo)(()=>{let e=new Map;return ae(p).forEach(t=>{e.set(L(t),t)}),e},[p]),fe=(0,Q.useMemo)(()=>{let e=new Map;return m(p).forEach(t=>{e.set(L(t),t)}),e},[p]),I=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return P;case`deny`:return F;case`ask`:return fe;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=R(r.ruleValue).toLowerCase(),t=R(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=R(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[P,F,fe]),pe=ye(),z=!_&&!y&&!x&&!T&&!O,{query:me,setQuery:B,cursorOffset:he}=we({isActive:z&&A,onExit:()=>{M(!1)}}),ge=(0,Q.useCallback)(e=>{z&&(A||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),M(!0),B(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),M(!0),B(e.key))))},[z,A,B]),V=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){b(t);return}else{v(n.get(e));return}},[I]),_e=(0,Q.useCallback)(()=>{b(null)},[]),ve=(0,Q.useCallback)((e,t)=>{w({ruleValue:e,ruleBehavior:t}),b(null)},[]),be=(0,Q.useCallback)((e,t)=>{w(null);for(let t of e)f(e=>[...e,`Added ${t.ruleBehavior} rule ${E.bold(R(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;f(n=>[...n,E.yellow(`${r.warning} Warning: ${R(e.rule.ruleValue)} is ${t}`),E.dim(` ${e.reason}`),E.dim(` Fix: ${e.fix}`)])}},[]),xe=(0,Q.useCallback)(()=>{w(null)},[]),Ce=(0,Q.useCallback)(()=>D(!0),[]),Te=(0,Q.useCallback)(e=>k(e),[]),H=(0,Q.useCallback)(()=>{let t=g.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||s.length>0?e([...a.length>0?[`Approved ${a.map(e=>E.bold(e.display)).join(`, `)}`]:[],...s].join(`
|
|
3
|
-
`)):e(`Permissions dialog dismissed`,{display:`system`})},[s,e,n]);oe(`confirm:no`,H,{context:`Settings`,isActive:z&&!A});let Ee=()=>{if(!_)return;let{options:e}=I(_.ruleBehavior),t=L(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),ie(i),l({rule:_,initialContext:p,setToolPermissionContext(e){h(t=>({...t,toolPermissionContext:e}))}}),f(e=>[...e,`Deleted ${_.ruleBehavior} rule ${E.bold(R(_.ruleValue))}`]),v(void 0)};if(_)return(0,$.jsx)(Je,{rule:_,onDelete:Ee,onCancel:()=>v(void 0)});if(y&&y!==`workspace`&&y!==`recent`)return(0,$.jsx)(Fe,{onCancel:_e,onSubmit:ve,ruleBehavior:y});if(x)return(0,$.jsx)(Me,{onAddRules:be,onCancel:xe,ruleValues:[x.ruleValue],ruleBehavior:x.ruleBehavior,initialContext:p,setToolPermissionContext:e=>{h(t=>({...t,toolPermissionContext:e}))}});if(T)return(0,$.jsx)(Se,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=c(p,n);h(e=>({...e,toolPermissionContext:r})),t&&u(n),f(n=>[...n,`Added directory ${E.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:p});if(O)return(0,$.jsx)(Be,{directoryPath:O,onRemove:()=>{f(e=>[...e,`Removed directory ${E.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:p,setPermissionContext:e=>{h(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:me,isSearchMode:A,isFocused:ee,onCancel:H,lastFocusedRuleKey:re,cursorOffset:he,getRulesOptions:I,handleToolSelect:V,onHeaderFocusChange:N};return(0,$.jsx)(S,{flexDirection:`column`,onKeyDown:ge,children:(0,$.jsxs)(de,{color:`permission`,children:[(0,$.jsxs)(le,{title:`Permissions:`,color:`permission`,defaultTab:o,hidden:!!_||!!y||!!x||T||!!O,initialHeaderFocused:!a,navFromContent:!A,children:[(0,$.jsx)(j,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Re,{onHeaderFocusChange:N,onStateChange:te})}),(0,$.jsx)(j,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Xe,{tab:`allow`,...U})}),(0,$.jsx)(j,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Xe,{tab:`ask`,...U})}),(0,$.jsx)(j,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Xe,{tab:`deny`,...U})}),(0,$.jsx)(j,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(S,{flexDirection:`column`,children:[(0,$.jsx)(C,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(Ue,{onExit:e,toolPermissionContext:p,onRequestAddDirectory:Ce,onRequestRemoveDirectory:Te,onHeaderFocusChange:N})]})})]}),(0,$.jsx)(S,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(C,{dimColor:!0,children:pe.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,pe.keyName,` again to exit`]}):ce?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):A?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):a&&o===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Qe=e((()=>{D(),n(),Q=t(T(),1),te(),o(),a(),be(),Te(),N(),re(),Oe(),V(),ee(),pe(),Ce(),Pe(),xe(),Ae(),Le(),ze(),He(),Ge(),$=F()})),$e,et;e((()=>{Qe(),f(),$e=F(),et=async(e,t)=>(0,$e.jsx)(Ze,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,_(e)])}})}))();export{et as call};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,i,l as a,o}from"./envUtils-DcaKZlRU.js";import{$d as s,oT as c,rT as ee}from"./loadAgentsDir-DnsldjYU.js";import{n as te}from"./cwd-Dj2ynhWd.js";import{B as ne,C as re,D as ie,R as l,S as u,T as ae,U as oe,V as se,c as d,f,i as p,u as m,x as h}from"./debug-D7OBvqC2.js";import{Kt as ce,M as g,P as le,Qt as ue,Xt as de,Yt as fe,g as pe,n as me}from"./settings-DUyIag_5.js";import{a as _,c as v,h as y,i as he}from"./config-BybjRr09.js";import{c as ge,n as _e,o as ve,r as b,t as x}from"./execFileNoThrow-BHDSgTpZ.js";import{o as S,s as C}from"./log-CR0v5KUR.js";import{n as w,t as ye}from"./which-3MmqfsNV.js";import{i as T,o as E}from"./platform-BZm4WVLM.js";import{n as D,t as be}from"./bundledMode--fG1S62b.js";import{_t as xe,vt as Se}from"./sessionState-B3tFm9SC.js";import{a as Ce,i as we}from"./ripgrep-C_XuTqp3.js";import{i as Te,r as Ee}from"./genericProcessUtils-D5hCZ2ho.js";import{homedir as O}from"os";import{basename as De,delimiter as Oe,join as k,posix as A,win32 as j}from"path";import{constants as ke}from"fs";import{access as Ae,open as je,readFile as M,realpath as Me,stat as Ne}from"fs/promises";function Pe(){return k(i(),`local`)}function Fe(){return k(Pe(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function N(){try{return await Ae(k(Pe(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function P(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var F=e((()=>{y(),o(),l(),b(),f(),S(),h()}));function I(e){let t=e?.homedir??O();return{zsh:k((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:k(t,`.bashrc`),fish:k(t,`.config/fish/config.fish`)}}function Le(e){let t=!1;return{filtered:e.filter(e=>{if(z.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n?.[1]&&n[1].trim()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function L(e){try{return(await M(e,{encoding:`utf8`})).split(`
|
|
2
|
-
`)}catch(e){if(se(e))return null;throw e}}async function Re(e,t){let n=await je(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
-
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function R(e){let t=I(e);for(let e of Object.values(t)){let t=await L(e);if(t){for(let e of t)if(z.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t?.[1])return t[1]}}}return null}async function ze(e){let t=await R(e);if(!t)return null;let n=e?.homedir??O(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Ne(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var z,B=e((()=>{l(),F(),z=/^\s*alias\s+claude\s*=/}));async function Be(){}function Ve(e){let t=me()?.minimumVersion;if(!t)return!1;let n=!xe(e,t);return n&&d(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=ce.isRunningWithBun(),t=null;return t=e?await _e(`bun`,[`pm`,`bin`,`-g`],{cwd:O()}):await _e(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:O()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ue(){try{let e=await He();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await Ae(e,ke.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new We(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}var We,Ge=e((()=>{y(),p(),fe(),o(),l(),b(),f(),s(),S(),Se(),pe(),B(),We=class extends ie{}}));function V(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ke(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(d(`Detected mise installation: ${e}`),!0):!1}function qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(d(`Detected asdf installation: ${e}`),!0):!1}function H(){let e=T();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(d(`Detected Homebrew cask installation: ${t}`),!0):!1}function Je(){if(T()!==`windows`)return!1;let e=process.execPath||process.argv[0]||``;for(let t of[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i])if(t.test(e))return d(`Detected winget installation: ${e}`),!0;return!1}var U,W,G,K,q,Ye,Xe=e((()=>{n(),p(),b(),E(),U=t(async()=>{try{let e=await M(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),W=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),G=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),K=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),Ye=t(async()=>H()?`homebrew`:Je()?`winget`:Ke()?`mise`:qe()?`asdf`:await W()?`pacman`:await q()?`apk`:await G()?`deb`:await K()?`rpm`:`unknown`)}));function Ze(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return T()===`windows`&&(e=e.split(j.sep).join(A.sep),t=t.split(j.sep).join(A.sep)),[e,t]}async function Qe(){let[e]=Ze();if(D())return H()||Je()||Ke()||qe()||await W()||await G()||await K()||await q()?`package-manager`:`native`;if(Ie())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await ve(`npm config get prefix`,{shell:!0,reject:!1}),n=t.exitCode===0?t.stdout.trim():null;return n&&e.startsWith(n)?`npm-global`:`unknown`}async function $e(){if(D()){try{return await Me(process.execPath)}catch{}try{let e=await w(`claude`);if(e)return e}catch{}try{return await m().stat(k(O(),`.local/bin/claude`)),k(O(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function et(){try{return D()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function tt(){let e=m(),t=[],n=k(O(),`.workmate`,`local`);await N()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/workmate`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=T()===`windows`,o=a?k(n,`claude`):k(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await Me(o)).includes(`/Caskroom/`)&&(e=H())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?k(n,`node_modules`,i):k(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=k(O(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(v().installMethod===`native`){let n=k(O(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function nt(e){let t=[];try{let e=u(await M(k(de(),`managed-settings.json`),`utf-8`)),n=e&&typeof e==`object`?e.strictPluginOnlyCustomization:void 0;if(n!==void 0&&typeof n!=`boolean`)if(!Array.isArray(n))t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof n})`,fix:`The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=v();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(Oe),n=k(O(),`.local`,`bin`),r=n;if(T()===`windows`&&(r=n.split(j.sep).join(A.sep)),!e.some(e=>{let t=e;T()===`windows`&&(t=e.split(j.sep).join(A.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(T()===`windows`){let e=n.split(A.sep).join(j.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=P(),n=I()[e],r=n?n.replace(O(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}a(process.env.DISABLE_INSTALLATION_CHECKS)||(e===`npm-local`&&n.installMethod!==`local`&&t.push({issue:`Running from local installation but config install method is '${n.installMethod}'`,fix:`Consider using native installation: claude install`}),e===`native`&&n.installMethod!==`native`&&t.push({issue:`Running native installation but config install method is '${n.installMethod}'`,fix:`Run claude install to update configuration`})),e===`npm-global`&&await N()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await R(),i=await ze();return e===`npm-local`&&!await w(`claude`)&&!i&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.workmate/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.workmate/local/claude"`})),t}function rt(){if(T()!==`linux`)return[];let e=[],t=ee.getLinuxGlobPatternWarnings();if(t.length>0){let n=t.slice(0,3).join(`, `),r=t.length-3,i=r>0?`${n} (${r} more)`:n;e.push({issue:`Glob patterns in sandbox permission rules are not fully supported on Linux`,fix:`Found ${t.length} pattern(s): ${i}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return e}async function it(){let e=await Qe(),t=typeof MACRO<`u`?`0.0.18`:`unknown`,n=await $e(),r=et(),i=await tt(),a=await nt(e);if(a.push(...rt()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=T()===`windows`;for(let n of e)n.type===`npm-global`?a.push({issue:`Leftover npm global installation at ${n.path}`,fix:`Run: npm -g uninstall @anthropic-ai/workmate`}):n.type===`npm-global-orphan`?a.push({issue:`Orphaned npm global package at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`}):n.type===`npm-local`&&a.push({issue:`Leftover npm local installation at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`})}let o=v().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await Ue()).hasPermissions,!s&&!_()&&a.push({issue:`Insufficient permissions for auto-updates`,fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"}));let c=we(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await Ye():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_();return e?`disabled (${he(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var at=e((()=>{ge(),Ge(),be(),y(),te(),o(),b(),f(),F(),Xe(),E(),Ce(),c(),ue(),le(),B(),h(),ye()}));function J(e){return{env:e?.env??process.env,home:e?.homedir??process.env.HOME??O()}}function Y(e,...t){return e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)?A.join(e,...t):k(e,...t)}function ot(e){let{env:t,home:n}=J(e);return t.XDG_STATE_HOME??Y(n,`.local`,`state`)}function st(e){let{env:t,home:n}=J(e);return t.XDG_CACHE_HOME??Y(n,`.cache`)}function ct(e){let{env:t,home:n}=J(e);return t.XDG_DATA_HOME??Y(n,`.local`,`share`)}function lt(e){let{home:t}=J(e);return Y(t,`.local`,`bin`)}var ut=e((()=>{}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return a(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ft(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=Ee(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Z(e){let t=m();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=u(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!ft(n,r))return d(`Lock PID ${n} is running but does not appear to be Work Mate - treating as stale`),!1;let i=m();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=m(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ae(r,re(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function mt(e,t){let n=m(),r=De(e);if(Q(t))return d(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return pt(t,i),Z(t)?.pid===process.pid?(d(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),d(`Released PID lock for ${r}`))}catch(e){d(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return d(`Failed to acquire lock for ${r}: ${e}`),null}}async function ht(e,t){let n=await mt(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function gt(e,t,n){let r=await mt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function _t(e){let t=m(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=k(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(ne(e))return n;C(oe(e))}return n}function vt(e){let t=m(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=k(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,d(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,d(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(ne(e))return 0;C(oe(e))}return n}var $,yt=e((()=>{p(),o(),l(),f(),Te(),S(),h(),$=7200*1e3}));export{L as C,F as E,B as S,P as T,Be as _,Q as a,Le as b,gt as c,ct as d,ot as f,at as g,it as h,yt as i,lt as l,Qe as m,vt as n,dt as o,ut as p,_t as r,Z as s,ht as t,st as u,Ge as v,Re as w,I as x,Ve as y};
|