@readmagic/workmate 0.0.4 → 0.0.6
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-BTC7FPqM.js → AddWorkspaceDirectory-ClHi-Dr6.js} +1 -1
- package/dist/chunks/{App-DOm71vtY.js → App-BP06lHmf.js} +1 -1
- package/dist/chunks/{ApproveApiKey-9YQzwrrC.js → ApproveApiKey-Bsy8kr2a.js} +1 -1
- package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-CnYfFWrx.js → AssistantSessionChooser-CcocKoTJ.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-DNeBhGCf.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-DAq-qbqC.js → BypassPermissionsModeDialog-BKj_3Idm.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-CyvidoR3.js → ClaudeMdExternalIncludesDialog-BD-7yAZh.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +1 -0
- package/dist/chunks/{DesktopHandoff-gRvy-WlW.js → DesktopHandoff-BmPmCfT3.js} +1 -1
- package/dist/chunks/{DiffDialog-CdfVTgOx.js → DiffDialog-C4XSSjvV.js} +2 -2
- package/dist/chunks/Doctor-BhD-ZzZm.js +1 -0
- package/dist/chunks/Doctor-DEQe2q16.js +3 -0
- package/dist/chunks/ExitFlow-BttnAv-O.js +2 -0
- package/dist/chunks/{Feedback-gGpjUC_F.js → Feedback-BaYA8-SU.js} +2 -2
- package/dist/chunks/Grove-BJziCbZH.js +11 -0
- package/dist/chunks/Grove-sWm-oLBf.js +1 -0
- package/dist/chunks/{HybridTransport-kN1jmg26.js → HybridTransport-B8V6O6rM.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-BpJub73a.js → InvalidConfigDialog-CHzBSJDf.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-DzOp3Ihx.js → InvalidSettingsDialog-BKenH3bD.js} +1 -1
- package/dist/chunks/MCPConnectionManager-CNh9dNlk.js +1 -0
- package/dist/chunks/{McpParsingWarnings-Cc6FWyU4.js → McpParsingWarnings-Bj2-YL8o.js} +1 -1
- package/dist/chunks/MessageSelector-DdR6wJhh.js +3 -0
- package/dist/chunks/Messages-Ch6cboMV.js +11 -0
- package/dist/chunks/{Onboarding-D00lTweB.js → Onboarding-BrAJp0aL.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-B-Bf_-UX.js → OverageCreditUpsell-Ds1cB7RC.js} +1 -1
- package/dist/chunks/PluginSettings-CGqEzejq.js +17 -0
- package/dist/chunks/{PromptInputFooterSuggestions-MwS_cExV.js → PromptInputFooterSuggestions-egs9VvUs.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-V2dEpzhC.js → PromptInputHelpMenu-SieM5NoY.js} +1 -1
- package/dist/chunks/QueryEngine-CZZMl3PB.js +1 -0
- package/dist/chunks/REPL-CG2N7E4Q.js +142 -0
- package/dist/chunks/REPL-DvA910N_.js +1 -0
- package/dist/chunks/{RemoteCallout-ChCjmgw1.js → RemoteCallout-Cs-ro8_i.js} +1 -1
- package/dist/chunks/RemoteSessionManager-B740Dp6m.js +2 -0
- package/dist/chunks/ResumeConversation-DzV2zmuX.js +1 -0
- package/dist/chunks/{SSETransport-h43pQVlJ.js → SSETransport-DtpMDekF.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +1 -0
- package/dist/chunks/Settings-XKw6FI_m.js +2 -0
- package/dist/chunks/{TeleportProgress-QtJrXSCX.js → TeleportProgress-rYaHIEfe.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-D-HVj-A6.js → TeleportRepoMismatchDialog-DY97YZMB.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-C6sbzJsJ.js → TeleportResumeWrapper-jaQzyTCh.js} +1 -1
- package/dist/chunks/{ThemePicker-CqPCp5Hs.js → ThemePicker-BViWzLp3.js} +1 -1
- package/dist/chunks/{TrustDialog-CeVwxDlZ.js → TrustDialog-DGJ_BisZ.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-Bl68E-2-.js → ValidationErrorsList-B8pRiGuy.js} +1 -1
- package/dist/chunks/{WelcomeV2-DNiXQ5ES.js → WelcomeV2-DqnbSdIu.js} +1 -1
- package/dist/chunks/{add-dir-V3xjklnJ.js → add-dir-C2Hu3oE4.js} +1 -1
- package/dist/chunks/{agentDisplay-BuiwcrQi.js → agentDisplay-XoDJhr03.js} +1 -1
- package/dist/chunks/agents-BIHTGDYh.js +103 -0
- package/dist/chunks/{agents-ZY6IaVE7.js → agents-C4QXeHIJ.js} +1 -1
- package/dist/chunks/allErrors-1896uQA1.js +1 -0
- package/dist/chunks/{ant-D66LZCap.js → ant-B6k6cBts.js} +1 -1
- package/dist/chunks/api-BsFW57_Q.js +1 -0
- package/dist/chunks/api-gqTA-D7n.js +1 -0
- package/dist/chunks/{assistant-CYF7ch7C.js → assistant-DJ9hd4uC.js} +1 -1
- package/dist/chunks/auth-8Vd3_U8t.js +1 -0
- package/dist/chunks/auth-BnSrKyJe.js +15 -0
- package/dist/chunks/auth-DRTjfnGy.js +1 -0
- package/dist/chunks/{autoMode-TysBQkU_.js → autoMode-BNukrVAB.js} +1 -1
- package/dist/chunks/{autonomy-k3QPea5z.js → autonomy-BEmI7WVW.js} +1 -1
- package/dist/chunks/{autonomy-CNEbT-t_.js → autonomy-DGcy5Rml.js} +7 -7
- package/dist/chunks/{autonomyPanel-DiztRblF.js → autonomyPanel-fhge09AG.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +1 -0
- package/dist/chunks/backgroundHousekeeping-BVMf_Tjn.js +17 -0
- package/dist/chunks/{branch-_NBgDfrK.js → branch-Bpe-gocq.js} +1 -1
- package/dist/chunks/{break-cache-BQfgkNAo.js → break-cache-C_p7Kmx2.js} +3 -3
- package/dist/chunks/{bridge-DpmFl8p8.js → bridge-D12Shbkj.js} +2 -2
- package/dist/chunks/{bridgeConfig-DMBOO3gW.js → bridgeConfig-BhxRF2vm.js} +1 -1
- package/dist/chunks/bridgeConfig-CqIQ_rvD.js +1 -0
- package/dist/chunks/bridgeEnabled-D0XC5kNh.js +1 -0
- package/dist/chunks/bridgeEnabled-SbB-6zdY.js +1 -0
- package/dist/chunks/bridgeMain-DHUpZFgL.js +68 -0
- package/dist/chunks/bridgeMain-DUbQjgCp.js +1 -0
- package/dist/chunks/{bridgeMessaging-N5zlzCCr.js → bridgeMessaging-DHc5dOhB.js} +1 -1
- package/dist/chunks/{btw-BFRje_Zi.js → btw-D9hMM5d2.js} +1 -1
- package/dist/chunks/caches-CWzT7e6Y.js +1 -0
- package/dist/chunks/{caches-CcfPJ4_A.js → caches-UeVVM3T0.js} +2 -2
- package/dist/chunks/{ccrClient-q2JCVCU2.js → ccrClient-Iza0L8Zw.js} +1 -1
- package/dist/chunks/{clear-CxY7W5Wt.js → clear-B4d38ssF.js} +1 -1
- package/dist/chunks/client-BzKQTXzF.js +1 -0
- package/dist/chunks/{color-DOWhfjnA.js → color-D8VOyoYl.js} +1 -1
- package/dist/chunks/commands-DDamMmo4.js +1 -0
- package/dist/chunks/commitAttribution-CgohL8vD.js +1 -0
- package/dist/chunks/{commitAttribution-CLbEIaRJ.js → commitAttribution-ChAgixdj.js} +2 -2
- package/dist/chunks/compact-IFHwxjZ9.js +2 -0
- package/dist/chunks/config-DY5-_kk_.js +1 -0
- package/dist/chunks/{config-DiT2Z8dY.js → config-DmomySWC.js} +1 -1
- package/dist/chunks/config-WxgxrQoP.js +1 -0
- package/dist/chunks/{context-B2OvKo2t.js → context-Cl6BJ2vm.js} +1 -1
- package/dist/chunks/{context-noninteractive-BuGxX3YL.js → context-noninteractive-9hELVC29.js} +2 -2
- package/dist/chunks/context-noninteractive-Beij5MfU.js +1 -0
- package/dist/chunks/conversation-BBB91hEw.js +1 -0
- package/dist/chunks/conversation-BWVTM40Y.js +1 -0
- package/dist/chunks/{createSSHSession-C-c7I5iJ.js → createSSHSession-BM-5pbv6.js} +1 -1
- package/dist/chunks/createSession-CoQtL5Rj.js +1 -0
- package/dist/chunks/{createSession-D_fIDqgc.js → createSession-Cvl1Q50F.js} +1 -1
- package/dist/chunks/crossProjectResume-BasMLl2n.js +40 -0
- package/dist/chunks/{datadog-Ed8emSFA.js → datadog-CpqEQbHa.js} +1 -1
- package/dist/chunks/{desktop-D_ofPlyi.js → desktop-B_L6T6jI.js} +1 -1
- package/dist/chunks/{diff-CUAgBDu1.js → diff-CVzOodeg.js} +1 -1
- package/dist/chunks/doctor-1L0TFuGw.js +1 -0
- package/dist/chunks/{entry-Bh0gPOAo.js → entry-DHVYCR26.js} +3 -3
- package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-DJHZAlU-.js → envLessBridgeConfig-Ck2-KMq0.js} +1 -1
- package/dist/chunks/{esm-B62dCLgf.js → esm-D5q6s4l8.js} +1 -1
- package/dist/chunks/exit-Bm1S_f3i.js +1 -0
- package/dist/chunks/extra-usage-UHAWtypK.js +1 -0
- package/dist/chunks/{extra-usage-core-B6ga8Rni.js → extra-usage-core-BFOolqoi.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-Dc9AndId.js → extra-usage-noninteractive-cUGZy0en.js} +1 -1
- package/dist/chunks/{extra-usage-CjaHpu8y.js → extra-usage-zDHVtWKZ.js} +1 -1
- package/dist/chunks/extraUsage-Dq66zzqR.js +1 -0
- package/dist/chunks/extractMemories-BcaklA33.js +1 -0
- package/dist/chunks/fast-DALAHO3d.js +1 -0
- package/dist/chunks/{fast-CW_NsL0x.js → fast-MS7WZpD8.js} +1 -1
- package/dist/chunks/{feedback-BpRorTAC.js → feedback-Fw4m28ZC.js} +1 -1
- package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-CuUiNdj8.js → firstPartyEventLogger-CoSUd0a1.js} +2 -2
- package/dist/chunks/{flushGate-BltVae97.js → flushGate-De-yppeo.js} +1 -1
- package/dist/chunks/{gemini-YyIxfveQ.js → gemini-BPziscyN.js} +1 -1
- package/dist/chunks/{generateRecap-tx4wLIkI.js → generateRecap-jGDLI_wU.js} +1 -1
- package/dist/chunks/{generateSessionName-BkDigIN8.js → generateSessionName-hDJ6HBJ1.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-C4umZ1oC.js → githubRepoPathMapping-qAoiyj6P.js} +1 -1
- package/dist/chunks/{goal-DZrD4puM.js → goal-CFx4eRkf.js} +3 -3
- package/dist/chunks/{grok-BZf7W_hL.js → grok-Byblph7F.js} +1 -1
- package/dist/chunks/{grove-CFBPplP6.js → grove-CpqjcGCb.js} +2 -2
- package/dist/chunks/{heapdump-DWc3Z2NO.js → heapdump-C4kPlqGt.js} +1 -1
- package/dist/chunks/{help-pap9jNUJ.js → help-B1h-faJ3.js} +1 -1
- package/dist/chunks/hooks-DPLIIpAD.js +1 -0
- package/dist/chunks/{hooks-Bmat0L6A.js → hooks-X6J03MnA.js} +2 -2
- package/dist/chunks/hostGuard-BHI6Q8Mt.js +1 -0
- package/dist/chunks/inboundAttachments-BekVc0W-.js +1 -0
- package/dist/chunks/{inboundAttachments-DkfNHtF9.js → inboundAttachments-CUJE3KaU.js} +1 -1
- package/dist/chunks/initReplBridge-JQ-afRx9.js +1 -0
- package/dist/chunks/{install-D4jmHjmk.js → install-D5YORIJL.js} +1 -1
- package/dist/chunks/{instrumentation-Nqgm1SMw.js → instrumentation-Bw3CxPQf.js} +4 -4
- package/dist/chunks/{job-CT9bcgPb.js → job-DOWtcltx.js} +1 -1
- package/dist/chunks/keybindings-BLw5J-Zj.js +2 -0
- package/dist/chunks/{language-BA5WprZv.js → language-C6Fq-XOZ.js} +1 -1
- package/dist/chunks/language-Cqw5gYJR.js +1 -0
- package/dist/chunks/launchAgentsPlatform-jWWf-Lk9.js +1 -0
- package/dist/chunks/{launchLocalMemory-CRMqifzn.js → launchLocalMemory-kHeD0I0y.js} +2 -2
- package/dist/chunks/{launchLocalVault-DlKX_oDE.js → launchLocalVault-DLqkOjmb.js} +3 -3
- package/dist/chunks/launchMemoryStores-Ct7AVXrO.js +1 -0
- package/dist/chunks/{launchOnboarding-DTdUA_wE.js → launchOnboarding-Cc6WwPX9.js} +1 -1
- package/dist/chunks/launchSchedule-ZyvuvjgU.js +1 -0
- package/dist/chunks/launchSkillStore-BejQnLog.js +1 -0
- package/dist/chunks/{launchTeleport-CXFRPVMR.js → launchTeleport-8CuYUfIR.js} +3 -3
- package/dist/chunks/launchVault-DIvIOuPh.js +1 -0
- package/dist/chunks/{loadAgentsDir-BURvZNN6.js → loadAgentsDir-D206qwP3.js} +632 -632
- package/dist/chunks/loadAgentsDir-TZjwTqdr.js +1 -0
- package/dist/chunks/loadPluginHooks-Ddhsyn0_.js +1 -0
- package/dist/chunks/{localSearch-D2Rs8wQP.js → localSearch-CzrbOklu.js} +1 -1
- package/dist/chunks/localSearch-DrOAL6f4.js +1 -0
- package/dist/chunks/{logoV2Utils-DN9nzdX-.js → logoV2Utils-8M56V7oN.js} +1 -1
- package/dist/chunks/{magicDocs-DIeTcwAA.js → magicDocs-DWjL2k7P.js} +3 -3
- package/dist/chunks/{main-CI54PZrG.js → main-BohPzJFF.js} +86 -86
- package/dist/chunks/{mappers-Q_Z3Kjo-.js → mappers-BDMZFgKx.js} +1 -1
- package/dist/chunks/mcp-Bt1ITh-Z.js +1 -0
- package/dist/chunks/{mcp-RvwPC7FB.js → mcp-CwJ-AIpt.js} +4 -4
- package/dist/chunks/mcp-W0LFoyFR.js +2 -0
- package/dist/chunks/memory-3wV7m7UU.js +1 -0
- package/dist/chunks/{mode-Jl_Boaym.js → mode-CUkHFkju.js} +2 -2
- package/dist/chunks/model-BY3auM2c.js +1 -0
- package/dist/chunks/model-CKkOnnnx.js +1 -0
- package/dist/chunks/model-DRXcJyU9.js +1 -0
- package/dist/chunks/{nativeInstaller-8arnRiUO.js → nativeInstaller-CA5d6_G7.js} +1 -1
- package/dist/chunks/{onChangeAppState-DBantDJ6.js → onChangeAppState-DBmy2Ow_.js} +1 -1
- package/dist/chunks/openai-Cbomn0Ws.js +10 -0
- package/dist/chunks/{overageCreditGrant-CN_sVURL.js → overageCreditGrant-DsUrmeBh.js} +1 -1
- package/dist/chunks/{panel-CrTPqXCv.js → panel-BSZGX6jN.js} +1 -1
- package/dist/chunks/{panelCall-CPKC6VR5.js → panelCall-BsVoL1uF.js} +1 -1
- package/dist/chunks/{partition-CW0BJ881.js → partition-BAakXjvj.js} +1 -1
- package/dist/chunks/{passes-DOm9ukdK.js → passes-CLRt7Cvm.js} +1 -1
- package/dist/chunks/permissions-BVSFuwNP.js +3 -0
- package/dist/chunks/{pidLock-C69HNTTb.js → pidLock-D5rUnDB-.js} +2 -2
- package/dist/chunks/{plan-B0rEs32a.js → plan-SYZ4DXR8.js} +1 -1
- package/dist/chunks/{plugin-BSEMgcGu.js → plugin-Bfjzhmrk.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-CTByPD8J.js → pluginAutoupdate-reO2PgtQ.js} +1 -1
- package/dist/chunks/{pluginBlocklist-mogKaK0p.js → pluginBlocklist-C3H2afWG.js} +1 -1
- package/dist/chunks/pluginCliCommands-lqdxdkQp.js +1 -0
- package/dist/chunks/{pluginFlagging-mHNff1t9.js → pluginFlagging-D9HKAGBC.js} +1 -1
- package/dist/chunks/{pluginOperations-JEedVzfS.js → pluginOperations-EN3EKLux.js} +2 -2
- package/dist/chunks/{pluginStartupCheck-RscVZDi4.js → pluginStartupCheck-BY73BMT2.js} +1 -1
- package/dist/chunks/pluginStartupCheck-CwWOlveD.js +1 -0
- package/dist/chunks/plugins-Dn6ceWrT.js +4 -0
- package/dist/chunks/policyLimits-CkTI5KEt.js +1 -0
- package/dist/chunks/{poor-DekfGNT7.js → poor-j-y-bv8o.js} +1 -1
- package/dist/chunks/{poorMode-CtcqaiwD.js → poorMode-DhzFKpPl.js} +1 -1
- package/dist/chunks/poorMode-V11s-3cf.js +1 -0
- package/dist/chunks/print-Db_VXmfO.js +23 -0
- package/dist/chunks/{privacy-settings-CwJ1H8Ua.js → privacy-settings-DHMJREbb.js} +1 -1
- package/dist/chunks/processBashCommand-BcM_fhV9.js +1 -0
- package/dist/chunks/processSlashCommand-DEVo3GPX.js +5 -0
- package/dist/chunks/{prompt-DNDgGM9q.js → prompt-BNHtszmZ.js} +1 -1
- package/dist/chunks/prompt-CrX31AGm.js +1 -0
- package/dist/chunks/prompt-IAvMxKDl.js +1 -0
- package/dist/chunks/{promptEditor-DMJyosKj.js → promptEditor-DeMrXUir.js} +2 -2
- package/dist/chunks/{protocolHandler-z2zxAtB1.js → protocolHandler-BHxBy84Z.js} +1 -1
- package/dist/chunks/rate-limit-options-DIudL9fb.js +1 -0
- package/dist/chunks/{rcDebugLog-DoL1FpGJ.js → rcDebugLog-CUy1_F23.js} +1 -1
- package/dist/chunks/reconciler-BXpPyfSY.js +4 -0
- package/dist/chunks/{referral-UKJv23_5.js → referral-CUaIo_vT.js} +1 -1
- package/dist/chunks/{refresh-ul_i5R1a.js → refresh-CuaVBIQ0.js} +1 -1
- package/dist/chunks/{registerProtocol-CukLQuxJ.js → registerProtocol-B7Fzdofu.js} +1 -1
- package/dist/chunks/{release-notes-CGv_6MMt.js → release-notes-fbfv2DC0.js} +1 -1
- package/dist/chunks/{releaseNotes-BKZNuDLD.js → releaseNotes-CxAHFLPl.js} +2 -2
- package/dist/chunks/{reload-plugins-2W11dpLQ.js → reload-plugins-B9IT9CFA.js} +1 -1
- package/dist/chunks/{remote-env-D9xsoBfx.js → remote-env-BOklGlll.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-asY9JAXU.js → remoteBridgeCore-j0bG1zjv.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-Bxo3bv1U.js → remoteManagedSettings-Cq994lyc.js} +1 -1
- package/dist/chunks/{rename-CHsHMWpO.js → rename-Iev7wQsI.js} +1 -1
- package/dist/chunks/{resume-NduOaghx.js → resume-y7MCTZHJ.js} +2 -2
- package/dist/chunks/{runtimeObserver-Bo80nWQf.js → runtimeObserver-BZcJ1FbH.js} +1 -1
- package/dist/chunks/{runtimeObserver-BXbjibFk.js → runtimeObserver-CyzLASla.js} +3 -3
- package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +1 -0
- package/dist/chunks/{sandbox-toggle-C-WCDRN4.js → sandbox-toggle-CWpBO228.js} +1 -1
- package/dist/chunks/searchExtraTools-BUOUds7p.js +1 -0
- package/dist/chunks/{session-pDd13-wE.js → session-DL4cA_8l.js} +2 -2
- package/dist/chunks/{sessionDiscovery-CSUnpsCy.js → sessionDiscovery-DAfNKqp1.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +1 -0
- package/dist/chunks/sessionMemory-BS8_TbKj.js +1 -0
- package/dist/chunks/sessionMemory-D5fSHXvZ.js +1 -0
- package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +1 -0
- package/dist/chunks/sessionObserver-ChfQtK2m.js +1 -0
- package/dist/chunks/{sessionObserver-Ur7PqKl_.js → sessionObserver-ShbCwJ8x.js} +1 -1
- package/dist/chunks/sessionStorage-Cf5wmnyB.js +1 -0
- package/dist/chunks/{sessionTitle-pWMaI79N.js → sessionTitle-coed9IuJ.js} +1 -1
- package/dist/chunks/{sessionTracing-CCPRzOvy.js → sessionTracing-D9rUyiq0.js} +1 -1
- package/dist/chunks/{settings-DfWP5y6X.js → settings-BovzmwMP.js} +2 -2
- package/dist/chunks/settingsSync-PqU9XGJq.js +1 -0
- package/dist/chunks/setup-B_FOvNpp.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-Chi3afMR.js → shadowedRuleDetection-D1wsAdpp.js} +1 -1
- package/dist/chunks/{sideQuestion-D03MXdE2.js → sideQuestion-wSi38p81.js} +1 -1
- package/dist/chunks/sinks-BpcRrN_T.js +1 -0
- package/dist/chunks/{sinks-B4_pw0Gb.js → sinks-C_Dl1p4K.js} +2 -2
- package/dist/chunks/{skill-learning-7ZQF5JvA.js → skill-learning-B5tmc7EX.js} +1 -1
- package/dist/chunks/skillChangeDetector-DNqohXxz.js +1 -0
- package/dist/chunks/{skillGapStore-BND2Lq0Z.js → skillGapStore-D-kQKVDZ.js} +1 -1
- package/dist/chunks/{skillGapStore-z3LP64O-.js → skillGapStore-Df5BWAk5.js} +2 -2
- package/dist/chunks/{skillGenerator-DaNb-yKH.js → skillGenerator-DbcdpAkw.js} +2 -2
- package/dist/chunks/skillLearning-C5cXZE6_.js +1 -0
- package/dist/chunks/{skillLearning-rMX1bSBa.js → skillLearning-ClRiDcJH.js} +1 -1
- package/dist/chunks/{skillPanel-q7GPSQ6_.js → skillPanel-LBd4E-MM.js} +3 -3
- package/dist/chunks/{skillSearchPanel-oj8gy1ZL.js → skillSearchPanel-CErRnUwo.js} +3 -3
- package/dist/chunks/{skills-QqbeFP0s.js → skills-CBKhfg_a.js} +1 -1
- package/dist/chunks/{stats-DmFubHpI.js → stats-BY4dskVg.js} +1 -1
- package/dist/chunks/{status-DW3Z_7xa.js → status-BnJIXtKl.js} +2 -2
- package/dist/chunks/{status-BEIsLmfj.js → status-DU-B4SMW.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-CaHS8xig.js → statusNoticeHelpers-CzTuGNuC.js} +1 -1
- package/dist/chunks/{tag-CRg93Die.js → tag-B-wVW9Aj.js} +2 -2
- package/dist/chunks/{tasks-BEohK1ij.js → tasks-CBVL005y.js} +1 -1
- package/dist/chunks/teleport-dtqQXM4x.js +1 -0
- package/dist/chunks/{templateJobs-DYP1fjYU.js → templateJobs-D6998LcG.js} +1 -1
- package/dist/chunks/{terminalSetup-RDKg8dVa.js → terminalSetup-0SBdyKF5.js} +1 -1
- package/dist/chunks/{terminalSetup-BNs9nLbT.js → terminalSetup-CuV-qU6v.js} +1 -1
- package/dist/chunks/{theme-kNL4kl_3.js → theme-p0AooruD.js} +1 -1
- package/dist/chunks/thinkback-Catprqs_.js +1 -0
- package/dist/chunks/thinkback-DI2NpvG-.js +1 -0
- package/dist/chunks/{thinkback-play-BpWMqbgJ.js → thinkback-play-CqrIRx2o.js} +1 -1
- package/dist/chunks/{toolEventObserver-C98uraqD.js → toolEventObserver-DTccwC3c.js} +1 -1
- package/dist/chunks/{toolEventObserver-ar5NDa0M.js → toolEventObserver-DlH73w-S.js} +1 -1
- package/dist/chunks/toolPool-B64V-jmK.js +1 -0
- package/dist/chunks/{trustedDevice-BBKUhCCL.js → trustedDevice-BTYoQCkC.js} +1 -1
- package/dist/chunks/trustedDevice-CiwjT_Y6.js +1 -0
- package/dist/chunks/types-Bh9S_JG5.js +3 -0
- package/dist/chunks/types-DHkZVzJe.js +1 -0
- package/dist/chunks/{ultrareviewCommand-yXlFsMnv.js → ultrareviewCommand-BDFUS3hf.js} +2 -2
- package/dist/chunks/undercover-XYapZ_SS.js +1 -0
- package/dist/chunks/{undercover-BTIRVF1t.js → undercover-vuTpCnQJ.js} +2 -2
- package/dist/chunks/{updateCCB-B2xAJ4Nr.js → updateCCB-DFL5Wt_I.js} +1 -1
- package/dist/chunks/upgrade-D5qwcaWQ.js +1 -0
- package/dist/chunks/upgrade-DIg3j929.js +1 -0
- package/dist/chunks/{upload-BWVIHmMB.js → upload-B_yADHX9.js} +1 -1
- package/dist/chunks/usage-C0SnnC-i.js +1 -0
- package/dist/chunks/usage-CYJKE8N6.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CV4GZ-sq.js → useExitOnCtrlCDWithKeybindings-DKIqRraH.js} +1 -1
- package/dist/chunks/useMainLoopModel-XetDUXd-.js +1 -0
- package/dist/chunks/useManagePlugins-B2KhKiu5.js +1 -0
- package/dist/chunks/{useMergedTools-CRLWSGDl.js → useMergedTools-CKvwz_Zt.js} +1 -1
- package/dist/chunks/{useSearchInput-BzGq4t7t.js → useSearchInput-D1Vr2Js1.js} +1 -1
- package/dist/chunks/useSettingsErrors-B7BXHchG.js +1 -0
- package/dist/chunks/{util-BnReK81E.js → util-BaDs-wL5.js} +1 -1
- package/dist/chunks/validatePlugin-DtiYlXby.js +1 -0
- package/dist/chunks/{vim-C0KTnJJs.js → vim-C-icQDz1.js} +1 -1
- package/dist/chunks/{workerRegistry-CUXbNyL9.js → workerRegistry-ChqPPIaO.js} +1 -1
- package/dist/chunks/worktree-DAn8ooa1.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-LPrZMlgU.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-D_UHm7xo.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog--w2zWWEn.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-BXdC6j3_.js +0 -1
- package/dist/chunks/Doctor-BuiYwjAS.js +0 -1
- package/dist/chunks/Doctor-DKlHJBXq.js +0 -3
- package/dist/chunks/ExitFlow-rExuBL3w.js +0 -2
- package/dist/chunks/Grove-CD769Wvw.js +0 -11
- package/dist/chunks/Grove-ENfM8hC6.js +0 -1
- package/dist/chunks/MCPConnectionManager-CaBvO7NB.js +0 -1
- package/dist/chunks/MessageSelector-DOB1S2-O.js +0 -3
- package/dist/chunks/Messages-Clihwd2F.js +0 -11
- package/dist/chunks/PluginSettings-DUxj_oAg.js +0 -17
- package/dist/chunks/QueryEngine-BLcPQYq_.js +0 -1
- package/dist/chunks/REPL-B_E07dnf.js +0 -142
- package/dist/chunks/REPL-BhURgntS.js +0 -1
- package/dist/chunks/RemoteSessionManager-B43isWQs.js +0 -2
- package/dist/chunks/ResumeConversation-DaQ9n8_C.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-DSq7beKs.js +0 -1
- package/dist/chunks/Settings-CNsaWv8g.js +0 -2
- package/dist/chunks/agents-D7um1IXM.js +0 -103
- package/dist/chunks/allErrors-CHVdQ3fT.js +0 -1
- package/dist/chunks/api-C-rOQY-l.js +0 -1
- package/dist/chunks/api-Dmn7DUgU.js +0 -1
- package/dist/chunks/auth-C4Rvit2q.js +0 -1
- package/dist/chunks/auth-Cj7EX1eG.js +0 -1
- package/dist/chunks/auth-DAxGNCIR.js +0 -15
- package/dist/chunks/backgroundHousekeeping-C9m4tiFi.js +0 -17
- package/dist/chunks/backgroundHousekeeping-DQjzXBe0.js +0 -1
- package/dist/chunks/bridgeConfig-DsI5d0s7.js +0 -1
- package/dist/chunks/bridgeEnabled-DZzlF2d8.js +0 -1
- package/dist/chunks/bridgeEnabled-FjPuA7zx.js +0 -1
- package/dist/chunks/bridgeMain-BppY0KW3.js +0 -68
- package/dist/chunks/bridgeMain-BrY4tkF6.js +0 -1
- package/dist/chunks/caches-BBLH8G1I.js +0 -1
- package/dist/chunks/client-CtVu3BLD.js +0 -1
- package/dist/chunks/commands-BWw1sQeH.js +0 -1
- package/dist/chunks/commitAttribution-DIT_s0vY.js +0 -1
- package/dist/chunks/compact-CaOnQVkH.js +0 -2
- package/dist/chunks/config-DmPGzNmi.js +0 -1
- package/dist/chunks/config-HHTwEsWp.js +0 -1
- package/dist/chunks/context-noninteractive-BilCSCV1.js +0 -1
- package/dist/chunks/conversation-BWXf3un9.js +0 -1
- package/dist/chunks/conversation-awh8AwwL.js +0 -1
- package/dist/chunks/createSession-Hvpx3Le7.js +0 -1
- package/dist/chunks/crossProjectResume-_XjvSXA3.js +0 -40
- package/dist/chunks/doctor-CkdQ7Fv7.js +0 -1
- package/dist/chunks/effort-DCgooYMY.js +0 -9
- package/dist/chunks/envLessBridgeConfig-sxodu0xO.js +0 -1
- package/dist/chunks/exit-CFJR3NfE.js +0 -1
- package/dist/chunks/extra-usage-D1Y-3OWQ.js +0 -1
- package/dist/chunks/extraUsage-2DwLEr26.js +0 -1
- package/dist/chunks/extractMemories-C3qrwpu2.js +0 -1
- package/dist/chunks/fast-D3CPmUX4.js +0 -1
- package/dist/chunks/firstPartyEventLogger-DPUQnc6J.js +0 -1
- package/dist/chunks/hooks-cCAzfabs.js +0 -1
- package/dist/chunks/hostGuard-C5xydXZI.js +0 -1
- package/dist/chunks/inboundAttachments-DZgSqDwY.js +0 -1
- package/dist/chunks/initReplBridge-myzllvlk.js +0 -1
- package/dist/chunks/keybindings-DETOn3qJ.js +0 -2
- package/dist/chunks/language-BbaOTWm3.js +0 -1
- package/dist/chunks/launchAgentsPlatform-CuRQgd2Q.js +0 -1
- package/dist/chunks/launchMemoryStores-CN0ecWpP.js +0 -1
- package/dist/chunks/launchSchedule-psiSLmTA.js +0 -1
- package/dist/chunks/launchSkillStore-CQQ00Ads.js +0 -1
- package/dist/chunks/launchVault-Dn6jq0Rc.js +0 -1
- package/dist/chunks/loadAgentsDir-Db9UTm45.js +0 -1
- package/dist/chunks/loadPluginHooks-C9A9oS-w.js +0 -1
- package/dist/chunks/localSearch-hBh1ATr2.js +0 -1
- package/dist/chunks/mcp-CtbhGaLC.js +0 -2
- package/dist/chunks/mcp-DMacvhqZ.js +0 -1
- package/dist/chunks/memory-BPN8gW7n.js +0 -1
- package/dist/chunks/model-BIVmcl_N.js +0 -1
- package/dist/chunks/model-CWBwPvTH.js +0 -1
- package/dist/chunks/model-DlVpqR0P.js +0 -1
- package/dist/chunks/openai-yin1iDG8.js +0 -10
- package/dist/chunks/permissions-CxDJ__l6.js +0 -3
- package/dist/chunks/pluginCliCommands-DQQ7C7kk.js +0 -1
- package/dist/chunks/pluginStartupCheck-D7ts2V3p.js +0 -1
- package/dist/chunks/plugins-Cr03lISA.js +0 -4
- package/dist/chunks/policyLimits-DWtLyJ4n.js +0 -1
- package/dist/chunks/poorMode-AE4WNYZo.js +0 -1
- package/dist/chunks/print-CZUmAzmt.js +0 -23
- package/dist/chunks/processBashCommand-aKNneP2u.js +0 -1
- package/dist/chunks/processSlashCommand-BcPnWNxZ.js +0 -5
- package/dist/chunks/prompt-CIyhCdkE.js +0 -1
- package/dist/chunks/prompt-DRhjinu2.js +0 -1
- package/dist/chunks/rate-limit-options--Y3oF1g0.js +0 -1
- package/dist/chunks/reconciler-CJcSh6xo.js +0 -4
- package/dist/chunks/sandbox-adapter-DDfVl_2V.js +0 -1
- package/dist/chunks/searchExtraTools-BHWzsbNO.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-BZvxeufx.js +0 -1
- package/dist/chunks/sessionMemory-CAmpw2yb.js +0 -1
- package/dist/chunks/sessionMemory-DT0IkiA1.js +0 -1
- package/dist/chunks/sessionMemoryUtils-B4kGNH4j.js +0 -1
- package/dist/chunks/sessionObserver-oIkwTidC.js +0 -1
- package/dist/chunks/sessionStorage-DqARUj0K.js +0 -1
- package/dist/chunks/settingsSync-D_4P3Esd.js +0 -1
- package/dist/chunks/setup-JHvhWKh9.js +0 -3
- package/dist/chunks/sinks-Cro1Y8C2.js +0 -1
- package/dist/chunks/skillChangeDetector-uCaYrerZ.js +0 -1
- package/dist/chunks/skillLearning-GZxYPlyl.js +0 -1
- package/dist/chunks/teleport-4Srg5vcP.js +0 -1
- package/dist/chunks/thinkback-gV-sKkMM.js +0 -1
- package/dist/chunks/thinkback-hc5eJ9ul.js +0 -1
- package/dist/chunks/toolPool-CNYKDRq5.js +0 -1
- package/dist/chunks/trustedDevice-0dehm9qz.js +0 -1
- package/dist/chunks/types-BUyOCzUt.js +0 -1
- package/dist/chunks/types-Czs-_G1S.js +0 -3
- package/dist/chunks/undercover-CG_269xD.js +0 -1
- package/dist/chunks/upgrade-J7lKLkD2.js +0 -1
- package/dist/chunks/upgrade-yNl7EO4e.js +0 -1
- package/dist/chunks/usage-B2PbCUMi.js +0 -1
- package/dist/chunks/usage-Ck8Cu45g.js +0 -1
- package/dist/chunks/useMainLoopModel-CO4yBjRM.js +0 -1
- package/dist/chunks/useManagePlugins-BzFKIDrD.js +0 -1
- package/dist/chunks/useSettingsErrors-CSemUjj1.js +0 -1
- package/dist/chunks/validatePlugin-D6sPqea1.js +0 -1
- package/dist/chunks/worktree-89ttIVxH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,mt as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{$u as u,ed as d}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,mt as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{$u as u,ed as d}from"./loadAgentsDir-D206qwP3.js";function f(e){return e.status===`running`?{mark:`●`,color:`warning`}:e.resultKind===`dead`?{mark:`✗`,color:`error`}:{mark:`✓`,color:`success`}}function p(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function m(e){let t=[];return e.model&&t.push(e.model),t.push(`${p(e.tokenCount)} tok`),t.push(`${e.toolCount??0} tool`),t.join(` · `)}var h,g,_,v,y,b=e((()=>{h={running:`●`,completed:`✓`,failed:`✗`,killed:`■`},g={running:`warning`,completed:`success`,failed:`error`,killed:`subtle`},_={running:`running`,completed:`done`,failed:`failed`,killed:`killed`},v={running:`●`,done:`✓`,pending:`○`},y={running:`warning`,done:`success`,pending:`subtle`}}));function x(e,t){if(e.length<=t)return e;let n=e.match(/#\d+$/);if(!n)return e.slice(0,t);let r=n[0],i=e.slice(0,e.length-r.length),a=t-r.length-1;return`${i.slice(0,a)}…${r}`}function S({agents:e,selectedIndex:t,focused:i}){let[a,s]=o(T),c=w[Math.floor(s/T)%w.length];return e.length===0?(0,C.jsx)(r,{color:`subtle`,children:`(no agents in this phase)`}):(0,C.jsx)(n,{ref:a,flexDirection:`column`,children:e.map((e,a)=>{let o=f(e),s=a===t&&i,l=e.status===`running`?c:o.mark,u=x(e.label??`agent-${e.id}`,E);return(0,C.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,C.jsxs)(n,{children:[(0,C.jsx)(r,{color:o.color,children:l}),(0,C.jsxs)(r,{children:[` `,u]})]}),(0,C.jsx)(r,{color:`subtle`,children:m(e)})]},e.id)})})}var C,w,T,E,D=e((()=>{i(),s(),b(),C=l(),w=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],T=120,E=18}));function O(e,t){return e?.status===`done`?`done`:t.length>0?t.every(e=>e.status===`done`)?`done`:`running`:e?.status===`running`?`running`:`pending`}function k(e){let t=new Map(e.phases.map(e=>[e.title,e])),n=new Set,r=[],i=i=>{if(n.has(i))return;n.add(i);let a=t.get(i),o=e.agents.filter(e=>e.phase===i);r.push({title:i,status:O(a,o),done:o.filter(e=>e.status===`done`).length,total:o.length})};for(let t of e.declaredPhases)i(t);for(let t of e.phases)i(t.title);for(let t of e.agents)t.phase&&i(t.phase);return r}function A(e,t){return t===void 0||t===`All`?e:e.filter(e=>e.phase===t)}function j(e){return e.filter(e=>e.status===`running`)}function M(e,t){let n=Math.max(0,Math.trunc(t)),r=e.slice(0,n);return{runs:r,overflow:Math.max(0,e.length-r.length)}}function N(e,t){return`${e}#${t.slice(-4)}`}function P(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var F=e((()=>{}));function I({phases:e,agents:t,selectedIndex:i,focused:a}){let[s,c]=o(z),l=R[Math.floor(c/z)%R.length],u=t.length;return(0,L.jsx)(n,{ref:s,flexDirection:`column`,children:[{title:`All`,done:t.filter(e=>e.status===`done`).length,total:u},...e].map((e,t)=>{let o=t===i,s=o&&a,c=e.status===`running`?l:e.status?v[e.status]:` `,u=e.status?y[e.status]:`subtle`;return(0,L.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,L.jsxs)(n,{children:[(0,L.jsx)(r,{color:o?`claude`:void 0,children:s?`>`:` `}),(0,L.jsx)(r,{children:` `}),(0,L.jsx)(r,{color:u,children:c}),(0,L.jsxs)(r,{children:[` `,e.title]})]}),(0,L.jsxs)(r,{color:`subtle`,children:[e.done,`/`,e.total]})]},e.title)})})}var L,R,z,B=e((()=>{i(),s(),b(),F(),L=l(),R=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],z=120}));function V({runs:e,activeRunId:t}){if(e.length===0)return(0,H.jsx)(r,{color:`subtle`,children:`(no runs)`});let{runs:i,overflow:a}=M(e,W);return(0,H.jsxs)(n,{children:[i.map(e=>{let i=e.runId===t,a=x(N(e.workflowName,e.runId),U),o=`═`.repeat(a.length+2);return(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(n,{children:[(0,H.jsx)(r,{color:g[e.status],children:h[e.status]}),(0,H.jsx)(r,{children:` `}),(0,H.jsx)(r,{color:i?`claude`:void 0,bold:i,children:a})]}),(0,H.jsx)(r,{color:i?`claude`:void 0,children:i?o:``})]},e.runId)}),a>0?(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(r,{color:`subtle`,children:[`+`,a]}),(0,H.jsx)(r,{children:` `})]}):null]})}var H,U,W,G=e((()=>{i(),s(),b(),F(),D(),H=l(),U=18,W=6}));function K(e,t,n=`normal`){return n===`confirm`?e===`y`||e===`Y`||t.return?`confirmYes`:e===`n`||e===`N`||t.escape||e===`q`?`confirmNo`:null:t.tab||e===` `?t.shift?`prevTab`:`nextTab`:t.escape||e===`q`?`quit`:e===`K`?`killWorkflow`:e===`x`?`killAgent`:e===`r`?`resume`:e===`n`?`newRun`:t.leftArrow?`focusLeft`:t.rightArrow?`focusRight`:t.upArrow?`moveUp`:t.downArrow?`moveDown`:null}function q(e,t=`normal`){a((n,r)=>{let i=K(n,r,t);if(i!==null)switch(i){case`nextTab`:e.nextTab();break;case`prevTab`:e.prevTab();break;case`focusLeft`:e.focusLeft();break;case`focusRight`:e.focusRight();break;case`moveUp`:e.moveUp();break;case`moveDown`:e.moveDown();break;case`killAgent`:e.killAgent();break;case`killWorkflow`:e.killWorkflow();break;case`resume`:e.resumeFocused();break;case`newRun`:e.newRun();break;case`quit`:e.quit();break;case`confirmYes`:e.confirmYes();break;case`confirmNo`:e.confirmNo();break}})}var J=e((()=>{s()}));function Y(e,t){if(t===0)return 0;let n=Math.trunc(e);return Number.isNaN(n)||n<0?0:Math.min(n,t-1)}function ee(e,t){return!e||!t||e.runId!==t.runId||e.status!==`running`?!1:t.status===`completed`||t.status===`failed`||t.status===`killed`}function te({onDone:e,context:t}){let i=u(),a=(0,X.useSyncExternalStore)(i.subscribe,()=>i.listRuns(),()=>[]),s=j(a),[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(`phases`),[m,h]=(0,X.useState)(0),[v,y]=(0,X.useState)(0),[b,x]=(0,X.useState)(null);(0,X.useEffect)(()=>{i.loadPersistedRuns()},[i]),(0,X.useEffect)(()=>{if(s.length===0){l!==null&&d(null);return}s.some(e=>e.runId===l)||d(s[0].runId)},[s,l]);let C=s.find(e=>e.runId===l),w=C?k(C):[],T=w.length+1,E=Y(m,T),D=(0,X.useRef)(null);(0,X.useEffect)(()=>{let t=C?{runId:C.runId,status:C.status}:null,n=D.current;if(D.current=t,!ee(n,t))return;let r=setTimeout(()=>e(),800);return()=>{clearTimeout(r)}},[C?.runId,C?.status,e]);let O=E===0?void 0:w[E-1]?.title,M=C?A(C.agents,O):[],N=Y(v,M.length),F=e=>{d(e),p(`phases`),h(0),y(0)};q({nextTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e+1)%s.length];F(t.runId)},prevTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e-1+s.length)%s.length];F(t.runId)},focusLeft:()=>p(`phases`),focusRight:()=>p(`agents`),moveUp:()=>{f===`phases`?h(e=>Y(e-1,T)):y(e=>Y(e-1,M.length))},moveDown:()=>{f===`phases`?h(e=>Y(e+1,T)):y(e=>Y(e+1,M.length))},killAgent:()=>{f!==`agents`||!C||M[N]&&x(`agent`)},killWorkflow:()=>{C&&x(`workflow`)},resumeFocused:()=>{if(!C)return;let n=t.canUseTool;if(!n){e(`resume needs canUseTool context; run /<name> resume from the main session.`);return}i.launch({resumeFromRunId:C.runId,name:C.workflowName},t,n).catch(t=>e(`resume failed: ${t.message}`))},newRun:()=>e(`Tip: start a named workflow with /<name>, or pass name via the Workflow tool.`),quit:()=>{if(b!==null){x(null);return}e()},confirmYes:()=>{if(b===`workflow`&&C){i.kill(C.runId),x(null),e();return}else if(b===`agent`&&C){let e=M[N];e&&i.killAgent(C.runId,e.id)}x(null)},confirmNo:()=>x(null)},b===null?`normal`:`confirm`);let L=a.filter(e=>e.status===`running`).length,R=a.length-L,z=O??`All`,B=C?C.agents.filter(e=>e.status===`done`).length:0,[H]=o(1e3),U=C?Date.now()-C.startedAt:0;return(0,Z.jsxs)(n,{ref:H,flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,paddingX:1,children:[(0,Z.jsxs)(n,{justifyContent:`space-between`,children:[(0,Z.jsx)(r,{bold:!0,children:C?.workflowName??`Workflows`}),C?(0,Z.jsxs)(r,{color:`subtle`,children:[B,`/`,C.agentCount,` agents · `,P(U),` ·`,` `,(0,Z.jsx)(r,{color:g[C.status],children:_[C.status]})]}):(0,Z.jsxs)(r,{color:`subtle`,children:[L,` running · `,R,` done`]})]}),C?.description?(0,Z.jsx)(r,{color:`subtle`,children:C.description}):null,s.length>1?(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(V,{runs:s,activeRunId:l})}):null,(0,Z.jsxs)(n,{flexDirection:`row`,marginTop:1,children:[(0,Z.jsxs)(n,{width:`25%`,flexDirection:`column`,children:[(0,Z.jsx)(r,{color:f===`phases`?`claude`:`subtle`,bold:!0,children:`Phases`}),(0,Z.jsx)(I,{phases:w,agents:C?.agents??[],selectedIndex:E,focused:f===`phases`})]}),(0,Z.jsx)(r,{color:`subtle`,children:`│`}),(0,Z.jsxs)(n,{flexGrow:1,flexDirection:`column`,children:[(0,Z.jsxs)(r,{color:f===`agents`?`claude`:`subtle`,bold:!0,children:[z,` · `,M.length,` agents`]}),(0,Z.jsx)(S,{agents:M,selectedIndex:N,focused:f===`agents`})]})]}),(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(r,{color:`subtle`,children:b===null?`Tab switch run · ←/→ focus · ↑/↓ move · x kill agent · K kill workflow · r resume · q quit`:`Confirm: y kill · n/Esc cancel`})}),b===null?null:(0,Z.jsx)(c,{title:b===`workflow`?`Kill workflow "${C?.workflowName??``}"?`:`Kill agent "${M[N]?.label??``}"?`,subtitle:b===`workflow`?`All in-flight agents will be aborted. Resume will replay from journal.`:`Only this agent aborts; other agents in the workflow keep running.`,onCancel:()=>x(null),color:`warning`,children:(0,Z.jsx)(r,{color:`subtle`,children:`Press y to confirm, or n/Esc to cancel.`})})]})}var X,Z,ne=e((()=>{X=t(i(),1),s(),d(),D(),B(),G(),b(),J(),F(),Z=l()})),Q,$;e((()=>{ne(),Q=l(),$=async(e,t,n)=>(0,Q.jsx)(te,{onDone:e,context:t})}))();export{$ as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Fr as t,Mi as n,Ni as r,Pr as i}from"./state-ix0xIunV.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Fr as t,Mi as n,Ni as r,Pr as i}from"./state-ix0xIunV.js";import{HD as a,VD as o}from"./loadAgentsDir-D206qwP3.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,t,n,r){return o(e,function(e,i,a){t(r,e,n(e),a)}),r}var u=e((()=>{a()}));function d(e,t){return function(n,a){var o=r(n)?s:l,c=t?t():{};return o(n,e,i(a,2),c)}}var f=e((()=>{c(),u(),t(),n()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,Wt as a,dr as o,fi as s,hn as c,t as l,x as u}from"./src-CDCSSo0U2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as f,_n as p,gn as m}from"./settings-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,Wt as a,dr as o,fi as s,hn as c,t as l,x as u}from"./src-CDCSSo0U2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as f,_n as p,gn as m}from"./settings-BovzmwMP.js";import{b as h,c as g,g as _}from"./config-DmomySWC.js";import{o as v,s as y}from"./log-BMCygSzM.js";import{n as b,r as x}from"./analytics-BotDBGh0.js";import{i as S,n as C,o as w,r as T,s as E,u as D}from"./referral-CUaIo_vT.js";import{n as O,t as k}from"./useExitOnCtrlCDWithKeybindings-DKIqRraH.js";function A({onDone:e}){let[t,s]=(0,j.useState)(!0),[l,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null),[_,v]=(0,j.useState)(void 0),b=O(()=>e(`Guest passes dialog dismissed`,{display:`system`}));if(a(`confirm:no`,(0,j.useCallback)(()=>{e(`Guest passes dialog dismissed`,{display:`system`})},[e]),{context:`Confirmation`}),c((t,n)=>{n.return&&h&&o(h).then(t=>{t&&process.stdout.write(t),x(`tengu_guest_passes_link_copied`,{}),e(`Referral link copied to clipboard!`)})}),(0,j.useEffect)(()=>{async function e(){try{let e=await S();if(!e||!e.eligible){p(!1),s(!1);return}p(!0),e.referral_code_details?.referral_link&&g(e.referral_code_details.referral_link),v(e.referrer_reward);let t=e.referral_code_details?.campaign??`claude_code_guest_pass`,n;try{n=await C(t)}catch(e){y(e),p(!1),s(!1);return}let r=n.redemptions||[],i=n.limit||3,a=[];for(let e=0;e<i;e++){let t=r[e];a.push({passNumber:e+1,isAvailable:!t})}d(a),s(!1)}catch(e){y(e),p(!1),s(!1)}}e()},[]),t)return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`Loading guest pass information…`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});if(!f)return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{children:`Guest passes are not currently available.`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});let w=m(l,e=>e.isAvailable),E=[...l].sort((e,t)=>t.isAvailable-+e.isAvailable),D=e=>e.isAvailable?(0,M.jsxs)(n,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{children:`┌──────────┐`}),(0,M.jsxs)(i,{children:[` ) CC `,(0,M.jsx)(i,{color:`claude`,children:`✻`}),` ┊ ( `]}),(0,M.jsx)(i,{children:`└──────────┘`})]},e.passNumber):(0,M.jsxs)(n,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`┌─────────╱`}),(0,M.jsx)(i,{dimColor:!0,children:` ) CC ✻ ┊╱`}),(0,M.jsx)(i,{dimColor:!0,children:`└───────╱`})]},e.passNumber);return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsxs)(i,{color:`permission`,children:[`Guest passes · `,w,` left`]}),(0,M.jsx)(n,{flexDirection:`row`,marginLeft:2,children:E.slice(0,3).map(e=>D(e))}),h&&(0,M.jsx)(n,{marginLeft:2,children:(0,M.jsx)(i,{children:h})}),(0,M.jsx)(n,{flexDirection:`column`,marginLeft:2,children:(0,M.jsxs)(i,{dimColor:!0,children:[_?`Share a free week of Claude Code with friends. If they love it and subscribe, you'll get ${T(_)} of extra usage to keep building. `:`Share a free week of Claude Code with friends. `,(0,M.jsx)(r,{url:_?`https://support.claude.com/en/articles/13456702-claude-code-guest-passes`:`https://support.claude.com/en/articles/12875061-claude-code-guest-passes`,children:`Terms apply.`})]})}),(0,M.jsx)(n,{children:(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Enter to copy link · Esc to cancel`})})})]})})}var j,M,N=e((()=>{s(),j=t(s(),1),f(),k(),l(),D(),b(),E(),p(),v(),M=d()}));async function P(e){let t=!g().hasVisitedPasses;if(t){let e=w();h(t=>({...t,hasVisitedPasses:!0,passesLastSeenRemaining:e??t.passesLastSeenRemaining}))}return x(`tengu_guest_passes_visited`,{is_first_visit:t}),(0,F.jsx)(A,{onDone:e})}var F;e((()=>{s(),N(),b(),E(),_(),F=d()}))();export{P as call};
|
|
@@ -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{I as i,P as a,Wt as o,Xn as s,a as c,di as l,fi as u,hn as d,k as f,kt as p,n as m,o as h,ot as g,r as _,s as ee,t as v,ui as y,x as te,y as b}from"./src-CDCSSo0U2.js";import{t as x}from"./jsx-runtime-Bb4Xn-E0.js";import{en as ne,nt as S}from"./state-ix0xIunV.js";import{B as re,Dw as ie,Ew as C,Fx as w,G as T,H as ae,K as E,KS as oe,Px as D,SD as O,Sw as se,U as ce,US as k,V as le,WS as ue,_o as A,_u as j,aC as de,mx as M,px as N,vu as P,yD as F,zo as fe}from"./loadAgentsDir-D206qwP3.js";import{S as I,w as L}from"./debug-BrXObCdR.js";import{B as R,L as z,an as B,dn as pe,g as V,o as H,z as me}from"./settings-BovzmwMP.js";import{l as he,o as ge}from"./stringUtils-DGLPkqJ4.js";import{u as _e}from"./referral-CUaIo_vT.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-DKIqRraH.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-ClHi-Dr6.js";import{t as Se}from"./SearchBox-vfLXEPed.js";import{n as Ce,t as we}from"./useSearchInput-D1Vr2Js1.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-D1wsAdpp.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case j.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(a,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(a,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(a,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(a,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(a,{bold:!0,children:e.toolName}),` tool`]})}}var W,ke=e((()=>{u(),v(),P(),W=x()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${H(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${H(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function je({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:o,setToolPermissionContext:s}){let c=B.map(Ae),l=(0,Me.useCallback)(i=>{if(i===`cancel`){t();return}else if(B.includes(i)){let t=i,a=se(o,{type:`addRules`,rules:n,behavior:r,destination:t});ie({type:`addRules`,rules:n,behavior:r,destination:t}),s(a);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(a,{sandboxAutoAllowEnabled:F.isSandboxingEnabled()&&F.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,o,s]);return(0,G.jsxs)(b,{title:`Add ${r} permission ${he(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(i,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(i,{flexDirection:`column`,children:[(0,G.jsx)(a,{bold:!0,children:R(e)}),(0,G.jsx)(Oe,{ruleValue:e})]},R(e)))}),(0,G.jsxs)(i,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(a,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(N,{options:c,onChange:l})]})]})}var Me,G,Ne=e((()=>{u(),Me=t(u(),1),M(),v(),C(),z(),Te(),O(),pe(),V(),ge(),ke(),G=x()}));function Pe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[s,c]=(0,Fe.useState)(``),[l,u]=(0,Fe.useState)(0),d=ve();o(`confirm:no`,e,{context:`Settings`});let{columns:f}=g(),m=f-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(a,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(i,{flexDirection:`column`,children:[(0,K.jsxs)(a,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(p,{}),`e.g., `,(0,K.jsx)(a,{bold:!0,children:R({toolName:j.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:R({toolName:j.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(D,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(me(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:m,cursorOffset:l,onChangeCursorOffset:u})})]})]}),(0,K.jsx)(i,{marginLeft:3,children:d.pending?(0,K.jsxs)(a,{dimColor:!0,children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsx)(a,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Fe,K,Ie=e((()=>{n(),u(),Fe=t(u(),1),w(),ye(),de(),v(),_e(),P(),z(),K=x()}));function Le({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=c();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[o]=(0,q.useState)(()=>De()),[s,l]=(0,q.useState)(()=>new Set),[u,f]=(0,q.useState)(()=>new Set),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:s,retry:u,denials:o})},[s,u,o,t]);let h=(0,q.useCallback)(e=>{let t=Number(e);l(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),g=(0,q.useCallback)(e=>{m(Number(e))},[]);if(d((e,t)=>{e===`r`&&(f(e=>{let t=new Set(e);return t.has(p)?t.delete(p):t.add(p),t}),l(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t}))},{isActive:o.length>0}),o.length===0)return(0,J.jsx)(a,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let _=o.map((e,t)=>{let n=s.has(t),r=u.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(a,{children:[(0,J.jsx)(ee,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(a,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(i,{flexDirection:`column`,children:[(0,J.jsx)(a,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(i,{marginTop:1,children:(0,J.jsx)(N,{options:_,onChange:h,onFocus:g,visibleOptionCount:Math.min(10,_.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,Re=e((()=>{u(),q=t(u(),1),v(),U(),M(),J=x()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Be.useCallback)(()=>{o(se(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,o,t]),c=(0,Be.useCallback)(e=>{e===`yes`?s():n()},[s,n]);return(0,Y.jsxs)(b,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(i,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(a,{bold:!0,children:e})}),(0,Y.jsx)(a,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(N,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{u(),Be=t(u(),1),M(),v(),C(),Y=x()}));function He({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:o,onHeaderFocusChange:s}){let{headerFocused:l,focusHeader:u}=c();(0,X.useEffect)(()=>{s?.(l)},[l,s]);let d=Ue.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),f=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=d.find(t=>t.path===e);t&&t.isDeletable&&o(t.path)},[d,n,o]),p=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),m=Ue.useMemo(()=>{let e=d.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[d]);return(0,Z.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(a,{children:`- ${S()}`}),(0,Z.jsx)(a,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(N,{options:m,onChange:f,onCancel:p,visibleOptionCount:Math.min(10,m.length),onUpFromFirstItem:u,isDisabled:l})]})}var Ue,X,Z,We=e((()=>{n(),Ue=t(u(),1),X=t(u(),1),ne(),M(),v(),Z=x()}));function Ge({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${E(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();o(`confirm:no`,n,{context:`Confirmation`});let s=(0,$.jsxs)(i,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(a,{bold:!0,children:R(e.ruleValue)}),(0,$.jsx)(Oe,{ruleValue:e.ruleValue}),(0,$.jsx)(Ge,{rule:e})]}),c=(0,$.jsx)(i,{marginLeft:3,children:r.pending?(0,$.jsxs)(a,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(a,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(a,{bold:!0,color:`permission`,children:`Rule details`}),s,(0,$.jsxs)(a,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
+
`,`Contact your system administrator for more information.`]})]}),c]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(a,{bold:!0,color:`error`,children:[`Delete `,Ke(e.ruleBehavior),` tool?`]}),s,(0,$.jsx)(a,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(N,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),c]})}function Je(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:a,onSelect:o,onCancel:s,lastFocusedRuleKey:l,cursorOffset:u,onHeaderFocusChange:d}=e,p=h(),{headerFocused:m,focusHeader:g,blurHeader:_}=c();return(0,Q.useEffect)(()=>{r&&m&&_()},[r,m,_]),(0,Q.useEffect)(()=>{d?.(m)},[m,d]),(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(i,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(f,{query:n,isFocused:r&&!m,isTerminalFocused:a,width:p,cursorOffset:u})}),(0,$.jsx)(N,{options:t,onChange:o,onCancel:s,visibleOptionCount:Math.min(10,t.length),isDisabled:r||m,defaultFocusValue:l,onUpFromFirstItem:g})]})}function Ye({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(i,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(a,{children:{allow:`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 c=De().length>0,l=t??(c?`recent`:`allow`),[u,d]=(0,Q.useState)([]),f=ue(e=>e.toolPermissionContext),p=oe(),h=s(),g=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),ee=(0,Q.useCallback)(e=>{g.current=e},[]),[v,b]=(0,Q.useState)(),[x,ne]=(0,Q.useState)(),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[de,M]=(0,Q.useState)(!0),N=(0,Q.useCallback)(e=>{M(e)},[]),P=(0,Q.useMemo)(()=>{let e=new Map;return le(f).forEach(t=>{e.set(L(t),t)}),e},[f]),F=(0,Q.useMemo)(()=>{let e=new Map;return ce(f).forEach(t=>{e.set(L(t),t)}),e},[f]),fe=(0,Q.useMemo)(()=>{let e=new Map;return ae(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]),z=ve(),B=!v&&!S&&!w&&!E&&!O,{query:pe,setQuery:V,cursorOffset:H}=Ce({isActive:B&&A,onExit:()=>{j(!1)}}),me=(0,Q.useCallback)(e=>{B&&(A||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),j(!0),V(``)):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),V(e.key))))},[B,A,V]),he=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){C(t);return}else{b(n.get(e));return}},[I]),ge=(0,Q.useCallback)(()=>{C(null)},[]),_e=(0,Q.useCallback)((e,t)=>{T({ruleValue:e,ruleBehavior:t}),C(null)},[]),ye=(0,Q.useCallback)((e,t)=>{T(null);for(let t of e)d(e=>[...e,`Added ${t.ruleBehavior} rule ${y.bold(R(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;d(n=>[...n,y.yellow(`${r.warning} Warning: ${R(e.rule.ruleValue)} is ${t}`),y.dim(` ${e.reason}`),y.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{T(null)},[]),Se=(0,Q.useCallback)(()=>D(!0),[]),we=(0,Q.useCallback)(e=>k(e),[]),Te=(0,Q.useCallback)(()=>{let t=g.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||u.length>0?e([...a.length>0?[`Approved ${a.map(e=>y.bold(e.display)).join(`, `)}`]:[],...u].join(`
|
|
3
|
+
`)):e(`Permissions dialog dismissed`,{display:`system`})},[u,e,n]);o(`confirm:no`,Te,{context:`Settings`,isActive:B&&!A});let Ee=()=>{if(!v)return;let{options:e}=I(v.ruleBehavior),t=L(v),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])),ne(i),re({rule:v,initialContext:f,setToolPermissionContext(e){p(t=>({...t,toolPermissionContext:e}))}}),d(e=>[...e,`Deleted ${v.ruleBehavior} rule ${y.bold(R(v.ruleValue))}`]),b(void 0)};if(v)return(0,$.jsx)(qe,{rule:v,onDelete:Ee,onCancel:()=>b(void 0)});if(S&&S!==`workspace`&&S!==`recent`)return(0,$.jsx)(Pe,{onCancel:ge,onSubmit:_e,ruleBehavior:S});if(w)return(0,$.jsx)(je,{onAddRules:ye,onCancel:be,ruleValues:[w.ruleValue],ruleBehavior:w.ruleBehavior,initialContext:f,setToolPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});if(E)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=se(f,n);p(e=>({...e,toolPermissionContext:r})),t&&ie(n),d(n=>[...n,`Added directory ${y.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:f});if(O)return(0,$.jsx)(ze,{directoryPath:O,onRemove:()=>{d(e=>[...e,`Removed directory ${y.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:f,setPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:pe,isSearchMode:A,isFocused:h,onCancel:Te,lastFocusedRuleKey:x,cursorOffset:H,getRulesOptions:I,handleToolSelect:he,onHeaderFocusChange:N};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:me,children:(0,$.jsxs)(te,{color:`permission`,children:[(0,$.jsxs)(_,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!v||!!S||!!w||E||!!O,initialHeaderFocused:!c,navFromContent:!A,children:[(0,$.jsx)(m,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:N,onStateChange:ee})}),(0,$.jsx)(m,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ye,{tab:`allow`,...U})}),(0,$.jsx)(m,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ye,{tab:`ask`,...U})}),(0,$.jsx)(m,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ye,{tab:`deny`,...U})}),(0,$.jsx)(m,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(a,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(He,{onExit:e,toolPermissionContext:f,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:N})]})})]}),(0,$.jsx)(i,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(a,{dimColor:!0,children:z.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):de?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):A?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):c&&l===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Ze=e((()=>{l(),n(),u(),Q=t(u(),1),k(),C(),M(),ye(),we(),v(),_e(),U(),z(),T(),I(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=x()})),Qe,$e;e((()=>{Ze(),fe(),Qe=x(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,A(e)])}})}))();export{$e as call};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,l as i,n as a,o}from"./envUtils-DSxRz_kt.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{
|
|
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,l as i,n as a,o}from"./envUtils-DSxRz_kt.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{SD as ee,cC as te,yD as ne}from"./loadAgentsDir-D206qwP3.js";import{n as re}from"./cwd-CYmmnQVS.js";import{C as l,E as ie,H as ae,O as oe,S as u,V as se,W as ce,a as d,d as f,l as p,p as m,w as le,z as h}from"./debug-BrXObCdR.js";import{A as g,Jt as ue,M as de,Qt as fe,Zt as pe,en as me,g as he,n as ge}from"./settings-BovzmwMP.js";import{a as _e,c as _,g as v,i as ve}from"./config-DmomySWC.js";import{c as ye,n as y,o as be,r as b,t as x}from"./execFileNoThrow-D244NytW.js";import{o as S,s as C}from"./log-BMCygSzM.js";import{n as xe,t as Se}from"./which-CKQnSouy.js";import{i as w,o as T}from"./platform-BrYefG_2.js";import{n as E,t as Ce}from"./bundledMode--fG1S62b.js";import{i as we,r as Te}from"./genericProcessUtils-CdQTApYX.js";import{a as Ee,i as De}from"./ripgrep-BXmXjAzA.js";import{n as Oe,r as ke}from"./semver-BMRJYn3q.js";import{homedir as D}from"os";import{basename as Ae,delimiter as je,join as O,posix as k,win32 as A}from"path";import{constants as Me}from"fs";import{access as j,open as Ne,readFile as M,realpath as N,stat as Pe}from"fs/promises";function P(){return O(a(),`local`)}function Fe(){return O(P(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.claude/local/node_modules/`)}async function F(){try{return await j(O(P(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function I(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var L=e((()=>{v(),o(),h(),b(),m(),S(),u()}));function R(e){let t=e?.homedir??D();return{zsh:O((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:O(t,`.bashrc`),fish:O(t,`.config/fish/config.fish`)}}function Le(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()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function z(e){try{return(await M(e,{encoding:`utf8`})).split(`
|
|
2
2
|
`)}catch(e){if(ae(e))return null;throw e}}async function Re(e,t){let n=await Ne(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
-
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(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 B(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){let e=await Ve();return process.env.USER_TYPE===`ant`?e.ant||void 0:e.external||void 0}async function Ve(){try{return{}}catch(e){return C(e),{}}}function He(e){let t=ge()?.minimumVersion;if(!t)return!1;let n=!Oe(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ue(){let e=ue.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function We(){try{let e=await Ue();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Ye(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function Ge(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ke(e){try{return(await s.get(`${Je}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function qe(){let[e,t]=await Promise.all([Ke(`latest`),Ke(`stable`)]);return{latest:e,stable:t}}var Je,Ye,Xe=e((()=>{c(),v(),d(),pe(),o(),h(),b(),m(),ne(),S(),ke(),he(),H(),u(),Je=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Ye=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function $e(){if(w()!==`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 p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,et,tt=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),et=t(async()=>W()?`homebrew`:$e()?`winget`:Ze()?`mise`:Qe()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function nt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function rt(){let[e]=nt();if(E())return W()||$e()||Ze()||Qe()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Ie())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await be(`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 it(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function at(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function ot(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await N(o)).includes(`/Caskroom/`)&&(e=W())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(_().installMethod===`native`){let n=O(D(),`.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 st(e){let t=[];try{let e=l(await M(O(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: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(w()===`windows`){let e=n.split(k.sep).join(A.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=I(),n=R()[e],r=n?n.replace(D(),`~`):`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}`})}}i(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 F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`claude`)&&!a&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.claude/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.claude/local/claude"`})),t}function ct(){if(w()!==`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 lt(){let e=await rt(),t=typeof MACRO<`u`?`0.0.4`:`unknown`,n=await it(),r=at(),i=await ot(),a=await st(e);if(a.push(...ct()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`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/claude-code`}):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=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await We()).hasPermissions,!s&&!_e()&&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=De(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await et():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var ut=e((()=>{ye(),Xe(),Ce(),v(),re(),o(),b(),m(),L(),tt(),T(),Ee(),te(),me(),de(),H(),u(),Se()}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ft(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=Te(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=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!ft(n,r))return p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function mt(e,t){let n=f(),r=Ae(e);if(Q(t))return p(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return pt(t,i),Z(t)?.pid===process.pid?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`Failed to acquire lock for ${r}: ${e}`),null}}async function ht(e,t){let n=await mt(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function gt(e,t,n){let r=await mt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function _t(e){let t=f(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(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(se(e))return n;C(ce(e))}return n}function vt(e){let t=f(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,yt=e((()=>{d(),o(),h(),m(),we(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,gt as c,ut as d,qe as f,He as g,Xe as h,yt as i,rt as l,Ge as m,vt as n,dt as o,Be as p,_t as r,Z as s,ht as t,lt as u,R as v,Re as x,H as y};
|
|
3
|
+
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(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 B(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){let e=await Ve();return process.env.USER_TYPE===`ant`?e.ant||void 0:e.external||void 0}async function Ve(){try{return{}}catch(e){return C(e),{}}}function He(e){let t=ge()?.minimumVersion;if(!t)return!1;let n=!Oe(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ue(){let e=ue.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function We(){try{let e=await Ue();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Ye(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function Ge(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ke(e){try{return(await s.get(`${Je}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function qe(){let[e,t]=await Promise.all([Ke(`latest`),Ke(`stable`)]);return{latest:e,stable:t}}var Je,Ye,Xe=e((()=>{c(),v(),d(),pe(),o(),h(),b(),m(),te(),S(),ke(),he(),H(),u(),Je=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Ye=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function $e(){if(w()!==`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 p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,et,tt=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),et=t(async()=>W()?`homebrew`:$e()?`winget`:Ze()?`mise`:Qe()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function nt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function rt(){let[e]=nt();if(E())return W()||$e()||Ze()||Qe()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Ie())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await be(`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 it(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function at(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function ot(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await N(o)).includes(`/Caskroom/`)&&(e=W())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(_().installMethod===`native`){let n=O(D(),`.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 st(e){let t=[];try{let e=l(await M(O(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: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(w()===`windows`){let e=n.split(k.sep).join(A.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=I(),n=R()[e],r=n?n.replace(D(),`~`):`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}`})}}i(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 F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`claude`)&&!a&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.claude/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.claude/local/claude"`})),t}function ct(){if(w()!==`linux`)return[];let e=[],t=ne.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 lt(){let e=await rt(),t=typeof MACRO<`u`?`0.0.6`:`unknown`,n=await it(),r=at(),i=await ot(),a=await st(e);if(a.push(...ct()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`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/claude-code`}):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=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await We()).hasPermissions,!s&&!_e()&&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=De(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await et():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var ut=e((()=>{ye(),Xe(),Ce(),v(),re(),o(),b(),m(),L(),tt(),T(),Ee(),ee(),me(),de(),H(),u(),Se()}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ft(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=Te(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=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!ft(n,r))return p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function mt(e,t){let n=f(),r=Ae(e);if(Q(t))return p(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return pt(t,i),Z(t)?.pid===process.pid?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`Failed to acquire lock for ${r}: ${e}`),null}}async function ht(e,t){let n=await mt(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function gt(e,t,n){let r=await mt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function _t(e){let t=f(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(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(se(e))return n;C(ce(e))}return n}function vt(e){let t=f(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,yt=e((()=>{d(),o(),h(),m(),we(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,gt as c,ut as d,qe as f,He as g,Xe as h,yt as i,rt as l,Ge as m,vt as n,dt as o,Be as p,_t as r,Z as s,ht as t,lt as u,R as v,Re as x,H as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Yt as o,en as s}from"./state-ix0xIunV.js";import{A as c,C as l,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Yt as o,en as s}from"./state-ix0xIunV.js";import{A as c,C as l,Dg as u,Ew as d,Fg as f,Sw as p,cb as m,fb as h,lb as g}from"./loadAgentsDir-D206qwP3.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-DeMrXUir.js";import{r as x,t as S}from"./staticRender-BIxpgNUq.js";function C({planContent:e,planPath:r,editorName:i}){return(0,T.jsxs)(t,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:r}),(0,T.jsx)(t,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),i&&(0,T.jsxs)(t,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:i})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){o(a,`plan`),i(e=>({...e,toolPermissionContext:p(c(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let s=m(),l=g();if(!s)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(l);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${l}`),null}let u=v();return e(await x((0,T.jsx)(C,{planContent:s,planPath:l,editorName:u?f(u):void 0}))),null}var T;e((()=>{r(),s(),i(),_(),u(),d(),l(),h(),y(),S(),T=a()}))();export{w as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,t as i}from"./PluginSettings-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,t as i}from"./PluginSettings-CGqEzejq.js";async function a(e,t,n){return(0,o.jsx)(i,{onComplete:e,args:n})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Es as t,Gs as n,Hs as r,Ls as i,Os as a,Vs as o,aO as s,js as c,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Es as t,Gs as n,Hs as r,Ls as i,Os as a,Vs as o,aO as s,js as c,sO as l}from"./loadAgentsDir-D206qwP3.js";import{F as u,a as d,l as f,z as p}from"./debug-BrXObCdR.js";import{St as m,Tt as h}from"./settings-BovzmwMP.js";import{g,x as _}from"./config-DmomySWC.js";import{o as v,s as y}from"./log-BMCygSzM.js";import{f as b,s as x}from"./pluginOperations-EN3EKLux.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await r(),t=i(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=c(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=l(n);if(!r||!e.has(r.toLowerCase()))return null;let i=t.plugins[n];if(!i||i.length===0)return null;let o=i.filter(a);return o.length===0?null:w(n,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await n(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let r=await E(e);r.length>0&&(O?O(r):k=r)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),g(),d(),p(),v(),t(),o(),s(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Es as e,Ms as t,Rs as n,Us as r,Vs as i}from"./loadAgentsDir-
|
|
1
|
+
import{Es as e,Ms as t,Rs as n,Us as r,Vs as i}from"./loadAgentsDir-D206qwP3.js";import{F as a,a as o,l as s,z as c}from"./debug-BrXObCdR.js";import{i as l,n as u,r as d,t as f}from"./pluginFlagging-D9HKAGBC.js";import{d as p,s as m}from"./pluginOperations-EN3EKLux.js";m(),o(),c(),e(),i(),d();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await l();let e=t(),i=u(),o=await r(),c=[];for(let t of Object.keys(o))try{let r=await n(t);if(!r.forceRemoveDeletedPlugins)continue;let o=h(e,r,t);for(let t of o){if(t in i)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await p(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${a(e)}`,{level:`error`})}}await f(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${a(e)}`,{level:`warn`})}return c}export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./figures-5ThXQEtq.js";import{Ts as n,aO as r,cC as i,hy as a,my as o,oC as s,py as c,sO as l,ws as u}from"./loadAgentsDir-D206qwP3.js";import{F as d,z as f}from"./debug-BrXObCdR.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-BMCygSzM.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-EN3EKLux.js";e(),f(),i(),h(),n(),r(),p(),a(),_(),T();function E(e,n,r){g(e);let i=r?`${n} plugin "${r}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${i}: ${d(e)}`);let a=r?(()=>{let{name:e,marketplace:t}=l(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...c(e,t,u())}})():{};v(`tengu_plugin_command_failed`,{command:n,error_category:o(e),...a}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r.scope||n,install_source:`cli-explicit`,...c(i,a,u())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let i=await x(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=l(i.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope||n,...c(a,o,u())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r.scope,...c(i,a,u())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r.scope,...c(i,a,u())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),v(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await S(e,n);if(!r.success)throw Error(r.message);if(m(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=l(r.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...c(t,n,u())})}await s(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j 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{Br as r,Ci as i,Fi as a,Hr as o,Kr as s,Mi as ee,Ni as te,Pi as ne,Rr as c,Si as re,Ur as l,Vr as u,qr as ie,zr as ae}from"./state-ix0xIunV.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{Br as r,Ci as i,Fi as a,Hr as o,Kr as s,Mi as ee,Ni as te,Pi as ne,Rr as c,Si as re,Ur as l,Vr as u,qr as ie,zr as ae}from"./state-ix0xIunV.js";import{GD as oe,KD as se,OO as ce,_D as le,gD as d,kO as ue,vO as de,yO as fe}from"./loadAgentsDir-D206qwP3.js";import{C as f,S as p,a as m,d as h,l as g,p as _,w as v}from"./debug-BrXObCdR.js";import{An as y,Dn as b,En as x,Jn as S,On as C,Yn as w,jn as T,kn as E}from"./settings-BovzmwMP.js";import{R as D,z as O}from"./config-DmomySWC.js";import{o as k,s as A}from"./log-BMCygSzM.js";import{join as j}from"path";import{randomBytes as M}from"crypto";import{readFile as N,rename as P,unlink as F,writeFile as I}from"fs/promises";function L(e){return te(e)||i(e)||!!(R&&e&&e[R])}var R,z=e((()=>{n(),re(),ee(),R=t?t.isConcatSpreadable:void 0}));function B(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=L),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?B(s,t-1,n,r,i):ne(i,s):r||(i[i.length]=s)}return i}var V=e((()=>{a(),z()}));function pe(e){return e!=null&&e.length?B(e,1):[]}var me=e((()=>{V()}));function he(e){return b(E(e,void 0,pe),e+``)}var ge=e((()=>{me(),C(),x()}));function _e(e,t){return t.length<2?e:c(e,oe(t,0,-1))}var ve=e((()=>{ae(),se()}));function ye(e,t){t=o(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=u(t[n]);if(i===`__proto__`&&!H.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=_e(e,t);return a==null||delete a[u(fe(t))]}var H,be=e((()=>{l(),de(),ve(),r(),H=Object.prototype.hasOwnProperty}));function xe(e){return T(e)?void 0:e}var Se=e((()=>{y()})),U,W,G,K,Ce=e((()=>{ie(),ue(),be(),l(),w(),Se(),ge(),O(),U=1,W=2,G=4,K=he(function(e,t){var n={};if(e==null)return n;var r=!1;t=s(t,function(t){return t=o(t,e),r||(r=t.length>1),t}),S(e,D(e),n),r&&(n=ce(n,U|W|G,xe));for(var i=t.length;i--;)ye(n,t[i]);return n})}));function q(){return j(d(),Z)}function we(e){let t=f(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function J(){try{return we(await N(q(),{encoding:`utf-8`}))}catch{return{}}}async function Y(e){let t=q(),n=`${t}.${M(8).toString(`hex`)}.tmp`;try{await h().mkdir(d()),await I(n,v({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await P(n,t),$=e}catch(e){A(e);try{await F(n)}catch{}}}async function Te(){let e=await J(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=Q&&(delete e[r],n=!0);$=e,n&&await Y(e)}function Ee(){return $??{}}async function X(e){$===null&&($=await J()),await Y({...$,[e]:{flaggedAt:new Date().toISOString()}}),g(`Flagged plugin: ${e}`)}async function De(e){$===null&&($=await J());let t=new Date().toISOString(),n=!1,r={...$};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await Y(r)}async function Oe(e){if($===null&&($=await J()),!(e in $))return;let{[e]:t,...n}=$;$=n,await Y(n)}var Z,Q,$,ke=e((()=>{m(),_(),k(),p(),le(),Z=`flagged-plugins.json`,Q=2880*60*1e3,$=null}));export{De as a,K as c,Te as i,Ee as n,Oe as o,ke as r,Ce as s,X as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,nt as n}from"./state-ix0xIunV.js";import{Bs as r,Cs as i,Es as a,Hs as o,Ms as s,Ns as c,Ps as l,Rs as u,Ss as d,Vs as f,
|
|
2
|
-
`)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:i}=
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,nt as n}from"./state-ix0xIunV.js";import{Bs as r,Cs as i,Es as a,Hs as o,Ms as s,Ns as c,Ps as l,Rs as u,Ss as d,Vs as f,_D as p,_s as m,aO as h,am as g,bs as _,cO as v,dc as y,ds as b,ev as ee,fO as x,fs as S,hs as C,iO as w,js as T,lc as E,ls as te,nO as D,nv as ne,om as re,pD as O,pO as k,ps as A,rO as j,sO as M,ss as ie,uc as ae,us as N,vs as oe}from"./loadAgentsDir-D206qwP3.js";import{V as P,W as se,d as ce,p as F,z as I}from"./debug-BrXObCdR.js";import{c as L,g as R,y as z}from"./settings-BovzmwMP.js";import{o as B,s as V}from"./log-BMCygSzM.js";import{l as H,o as U}from"./stringUtils-DGLPkqJ4.js";import{n as W,t as G}from"./pluginStartupCheck-BY73BMT2.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return L(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=L(v(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=M(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=M(e),n=s();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=M(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=s().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:i}=M(e),a,s,c;if(i){let t=await r(e);t&&(a=t.entry,s=i,c=t.marketplaceInstallLocation)}else{let e=await o();for(let[t,r]of Object.entries(e))try{let e=(await u(t)).plugins.find(e=>e.name===n);if(e){a=e,s=t,c=r.installLocation;break}}catch(e){V(se(e))}}if(!a||!s)return{success:!1,message:`Plugin "${n}" not found in ${i?`marketplace "${i}"`:`any configured marketplace`}`};let l=a,d=`${l.name}@${s}`,f=await _({pluginId:d,entry:l,scope:t,marketplaceInstallLocation:c});if(!f.ok){let e=f;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:m(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${d} (scope: ${t})${f.depNote}`,pluginId:d,pluginName:l.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:r,disabled:i}=await A(),a=[...r,...i],o=pe(e,a),l=v(t),u=L(l),d,f;if(o)d=Object.keys(u?.enabledPlugins??{}).find(t=>t===e||t===o.name||t.startsWith(`${o.name}@`))??(e.includes(`@`)?e:o.name),f=o.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};d=t.pluginId,f=t.pluginName}let p=J(t),m=s().plugins[d],h=m?.find(e=>e.scope===t&&e.projectPath===p);if(!h){let{scope:n}=Y(d);return n!==t&&m&&m.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let g=h.installPath,_={...u?.enabledPlugins};_[d]=void 0,z(l,{enabledPlugins:_}),E(),c(d,t,p);let b=s().plugins[d],x=!b||b.length===0;x&&g&&await y(g),x&&(ee(d),n&&await O(d));let S=D(d,a),C=j(S);return{success:!0,message:`Successfully uninstalled plugin: ${f} (scope: ${t})${C}`,pluginId:d,pluginName:f,scope:t,reverseDependents:S.length>0?S:void 0}}async function X(e,t,n){let r=t?`enable`:`disable`;if(k(e)){let{error:n}=z(`userSettings`,{enabledPlugins:{...L(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${r} built-in plugin: ${n.message}`};E();let{name:i}=M(e);return{success:!0,message:`Successfully ${r}d built-in plugin: ${i}`,pluginId:e,pluginName:i,scope:`user`}}n&&q(n);let i,a,o=fe(e);if(n)if(a=n,o)i=o.pluginId;else if(e.includes(`@`))i=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(o)i=o.pluginId,a=o.scope;else if(e.includes(`@`))i=e,a=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&re(i))return{success:!1,message:`Plugin "${i}" is blocked by your organization's policy and cannot be enabled`};let s=v(a),c=L(s)?.enabledPlugins?.[i],l={user:0,project:1,local:2},u=n&&o&&l[n]>l[o.scope];if(n&&c===void 0&&o&&o.scope!==n&&!u)return{success:!1,message:`Plugin "${e}" is installed at ${o.scope} scope, not ${n}. Use --scope ${o.scope} or omit --scope to auto-detect.`};if(t===(n&&!u?c===!0:G().has(i)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let d;if(!t){let{enabled:e,disabled:t}=await A(),n=D(i,[...e,...t]);n.length>0&&(d=n)}let{error:f}=z(s,{enabledPlugins:{...L(s)?.enabledPlugins,[i]:t}});if(f)return{success:!1,message:`Failed to ${r} plugin: ${f.message}`};E();let{name:p}=M(i),m=j(d);return{success:!0,message:`Successfully ${r}d plugin: ${p} (scope: ${a})${m}`,pluginId:i,pluginName:p,scope:a,reverseDependents:d}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${H(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
|
|
2
|
+
`)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:i}=M(e),a=i?`${n}@${i}`:e,o=await r(e);if(!o)return{success:!1,message:`Plugin "${n}" not found`,pluginId:a,scope:t};let{entry:s,marketplaceInstallLocation:c}=o,l=T().plugins[a];if(!l||l.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:a,scope:t};let u=J(t),d=l.find(e=>e.scope===t&&e.projectPath===u);return d?be({pluginId:a,pluginName:n,entry:s,marketplaceInstallLocation:c,installation:d,scope:t,projectPath:u}):{success:!1,message:`Plugin "${n}" is not installed at scope ${u?`${t} (${u})`:t}`,pluginId:a,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=ce(),c=i.version,u,f,p=!1,m;if(typeof n.source!=`string`){let t=await ie(n.source,{manifest:{name:n.name}});u=t.path,p=!0,m=t.gitCommitSha,f=await d(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(P(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}u=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(u)}catch(t){if(P(t))return{success:!1,message:`Plugin source not found at ${u}`,pluginId:e,scope:a};throw t}let i,o=K(u,`.claude-plugin`,`plugin.json`);try{i=await C(o,n.name,n.source)}catch{}f=await d(e,n.source,i,u,n.version)}try{let r=N(e,f),s=b(e,f);if(i.version===f||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${f}).`,pluginId:e,newVersion:f,oldVersion:c,alreadyUpToDate:!0,scope:a};r=await te(u,e,f,n);let d=i.installPath;if(l(e,a,o,r,f,m),d&&d!==r){let e=T();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===d))||await y(d)}let p=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${c||`unknown`} to ${f} for scope ${p}. Restart to apply changes.`,pluginId:e,newVersion:f,oldVersion:c,scope:a}}finally{p&&u!==N(e,f)&&await s.rm(u,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),x(),I(),F(),B(),ae(),w(),a(),f(),p(),h(),oe(),S(),ne(),g(),W(),i(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bs as t,Es as n,Vs as r,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bs as t,Es as n,Vs as r,aO as i,cO as a,gs as o,lO as s,uO as c,vs as l,xs as u}from"./loadAgentsDir-D206qwP3.js";import{n as d,t as f}from"./cwd-CYmmnQVS.js";import{a as p,l as m}from"./debug-BrXObCdR.js";import{St as h,c as g,g as _,wt as v,y}from"./settings-BovzmwMP.js";import{o as b,s as x}from"./log-BMCygSzM.js";import{join as S}from"path";function C(){let e=new Map,t=s();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=g(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&m(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return m(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}async function w(e,n,r=`user`){let i=r===`user`?void 0:f(),s=a(r),c=g(s),l={...c?.enabledPlugins},d=[],p=[];for(let a=0;a<e.length;a++){let s=e[a];if(s){n&&n(s,a+1,e.length);try{let e=await t(s);if(!e){p.push({name:s,error:`Plugin not found in any marketplace`});continue}let{entry:n,marketplaceInstallLocation:a}=e;v(n.source)?u({pluginId:s,installPath:S(a,n.source),version:n.version},r,i):await o(s,n,r,i),l[s]=!0,d.push(s)}catch(e){let t=e instanceof Error?e.message:String(e);p.push({name:s,error:t}),x(e)}}}return y(s,{...c,enabledPlugins:l}),{installed:d,failed:p}}var T=e((()=>{d(),p(),b(),_(),c(),n(),r(),i(),l(),h()}));export{T as n,w as r,C as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./pluginStartupCheck-BY73BMT2.js";e();export{t as getPluginEditableScopes};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{n as e,t}from"./figures-5ThXQEtq.js";import{en as n,hr as r}from"./state-ix0xIunV.js";import{$_ as i,$s as a,As as o,Es as s,Fs as c,Gs as l,Hs as u,Ms as d,Q_ as f,Vs as p,Ws as m,Ys as h,aO as g,ac as _,cO as ee,fs as v,hO as y,lc as b,mO as x,ps as S,qs as C,sO as w,sc as T,uc as E}from"./loadAgentsDir-D206qwP3.js";import{F as D,S as te,w as O,z as k}from"./debug-BrXObCdR.js";import{o as A,s as j}from"./log-BMCygSzM.js";import{n as ne,r as M}from"./analytics-BotDBGh0.js";import{l as N,o as P}from"./stringUtils-DGLPkqJ4.js";import{n as F,t as I}from"./exit-BOhGfSlm.js";import{n as L,s as R,t as z}from"./pluginOperations-EN3EKLux.js";import{a as B,i as V,n as H,o as U,r as W,t as G}from"./pluginCliCommands-lqdxdkQp.js";import{a as K,c as re,i as q,n as J,r as Y,s as X,t as ie}from"./validatePlugin-DtiYlXby.js";import{basename as ae,dirname as Z}from"path";e(),n(),ne(),R(),y(),k(),A(),E(),re(),s(),_(),p(),f(),q(),g(),v(),ie(),te(),P();function Q(e,n){j(e),I(`${t.cross} Failed to ${n}: ${D(e)}`)}function $(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${N(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${N(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function oe(e,n){n.cowork&&r(!0);try{let n=await J(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),$(n);let r=[];if(n.fileType===`plugin`){let e=Z(n.filePath);if(ae(e)===`.claude-plugin`){r=await Y(Z(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),$(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?F(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){j(e),console.error(`${t.cross} Unexpected error during validation: ${D(e)}`),process.exit(2)}}async function se(e){e.cowork&&r(!0),M(`tengu_plugin_list_command`,{});let n=d(),{getPluginEditableScopes:s}=await import(`./pluginStartupCheck-CwWOlveD.js`),c=s(),l=Object.keys(n.plugins),{enabled:f,disabled:p,errors:m}=await S(),h=[...f,...p],g=h.filter(e=>e.source.endsWith(`@inline`)),_=m.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(h.map(e=>[e.source,e])),r=[];for(let e of l.sort()){let a=n.plugins[e];if(!a||a.length===0)continue;let o=w(e).name,s=m.filter(t=>t.source===e||`plugin`in t&&t.plugin===o).map(x);for(let n of a){let a=t.get(e),o;if(a){let e=a.mcpServers||await i(a);e&&Object.keys(e).length>0&&(o=e)}r.push({id:e,version:n.version||`unknown`,scope:n.scope,enabled:c.has(e),installPath:n.installPath,installedAt:n.installedAt,lastUpdated:n.lastUpdated,projectPath:n.projectPath,mcpServers:o,errors:s.length>0?s:void 0})}}for(let e of g){let t=e.mcpServers||await i(e),n=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(x);r.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:n.length>0?n:void 0})}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))r.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[x(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([u(),X()]),{marketplaces:r}=await T(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=a(r.name,t);o(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}F(O({installed:r,available:e},null,2))}else F(O(r,null,2))}l.length===0&&g.length===0&&_.length===0&&F("No plugins installed. Use `claude plugin install` to install a plugin."),l.length>0&&console.log(`Installed plugins:
|
|
2
|
+
`);for(let e of l.sort()){let r=n.plugins[e];if(!r||r.length===0)continue;let i=w(e).name,a=m.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let n of r){let r=c.has(e),i=a.length>0?`${t.cross} failed to load`:r?`${t.tick} enabled`:`${t.cross} disabled`,o=n.version||`unknown`,s=n.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${o}`),console.log(` Scope: ${s}`),console.log(` Status: ${i}`);for(let e of a)console.log(` Error: ${x(e)}`);console.log(``)}}if(g.length>0||_.length>0){console.log(`Session-only plugins (--plugin-dir):
|
|
3
|
+
`);for(let e of g){let n=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${x(e)}`);console.log(``)}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${x(e)}\n`)}F()}async function ce(e,n){n.cowork&&r(!0);try{let r=await K(e);r||I(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in r&&I(`${t.cross} ${r.error}`);let i=n.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&I(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=ee(i),o=r;n.sparse&&n.sparse.length>0&&(o.source===`github`||o.source===`git`?o={...o,sparsePaths:n.sparse}:I(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${o.source})`)),console.log(`Adding marketplace...`);let{name:s,alreadyMaterialized:l,resolvedSource:u}=await c(o,e=>{console.log(e)});h(s,{source:u},a),b();let d=o.source;o.source===`github`&&(d=o.repo),M(`tengu_marketplace_added`,{source_type:d}),F(l?`${t.tick} Marketplace '${s}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${s} (declared in ${i} settings)`)}catch(e){Q(e,`add marketplace`)}}async function le(e){e.cowork&&r(!0);try{let n=await u(),r=Object.keys(n);e.json&&F(O(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&F(`No marketplaces configured`),console.log(`Configured marketplaces:
|
|
4
|
+
`),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),F()}catch(e){Q(e,`list marketplaces`)}}async function ue(e,n){n.cowork&&r(!0);try{await C(e),b(),M(`tengu_marketplace_removed`,{marketplace_name:e}),F(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Q(e,`remove marketplace`)}}async function de(e,n){n.cowork&&r(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await l(e,e=>{console.log(e)}),b(),M(`tengu_marketplace_updated`,{marketplace_name:e}),F(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await u(),n=Object.keys(e);n.length===0&&F(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await m(),b(),M(`tengu_marketplace_updated_all`,{count:n.length}),F(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Q(e,`update marketplace(s)`)}}async function fe(e,t){t.cowork&&r(!0);let n=t.scope||`user`;t.cowork&&n!==`user`&&I(`--cowork can only be used with user scope`),z.includes(n)||I(`Invalid scope: ${n}. Must be one of: ${z.join(`, `)}.`);let{name:i,marketplace:a}=w(e);M(`tengu_plugin_install_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:n}),await V(e,n)}async function pe(e,t){t.cowork&&r(!0);let n=t.scope||`user`;t.cowork&&n!==`user`&&I(`--cowork can only be used with user scope`),z.includes(n)||I(`Invalid scope: ${n}. Must be one of: ${z.join(`, `)}.`);let{name:i,marketplace:a}=w(e);M(`tengu_plugin_uninstall_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:n}),await B(e,n,t.keepData)}async function me(e,t){t.cowork&&r(!0);let n;t.scope&&(z.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${z.join(`, `)}`),n=t.scope),t.cowork&&n!==void 0&&n!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&n===void 0&&(n=`user`);let{name:i,marketplace:a}=w(e);M(`tengu_plugin_enable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:n??`auto`}),await W(e,n)}async function he(e,t){if(t.all&&e&&I(`Cannot use --all with a specific plugin`),!t.all&&!e&&I(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&r(!0),t.all){t.scope&&I(`Cannot use --scope with --all`),M(`tengu_plugin_disable_command`,{}),await G();return}let n;t.scope&&(z.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${z.join(`, `)}`),n=t.scope),t.cowork&&n!==void 0&&n!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&n===void 0&&(n=`user`);let{name:i,marketplace:a}=w(e);M(`tengu_plugin_disable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:n??`auto`}),await H(e,n)}async function ge(e,t){t.cowork&&r(!0);let{name:n,marketplace:i}=w(e);M(`tengu_plugin_update_command`,{_PROTO_plugin_name:n,...i&&{_PROTO_marketplace_name:i}});let a=`user`;t.scope&&(L.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),a=t.scope),t.cowork&&a!==`user`&&I(`--cowork can only be used with user scope`),await U(e,a)}export{ce as marketplaceAddHandler,le as marketplaceListHandler,ue as marketplaceRemoveHandler,de as marketplaceUpdateHandler,he as pluginDisableHandler,me as pluginEnableHandler,fe as pluginInstallHandler,se as pluginListHandler,pe as pluginUninstallHandler,ge as pluginUpdateHandler,oe as pluginValidateHandler};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ua as e,Va as t,Ya as n}from"./loadAgentsDir-D206qwP3.js";t();export{e as isPolicyAllowed,n as waitForPolicyLimitsToLoad};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,t as r}from"./poorMode-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,t as r}from"./poorMode-DhzFKpPl.js";var i;e((()=>{r(),i=async(e,r)=>{let i=!n();return t(i),i?r.setAppState(e=>({...e,promptSuggestionEnabled:!1})):r.setAppState(e=>({...e,promptSuggestionEnabled:!0})),{type:`text`,value:`Poor mode ${i?`ON`:`OFF`} — ${i?`extract_memories and prompt_suggestion are disabled`:`extract_memories and prompt_suggestion are restored`}`}}}))();export{i as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{g as n,n as r,y as i}from"./settings-
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{g as n,n as r,y as i}from"./settings-BovzmwMP.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=r().poorMode===!0),c}function s(e){c=e,i(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{n(),c=null}));export{s as i,o as n,a as r,l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./poorMode-DhzFKpPl.js";t();export{e as isPoorModeActive};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r,s as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{M as s,P as c,Tn as l,Un as u,Wn as d,Z as f,en as p,ht as m,ir as h,kn as g,ln as _,tn as v,vr as y}from"./state-ix0xIunV.js";import{$g as b,$w as x,Al as S,Ar as C,BT as ee,Bv as w,C as T,Cn as E,D,DD as te,DT as ne,E as O,ED as re,ET as ie,F_ as ae,Fc as k,G as oe,Gw as se,HC as ce,H_ as le,Hy as ue,I_ as de,Ib as fe,Ic as pe,Is as me,JS as A,Jy as j,KT as he,K_ as ge,Ks as _e,Ku as ve,Ky as ye,LD as M,LT as be,Lb as xe,Ls as Se,MT as Ce,Md as N,NC as we,ND as Te,NT as Ee,Nc as De,O_ as Oe,Oi as ke,P as Ae,PC as je,PD as Me,PT as Ne,Pc as Pe,Qi as Fe,Qw as Ie,RC as P,RD as F,R_ as Le,Rv as Re,SD as I,TT as ze,T_ as Be,Tb as Ve,UC as He,Ua as Ue,Us as We,Ut as Ge,Uy as L,V_ as R,Va as z,Vi as Ke,Vs as qe,W as Je,Wi as Ye,Ww as Xe,Xu as Ze,YC as Qe,Yy as $e,ZC as et,Zw as B,_c as V,_g as tt,_i as nt,_w as rt,aT as it,ag as at,as as ot,ax as st,b as ct,bb as lt,bc as ut,cC as dt,cT as ft,ca as pt,cf as mt,cg as ht,cr as gt,cs as _t,cu as vt,cw as yt,cy as bt,dg as xt,eT as St,e_ as Ct,ei as wt,ew as Tt,f as Et,fc as Dt,fi as Ot,fs as kt,gb as At,gc as jt,gi as Mt,go as Nt,h_ as Pt,hc as Ft,hg as It,hw as Lt,iT as Rt,ig as zt,ir as Bt,jd as Vt,jr as Ht,ki as Ut,kl as Wt,kr as Gt,lC as Kt,lf as qt,lx as Jt,mc as Yt,mg as Xt,ms as Zt,mw as Qt,nT as $t,n_ as en,ng as tn,o as nn,oC as rn,oT as an,os as on,pT as sn,pc as cn,pg as ln,pi as un,pw as dn,qS as fn,qT as pn,qi as mn,qu as hn,qy as gn,rT as _n,s as vn,sC as H,sT as yn,su as bn,sy as xn,tT as Sn,tw as Cn,ty as wn,uu as Tn,uw as En,vb as Dn,vc as On,vg as kn,vw as An,wb as jn,wn as Mn,x as Nn,xc as Pn,yD as Fn,yb as In,yc as Ln,yn as Rn,yw as zn,zC as Bn,zo as Vn,zy as Hn}from"./loadAgentsDir-D206qwP3.js";import{n as Un,t as Wn}from"./cwd-CYmmnQVS.js";import{C as Gn,F as U,S as Kn,W as qn,a as Jn,d as Yn,l as W,nt as Xn,o as Zn,p as Qn,rt as $n,w as G,z as er}from"./debug-BrXObCdR.js";import{St as tr,Y as nr,_n as rr,ct as ir,d as ar,f as or,g as sr,ht as cr,ot as K,yn as lr}from"./settings-BovzmwMP.js";import{L as ur,P as dr}from"./config-DmomySWC.js";import{i as fr,n as pr,o as q}from"./process-gEbdy6uY.js";import{M as mr,N as hr,j as gr}from"./git-Do0wJvux.js";import{U as _r,Y as vr,c as yr,i as br,o as xr,s as J}from"./log-BMCygSzM.js";import{i as Sr,n as Cr}from"./path-D5U-tm91.js";import{s as wr,u as Tr}from"./types-C-MRCL8J.js";import{n as Er,r as Y}from"./analytics-BotDBGh0.js";import{Bt as Dr,C as Or,Mn as kr,Si as Ar,Y as jr,_ as Mr,_n as Nr,bi as Pr,br as Fr,bt as Ir,et as Lr,ii as Rr,it as zr,jn as Br,o as Vr,oi as Hr,rt as Ur,tt as Wr,u as Gr,vn as Kr,wi as qr,x as Jr,xi as Yr,xr as Xr}from"./model-CKkOnnnx.js";import{Dt as Zr,En as Qr,Ot as $r,Tn as ei,Zt as ti,an as ni,dt as ri,ut as ii}from"./prompt-BNHtszmZ.js";import{c as ai,s as oi}from"./pluginFlagging-D9HKAGBC.js";import{a as si,o as ci,s as li}from"./fileStateCache-DDW5toIs.js";import{A as ui,C as di,D as fi,N as pi,O as mi,P as hi,_ as gi,d as _i,g as vi,h as yi,lt as bi,m as xi,u as Si,v as Ci,y as wi}from"./rcDebugLog-CUy1_F23.js";import{c as Ti,l as Ei}from"./commitAttribution-ChAgixdj.js";import{t as Di}from"./pollConfig-DH2oCtFS.js";import{r as Oi}from"./inboundAttachments-CUJE3KaU.js";import{i as ki,n as Ai,s as ji}from"./mappers-BDMZFgKx.js";import{n as Mi,r as Ni}from"./sessionTitle-coed9IuJ.js";import{n as Pi,t as Fi}from"./ccrClient-Iza0L8Zw.js";import{n as Ii,t as Li}from"./HybridTransport-B8V6O6rM.js";import{n as Ri,t as zi}from"./SSETransport-DtpMDekF.js";import{a as Bi,n as Vi,o as Hi}from"./grove-CpqjcGCb.js";import{o as Ui}from"./remoteManagedSettings-Cq994lyc.js";import{i as Wi,r as Gi}from"./auth-BnSrKyJe.js";import{t as Ki}from"./pluginBlocklist-C3H2afWG.js";import{t as qi}from"./onChangeAppState-DBmy2Ow_.js";import{t as Ji}from"./settingsSync-PqU9XGJq.js";import{a as Yi,c as Xi,n as Zi,o as Qi,r as $i,s as ea}from"./reconciler-BXpPyfSY.js";import{n as ta,t as na}from"./toolPool-B64V-jmK.js";import{n as ra,r as ia}from"./QueryEngine-CZZMl3PB.js";import{n as aa,r as oa}from"./sideQuestion-wSi38p81.js";import{n as sa,r as ca}from"./context-noninteractive-9hELVC29.js";import{a as la,o as ua,t as da}from"./skillChangeDetector-DNqohXxz.js";import{n as fa,t as pa}from"./refresh-CuaVBIQ0.js";import{dirname as ma,join as ha}from"path";import{PassThrough as ga}from"stream";import{randomUUID as X}from"crypto";import{readFile as _a,stat as va}from"fs/promises";import{URL as ya}from"url";import{cwd as Z}from"process";a(),p(),Un(),Xn(),er(),Kn(),Qn(),pr(),Jn(),gr(),vr(),xr(),Sr(),rr(),wr(),sr(),qr(),ei(),Hr(),Xr(),Br(),Nr(),Dr(),Mr(),ni(),Sn(),pi(),Bn(),dt(),mi(),xn(),_i(),on(),Vn(),Fe(),Ht(),Ji(),r(),Ri();function ba(e,t={},r,i){if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let n=new ya(e.href);return n.protocol===`wss:`?n.protocol=`https:`:n.protocol===`ws:`&&(n.protocol=`http:`),n.pathname=n.pathname.replace(/\/$/,``)+`/worker/events/stream`,new zi(n,t,r,i)}if(e.protocol===`ws:`||e.protocol===`wss:`)return n(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new Li(e,t,r,i):new Ii(e,t,r,i);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Ri();var xa=class extends Yi{constructor(e,t,r){let i=new ga({encoding:`utf8`});super(i,r),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=i,this.url=new ya(e);let a={},s=fi();s?a.Authorization=`Bearer ${s}`:W(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;c&&(a[`x-environment-runner-version`]=c);let l=()=>{let e={},t=fi();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e};if(this.transport=ba(this.url,a,m(),l),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=Zn(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&q(e.endsWith(`
|
|
2
|
+
`)?e:e+`
|
|
3
|
+
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),n(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof zi))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Fi(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{mr(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Pi?e.reason:`unknown`}),J(Error(`CCRClient initialization failed: ${U(e)}`)),rn(1,`other`)}),$n(async()=>this.ccrClient?.close()),Ut((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),ke(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};_n((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),Ci((e,t)=>{this.ccrClient?.reportState(e,t)}),gi(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let u=Di().session_keepalive_interval_v2_ms;if(this.isBridge&&u>0&&(this.keepAliveTimer=setInterval(()=>{W(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{W(`[remote-io] keep_alive write failed: ${U(e)}`)})},u),this.keepAliveTimer.unref?.()),$n(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
|
|
4
|
+
`)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&q(Qi(e)+`
|
|
5
|
+
`)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};ti(),nr(),$r(),[...Zr],Xn(),Jn();var Sa=`[stdout-guard]`,Ca=!1,Q=``,wa=null;function Ta(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function Ea(){Ca||(Ca=!0,wa=process.stdout.write.bind(process.stdout),process.stdout.write=function(e,t,n){let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);Q+=r;let i,a=!0;for(;(i=Q.indexOf(`
|
|
6
|
+
`))!==-1;){let e=Q.slice(0,i);Q=Q.slice(i+1),Ta(e)?a=wa(e+`
|
|
7
|
+
`):(process.stderr.write(`${Sa} ${e}\n`),W(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},$n(async()=>{Q.length>0&&(wa&&Ta(Q)?wa(Q+`
|
|
8
|
+
`):process.stderr.write(`${Sa} ${Q}\n`),Q=``),wa&&(process.stdout.write=wa,wa=null),Ca=!1}))}tr(),ir(),dr(),Te(),re(),I(),ri(),ci(),hi(),Ne(),se(),An(),Cn(),et(),Ve(),ye(),ue(),R(),Oe(),Ze(),k(),Pe(),Ln(),qe(),kt(),Mn(),Rn(),oe(),nn(),na(),Hn(),er(),xr(),mi(),At(),Jn(),dt();function Da(e){let t=process.env.CLAUDE_CODE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(W(`Exiting after ${n}ms of idle time`),H())},n))},stop(){i&&(clearTimeout(i),i=null)}}}Lr(),oi(),M(),he(),dn(),je(),A(),Jt(),S(),z(),T(),Ni(),aa();function Oa(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:X(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(bt(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:X(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}Pr(),sn(),yn(),x(),Ei(),yt(),wn(),b(),It(),xt(),N(),bn(),Ai(),Bi(),ca(),Jn();async function ka(){try{let e=await _a(jt(),`utf-8`),t=cr().safeParse(Gn(e));return t.success?t.data:(W(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function Aa(e){await Dt(jt(),G(e,null,2))}async function ja(e,t){let n=Ft();if(!n)return;let r=await Ma(t);r!==null&&await Dt(ha(n,Yt(e)),r)}async function Ma(e){let t=[ha(e,`.claude-plugin`,`marketplace.json`),ha(e,`marketplace.json`),e];for(let e of t)try{return await _a(e,`utf-8`)}catch{}return null}async function Na(){let e=await We();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await ja(t,n.installLocation)}catch(e){W(`Failed to save marketplace JSON for ${t}: ${e}`)}await Aa({...await ka(),...e})}Er(),Xn(),Jn(),gr(),xr(),qe(),Ln();async function Pa(){let e=Pn();W(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await _e();t&&(me(),_t(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Yn().mkdir(V()),await Yn().mkdir(On()));let n=Object.keys(Se()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)W(`installPluginsForHeadless: no marketplaces declared`);else{let t=await hr(`headless_marketplace_reconcile`,()=>Zi({skip:e?(e,t)=>!ut(t):void 0,onProgress:e=>{e.type===`installed`?W(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&W(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&W(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(me(),_t(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Na();let t=await Ki();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&_t(`headlessPluginInstall: plugins changed`),e&&$n(cn),i}catch(e){return J(e),!1}finally{Y(`tengu_headless_plugin_install`,r)}}Er(),Jn(),gr(),Sn(),_i(),xr(),pr(),xn(),dt(),Xn(),Un(),p(),Ht(),Vn(),Kn(),r(),pa(),kt(),He(),fe(),mt(),er();var $=(wi(),e(di)),Fa=1e4,Ia=new Set,La=[];function Ra(e){if(Ia.has(e))return!1;if(Ia.add(e),La.push(e),La.length>Fa){let e=La.splice(0,La.length-Fa);for(let t of e)Ia.delete(t)}return!0}function za(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Ba(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
|
|
9
|
+
`):e.flatMap(za)}function Va(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Ha(e,t,r,i,a,o,s,c){if(process.env.USER_TYPE===`ant`&&n(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),te.subscribe(e=>{fn(e,r),Ur()&&r(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),$&&!$.isProactiveActive()&&n(process.env.CLAUDE_CODE_PROACTIVE)&&$.activateProactive(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),Ie(),B(`runHeadless_entry`),await Hi()&&await Vi(),B(`after_grove_check`),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
10
|
+
`),H(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
|
|
11
|
+
`),H(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
|
|
12
|
+
`),H(1);return}let l=Qa(e,c);c.outputFormat===`stream-json`&&Ea();let u=Fn.getSandboxUnavailableReason();if(u){if(Fn.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${u}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),H(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${u}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(Fn.isSandboxingEnabled())try{await Fn.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${U(e)}\n`),H(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&pe(e=>{let t=(()=>{switch(e.type){case`started`:return{type:`system`,subtype:`hook_started`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,uuid:X(),session_id:m()};case`progress`:return{type:`system`,subtype:`hook_progress`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,stdout:e.stdout,stderr:e.stderr,output:e.output,uuid:X(),session_id:m()};case`response`:return{type:`system`,subtype:`hook_response`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,output:e.output,stdout:e.stdout,stderr:e.stderr,exit_code:e.exitCode,outcome:e.outcome,uuid:X(),session_id:m()}}})();l.write(t)}),c.setupTrigger&&await j(c.setupTrigger),B(`before_loadInitialMessages`);let d=t(),{messages:p,turnInterruptionState:h,agentSetting:g}=await Za(r,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),_=$e();if(_&&l.prependUserMessage(_),!c.agent&&!f()&&g){let{agentDefinition:e}=la(g,void 0,{activeAgents:s,allAgents:s});if(e){if(r(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!vn(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}Mt(e.agentType)}}if(p.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){let e=p.find(e=>e.uuid===c.rewindFiles);if(!e||e.type!==`user`){process.stderr.write(`Error: --rewind-files requires a user message UUID, but ${c.rewindFiles} is not a user message in this session\n`),H(1);return}let n=t(),i=await qa(c.rewindFiles,n,r,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),H(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),H(0);return}let v=typeof c.resume==`string`&&(!!bt(c.resume)||c.resume.endsWith(`.jsonl`)),y=!!c.sdkUrl;if(!e&&!v&&!y){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
|
|
13
|
+
`),H(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
14
|
+
`),H(1);return}let b=hn(d.mcp.tools,d.toolPermissionContext),x=[...a,...b],S=Ga(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{r(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),yi(`requires_action`,e)});c.permissionPromptToolName&&(x=x.filter(e=>!Qr(e,c.permissionPromptToolName))),fr(),B(`after_loadInitialMessages`),await Rr(),B(`after_modelStrings`);let C=c.outputFormat===`json`&&c.verbose,ee=[],w;B(`before_runHeadlessStreaming`);for await(let e of Ua(l,d.mcp.clients,[...i,...d.mcp.commands],x,p,S,o,t,r,s,c,h))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(C&&ee.push(e),w=e);switch(c.outputFormat){case`json`:if(!w||w.type!==`result`)throw Error(`No messages returned`);if(c.verbose){q(G(ee)+`
|
|
15
|
+
`);break}q(G(w)+`
|
|
16
|
+
`);break;case`stream-json`:break;default:if(!w||w.type!==`result`)throw Error(`No messages returned`);switch(w.subtype){case`success`:q(w.result.endsWith(`
|
|
17
|
+
`)?w.result:w.result+`
|
|
18
|
+
`);break;case`error_during_execution`:q(`Execution error`);break;case`error_max_turns`:q(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:q(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:q(`Error: Failed to provide valid structured output after maximum retries.
|
|
19
|
+
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(St(),ur())try{let{drainPendingExtraction:e}=await import(`./extractMemories-BcaklA33.js`);await e()}catch{}H(w?.type===`result`&&w?.is_error?1:0)}function Ua(e,r,a,o,d,f,p,g,_,v,y,b){let x=!1,S,C=!1,T=null,E,D=e.outbound;process.on(`SIGINT`,()=>{mr(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),rn(0)}),$n(async()=>{let t={};for(let e of ce(g()))xe(e)&&(t[e.type]=(t[e.type]??0)+1);mr(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:Si(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),vi(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:X(),session_id:m()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},re;y.enableAuthStatus&&(re=Fr.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:m()})}));let ae=e=>{let t=ji(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:X(),session_id:m()})};pn.add(ae);let k=d,oe=Qe(d,Z(),100),se=si(100),ue=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;b&&b.kind!==`none`&&ue&&(W(`[print.ts] Auto-resuming interrupted turn (kind: ${b.kind})`),Xa(k,b.message),ne({mode:`prompt`,value:b.message.message.content,uuid:X()}));let fe=Vt().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?Vr():Or(t),r=En(n),i=zr(e.value),a=kr(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),pe=y.userSpecifiedModel;function me(e,t){let n=Nt(e,Jr(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:m(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let A=[],j=[],he=new Set;function _e(t){for(let n of t){if(n.type!==`connected`||he.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(Re,async(n,r)=>{yr(t,`Elicitation request received in print mode: ${G(n)}`);let i=n.params.mode===`url`?`url`:`form`;Y(`tengu_mcp_elicitation_shown`,{mode:i});let a=await tt(t,n.params,r.signal);if(a)return yr(t,`Elicitation resolved by hook: ${G(a)}`),Y(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),u=await kn(t,l,r.signal,i,c);return Y(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler(w,e=>{let{elicitationId:n}=e.params;yr(t,`Elicitation completion notification: ${n}`),Ge({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:X(),session_id:m()})}),he.add(t)}catch{}}}async function ye(){let t=new Set(Object.keys(p)),n=new Set(A.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=A.some(e=>e.type===`pending`),o=A.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of A)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Xt(p,(t,n)=>e.sendMcpMessage(t,n));A=r.clients,j=r.tools;let i=lr([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(K(t)))),...j]}})),zn(A)}}ye();let M={clients:[],tools:[],configs:{}},Se=e=>{let t=ve(e.toolPermissionContext,e.mcp.tools),n=Me(ta([...o,...j,...M.tools],t,e.toolPermissionContext.mode),`name`);y.permissionPromptToolName&&(n=n.filter(e=>!Qr(e,y.permissionPromptToolName)));let r=c();if(r&&!y.jsonSchema){let e=ii(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,Te=0;function Oe(){if(!N)return;let e=Math.min(Te,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);Te=k.length,t.length>0&&N.writeMessages(t)}let ke=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Ae(e){let t=async()=>{let t=new Set(A.map(e=>e.name)),n=await to(e,{configs:p,clients:A,tools:j},M,_);for(let e of Object.keys(p))delete p[e];if(Object.assign(p,n.newSdkState.configs),A=n.newSdkState.clients,j=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(A.map(e=>e.name)),n=lr([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(K(t)))),...j]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return ke=ke.then(t,t),ke}function je(){let e=g(),t=e.mcp.clients,n=Me([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...A.map(e=>e.name)]);return[...t,...A,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Be(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function Ne(){try{await Promise.all([Promise.resolve(),hr(`headless_managed_settings_wait`,()=>Ui())]),await Pa()&&await He()}catch(e){J(e)}}let Pe=null;i()||(n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Pe=Ne():Ne());let Fe=Da(()=>!x),P=a,I=v;async function Ve(){let{agentDefinitions:e}=await fa(_);P=await mn(Z());let t=I.filter(e=>e.source===`flagSettings`);I=[...e.allAgents,...t]}async function He(){let{servers:e}=await de(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(p))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Ae(t);r&&ye(),W(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=da.subscribe(()=>{Ke(),mn(Z()).then(e=>{P=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await ft({basePrompt:`<${_r}>${new Date().toLocaleTimeString()}</${_r}>`,currentDir:Z(),shouldCreate:()=>!C});if(C){await Rt({commands:e});return}for(let t of e)ne({...t,uuid:X()});L()})().catch(e=>{J(e),W(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};ee(()=>{E&&Ce(`now`).length>0&&E.abort(`interrupt`)});let L=async()=>{if(x)return;if(x=!0,S=void 0,yi(`running`),Fe.stop(),B(`run_entry`),await ye(),B(`after_updateSdkMcp`),Pe){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=Kr(e).then(()=>`timeout`);await Promise.race([Pe,t])===`timeout`&&(J(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),Y(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Pe;Pe=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-Ddhsyn0_.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=ze(n);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Va(r,be(n));)i.push(ze(n));let a=await it(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Ba(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(y.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:m(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),l=[...s.mcp.clients,...A,...M.clients];_e(l);let u=Se(s);for(let e of o)$t(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:m(),uuid:X()})}let d=r.value,p=a.claimedCommands;if(e instanceof xa&&r.mode===`prompt`&&Y(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&Qt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=Xe(),B(`before_ask`),Tn();let h=r,v=!1;try{if(await Yr(h.workload??y.workload,async()=>{for await(let t of ra({commands:Me([...P,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:Z(),tools:u,verbose:y.verbose,mcpClients:l,thinkingConfig:y.thinkingConfig,maxTurns:y.maxTurns,maxBudgetUsd:y.maxBudgetUsd,taskBudget:y.taskBudget,canUseTool:f,userSpecifiedModel:pe,fallbackModel:y.fallbackModel,jsonSchema:c()??y.jsonSchema,mutableMessages:k,getReadFileCache:()=>se.size===0?oe:li(oe,se),setReadFileCache:e=>{oe=e;for(let[e,t]of se.entries()){let n=oe.get(e);(!n||t.timestamp>n.timestamp)&&oe.set(e,t)}se.clear()},customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:y.replayUserMessages,includePartialMessages:y.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:I,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:m(),uuid:X()})}}))if(Oe(),t.type===`result`){v=!!t.is_error;for(let e of ui())D.enqueue(e);ce(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&xe(e))?T=t:(T=null,D.enqueue(t))}else{for(let e of ui())D.enqueue(e);D.enqueue(t)}}),v)await an({commands:p,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:Z(),priority:`later`,workload:h.workload??y.workload});else{let e=await an({commands:p,outcome:{type:`completed`},currentDir:Z(),priority:`later`,workload:h.workload??y.workload});for(let t of e)ne({...t,uuid:X()})}}catch(e){throw await an({commands:p,outcome:{type:`failed`,error:e},currentDir:Z(),priority:`later`,workload:h.workload??y.workload}),e}for(let e of o)$t(e,`completed`);if(Oe(),N?.sendResult(),y.promptSuggestions&&!t(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=Wt();if(!t)Lt(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await rt(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:X(),session_id:m()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};T?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Lt(`aborted`,void 0,void 0,`sdk`);return}J(qn(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}St(),vt(),Ie()}};do{for(let e of ui())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=ce(g()).some(e=>xe(e)),t=be(n)!==void 0;(e||t)&&(i=!0,t||(S=`waiting_for_agents`,await Kr(100)))}}while(i);T&&(D.enqueue(T),T=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:bi,modelUsage:{},permission_denials:[],uuid:X(),errors:[U(t),...br().map(e=>e.error)]})}catch{}O.abortController?.abort(),H(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Kt()){yi(`idle`);for(let e of ui())D.enqueue(e)}x=!1,Fe.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&be(n)===void 0&&!C){We();return}if(be(n)!==void 0){L();return}C&&(O.inflightPromise&&await Promise.race([O.inflightPromise,Kr(5e3)]),O.abortController?.abort(),O.abortController=null,await De(),Ue(),re?.(),pn.delete(ae),D.done())},R=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},z=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},qe=new Set;e.setUnexpectedResponseCallback(async e=>{await $a({message:e,setAppState:_,handledToolUseIds:qe,onEnqueued:()=>{L()}})});let Je=new Map,Ze=new Map,$e=new Set,et=new Map,V=null;return(async()=>{let t=!1;mr(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&$t(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,R(i);else if(o.subtype===`end_session`){W(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,R(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)p[e]={type:`sdk`,name:e};await Ka(i.request,i.request_id,t,D,a,fe,e,!!y.enableAuthStatus,y,v,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&h(!0),t=!0,Ee()&&L()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Ja(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e==="default"?Vr():e;pe=t,u(t),xi({model:t}),me(e,t),R(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?y.thinkingConfig=void 0:i.request.max_thinking_tokens===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},R(i);else if(i.request.subtype===`mcp_status`)R(i,{mcpServers:je()});else if(i.request.subtype===`get_context_usage`)try{let e=g(),t=await sa({messages:k,getAppState:g,options:{mainLoopModel:Gr(),tools:Se(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt}});R(i,{...t})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=A.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),R(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await qa(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?R(i,t):z(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid,t=ie(t=>t.uuid===e);R(i,{cancelled:t.length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=Cr(i.request.path),t=Math.floor((await va(e)).mtimeMs);if(t<=i.request.mtime){let n=await _a(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
20
|
+
`,`
|
|
21
|
+
`);se.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}R(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Ae(i.request.servers);R(i,e),t&&ye()}else if(i.request.subtype===`reload_plugins`)try{let e=await fa(_),t=I.filter(e=>e.source===`flagSettings`);I=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([mn(Z()),He(),Zt()]);r.status===`fulfilled`?P=r.value:J(r.reason),a.status===`rejected`&&J(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):J(o.reason),R(i,{commands:P.filter(e=>e.userInvocable!==!1).map(e=>({name:pt(e),description:Ye(e),argumentHint:e.argumentHint||``})),agents:I.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:je(),error_count:e.error_count})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;he.delete(t);let n=Le(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)z(i,`Server not found: ${t}`);else{let e=await ln(t,n),r=K(t);if(_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...F(n.mcp.commands,e=>Pt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:ai(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`)_e([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;he.delete(t);let a=Le(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)z(i,`Server not found: ${t}`);else if(n){ge(t,!0);let e=await ln(t,a),n=K(t);if(_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...F(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...F(r.mcp.commands,e=>Pt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:ai(r.mcp.resources,t)}})),e.client.type===`connected`)_e([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}else{ge(t,!1);let n=[...r,...A,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await zt(t,a);let o=K(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:F(e.mcp.tools,e=>e.name?.startsWith(o)),commands:F(e.mcp.commands,e=>Pt(e,t)),resources:ai(e.mcp.resources,t)}})),R(i)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=Le(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Je.get(e)?.abort();let t=new AbortController;Je.set(e,t);let r,a=new Promise(e=>{r=e}),o=Ct(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{Ze.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?R(i,{authUrl:s,requiresUserAction:!0}):R(i,{requiresUserAction:!1}),et.set(e,o),o.then(async()=>{if(le(e)||$e.has(e))return;let t=await ln(e,n),r=K(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...F(n.mcp.commands,t=>Pt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ai(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{W(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Je.get(e)===t&&(Je.delete(e),Ze.delete(e),$e.delete(e),et.delete(e))})}catch(e){z(i,U(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=Ze.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)z(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{$e.add(e),n(t);let r=et.get(e);if(r)try{await r,R(i)}catch(e){z(i,e instanceof Error?e.message:`OAuth authentication failed`)}else R(i)}}else z(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;V?.service.cleanup(),Y(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Wi,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Gi(t),Y(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),V?.service===t&&(V=null)});V={service:t,flow:a},a.catch(e=>W(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);R(i,{manualUrl:e,automaticUrl:t})}catch(e){z(i,U(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!V)z(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&V.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=V;e.then(()=>{let e=Ir();R(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:Ar()}})},e=>z(i,U(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=Le(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Cannot clear auth for server type "${n.type}"`);else{await en(e,n);let t=await ln(e,n),r=K(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...F(n.mcp.commands,t=>Pt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ai(n.mcp.resources,e)}})),R(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=Gr(),t=s()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];l(r),te.notifyChange(`flagSettings`),`model`in n&&(n.model==null?u(void 0):u(String(n.model)));let a=Gr();if(a!==e){pe=a;let e=n.model?String(n.model):`default`;xi({model:a}),me(e,a)}R(i)}else if(i.request.subtype===`get_settings`){let e=Gr();R(i,{...ar(),applied:{model:e}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await qt(e,{getAppState:g,setAppState:_}),R(i,{})}catch(e){z(i,U(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:Xe()).signal;(async()=>{try{let r=await Mi(e,n);if(r&&t)try{nt(m(),r)}catch(e){J(e)}R(i,{title:r})}catch(e){z(i,U(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=Wt(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:Xe()}}:await ia({tools:Se(g()),commands:P,mcpClients:[...g().mcp.clients,...A,...M.clients],messages:k,readFileState:oe,getAppState:g,setAppState:_,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,thinkingConfig:y.thinkingConfig,agents:I}),r=await oa({question:e,cacheSafeParams:n});R(i,{response:r.response})}catch(e){z(i,U(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),R(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)R(i,{session_url:we(N.bridgeSessionId,N.sessionIngressUrl),connect_url:st(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-JQ-afRx9.js`),r=await n({onInboundMessage(e){let t=$i(e);if(!t)return;let{content:n,uuid:r}=t;ne({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),L()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e==="default"?Vr():e;pe=t,u(t)},onSetMaxThinkingTokens(e){e===null?y.thinkingConfig=void 0:e===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),W(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:X(),session_id:m()})},initialMessages:k.length>0?k:void 0});r?(N=r,Te=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),R(i,{session_url:we(r.bridgeSessionId,r.sessionIngressUrl),connect_url:st(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):z(i,t??`Remote Control initialization failed`)}catch(e){z(i,U(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),R(i);else z(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){y.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=ki([n]);k.push(...e),n.type===`assistant`&&y.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=m(),t=await Bt(e,o.uuid);if(t||Ia.has(o.uuid)){W(`Skipping duplicate user message: ${o.uuid}`),y.replayUserMessages&&(W(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&$t(o.uuid,`completed`);continue}Ra(o.uuid)}ne({mode:`prompt`,value:await Oi(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:Ti(e.attribution,e=>{wt(e).catch(e=>{W(`Attribution: Failed to save snapshot: ${e}`)})})})),L()}C=!0,x||(O.inflightPromise&&await Promise.race([O.inflightPromise,Kr(5e3)]),O.abortController?.abort(),O.abortController=null,await De(),Ue(),re?.(),pn.delete(ae),D.done())})(),D}function Wa(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Je(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=E(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Xi(ea().parse(Tr(h.content[0].text)),e,r,i)};return t}function Ga(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Je(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Qr(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),H(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),H(1),Error(t)}i=Wa(r)}return i(t,r,a,o,s,c)}}async function Ka(e,t,n,r,i,a,o,s,c,l,p){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Et(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=f()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(d(t.agentType),!c.systemPrompt&&!vn(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&u(Or(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let h=or()?.outputStyle||`default`,v=await ot(Wn()),y=Ir();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});_(t)}e.jsonSchema&&g(e.jsonSchema);let b={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:pt(e),description:Ye(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:h,available_output_styles:Object.keys(v),models:a,account:{email:y?.email,organization:y?.organization,subscriptionType:y?.subscription,tokenSource:y?.tokenSource,apiKeySource:y?.apiKeySource,apiProvider:Ar()},pid:process.pid};if(Ur()&&Wr()){let e=p();b.fast_mode_state=jr(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:b}}),s){let e=Fr.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:m()})}}async function qa(e,t,n,r){if(!In())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Dn(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await lt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await jn(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${U(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Ja(e,t,n,r){if(e.mode===`bypassPermissions`){if(D())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!O()){let e=Nn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${ct(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Ae(n.mode,e.mode,n),mode:e.mode}}function Ya(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:bi,modelUsage:{},permission_denials:[],uuid:X(),errors:[e]};process.stdout.write(G(t)+`
|
|
22
|
+
`)}else process.stderr.write(e+`
|
|
23
|
+
`)}function Xa(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function Za(e,t){let r=!v();if(t.continue)try{Y(`tengu_continue_print`,{});let n=await L(void 0,void 0);if(n)return t.forkSession||n.sessionId&&(y(P(n.sessionId),n.fullPath?ma(n.fullPath):null),r&&await Ot()),ua(n,e),un(t.forkSession?{...n,worktreeSession:void 0}:n),{messages:n.messages,turnInterruptionState:n.turnInterruptionState,agentSetting:n.agentSetting}}catch(e){return J(e),H(1),{messages:[]}}if(t.teleport)try{if(!Ue(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(Y(`tengu_teleport_print`,{}),typeof t.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:n,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-dtqQXM4x.js`);await i();let a=await r(t.teleport),{branchError:o}=await e(a.branch);return{messages:n(a.log,o)}}catch(e){return J(e),H(1),{messages:[]}}if(t.resume)try{Y(`tengu_resume_print`,{});let i=Oa(typeof t.resume==`string`?t.resume:``);if(!i){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof t.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${t.resume}" is not a valid UUID`),Ya(e,t.outputFormat),H(1),{messages:[]}}if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,n]=await Promise.all([Gt(i.sessionId),t.restoredWorkerState]);n&&(e(qi(n)),typeof n.model==`string`&&u(n.model))}else i.isUrl&&i.ingressUrl&&n(process.env.ENABLE_SESSION_PERSISTENCE)&&await C(i.sessionId,i.ingressUrl);let a=await L(i.sessionId,i.jsonlFile||void 0);if(!a||a.messages.length===0)return i.isUrl||n(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(t.sessionStartHooksPromise??gn(`startup`))}:(Ya(`No conversation found with session ID: ${i.sessionId}`,t.outputFormat),H(1),{messages:[]});if(t.resumeSessionAt){let e=a.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return Ya(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),H(1),{messages:[]};a.messages=e>=0?a.messages.slice(0,e+1):[]}return!t.forkSession&&a.sessionId&&(y(P(a.sessionId),a.fullPath?ma(a.fullPath):null),r&&await Ot()),ua(a,e),un(t.forkSession?{...a,worktreeSession:void 0}:a),{messages:a.messages,turnInterruptionState:a.turnInterruptionState,agentSetting:a.agentSetting}}catch(e){return J(e),Ya(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),H(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??gn(`startup`))}}function Qa(e,t){let n;return n=typeof e==`string`?e.trim()===``?Tt([]):Tt([G({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new xa(t.sdkUrl,n,t.replayUserMessages):new Yi(n,t.replayUserMessages)}async function $a({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(W(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return W(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await gt(t);return a?(r.add(t),W(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),ne({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(W(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function eo(e){return{...e,scope:`dynamic`}}async function to(e,t,n,r){let{allowed:i,blocked:a}=ae(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await no(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function no(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i||!tn(r,eo(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){J(e)}await zt(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=eo(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await at(t,r);if(d.push(e),e.type===`connected`){let t=await ht(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=qn(e);u[t]=n.message,J(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=eo(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Ha as runHeadless};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,r as i}from"./analytics-BotDBGh0.js";import{a,i as o,o as s,r as c}from"./grove-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,r as i}from"./analytics-BotDBGh0.js";import{a,i as o,o as s,r as c}from"./grove-CpqjcGCb.js";import{n as l,r as u,t as d}from"./Grove-BJziCbZH.js";async function f(e){if(!await s())return e(m),null;let[t,n]=await Promise.all([o(),c()]);if(!t.success)return e(m),null;let r=t.data,a=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await o();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:a?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),a(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,fi as n,t as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Ap as a,BC as o,Gg as s,Hp as c,Jm as l,So as u,VC as d,Vp as f,Wg as p,Ym as m,Yo as h,_u as g,kp as _,vo as v,vu as y,xo as b,zo as x}from"./loadAgentsDir-D206qwP3.js";import{F as S,j as C,z as w}from"./debug-BrXObCdR.js";import{g as T,n as E}from"./settings-BovzmwMP.js";import{n as D,r as O}from"./analytics-BotDBGh0.js";import{Ot as k,kt as A}from"./prompt-BNHtszmZ.js";import{randomUUID as j}from"crypto";n(),r(),y(),m(),c();var M=i();function N({input:e,progress:n,verbose:r}){return(0,M.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(l,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),n?(0,M.jsx)(f,{fullOutput:n.fullOutput,output:n.output,elapsedTimeSeconds:n.elapsedTimeSeconds,totalLines:n.totalLines,verbose:r}):g.renderToolUseProgressMessage?.([],{verbose:r,tools:[],terminalSize:void 0})]})}w(),D(),p(),x(),T();function P(){return E().defaultShell??`bash`}y(),k(),d();async function F(t,n,r,i,c){let l=A()&&P()===`powershell`;O(`tengu_input_bash`,{powershell:l});let d=u({content:h({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),f;c({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{f=e?.jsx}},p=e=>{c({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),f]}),shouldHidePromptInput:!1,showSpinner:!1})},m=null;l&&(m=(a(),e(_)).PowerShellTool);let h=m??g,y=(m?await m.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,p):await g.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,p)).data;if(!y)throw Error(`No result received from shell command`);let b=y.stderr,x=await s(h,{...y,stderr:``},j()),S=typeof x.content==`string`?x.content:o(y.stdout);return{messages:[v(),d,...r,u({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${o(b)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof C?e.interrupted?{messages:[v(),d,b({toolUse:!1}),...r],shouldQuery:!1}:{messages:[v(),d,...r,u({content:`<bash-stdout>${o(e.stdout)}</bash-stdout><bash-stderr>${o(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[v(),d,...r,u({content:`<bash-stderr>Command failed: ${o(S(e))}</bash-stderr>`})],shouldQuery:!1}}finally{c(null)}}export{F as processBashCommand};
|