@readmagic/workmate 0.0.17 → 0.0.18
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-YAhnVwyN.js → AddWorkspaceDirectory-Wa6Q24nu.js} +1 -1
- package/dist/chunks/{AgentsMdExternalIncludesDialog-Ba4GYFl3.js → AgentsMdExternalIncludesDialog-3I_KlOLv.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-h150UBir.js +1 -0
- package/dist/chunks/{App-mri25OrC.js → App-BgPs1Bu8.js} +1 -1
- package/dist/chunks/{ApproveApiKey-DCw6d7dm.js → ApproveApiKey-BxpapUq0.js} +1 -1
- package/dist/chunks/ApproveApiKey-DIIIi6U8.js +1 -0
- package/dist/chunks/{BackgroundTasksDialog-CZND8e_Z.js → BackgroundTasksDialog-nfRmiGl3.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-B5QBJTB4.js → BypassPermissionsModeDialog-8Cq982M0.js} +1 -1
- package/dist/chunks/{DiffDialog-Bd-DcTsK.js → DiffDialog-DwQTDWYh.js} +1 -1
- package/dist/chunks/Doctor-Beo5yEMD.js +1 -0
- package/dist/chunks/{Doctor-C9t7udHN.js → Doctor-BxXAGr-Z.js} +1 -1
- package/dist/chunks/{ExitFlow-CShdrKmr.js → ExitFlow-CVIuvrHT.js} +1 -1
- package/dist/chunks/{Grove-CClEZT2e.js → Grove-_QX_wR9C.js} +1 -1
- package/dist/chunks/{HybridTransport-DyEuslQB.js → HybridTransport-BG2VIIBC.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-Wyrk_cXR.js → InvalidConfigDialog-BDdMkuaL.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-Cr9fmSyh.js → InvalidSettingsDialog-DSCqbVER.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-BnUw0nYN.js → MCPConnectionManager-Cer1UawR.js} +1 -1
- package/dist/chunks/{MCPToolListView-CY2EezWF.js → MCPToolListView-DndNWDr1.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-BF4np2Y3.js → McpParsingWarnings-Cr_n2QR6.js} +1 -1
- package/dist/chunks/{MessageSelector-Dtt2Sf65.js → MessageSelector-BfmbAG8E.js} +1 -1
- package/dist/chunks/{Messages-D5Uuapmf.js → Messages-CUJJ6nHV.js} +1 -1
- package/dist/chunks/{Onboarding-BAJXV7Ay.js → Onboarding-Cz3CfOTl.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-Cm4WN3qd.js → PromptInputFooterSuggestions-GhA5Qa1I.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-ESj8sOpK.js → PromptInputHelpMenu-sX_yHORM.js} +1 -1
- package/dist/chunks/{QueryEngine-B79JLwG4.js → QueryEngine-C6Dx_-U8.js} +1 -1
- package/dist/chunks/{REPL-cAXdORs2.js → REPL-BPig-OIh.js} +38 -38
- package/dist/chunks/REPL-e5wWV2Sl.js +1 -0
- package/dist/chunks/{RemoteSessionManager-C5pAD0Lh.js → RemoteSessionManager-Cax4g0GH.js} +1 -1
- package/dist/chunks/{ResumeConversation-NSVT3gn7.js → ResumeConversation-e5sISbWn.js} +1 -1
- package/dist/chunks/{SSETransport-CDGMGrxN.js → SSETransport-BuDKErlN.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-B_z74zwG.js +1 -0
- package/dist/chunks/{Settings-_b5Yxt_9.js → Settings-B9rxF2wR.js} +2 -2
- package/dist/chunks/{TeleportProgress-8cS6aHVO.js → TeleportProgress-BUtze4qa.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-B0epkMgp.js → TeleportRepoMismatchDialog-Dp7rzrrz.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-Bb14JeEk.js → TeleportResumeWrapper-Ch2osY21.js} +1 -1
- package/dist/chunks/{ThemePicker-CnX8faYA.js → ThemePicker-AA-0hjpq.js} +1 -1
- package/dist/chunks/{TrustDialog-6wJF3W6K.js → TrustDialog-rO5dZ8G-.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-Cuq6W2yc.js → ValidationErrorsList-DayOwxq9.js} +1 -1
- package/dist/chunks/{add-dir-LLAv-rGS.js → add-dir-Cz33IGht.js} +1 -1
- package/dist/chunks/{agentDisplay-QqGqcHGz.js → agentDisplay-nVTmC7tL.js} +1 -1
- package/dist/chunks/{agents-DFPEienW.js → agents-BQwi-6GV.js} +1 -1
- package/dist/chunks/{agents-C8wRUTNV.js → agents-rfuJUSSc.js} +1 -1
- package/dist/chunks/{allErrors-DUYYPpdH.js → allErrors-YIRWFBD9.js} +1 -1
- package/dist/chunks/api-CGk-0H2x.js +1 -0
- package/dist/chunks/{api-B3Wnozaf.js → api-DAyhTxgY.js} +1 -1
- package/dist/chunks/{auth-CQGJitIV.js → auth-BzrroWLq.js} +1 -1
- package/dist/chunks/auth-DWWb8STf.js +1 -0
- package/dist/chunks/auth-DsqlBO-Q.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-Bjb_Jc7L.js → backgroundHousekeeping-CXv_Pm5h.js} +2 -2
- package/dist/chunks/backgroundHousekeeping-Crx3oXIu.js +1 -0
- package/dist/chunks/{banner-HfMnBd03.js → banner-BfIcVEUU.js} +1 -1
- package/dist/chunks/{bg-DltfF1_K.js → bg-C15c_rMK.js} +2 -2
- package/dist/chunks/{branch-BWq5ynjm.js → branch-BEaujq-M.js} +1 -1
- package/dist/chunks/{break-cache-Cd1yQ-0h.js → break-cache-XKbOAw-u.js} +2 -2
- package/dist/chunks/{bridgeConfig-B3mR0kJ0.js → bridgeConfig-Bxkrv8ZL.js} +1 -1
- package/dist/chunks/bridgeConfig-Ctl7I_RR.js +1 -0
- package/dist/chunks/{bridgeMessaging-wZ5EKxW_.js → bridgeMessaging-BcSjIPCZ.js} +1 -1
- package/dist/chunks/bridgePointer-CGhOBNMg.js +1 -0
- package/dist/chunks/bridgeStatusUtil-DBWBTU31.js +1 -0
- package/dist/chunks/{btw-XNgXHnNr.js → btw-8JqSG3o7.js} +1 -1
- package/dist/chunks/caches-dnO4Ae_m.js +1 -0
- package/dist/chunks/caches-lPzD_yGv.js +1 -0
- package/dist/chunks/{capacityWake-LRiPhPeM.js → capacityWake-C24_KT1x.js} +1 -1
- package/dist/chunks/{ccrClient-EisctZbc.js → ccrClient-CH6PsxJJ.js} +1 -1
- package/dist/chunks/{claudeDesktop-CB3UCt7U.js → claudeDesktop-CovdLe-b.js} +1 -1
- package/dist/chunks/{clear-BjtPf2Jb.js → clear-D72LxXA6.js} +1 -1
- package/dist/chunks/{cliLaunch-xIVvtPZy.js → cliLaunch-DDA65zeR.js} +1 -1
- package/dist/chunks/client-BFjMSlp7.js +1 -0
- package/dist/chunks/client-Byat5HpG.js +1 -0
- package/dist/chunks/client-Dzx24jGZ.js +1 -0
- package/dist/chunks/{client-Bb2eZnuq.js → client-eLOYyeES.js} +1 -1
- package/dist/chunks/{client-DNEVh6Wu.js → client-o5_awagP.js} +1 -1
- package/dist/chunks/commands-D3lQbt9p.js +1 -0
- package/dist/chunks/{compact-w8AhLkr6.js → compact--fnu8Zd-.js} +1 -1
- package/dist/chunks/{config-D78R57VA.js → config-BlQhL9Bh.js} +1 -1
- package/dist/chunks/{config-BSkuQZNf.js → config-BybjRr09.js} +1 -1
- package/dist/chunks/config-CPGSP_1Z.js +1 -0
- package/dist/chunks/{context-Btn2JU2y.js → context-D6PaqwrR.js} +1 -1
- package/dist/chunks/context-noninteractive-CwlOID3q.js +1 -0
- package/dist/chunks/{context-noninteractive-044464Vs.js → context-noninteractive-CxoMCfR4.js} +1 -1
- package/dist/chunks/conversation-BLEWB1BE.js +1 -0
- package/dist/chunks/{conversation-a82khZ_n.js → conversation-Bos7yTIv.js} +1 -1
- package/dist/chunks/{createSSHSession-C0KSI0fJ.js → createSSHSession-B3FdForb.js} +1 -1
- package/dist/chunks/createSession-B4wkDNam.js +1 -0
- package/dist/chunks/{createSession-8ScCWTKb.js → createSession-C0e_DHsW.js} +1 -1
- package/dist/chunks/{crossProjectResume-BCN462Wa.js → crossProjectResume-C5QtstD6.js} +1 -1
- package/dist/chunks/cwd-BfiQQAqr.js +1 -0
- package/dist/chunks/{cwd-Besi3Os3.js → cwd-Dj2ynhWd.js} +1 -1
- package/dist/chunks/{datadog-BqINRWAW.js → datadog-ZxeaKwKd.js} +1 -1
- package/dist/chunks/{debug-BQj6h99Q.js → debug-D7OBvqC2.js} +1 -1
- package/dist/chunks/{debugUtils-B86DM1Sp.js → debugUtils-B-GMBTBk.js} +1 -1
- package/dist/chunks/{detached--wGwkuHX.js → detached-uMuMcLsV.js} +1 -1
- package/dist/chunks/{detectRepository-Qy3zKoyn.js → detectRepository-AVEUw4lk.js} +1 -1
- package/dist/chunks/detectRepository-CWI2xcdR.js +1 -0
- package/dist/chunks/{diff-CcrSQNvQ.js → diff-BA2vN7sD.js} +1 -1
- package/dist/chunks/{directoryCompletion-i2oWpaUe.js → directoryCompletion-CLcmLin8.js} +1 -1
- package/dist/chunks/doctor-BV6zhneX.js +1 -0
- package/dist/chunks/{entry-oVZ7Z59B.js → entry-cou5DS53.js} +2 -2
- package/dist/chunks/{esm-BZciQG9N.js → esm-D9-9wS1F.js} +1 -1
- package/dist/chunks/{execFileNoThrow-DYm1GeGn.js → execFileNoThrow-BHDSgTpZ.js} +1 -1
- package/dist/chunks/{execSyncWrapper-CqvQqke-.js → execSyncWrapper-pYxQXqb-.js} +1 -1
- package/dist/chunks/{exit-jikLI2Zh.js → exit-DdZJHhy2.js} +1 -1
- package/dist/chunks/{extraUsage-BT3in1Aj.js → extraUsage-CHnG6JNH.js} +1 -1
- package/dist/chunks/extractMemories-DxGHxoNO.js +1 -0
- package/dist/chunks/fast-Bf-g-wR6.js +1 -0
- package/dist/chunks/{fast-CKhtBOx7.js → fast-Bl_0cs9e.js} +1 -1
- package/dist/chunks/{fetchModelList-DmaMgpa2.js → fetchModelList-CheIBH5f.js} +1 -1
- package/dist/chunks/fetchModelList-vk-RMDfG.js +1 -0
- package/dist/chunks/{fileSuggestions-BfG3sbET.js → fileSuggestions-Dl87JhBr.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-Q3fMF0BR.js → firstPartyEventLogger-Cw9Bc3on.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-DvsZdBy2.js +1 -0
- package/dist/chunks/flushGate-BD3Tk3_k.js +1 -0
- package/dist/chunks/{gemini-L8Gj2B4H.js → gemini-BARUjH_t.js} +1 -1
- package/dist/chunks/{generateSessionName-cAL5T7pG.js → generateSessionName-CHaK44K-.js} +1 -1
- package/dist/chunks/{genericProcessUtils-Bbcbi11g.js → genericProcessUtils-D5hCZ2ho.js} +1 -1
- package/dist/chunks/git-Bujlb5tq.js +1 -0
- package/dist/chunks/{git-DplvjXEY.js → git-CNhyfMtb.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-Px3_GeD1.js → githubRepoPathMapping-Dhz4cvw2.js} +1 -1
- package/dist/chunks/{goal-D-x2WXm7.js → goal-fTQFogdl.js} +1 -1
- package/dist/chunks/{grok-DtypRM4d.js → grok-D0J4IiCe.js} +1 -1
- package/dist/chunks/{grove-CSivzrhe.js → grove-mDH4wkhM.js} +1 -1
- package/dist/chunks/{help-DKZhC0lL.js → help-Dr7st1Yv.js} +1 -1
- package/dist/chunks/hooks-C5YSYzSl.js +1 -0
- package/dist/chunks/{hooks-D_afUDcs.js → hooks-DCfpFhl2.js} +1 -1
- package/dist/chunks/{initReplBridge-sTaq4a0K.js → initReplBridge-BFYTAFlT.js} +1 -1
- package/dist/chunks/{install-BWe3Jz4M.js → install-CjacxFXg.js} +1 -1
- package/dist/chunks/{instrumentation-IljwxX0V.js → instrumentation-DS2S1m1a.js} +3 -3
- package/dist/chunks/{job-N25KhSUu.js → job-Dry-GMc5.js} +1 -1
- package/dist/chunks/{jwtUtils-YCoZL0FW.js → jwtUtils-ClCcC8lO.js} +1 -1
- package/dist/chunks/{keybindings-DLEorhlY.js → keybindings-D01jzjKu.js} +1 -1
- package/dist/chunks/{launchLocalMemory-DJsuNLIf.js → launchLocalMemory-_T0oHfh9.js} +1 -1
- package/dist/chunks/{launchOnboarding-CVvuxeH-.js → launchOnboarding-D4fS6pLc.js} +1 -1
- package/dist/chunks/{external-CEp-aPkt.js → lazySchema-DULtBUCI.js} +1 -1
- package/dist/chunks/{loadAgentsDir-CbtNPJV3.js → loadAgentsDir-DnsldjYU.js} +560 -560
- package/dist/chunks/loadAgentsDir-xG1HswS_.js +1 -0
- package/dist/chunks/{loadPluginHooks-BxkDBFd6.js → loadPluginHooks-CRoYa_il.js} +1 -1
- package/dist/chunks/loader-C-PQ3onD.js +1 -0
- package/dist/chunks/localSearch-B17Mzd84.js +1 -0
- package/dist/chunks/{localSearch-B5mTHBwK.js → localSearch-nuNjYVKq.js} +1 -1
- package/dist/chunks/{log-BlJ7CcKG.js → log-CR0v5KUR.js} +1 -1
- package/dist/chunks/{logoV2Utils-D5nRpirL.js → logoV2Utils-CZwL_VX1.js} +1 -1
- package/dist/chunks/{magicDocs-C9aIo4Oe.js → magicDocs-D0rjtxup.js} +1 -1
- package/dist/chunks/{main-DeUt_aE2.js → main-C8n_p7yX.js} +11 -11
- package/dist/chunks/{main-Zh18lf2J.js → main-DKqCPH3G.js} +2 -2
- package/dist/chunks/managedEnv-C7bVtcgA.js +1 -0
- package/dist/chunks/managedEnv-d7HliQYg.js +1 -0
- package/dist/chunks/{mappers-Del1KoA7.js → mappers-BIDALdjB.js} +1 -1
- package/dist/chunks/{mcp-nnBVM5Lt.js → mcp-BcEApfqn.js} +1 -1
- package/dist/chunks/{mcp-D7vMhEOV.js → mcp-CBbVcOTy.js} +1 -1
- package/dist/chunks/{mcp-Bh3MNBIj.js → mcp-DYtfHeRa.js} +3 -3
- package/dist/chunks/{memoize-_2f7NWDv.js → memoize-C7xmvAQ0.js} +1 -1
- package/dist/chunks/{memory-DtqQhHu8.js → memory-CijapyZk.js} +1 -1
- package/dist/chunks/{mode-DPbrxU32.js → mode-CajUX4Uz.js} +1 -1
- package/dist/chunks/model-CyF5u3zH.js +1 -0
- package/dist/chunks/model-DaYZWYJe.js +1 -0
- package/dist/chunks/model-xI2MbgRj.js +1 -0
- package/dist/chunks/{modelOptions-SMq3one0.js → modelOptions-Ct80yABl.js} +1 -1
- package/dist/chunks/{nativeInstaller-DTJ4clp-.js → nativeInstaller-C6aWHxve.js} +1 -1
- package/dist/chunks/{omit-CMldTqqy.js → omit-BhPlISSj.js} +1 -1
- package/dist/chunks/{onChangeAppState-EAnsmOuo.js → onChangeAppState-BOJd4Yce.js} +1 -1
- package/dist/chunks/{openai-D9KvLMrj.js → openai-wsPCDwGL.js} +1 -1
- package/dist/chunks/{panel-Bg_0PHE6.js → panel-BKMLX5AR.js} +1 -1
- package/dist/chunks/parser-B-QFQfSO.js +1 -0
- package/dist/chunks/{parser-a2S_eFyE.js → parser-Dy-RMf4a.js} +1 -1
- package/dist/chunks/{partition-B8Y4jvjW.js → partition-_qZZlGjS.js} +1 -1
- package/dist/chunks/{permissions-cDtIZRM1.js → permissions-CcjGscyg.js} +1 -1
- package/dist/chunks/{pidLock-Br3_YNi_.js → pidLock-Cm9FWa4w.js} +2 -2
- package/dist/chunks/{plan-dG2H4eQl.js → plan-CTiLy_c4.js} +1 -1
- package/dist/chunks/{platform-DVeTi9mp.js → platform-BZm4WVLM.js} +1 -1
- package/dist/chunks/{plugin-CzQHuIlP.js → plugin-D7vjs6Hu.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-B9W_vxOG.js → pluginAutoupdate-DzK-fXJC.js} +1 -1
- package/dist/chunks/{pluginBlocklist-BvdBsnJG.js → pluginBlocklist-B3JVl1h2.js} +1 -1
- package/dist/chunks/{pluginCliCommands-NKIgFTUF.js → pluginCliCommands-CubOvlhc.js} +1 -1
- package/dist/chunks/{pluginFlagging-C0PtAJEg.js → pluginFlagging-Dp7W2eL8.js} +1 -1
- package/dist/chunks/{pluginOperations-wUUdFpu9.js → pluginOperations-BxHoy0pC.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-p0njap1l.js → pluginStartupCheck-CL24_zVV.js} +1 -1
- package/dist/chunks/pluginStartupCheck-CtX6QkdO.js +1 -0
- package/dist/chunks/{plugins-B9WBqOAW.js → plugins-DA3lpRU4.js} +1 -1
- package/dist/chunks/pollConfig-2nFzv6Hy.js +1 -0
- package/dist/chunks/poorMode-DyAWNRRM.js +1 -0
- package/dist/chunks/{poorMode-wm2WkPF0.js → poorMode-aMzKXz6G.js} +1 -1
- package/dist/chunks/{print-G3DgPTxy.js → print-BrqZ3AgP.js} +5 -5
- package/dist/chunks/{processBashCommand-zLWgCRws.js → processBashCommand-C6mBgRVz.js} +1 -1
- package/dist/chunks/{processSlashCommand-BHBnHBjj.js → processSlashCommand-t0-BVku8.js} +1 -1
- package/dist/chunks/prompt-BJ3xYAvE.js +1 -0
- package/dist/chunks/{prompt-BRGC5U9Y.js → prompt-CzQkcxfg.js} +3 -3
- package/dist/chunks/prompt-Di2lNwYp.js +1 -0
- package/dist/chunks/{promptEditor-CRIw6vJS.js → promptEditor-C6w1vT5E.js} +1 -1
- package/dist/chunks/{protocolHandler--eQQuSyx.js → protocolHandler-B3bQyB6W.js} +1 -1
- package/dist/chunks/{proxy-C0j74LqT.js → proxy-DFIxRT0i.js} +1 -1
- package/dist/chunks/{reconciler-DiU1RvGD.js → reconciler-p4lAu9ft.js} +1 -1
- package/dist/chunks/{refresh-DEXe3Lmx.js → refresh-DCQChX5A.js} +1 -1
- package/dist/chunks/{registerProtocol-DrWIX3Lb.js → registerProtocol-CrzdmgCD.js} +1 -1
- package/dist/chunks/{reload-plugins-Cl6wvT6V.js → reload-plugins-BnZzcRcd.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-DnFZoXaw.js → remoteBridgeCore-DAK9KSWp.js} +1 -1
- package/dist/chunks/remoteManagedSettings-DkLfclxa.js +1 -0
- package/dist/chunks/{rename-CdzxOzN5.js → rename-OSN3Ua2J.js} +1 -1
- package/dist/chunks/{renderOptions-CkqTbz6d.js → renderOptions-XgkOdKCJ.js} +1 -1
- package/dist/chunks/{resume-DgFXYWTN.js → resume-K9q5B1li.js} +1 -1
- package/dist/chunks/{ripgrep-DsLUmulz.js → ripgrep-C_XuTqp3.js} +1 -1
- package/dist/chunks/ripgrep-DLPH9MP9.js +1 -0
- package/dist/chunks/{runtimeObserver-CwtRE2cj.js → runtimeObserver-CuTsWhhF.js} +1 -1
- package/dist/chunks/{runtimeObserver-Dov-m2dl.js → runtimeObserver-D9sujsqj.js} +2 -2
- package/dist/chunks/sandbox-adapter-CRxZBMAP.js +1 -0
- package/dist/chunks/{sandbox-toggle-DWCrG9zV.js → sandbox-toggle-oasrWfbj.js} +1 -1
- package/dist/chunks/searchExtraTools-BAYzzTE8.js +1 -0
- package/dist/chunks/{session-L5191BSn.js → session-c46jULDV.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-CwnjOk6S.js +1 -0
- package/dist/chunks/{sessionObserver-DpY0DOjI.js → sessionObserver-Cu7vykWp.js} +1 -1
- package/dist/chunks/sessionObserver-DNjDoJmy.js +1 -0
- package/dist/chunks/{sessionState-BlbRQ3Y6.js → sessionState-B3tFm9SC.js} +1 -1
- package/dist/chunks/sessionStorage-CVZ0MUSE.js +1 -0
- package/dist/chunks/{sessionTracing-DqVx8aFD.js → sessionTracing-BRp_Ej-e.js} +1 -1
- package/dist/chunks/{settings-CvhsRFaT.js → settings-DUyIag_5.js} +4 -4
- package/dist/chunks/settings-DsqFBv6J.js +1 -0
- package/dist/chunks/settingsSync-yE43qjMS.js +1 -0
- package/dist/chunks/{setup-DvnKMqDy.js → setup-CFOc-hPM.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-Gerk3t93.js → shadowedRuleDetection-ChoqK1Iq.js} +1 -1
- package/dist/chunks/{shellQuote-D3Ocv_U-.js → shellQuote-C-7PluUY.js} +1 -1
- package/dist/chunks/{sideQuestion-RndkXExy.js → sideQuestion-CkC27Pf3.js} +1 -1
- package/dist/chunks/sinks-B64r_OBE.js +1 -0
- package/dist/chunks/{sinks-CfzgqLH5.js → sinks-C9qCsi94.js} +1 -1
- package/dist/chunks/{skillChangeDetector-BQx4xe_b.js → skillChangeDetector-CLnn22Jo.js} +1 -1
- package/dist/chunks/{skillGapStore-CLxhWLyq.js → skillGapStore-DC8s2Whn.js} +2 -2
- package/dist/chunks/{skillLifecycle-CSNX2qOH.js → skillLifecycle-BaqH5lw_.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CsQDjy_E.js → skillSearchPanel-Dtvyo2Dk.js} +2 -2
- package/dist/chunks/{skills-DM9ACPW-.js → skills-DXW57WeY.js} +1 -1
- package/dist/chunks/{startupProfiler-2sjXZkIP.js → startupProfiler-BqUlQEaV.js} +1 -1
- package/dist/chunks/startupProfiler-yBU6FaAV.js +1 -0
- package/dist/chunks/{state-BPFYBqm1.js → state-B3zvBu4R.js} +1 -1
- package/dist/chunks/state-mHtumqEo.js +1 -0
- package/dist/chunks/{stats-Dq-5qizS.js → stats-vvwEVnon.js} +1 -1
- package/dist/chunks/status--Ql7l0VG.js +1 -0
- package/dist/chunks/{status-C5v7KsX4.js → status-g_dhM6Ep.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-BY_8pK19.js → statusNoticeHelpers-B235FWru.js} +1 -1
- package/dist/chunks/{stringUtils-BjnclTLB.js → stringUtils-CGZoOfer.js} +1 -1
- package/dist/chunks/switcher-Cb9R9247.js +1 -0
- package/dist/chunks/switcher-OAeeTHHt.js +1 -0
- package/dist/chunks/{syncCache-Dff4hbz4.js → syncCache-BiqQEess.js} +1 -1
- package/dist/chunks/{tasks-qVyXOLBf.js → tasks--7yJk7MD.js} +1 -1
- package/dist/chunks/{teleport-Deq_ecN9.js → teleport-ja50aVy3.js} +1 -1
- package/dist/chunks/{templateJobs-CntPyct-.js → templateJobs-DSM3tNDS.js} +1 -1
- package/dist/chunks/{terminalSetup-JJiXmszo.js → terminalSetup-BpZXqE_G.js} +1 -1
- package/dist/chunks/{terminalSetup-DDvQ0K5e.js → terminalSetup-C735-5lZ.js} +1 -1
- package/dist/chunks/{theme-DVWYzSct.js → theme-BX54e0r7.js} +1 -1
- package/dist/chunks/{tmux-g0cQ0Buz.js → tmux-BIdWN33b.js} +1 -1
- package/dist/chunks/{toolEventObserver-BZn8ZJB5.js → toolEventObserver-O6ljakS9.js} +1 -1
- package/dist/chunks/{toolPool-Dzp1ob3I.js → toolPool-H_kXc8vo.js} +1 -1
- package/dist/chunks/trustedDevice-Dm_SY3Ko.js +1 -0
- package/dist/chunks/{trustedDevice-CdLAZK6m.js → trustedDevice-Kyid5Fuy.js} +1 -1
- package/dist/chunks/{types-BomO8WUz.js → types-DDku8UKF.js} +2 -2
- package/dist/chunks/{udsClient-DSvRPCvR.js → udsClient-B2yCKNgT.js} +1 -1
- package/dist/chunks/{upstreamproxy-DYoLvdM9.js → upstreamproxy--RTAcgrE.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-YSWYVWk6.js → useExitOnCtrlCDWithKeybindings-BnmDpMkm.js} +1 -1
- package/dist/chunks/useMainLoopModel-DG8pghH7.js +1 -0
- package/dist/chunks/{useManagePlugins-DfuI4Nhd.js → useManagePlugins-HMHtjIY-.js} +1 -1
- package/dist/chunks/{useMergedTools-B4qRVJ8b.js → useMergedTools-ChLA8dsy.js} +1 -1
- package/dist/chunks/{useSearchInput-DfUNYhqC.js → useSearchInput-DqymtQhH.js} +1 -1
- package/dist/chunks/{useSettingsErrors-Bls74ocI.js → useSettingsErrors-Bs9uyzW4.js} +1 -1
- package/dist/chunks/{userAgent-CNPTS7ix.js → userAgent-D8vvjitA.js} +1 -1
- package/dist/chunks/{util-6aJHnBQ_.js → util-CC-NRn16.js} +1 -1
- package/dist/chunks/validatePlugin-yCb8gsVF.js +1 -0
- package/dist/chunks/{vim-s-wmybpU.js → vim-CIK2DjfK.js} +1 -1
- package/dist/chunks/{which-BR8YVCCW.js → which-3MmqfsNV.js} +1 -1
- package/dist/chunks/windowsPaths-Dd_S96Bq.js +1 -0
- package/dist/chunks/{windowsPaths-BmXyrasP.js → windowsPaths-x-CxdtFP.js} +1 -1
- package/dist/chunks/{workSecret-BUd8cQ6-.js → workSecret-BsolC5S7.js} +1 -1
- package/dist/chunks/{workerRegistry-BwJ54Lzk.js → workerRegistry-DE4Ghp-n.js} +2 -2
- package/dist/chunks/worktree-D-CgffvU.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog--D4BeNAN.js +0 -1
- package/dist/chunks/ApproveApiKey-lv4Sg0RR.js +0 -1
- package/dist/chunks/Doctor-V-JLC4e3.js +0 -1
- package/dist/chunks/REPL-B7evbhvN.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-CddjJcAH.js +0 -1
- package/dist/chunks/api-BAT--5sp.js +0 -1
- package/dist/chunks/auth-DaJXqwN5.js +0 -1
- package/dist/chunks/auth-DkhPycBL.js +0 -1
- package/dist/chunks/backgroundHousekeeping-V-dg2j2E.js +0 -1
- package/dist/chunks/bridgeConfig-D31i4BRi.js +0 -1
- package/dist/chunks/bridgePointer-CiHy2tTN.js +0 -1
- package/dist/chunks/bridgeStatusUtil-mvVQSVN-.js +0 -1
- package/dist/chunks/caches-ByLjTvdy.js +0 -1
- package/dist/chunks/caches-ckqJ4Qso.js +0 -1
- package/dist/chunks/client-Bl43xcRk.js +0 -1
- package/dist/chunks/client-Pap_HyZZ.js +0 -1
- package/dist/chunks/client-zhozU2ws.js +0 -1
- package/dist/chunks/commands-BDhn7EPO.js +0 -1
- package/dist/chunks/config-CbAvTdZ7.js +0 -1
- package/dist/chunks/context-noninteractive-ulRLlYg5.js +0 -1
- package/dist/chunks/conversation-D08lU377.js +0 -1
- package/dist/chunks/createSession-CnlPXXkA.js +0 -1
- package/dist/chunks/cwd-DpqwaYHw.js +0 -1
- package/dist/chunks/detectRepository-tRUoPOKy.js +0 -1
- package/dist/chunks/doctor-DRFDBrH1.js +0 -1
- package/dist/chunks/extractMemories-BsQU2bVO.js +0 -1
- package/dist/chunks/fast-B9vVL3sY.js +0 -1
- package/dist/chunks/fetchModelList-BeL40TyR.js +0 -1
- package/dist/chunks/firstPartyEventLogger-6GwZ6VLr.js +0 -1
- package/dist/chunks/flushGate-COa_KO98.js +0 -1
- package/dist/chunks/git-BaSq69E7.js +0 -1
- package/dist/chunks/hooks-DvVuNKRx.js +0 -1
- package/dist/chunks/lazySchema-B4D4qJVE.js +0 -1
- package/dist/chunks/loadAgentsDir-D0gl_H2S.js +0 -1
- package/dist/chunks/localSearch-D3UrYUre.js +0 -1
- package/dist/chunks/managedEnv-ADMKY7-G.js +0 -1
- package/dist/chunks/managedEnv-CDxyrUw1.js +0 -1
- package/dist/chunks/model-B50j-O5v.js +0 -1
- package/dist/chunks/model-DLG1nrnf.js +0 -1
- package/dist/chunks/model-DlLO7TSx.js +0 -1
- package/dist/chunks/parser-x-w3ikxt.js +0 -1
- package/dist/chunks/pluginStartupCheck-hDT6pEAd.js +0 -1
- package/dist/chunks/pollConfig-BgpfHQPJ.js +0 -1
- package/dist/chunks/poorMode-DD88nPJ4.js +0 -1
- package/dist/chunks/prompt-Ct3Ryb3C.js +0 -1
- package/dist/chunks/prompt-TZJKyomz.js +0 -1
- package/dist/chunks/remoteManagedSettings-BboLJ46D.js +0 -1
- package/dist/chunks/ripgrep-Di-2j8Ws.js +0 -1
- package/dist/chunks/sandbox-adapter-CtEngx-6.js +0 -1
- package/dist/chunks/searchExtraTools-zFMN5MqY.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-C2VjT-PU.js +0 -1
- package/dist/chunks/sessionObserver-BuhXr3FP.js +0 -1
- package/dist/chunks/sessionStorage-CiYSwyY3.js +0 -1
- package/dist/chunks/settings-BgHApyGL.js +0 -1
- package/dist/chunks/settingsSync-BhlegQAU.js +0 -1
- package/dist/chunks/sinks-Cf4vx9UX.js +0 -1
- package/dist/chunks/startupProfiler-B2fyaBEa.js +0 -1
- package/dist/chunks/state-CsdHk8n-.js +0 -1
- package/dist/chunks/status-C3z0CSBw.js +0 -1
- package/dist/chunks/switcher-C9VsM-ip.js +0 -1
- package/dist/chunks/switcher-CnBKuiNp.js +0 -1
- package/dist/chunks/trustedDevice-1Q4FTNyX.js +0 -1
- package/dist/chunks/useMainLoopModel-C1JRp4zE.js +0 -1
- package/dist/chunks/validatePlugin-BajM6yNf.js +0 -1
- package/dist/chunks/windowsPaths-BybjGW7e.js +0 -1
- package/dist/chunks/worktree-BFP10vim.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{B as a,F as o,P as s,R as c,U as l,c as u,f as d,i as f,nt as p,tt as ee,u as te,x as ne}from"./debug-BQj6h99Q.js";import{Kt as re,Yt as ie}from"./settings-CvhsRFaT.js";import{C as m,S as ae,c as oe,h as se,x as ce,y as le}from"./config-BSkuQZNf.js";import{n as h,r as g}from"./execFileNoThrow-DYm1GeGn.js";import{o as _,s as v}from"./log-BlJ7CcKG.js";import{n as y,r as b}from"./analytics-DJobLaWP.js";import{dn as x,fn as ue}from"./model-DlLO7TSx.js";import{_t as de,gt as fe,vt as pe}from"./sessionState-BlbRQ3Y6.js";import{ft as me,ut as he}from"./esm-BZciQG9N.js";import{C as ge,E as _e,S as ve,T as ye,_ as be,a as S,b as xe,c as Se,d as Ce,f as we,g as Te,i as Ee,l as De,m as Oe,n as ke,o as C,p as Ae,s as je,t as Me,u as Ne,v as Pe,w as Fe,x as w,y as Ie}from"./pidLock-Br3_YNi_.js";import{homedir as T}from"os";import{basename as Le,delimiter as Re,dirname as E,join as D,resolve as O}from"path";import{constants as ze}from"fs";import{createHash as Be}from"crypto";import{access as k,chmod as A,copyFile as j,mkdir as M,readdir as N,readlink as P,rename as F,rm as I,rmdir as Ve,stat as L,symlink as He,unlink as R,writeFile as z}from"fs/promises";async function Ue(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return b(`tengu_version_check_success`,{latency_ms:Date.now()-i}),a.data.trim()}catch(n){let a=Date.now()-i,o=n instanceof Error?n.message:String(n),s;r.isAxiosError(n)&&n.response&&(s=n.response.status),b(`tengu_version_check_failure`,{latency_ms:a,http_status:s,is_timeout:o.includes(`timeout`)});let c=Error(`Failed to fetch version from ${t}/${e}: ${o}`);throw v(c),c}}async function We(e){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(e)){let t=e.startsWith(`v`)?e.slice(1):e;if(/^99\.99\./.test(t))throw Error(`Version ${t} is not available for installation. Use 'stable' or 'latest'.`);return t}let t=e;if(t!==`stable`&&t!==`latest`)throw Error(`Invalid channel: ${e}. Use 'stable' or 'latest'`);return Ue(t,B)}function Ge(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||V}async function Ke(e,t,n,i={}){let a;for(let o=1;o<=3;o++){let s=new AbortController,c,d=()=>{c&&(clearTimeout(c),c=void 0)},f=()=>{d(),c=setTimeout(e=>e.abort(),Ge(),s)};try{f();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{f()},...i});d();let o=Be(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await z(n,Buffer.from(a.data)),await A(n,493);return}catch(e){d();let t=r.isCancel(e);if(a=t?new H:l(e),t&&o<3){u(`Download stalled on attempt ${o}/3, retrying...`),await ue(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function qe(e,t,n,i){let a=te();await a.rm(t,{recursive:!0,force:!0});let o=U(),s=Date.now();b(`tengu_binary_download_attempt`,{});let c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){let i=Date.now()-s,a=t instanceof Error?t.message:String(t),o;throw r.isAxiosError(t)&&t.response&&(o=t.response.status),b(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),v(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw b(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=W(o),f=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let p=D(t,d);try{await Ke(f,u,p,i||{}),b(`tengu_binary_download_success`,{latency_ms:Date.now()-s})}catch(e){let t=Date.now()-s,n=e instanceof Error?e.message:String(e),i;throw r.isAxiosError(e)&&e.response&&(i=e.response.status),b(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),v(Error(`Failed to download binary from ${f}: ${n}`)),e}}async function Je(e,t){return await qe(e,t,B),`binary`}var B,V,H,Ye=e((()=>{i(),y(),f(),c(),g(),d(),_(),x(),ne(),$(),B=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,V=6e4,H=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function U(){let e=re.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw u(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&he.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function W(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function G(){let e=W(U());return{versions:D(Ce(),`claude`,`versions`),staging:D(Ne(),`claude`,`staging`),locks:D(we(),`claude`,`locks`),executable:D(De(),e)}}async function K(e){try{let t=await L(e);return!t.isFile()||t.size===0?!1:(await k(e,ze.X_OK),!0)}catch{return!1}}async function q(e){let t=G(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>M(e,{recursive:!0}))),await M(E(t.executable),{recursive:!0});let r=D(t.versions,e);try{await L(r)}catch{await z(r,``,{encoding:`utf8`})}return{stagingPath:D(t.staging,e),installPath:r}}async function Xe(e,t,n=0){let r=G(),i=J(r,e);if(await M(r.locks,{recursive:!0}),C()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await Se(e,i,async()=>{try{await t()}catch(e){throw v(e),e}}))return b(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await ue(Math.min(o*2**(r-1),s))}return b(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),Y(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await m(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{u(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return b(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),Y(e,t),!1}try{return await t(),b(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw v(e),e}}finally{a&&await a()}}async function Ze(e,t){await M(E(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await j(e,n),await A(n,493),await F(n,t),u(`Atomically installed binary to ${t}`)}catch(e){try{await R(n)}catch{}throw e}}async function Qe(e,t){try{let n=D(e,`node_modules`,`@anthropic-ai`),r=(await N(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw b(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=D(n,r,`cli`);try{await L(i)}catch{throw b(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await Ze(i,t),await I(e,{recursive:!0,force:!0}),b(`tengu_native_install_package_success`,{})}catch(e){let t=s(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&b(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),v(l(e)),e}}async function $e(e,t){try{let n=D(e,W(U()));try{await L(n)}catch{throw b(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await Ze(n,t),await I(e,{recursive:!0,force:!0}),b(`tengu_native_install_binary_success`,{})}catch(e){throw s(e).includes(`Staged binary not found`)||b(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),v(l(e)),e}}async function et(e,t,n){n===`npm`?await Qe(e,t):await $e(e,t)}async function tt(e,n){let{stagingPath:r,installPath:i}=await q(e),{executable:a}=G(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await nt(e)||n;if(s?(u(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await et(o,i,await Je(e,o))):u(`Version ${e} already installed, updating symlink`),await it(a),await at(a,i),!await K(a)){let e=!1;try{await L(i),e=!0}catch{}throw Error(`Failed to create executable at ${a}. Source file exists: ${e}. Check write permissions to ${a}.`)}return s}async function nt(e){let{installPath:t}=await q(e);return K(t)}async function rt(e,n=!1){let r=Date.now(),i=await We(e),{executable:a}=G();if(u(`Checking for native installer update to version ${i}`),!n){let e=await be();if(e&&fe(i,e)){if(u(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),de(`0.0.17`,e))return u(`Native installer: current version 0.0.17 is already at or above maxVersion ${e}, skipping update`),b(`tengu_native_update_skipped_max_version`,{latency_ms:Date.now()-r,max_version:e,available_version:i}),{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.17`&&await nt(i)&&await K(a))return u(`Found ${i} at ${a}, skipping install`),b(`tengu_native_update_complete`,{latency_ms:Date.now()-r,was_new_install:!1,was_force_reinstall:!1,was_already_running:!0}),{success:!0,latestVersion:i};if(!n&&Ie(i))return b(`tengu_native_update_skipped_minimum_version`,{latency_ms:Date.now()-r,target_version:i}),{success:!0,latestVersion:i};let o=!1,s;if(t(process.env.ENABLE_LOCKLESS_UPDATES))o=await tt(i,n),s=Date.now()-r;else{let{installPath:e}=await q(i);n&&await dt(e);let t=await Xe(e,async()=>{o=await tt(i,n)},3);if(s=Date.now()-r,!t){let t=G(),n;if(C()){let r=J(t,e);S(r)&&(n=je(r)?.pid)}return b(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return b(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),u(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function it(e){try{await Ve(e),u(`Removed empty directory at ${e}`)}catch(t){let n=o(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&u(`Could not remove directory at ${e}: ${t}`)}}async function at(e,t){if(U().startsWith(`win32`))try{await M(E(e),{recursive:!0});let n;try{n=await L(e)}catch{}if(n){try{let e=await L(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await F(e,r);try{await j(t,e);try{await R(r)}catch{}}catch(t){try{await F(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw v(n),n}throw t}}else try{await j(t,e)}catch(e){throw a(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return v(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=E(e);try{await M(n,{recursive:!0}),u(`Created directory ${n} for symlink`)}catch(e){return v(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await L(e),n=!0}catch{}if(n){try{let n=await P(e);if(O(E(e),n)===O(t))return!1}catch{}await R(e)}}catch(e){v(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await He(t,r),await F(r,e),u(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await R(r)}catch{}return v(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function ot(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await Oe();if(n===`development`||!(e||n===`native`))return[];let r=G(),i=[],o=E(r.executable),s=O(o),c=U().startsWith(`win32`);try{await k(o)}catch{i.push({message:`installMethod is native, but directory ${o} does not exist`,userActionRequired:!0,type:`error`})}if(c)await K(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await P(r.executable);await K(O(E(r.executable),e))||i.push({message:`Work Mate symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){a(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await K(r.executable)||i.push({message:`${r.executable} exists but is not a valid Work Mate binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Re).some(e=>{try{let t=O(e);return c?t.toLowerCase()===s.toLowerCase():t===s}catch{return!1}}))if(c){let e=o.replace(/\//g,`\\`);i.push({message:`Native installation exists but ${e} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:`path`})}else{let e=ye(),t=w()[e],n=t?t.replace(T(),`~`):`your shell config file`;i.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run:\n\necho 'export PATH="$HOME/.local/bin:$PATH"' >> ${n} && source ${n}`,userActionRequired:!0,type:`path`})}return i}function st(e,t=!1){if(t)return ct(e,t);if(Q)return u(`installLatest: joining in-flight call`),Q;let n=ct(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function ct(e,t=!1){let n=await rt(e,t);return n.success?(oe().installMethod!==`native`&&(le(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),u(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),X(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function lt(e){try{let t=await P(e),n=O(E(e),t);if(await K(n))return n}catch{}return null}function J(e,t){let n=Le(t);return D(e.locks,`${n}.lock`)}async function ut(){let e=G();if(!process.execPath.includes(e.versions))return;let t=O(process.execPath);try{let n=J(e,t);if(await M(e.locks,{recursive:!0}),C()){if(!await Me(t,n)){b(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),Y(t,Error(`Lock already held by another process`));return}b(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),u(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await m(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{u(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),b(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),u(`Acquired mtime-based lock on running version: ${t}`),p(async()=>{try{await e?.()}catch{}})}catch(e){if(a(e)){u(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}b(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),Y(t,e);return}}}catch(e){if(a(e)){u(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}u(`NON-FATAL: Failed to lock current version during execution ${s(e)}`,{level:`info`})}}function Y(e,t){v(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function dt(e){let t=J(G(),e);try{await R(t),u(`Force-removed lock file at ${t}`)}catch(e){u(`Failed to force-remove lock file: ${s(e)}`)}}async function X(){await Promise.resolve();let e=G(),t=Date.now()-36e5;if(U().startsWith(`win32`)){let t=E(e.executable);try{let e=await N(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await R(D(t,r)),n++}catch{}n>0&&u(`Cleaned up ${n} old Windows executables on startup`)}catch(e){a(e)||u(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await N(e.staging),r=0;for(let i of n){let n=D(e.staging,i);try{(await L(n)).mtime.getTime()<t&&(await I(n,{recursive:!0,force:!0}),r++,u(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(u(`Cleaned up ${r} orphaned staging directories`),b(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){a(e)||u(`Failed to clean up staging directories: ${e}`)}if(C()){let t=ke(e.locks);t>0&&(u(`Cleaned up ${t} stale version locks`),b(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await N(e.versions)}catch(e){a(e)||u(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=D(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await L(n)).mtime.getTime()<t&&(await R(n),i++,u(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await L(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:O(n),mtime:e.mtime})}catch{}}if(i>0&&(u(`Cleaned up ${i} orphaned temp install files`),b(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t?.includes(e.versions)&&n.add(O(t));let i=await lt(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=J(e,t.resolvedPath),i=!1;if(C())i=S(r);else try{i=await ce(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),u(`Protecting locked version from cleanup: ${t.name}`))}let a=r.filter(e=>!n.has(e.resolvedPath)).sort((e,t)=>t.mtime.getTime()-e.mtime.getTime()).slice(2);if(a.length===0){b(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:0,protected_count:n.size,retained_count:2,lock_failed_count:0,error_count:0});return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await Xe(e.path,async()=>{await R(e.path)})?o++:(s++,u(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,v(Error(`Failed to delete version ${e.name}: ${t}`))}})),b(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:o,protected_count:n.size,retained_count:2,lock_failed_count:s,error_count:c})}catch(e){a(e)||v(Error(`Version cleanup failed: ${e}`))}}async function ft(){let e=[],t=w();for(let[n,r]of Object.entries(t))try{let t=await ge(r);if(!t)continue;let{filtered:i,hadAlias:a}=xe(t);a&&(await Fe(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),u(`Cleaned up claude alias from ${n} config`))}catch(t){v(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function pt(e){try{let t=await h(`npm`,[`config`,`get`,`prefix`]);if(t.code!==0||!t.stdout)return{success:!1,error:`Failed to get npm global prefix`};let n=t.stdout.trim(),r=!1;async function i(e,t){try{return await R(e),u(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(U().startsWith(`win32`)){let e=D(n,`claude.cmd`),t=D(n,`claude.ps1`),a=D(n,`claude`);await i(e,`bin script`)&&(r=!0),await i(t,`PowerShell script`)&&(r=!0),await i(a,`bin executable`)&&(r=!0)}else await i(D(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(u(`Successfully removed ${e} manually`),{success:!0,warning:`${e} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${U().startsWith(`win32`)?D(n,`node_modules`,e):D(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return u(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function mt(e){let{code:t,stderr:n}=await h(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return u(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){u(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),u(`Attempting manual removal due to ENOTEMPTY error`);let t=await pt(e);if(t.success)return{success:!0,warning:t.warning};if(t.error)return{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}. Manual removal also failed: ${t.error}`}}return u(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}`}}return{success:!1}}async function ht(){let e=[],t=[],n=0,r=await mt(`@anthropic-ai/workmate`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=D(T(),`.workmate`,`local`);try{await I(i,{recursive:!0}),n++,u(`Removed local installation at ${i}`)}catch(t){a(t)||(e.push(`Failed to remove ${i}: ${t}`),u(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{y(),Pe(),ee(),se(),f(),Te(),ie(),me(),n(),c(),g(),_e(),ae(),_(),pe(),ve(),x(),Ae(),Ye(),Ee(),Z=10080*60*1e3,Q=null})),gt=e((()=>{$()}));export{ft as a,ut as c,X as i,ot as n,$ as o,ht as r,st as s,gt as t};
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{B as a,F as o,P as s,R as c,U as l,c as u,f as d,i as f,nt as p,tt as ee,u as te,x as ne}from"./debug-D7OBvqC2.js";import{Kt as re,Yt as ie}from"./settings-DUyIag_5.js";import{C as m,S as ae,c as oe,h as se,x as ce,y as le}from"./config-BybjRr09.js";import{n as h,r as g}from"./execFileNoThrow-BHDSgTpZ.js";import{o as _,s as v}from"./log-CR0v5KUR.js";import{n as y,r as b}from"./analytics-DJobLaWP.js";import{dn as x,fn as ue}from"./model-xI2MbgRj.js";import{_t as de,gt as fe,vt as pe}from"./sessionState-B3tFm9SC.js";import{ft as me,ut as he}from"./esm-D9-9wS1F.js";import{C as ge,E as _e,S as ve,T as ye,_ as be,a as S,b as xe,c as Se,d as Ce,f as we,g as Te,i as Ee,l as De,m as Oe,n as ke,o as C,p as Ae,s as je,t as Me,u as Ne,v as Pe,w as Fe,x as w,y as Ie}from"./pidLock-Cm9FWa4w.js";import{homedir as T}from"os";import{basename as Le,delimiter as Re,dirname as E,join as D,resolve as O}from"path";import{constants as ze}from"fs";import{createHash as Be}from"crypto";import{access as k,chmod as A,copyFile as j,mkdir as M,readdir as N,readlink as P,rename as F,rm as I,rmdir as Ve,stat as L,symlink as He,unlink as R,writeFile as z}from"fs/promises";async function Ue(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return b(`tengu_version_check_success`,{latency_ms:Date.now()-i}),a.data.trim()}catch(n){let a=Date.now()-i,o=n instanceof Error?n.message:String(n),s;r.isAxiosError(n)&&n.response&&(s=n.response.status),b(`tengu_version_check_failure`,{latency_ms:a,http_status:s,is_timeout:o.includes(`timeout`)});let c=Error(`Failed to fetch version from ${t}/${e}: ${o}`);throw v(c),c}}async function We(e){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(e)){let t=e.startsWith(`v`)?e.slice(1):e;if(/^99\.99\./.test(t))throw Error(`Version ${t} is not available for installation. Use 'stable' or 'latest'.`);return t}let t=e;if(t!==`stable`&&t!==`latest`)throw Error(`Invalid channel: ${e}. Use 'stable' or 'latest'`);return Ue(t,B)}function Ge(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||V}async function Ke(e,t,n,i={}){let a;for(let o=1;o<=3;o++){let s=new AbortController,c,d=()=>{c&&(clearTimeout(c),c=void 0)},f=()=>{d(),c=setTimeout(e=>e.abort(),Ge(),s)};try{f();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{f()},...i});d();let o=Be(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await z(n,Buffer.from(a.data)),await A(n,493);return}catch(e){d();let t=r.isCancel(e);if(a=t?new H:l(e),t&&o<3){u(`Download stalled on attempt ${o}/3, retrying...`),await ue(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function qe(e,t,n,i){let a=te();await a.rm(t,{recursive:!0,force:!0});let o=U(),s=Date.now();b(`tengu_binary_download_attempt`,{});let c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){let i=Date.now()-s,a=t instanceof Error?t.message:String(t),o;throw r.isAxiosError(t)&&t.response&&(o=t.response.status),b(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),v(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw b(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=W(o),f=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let p=D(t,d);try{await Ke(f,u,p,i||{}),b(`tengu_binary_download_success`,{latency_ms:Date.now()-s})}catch(e){let t=Date.now()-s,n=e instanceof Error?e.message:String(e),i;throw r.isAxiosError(e)&&e.response&&(i=e.response.status),b(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),v(Error(`Failed to download binary from ${f}: ${n}`)),e}}async function Je(e,t){return await qe(e,t,B),`binary`}var B,V,H,Ye=e((()=>{i(),y(),f(),c(),g(),d(),_(),x(),ne(),$(),B=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,V=6e4,H=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function U(){let e=re.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw u(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&he.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function W(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function G(){let e=W(U());return{versions:D(Ce(),`claude`,`versions`),staging:D(Ne(),`claude`,`staging`),locks:D(we(),`claude`,`locks`),executable:D(De(),e)}}async function K(e){try{let t=await L(e);return!t.isFile()||t.size===0?!1:(await k(e,ze.X_OK),!0)}catch{return!1}}async function q(e){let t=G(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>M(e,{recursive:!0}))),await M(E(t.executable),{recursive:!0});let r=D(t.versions,e);try{await L(r)}catch{await z(r,``,{encoding:`utf8`})}return{stagingPath:D(t.staging,e),installPath:r}}async function Xe(e,t,n=0){let r=G(),i=J(r,e);if(await M(r.locks,{recursive:!0}),C()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await Se(e,i,async()=>{try{await t()}catch(e){throw v(e),e}}))return b(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await ue(Math.min(o*2**(r-1),s))}return b(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),Y(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await m(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{u(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return b(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),Y(e,t),!1}try{return await t(),b(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw v(e),e}}finally{a&&await a()}}async function Ze(e,t){await M(E(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await j(e,n),await A(n,493),await F(n,t),u(`Atomically installed binary to ${t}`)}catch(e){try{await R(n)}catch{}throw e}}async function Qe(e,t){try{let n=D(e,`node_modules`,`@anthropic-ai`),r=(await N(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw b(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=D(n,r,`cli`);try{await L(i)}catch{throw b(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await Ze(i,t),await I(e,{recursive:!0,force:!0}),b(`tengu_native_install_package_success`,{})}catch(e){let t=s(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&b(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),v(l(e)),e}}async function $e(e,t){try{let n=D(e,W(U()));try{await L(n)}catch{throw b(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await Ze(n,t),await I(e,{recursive:!0,force:!0}),b(`tengu_native_install_binary_success`,{})}catch(e){throw s(e).includes(`Staged binary not found`)||b(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),v(l(e)),e}}async function et(e,t,n){n===`npm`?await Qe(e,t):await $e(e,t)}async function tt(e,n){let{stagingPath:r,installPath:i}=await q(e),{executable:a}=G(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await nt(e)||n;if(s?(u(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await et(o,i,await Je(e,o))):u(`Version ${e} already installed, updating symlink`),await it(a),await at(a,i),!await K(a)){let e=!1;try{await L(i),e=!0}catch{}throw Error(`Failed to create executable at ${a}. Source file exists: ${e}. Check write permissions to ${a}.`)}return s}async function nt(e){let{installPath:t}=await q(e);return K(t)}async function rt(e,n=!1){let r=Date.now(),i=await We(e),{executable:a}=G();if(u(`Checking for native installer update to version ${i}`),!n){let e=await be();if(e&&fe(i,e)){if(u(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),de(`0.0.18`,e))return u(`Native installer: current version 0.0.18 is already at or above maxVersion ${e}, skipping update`),b(`tengu_native_update_skipped_max_version`,{latency_ms:Date.now()-r,max_version:e,available_version:i}),{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.18`&&await nt(i)&&await K(a))return u(`Found ${i} at ${a}, skipping install`),b(`tengu_native_update_complete`,{latency_ms:Date.now()-r,was_new_install:!1,was_force_reinstall:!1,was_already_running:!0}),{success:!0,latestVersion:i};if(!n&&Ie(i))return b(`tengu_native_update_skipped_minimum_version`,{latency_ms:Date.now()-r,target_version:i}),{success:!0,latestVersion:i};let o=!1,s;if(t(process.env.ENABLE_LOCKLESS_UPDATES))o=await tt(i,n),s=Date.now()-r;else{let{installPath:e}=await q(i);n&&await dt(e);let t=await Xe(e,async()=>{o=await tt(i,n)},3);if(s=Date.now()-r,!t){let t=G(),n;if(C()){let r=J(t,e);S(r)&&(n=je(r)?.pid)}return b(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return b(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),u(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function it(e){try{await Ve(e),u(`Removed empty directory at ${e}`)}catch(t){let n=o(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&u(`Could not remove directory at ${e}: ${t}`)}}async function at(e,t){if(U().startsWith(`win32`))try{await M(E(e),{recursive:!0});let n;try{n=await L(e)}catch{}if(n){try{let e=await L(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await F(e,r);try{await j(t,e);try{await R(r)}catch{}}catch(t){try{await F(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw v(n),n}throw t}}else try{await j(t,e)}catch(e){throw a(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return v(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=E(e);try{await M(n,{recursive:!0}),u(`Created directory ${n} for symlink`)}catch(e){return v(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await L(e),n=!0}catch{}if(n){try{let n=await P(e);if(O(E(e),n)===O(t))return!1}catch{}await R(e)}}catch(e){v(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await He(t,r),await F(r,e),u(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await R(r)}catch{}return v(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function ot(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await Oe();if(n===`development`||!(e||n===`native`))return[];let r=G(),i=[],o=E(r.executable),s=O(o),c=U().startsWith(`win32`);try{await k(o)}catch{i.push({message:`installMethod is native, but directory ${o} does not exist`,userActionRequired:!0,type:`error`})}if(c)await K(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await P(r.executable);await K(O(E(r.executable),e))||i.push({message:`Work Mate symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){a(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await K(r.executable)||i.push({message:`${r.executable} exists but is not a valid Work Mate binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Re).some(e=>{try{let t=O(e);return c?t.toLowerCase()===s.toLowerCase():t===s}catch{return!1}}))if(c){let e=o.replace(/\//g,`\\`);i.push({message:`Native installation exists but ${e} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:`path`})}else{let e=ye(),t=w()[e],n=t?t.replace(T(),`~`):`your shell config file`;i.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run:\n\necho 'export PATH="$HOME/.local/bin:$PATH"' >> ${n} && source ${n}`,userActionRequired:!0,type:`path`})}return i}function st(e,t=!1){if(t)return ct(e,t);if(Q)return u(`installLatest: joining in-flight call`),Q;let n=ct(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function ct(e,t=!1){let n=await rt(e,t);return n.success?(oe().installMethod!==`native`&&(le(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),u(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),X(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function lt(e){try{let t=await P(e),n=O(E(e),t);if(await K(n))return n}catch{}return null}function J(e,t){let n=Le(t);return D(e.locks,`${n}.lock`)}async function ut(){let e=G();if(!process.execPath.includes(e.versions))return;let t=O(process.execPath);try{let n=J(e,t);if(await M(e.locks,{recursive:!0}),C()){if(!await Me(t,n)){b(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),Y(t,Error(`Lock already held by another process`));return}b(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),u(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await m(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{u(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),b(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),u(`Acquired mtime-based lock on running version: ${t}`),p(async()=>{try{await e?.()}catch{}})}catch(e){if(a(e)){u(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}b(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),Y(t,e);return}}}catch(e){if(a(e)){u(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}u(`NON-FATAL: Failed to lock current version during execution ${s(e)}`,{level:`info`})}}function Y(e,t){v(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function dt(e){let t=J(G(),e);try{await R(t),u(`Force-removed lock file at ${t}`)}catch(e){u(`Failed to force-remove lock file: ${s(e)}`)}}async function X(){await Promise.resolve();let e=G(),t=Date.now()-36e5;if(U().startsWith(`win32`)){let t=E(e.executable);try{let e=await N(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await R(D(t,r)),n++}catch{}n>0&&u(`Cleaned up ${n} old Windows executables on startup`)}catch(e){a(e)||u(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await N(e.staging),r=0;for(let i of n){let n=D(e.staging,i);try{(await L(n)).mtime.getTime()<t&&(await I(n,{recursive:!0,force:!0}),r++,u(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(u(`Cleaned up ${r} orphaned staging directories`),b(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){a(e)||u(`Failed to clean up staging directories: ${e}`)}if(C()){let t=ke(e.locks);t>0&&(u(`Cleaned up ${t} stale version locks`),b(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await N(e.versions)}catch(e){a(e)||u(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=D(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await L(n)).mtime.getTime()<t&&(await R(n),i++,u(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await L(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:O(n),mtime:e.mtime})}catch{}}if(i>0&&(u(`Cleaned up ${i} orphaned temp install files`),b(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t?.includes(e.versions)&&n.add(O(t));let i=await lt(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=J(e,t.resolvedPath),i=!1;if(C())i=S(r);else try{i=await ce(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),u(`Protecting locked version from cleanup: ${t.name}`))}let a=r.filter(e=>!n.has(e.resolvedPath)).sort((e,t)=>t.mtime.getTime()-e.mtime.getTime()).slice(2);if(a.length===0){b(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:0,protected_count:n.size,retained_count:2,lock_failed_count:0,error_count:0});return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await Xe(e.path,async()=>{await R(e.path)})?o++:(s++,u(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,v(Error(`Failed to delete version ${e.name}: ${t}`))}})),b(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:o,protected_count:n.size,retained_count:2,lock_failed_count:s,error_count:c})}catch(e){a(e)||v(Error(`Version cleanup failed: ${e}`))}}async function ft(){let e=[],t=w();for(let[n,r]of Object.entries(t))try{let t=await ge(r);if(!t)continue;let{filtered:i,hadAlias:a}=xe(t);a&&(await Fe(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),u(`Cleaned up claude alias from ${n} config`))}catch(t){v(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function pt(e){try{let t=await h(`npm`,[`config`,`get`,`prefix`]);if(t.code!==0||!t.stdout)return{success:!1,error:`Failed to get npm global prefix`};let n=t.stdout.trim(),r=!1;async function i(e,t){try{return await R(e),u(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(U().startsWith(`win32`)){let e=D(n,`claude.cmd`),t=D(n,`claude.ps1`),a=D(n,`claude`);await i(e,`bin script`)&&(r=!0),await i(t,`PowerShell script`)&&(r=!0),await i(a,`bin executable`)&&(r=!0)}else await i(D(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(u(`Successfully removed ${e} manually`),{success:!0,warning:`${e} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${U().startsWith(`win32`)?D(n,`node_modules`,e):D(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return u(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function mt(e){let{code:t,stderr:n}=await h(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return u(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){u(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),u(`Attempting manual removal due to ENOTEMPTY error`);let t=await pt(e);if(t.success)return{success:!0,warning:t.warning};if(t.error)return{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}. Manual removal also failed: ${t.error}`}}return u(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}`}}return{success:!1}}async function ht(){let e=[],t=[],n=0,r=await mt(`@anthropic-ai/workmate`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=D(T(),`.workmate`,`local`);try{await I(i,{recursive:!0}),n++,u(`Removed local installation at ${i}`)}catch(t){a(t)||(e.push(`Failed to remove ${i}: ${t}`),u(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{y(),Pe(),ee(),se(),f(),Te(),ie(),me(),n(),c(),g(),_e(),ae(),_(),pe(),ve(),x(),Ae(),Ye(),Ee(),Z=10080*60*1e3,Q=null})),gt=e((()=>{$()}));export{ft as a,ut as c,X as i,ot as n,$ as o,ht as r,st as s,gt as t};
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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 +1 @@
|
|
|
1
|
-
import{Mn as e,Wt as t}from"./state-
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DcaKZlRU.js";import{F_ as i,Ka as a,La as o,N_ as s,Ny as c,P_ as l,Sa as u,Wa as d,it as ee,ky as f,pa as p,tt as m}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DcaKZlRU.js";import{F_ as i,Ka as a,La as o,N_ as s,Ny as c,P_ as l,Sa as u,Wa as d,it as ee,ky as f,pa as p,tt as m}from"./loadAgentsDir-DnsldjYU.js";import{c as h,i as g}from"./debug-D7OBvqC2.js";import{Bn as _,F as te,Ln as v,R as y}from"./model-xI2MbgRj.js";import{i as ne,r as b,t as x,vn as re,xn as ie,yn as S}from"./prompt-CzQkcxfg.js";import{E as C,O as w,T,Z as E,j as D,k as ae}from"./sessionState-B3tFm9SC.js";import{n as oe,r as O}from"./client-eLOYyeES.js";import{n as se,t as k}from"./openaiShared-G2-w4gJt.js";import{homedir as A}from"os";import{join as j}from"path";import{randomUUID as M}from"crypto";import{chmod as ce,mkdir as N,readFile as P,writeFile as F}from"fs/promises";function I(){return j(L(),J)}function L(){return(process.env.WORKMATE_CONFIG_DIR??j(A(),`.workmate`)).normalize(`NFC`)}function R(){return j(process.env.CODEX_HOME??j(process.env.HOME??``,`.codex`),`auth.json`)}function z(e){return typeof e==`string`&&e.length>0?e:void 0}function B(e){try{let t=JSON.parse(e);return t&&typeof t==`object`?t:null}catch{return null}}function V(e){let[,t]=e.split(`.`);if(!t)return null;try{let e=t.replace(/-/g,`+`).replace(/_/g,`/`),n=e.padEnd(e.length+(4-e.length%4)%4,`=`);return B(Buffer.from(n,`base64`).toString(`utf8`))}catch{return null}}function H(e){let t=V(e),n=t?.[`https://api.openai.com/auth`];return n&&typeof n==`object`?n:t??{}}function U(e){let t=V(e)?.exp;return typeof t==`number`?t*1e3:null}function W(e){if(e.accountId)return e.accountId;for(let t of[e.idToken,e.accessToken]){if(!t)continue;let e=H(t),n=z(e.chatgpt_account_id)??z(e.chatgpt_account_user_id)??z(e.account_id);if(n)return n}}async function G(e){try{let t=await P(e,`utf8`),n=JSON.parse(t),r=n.tokens,i=r?.id_token,a=r?.access_token,o=r?.refresh_token;return!i||!a||!o?null:{idToken:i,accessToken:a,refreshToken:o,accountId:W({idToken:i,accessToken:a,accountId:r.account_id}),lastRefresh:n.last_refresh}}catch{return null}}async function le(e){let t=I();await N(L(),{recursive:!0});let n={auth_mode:`chatgpt`,tokens:{id_token:e.idToken,access_token:e.accessToken,refresh_token:e.refreshToken,account_id:W(e)},last_refresh:new Date().toISOString()};await F(t,`${JSON.stringify(n,null,2)}\n`,{mode:384}),await ce(t,384).catch(()=>void 0)}async function ue(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`ChatGPT token request failed (${n.status})${e?`: ${e}`:``}`)}return await n.json()}async function de(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:q,scope:`openid profile email offline_access api.connectors.read api.connectors.invoke`}),n=await ue(`${K}/oauth/token`,t);return{idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token??e.refreshToken,accountId:W({idToken:n.id_token,accessToken:n.access_token,accountId:e.accountId})}}function fe(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}async function pe(){let e=await G(I());if(e||(e=await G(R()),e&&h(`[OpenAI] Using ChatGPT auth from Codex auth.json`)),!e)throw Error(`ChatGPT account is not logged in.`);let t=U(e.accessToken);return t!==null&&t<=Date.now()+Y&&(e=await de(e),await le(e)),{accessToken:e.accessToken,accountId:e.accountId??W(e)}}var K,q,J,Y,X=e((()=>{g(),K=`https://auth.openai.com`,q=`app_EMoamEEZ73f0CkXaXp7hrann`,J=`openai-chatgpt-auth.json`,Y=300*1e3}));function Z(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
|
|
2
2
|
`):``}function me(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return Z(e);let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.type===`text`&&typeof e.text==`string`)t.push({type:`input_text`,text:e.text});else if(e.type===`image_url`){let n=e.image_url;typeof n?.url==`string`&&t.push({type:`input_image`,image_url:n.url})}}return t.length>0?t:Z(e)}function he(e){let t=[],n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.role;if(i===`system`||i===`developer`){let t=Z(e.content);t&&n.push(t);continue}if(i===`tool`){let n=e.tool_call_id;typeof n==`string`&&t.push({type:`function_call_output`,call_id:n,output:Z(e.content)});continue}if(i===`assistant`){let n=Z(e.content);n&&t.push({role:`assistant`,content:n});let r=e.tool_calls;if(Array.isArray(r))for(let e of r){if(!e||typeof e!=`object`)continue;let n=e,r=n.function,i=typeof n.id==`string`?n.id:void 0,a=typeof r?.name==`string`?r.name:void 0;!i||!a||t.push({type:`function_call`,call_id:i,name:a,arguments:typeof r?.arguments==`string`?r.arguments:`{}`})}continue}i===`user`&&t.push({role:`user`,content:me(e.content)})}return{input:t,instructions:n.length>0?n.join(`
|
|
3
3
|
|
|
4
4
|
`):void 0}}function ge(e){let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n.function,r=typeof e?.name==`string`?e.name:void 0;r&&t.push({type:`function`,name:r,description:typeof e?.description==`string`?e.description:``,parameters:e?.parameters&&typeof e.parameters==`object`?e.parameters:{type:`object`,properties:{}},strict:!1})}return t}function _e(e){if(e===`required`)return`required`;if(e===`auto`)return`auto`;if(!e||typeof e!=`object`)return e;let t=e,n=t.function;return t.type===`function`&&typeof n?.name==`string`?{type:`function`,name:n.name}:e}function ve(e){let{input:t,instructions:n}=he(e.messages),r=ge(e.tools);return{model:e.model,stream:!0,store:!1,input:t,...n?{instructions:n}:{},...r.length>0?{tools:r}:{},...e.toolChoice?{tool_choice:_e(e.toolChoice)}:{},parallel_tool_calls:!0}}async function*ye(e){if(!e.body)throw Error(`ChatGPT response did not include a body`);let t=e.body.getReader(),n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,hn as a,t as o,y as s}from"./src-DL3w8VPk2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,hn as a,t as o,y as s}from"./src-DL3w8VPk2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-XKbOAw-u.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`显示 pending 标记、always 模式与打断次数`,run:()=>void d(`status`,e)},{label:`Once`,description:`仅在下一次 API 调用打断 prompt cache`,run:()=>void d(`once`,e)},{label:`Always`,description:`在每次 API 调用都打断 prompt cache`,run:()=>void d(`always`,e)},{label:`Off`,description:`关闭 always 模式并清除 pending 的一次性标记`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`取消待生效的一次性 cache 打断`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./parser-Dy-RMf4a.js";t();export{e as parseCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t}from"./debug-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t}from"./debug-D7OBvqC2.js";var n,r=e((()=>{Promise.resolve(),n=new Set([`if`,`then`,`elif`,`else`,`fi`,`while`,`until`,`for`,`in`,`do`,`done`,`case`,`esac`,`function`,`select`])}));async function i(e){return!e||e.length,null}async function a(e){return!e||e.length,null}function o(e){if(e.type===`declaration_command`){let t=e.children[0];return t&&c.has(t.text)?[t.text]:[]}let t=[],n=!1;for(let r of e.children)if(r.type!==`variable_assignment`){if(r.type===`command_name`||!n&&r.type===`word`){n=!0,t.push(r.text);continue}if(l.has(r.type))t.push(s(r.text));else if(u.has(r.type))break}return t}function s(e){return e.length>=2&&(e[0]===`"`&&e.at(-1)===`"`||e[0]===`'`&&e.at(-1)===`'`)?e.slice(1,-1):e}var c,l,u,d,f=e((()=>{t(),r(),c=new Set([`export`,`declare`,`typeset`,`readonly`,`local`,`unset`,`unsetenv`]),l=new Set([`word`,`string`,`raw_string`,`number`]),u=new Set([`command_substitution`,`process_substitution`]),d=Symbol(`parse-aborted`)}));export{a,i,o as n,n as o,f as r,r as s,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ET as t,TT as n}from"./loadAgentsDir-
|
|
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 +1,3 @@
|
|
|
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-
|
|
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
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
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 +1,3 @@
|
|
|
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-
|
|
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
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.17`:`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};
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{D as t,Gg as n,Hg as r,XT as i,ZT as a,_b as o,b as s,eE as c,lb as l}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{D as t,Gg as n,Hg as r,XT as i,ZT as a,_b as o,b as s,eE as c,lb as l}from"./loadAgentsDir-DnsldjYU.js";import{I as u,P as d,t as f}from"./src-DL3w8VPk2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as m,zt as h}from"./state-B3zvBu4R.js";import{a as g,i as _,r as v,t as y}from"./promptEditor-C6w1vT5E.js";import{r as b,t as x}from"./staticRender-D9AbnQFr.js";function S({planContent:e,planPath:t,editorName:n}){return(0,w.jsxs)(u,{flexDirection:`column`,children:[(0,w.jsx)(d,{bold:!0,children:`Current Plan`}),(0,w.jsx)(d,{dimColor:!0,children:t}),(0,w.jsx)(u,{marginTop:1,children:(0,w.jsx)(d,{children:e})}),n&&(0,w.jsxs)(u,{marginTop:1,children:[(0,w.jsx)(d,{dimColor:!0,children:`"/plan open"`}),(0,w.jsx)(d,{dimColor:!0,children:` to edit this plan in `}),(0,w.jsx)(d,{bold:!0,dimColor:!0,children:n})]})]})}async function C(e,n,s){let{getAppState:c,setAppState:l}=n,u=c().toolPermissionContext.mode;if(u!==`plan`){h(u,`plan`),l(e=>({...e,toolPermissionContext:r(t(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let n=s.trim();return n&&n!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let d=i(),f=a();if(!d)return e(`Already in plan mode. No plan written yet.`),null;if(s.trim().split(/\s+/)[0]===`open`){let t=await y(f);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${f}`),null}let p=_();return e(await b((0,w.jsx)(S,{planContent:d,planPath:f,editorName:p?o(p):void 0}))),null}var w;e((()=>{m(),f(),g(),l(),n(),s(),c(),v(),x(),w=p()}))();export{C as call};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{f as r,u as i}from"./debug-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{f as r,u as i}from"./debug-D7OBvqC2.js";import{o as a,s as o}from"./log-CR0v5KUR.js";import{release as s}from"os";import{readFile as c,readdir as l}from"fs/promises";async function u(e){let t=new Set;process.env.P4PORT&&t.add(`perforce`);try{let n=e??i().cwd(),r=new Set(await l(n));for(let[e,n]of h)r.has(e)&&t.add(n)}catch{}return[...t]}var d,f,p,m,h,g=e((()=>{n(),r(),a(),d=[`macos`,`wsl`],f=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){o(e)}return`linux`}return`unknown`}catch(e){return o(e),`unknown`}}),p=t(()=>{if(process.platform===`linux`)try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t?.[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){o(e);return}}),m=t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:s()};try{let t=await c(`/etc/os-release`,`utf8`);for(let n of t.split(`
|
|
2
2
|
`)){let t=n.match(/^(ID|VERSION_ID)=(.*)$/);if(t?.[1]&&t[2]){let n=t[2].replace(/^"|"$/g,``);t[1]===`ID`?e.linuxDistroId=n:e.linuxDistroVersion=n}}}catch{}return e}),h=[[`.git`,`git`],[`.hg`,`mercurial`],[`.svn`,`svn`],[`.p4config`,`perforce`],[`$tf`,`tfs`],[`.tfvc`,`tfs`],[`.jj`,`jujutsu`],[`.sl`,`sapling`]]}));export{p as a,f as i,u as n,g as o,m as r,d as t};
|