@readmagic/workmate 0.0.12 → 0.0.13
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-CtRxzRny.js → AddWorkspaceDirectory-BzNj9rS6.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CDZPR488.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-_yJJ0wqu.js → AgentsMdExternalIncludesDialog-CH9x1Ngp.js} +1 -1
- package/dist/chunks/App-D-bYAYAl.js +1 -0
- package/dist/chunks/ApproveApiKey-BEGV9Zj9.js +1 -0
- package/dist/chunks/ApproveApiKey-CjacpIqq.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-A9hw_SV0.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-COI_V57z.js → BypassPermissionsModeDialog-B0BizN_J.js} +1 -1
- package/dist/chunks/{DiffDialog-CRWtQ1R5.js → DiffDialog-mQ-5_TSv.js} +3 -3
- package/dist/chunks/Doctor-BC6IuQhd.js +3 -0
- package/dist/chunks/Doctor-i_5_AQd-.js +1 -0
- package/dist/chunks/ExitFlow-Bu2cVGpC.js +2 -0
- package/dist/chunks/{Grove-DRZrhbF0.js → Grove-D0nn8zOV.js} +2 -2
- package/dist/chunks/{HybridTransport-BadJQe6u.js → HybridTransport-BQNLZNa_.js} +2 -2
- package/dist/chunks/InvalidConfigDialog-C5CIiSIE.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-ISzcIGPU.js → InvalidSettingsDialog-Dq7hKXcO.js} +1 -1
- package/dist/chunks/MCPConnectionManager-aDDsYkGM.js +1 -0
- package/dist/chunks/MCPToolListView-Cr0MDkzT.js +1 -0
- package/dist/chunks/{McpParsingWarnings-xv0RZCSL.js → McpParsingWarnings-CUx2zexI.js} +1 -1
- package/dist/chunks/MessageSelector-DwGOWKKL.js +3 -0
- package/dist/chunks/Messages-C1jh4ixt.js +11 -0
- package/dist/chunks/Onboarding-t-P6Q5O6.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-8-awCxOn.js → PromptInputFooterSuggestions-R12fbdmp.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-BgADIzRj.js +1 -0
- package/dist/chunks/QueryEngine-HlLQJmsd.js +1 -0
- package/dist/chunks/REPL-Rs_JQkDc.js +1 -0
- package/dist/chunks/REPL-VKAmKkII.js +133 -0
- package/dist/chunks/RemoteSessionManager-BbgXeM-t.js +2 -0
- package/dist/chunks/ResumeConversation-66zbx12g.js +1 -0
- package/dist/chunks/{SSETransport-je346ofV.js → SSETransport-BBQkdn4e.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-Bq87I_vu.js +1 -0
- package/dist/chunks/Settings-BKdLcyXe.js +2 -0
- package/dist/chunks/{TeleportProgress-zmdAsogZ.js → TeleportProgress-3hmIApkj.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-CG32I4cO.js → TeleportRepoMismatchDialog-BA1a66RK.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-2Yjr74Lq.js → TeleportResumeWrapper-BT4O-Wsi.js} +1 -1
- package/dist/chunks/{ThemePicker-p7_hHk1V.js → ThemePicker-DUlhcoso.js} +1 -1
- package/dist/chunks/{TrustDialog-BVcny9vs.js → TrustDialog-Dpk03V1Y.js} +1 -1
- package/dist/chunks/add-dir-BUr0z-VU.js +1 -0
- package/dist/chunks/{agentDisplay-CfMLGPGH.js → agentDisplay-D7bdOOG7.js} +1 -1
- package/dist/chunks/{agents-BT82hwBN.js → agents-22wiC58F.js} +1 -1
- package/dist/chunks/agents-8ELI8RJo.js +103 -0
- package/dist/chunks/{allErrors-CS77lRvU.js → allErrors-C1eMbHSv.js} +1 -1
- package/dist/chunks/api-DgjIFdMn.js +1 -0
- package/dist/chunks/{api-DAubp5q9.js → api-f3GN2I_J.js} +1 -1
- package/dist/chunks/auth-B73a4Cob.js +1 -0
- package/dist/chunks/{auth-yDsvFcM7.js → auth-Czy7GoRh.js} +1 -1
- package/dist/chunks/auth-D_0waidQ.js +1 -0
- package/dist/chunks/backgroundHousekeeping-C_ArdTFX.js +17 -0
- package/dist/chunks/backgroundHousekeeping-YJhvZ0dh.js +1 -0
- package/dist/chunks/{branch-DJiMa8td.js → branch-bb4-bErF.js} +2 -2
- package/dist/chunks/{bridgeConfig-BB6Hgali.js → bridgeConfig-B80T_lw7.js} +1 -1
- package/dist/chunks/bridgeConfig-DywkIo_k.js +1 -0
- package/dist/chunks/{bridgeMessaging-C9D0Lly2.js → bridgeMessaging-DyvHd16Z.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-D8UbcVrZ.js → bridgeStatusUtil-DStiD05t.js} +1 -1
- package/dist/chunks/{btw-BO2B23f-.js → btw-BRmV51bR.js} +1 -1
- package/dist/chunks/caches-C5DIVdvI.js +1 -0
- package/dist/chunks/caches-zDZEgNKq.js +1 -0
- package/dist/chunks/{ccrClient-BG9HU_fW.js → ccrClient-BALhzhPF.js} +1 -1
- package/dist/chunks/{clear-B4XN2fib.js → clear-B_yVyJXP.js} +1 -1
- package/dist/chunks/client-DVg8PpFX.js +1 -0
- package/dist/chunks/commands-ByFXqW43.js +1 -0
- package/dist/chunks/compact-BUShp2eQ.js +2 -0
- package/dist/chunks/config-BwHNU_pI.js +1 -0
- package/dist/chunks/{context-BY5oO5is.js → context-6Pk3iVhh.js} +1 -1
- package/dist/chunks/{context-noninteractive-mAQt1p9l.js → context-noninteractive-CHzerxnH.js} +2 -2
- package/dist/chunks/context-noninteractive-DFwRQyFE.js +1 -0
- package/dist/chunks/conversation-5zb5XkSA.js +1 -0
- package/dist/chunks/conversation-JP2ZXrwu.js +1 -0
- package/dist/chunks/{createSSHSession-DjLSGm-0.js → createSSHSession-XkHMiGRN.js} +1 -1
- package/dist/chunks/{createSession-CftIZ3aq.js → createSession-BNGm9fL4.js} +1 -1
- package/dist/chunks/createSession-VTqzWAu6.js +1 -0
- package/dist/chunks/crossProjectResume-DxgQVYSi.js +40 -0
- package/dist/chunks/{datadog-BGati3aQ.js → datadog-3WUWcCFn.js} +1 -1
- package/dist/chunks/{diff-1HsxKGBh.js → diff-CKlLimGq.js} +1 -1
- package/dist/chunks/doctor-Bvx0u0sO.js +1 -0
- package/dist/chunks/entry-DCbq734V.js +14 -0
- package/dist/chunks/{esm-BkOWaWVb.js → esm-CtQkOk5D.js} +1 -1
- package/dist/chunks/exit-DTsz5Lcb.js +1 -0
- package/dist/chunks/{extraUsage-0pUcYexI.js → extraUsage-C86bZVgt.js} +1 -1
- package/dist/chunks/extractMemories-6OnMgL2S.js +1 -0
- package/dist/chunks/fast-B2ziqJEA.js +1 -0
- package/dist/chunks/{fast-VOu2FUlV.js → fast-BkhjaTkZ.js} +1 -1
- package/dist/chunks/{fileSuggestions-Be-pyLLq.js → fileSuggestions-BalHmi1-.js} +2 -2
- package/dist/chunks/{firstPartyEventLogger-aFhcruXA.js → firstPartyEventLogger-1RTgXHSz.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-CXMzhLrF.js +1 -0
- package/dist/chunks/{flushGate-BUSrMj_6.js → flushGate-DWL05x7v.js} +1 -1
- package/dist/chunks/{gemini-DB4M-MYv.js → gemini-BLpLJyli.js} +1 -1
- package/dist/chunks/generateSessionName-CdbMksHi.js +1 -0
- package/dist/chunks/goal-V3qix-i1.js +3 -0
- package/dist/chunks/grok-BLLATotv.js +1 -0
- package/dist/chunks/{grove-BnzBbGsX.js → grove-b9gGKgu4.js} +2 -2
- package/dist/chunks/{help-C5ankDi4.js → help-BR7UEr5R.js} +1 -1
- package/dist/chunks/{hooks-BZS105Rd.js → hooks-C-QMGvCg.js} +2 -2
- package/dist/chunks/hooks-D6wtd0Qq.js +1 -0
- package/dist/chunks/{initReplBridge-DL4klK0C.js → initReplBridge-DyScxedy.js} +1 -1
- package/dist/chunks/{install-NZvHd_40.js → install-DGH_bjUh.js} +1 -1
- package/dist/chunks/{instrumentation-CjBlVlFq.js → instrumentation-DQ705pC7.js} +3 -3
- package/dist/chunks/{job-D502Zf8J.js → job-BaMT6Lb2.js} +1 -1
- package/dist/chunks/keybindings-CG292HS1.js +2 -0
- package/dist/chunks/{launchLocalMemory-DxC3LojF.js → launchLocalMemory-CtZrkmaw.js} +2 -2
- package/dist/chunks/{launchOnboarding-BLp5k_H4.js → launchOnboarding-CyOtdZkT.js} +1 -1
- package/dist/chunks/loadAgentsDir-4UC4yLg1.js +1 -0
- package/dist/chunks/{loadAgentsDir-BXtV2jiO.js → loadAgentsDir-mcRW90aq.js} +389 -390
- package/dist/chunks/loadPluginHooks-CWI0RMUx.js +1 -0
- package/dist/chunks/{localSearch-CeP4ef0a.js → localSearch-CCCDKpYx.js} +1 -1
- package/dist/chunks/localSearch-D4hVR7-d.js +1 -0
- package/dist/chunks/{logoV2Utils-CEnU8qad.js → logoV2Utils--8OUQQPd.js} +1 -1
- package/dist/chunks/{magicDocs-YtfrqVC6.js → magicDocs-26J_l1De.js} +2 -2
- package/dist/chunks/main-DUjtDK1Q.js +513 -0
- package/dist/chunks/managedEnv-BuCurT_S.js +1 -0
- package/dist/chunks/{managedEnv-B-BNY0xC.js → managedEnv-Ds6MlFQE.js} +1 -1
- package/dist/chunks/{mappers-IuJeXgvr.js → mappers-DwZw084m.js} +1 -1
- package/dist/chunks/mcp-CEKR7PjL.js +6 -0
- package/dist/chunks/mcp-DCAf2hHD.js +1 -0
- package/dist/chunks/mcp-mCuc8dNe.js +2 -0
- package/dist/chunks/memory-B5SkpC7u.js +1 -0
- package/dist/chunks/{mode-GzBwK--u.js → mode-B80CHkqo.js} +2 -2
- package/dist/chunks/model-BqaneI4D.js +1 -0
- package/dist/chunks/{model-CDnVaVDR.js → model-C29_32BD.js} +1 -1
- package/dist/chunks/{model-BydaMaPr.js → model-NG8fvuT2.js} +1 -1
- package/dist/chunks/{modelOptions-ut0xePEe.js → modelOptions-CiZgZxZC.js} +1 -1
- package/dist/chunks/{nativeInstaller-fgCMR_c0.js → nativeInstaller-DqbEfGSX.js} +1 -1
- package/dist/chunks/{omit-D4Udf-p-.js → omit-KEhe84f4.js} +1 -1
- package/dist/chunks/{onChangeAppState-WbvtqDtk.js → onChangeAppState-Dq1tIEJI.js} +1 -1
- package/dist/chunks/{openai-DaVFXyBB.js → openai-BvnsYTpQ.js} +3 -3
- package/dist/chunks/{partition-CzW_31Y1.js → partition-DeT341qu.js} +1 -1
- package/dist/chunks/permissions-BPpeHxpk.js +3 -0
- package/dist/chunks/pidLock-DQGDoFQP.js +3 -0
- package/dist/chunks/{plan-M9DG3AqN.js → plan-BRiC5ujG.js} +1 -1
- package/dist/chunks/plugin-Dcg_GGR9.js +17 -0
- package/dist/chunks/{pluginAutoupdate-B5lel6s5.js → pluginAutoupdate-ByH9IPC9.js} +1 -1
- package/dist/chunks/pluginBlocklist-BfoLN9a-.js +1 -0
- package/dist/chunks/pluginCliCommands-Bc2Iybhz.js +1 -0
- package/dist/chunks/{pluginFlagging-CXSSOj4J.js → pluginFlagging-Cr0d0hBA.js} +1 -1
- package/dist/chunks/pluginOperations-CKNyYjS-.js +2 -0
- package/dist/chunks/pluginStartupCheck-B48_cGgo.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BEd0VeQC.js → pluginStartupCheck-DiCDQQlr.js} +1 -1
- package/dist/chunks/plugins-BP_36tOl.js +4 -0
- package/dist/chunks/print-2uavraPq.js +26 -0
- package/dist/chunks/processBashCommand-g3sAMpHt.js +1 -0
- package/dist/chunks/processSlashCommand-tIbeCrv5.js +5 -0
- package/dist/chunks/{prompt-CRc2QEZ5.js → prompt-DIlq8NTy.js} +1 -1
- package/dist/chunks/prompt-DLv-Cd67.js +1 -0
- package/dist/chunks/prompt-DV5tCLRh.js +1 -0
- package/dist/chunks/{promptEditor-Bo1d8ZLq.js → promptEditor-BILqOGl1.js} +2 -2
- package/dist/chunks/{reconciler-BGav_ezX.js → reconciler-CDq6XgAS.js} +1 -1
- package/dist/chunks/refresh-ysrhoWCo.js +1 -0
- package/dist/chunks/{reload-plugins-DNEgQ5vo.js → reload-plugins-CGb0HTsH.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BGOqHADF.js → remoteBridgeCore-BmteXmI9.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-26nhzuca.js → remoteManagedSettings-CwDGxL5p.js} +1 -1
- package/dist/chunks/rename-1GLIUlYk.js +1 -0
- package/dist/chunks/resume-DWtlUiHW.js +2 -0
- package/dist/chunks/{runtimeObserver-BZrF3GnQ.js → runtimeObserver-4ZqaCXYy.js} +4 -4
- package/dist/chunks/{runtimeObserver-CBV-7-w7.js → runtimeObserver-CtNY8Al2.js} +1 -1
- package/dist/chunks/sandbox-adapter-BzjRQh_r.js +1 -0
- package/dist/chunks/{sandbox-toggle-D61gVqcT.js → sandbox-toggle-Bz49-F6e.js} +1 -1
- package/dist/chunks/searchExtraTools-D6vj8qJ-.js +1 -0
- package/dist/chunks/{session-Dy-_R7KP.js → session-wb6X4Wrq.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-Da97UA2n.js +1 -0
- package/dist/chunks/{sessionObserver-CyLpHSkw.js → sessionObserver-BJQ5hwjU.js} +2 -2
- package/dist/chunks/sessionObserver-DXO4trhk.js +1 -0
- package/dist/chunks/{sessionState-DSWN4tMV.js → sessionState-Bn3ESS5f.js} +1 -1
- package/dist/chunks/sessionStorage-DlPVsQn9.js +1 -0
- package/dist/chunks/{sessionTitle-L5tyJgdU.js → sessionTitle-Cbzrb9jT.js} +2 -2
- package/dist/chunks/{sessionTracing-DpHGGIZm.js → sessionTracing-CEsm8pZL.js} +1 -1
- package/dist/chunks/{settingsSync-dBqlrbcU.js → settingsSync-eHaSngKo.js} +1 -1
- package/dist/chunks/setup-DeyiuGNX.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DZ0AA2Rw.js → shadowedRuleDetection-D5X5fhzj.js} +1 -1
- package/dist/chunks/{sideQuestion-BYT8FdPF.js → sideQuestion-BHRtwhyj.js} +3 -3
- package/dist/chunks/{sinks-mFsijQ_S.js → sinks-Bgy2UNK-.js} +2 -2
- package/dist/chunks/sinks-CgzLmim2.js +1 -0
- package/dist/chunks/skillChangeDetector-BlSP16j6.js +1 -0
- package/dist/chunks/{skillGapStore-DQXHqoP7.js → skillGapStore-BjQSSz2E.js} +2 -2
- package/dist/chunks/{skillLifecycle-BG_RnGSh.js → skillLifecycle-Sp8strFv.js} +2 -2
- package/dist/chunks/{skillSearchPanel-DxYP4Q6R.js → skillSearchPanel-3sYRez_Q.js} +4 -4
- package/dist/chunks/{skills-BD-2ofXA.js → skills-CJhWI8t1.js} +1 -1
- package/dist/chunks/{status-BmHu-c7I.js → status-CDCurOqs.js} +2 -2
- package/dist/chunks/{status-CrmnCDIE.js → status-yoQIQ2Ni.js} +1 -1
- package/dist/chunks/statusNoticeHelpers-Sl4jjauz.js +1 -0
- package/dist/chunks/switcher-C-m6MUwE.js +1 -0
- package/dist/chunks/{switcher-sYTxnJQA.js → switcher-uoQMHmEZ.js} +1 -1
- package/dist/chunks/{syncCache-BofuFJEe.js → syncCache-BooMjgU6.js} +1 -1
- package/dist/chunks/{tasks-NpI1iEem.js → tasks-CHG_6sXQ.js} +1 -1
- package/dist/chunks/teleport-C9KRE4X8.js +1 -0
- package/dist/chunks/{templateJobs-C94jEE6O.js → templateJobs-BYYfF4m5.js} +1 -1
- package/dist/chunks/{theme-CEi3b_8f.js → theme-MvX7hojJ.js} +1 -1
- package/dist/chunks/{toolEventObserver-DlL9CHmI.js → toolEventObserver-BFEl47bq.js} +1 -1
- package/dist/chunks/toolPool-Cq74Cvjp.js +1 -0
- package/dist/chunks/trustedDevice-BGwujSqc.js +1 -0
- package/dist/chunks/{trustedDevice-Bzz03jCy.js → trustedDevice-BLiKbGpG.js} +1 -1
- package/dist/chunks/{updateCCB-CzBxsuJe.js → updateCCB-CfckOy7T.js} +6 -6
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BHQfwlAl.js → useExitOnCtrlCDWithKeybindings-CPLBDluY.js} +1 -1
- package/dist/chunks/useMainLoopModel-C00PbZ1Q.js +1 -0
- package/dist/chunks/useManagePlugins-DFaGntzJ.js +1 -0
- package/dist/chunks/{useMergedTools-CHxnwR7R.js → useMergedTools-DYobZ5N4.js} +1 -1
- package/dist/chunks/{useSearchInput-q2CFPU4W.js → useSearchInput-KFKh2ozY.js} +1 -1
- package/dist/chunks/useSettingsErrors-BRgjvaHd.js +1 -0
- package/dist/chunks/{userAgent-B7WkjI6I.js → userAgent-DUrr02yh.js} +1 -1
- package/dist/chunks/util-D7uwPgF1.js +1 -0
- package/dist/chunks/validatePlugin-VukX52bx.js +1 -0
- package/dist/chunks/{workerRegistry-Cfo7bKlm.js → workerRegistry-BA37PVbv.js} +3 -3
- package/dist/chunks/worktree-Lik8xuKd.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-_bI4jo_P.js +0 -1
- package/dist/chunks/App-DoAZ7CYS.js +0 -1
- package/dist/chunks/ApproveApiKey-C8LwmDM2.js +0 -1
- package/dist/chunks/ApproveApiKey-DQP3qmb0.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CDA2noEk.js +0 -2
- package/dist/chunks/ConsoleOAuthFlow-Dn8fO-o_.js +0 -1
- package/dist/chunks/Doctor-CZ513Df9.js +0 -3
- package/dist/chunks/Doctor-CzPvNZzF.js +0 -1
- package/dist/chunks/ExitFlow-BFeftDv0.js +0 -2
- package/dist/chunks/InvalidConfigDialog-DQaT6aen.js +0 -1
- package/dist/chunks/MCPConnectionManager-BpjC7CEo.js +0 -1
- package/dist/chunks/MCPToolListView-Rb1Q--jG.js +0 -1
- package/dist/chunks/MessageSelector-BHB55sZb.js +0 -3
- package/dist/chunks/Messages-CPX-nIdA.js +0 -11
- package/dist/chunks/Onboarding-CymgipoF.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-BP3UgCdi.js +0 -1
- package/dist/chunks/QueryEngine-HkswHUNv.js +0 -1
- package/dist/chunks/REPL-CZfg65kg.js +0 -133
- package/dist/chunks/REPL-eZsYNBfl.js +0 -1
- package/dist/chunks/RemoteSessionManager-B4jqKVd3.js +0 -2
- package/dist/chunks/ResumeConversation-B03XN_SP.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-C85Sanww.js +0 -1
- package/dist/chunks/Settings-C8GKWod1.js +0 -2
- package/dist/chunks/WelcomeV2-BnSYhyfu.js +0 -1
- package/dist/chunks/add-dir-Bd7pilVx.js +0 -1
- package/dist/chunks/agents-qR6r94-F.js +0 -103
- package/dist/chunks/api-C4VflFau.js +0 -1
- package/dist/chunks/auth-CNCehj7y.js +0 -1
- package/dist/chunks/auth-DrD9DW6X.js +0 -1
- package/dist/chunks/autoMode-C2lnBot9.js +0 -45
- package/dist/chunks/backgroundHousekeeping-DbpTGbwl.js +0 -1
- package/dist/chunks/backgroundHousekeeping-SpTxViUq.js +0 -17
- package/dist/chunks/bridgeConfig-Ccm79Jze.js +0 -1
- package/dist/chunks/caches-BQmbXerw.js +0 -1
- package/dist/chunks/caches-Dtjmjm6G.js +0 -1
- package/dist/chunks/client-B-2ccQZk.js +0 -1
- package/dist/chunks/commands-D_-v6_A0.js +0 -1
- package/dist/chunks/compact-kM0ETtB2.js +0 -2
- package/dist/chunks/config-Crf6Mzu3.js +0 -1
- package/dist/chunks/connectHeadless-CqRoEtrg.js +0 -1
- package/dist/chunks/context-noninteractive-tc4KTYfI.js +0 -1
- package/dist/chunks/conversation-CFIn-KsW.js +0 -1
- package/dist/chunks/conversation-DPI7VKBL.js +0 -1
- package/dist/chunks/createSession-CjdLcRec.js +0 -1
- package/dist/chunks/crossProjectResume-BJqXBzkf.js +0 -40
- package/dist/chunks/dangerousBackend-DwcP0P08.js +0 -1
- package/dist/chunks/doctor-CJfvt9zR.js +0 -1
- package/dist/chunks/entry-CrZCZQQC.js +0 -14
- package/dist/chunks/exit-B8MA4Ltm.js +0 -1
- package/dist/chunks/extractMemories-DqhN0lba.js +0 -1
- package/dist/chunks/fast-DT5WDe3L.js +0 -1
- package/dist/chunks/firstPartyEventLogger-B8RVGBQB.js +0 -1
- package/dist/chunks/generateSessionName-DhCypqJ_.js +0 -1
- package/dist/chunks/goal-TxXtfkQ6.js +0 -3
- package/dist/chunks/grok-D2a_J5wE.js +0 -1
- package/dist/chunks/hooks-D-twhU_z.js +0 -1
- package/dist/chunks/keybindings-D9Boc8FD.js +0 -2
- package/dist/chunks/loadAgentsDir-BjsAQWqt.js +0 -1
- package/dist/chunks/loadPluginHooks-Dt3XQ-3N.js +0 -1
- package/dist/chunks/localSearch-Cz8Ot7k2.js +0 -1
- package/dist/chunks/lockfile-D5-j7HOZ.js +0 -1
- package/dist/chunks/main-CkjTzYj1.js +0 -513
- package/dist/chunks/managedEnv-K9Si1UuL.js +0 -1
- package/dist/chunks/mcp-DMBoeQzm.js +0 -6
- package/dist/chunks/mcp-TMOPfLcW.js +0 -1
- package/dist/chunks/mcp-x5rgv-uv.js +0 -2
- package/dist/chunks/memory-DDUoR63T.js +0 -1
- package/dist/chunks/model-CIvbC7rW.js +0 -1
- package/dist/chunks/parseConnectUrl-BiyKR5-x.js +0 -1
- package/dist/chunks/permissions-BT3lxYBM.js +0 -3
- package/dist/chunks/pidLock-d1VPd6CG.js +0 -3
- package/dist/chunks/plugin-BiNHuq3h.js +0 -17
- package/dist/chunks/pluginBlocklist-CNGmIlwU.js +0 -1
- package/dist/chunks/pluginCliCommands-WLOEhb2M.js +0 -1
- package/dist/chunks/pluginOperations-BFbty6WT.js +0 -2
- package/dist/chunks/pluginStartupCheck-Bcdxg484.js +0 -1
- package/dist/chunks/plugins-BMZ3aYKP.js +0 -4
- package/dist/chunks/print-DmoLcwVq.js +0 -26
- package/dist/chunks/processBashCommand-B-VqME9O.js +0 -1
- package/dist/chunks/processSlashCommand-D6zEooTy.js +0 -5
- package/dist/chunks/prompt-C3RRe4kW.js +0 -1
- package/dist/chunks/prompt-EtAanewG.js +0 -1
- package/dist/chunks/refresh-DumNiLvM.js +0 -1
- package/dist/chunks/rename-BPknfVGF.js +0 -1
- package/dist/chunks/resume-DGz04xDh.js +0 -2
- package/dist/chunks/sandbox-adapter-DUqeqkQD.js +0 -1
- package/dist/chunks/searchExtraTools-CgsV6kb1.js +0 -1
- package/dist/chunks/server-LdbAb0sV.js +0 -1
- package/dist/chunks/serverBanner-BdExKFHT.js +0 -1
- package/dist/chunks/serverLog-BFmvyJ93.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-BJlrZaRD.js +0 -1
- package/dist/chunks/sessionManager-CPa049BO.js +0 -1
- package/dist/chunks/sessionObserver-BGYoLRGx.js +0 -1
- package/dist/chunks/sessionStorage-zJ1esSCE.js +0 -1
- package/dist/chunks/setup-zf3v3ICe.js +0 -3
- package/dist/chunks/sinks-DppGvgz1.js +0 -1
- package/dist/chunks/skillChangeDetector-D-iq09Xs.js +0 -1
- package/dist/chunks/statusNoticeHelpers-DakAVtQO.js +0 -1
- package/dist/chunks/switcher-Dm646gO5.js +0 -1
- package/dist/chunks/teleport-Bs3kEipi.js +0 -1
- package/dist/chunks/toolPool-DIT_uhtD.js +0 -1
- package/dist/chunks/trustedDevice-BokywSKL.js +0 -1
- package/dist/chunks/useMainLoopModel-BkyIIW9t.js +0 -1
- package/dist/chunks/useManagePlugins-BWROoGDs.js +0 -1
- package/dist/chunks/useSettingsErrors-CPVQbsqq.js +0 -1
- package/dist/chunks/util-BfqXOA-P.js +0 -1
- package/dist/chunks/validatePlugin-jrcrYEIu.js +0 -1
- package/dist/chunks/worktree-D0k_pCEz.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Cp as t,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Cp as t,Sp as n,wp as r}from"./loadAgentsDir-mcRW90aq.js";import{F as i,Wt as a}from"./state-BPFYBqm1.js";import{f as o,g as s}from"./settings-DiBMs2gM.js";import{c as ee,h as te}from"./config-9rLTDOYW.js";import{A as c,Bt as l,Gn as u,Gt as d,H as f,I as ne,Kn as p,Kr as m,L as h,M as g,N as _,O as v,R as y,W as re,Xt as ie,_ as ae,a as b,ai as x,b as S,c as oe,d as C,en as w,f as T,g as E,i as D,j as O,k,l as A,qr as j,r as M,s as N,si as P,w as F}from"./model-C29_32BD.js";function I(e=!1){if(d())return{value:null,label:`Default (recommended)`,description:D(e)};let t=x()!==`firstParty`;return{value:null,label:`Default (recommended)`,description:`Use the default model (currently ${F(N())})${t?``:` · ${f(y)}`}`}}function L(){let e=x()!==`firstParty`,t=x(),n=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL;if(e&&n){let e=u(n),r=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME,i=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION;return{value:`sonnet`,label:r??n,description:i??`Custom Sonnet model${e?` (1M context)`:``}`,descriptionForModel:`${i??`Custom Sonnet model${e?` with 1M context`:``}`} (${n})`}}}function R(){let e=x()!==`firstParty`;return{value:e?m().sonnet46:`sonnet`,label:`Sonnet`,description:`Sonnet 4.6 · Best for everyday tasks${e?``:` · ${f(y)}`}`,descriptionForModel:`Sonnet 4.6 - best for everyday tasks. Generally recommended for most coding tasks`}}function se(){let e=x()!==`firstParty`,t=x(),n=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL;if(e&&n){let e=u(n),r=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME,i=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION;return{value:`opus`,label:r??n,description:i??`Custom Opus model${e?` (1M context)`:``}`,descriptionForModel:`${i??`Custom Opus model${e?` with 1M context`:``}`} (${n})`}}}function z(e=!1){return{value:x()===`firstParty`?`opus`:m().opus47,label:`Opus 4.7`,description:`Opus 4.7 · Most capable for complex work${T(e)}`,descriptionForModel:`Opus 4.7 - most capable for complex work`}}function B(){let e=x()!==`firstParty`;return{value:e?m().sonnet46+`[1m]`:`sonnet[1m]`,label:`Sonnet (1M context)`,description:`Sonnet 4.6 for long sessions${e?``:` · ${f(y)}`}`,descriptionForModel:`Sonnet 4.6 with 1M context window - for long sessions with large codebases`}}function V(e=!1){return{value:x()===`firstParty`?`opus[1m]`:m().opus47+`[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context${T(e)}`,descriptionForModel:`Opus 4.7 with 1M context window - for long sessions with large codebases`}}function H(e=!1){return{value:m().opus46+`[1m]`,label:`Opus 4.6 (1M context)`,description:`Opus 4.6 with 1M context${T(e)}`,descriptionForModel:`Opus 4.6 with 1M context window - for long sessions with large codebases`}}function U(){let e=x()!==`firstParty`,t=x(),n=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL;if(e&&n){let e=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME,r=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION;return{value:`haiku`,label:e??n,description:r??`Custom Haiku model`,descriptionForModel:`${r??`Custom Haiku model`} (${n})`}}}function W(){return{value:`haiku`,label:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers${x()===`firstParty`?` · ${f(h)}`:``}`,descriptionForModel:`Haiku 4.5 - fastest for quick answers. Lower cost but less capable than Sonnet 4.6.`}}function G(){return{value:`haiku`,label:`Haiku`,description:`Haiku 3.5 for simple tasks${x()===`firstParty`?` · ${f(ne)}`:``}`,descriptionForModel:`Haiku 3.5 - faster and lower cost, but less capable than Sonnet. Use for simple tasks.`}}function K(){return b()===m().haiku45?W():G()}function q(e=!1){return{value:`opus`,label:`Opus 4.7`,description:`Opus 4.7 · Most capable for complex work${e?T(!0):``}`}}function J(){let e=x()!==`firstParty`;return{value:`sonnet[1m]`,label:`Sonnet (1M context)`,description:`Sonnet 4.6 with 1M context${d()?` · Billed as extra usage`:``}${e?``:` · ${f(y)}`}`}}function ce(e=!1){return{value:`opus[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context${d()?` · Billed as extra usage`:``}${T(e)}`}}function Y(e=!1){let t=x()!==`firstParty`;return{value:t?m().opus47+`[1m]`:`opus[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context · Most capable for complex work${!t&&e?T(e):``}`,descriptionForModel:`Opus 4.7 with 1M context - most capable for complex work`}}function le(){return{value:`opusplan`,label:`Opus Plan Mode`,description:`Use Opus 4.7 in plan mode, Sonnet 4.6 otherwise`}}function ue(){return[{value:null,label:`Default (recommended)`,description:`Use the default ChatGPT Codex model (currently ${v})`,descriptionForModel:`Default ChatGPT Codex model (currently ${v})`},...k.map(e=>({value:e.value,label:e.label,description:e.description,descriptionForModel:`${e.description} (${e.value})`}))]}function de(e=!1){if(x()===`openai`&&O())return ue();if(d()){if(ie()||w()){let n=[I(e)];return n.push(H(e)),n.push(Q),t()&&n.push(J()),n.push($),n}let r=[I(e)];return S()?r.push(Y(e)):(r.push(q(e)),n()&&r.push(ce(e))),r.push(H(e)),t()&&r.push(J()),r.push($),r}if(x()===`firstParty`){let r=[I(e)];return S()?r.push(Y(e)):(r.push(z(e)),n()&&r.push(V(e))),r.push(H(e)),t()&&r.push(B()),r.push(W()),r}let r=[I(e)],i=L();i===void 0?(r.push(R()),t()&&r.push(B())):r.push(i);let a=se();a===void 0?(r.push(V(e)),r.push(H(e))):r.push(a);let o=U();return o===void 0?r.push(K()):r.push(o),r}function fe(e){let t=M(e);if(t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-sonnet-4-`)||t.includes(`claude-3-7-sonnet`)||t.includes(`claude-3-5-sonnet`)){let e=C(A());if(e)return{alias:`Sonnet`,currentVersionName:e}}if(t.includes(`claude-opus-4`)){let e=C(oe());if(e)return{alias:`Opus`,currentVersionName:e}}if(t.includes(`claude-haiku`)||t.includes(`claude-3-5-haiku`)){let e=C(b());if(e)return{alias:`Haiku`,currentVersionName:e}}return null}function X(e){let t=C(e);if(!t)return null;let n=fe(e);return n?t===n.currentVersionName?{value:e,label:t,description:e}:{value:e,label:t,description:`Newer version available · select ${n.alias} for ${n.currentVersionName}`}:{value:e,label:t,description:e}}function pe(e=!1){let t=de(e),n=process.env.ANTHROPIC_CUSTOM_MODEL_OPTION;n&&!t.some(e=>e.value===n)&&t.push({value:n,label:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME??n,description:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION??`Custom model (${n})`});for(let e of ee().additionalModelOptionsCache??[])t.some(t=>t.value===e.value)||t.push(e);let r=null,a=E(),o=i();if(a==null?o!==null&&(r=o):r=a,r===null||t.some(e=>e.value===r))return Z(t);if(r===`opusplan`)return Z([...t,le()]);if(r===`opus`&&x()===`firstParty`)return Z([...t,q(e)]);if(r===`opus[1m]`&&x()===`firstParty`)return Z([...t,Y(e)]);{let e=X(r);return e?t.push(e):t.push({value:r,label:r,description:`Custom model`}),Z(t)}}function Z(e){return(o()||{}).availableModels?e.filter(e=>e.value===null||e.value!==null&&_(e.value)):e}var Q,$,me=e((()=>{a(),l(),j(),re(),s(),r(),P(),g(),ae(),p(),te(),c(),Q={value:`sonnet`,label:`Sonnet`,description:`Sonnet 4.6 · Best for everyday tasks`},$={value:`haiku`,label:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers`}}));export{me as n,pe as t};
|
|
@@ -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 ee,tt as te,u as ne,x as re}from"./debug-Dr1SjdXn.js";import{Kt as ie,Yt as ae}from"./settings-DiBMs2gM.js";import{C as oe,S as se,c as ce,h as le,x as ue,y as de}from"./config-9rLTDOYW.js";import{n as p,r as m}from"./execFileNoThrow-mXq4K0rl.js";import{o as h,s as g}from"./log-27kCA_9u.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{_n as fe,vn as pe}from"./model-CDnVaVDR.js";import{dt as me,lt as he,ut as ge}from"./sessionState-DSWN4tMV.js";import{ft as _e,ut as ve}from"./esm-BkOWaWVb.js";import{C as ye,S as be,_ as xe,a as y,b as Se,c as Ce,d as we,g as Te,h as Ee,i as De,l as Oe,n as ke,o as b,p as Ae,s as je,t as Me,v as x,x as Ne,y as Pe}from"./pidLock-d1VPd6CG.js";import{a as Fe,i as Ie,n as Le,r as Re,t as ze}from"./xdg-DcF9ejUM.js";import{homedir as S}from"os";import{basename as Be,delimiter as Ve,dirname as C,join as w,resolve as T}from"path";import{constants as He}from"fs";import{createHash as Ue}from"crypto";import{access as E,chmod as D,copyFile as O,mkdir as k,readdir as A,readlink as j,rename as M,rm as N,rmdir as We,stat as P,symlink as Ge,unlink as F,writeFile as Ke}from"fs/promises";async function qe(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return v(`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),v(`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 g(c),c}}async function Je(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 qe(t,I)}function Ye(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||L}async function Xe(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(),Ye(),s)};try{f();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{f()},...i});d();let o=Ue(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await Ke(n,Buffer.from(a.data)),await D(n,493);return}catch(e){d();let t=r.isCancel(e);if(a=t?new R:l(e),t&&o<3){u(`Download stalled on attempt ${o}/3, retrying...`),await pe(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ze(e,t,n,i){let a=ne();await a.rm(t,{recursive:!0,force:!0});let o=z(),s=Date.now();v(`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),v(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),g(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw v(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=B(o),f=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let ee=w(t,d);try{await Xe(f,u,ee,i||{}),v(`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),v(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),g(Error(`Failed to download binary from ${f}: ${n}`)),e}}async function Qe(e,t){return await Ze(e,t,I),`binary`}var I,L,R,$e=e((()=>{i(),_(),f(),c(),m(),d(),h(),fe(),re(),$(),I=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,L=6e4,R=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function z(){let e=ie.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`&&ve.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function B(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function V(){let e=B(z());return{versions:w(Re(),`claude`,`versions`),staging:w(Le(),`claude`,`staging`),locks:w(Ie(),`claude`,`locks`),executable:w(ze(),e)}}async function H(e){try{let t=await P(e);return!t.isFile()||t.size===0?!1:(await E(e,He.X_OK),!0)}catch{return!1}}async function U(e){let t=V(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>k(e,{recursive:!0}))),await k(C(t.executable),{recursive:!0});let r=w(t.versions,e);try{await P(r)}catch{await Ke(r,``,{encoding:`utf8`})}return{stagingPath:w(t.staging,e),installPath:r}}async function W(e,t,n=0){let r=V(),i=Y(r,e);if(await k(r.locks,{recursive:!0}),b()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await Ce(e,i,async()=>{try{await t()}catch(e){throw g(e),e}}))return v(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await pe(Math.min(o*2**(r-1),s))}return v(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),X(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await oe(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 v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw g(e),e}}finally{a&&await a()}}async function G(e,t){await k(C(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await O(e,n),await D(n,493),await M(n,t),u(`Atomically installed binary to ${t}`)}catch(e){try{await F(n)}catch{}throw e}}async function et(e,t){try{let n=w(e,`node_modules`,`@anthropic-ai`),r=(await A(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw v(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=w(n,r,`cli`);try{await P(i)}catch{throw v(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await G(i,t),await N(e,{recursive:!0,force:!0}),v(`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`)&&v(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),g(l(e)),e}}async function tt(e,t){try{let n=w(e,B(z()));try{await P(n)}catch{throw v(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await G(n,t),await N(e,{recursive:!0,force:!0}),v(`tengu_native_install_binary_success`,{})}catch(e){throw s(e).includes(`Staged binary not found`)||v(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),g(l(e)),e}}async function nt(e,t,n){n===`npm`?await et(e,t):await tt(e,t)}async function K(e,n){let{stagingPath:r,installPath:i}=await U(e),{executable:a}=V(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await q(e)||n;if(s?(u(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await nt(o,i,await Qe(e,o))):u(`Version ${e} already installed, updating symlink`),await it(a),await at(a,i),!await H(a)){let e=!1;try{await P(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 q(e){let{installPath:t}=await U(e);return H(t)}async function rt(e,n=!1){let r=Date.now(),i=await Je(e),{executable:a}=V();if(u(`Checking for native installer update to version ${i}`),!n){let e=await Ae();if(e&&he(i,e)){if(u(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),ge(`0.0.12`,e))return u(`Native installer: current version 0.0.12 is already at or above maxVersion ${e}, skipping update`),v(`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.12`&&await q(i)&&await H(a))return u(`Found ${i} at ${a}, skipping install`),v(`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&&Te(i))return v(`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 K(i,n),s=Date.now()-r;else{let{installPath:e}=await U(i);n&&await ut(e);let t=await W(e,async()=>{o=await K(i,n)},3);if(s=Date.now()-r,!t){let t=V(),n;if(b()){let r=Y(t,e);y(r)&&(n=je(r)?.pid)}return v(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return v(`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 We(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(z().startsWith(`win32`))try{await k(C(e),{recursive:!0});let n;try{n=await P(e)}catch{}if(n){try{let e=await P(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await M(e,r);try{await O(t,e);try{await F(r)}catch{}}catch(t){try{await M(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw g(n),n}throw t}}else try{await O(t,e)}catch(e){throw a(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return g(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=C(e);try{await k(n,{recursive:!0}),u(`Created directory ${n} for symlink`)}catch(e){return g(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await P(e),n=!0}catch{}if(n){try{let n=await j(e);if(T(C(e),n)===T(t))return!1}catch{}await F(e)}}catch(e){g(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await Ge(t,r),await M(r,e),u(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await F(r)}catch{}return g(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=V(),i=[],o=C(r.executable),s=T(o),c=z().startsWith(`win32`);try{await E(o)}catch{i.push({message:`installMethod is native, but directory ${o} does not exist`,userActionRequired:!0,type:`error`})}if(c)await H(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 j(r.executable);await H(T(C(r.executable),e))||i.push({message:`Claude 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 H(r.executable)||i.push({message:`${r.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Ve).some(e=>{try{let t=T(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=be(),t=x()[e],n=t?t.replace(S(),`~`):`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 J(e,t);if(Q)return u(`installLatest: joining in-flight call`),Q;let n=J(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function J(e,t=!1){let n=await rt(e,t);return n.success?(ce().installMethod!==`native`&&(de(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),u(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),dt(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function ct(e){try{let t=await j(e),n=T(C(e),t);if(await H(n))return n}catch{}return null}function Y(e,t){let n=Be(t);return w(e.locks,`${n}.lock`)}async function lt(){let e=V();if(!process.execPath.includes(e.versions))return;let t=T(process.execPath);try{let n=Y(e,t);if(await k(e.locks,{recursive:!0}),b()){if(!await Me(t,n)){v(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}v(`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 oe(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{u(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),u(`Acquired mtime-based lock on running version: ${t}`),ee(async()=>{try{await e?.()}catch{}})}catch(e){if(a(e)){u(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(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 X(e,t){g(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function ut(e){let t=Y(V(),e);try{await F(t),u(`Force-removed lock file at ${t}`)}catch(e){u(`Failed to force-remove lock file: ${s(e)}`)}}async function dt(){await Promise.resolve();let e=V(),t=Date.now()-36e5;if(z().startsWith(`win32`)){let t=C(e.executable);try{let e=await A(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await F(w(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 A(e.staging),r=0;for(let i of n){let n=w(e.staging,i);try{(await P(n)).mtime.getTime()<t&&(await N(n,{recursive:!0,force:!0}),r++,u(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(u(`Cleaned up ${r} orphaned staging directories`),v(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){a(e)||u(`Failed to clean up staging directories: ${e}`)}if(b()){let t=ke(e.locks);t>0&&(u(`Cleaned up ${t} stale version locks`),v(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await A(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=w(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await P(n)).mtime.getTime()<t&&(await F(n),i++,u(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await P(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:T(n),mtime:e.mtime})}catch{}}if(i>0&&(u(`Cleaned up ${i} orphaned temp install files`),v(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t&&t.includes(e.versions)&&n.add(T(t));let i=await ct(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=Y(e,t.resolvedPath),i=!1;if(b())i=y(r);else try{i=await ue(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){v(`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 W(e.path,async()=>{await F(e.path)})?o++:(s++,u(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,g(Error(`Failed to delete version ${e.name}: ${t}`))}})),v(`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)||g(Error(`Version cleanup failed: ${e}`))}}async function ft(){let e=[],t=x();for(let[n,r]of Object.entries(t))try{let t=await Se(r);if(!t)continue;let{filtered:i,hadAlias:a}=xe(t);a&&(await Ne(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){g(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function pt(e){try{let t=await p(`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 F(e),u(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(z().startsWith(`win32`)){let e=w(n,`claude.cmd`),t=w(n,`claude.ps1`),a=w(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(w(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: ${z().startsWith(`win32`)?w(n,`node_modules`,e):w(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 p(`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=w(S(),`.workmate`,`local`);try{await N(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((()=>{_(),Ee(),te(),le(),f(),we(),ae(),_e(),n(),c(),m(),ye(),se(),h(),me(),Pe(),fe(),Fe(),$e(),De(),Z=10080*60*1e3,Q=null})),gt=e((()=>{$()}));export{ft as a,lt as c,dt 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 ee,tt as te,u as ne,x as re}from"./debug-Dr1SjdXn.js";import{Kt as ie,Yt as ae}from"./settings-DiBMs2gM.js";import{C as oe,S as se,c as ce,h as le,x as ue,y as de}from"./config-9rLTDOYW.js";import{n as p,r as m}from"./execFileNoThrow-mXq4K0rl.js";import{o as h,s as g}from"./log-27kCA_9u.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{_n as fe,vn as pe}from"./model-C29_32BD.js";import{dt as me,lt as he,ut as ge}from"./sessionState-Bn3ESS5f.js";import{ft as _e,ut as ve}from"./esm-CtQkOk5D.js";import{C as ye,S as be,_ as xe,a as y,b as Se,c as Ce,d as we,g as Te,h as Ee,i as De,l as Oe,n as ke,o as b,p as Ae,s as je,t as Me,v as x,x as Ne,y as Pe}from"./pidLock-DQGDoFQP.js";import{a as Fe,i as Ie,n as Le,r as Re,t as ze}from"./xdg-DcF9ejUM.js";import{homedir as S}from"os";import{basename as Be,delimiter as Ve,dirname as C,join as w,resolve as T}from"path";import{constants as He}from"fs";import{createHash as Ue}from"crypto";import{access as E,chmod as D,copyFile as O,mkdir as k,readdir as A,readlink as j,rename as M,rm as N,rmdir as We,stat as P,symlink as Ge,unlink as F,writeFile as Ke}from"fs/promises";async function qe(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return v(`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),v(`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 g(c),c}}async function Je(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 qe(t,I)}function Ye(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||L}async function Xe(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(),Ye(),s)};try{f();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{f()},...i});d();let o=Ue(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await Ke(n,Buffer.from(a.data)),await D(n,493);return}catch(e){d();let t=r.isCancel(e);if(a=t?new R:l(e),t&&o<3){u(`Download stalled on attempt ${o}/3, retrying...`),await pe(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ze(e,t,n,i){let a=ne();await a.rm(t,{recursive:!0,force:!0});let o=z(),s=Date.now();v(`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),v(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),g(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw v(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=B(o),f=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let ee=w(t,d);try{await Xe(f,u,ee,i||{}),v(`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),v(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),g(Error(`Failed to download binary from ${f}: ${n}`)),e}}async function Qe(e,t){return await Ze(e,t,I),`binary`}var I,L,R,$e=e((()=>{i(),_(),f(),c(),m(),d(),h(),fe(),re(),$(),I=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,L=6e4,R=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function z(){let e=ie.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`&&ve.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function B(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function V(){let e=B(z());return{versions:w(Re(),`claude`,`versions`),staging:w(Le(),`claude`,`staging`),locks:w(Ie(),`claude`,`locks`),executable:w(ze(),e)}}async function H(e){try{let t=await P(e);return!t.isFile()||t.size===0?!1:(await E(e,He.X_OK),!0)}catch{return!1}}async function U(e){let t=V(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>k(e,{recursive:!0}))),await k(C(t.executable),{recursive:!0});let r=w(t.versions,e);try{await P(r)}catch{await Ke(r,``,{encoding:`utf8`})}return{stagingPath:w(t.staging,e),installPath:r}}async function W(e,t,n=0){let r=V(),i=Y(r,e);if(await k(r.locks,{recursive:!0}),b()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await Ce(e,i,async()=>{try{await t()}catch(e){throw g(e),e}}))return v(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await pe(Math.min(o*2**(r-1),s))}return v(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),X(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await oe(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 v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw g(e),e}}finally{a&&await a()}}async function G(e,t){await k(C(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await O(e,n),await D(n,493),await M(n,t),u(`Atomically installed binary to ${t}`)}catch(e){try{await F(n)}catch{}throw e}}async function et(e,t){try{let n=w(e,`node_modules`,`@anthropic-ai`),r=(await A(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw v(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=w(n,r,`cli`);try{await P(i)}catch{throw v(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await G(i,t),await N(e,{recursive:!0,force:!0}),v(`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`)&&v(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),g(l(e)),e}}async function tt(e,t){try{let n=w(e,B(z()));try{await P(n)}catch{throw v(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await G(n,t),await N(e,{recursive:!0,force:!0}),v(`tengu_native_install_binary_success`,{})}catch(e){throw s(e).includes(`Staged binary not found`)||v(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),g(l(e)),e}}async function nt(e,t,n){n===`npm`?await et(e,t):await tt(e,t)}async function K(e,n){let{stagingPath:r,installPath:i}=await U(e),{executable:a}=V(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await q(e)||n;if(s?(u(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await nt(o,i,await Qe(e,o))):u(`Version ${e} already installed, updating symlink`),await it(a),await at(a,i),!await H(a)){let e=!1;try{await P(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 q(e){let{installPath:t}=await U(e);return H(t)}async function rt(e,n=!1){let r=Date.now(),i=await Je(e),{executable:a}=V();if(u(`Checking for native installer update to version ${i}`),!n){let e=await Ae();if(e&&he(i,e)){if(u(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),ge(`0.0.13`,e))return u(`Native installer: current version 0.0.13 is already at or above maxVersion ${e}, skipping update`),v(`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.13`&&await q(i)&&await H(a))return u(`Found ${i} at ${a}, skipping install`),v(`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&&Te(i))return v(`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 K(i,n),s=Date.now()-r;else{let{installPath:e}=await U(i);n&&await ut(e);let t=await W(e,async()=>{o=await K(i,n)},3);if(s=Date.now()-r,!t){let t=V(),n;if(b()){let r=Y(t,e);y(r)&&(n=je(r)?.pid)}return v(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return v(`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 We(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(z().startsWith(`win32`))try{await k(C(e),{recursive:!0});let n;try{n=await P(e)}catch{}if(n){try{let e=await P(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await M(e,r);try{await O(t,e);try{await F(r)}catch{}}catch(t){try{await M(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw g(n),n}throw t}}else try{await O(t,e)}catch(e){throw a(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return g(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=C(e);try{await k(n,{recursive:!0}),u(`Created directory ${n} for symlink`)}catch(e){return g(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await P(e),n=!0}catch{}if(n){try{let n=await j(e);if(T(C(e),n)===T(t))return!1}catch{}await F(e)}}catch(e){g(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await Ge(t,r),await M(r,e),u(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await F(r)}catch{}return g(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=V(),i=[],o=C(r.executable),s=T(o),c=z().startsWith(`win32`);try{await E(o)}catch{i.push({message:`installMethod is native, but directory ${o} does not exist`,userActionRequired:!0,type:`error`})}if(c)await H(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 j(r.executable);await H(T(C(r.executable),e))||i.push({message:`Claude 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 H(r.executable)||i.push({message:`${r.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Ve).some(e=>{try{let t=T(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=be(),t=x()[e],n=t?t.replace(S(),`~`):`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 J(e,t);if(Q)return u(`installLatest: joining in-flight call`),Q;let n=J(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function J(e,t=!1){let n=await rt(e,t);return n.success?(ce().installMethod!==`native`&&(de(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),u(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),dt(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function ct(e){try{let t=await j(e),n=T(C(e),t);if(await H(n))return n}catch{}return null}function Y(e,t){let n=Be(t);return w(e.locks,`${n}.lock`)}async function lt(){let e=V();if(!process.execPath.includes(e.versions))return;let t=T(process.execPath);try{let n=Y(e,t);if(await k(e.locks,{recursive:!0}),b()){if(!await Me(t,n)){v(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}v(`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 oe(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{u(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),u(`Acquired mtime-based lock on running version: ${t}`),ee(async()=>{try{await e?.()}catch{}})}catch(e){if(a(e)){u(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(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 X(e,t){g(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function ut(e){let t=Y(V(),e);try{await F(t),u(`Force-removed lock file at ${t}`)}catch(e){u(`Failed to force-remove lock file: ${s(e)}`)}}async function dt(){await Promise.resolve();let e=V(),t=Date.now()-36e5;if(z().startsWith(`win32`)){let t=C(e.executable);try{let e=await A(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await F(w(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 A(e.staging),r=0;for(let i of n){let n=w(e.staging,i);try{(await P(n)).mtime.getTime()<t&&(await N(n,{recursive:!0,force:!0}),r++,u(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(u(`Cleaned up ${r} orphaned staging directories`),v(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){a(e)||u(`Failed to clean up staging directories: ${e}`)}if(b()){let t=ke(e.locks);t>0&&(u(`Cleaned up ${t} stale version locks`),v(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await A(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=w(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await P(n)).mtime.getTime()<t&&(await F(n),i++,u(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await P(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:T(n),mtime:e.mtime})}catch{}}if(i>0&&(u(`Cleaned up ${i} orphaned temp install files`),v(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t&&t.includes(e.versions)&&n.add(T(t));let i=await ct(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=Y(e,t.resolvedPath),i=!1;if(b())i=y(r);else try{i=await ue(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){v(`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 W(e.path,async()=>{await F(e.path)})?o++:(s++,u(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,g(Error(`Failed to delete version ${e.name}: ${t}`))}})),v(`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)||g(Error(`Version cleanup failed: ${e}`))}}async function ft(){let e=[],t=x();for(let[n,r]of Object.entries(t))try{let t=await Se(r);if(!t)continue;let{filtered:i,hadAlias:a}=xe(t);a&&(await Ne(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){g(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function pt(e){try{let t=await p(`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 F(e),u(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(z().startsWith(`win32`)){let e=w(n,`claude.cmd`),t=w(n,`claude.ps1`),a=w(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(w(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: ${z().startsWith(`win32`)?w(n,`node_modules`,e):w(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 p(`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=w(S(),`.workmate`,`local`);try{await N(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((()=>{_(),Ee(),te(),le(),f(),we(),ae(),_e(),n(),c(),m(),ye(),se(),h(),me(),Pe(),fe(),Fe(),$e(),De(),Z=10080*60*1e3,Q=null})),gt=e((()=>{$()}));export{ft as a,lt as c,dt 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{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{AE as r,HT as i,IT as a,LT as o,UT as s,kE as c}from"./loadAgentsDir-mcRW90aq.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-BPFYBqm1.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-DiBMs2gM.js";import{I as j,L as M}from"./config-9rLTDOYW.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,i(t,0,-1))}var U=e((()=>{d(),s()}));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(o(t))]}var G,K=e((()=>{y(),a(),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(),r(),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=c(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-BPFYBqm1.js";import{R as n,U as r}from"./debug-Dr1SjdXn.js";import{Ft as i,Mt as a,zt as o}from"./settings-DiBMs2gM.js";import{c as s,h as c,y as l}from"./config-9rLTDOYW.js";import{o as u,s as d}from"./log-27kCA_9u.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-
|
|
1
|
+
import{Mn as e,Wt as t}from"./state-BPFYBqm1.js";import{R as n,U as r}from"./debug-Dr1SjdXn.js";import{Ft as i,Mt as a,zt as o}from"./settings-DiBMs2gM.js";import{c as s,h as c,y as l}from"./config-9rLTDOYW.js";import{o as u,s as d}from"./log-27kCA_9u.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-C29_32BD.js";import{a as g,i as _,n as v}from"./sessionState-Bn3ESS5f.js";import{r as y,t as b}from"./managedEnv-Ds6MlFQE.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{m(),p(),h(),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{
|
|
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{B_ as i,Dy as a,Ja as o,Ka as s,V_ as c,ha as l,jy as u,ot as d,rt as f,wa as p,z_ as m,za as h}from"./loadAgentsDir-mcRW90aq.js";import{c as g,i as _}from"./debug-Dr1SjdXn.js";import{Kn as v,Un as ee,V as te,W as y}from"./model-C29_32BD.js";import{bn as b,i as x,r as S,t as C,xn as ne,yn as re}from"./prompt-DIlq8NTy.js";import{F as ie,I as w,M as T,N as E,R as D,it as O}from"./sessionState-Bn3ESS5f.js";import{n as k,r as A}from"./client-BMA05FW8.js";import{n as ae,t as j}from"./openaiShared-G2-w4gJt.js";import{homedir as M}from"os";import{join as N}from"path";import{randomUUID as P}from"crypto";import{chmod as oe,mkdir as se,readFile as ce,writeFile as F}from"fs/promises";function I(){return N(L(),J)}function L(){return(process.env.WORKMATE_CONFIG_DIR??N(M(),`.workmate`)).normalize(`NFC`)}function R(){return N(process.env.CODEX_HOME??N(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 ce(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 se(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 oe(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&&g(`[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((()=>{_(),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(`
|
|
@@ -6,5 +6,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}f
|
|
|
6
6
|
`);for(;a>=0;){let e=r.slice(0,a);r=r.slice(a+2);let t=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
7
7
|
`);if(t&&t!==`[DONE]`){let e=JSON.parse(t);e&&typeof e==`object`&&(yield e)}a=r.indexOf(`
|
|
8
8
|
|
|
9
|
-
`)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${
|
|
10
|
-
`);return
|
|
9
|
+
`)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${P().replace(/-/g,``).slice(0,24)}`,r=new Map,i=!1,a=-1,o=!1,s=!1,c=async function*(){i||(i=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0}}})};for await(let t of e){for await(let e of c())yield e;let e=t.type;if(e===`response.output_text.delta`){o||(s&&(yield{type:`content_block_stop`,index:a},s=!1),a++,o=!0,yield{type:`content_block_start`,index:a,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`text_delta`,text:String(t.delta??``)}};continue}if(e===`response.reasoning_text.delta`){s||(o&&(yield{type:`content_block_stop`,index:a},o=!1),a++,s=!0,yield{type:`content_block_start`,index:a,content_block:{type:`thinking`,thinking:``,signature:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`thinking_delta`,thinking:String(t.delta??``)}};continue}if(e===`response.output_item.added`){let e=t.item,n=typeof t.output_index==`number`?t.output_index:-1;if(e?.type===`function_call`&&n>=0){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1),a++;let t=String(e.call_id??e.id??`call_${n}`),i=String(e.name??``);r.set(n,{contentIndex:a,open:!0,name:i,id:t}),yield{type:`content_block_start`,index:a,content_block:{type:`tool_use`,id:t,name:i,input:{}}}}continue}if(e===`response.function_call_arguments.delta`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n&&(yield{type:`content_block_delta`,index:n.contentIndex,delta:{type:`input_json_delta`,partial_json:String(t.delta??``)}});continue}if(e===`response.output_item.done`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n?.open&&(yield{type:`content_block_stop`,index:n.contentIndex},n.open=!1);continue}if(e===`response.error`){let e=t.error;throw Error(String(e?.message??`ChatGPT Responses API error`))}if(e===`response.failed`){let e=t.response?.error;throw Error(String(e?.message??`ChatGPT Responses API failed`))}if(e===`response.completed`||e===`response.incomplete`){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1);let e=t.response;yield{type:`message_delta`,delta:{stop_reason:xe(e),stop_sequence:null},usage:be(e)},yield{type:`message_stop`}}}}async function Se(e){let t=await pe(),n=e.fetchOverride??globalThis.fetch,r={Authorization:`Bearer ${t.accessToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`,"OpenAI-Beta":`responses=experimental`,Origin:`https://chatgpt.com`,Referer:`https://chatgpt.com/`,originator:`workmate`};t.accountId&&(r[`ChatGPT-Account-Id`]=t.accountId);let i=await n(`https://chatgpt.com/backend-api/codex/responses`,{method:`POST`,headers:r,body:JSON.stringify(e.request),signal:e.signal});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`ChatGPT Responses API request failed (${i.status})${e?`: ${e.slice(0,500)}`:``}`)}return ye(i)}var Ce=e((()=>{X()}));function we(e){if(t(process.env.OPENAI_ENABLE_THINKING))return!1;if(n(process.env.OPENAI_ENABLE_THINKING))return!0;let r=e.toLowerCase();return r.includes(`deepseek`)||r.includes(`mimo`)}function Te(e,t){return t??(process.env.OPENAI_MAX_TOKENS&&parseInt(process.env.OPENAI_MAX_TOKENS,10)||void 0)??(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS&&parseInt(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS,10)||void 0)??e}function Ee(e){let{model:t,messages:n,tools:r,toolChoice:i,enableThinking:a,maxTokens:o,temperatureOverride:s}=e;return{model:t,messages:n,max_tokens:o,...r.length>0&&{tools:r,...i&&{tool_choice:i}},stream:!0,stream_options:{include_usage:!0},...a&&{thinking:{type:`enabled`},enable_thinking:!0,chat_template_kwargs:{thinking:!0,enable_thinking:!0}},...!a&&s!==void 0&&{temperature:s}}}var De=e((()=>{r()}));function Oe(e,t,n,r){if(!r||i())return e;let a=t.filter(e=>n.has(e.name)).map(C).sort().join(`
|
|
10
|
+
`);return a?[p({content:`<available-deferred-tools>\n${a}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function ke(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:a,stopReason:o,maxTokens:c}=e,u=[],d=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return d.length>0&&t&&u.push({message:{...t,content:s(d,r,i),usage:a,stop_reason:o,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:P(),timestamp:new Date().toISOString()}),o===`max_tokens`&&u.push(l({content:`Output truncated: response exceeded the ${c} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),u}async function*Ae(e,t,n,r,i){try{let s=O(i.model),l=o(e,n),u=await c(i.model,n,i.getToolPermissionContext||(async()=>re()),i.agents||[],i.querySource),f=new Set;if(u)for(let e of n)x(e)&&f.add(e.name);let p=n;u&&f.size>0&&(p=n.filter(e=>!!(!f.has(e.name)||ne(e,`SearchExtraTools`))));let m=(await Promise.all(p.map(e=>d(e,{getToolPermissionContext:i.getToolPermissionContext,tools:n,agents:i.agents,allowedAgentTypes:i.allowedAgentTypes,model:i.model,deferLoading:u&&f.has(e.name)})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),h=we(s),_=D(Oe(l.filter(ke),n,f,u),t,{enableThinking:h}),v=w(m),y=ie(i.toolChoice);if(u){let e=p.filter(e=>f.has(e.name)).length;g(`[OpenAI] Tool search enabled: ${e}/${f.size} deferred tools included, total tools=${v.length}`)}else g(`[OpenAI] Tool search disabled, total tools=${v.length}`);let{upperLimit:b}=ee(s),S=Te(b,i.maxOutputTokensOverride);g(`[OpenAI] Calling model=${s}, messages=${_.length}, tools=${v.length}, thinking=${h}`);let C=fe()?Q(await Se({request:ve({model:s,messages:_,tools:v,toolChoice:y}),signal:r,fetchOverride:i.fetchOverride}),s):E(await k({maxRetries:0,fetchOverride:i.fetchOverride,source:i.querySource}).chat.completions.create(Ee({model:s,messages:_,tools:v,toolChoice:y,enableThinking:h,maxTokens:S,temperatureOverride:i.temperatureOverride}),{signal:r}),s),T={},A=null,j=null,M={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},N=0,P=Date.now();for await(let e of C){switch(e.type){case`message_start`:A=e.message,N=Date.now()-P,e.message.usage&&(M={...M,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?T[t]={...n,input:``}:n.type===`text`?T[t]={...n,text:``}:n.type===`thinking`?T[t]={...n,thinking:``,signature:``}:T[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=T[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(M=ae(M,t)),e.delta.stop_reason!=null&&(j=e.delta.stop_reason);break}case`message_stop`:if(A){for(let e of $({partialMessage:A,contentBlocks:T,tools:n,agentId:i.agentId,usage:M,stopReason:j,maxTokens:S}))yield e;A=null}M.input_tokens+M.output_tokens>0&&a(te(s,M),M,i.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:N}:void 0}}if(A)for(let e of $({partialMessage:A,contentBlocks:T,tools:n,agentId:i.agentId,usage:M,stopReason:j,maxTokens:S}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);g(`[OpenAI] Error: ${t}`,{level:`error`}),yield l({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{A(),j(),T(),X(),Ce(),h(),f(),b(),_(),u(),y(),De(),v(),m(),S()}))();export{Ae as queryModelOpenAI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{RT as t,zT as n}from"./loadAgentsDir-mcRW90aq.js";import{Cr as r,Sr as i,bi as a,xi as o}from"./state-BPFYBqm1.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,n,r,i){return t(e,function(e,t,a){n(i,e,r(e),a)}),i}var u=e((()=>{n()}));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};
|
|
@@ -0,0 +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{B as i,EC as a,Jg as o,Jm as s,MC as c,Qg as l,R as u,U as d,V as ee,W as f,Xu as p,Zg as m,Zu as h,ag as te,gT as ne,ng as g,od as _,qm as v,rg as re,sd as ie,yT as y,ya as b,z as ae,za as x}from"./loadAgentsDir-mcRW90aq.js";import{I as S,P as C,Wt as oe,Xn as se,a as w,di as T,fi as E,hn as D,k as O,kt as k,n as A,o as j,ot as ce,r as le,s as ue,t as M,ui as N,x as de,y as P}from"./src-P_wYS_NJ2.js";import{t as F}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as fe,et as I}from"./state-BPFYBqm1.js";import{C as L,x as pe}from"./debug-Dr1SjdXn.js";import{H as R,V as z,g as me,ln as B,o as V,rn as he,z as H}from"./settings-DiBMs2gM.js";import{l as ge,o as _e}from"./stringUtils-Df-Lnjxd.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-CPLBDluY.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-BzNj9rS6.js";import{t as Se}from"./SearchBox-C9vUA4IM.js";import{n as Ce,t as we}from"./useSearchInput-KFKh2ozY.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-D5X5fhzj.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case v.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,ke=e((()=>{E(),M(),s(),W=F()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${V(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${V(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.workmate/settings.json`,value:e}}}function je({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let s=he.map(Ae),c=(0,Me.useCallback)(s=>{if(s===`cancel`){t();return}else if(he.includes(s)){let t=s,c=o(i,{type:`addRules`,rules:n,behavior:r,destination:t});l({type:`addRules`,rules:n,behavior:r,destination:t}),a(c);let u=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),d=Ee(c,{sandboxAutoAllowEnabled:ne.isSandboxingEnabled()&&ne.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(u,d.length>0?d:void 0)}},[e,t,n,r,i,a]);return(0,G.jsxs)(P,{title:`Add ${r} permission ${ge(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)(Oe,{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:s,onChange:c})]})]})}var Me,G,Ne=e((()=>{E(),Me=t(E(),1),h(),M(),m(),H(),Te(),y(),B(),me(),_e(),ke(),G=F()}));function Pe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[i,a]=(0,Fe.useState)(``),[o,s]=(0,Fe.useState)(0),c=ve();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)(k,{}),`e.g., `,(0,K.jsx)(C,{bold:!0,children:R({toolName:v.name})}),(0,K.jsx)(C,{bold:!1,children:` or `}),(0,K.jsx)(C,{bold:!0,children:R({toolName:v.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(S,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(_,{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 Fe,K,Ie=e((()=>{n(),E(),Fe=t(E(),1),ie(),ye(),c(),M(),a(),s(),H(),K=F()}));function Le({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})},[]),ee=(0,q.useCallback)(e=>{u(Number(e))},[]);if(D((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 f=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:f,onChange:d,onFocus:ee,visibleOptionCount:Math.min(10,f.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,Re=e((()=>{E(),q=t(E(),1),M(),U(),h(),J=F()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,Be.useCallback)(()=>{i(o(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),s=(0,Be.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:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(p,{onChange:s,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{E(),Be=t(E(),1),h(),M(),m(),Y=F()}));function He({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=Ue.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&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=Ue.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 Ue,X,Z,We=e((()=>{n(),Ue=t(E(),1),X=t(E(),1),fe(),h(),M(),Z=F()}));function Ge({rule:e}){return(0,$.jsx)(C,{dimColor:!0,children:`From ${f(e.source)}`})}function Ke(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function qe({rule:e,onDelete:t,onCancel:n}){let r=ve();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)(Oe,{ruleValue:e.ruleValue}),(0,$.jsx)(Ge,{rule:e})]}),a=(0,$.jsx)(S,{marginLeft:3,children:r.pending?(0,$.jsxs)(C,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(C,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(S,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(C,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(C,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
+
`,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(S,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(C,{bold:!0,color:`error`,children:[`Delete `,Ke(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 Je(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,u=j(),{headerFocused:d,focusHeader:ee,blurHeader:f}=w();return(0,Q.useEffect)(()=>{r&&d&&f()},[r,d,f]),(0,Q.useEffect)(()=>{l?.(d)},[d,l]),(0,$.jsxs)(S,{flexDirection:`column`,children:[(0,$.jsx)(S,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(O,{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:ee})]})}function Ye({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:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Je,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Xe({onExit:e,initialTab:t,onRetryDenials:n}){let a=De().length>0,s=t??(a?`recent`:`allow`),[c,d]=(0,Q.useState)([]),f=re(e=>e.toolPermissionContext),p=te(),m=se(),h=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),ne=(0,Q.useCallback)(e=>{h.current=e},[]),[g,_]=(0,Q.useState)(),[v,ie]=(0,Q.useState)(),[y,b]=(0,Q.useState)(null),[x,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(!1),[ce,ue]=(0,Q.useState)(!0),M=(0,Q.useCallback)(e=>{ue(e)},[]),P=(0,Q.useMemo)(()=>{let e=new Map;return ae(f).forEach(t=>{e.set(L(t),t)}),e},[f]),F=(0,Q.useMemo)(()=>{let e=new Map;return ee(f).forEach(t=>{e.set(L(t),t)}),e},[f]),fe=(0,Q.useMemo)(()=>{let e=new Map;return i(f).forEach(t=>{e.set(L(t),t)}),e},[f]),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=ve(),z=!g&&!y&&!x&&!T&&!D,{query:me,setQuery:B,cursorOffset:V}=Ce({isActive:z&&k,onExit:()=>{j(!1)}}),he=(0,Q.useCallback)(e=>{z&&(k||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),j(!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(),j(!0),B(e.key))))},[z,k,B]),H=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){b(t);return}else{_(n.get(e));return}},[I]),ge=(0,Q.useCallback)(()=>{b(null)},[]),_e=(0,Q.useCallback)((e,t)=>{w({ruleValue:e,ruleBehavior:t}),b(null)},[]),ye=(0,Q.useCallback)((e,t)=>{w(null);for(let t of e)d(e=>[...e,`Added ${t.ruleBehavior} rule ${N.bold(R(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;d(n=>[...n,N.yellow(`${r.warning} Warning: ${R(e.rule.ruleValue)} is ${t}`),N.dim(` ${e.reason}`),N.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{w(null)},[]),Se=(0,Q.useCallback)(()=>E(!0),[]),we=(0,Q.useCallback)(e=>O(e),[]),Te=(0,Q.useCallback)(()=>{let t=h.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||c.length>0?e([...a.length>0?[`Approved ${a.map(e=>N.bold(e.display)).join(`, `)}`]:[],...c].join(`
|
|
3
|
+
`)):e(`Permissions dialog dismissed`,{display:`system`})},[c,e,n]);oe(`confirm:no`,Te,{context:`Settings`,isActive:z&&!k});let Ee=()=>{if(!g)return;let{options:e}=I(g.ruleBehavior),t=L(g),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),u({rule:g,initialContext:f,setToolPermissionContext(e){p(t=>({...t,toolPermissionContext:e}))}}),d(e=>[...e,`Deleted ${g.ruleBehavior} rule ${N.bold(R(g.ruleValue))}`]),_(void 0)};if(g)return(0,$.jsx)(qe,{rule:g,onDelete:Ee,onCancel:()=>_(void 0)});if(y&&y!==`workspace`&&y!==`recent`)return(0,$.jsx)(Pe,{onCancel:ge,onSubmit:_e,ruleBehavior:y});if(x)return(0,$.jsx)(je,{onAddRules:ye,onCancel:be,ruleValues:[x.ruleValue],ruleBehavior:x.ruleBehavior,initialContext:f,setToolPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});if(T)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=o(f,n);p(e=>({...e,toolPermissionContext:r})),t&&l(n),d(n=>[...n,`Added directory ${N.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),E(!1)},onCancel:()=>E(!1),permissionContext:f});if(D)return(0,$.jsx)(ze,{directoryPath:D,onRemove:()=>{d(e=>[...e,`Removed directory ${N.bold(D)} from workspace`]),O(null)},onCancel:()=>O(null),permissionContext:f,setPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:me,isSearchMode:k,isFocused:m,onCancel:Te,lastFocusedRuleKey:v,cursorOffset:V,getRulesOptions:I,handleToolSelect:H,onHeaderFocusChange:M};return(0,$.jsx)(S,{flexDirection:`column`,onKeyDown:he,children:(0,$.jsxs)(de,{color:`permission`,children:[(0,$.jsxs)(le,{title:`Permissions:`,color:`permission`,defaultTab:s,hidden:!!g||!!y||!!x||T||!!D,initialHeaderFocused:!a,navFromContent:!k,children:[(0,$.jsx)(A,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:M,onStateChange:ne})}),(0,$.jsx)(A,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ye,{tab:`allow`,...U})}),(0,$.jsx)(A,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ye,{tab:`ask`,...U})}),(0,$.jsx)(A,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ye,{tab:`deny`,...U})}),(0,$.jsx)(A,{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)(He,{onExit:e,toolPermissionContext:f,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:M})]})})]}),(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`}):k?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):a&&s===`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,$,Ze=e((()=>{T(),n(),E(),Q=t(E(),1),g(),m(),h(),ye(),we(),M(),a(),U(),H(),d(),pe(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=F()})),Qe,$e;e((()=>{Ze(),x(),Qe=F(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,b(e)])}})}))();export{$e as call};
|
|
@@ -0,0 +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{n as s,t as c}from"./axios-DaWTGg7G.js";import{Zd as l,gT as ee,yT as te}from"./loadAgentsDir-mcRW90aq.js";import{n as ne}from"./cwd-Besi3Os3.js";import{B as re,C as ie,D as ae,R as u,S as d,T as oe,U as se,V as ce,c as f,f as p,i as m,u as h,x as g}from"./debug-Dr1SjdXn.js";import{Kt as le,M as _,P as ue,Qt as de,Xt as fe,Yt as pe,g as me,n as he}from"./settings-DiBMs2gM.js";import{a as ge,c as v,h as y,i as _e}from"./config-9rLTDOYW.js";import{c as ve,n as b,o as ye,r as x,t as S}from"./execFileNoThrow-mXq4K0rl.js";import{o as C,s as w}from"./log-27kCA_9u.js";import{n as be,t as xe}from"./which-mplwBbc0.js";import{i as T,o as E}from"./platform-Dg1c9F_1.js";import{n as D,t as Se}from"./bundledMode--fG1S62b.js";import{dt as Ce,ut as we}from"./sessionState-Bn3ESS5f.js";import{a as Te,i as Ee}from"./ripgrep-DQ_ILUJV.js";import{i as De,r as Oe}from"./genericProcessUtils-Dc1pfb7J.js";import{homedir as O}from"os";import{basename as ke,delimiter as Ae,join as k,posix as A,win32 as j}from"path";import{constants as je}from"fs";import{access as M,open as Me,readFile as N,realpath as P,stat as Ne}from"fs/promises";function F(){return k(i(),`local`)}function Pe(){return k(F(),`claude`)}function Fe(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function I(){try{return await M(k(F(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function L(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var R=e((()=>{y(),o(),u(),x(),p(),C(),g()}));function z(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 Ie(e){let t=!1;return{filtered:e.filter(e=>{if(V.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n&&n[1]&&n[1].trim()===Pe())return t=!0,!1}return!0}),hadAlias:t}}async function B(e){try{return(await N(e,{encoding:`utf8`})).split(`
|
|
2
|
+
`)}catch(e){if(ce(e))return null;throw e}}async function Le(e,t){let n=await Me(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
+
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function Re(e){let t=z(e);for(let e of Object.values(t)){let t=await B(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await Re(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 V,H=e((()=>{u(),R(),V=/^\s*alias\s+claude\s*=/}));async function Be(){}function Ve(e){let t=he()?.minimumVersion;if(!t)return!1;let n=!we(e,t);return n&&f(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=le.isRunningWithBun(),t=null;return t=e?await b(`bun`,[`pm`,`bin`,`-g`],{cwd:O()}):await b(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:O()}),t.code===0?t.stdout.trim():(w(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 M(e,je.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return w(new Je(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return w(e),{hasPermissions:!1,npmPrefix:null}}}async function We(){let e=await b(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:O()});if(e.code!==0)return f(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=d(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return f(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ge(e){try{return(await s.get(`${qe}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return f(`Failed to fetch ${e} from GCS: ${t}`),null}}async function Ke(){let[e,t]=await Promise.all([Ge(`latest`),Ge(`stable`)]);return{latest:e,stable:t}}var qe,Je,Ye=e((()=>{c(),y(),m(),pe(),o(),u(),x(),p(),l(),C(),Ce(),me(),H(),g(),qe=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Je=class extends ae{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Xe(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(f(`Detected mise installation: ${e}`),!0):!1}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(f(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=T();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(f(`Detected Homebrew cask installation: ${t}`),!0):!1}function Qe(){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 f(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,$e,et=e((()=>{n(),m(),x(),E(),G=t(async()=>{try{let e=await N(`/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}}),K=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await S(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await S(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await S(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await S(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),$e=t(async()=>W()?`homebrew`:Qe()?`winget`:Xe()?`mise`:Ze()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function tt(){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 nt(){let[e]=tt();if(D())return W()||Qe()||Xe()||Ze()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Fe())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 ye(`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 rt(){if(D()){try{return await P(process.execPath)}catch{}try{let e=await be(`claude`);if(e)return e}catch{}try{return await h().stat(k(O(),`.local/bin/claude`)),k(O(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function it(){try{return D()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function at(){let e=h(),t=[],n=k(O(),`.workmate`,`local`);await I()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/workmate`],i=await S(`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 P(o)).includes(`/Caskroom/`)&&(e=W())}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 ot(e){let t=[];try{let e=d(await N(k(fe(),`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: ${_.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!_.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: ${_.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(Ae),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=L(),n=z()[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 I()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await Re(),i=await ze();return e===`npm-local`&&!await be(`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 st(){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 ct(){let e=await nt(),t=typeof MACRO<`u`?`0.0.13`:`unknown`,n=await rt(),r=it(),i=await at(),a=await ot(e);if(a.push(...st()),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&&!ge()&&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=Ee(),l={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},ee=e===`package-manager`?await $e():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=ge();return e?`disabled (${_e(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:ee,ripgrepStatus:l}}var lt=e((()=>{ve(),Ye(),Se(),y(),ne(),o(),x(),p(),R(),et(),E(),Te(),te(),de(),ue(),H(),g(),xe()}));function ut(){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 dt(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=Oe(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=h();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=d(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(!dt(n,r))return f(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=h();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function ft(e,t){let n=h(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{oe(r,ie(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function pt(e,t){let n=h(),r=ke(e);if(Q(t))return f(`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 ft(t,i),Z(t)?.pid===process.pid?(f(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),f(`Released PID lock for ${r}`))}catch(e){f(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return f(`Failed to acquire lock for ${r}: ${e}`),null}}async function mt(e,t){let n=await pt(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 ht(e,t,n){let r=await pt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function gt(e){let t=h(),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(re(e))return n;w(se(e))}return n}function _t(e){let t=h(),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++,f(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,f(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(re(e))return 0;w(se(e))}return n}var $,vt=e((()=>{m(),o(),u(),p(),De(),C(),g(),$=7200*1e3}));export{R as C,L as S,Ie as _,Q as a,B as b,ht as c,lt as d,Ke as f,Ve as g,Ye as h,vt as i,nt as l,We as m,_t as n,ut as o,Be as p,gt as r,Z as s,mt as t,ct as u,z as v,Le as x,H as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Jg as t,Ob as n,S as r,Zg as i,bb as a,k as o,lE as s,pE as c,uE as l}from"./loadAgentsDir-mcRW90aq.js";import{I as u,P as d,fi as f,t as p}from"./src-P_wYS_NJ2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as h,zt as g}from"./state-BPFYBqm1.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-BILqOGl1.js";import{r as x,t as S}from"./staticRender-DrU6eWoq.js";function C({planContent:e,planPath:t,editorName:n}){return(0,T.jsxs)(u,{flexDirection:`column`,children:[(0,T.jsx)(d,{bold:!0,children:`Current Plan`}),(0,T.jsx)(d,{dimColor:!0,children:t}),(0,T.jsx)(u,{marginTop:1,children:(0,T.jsx)(d,{children:e})}),n&&(0,T.jsxs)(u,{marginTop:1,children:[(0,T.jsx)(d,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(d,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(d,{bold:!0,dimColor:!0,children:n})]})]})}async function w(e,r,i){let{getAppState:a,setAppState:c}=r,u=a().toolPermissionContext.mode;if(u!==`plan`){g(u,`plan`),c(e=>({...e,toolPermissionContext:t(o(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let n=i.trim();return n&&n!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let d=s(),f=l();if(!d)return e(`Already in plan mode. No plan written yet.`),null;if(i.trim().split(/\s+/)[0]===`open`){let t=await b(f);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${f}`),null}let p=v();return e(await x((0,T.jsx)(C,{planContent:d,planPath:f,editorName:p?n(p):void 0}))),null}var T;e((()=>{f(),h(),p(),_(),a(),i(),r(),c(),y(),S(),T=m()}))();export{w as call};
|