@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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import{l as e,o as t,u as n}from"./envUtils-DSxRz_kt.js";import{Gr as r,di as i,t as a,ui as o}from"./src-CDCSSo0U2.js";import{Aa as s,Et as c,Fa as l,Ma as u,NC as d,Na as f,PC as p,Pa as m,ax as h,dx as g,ix as _,ja as v,jt as y,lx as b,nx as ee,ox as x,sx as S,ux as C,vt as w}from"./loadAgentsDir-D206qwP3.js";import{C as T,F as E,S as D,a as O,l as k,w as A,z as j}from"./debug-BrXObCdR.js";import{Gt as M,Kt as N,Wt as te}from"./settings-BovzmwMP.js";import{M as P,j as F}from"./git-Do0wJvux.js";import{o as I,s as L}from"./log-BMCygSzM.js";import{i as R,n as z,r as B}from"./analytics-BotDBGh0.js";import{T as V,b as H,u as U}from"./startupProfiler-xa3NmN7Z.js";import{_n as W,vn as G}from"./model-CKkOnnnx.js";import{n as K,t as q}from"./rcDebugLog-CUy1_F23.js";import{c as J,d as ne,f as re,n as Y,o as X,r as ie}from"./debugUtils-NO5KtXqi.js";import{n as ae,s as oe}from"./firstPartyEventLogger-CoSUd0a1.js";import{n as se,t as ce}from"./datadog-CpqEQbHa.js";import{a as le,t as ue}from"./types-Bh9S_JG5.js";import{i as de,n as Z,r as Q}from"./cliLaunch-BkPAatcs.js";import{t as $}from"./lib-BlVGipXx.js";import{t as fe}from"./capacityWake-CV_x9H8j.js";import{t as pe}from"./jwtUtils-DE2GPUcx.js";import{t as me}from"./pollConfig-DH2oCtFS.js";import{i as he}from"./trustedDevice-BTYoQCkC.js";import{a as ge,i as _e,n as ve,r as ye,t as be}from"./workSecret-CNWiR2uQ.js";import{hostname as xe,tmpdir as Se}from"os";import{basename as Ce,dirname as we,join as Te,resolve as Ee}from"path";import{createWriteStream as De}from"fs";import{randomUUID as Oe}from"crypto";import{spawn as ke}from"child_process";import{createInterface as Ae}from"readline";t(),j(),D(),F(),I(),z(),H(),W(),p(),ce(),ae(),X(),q(),le(),u(),c(),de(),i();var je=$();N(),a(),O(),b();var Me={type:`utf8`,errorCorrectionLevel:`L`,small:!0};async function Ne(e){return(await(0,je.toString)(e,Me)).split(`
|
|
2
|
+
`).filter(e=>e.length>0)}function Pe(e){let t=e.write??(e=>process.stdout.write(e)),n=e.verbose,i=0,a=`idle`,s=`Ready`,c=``,l=``,u=``,d=``,f=``,p=``,m=null,v=[],y=!1,b=null,w=0,T=0,E=1,D=null,O=`single-session`,A=new Map,j=null,N=0;function P(e){let t=process.stdout.columns||80,n=0;for(let i of e.split(`
|
|
3
|
+
`)){if(i.length===0){n++;continue}let e=r(i);n+=Math.max(1,Math.ceil(e/t))}return e.endsWith(`
|
|
4
|
+
`)&&n--,n}function F(e){t(e),i+=P(e)}function I(){i<=0||(k(`[bridge:ui] clearStatusLines count=${i}`),t(`\x1b[${i}A`),t(`\x1B[J`),i=0)}function L(e){I(),t(e)}function R(e){Ne(e).then(e=>{v=e,W()}).catch(e=>{k(`QR code generation failed: ${e}`,{level:`error`})})}function z(){I();let e=M[N%M.length],t=``;c&&(t+=o.dim(` · `)+o.dim(c)),l&&(t+=o.dim(` · `)+o.dim(l)),F(`${o.yellow(e)} ${o.yellow(`Connecting`)}${t}\n`)}function B(){H(),z(),j=setInterval(()=>{N++,z()},150)}function H(){j&&(clearInterval(j),j=null)}function W(){if(a===`reconnecting`||a===`failed`)return;I();let e=a===`idle`;if(y)for(let e of v)F(`${o.dim(e)}\n`);let t=te,n=e?o.green:o.cyan,r=(e?o.green:o.cyan)(s),i=``;if(c&&(i+=o.dim(` · `)+o.dim(c)),l&&O!==`worktree`&&(i+=o.dim(` · `)+o.dim(l)),process.env.USER_TYPE===`ant`&&u&&F(`${o.yellow(`[ANT-ONLY] Logs:`)} ${o.dim(u)}\n`),F(`${n(t)} ${r}${i}\n`),E>1){let e=O===`worktree`?`New sessions will be created in an isolated worktree`:`New sessions will be created in the current directory`;F(` ${o.dim(`Capacity: ${T}/${E} \u00b7 ${e}`)}\n`);for(let[,e]of A){let t=g(e.title?V(e.title,35):o.dim(`Attached`),e.url),n=e.activity;F(` ${t}${n&&n.type!==`result`&&n.type!==`error`?o.dim(` ${V(n.summary,40)}`):``}
|
|
5
|
+
`)}}if(E===1){let e=O===`single-session`?`Single session · exits when complete`:O===`worktree`?`Capacity: ${T}/1 \u00b7 New sessions will be created in an isolated worktree`:`Capacity: ${T}/1 \u00b7 New sessions will be created in the current directory`;F(` ${o.dim(e)}\n`)}E===1&&!e&&b&&Date.now()-w<3e4&&F(` ${o.dim(V(b,60))}\n`);let f=m??d;if(f){F(`
|
|
6
|
+
`);let t=e?S(f):_(f),n=y?o.dim.italic(`space to hide QR code`):o.dim.italic(`space to show QR code`),r=D?o.dim.italic(` · w to toggle spawn mode`):``;F(`${o.dim(t)}\n`),F(`${n}${r}\n`)}}return{printBanner(e,r){f=e.sessionIngressUrl,p=r,d=h(r,f),R(d),n&&t(o.dim(`Remote Control`)+` v0.0.6
|
|
7
|
+
`),n&&(e.spawnMode!==`single-session`&&(t(o.dim(`Spawn mode: `)+`${e.spawnMode}\n`),t(o.dim(`Max concurrent sessions: `)+`${e.maxSessions}\n`)),t(o.dim(`Environment ID: `)+`${r}\n`)),e.sandbox&&t(o.dim(`Sandbox: `)+`${o.green(`Enabled`)}\n`),t(`
|
|
8
|
+
`),B()},logSessionStart(e,t){if(n){let n=V(t,80);L(o.dim(`[${C()}]`)+` Session started: ${o.white(`"${n}"`)} (${o.dim(e)})\n`)}},logSessionComplete(e,t){L(o.dim(`[${C()}]`)+` Session ${o.green(`completed`)} (${U(t)}) ${o.dim(e)}\n`)},logSessionFailed(e,t){L(o.dim(`[${C()}]`)+` Session ${o.red(`failed`)}: ${t} ${o.dim(e)}\n`)},logStatus(e){L(o.dim(`[${C()}]`)+` ${e}\n`)},logVerbose(e){n&&L(o.dim(`[${C()}] ${e}`)+`
|
|
9
|
+
`)},logError(e){L(o.red(`[${C()}] Error: ${e}`)+`
|
|
10
|
+
`)},logReconnected(e){L(o.dim(`[${C()}]`)+` ${o.green(`Reconnected`)} after ${U(e)}\n`)},setRepoInfo(e,t){c=e,l=t},setDebugLogPath(e){u=e},updateIdleStatus(){H(),a=`idle`,s=`Ready`,b=null,w=0,m=null,R(d),W()},setAttached(e){H(),a=`attached`,s=`Connected`,b=null,w=0,E<=1&&(m=x(e,p,f),R(m)),W()},updateReconnectingStatus(e,t){if(H(),I(),a=`reconnecting`,y)for(let e of v)F(`${o.dim(e)}\n`);let n=M[N%M.length];N++,F(`${o.yellow(n)} ${o.yellow(`Reconnecting`)} ${o.dim(`·`)} ${o.dim(`retrying in ${e}`)} ${o.dim(`·`)} ${o.dim(`disconnected ${t}`)}\n`)},updateFailedStatus(e){H(),I(),a=`failed`;let t=``;c&&(t+=o.dim(` · `)+o.dim(c)),l&&(t+=o.dim(` · `)+o.dim(l)),F(`${o.red(`×`)} ${o.red(`Remote Control Failed`)}${t}\n`),F(`${o.dim(ee)}\n`),e&&F(`${o.red(e)}\n`)},updateSessionStatus(e,t,n,r){n.type===`tool_start`&&(b=n.summary,w=Date.now()),W()},clearStatus(){H(),I()},toggleQr(){y=!y,W()},updateSessionCount(e,t,n){T===e&&E===t&&O===n||(T=e,E=t,O=n)},setSpawnModeDisplay(e){D!==e&&(D=e,e&&(O=e))},addSession(e,t){A.set(e,{url:t})},updateSessionActivity(e,t){let n=A.get(e);n&&(n.activity=t)},setSessionTitle(e,t){let n=A.get(e);n&&(n.title=t,!(a===`reconnecting`||a===`failed`)&&(E===1&&(a=`titled`,s=V(t,40)),W()))},removeSession(e){A.delete(e)},refreshDisplay(){a===`reconnecting`||a===`failed`||W()}}}J();var Fe=10,Ie=10;function Le(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`)}var Re={Read:`Reading`,Write:`Writing`,Edit:`Editing`,MultiEdit:`Editing`,Bash:`Running`,Glob:`Searching`,Grep:`Searching`,WebFetch:`Fetching`,WebSearch:`Searching`,Task:`Running task`,FileReadTool:`Reading`,FileWriteTool:`Writing`,FileEditTool:`Editing`,GlobTool:`Searching`,GrepTool:`Searching`,BashTool:`Running`,NotebookEditTool:`Editing notebook`,LSP:`LSP`};function ze(e,t){let n=Re[e]??e,r=t.file_path??t.filePath??t.pattern??t.command?.slice(0,60)??t.url??t.query??``;return r?`${n} ${r}`:n}function Be(e,t,n){let r;try{r=T(e)}catch{return[]}if(!r||typeof r!=`object`)return[];let i=r,a=[],o=Date.now();switch(i.type){case`assistant`:{let e=i.message;if(!e)break;let r=e.content;if(!Array.isArray(r))break;for(let e of r){if(!e||typeof e!=`object`)continue;let r=e;if(r.type===`tool_use`){let e=r.name??`Tool`,i=r.input??{},s=ze(e,i);a.push({type:`tool_start`,summary:s,timestamp:o}),n(`[bridge:activity] sessionId=${t} tool_use name=${e} ${He(i)}`)}else if(r.type===`text`){let e=r.text??``;e.length>0&&(a.push({type:`text`,summary:e.slice(0,80),timestamp:o}),n(`[bridge:activity] sessionId=${t} text "${e.slice(0,100)}"`))}}break}case`result`:{let e=i.subtype;if(e===`success`)a.push({type:`result`,summary:`Session completed`,timestamp:o}),n(`[bridge:activity] sessionId=${t} result subtype=success`);else if(e){let r=i.errors?.[0]??`Error: ${e}`;a.push({type:`error`,summary:r,timestamp:o}),n(`[bridge:activity] sessionId=${t} result subtype=${e} error="${r}"`)}else n(`[bridge:activity] sessionId=${t} result subtype=undefined`);break}default:break}return a}function Ve(e){if(e.parent_tool_use_id!=null||e.isSynthetic||e.isReplay)return;let t=e.message?.content,n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let e of t)if(e&&typeof e==`object`&&e.type===`text`){n=e.text;break}}return n=n?.trim(),n||void 0}function He(e){let t=[];for(let[n,r]of Object.entries(e))if(typeof r==`string`&&t.push(`${n}="${r.slice(0,100)}"`),t.length>=3)break;return t.join(` `)}function Ue(e){return{spawn(t,n){let r=Le(t.sessionId),i;if(e.debugFile){let t=e.debugFile.lastIndexOf(`.`);i=t>0?`${e.debugFile.slice(0,t)}-${r}${e.debugFile.slice(t)}`:`${e.debugFile}-${r}`}else(e.verbose||process.env.USER_TYPE===`ant`)&&(i=Te(Se(),`claude`,`bridge-session-${r}.log`));let a=null,o;e.debugFile&&(o=Te(we(e.debugFile),`bridge-transcript-${r}.jsonl`),a=De(o,{flags:`a`}),a.on(`error`,t=>{e.onDebug(`[bridge:session] Transcript write error: ${t.message}`),a=null}),e.onDebug(`[bridge:session] Transcript log: ${o}`));let s=[...e.scriptArgs,`--print`,`--sdk-url`,t.sdkUrl,`--session-id`,t.sessionId,`--input-format`,`stream-json`,`--output-format`,`stream-json`,`--replay-user-messages`,...e.verbose?[`--verbose`]:[],...i?[`--debug-file`,i]:[],...e.permissionMode?[`--permission-mode`,e.permissionMode]:[]],c={...e.env,CLAUDE_CODE_OAUTH_TOKEN:void 0,CLAUDE_CODE_ENVIRONMENT_KIND:`bridge`,...e.sandbox&&{CLAUDE_CODE_FORCE_SANDBOX:`1`},CLAUDE_CODE_SESSION_ACCESS_TOKEN:t.accessToken,CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2:`1`,...t.useCcrV2&&{CLAUDE_CODE_USE_CCR_V2:`1`,CLAUDE_CODE_WORKER_EPOCH:String(t.workerEpoch)}};e.onDebug(`[bridge:session] Spawning sessionId=${t.sessionId} sdkUrl=${t.sdkUrl} accessToken=${t.accessToken?`present`:`MISSING`}`),e.onDebug(`[bridge:session] Child args: ${s.join(` `)}`),i&&e.onDebug(`[bridge:session] Debug log: ${i}`);let l=ke(e.execPath,s,{cwd:n,stdio:[`pipe`,`pipe`,`pipe`],env:c,windowsHide:!0});e.onDebug(`[bridge:session] sessionId=${t.sessionId} pid=${l.pid}`);let u=[],d=null,f=[],p=!1,m=!1;l.stderr&&Ae({input:l.stderr}).on(`line`,t=>{e.verbose&&process.stderr.write(t+`
|
|
11
|
+
`),f.length>=Ie&&f.shift(),f.push(t)}),l.stdout&&Ae({input:l.stdout}).on(`line`,n=>{a&&a.write(n+`
|
|
12
|
+
`),e.onDebug(`[bridge:ws] sessionId=${t.sessionId} <<< ${Y(n)}`),e.verbose&&process.stderr.write(n+`
|
|
13
|
+
`);let r=Be(n,t.sessionId,e.onDebug);for(let n of r)u.length>=Fe&&u.shift(),u.push(n),d=n,e.onActivity?.(t.sessionId,n);{let r;try{r=T(n)}catch{}if(r&&typeof r==`object`){let n=r;if(n.type===`control_request`)n.request?.subtype===`can_use_tool`&&e.onPermissionRequest&&e.onPermissionRequest(t.sessionId,r,t.accessToken);else if(n.type===`user`&&!m&&t.onFirstUserMessage){let e=Ve(n);e&&(m=!0,t.onFirstUserMessage(e))}}}});let h=new Promise(n=>{l.on(`close`,(r,i)=>{a&&(a.end(),a=null),i===`SIGTERM`||i===`SIGINT`?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} interrupted signal=${i} pid=${l.pid}`),n(`interrupted`)):r===0?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} completed exit_code=0 pid=${l.pid}`),n(`completed`)):(e.onDebug(`[bridge:session] sessionId=${t.sessionId} failed exit_code=${r} pid=${l.pid}`),n(`failed`))}),l.on(`error`,r=>{e.onDebug(`[bridge:session] sessionId=${t.sessionId} spawn error: ${r.message}`),n(`failed`)})}),g={sessionId:t.sessionId,done:h,activities:u,accessToken:t.accessToken,lastStderr:f,get currentActivity(){return d},kill(){l.killed||(e.onDebug(`[bridge:session] Sending SIGTERM to sessionId=${t.sessionId} pid=${l.pid}`),process.platform===`win32`?l.kill():l.kill(`SIGTERM`))},forceKill(){!p&&l.pid&&(p=!0,e.onDebug(`[bridge:session] Sending SIGKILL to sessionId=${t.sessionId} pid=${l.pid}`),process.platform===`win32`?l.kill():l.kill(`SIGKILL`))},writeStdin(n){l.stdin&&!l.stdin.destroyed&&(e.onDebug(`[bridge:ws] sessionId=${t.sessionId} >>> ${Y(n)}`),l.stdin.write(n))},updateAccessToken(n){g.accessToken=n,g.writeStdin(A({type:`update_environment_variables`,variables:{CLAUDE_CODE_SESSION_ACCESS_TOKEN:n}})+`
|
|
14
|
+
`),e.onDebug(`[bridge:session] Sent token refresh via stdin for sessionId=${t.sessionId}`)}};return g}}}O(),b(),X();var We={connInitialMs:2e3,connCapMs:12e4,connGiveUpMs:6e5,generalInitialMs:500,generalCapMs:3e4,generalGiveUpMs:6e5},Ge=1e3,Ke=32;async function qe(){return!1}function Je(e){return e.connCapMs*2}function Ye(){let e=[...Z()],t=Q();return t&&e.push(t),e}function Xe(e,t,n){try{return e.spawn(t,n)}catch(e){let t=E(e);return L(Error(`Session spawn failed: ${t}`)),t}}async function Ze(t,r,i,a,o,c,u,p=We,h,g){let _=new AbortController;u.aborted?_.abort():u.addEventListener(`abort`,()=>_.abort(),{once:!0});let v=_.signal,b=new Map,ee=new Map,x=new Map,S=new Map,C=new Map,T=new Map,D=new Set,O=new Map,A=new Set,j=new Set,M=fe(v);async function N(){K(`heartbeat: checking ${b.size} active session(s)`);let e=!1,t=!1,n=[];for(let[i]of b){let o=x.get(i),c=C.get(i);if(!(!o||!c))try{await a.heartbeatWork(r,o,c),e=!0}catch(e){k(`[bridge:heartbeat] Failed for sessionId=${i} workId=${o}: ${E(e)}`),e instanceof s&&(B(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),e.status===401||e.status===403?n.push(i):t=!0)}}for(let e of n){c.logVerbose(`Session ${e} token expired — re-queuing via bridge/reconnect`);try{await a.reconnectSession(r,e),k(`[bridge:heartbeat] Re-queued sessionId=${e} via bridge/reconnect`)}catch(t){c.logError(`Failed to refresh session ${e} token: ${E(t)}`),k(`[bridge:heartbeat] reconnectSession(${e}) failed: ${E(t)}`,{level:`error`})}}return t?`fatal`:n.length>0?`auth_failed`:e?`ok`:`failed`}let te=new Set,F=g?pe({getAccessToken:g,onRefresh:(e,t)=>{let n=b.get(e);n&&(te.has(e)?(c.logVerbose(`Refreshing session ${e} token via bridge/reconnect`),a.reconnectSession(r,e).catch(t=>{c.logError(`Failed to refresh session ${e} token: ${E(t)}`),k(`[bridge:token] reconnectSession(${e}) failed: ${E(t)}`,{level:`error`})})):n.updateAccessToken(t))},label:`bridge`}):null,I=Date.now(),R=new Set;function z(e){R.add(e),e.finally(()=>R.delete(e))}let V=0,H=0,W=null,q=null,J=null,re=null,Y=!1;if(k(`[bridge:work] Starting poll loop spawnMode=${t.spawnMode} maxSessions=${t.maxSessions} environmentId=${r}`),P(`info`,`bridge_loop_started`,{max_sessions:t.maxSessions,spawn_mode:t.spawnMode}),process.env.USER_TYPE===`ant`){let e;if(t.debugFile){let n=t.debugFile.lastIndexOf(`.`);e=n>0?`${t.debugFile.slice(0,n)}-*${t.debugFile.slice(n)}`:`${t.debugFile}-*`}else e=Te(Se(),`claude`,`bridge-session-*.log`);c.setDebugLogPath(e)}c.printBanner(t,r),c.updateSessionCount(0,t.maxSessions,t.spawnMode),h&&c.setAttached(h);function X(){c.updateSessionCount(b.size,t.maxSessions,t.spawnMode);for(let[e,t]of b){let n=t.currentActivity;n&&c.updateSessionActivity(S.get(e)??e,n)}if(b.size===0){c.updateIdleStatus();return}let[e,n]=[...b.entries()].pop(),r=ee.get(e);if(!r)return;let i=n.currentActivity;if(!i||i.type===`result`||i.type===`error`){t.maxSessions>1&&c.refreshDisplay();return}let a=U(Date.now()-r),o=n.activities.filter(e=>e.type===`tool_start`).slice(-5).map(e=>e.summary);c.updateSessionStatus(e,a,i,o)}function ae(){oe(),X(),re=setInterval(X,Ge)}function oe(){re&&(clearInterval(re),re=null)}function se(e,n,i){return o=>{let s=x.get(e);K(`session done: sessionId=${e} workId=${s??`none`} status=${o} wasTimedOut=${A.has(e)} duration=${Math.round((Date.now()-n)/1e3)}s stderr=${i.lastStderr.length>0?i.lastStderr.join(`\\n`).slice(0,500):`(none)`}`),b.delete(e),ee.delete(e),x.delete(e),C.delete(e);let l=S.get(e)??e;S.delete(e),c.removeSession(l),j.delete(l),te.delete(e);let u=T.get(e);u&&(clearTimeout(u),T.delete(e)),F?.cancel(e),M.wake();let d=A.delete(e),f=d&&o===`interrupted`?`failed`:o,m=Date.now()-n;k(`[bridge:session] sessionId=${e} workId=${s??`unknown`} exited status=${f} duration=${U(m)}`),B(`tengu_bridge_session_done`,{status:f,duration_ms:m}),P(`info`,`bridge_session_done`,{status:f,duration_ms:m}),c.clearStatus(),oe();let h=i.lastStderr.length>0?i.lastStderr.join(`
|
|
15
|
+
`):void 0,g;switch(f){case`completed`:c.logSessionComplete(e,m);break;case`failed`:!d&&!v.aborted&&(g=h??`Process exited with error`,c.logSessionFailed(e,g),L(Error(`Bridge session failed: ${g}`)));break;case`interrupted`:c.logVerbose(`Session ${e} interrupted`);break}f!==`interrupted`&&s&&(z(rt(a,r,s,c,p.stopWorkBaseDelayMs)),D.add(s));let w=O.get(e);if(w&&(O.delete(e),z(y(w.worktreePath,w.worktreeBranch,w.gitRoot,w.hookBased).catch(e=>c.logVerbose(`Failed to remove worktree ${w.worktreePath}: ${E(e)}`)))),f!==`interrupted`&&!v.aborted)if(t.spawnMode!==`single-session`)z(a.archiveSession(l).catch(t=>c.logVerbose(`Failed to archive session ${e}: ${E(t)}`))),k(`[bridge:session] Session ${f}, returning to idle (multi-session mode)`);else{k(`[bridge:session] Session ${f}, aborting poll loop to tear down environment`),_.abort();return}v.aborted||ae()}}for(h||ae();!v.aborted;){let u=me();try{K(`poll: envId=${r} activeSessions=${b.size}`);let s=await a.pollForWork(r,i,v,u.reclaim_older_than_ms);if(W!==null||q!==null){let e=Date.now()-(W??q??Date.now());c.logReconnected(e),k(`[bridge:poll] Reconnected after ${U(e)}`),B(`tengu_bridge_reconnected`,{disconnected_ms:e})}if(V=0,H=0,W=null,q=null,J=null,!s){if(b.size>=t.maxSessions){let e=u.multisession_poll_interval_ms_at_capacity;if(u.non_exclusive_heartbeat_interval_ms>0){B(`tengu_bridge_heartbeat_mode_entered`,{active_sessions:b.size,heartbeat_interval_ms:u.non_exclusive_heartbeat_interval_ms});let n=e>0?Date.now()+e:null,r=`ok`,i=0;for(;!v.aborted&&b.size>=t.maxSessions&&(n===null||Date.now()<n);){let e=me();if(e.non_exclusive_heartbeat_interval_ms<=0)break;let t=M.signal();if(r=await N(),r===`auth_failed`||r===`fatal`){t.cleanup();break}i++,await G(e.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}let a=r===`auth_failed`||r===`fatal`?r:v.aborted?`shutdown`:b.size<t.maxSessions?`capacity_changed`:n!==null&&Date.now()>=n?`poll_due`:`config_disabled`;if(B(`tengu_bridge_heartbeat_mode_exited`,{reason:a,heartbeat_cycles:i,active_sessions:b.size}),a===`poll_due`&&k(`[bridge:poll] Heartbeat poll_due after ${i} cycles — falling through to pollForWork`),r===`auth_failed`||r===`fatal`){let t=M.signal();await G(e>0?e:u.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}}else if(e>0){let t=M.signal();await G(e,t.signal),t.cleanup()}}else await G(b.size>0?u.multisession_poll_interval_ms_partial_capacity:u.multisession_poll_interval_ms_not_at_capacity,v);continue}let f=b.size>=t.maxSessions;if(D.has(s.id)){if(k(`[bridge:work] Skipping already-completed workId=${s.id}`),f){let e=M.signal();u.non_exclusive_heartbeat_interval_ms>0?(await N(),await G(u.non_exclusive_heartbeat_interval_ms,e.signal)):u.multisession_poll_interval_ms_at_capacity>0&&await G(u.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}else await G(1e3,v);continue}let m;try{m=ye(s.secret)}catch(e){let t=E(e);if(c.logError(`Failed to decode work secret for workId=${s.id}: ${t}`),B(`tengu_bridge_work_secret_failed`,{}),D.add(s.id),z(rt(a,r,s.id,c,p.stopWorkBaseDelayMs)),f){let e=M.signal();u.non_exclusive_heartbeat_interval_ms>0?(await N(),await G(u.non_exclusive_heartbeat_interval_ms,e.signal)):u.multisession_poll_interval_ms_at_capacity>0&&await G(u.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}continue}let g=async()=>{k(`[bridge:work] Acknowledging workId=${s.id}`);try{await a.acknowledgeWork(r,s.id,m.session_ingress_token)}catch(e){k(`[bridge:work] Acknowledge failed workId=${s.id}: ${E(e)}`)}},_=s.data.type;switch(s.data.type){case`healthcheck`:await g(),k(`[bridge:work] Healthcheck received`),c.logVerbose(`Healthcheck received`);break;case`session`:{let i=s.data.id;K(`work received: type=session sessionId=${i} workId=${s.id}`);try{l(i,`session_id`)}catch{await g(),c.logError(`Invalid session_id received: ${i}`);break}let u=b.get(i);if(u){u.updateAccessToken(m.session_ingress_token),C.set(i,m.session_ingress_token),x.set(i,s.id),F?.schedule(i,m.session_ingress_token),k(`[bridge:work] Updated access token for existing sessionId=${i} workId=${s.id}`),await g();break}if(b.size>=t.maxSessions){k(`[bridge:work] At capacity (${b.size}/${t.maxSessions}), cannot spawn new session for workId=${s.id}`);break}await g();let f=Date.now(),_,M=!1,N;if(m.use_code_sessions===!0||e(process.env.CLAUDE_BRIDGE_USE_CCR_V2)){_=be(t.apiBaseUrl,i);for(let e=1;e<=2;e++)try{N=await _e(_,m.session_ingress_token),M=!0,k(`[bridge:session] CCR v2: registered worker sessionId=${i} epoch=${N} attempt=${e}`);break}catch(t){let n=E(t);if(e<2){if(k(`[bridge:session] CCR v2: registerWorker attempt ${e} failed, retrying: ${n}`),await G(2e3,v),v.aborted)break;continue}c.logError(`CCR v2 worker registration failed for session ${i}: ${n}`),L(Error(`registerWorker failed: ${n}`)),D.add(s.id),z(rt(a,r,s.id,c,p.stopWorkBaseDelayMs))}if(!M)break}else _=ve(t.sessionIngressUrl,i);let I=t.spawnMode,R=t.dir,V=0;if(I===`worktree`&&(h===void 0||!ge(i,h))){let e=Date.now();try{let t=await w(`bridge-${Le(i)}`);V=Date.now()-e,O.set(i,{worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,gitRoot:t.gitRoot,hookBased:t.hookBased}),R=t.worktreePath,k(`[bridge:session] Created worktree for sessionId=${i} at ${t.worktreePath}`)}catch(e){let t=E(e);c.logError(`Failed to create worktree for session ${i}: ${t}`),L(Error(`Worktree creation failed: ${t}`)),D.add(s.id),z(rt(a,r,s.id,c,p.stopWorkBaseDelayMs));break}}k(`[bridge:session] Spawning sessionId=${i} sdkUrl=${_}`);let H=ne(i);K(`spawning session: sessionId=${i} sdkUrl=${_} useCcrV2=${M} workerEpoch=${N} dir=${R} accessToken=${m.session_ingress_token?m.session_ingress_token.slice(0,8)+`...`:`NONE`}`);let U=Xe(o,{sessionId:i,sdkUrl:_,accessToken:m.session_ingress_token,useCcrV2:M,workerEpoch:N,onFirstUserMessage:e=>{if(j.has(H))return;j.add(H);let n=dt(e);c.setSessionTitle(H,n),k(`[bridge:title] derived title for ${H}: ${n}`),import(`./createSession-CoQtL5Rj.js`).then(({updateBridgeSessionTitle:e})=>e(H,n,{baseUrl:t.apiBaseUrl})).catch(e=>k(`[bridge:title] failed to update title for ${H}: ${e}`,{level:`error`}))}},R);if(typeof U==`string`){c.logError(`Failed to spawn session ${i}: ${U}`);let e=O.get(i);e&&(O.delete(i),z(y(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased).catch(t=>c.logVerbose(`Failed to remove worktree ${e.worktreePath}: ${E(t)}`)))),D.add(s.id),z(rt(a,r,s.id,c,p.stopWorkBaseDelayMs));break}let W=U,q=Date.now()-f;B(`tengu_bridge_session_started`,{active_sessions:b.size,spawn_mode:I,in_worktree:O.has(i),spawn_duration_ms:q,worktree_create_ms:V,inProtectedNamespace:n()}),P(`info`,`bridge_session_started`,{spawn_mode:I,in_worktree:O.has(i),spawn_duration_ms:q,worktree_create_ms:V}),b.set(i,W),x.set(i,s.id),C.set(i,m.session_ingress_token),S.set(i,H);let J=Date.now();ee.set(i,J),c.logSessionStart(i,`Session ${i}`);let re=Le(i),Y;if(t.debugFile){let e=t.debugFile.lastIndexOf(`.`);Y=e>0?`${t.debugFile.slice(0,e)}-${re}${t.debugFile.slice(e)}`:`${t.debugFile}-${re}`}else(t.verbose||process.env.USER_TYPE===`ant`)&&(Y=Te(Se(),`claude`,`bridge-session-${re}.log`));Y&&c.logVerbose(`Debug log: ${Y}`),c.addSession(H,d(H,t.sessionIngressUrl)),ae(),c.setAttached(H),ft(H,t.apiBaseUrl).then(e=>{e&&b.has(i)&&(j.add(H),c.setSessionTitle(H,e),k(`[bridge:title] server title for ${H}: ${e}`))}).catch(e=>k(`[bridge:title] failed to fetch title for ${H}: ${e}`,{level:`error`}));let X=t.sessionTimeoutMs??864e5;if(X>0){let e=setTimeout(it,X,i,X,c,A,W);T.set(i,e)}M&&te.add(i),F?.schedule(i,m.session_ingress_token),W.done.then(se(i,J,W));break}default:await g(),k(`[bridge:work] Unknown work type: ${_}, skipping`);break}if(f){let e=M.signal();u.non_exclusive_heartbeat_interval_ms>0?(await N(),await G(u.non_exclusive_heartbeat_interval_ms,e.signal)):u.multisession_poll_interval_ms_at_capacity>0&&await G(u.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}}catch(e){if(v.aborted)break;if(e instanceof s){Y=!0,f(e.errorType)?c.logStatus(e.message):m(e)?k(`[bridge:work] Suppressed 403 error: ${e.message}`):(c.logError(e.message),L(e)),B(`tengu_bridge_fatal_error`,{status:e.status,error_type:e.errorType}),P(f(e.errorType)?`info`:`error`,`bridge_fatal_error`,{status:e.status,error_type:e.errorType});break}let t=ie(e);if(K(`poll error: ${t} isConn=${$e(e)} isServer=${et(e)} activeSessions=${b.size}`),$e(e)||et(e)){let e=Date.now();J!==null&&e-J>Je(p)&&(k(`[bridge:work] Detected system sleep (${Math.round((e-J)/1e3)}s gap), resetting error budget`),P(`info`,`bridge_poll_sleep_detected`,{gapMs:e-J}),W=null,V=0,q=null,H=0),J=e,W||(W=e);let n=e-W;if(n>=p.connGiveUpMs){c.logError(`Server unreachable for ${Math.round(n/6e4)} minutes, giving up.`),B(`tengu_bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),P(`error`,`bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),Y=!0;break}q=null,H=0,V=V?Math.min(V*2,p.connCapMs):p.connInitialMs;let r=tt(V);c.logVerbose(`Connection error, retrying in ${nt(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),c.updateReconnectingStatus(nt(r),U(n)),me().non_exclusive_heartbeat_interval_ms>0&&await N(),await G(r,v)}else{let e=Date.now();J!==null&&e-J>Je(p)&&(k(`[bridge:work] Detected system sleep (${Math.round((e-J)/1e3)}s gap), resetting error budget`),P(`info`,`bridge_poll_sleep_detected`,{gapMs:e-J}),W=null,V=0,q=null,H=0),J=e,q||(q=e);let n=e-q;if(n>=p.generalGiveUpMs){c.logError(`Persistent errors for ${Math.round(n/6e4)} minutes, giving up.`),B(`tengu_bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),P(`error`,`bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),Y=!0;break}W=null,V=0,H=H?Math.min(H*2,p.generalCapMs):p.generalInitialMs;let r=tt(H);c.logVerbose(`Poll failed, retrying in ${nt(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),c.updateReconnectingStatus(nt(r),U(n)),me().non_exclusive_heartbeat_interval_ms>0&&await N(),await G(r,v)}}}oe(),c.clearStatus();let ce=Date.now()-I;B(`tengu_bridge_shutdown`,{active_sessions:b.size,loop_duration_ms:ce}),P(`info`,`bridge_shutdown`,{active_sessions:b.size,loop_duration_ms:ce});let le=new Set(b.keys());h&&le.add(h);let ue=new Map(S);if(b.size>0){k(`[bridge:shutdown] Shutting down ${b.size} active session(s)`),c.logStatus(`Shutting down ${b.size} active session(s)\u2026`);let e=new Map(x);for(let[e,t]of b.entries())k(`[bridge:shutdown] Sending SIGTERM to sessionId=${e}`),t.kill();let t=new AbortController;await Promise.race([Promise.allSettled([...b.values()].map(e=>e.done)),G(p.shutdownGraceMs??3e4,t.signal)]),t.abort();for(let[e,t]of b.entries())k(`[bridge:shutdown] Force-killing stuck sessionId=${e}`),t.forceKill();for(let e of T.values())clearTimeout(e);if(T.clear(),F?.cancelAll(),O.size>0){let e=[...O.values()];O.clear(),k(`[bridge:shutdown] Cleaning up ${e.length} worktree(s)`),await Promise.allSettled(e.map(e=>y(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased)))}await Promise.allSettled([...e.entries()].map(([e,t])=>a.stopWork(r,t,!0).catch(n=>c.logVerbose(`Failed to stop work ${t} for session ${e}: ${E(n)}`))))}if(R.size>0&&await Promise.allSettled([...R]),t.spawnMode===`single-session`&&h&&!Y){c.logStatus("Resume this session by running `claude remote-control --continue`"),k(`[bridge:shutdown] Skipping archive+deregister to allow resume of session ${h}`);return}le.size>0&&(k(`[bridge:shutdown] Archiving ${le.size} session(s)`),await Promise.allSettled([...le].map(e=>a.archiveSession(ue.get(e)??ne(e)).catch(t=>c.logVerbose(`Failed to archive session ${e}: ${E(t)}`)))));try{await a.deregisterEnvironment(r),k(`[bridge:shutdown] Environment deregistered, bridge offline`),c.logVerbose(`Environment deregistered.`)}catch(e){c.logVerbose(`Failed to deregister environment: ${E(e)}`)}let{clearBridgePointer:de}=await import(`./bridgePointer-MqLe5Asm.js`);await de(t.dir),c.logVerbose(`Environment offline.`)}var Qe=new Set([`ECONNREFUSED`,`ECONNRESET`,`ETIMEDOUT`,`ENETUNREACH`,`EHOSTUNREACH`]);function $e(e){return!!(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&Qe.has(e.code))}function et(e){return!!e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&e.code===`ERR_BAD_RESPONSE`}function tt(e){return Math.max(0,e+e*.25*(2*Math.random()-1))}function nt(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}async function rt(e,t,n,r,i=1e3){for(let a=1;a<=3;a++)try{await e.stopWork(t,n,!1),k(`[bridge:work] stopWork succeeded for workId=${n} on attempt ${a}/3`);return}catch(e){if(e instanceof s){m(e)?k(`[bridge:work] Suppressed stopWork 403 for ${n}: ${e.message}`):r.logError(`Failed to stop work ${n}: ${e.message}`),P(`error`,`bridge_stop_work_failed`,{attempts:a,fatal:!0});return}let t=E(e);if(a<3){let e=tt(i*2**(a-1));r.logVerbose(`Failed to stop work ${n} (attempt ${a}/3), retrying in ${nt(e)}: ${t}`),await G(e)}else r.logError(`Failed to stop work ${n} after 3 attempts: ${t}`),P(`error`,`bridge_stop_work_failed`,{attempts:3})}}function it(e,t,n,r,i){k(`[bridge:session] sessionId=${e} timed out after ${U(t)}`),B(`tengu_bridge_session_timeout`,{timeout_ms:t}),n.logSessionFailed(e,`Session timed out after ${U(t)}`),r.add(e),i.kill()}var at=[`session`,`same-dir`,`worktree`];function ot(e){return e===`session`?`single-session`:e===`same-dir`?`same-dir`:e===`worktree`?`worktree`:`--spawn requires one of: ${at.join(`, `)} (got: ${e??`<missing>`})`}function st(e){let t=e===void 0?NaN:parseInt(e,10);return isNaN(t)||t<1?`--capacity requires a positive integer (got: ${e??`<missing>`})`:t}function ct(e){let t=!1,n=!1,r,i,a,o,s=!1,c,l,u,d,f=!1;for(let m=0;m<e.length;m++){let h=e[m];if(h===`--help`||h===`-h`)s=!0;else if(h===`--verbose`||h===`-v`)t=!0;else if(h===`--sandbox`)n=!0;else if(h===`--no-sandbox`)n=!1;else if(h===`--debug-file`&&m+1<e.length)r=Ee(e[++m]);else if(h.startsWith(`--debug-file=`))r=Ee(h.slice(13));else if(h===`--session-timeout`&&m+1<e.length)i=parseInt(e[++m],10)*1e3;else if(h.startsWith(`--session-timeout=`))i=parseInt(h.slice(18),10)*1e3;else if(h===`--permission-mode`&&m+1<e.length)a=e[++m];else if(h.startsWith(`--permission-mode=`))a=h.slice(18);else if(h===`--name`&&m+1<e.length)o=e[++m];else if(h.startsWith(`--name=`))o=h.slice(7);else if(h===`--session-id`&&m+1<e.length){if(d=e[++m],!d)return p(`--session-id requires a value`)}else if(h.startsWith(`--session-id=`)){if(d=h.slice(13),!d)return p(`--session-id requires a value`)}else if(h===`--continue`||h===`-c`)f=!0;else if(h===`--spawn`||h.startsWith(`--spawn=`)){if(c!==void 0)return p(`--spawn may only be specified once`);let t=ot(h.startsWith(`--spawn=`)?h.slice(8):e[++m]);if(t===`single-session`||t===`same-dir`||t===`worktree`)c=t;else return p(t)}else if(h===`--capacity`||h.startsWith(`--capacity=`)){if(l!==void 0)return p(`--capacity may only be specified once`);let t=st(h.startsWith(`--capacity=`)?h.slice(11):e[++m]);if(typeof t==`number`)l=t;else return p(t)}else if(h===`--create-session-in-dir`)u=!0;else if(h===`--no-create-session-in-dir`)u=!1;else return p(`Unknown argument: ${h}\nRun 'claude remote-control --help' for usage.`)}if(c===`single-session`&&l!==void 0)return p(`--capacity cannot be used with --spawn=session (single-session mode has fixed capacity 1).`);if((d||f)&&(c!==void 0||l!==void 0||u!==void 0))return p(`--session-id and --continue cannot be used with --spawn, --capacity, or --create-session-in-dir.`);if(d&&f)return p(`--session-id and --continue cannot be used together.`);return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s};function p(e){return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s,error:e}}}async function lt(){let{EXTERNAL_PERMISSION_MODES:e}=await import(`./permissions-CeYKbtSC.js`),t=e.join(`, `),n=await qe(),r=`
|
|
16
|
+
Remote Control - Connect your local environment to claude.ai/code
|
|
17
|
+
|
|
18
|
+
USAGE
|
|
19
|
+
claude remote-control [options]
|
|
20
|
+
OPTIONS
|
|
21
|
+
--name <name> Name for the session (shown in claude.ai/code)
|
|
22
|
+
-c, --continue Resume the last session in this directory
|
|
23
|
+
--session-id <id> Resume a specific session by ID (cannot be
|
|
24
|
+
used with spawn flags or --continue)
|
|
25
|
+
--permission-mode <mode> Permission mode for spawned sessions
|
|
26
|
+
(${t})
|
|
27
|
+
--debug-file <path> Write debug logs to file
|
|
28
|
+
-v, --verbose Enable verbose output
|
|
29
|
+
-h, --help Show this help
|
|
30
|
+
${n?` --spawn <mode> Spawn mode: same-dir, worktree, session
|
|
31
|
+
(default: same-dir)
|
|
32
|
+
--capacity <N> Max concurrent sessions in worktree or
|
|
33
|
+
same-dir mode (default: ${Ke})
|
|
34
|
+
--[no-]create-session-in-dir Pre-create a session in the current
|
|
35
|
+
directory; in worktree mode this session
|
|
36
|
+
stays in cwd while on-demand sessions get
|
|
37
|
+
isolated worktrees (default: on)
|
|
38
|
+
`:``}
|
|
39
|
+
DESCRIPTION
|
|
40
|
+
Remote Control allows you to control sessions on your local device from
|
|
41
|
+
claude.ai/code (https://claude.ai/code). Run this command in the
|
|
42
|
+
directory you want to work in, then connect from the Claude app or web.
|
|
43
|
+
${n?`
|
|
44
|
+
Remote Control runs as a persistent server that accepts multiple concurrent
|
|
45
|
+
sessions in the current directory. One session is pre-created on start so
|
|
46
|
+
you have somewhere to type immediately. Use --spawn=worktree to isolate
|
|
47
|
+
each on-demand session in its own git worktree, or --spawn=session for
|
|
48
|
+
the classic single-session mode (exits when that session ends). Press 'w'
|
|
49
|
+
during runtime to toggle between same-dir and worktree.
|
|
50
|
+
`:``}
|
|
51
|
+
NOTES
|
|
52
|
+
- You must be logged in with a Claude account that has a subscription
|
|
53
|
+
- Run \`claude\` first in the directory to accept the workspace trust dialog
|
|
54
|
+
${n?` - Worktree mode requires a git repository or WorktreeCreate/WorktreeRemove hooks
|
|
55
|
+
`:``}`;console.log(r)}var ut=80;function dt(e){return V(e.replace(/\s+/g,` `).trim(),ut)}async function ft(e,t){let{getBridgeSession:n}=await import(`./createSession-CoQtL5Rj.js`);return(await n(e,{baseUrl:t}))?.title||void 0}async function pt(e){let t=ct(e);if(t.help){await lt();return}t.error&&(console.error(`Error: ${t.error}`),process.exit(1));let{verbose:n,sandbox:r,debugFile:i,sessionTimeoutMs:a,permissionMode:o,name:c,spawnMode:u,capacity:d,createSessionInDir:f,sessionId:p,continueSession:m}=t,h=p,g,_=u!==void 0||d!==void 0||f!==void 0;if(o!==void 0){let{PERMISSION_MODES:e}=await import(`./permissions-CeYKbtSC.js`),t=e;t.includes(o)||(console.error(`Error: Invalid permission mode '${o}'. Valid modes: ${t.join(`, `)}`),process.exit(1))}let y=Ee(`.`),{enableConfigs:b,checkHasTrustDialogAccepted:ee}=await import(`./config-DY5-_kk_.js`);b();let{initSinks:x}=await import(`./sinks-BpcRrN_T.js`);x();let S=await qe();_&&!S&&(await R(`tengu_bridge_multi_session_denied`,{used_spawn:u!==void 0,used_capacity:d!==void 0,used_create_session_in_dir:f!==void 0}),await Promise.race([Promise.all([oe(),se()]),G(500,void 0,{unref:!0})]).catch(()=>{}),console.error(`Error: Multi-session Remote Control is not enabled for your account yet.`),process.exit(1));let{setOriginalCwd:C,setCwdState:w}=await import(`./state-BOa-3Av3.js`);C(y),w(y),ee()||(console.error(`Error: Workspace not trusted. Please run \`claude\` in ${y} first to review and accept the workspace trust dialog.`),process.exit(1));let{clearOAuthTokenCache:T,checkAndRefreshOAuthTokenIfNeeded:D}=await import(`./auth-DRTjfnGy.js`),{getBridgeAccessToken:O,getBridgeBaseUrl:A}=await import(`./bridgeConfig-CqIQ_rvD.js`);O()||(console.error(ue),process.exit(1));let{getGlobalConfig:j,saveGlobalConfig:M,getCurrentProjectConfig:N,saveCurrentProjectConfig:te}=await import(`./config-DY5-_kk_.js`);if(!j().remoteDialogSeen){let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});console.log(`
|
|
56
|
+
Remote Control lets you access this CLI session from the web (claude.ai/code)
|
|
57
|
+
or the Claude app, so you can pick up where you left off on any device.
|
|
58
|
+
|
|
59
|
+
You can disconnect remote access anytime by running /remote-control again.
|
|
60
|
+
`);let t=await new Promise(t=>{e.question(`Enable Remote Control? (y/n) `,t)});e.close(),M(e=>e.remoteDialogSeen?e:{...e,remoteDialogSeen:!0}),t.toLowerCase()!==`y`&&t.toLowerCase()!==`yes`&&process.exit(0)}if(m){let{readBridgePointerAcrossWorktrees:e}=await import(`./bridgePointer-MqLe5Asm.js`),t=await e(y);t||(console.error("Error: No recent session found in this directory or its worktrees. Run `claude remote-control` to start a new one."),process.exit(1));let{pointer:n,dir:r}=t,i=Math.round(n.ageMs/6e4),a=i<60?`${i}m`:`${Math.round(i/60)}h`,o=r===y?``:` from worktree ${r}`;console.error(`Resuming session ${n.sessionId} (${a} ago)${o}\u2026`),h=n.sessionId,g=r}let F=A();F.startsWith(`http://`)&&!F.includes(`localhost`)&&!F.includes(`127.0.0.1`)&&(console.error(`Error: Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`),process.exit(1));let I=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||F,{getBranch:z,getRemoteUrl:V,findGitRoot:H}=await import(`./git-CbcnOf0E.js`),{hasWorktreeCreateHook:U}=await import(`./hooks-DPLIIpAD.js`),W=U()||H(y)!==null,K=S?N().remoteControlSpawnMode:void 0;if(K===`worktree`&&!W&&(console.error(`Warning: Saved spawn mode is worktree but this directory is not a git repository. Falling back to same-dir.`),K=void 0,te(e=>e.remoteControlSpawnMode===void 0?e:{...e,remoteControlSpawnMode:void 0})),S&&!K&&W&&u===void 0&&!h&&process.stdin.isTTY){let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});console.log(`
|
|
61
|
+
Claude Remote Control is launching in spawn mode which lets you create new sessions in this project from Work Mate on Web or your Mobile app. Learn more here: https://code.claude.com/docs/en/remote-control
|
|
62
|
+
|
|
63
|
+
Spawn mode for this project:
|
|
64
|
+
[1] same-dir — sessions share the current directory (default)
|
|
65
|
+
[2] worktree — each session gets an isolated git worktree
|
|
66
|
+
|
|
67
|
+
This can be changed later or explicitly set with --spawn=same-dir or --spawn=worktree.
|
|
68
|
+
`);let t=await new Promise(t=>{e.question(`Choose [1/2] (default: 1): `,t)});e.close();let n=t.trim()===`2`?`worktree`:`same-dir`;K=n,B(`tengu_bridge_spawn_mode_chosen`,{spawn_mode:n}),te(e=>e.remoteControlSpawnMode===n?e:{...e,remoteControlSpawnMode:n})}let q,J;h?(J=`single-session`,q=`resume`):u===void 0?K===void 0?(J=S?`same-dir`:`single-session`,q=`gate_default`):(J=K,q=`saved`):(J=u,q=`flag`);let ne=J===`single-session`?1:d??Ke,Y=f??!0;if(!h){let{clearBridgePointer:e}=await import(`./bridgePointer-MqLe5Asm.js`);await e(y)}J===`worktree`&&!W&&(console.error(`Error: Worktree mode requires a git repository or WorktreeCreate hooks configured. Use --spawn=session for single-session mode.`),process.exit(1));let X=await z(),ie=await V(),ae=xe(),ce=Oe(),{handleOAuth401Error:le}=await import(`./auth-DRTjfnGy.js`),de=v({baseUrl:F,getAccessToken:O,runnerVersion:`0.0.6`,onDebug:k,onAuth401:le,getTrustedDeviceToken:he}),Z;if(h){try{l(h,`sessionId`)}catch{console.error(`Error: Invalid session ID "${h}". Session IDs must not contain unsafe characters.`),process.exit(1)}await D(),T();let{getBridgeSession:e}=await import(`./createSession-CoQtL5Rj.js`),t=await e(h,{baseUrl:F,getAccessToken:O});if(!t){if(g){let{clearBridgePointer:e}=await import(`./bridgePointer-MqLe5Asm.js`);await e(g)}console.error(`Error: Session ${h} not found. It may have been archived or expired.`),process.exit(1)}if(!t.environment_id){if(g){let{clearBridgePointer:e}=await import(`./bridgePointer-MqLe5Asm.js`);await e(g)}console.error(`Error: Session ${h} has no environment_id. It may never have been attached to a bridge.`),process.exit(1)}Z=t.environment_id,k(`[bridge:init] Resuming session ${h} on environment ${Z}`)}let Q={dir:y,machineName:ae,branch:X,gitRepoUrl:ie,maxSessions:ne,spawnMode:J,verbose:n,sandbox:r,bridgeId:ce,workerType:`claude_code`,environmentId:Oe(),reuseEnvironmentId:Z,apiBaseUrl:F,sessionIngressUrl:I,debugFile:i,sessionTimeoutMs:a};k(`[bridge:init] bridgeId=${ce}${Z?` reuseEnvironmentId=${Z}`:``} dir=${y} branch=${X} gitRepoUrl=${ie} machine=${ae}`),k(`[bridge:init] apiBaseUrl=${F} sessionIngressUrl=${I}`),k(`[bridge:init] sandbox=${r}${i?` debugFile=${i}`:``}`);let $,fe;try{let e=await de.registerBridgeEnvironment(Q);$=e.environment_id,fe=e.environment_secret}catch(e){B(`tengu_bridge_registration_failed`,{status:e instanceof s?e.status:void 0}),console.error(e instanceof s&&e.status===404?`Remote Control environments are not available for your account.`:`Error: ${E(e)}`),process.exit(1)}let pe;if(h)if(Z&&$!==Z)L(Error(`Bridge resume env mismatch: requested ${Z}, backend returned ${$}. Falling back to fresh session.`)),console.warn(`Warning: Could not resume session ${h} — its environment has expired. Creating a fresh session instead.`);else{let e=re(h),t=e===h?[h]:[h,e],n=!1,r;for(let e of t)try{await de.reconnectSession($,e),k(`[bridge:init] Session ${e} re-queued via bridge/reconnect`),pe=h,n=!0;break}catch(t){r=t,k(`[bridge:init] reconnectSession(${e}) failed: ${E(t)}`)}if(!n){let e=r,t=e instanceof s;if(g&&t){let{clearBridgePointer:e}=await import(`./bridgePointer-MqLe5Asm.js`);await e(g)}console.error(t?`Error: ${E(e)}`:`Error: Failed to reconnect session ${h}: ${E(e)}\nThe session may still be resumable — try running the same command again.`),process.exit(1)}}k(`[bridge:init] Registered, server environmentId=${$}`);let ge=me();B(`tengu_bridge_started`,{max_sessions:Q.maxSessions,has_debug_file:!!Q.debugFile,sandbox:Q.sandbox,verbose:Q.verbose,heartbeat_interval_ms:ge.non_exclusive_heartbeat_interval_ms,spawn_mode:Q.spawnMode,spawn_mode_source:q,multi_session_gate:S,pre_create_session:Y,worktree_available:W}),P(`info`,`bridge_started`,{max_sessions:Q.maxSessions,sandbox:Q.sandbox,spawn_mode:Q.spawnMode});let _e=Ue({execPath:process.execPath,scriptArgs:Ye(),env:process.env,verbose:n,sandbox:r,debugFile:i,permissionMode:o,onDebug:k,onActivity:(e,t)=>{k(`[bridge:activity] sessionId=${e} ${t.type} ${t.summary}`)},onPermissionRequest:(e,t,n)=>{k(`[bridge:perm] sessionId=${e} tool=${t.request.tool_name} request_id=${t.request_id} (not auto-approving)`)}}),ve=Pe({verbose:n}),{parseGitHubRepository:ye}=await import(`./detectRepository-BTPgN89l.js`),be=ie?ye(ie):null,Se=be?be.split(`/`).pop():Ce(y);ve.setRepoInfo(Se,X);let we=J!==`single-session`&&W;we&&ve.setSpawnModeDisplay(J);let Te=e=>{if(e[0]===3||e[0]===4){process.emit(`SIGINT`);return}if(e[0]===32){ve.toggleQr();return}if(e[0]===119){if(!we)return;let e=Q.spawnMode===`same-dir`?`worktree`:`same-dir`;Q.spawnMode=e,B(`tengu_bridge_spawn_mode_toggled`,{spawn_mode:e}),ve.logStatus(e===`worktree`?`Spawn mode: worktree (new sessions get isolated git worktrees)`:`Spawn mode: same-dir (new sessions share the current directory)`),ve.setSpawnModeDisplay(e),ve.refreshDisplay(),te(t=>t.remoteControlSpawnMode===e?t:{...t,remoteControlSpawnMode:e});return}};process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on(`data`,Te));let De=new AbortController,ke=()=>{k(`[bridge:shutdown] SIGINT received, shutting down`),De.abort()},Ae=()=>{k(`[bridge:shutdown] SIGTERM received, shutting down`),De.abort()};process.on(`SIGINT`,ke),process.on(`SIGTERM`,Ae);let je=pe||null;if(Y&&!pe){let{createBridgeSession:e}=await import(`./createSession-CoQtL5Rj.js`);try{je=await e({environmentId:$,title:c,events:[],gitRepoUrl:ie,branch:X,signal:De.signal,baseUrl:F,getAccessToken:O,permissionMode:o}),je&&k(`[bridge:init] Created initial session ${je}`)}catch(e){k(`[bridge:init] Session creation failed (non-fatal): ${E(e)}`)}}let Me=null;if(je&&J===`single-session`){let{writeBridgePointer:e}=await import(`./bridgePointer-MqLe5Asm.js`),t={sessionId:je,environmentId:$,source:`standalone`};await e(Q.dir,t),Me=setInterval(e,3600*1e3,Q.dir,t),Me.unref?.()}try{await Ze(Q,$,fe,de,_e,ve,De.signal,void 0,je??void 0,async()=>(T(),await D(),O()))}finally{Me!==null&&clearInterval(Me),process.off(`SIGINT`,ke),process.off(`SIGTERM`,Ae),process.stdin.off(`data`,Te),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause()}process.exit(0)}var mt=class extends Error{constructor(e){super(e),this.name=`BridgeHeadlessPermanentError`}};async function ht(e,t){let{dir:n,log:r}=e;process.chdir(n);let{setOriginalCwd:i,setCwdState:a}=await import(`./state-BOa-3Av3.js`);i(n),a(n);let{enableConfigs:o,checkHasTrustDialogAccepted:s}=await import(`./config-DY5-_kk_.js`);o();let{initSinks:c}=await import(`./sinks-BpcRrN_T.js`);if(c(),!s())throw new mt(`Workspace not trusted: ${n}. Run \`claude\` in that directory first to accept the trust dialog.`);if(!e.getAccessToken())throw Error(ue);let{getBridgeBaseUrl:l}=await import(`./bridgeConfig-CqIQ_rvD.js`),u=l();if(u.startsWith(`http://`)&&!u.includes(`localhost`)&&!u.includes(`127.0.0.1`))throw new mt(`Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`);let d=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||u,{getBranch:f,getRemoteUrl:p,findGitRoot:m}=await import(`./git-CbcnOf0E.js`),{hasWorktreeCreateHook:h}=await import(`./hooks-DPLIIpAD.js`);if(e.spawnMode===`worktree`&&!(h()||m(n)!==null))throw new mt(`Worktree mode requires a git repository or WorktreeCreate hooks. Directory ${n} has neither.`);let g=await f(),_=await p(),y=xe(),b=Oe(),ee={dir:n,machineName:y,branch:g,gitRepoUrl:_,maxSessions:e.capacity,spawnMode:e.spawnMode,verbose:!1,sandbox:e.sandbox,bridgeId:b,workerType:`claude_code`,environmentId:Oe(),apiBaseUrl:u,sessionIngressUrl:d,sessionTimeoutMs:e.sessionTimeoutMs},x=v({baseUrl:u,getAccessToken:e.getAccessToken,runnerVersion:`0.0.6`,onDebug:r,onAuth401:e.onAuth401,getTrustedDeviceToken:he}),S,C;try{let e=await x.registerBridgeEnvironment(ee);S=e.environment_id,C=e.environment_secret}catch(e){throw Error(`Bridge registration failed: ${E(e)}`)}let w=Ue({execPath:process.execPath,scriptArgs:Ye(),env:process.env,verbose:!1,sandbox:e.sandbox,permissionMode:e.permissionMode,onDebug:r}),T=gt(r);T.printBanner(ee,S);let D;if(e.createSessionOnStart){let{createBridgeSession:n}=await import(`./createSession-CoQtL5Rj.js`);try{let i=await n({environmentId:S,title:e.name,events:[],gitRepoUrl:_,branch:g,signal:t,baseUrl:u,getAccessToken:e.getAccessToken,permissionMode:e.permissionMode});i&&(D=i,r(`created initial session ${i}`))}catch(e){r(`session pre-creation failed (non-fatal): ${E(e)}`)}}await Ze(ee,S,C,x,w,T,t,void 0,D,async()=>e.getAccessToken())}function gt(e){let t=()=>{};return{printBanner:(t,n)=>e(`registered environmentId=${n} dir=${t.dir} spawnMode=${t.spawnMode} capacity=${t.maxSessions}`),logSessionStart:(t,n)=>e(`session start ${t}`),logSessionComplete:(t,n)=>e(`session complete ${t} (${n}ms)`),logSessionFailed:(t,n)=>e(`session failed ${t}: ${n}`),logStatus:e,logVerbose:e,logError:t=>e(`error: ${t}`),logReconnected:t=>e(`reconnected after ${t}ms`),addSession:(t,n)=>e(`session attached ${t}`),removeSession:t=>e(`session detached ${t}`),updateIdleStatus:t,updateReconnectingStatus:t,updateSessionStatus:t,updateSessionActivity:t,updateSessionCount:t,updateFailedStatus:t,setSpawnModeDisplay:t,setRepoInfo:t,setDebugLogPath:t,setAttached:t,setSessionTitle:t,clearStatus:t,toggleQr:t,refreshDisplay:t}}export{ct as a,et as i,pt as n,ht as o,$e as r,Ze as s,mt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./bridgeMain-DHUpZFgL.js";export{e as bridgeMain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,F as r,S as i,a,l as o,z as s}from"./debug-BrXObCdR.js";import{B as c,F as l,G as u,I as d,O as f,U as p,Y as m,b as h,g,m as _}from"./log-BMCygSzM.js";import{n as v,r as y}from"./analytics-BotDBGh0.js";import{P as b,lt as x,n as S,t as C}from"./rcDebugLog-
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,F as r,S as i,a,l as o,z as s}from"./debug-BrXObCdR.js";import{B as c,F as l,G as u,I as d,O as f,U as p,Y as m,b as h,g,m as _}from"./log-BMCygSzM.js";import{n as v,r as y}from"./analytics-BotDBGh0.js";import{P as b,lt as x,n as S,t as C}from"./rcDebugLog-CUy1_F23.js";import{t as w}from"./controlMessageCompat-IFu4Gc1y.js";import{randomUUID as T}from"crypto";v(),b(),a(),C(),_(),s(),i(),m(),e();function E(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function D(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_response`&&`response`in e}function O(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_request`&&`request_id`in e&&`request`in e}function k(e){return(e.type===`user`||e.type===`assistant`)&&e.isVirtual?!1:e.type===`user`||e.type===`assistant`||e.type===`system`&&e.subtype===`local_command`}function A(e){if(e.type!==`user`||e.isMeta||e.toolUseResult||e.isCompactSummary||e.origin&&e.origin.kind!==`human`)return;let t=e.message.content,n;if(typeof t==`string`)n=t;else for(let e of t??[])if(e.type===`text`){n=e.text;break}if(n)return g(n)||void 0}var j=`system-reminder`,M=/\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy,N=new Set([h,f,l,d,c,p,u]);function P(e){let t=e.message?.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``):``}function F(e){let t=e.trim();if(!t)return null;M.lastIndex=0;let n=[];for(;M.lastIndex<t.length;){let e=M.exec(t);if(!e)return null;n.push(e[1])}return n.length>0?n:null}function I(e){if(e.type!==`user`||e.isVisibleInTranscriptOnly)return!1;if(e.toolUseResult!==void 0||!e.isMeta)return!0;let t=F(P(e));return!t||t.some(e=>e!==`local-command-caveat`&&e!==j&&N.has(e))}function L(e){return e.some(I)}function R(e,t,i,a,s,c){try{let r=w(n(e));if(D(r)){o(`[bridge:repl] Ingress message type=control_response`),s?.(r);return}if(O(r)){o(`[bridge:repl] Inbound control_request subtype=${r.request.subtype}`),c?.(r);return}if(!E(r))return;let l=`uuid`in r&&typeof r.uuid==`string`?r.uuid:void 0;if(l&&t.has(l)){o(`[bridge:repl] Ignoring echo: type=${r.type} uuid=${l}`);return}if(l&&i.has(l)){o(`[bridge:repl] Ignoring re-delivered inbound: type=${r.type} uuid=${l}`);return}o(`[bridge:repl] Ingress message type=${r.type}${l?` uuid=${l}`:``}`),r.type===`user`?(l&&i.add(l),y(`tengu_bridge_message_received`,{is_repl:!0}),a?.(r)):o(`[bridge:repl] Ignoring non-user inbound message: type=${r.type}`)}catch(e){o(`[bridge:repl] Failed to parse ingress message: ${r(e)}`)}}var z=`This session is outbound-only. Enable Remote Control locally to allow inbound control.`;function B(e,t){let{transport:n,sessionId:r,outboundOnly:i,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:l}=t;if(!n){o(`[bridge:repl] Cannot respond to control_request: transport not configured`);return}let u,d=e.request;if(i&&d.subtype!==`initialize`){u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:z}};let t={...u,session_id:r};n.write(t),o(`[bridge:repl] Rejected ${d.subtype} (outbound-only) request_id=${e.request_id}`);return}switch(d.subtype){case`initialize`:u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:{commands:[],output_style:`normal`,available_output_styles:[`normal`],models:[],account:{},pid:process.pid}}};break;case`set_model`:s?.(d.model),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_max_thinking_tokens`:c?.(d.max_thinking_tokens??null),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_permission_mode`:{let t=l?.(d.mode)??{ok:!1,error:`set_permission_mode is not supported in this context (onSetPermissionMode callback not registered)`};u=t.ok?{type:`control_response`,response:{subtype:`success`,request_id:e.request_id}}:{type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t.error}};break}case`interrupt`:a?.(),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;default:u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:`REPL bridge does not handle control_request subtype: ${d.subtype}`}}}let f={...u,session_id:r};n.write(f),S(`control_response: subtype=${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`),o(`[bridge:repl] Sent control_response for ${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`)}function V(e){return{type:`result_success`,subtype:`success`,duration_ms:0,duration_api_ms:0,is_error:!1,num_turns:0,result:``,stop_reason:null,total_cost_usd:0,usage:{...x},modelUsage:{},permission_denials:[],session_id:e,uuid:T()}}var H=class{constructor(e){t(this,`capacity`,void 0),t(this,`ring`,void 0),t(this,`set`,new Set),t(this,`writeIdx`,0),this.capacity=e,this.ring=Array(e)}add(e){if(this.set.has(e))return;let t=this.ring[this.writeIdx];t!==void 0&&this.set.delete(t),this.ring[this.writeIdx]=e,this.set.add(e),this.writeIdx=(this.writeIdx+1)%this.capacity}has(e){return this.set.has(e)}clear(){this.set.clear(),this.ring.fill(void 0),this.writeIdx=0}};export{k as a,L as c,B as i,A as n,V as o,R as r,I as s,H as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,bn as i,fi as a,ot as o,t as s,vn as c,xt as l}from"./src-CDCSSo0U2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,bn as i,fi as a,ot as o,t as s,vn as c,xt as l}from"./src-CDCSSo0U2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{Al as d,Ao as f,Bb as p,Gw as m,ME as h,NE as g,Vb as _,Ww as v,ZT as y,aC as b,jE as x,kl as S,lh as C,lt as w,sh as T,ut as E,zo as D}from"./loadAgentsDir-D206qwP3.js";import{F as O,z as k}from"./debug-BrXObCdR.js";import{Kt as A}from"./settings-BovzmwMP.js";import{b as j,g as M}from"./config-DmomySWC.js";import{st as N}from"./rcDebugLog-CUy1_F23.js";import{n as P,r as F}from"./sideQuestion-wSi38p81.js";import{i as I,n as L}from"./modalContext-DFjKLCB6.js";function R({question:e,context:t,onDone:a}){let[s,c]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,m]=(0,H.useState)(0),h=(0,H.useRef)(null),{rows:g}=I(o());i(()=>m(e=>e+1),s||u?null:80);function _(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),a(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),h.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),h.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=v();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?c(r.response):d(`No response received`))}catch(e){n.signal.aborted||d(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let y=Math.max(5,g-W-G);return(0,U.jsxs)(n,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:_,children:[(0,U.jsxs)(n,{children:[(0,U.jsxs)(r,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(r,{dimColor:!0,children:e})]}),(0,U.jsx)(n,{marginTop:1,marginLeft:2,maxHeight:y,children:(0,U.jsx)(l,{ref:h,flexDirection:`column`,flexGrow:1,children:u?(0,U.jsx)(r,{color:`error`,children:u}):s?(0,U.jsx)(T,{children:s}):(0,U.jsxs)(n,{children:[(0,U.jsx)(p,{frame:f,messageColor:`warning`}),(0,U.jsx)(r,{color:`warning`,children:`Answering...`})]})})}),(s||u)&&(0,U.jsx)(n,{marginTop:1,children:(0,U.jsxs)(r,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=f(z(e.messages)),n=S();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,i,a]=await Promise.all([w(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),h(),x()]);return{systemPrompt:N(r),userContext:i,systemContext:a,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(j(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{a(),H=t(a(),1),c(),C(),_(),A(),E(),L(),g(),b(),s(),m(),M(),k(),d(),D(),P(),y(),U=u(),W=5,G=6,K=3}))();export{V as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./caches-UeVVM3T0.js";e();export{t as clearSessionCaches};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{m as i}from"./zod-CuNujUwx.js";import{Sr as a,en as o,l as s,xr as c,zn as l}from"./state-ix0xIunV.js";import{AE as u,
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{m as i}from"./zod-CuNujUwx.js";import{Sr as a,en as o,l as s,xr as c,zn as l}from"./state-ix0xIunV.js";import{AE as u,Ac as d,Cm as f,Db as ee,Eb as p,Ep as m,Ft as h,GE as g,HE as _,Jw as v,Kp as y,Kw as b,ME as x,NE as te,Ox as ne,PE as re,Qi as ie,Sp as ae,VE as oe,Vi as se,Vt as ce,WE as le,Y as ue,Z as de,_ as fe,_l as pe,eD as me,g as he,hl as ge,jE as _e,kc as ve,kx as ye,nD as be,p as xe,qp as Se,wm as Ce,yn as we}from"./loadAgentsDir-D206qwP3.js";import{n as Te,t as S}from"./cwd-CYmmnQVS.js";import{F as Ee,a as De,d as Oe,l as C,p as ke,z as Ae}from"./debug-BrXObCdR.js";import{g as je,n as Me}from"./settings-BovzmwMP.js";import{c as Ne,g as Pe}from"./config-DmomySWC.js";import{T as Fe,_ as Ie,g as Le,r as w,x as Re}from"./git-Do0wJvux.js";import{n as T,r as ze}from"./execFileNoThrow-D244NytW.js";import{o as Be,s as E}from"./log-BMCygSzM.js";import{i as Ve,n as He}from"./path-D5U-tm91.js";import{n as Ue,r as D}from"./analytics-BotDBGh0.js";import{a as We,s as Ge}from"./ripgrep-BXmXjAzA.js";import{i as Ke,t as qe}from"./detectRepository-BPr0VWNO.js";import{r as Je,t as Ye}from"./magicDocs-DWjL2k7P.js";import*as O from"path";import{statSync as Xe}from"fs";function Ze(e,t,n){if(t===0)return n?A:0;let r=e.charCodeAt(t-1);return Qe(r)?rt:$e(r)&&et(e.charCodeAt(t))?it:0}function Qe(e){return e===47||e===92||e===45||e===95||e===46||e===32}function $e(e){return e>=97&&e<=122}function et(e){return e>=65&&e<=90}function k(){return new Promise(e=>setImmediate(e))}function tt(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var nt,rt,it,at,A,ot,j,M,N,P,st,ct=e((()=>{n(),nt=16,rt=8,it=6,at=4,A=8,ot=3,j=1,M=100,N=64,P=new Int32Array(N),st=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await k(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await k(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=tt(e,M)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,N),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*24+A+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:ee,readyCount:p}=this;for(let e=0;e<p;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],p=a[0],m=0,h=[],g=r.indexOf(p);if(g===-1)continue;h[m++]=g;for(let e=g+1;e<r.length;e++){if(r.charCodeAt(e)!==p.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(h[m++]=e)}let _=u[e],v=ee[e],y=Math.max(0,32-(v>>2)),b=-1/0;for(let e=0;e<m;e++){P[0]=h[e];let n=0,o=0,u=P[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}P[e]=t;let i=t-u-1;i===0?o+=at:n+=ot+i*j,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*nt+o-n;f+=Ze(_,P[0],!0);for(let e=1;e<i;e++)f+=Ze(_,P[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:_,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:_,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let m=c.length,h=Math.max(m,1),g=Array(m);for(let e=0;e<m;e++){let t=c[e].path,n=e/h;g[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return g}}}));function F(){return R||(R=new st),R}function lt(){R=null,z=null,V++,H=null,U=[],W=[],G=[],B.clear(),K=null,q=null,J=0,Y=null,X=null,Z=null}function ut(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function dt(){let e=w(S());if(!e)return null;try{return Xe(O.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function ft(e,t,n){return n===t?e:e.map(e=>{let r=O.join(t,e);return O.relative(n,r)})}async function pt(e){if(e.length===0||!R||U.length===0)return;let t=await gt(e),n=[...U,...W,...G,...e,...t],r=ut(n);if(r===Z){C(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await R.loadFromFileListAsync(n).done,Z=r,C(`[FileIndex] rebuilt index with ${U.length} tracked + ${e.length} untracked files`)}async function mt(e,t){let n=`${e}:${t}`;if(q===n)return K;let r=Oe(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,Dt.default)(),s=!1,c=a.flatMap(e=>i.map(t=>O.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,C(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return K=u,q=n,u}async function ht(e,t){let n=Date.now();C(`[FileIndex] getFilesUsingGit called`);let r=S(),i=w(r);if(!i)return C(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await T(Le(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(C(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return C(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=ft(o.stdout.trim().split(`
|
|
2
2
|
`).filter(Boolean),i,r),c=await mt(i,r);if(c){let e=s.length;s=c.filter(s),C(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}U=s;let l=Date.now()-n;if(C(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),D(`tengu_file_suggestions_git_ls_files`,{file_count:s.length,tracked_count:s.length,untracked_count:0,duration_ms:l}),!H){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=V;H=T(Le(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===V&&e.code===0){let t=ft(e.stdout.trim().split(`
|
|
3
|
-
`).filter(Boolean),i,r),n=await mt(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),C(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}C(`[FileIndex] background untracked fetch: ${t.length} files`),pt(t)}}).catch(e=>{C(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return C(`[FileIndex] git ls-files error: ${Ee(e)}`),null}}async function gt(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)_t(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await k(),n=performance.now());return[...t].map(e=>e+O.sep)}function _t(e,t,n,r){for(let i=t;i<n;i++){let t=O.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=O.dirname(t);if(e===t)break;r.add(t),t=e}}}async function vt(e){return(await Promise.all(
|
|
3
|
+
`).filter(Boolean),i,r),n=await mt(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),C(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}C(`[FileIndex] background untracked fetch: ${t.length} files`),pt(t)}}).catch(e=>{C(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return C(`[FileIndex] git ls-files error: ${Ee(e)}`),null}}async function gt(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)_t(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await k(),n=performance.now());return[...t].map(e=>e+O.sep)}function _t(e,t,n,r){for(let i=t;i<n;i++){let t=O.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=O.dirname(t);if(e===t)break;r.add(t),t=e}}}async function vt(e){return(await Promise.all(xe.map(t=>fe(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function yt(e,t){C(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await ht(e,t);if(n!==null)return C(`[FileIndex] using git ls-files result (${n.length} files)`),n;C(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await Ge(i,`.`,e)).map(e=>O.relative(S(),e)),o=Date.now()-r;return C(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),D(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function bt(){let e=AbortSignal.timeout(1e4),t=F();try{let n=Me(),r=Ne(),i=n.respectGitignore??r.respectGitignore??!0,a=S(),[o,s]=await Promise.all([yt(e,i),vt(a)]);W=s;let c=[...o,...s],l=await gt(c);G=l;let u=[...l,...c],d=ut(u);d===X?C(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,X=d,Z=null)}catch(e){E(e)}return t}function xt(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function St(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=xt(n,r),n===``)return``}return n}function I(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Ct(e,t){return e.search(t,Q).map(e=>I(e.path,e.score))}function L(){if(z)return;let e=dt();if(R&&!(e!==null&&e!==Y)&&Date.now()-J<kt)return;let t=V,n=Date.now();F(),z=bt().then(r=>t===V?(z=null,B.emit(),Y=e,J=Date.now(),C(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(C(`[FileIndex] Cache refresh failed: ${Ee(e)}`),E(e),t===V&&(z=null),F()))}async function wt(){let e=Oe(),t=S();try{return(await e.readdir(t)).map(e=>{let n=O.join(t,e.name),r=O.relative(t,n);return e.isDirectory()?r+O.sep:r})}catch(e){return E(e),[]}}async function Tt(e,t=!1){if(!e&&!t)return[];if(Me().fileSuggestion?.type===`command`)return(await ce({...h(),query:e})).slice(0,Q).map(I);if(e===``||e===`.`||e===`./`){let e=await wt();return L(),e.slice(0,Q).map(I)}let n=Date.now();try{let t=z!==null;L();let r=e,i=`.`+O.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=He(r));let a=R?Ct(R,r):[],o=Date.now()-n;return C(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),D(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return E(e),[]}}function Et(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var Dt,R,z,B,Ot,V,H,U,W,G,K,q,J,Y,X,Z,Q,kt,$=e((()=>{Dt=t(i(),1),he(),ct(),Ue(),Pe(),Te(),De(),Ae(),ze(),ke(),Ie(),we(),Be(),Ve(),We(),je(),a(),R=null,z=null,B=c(),Ot=B.subscribe,V=0,H=null,U=[],W=[],G=[],K=null,q=null,J=0,Y=null,X=null,Z=null,Q=15,kt=5e3}));function At(e=new Set){let t=e.size>0;x.cache.clear?.(),_e.cache.clear?.(),u.cache.clear?.(),le.cache.clear?.(),lt(),se(),t||be(),re(null),l(null),pe(),d(),_(`session_start`),ne(),p(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-Cb7gJvq4.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-CUAoGkU6.js`).then(({clearAttributionCaches:e})=>e()),qe(),ue(),t||b(),s(e),Re(),ae(),Ce(),Ye(),y(),import(`./SearchExtraToolsTool-C4uO-Zx3.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-TZjwTqdr.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-IAvMxKDl.js`).then(({clearPromptCache:e})=>e())}var jt=e((()=>{o(),ie(),g(),te(),$(),v(),me(),ee(),ge(),f(),Je(),m(),ve(),de(),oe(),Ke(),Fe(),ye(),Se()}));export{Tt as a,L as c,St as i,jt as n,$ as o,Et as r,Ot as s,At as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{F as n,I as r,S as i,a,l as o,w as s,z as c}from"./debug-BrXObCdR.js";import{M as l,j as u}from"./git-Do0wJvux.js";import{lr as d,ur as f,vn as p,yn as m}from"./model-BIVmcl_N.js";import{l as h,r as g}from"./proxy-CRN7jYIi.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-DoL1FpGJ.js";import{n as C}from"./jwtUtils-DE2GPUcx.js";import{randomUUID as w}from"crypto";c(),a(),u(),h(),f(),p(),y(),S(),i(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(s(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await m(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}p(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,g({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),b(()=>{this.writeEvent({type:`keep_alive`})}),o(`CCRClient: initialized, epoch=${this.workerEpoch}`),l(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||l(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,i,a,{timeout:s=1e4}={}){let c=this.getAuthHeaders();if(Object.keys(c).length===0)return{ok:!1};try{let n=await this.http[e](`${this.sessionBaseUrl}${t}`,i,{headers:{...c,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":d()},validateStatus:j,timeout:s});if(n.status>=200&&n.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(n.status===409&&this.handleEpochMismatch(),n.status===401||n.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(o(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),l(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(o(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),l(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(o(`CCRClient: ${a} returned ${n.status}`,{level:`warn`}),l(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:n.status}),n.status===429){let e=n.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(i){return o(`CCRClient: ${a} failed: ${n(i)}`,{level:`warn`}),l(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:r(i)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){o(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),l(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&o(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return o(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,r){for(let r=1;r<=10;r++){let i;try{i=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":d()},validateStatus:j,timeout:3e4})}catch(t){o(`CCRClient: GET ${e} failed (attempt ${r}/10): ${n(t)}`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500);continue}if(i.status>=200&&i.status<300)return i.data;i.status===409&&this.handleEpochMismatch(),o(`CCRClient: GET ${e} returned ${i.status} (attempt ${r}/10)`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500)}return o(`CCRClient: GET retries exhausted`,{level:`error`}),l(`error`,`cli_worker_get_retries_exhausted`,{context:r}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),x(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{F as n,I as r,S as i,a,l as o,w as s,z as c}from"./debug-BrXObCdR.js";import{M as l,j as u}from"./git-Do0wJvux.js";import{_n as d,ar as f,or as p,vn as m}from"./model-CKkOnnnx.js";import{l as h,r as g}from"./proxy-CRN7jYIi.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-CUy1_F23.js";import{n as C}from"./jwtUtils-DE2GPUcx.js";import{randomUUID as w}from"crypto";c(),a(),u(),h(),p(),d(),y(),S(),i(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(s(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await m(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}d(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,g({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),b(()=>{this.writeEvent({type:`keep_alive`})}),o(`CCRClient: initialized, epoch=${this.workerEpoch}`),l(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||l(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,i,a,{timeout:s=1e4}={}){let c=this.getAuthHeaders();if(Object.keys(c).length===0)return{ok:!1};try{let n=await this.http[e](`${this.sessionBaseUrl}${t}`,i,{headers:{...c,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":f()},validateStatus:j,timeout:s});if(n.status>=200&&n.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(n.status===409&&this.handleEpochMismatch(),n.status===401||n.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(o(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),l(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(o(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),l(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(o(`CCRClient: ${a} returned ${n.status}`,{level:`warn`}),l(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:n.status}),n.status===429){let e=n.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(i){return o(`CCRClient: ${a} failed: ${n(i)}`,{level:`warn`}),l(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:r(i)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){o(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),l(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&o(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return o(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,r){for(let r=1;r<=10;r++){let i;try{i=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":f()},validateStatus:j,timeout:3e4})}catch(t){o(`CCRClient: GET ${e} failed (attempt ${r}/10): ${n(t)}`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500);continue}if(i.status>=200&&i.status<300)return i.data;i.status===409&&this.handleEpochMismatch(),o(`CCRClient: GET ${e} returned ${i.status} (attempt ${r}/10)`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500)}return o(`CCRClient: GET retries exhausted`,{level:`error`}),l(`error`,`cli_worker_get_retries_exhausted`,{context:r}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),x(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-BWVTM40Y.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Lr as e,Rr as t}from"./model-CKkOnnnx.js";t();export{e as getOrganizationUUID};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n}from"./state-ix0xIunV.js";import{$d as r,Er as i,Xd as a,jr as o,mi as s}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n}from"./state-ix0xIunV.js";import{$d as r,Er as i,Xd as a,jr as o,mi as s}from"./loadAgentsDir-D206qwP3.js";async function c(e,t,r){if(!r||r.trim()===``)return e(`Please provide a color. Available colors: ${a.join(`, `)}, default`,{display:`system`}),null;let o=r.trim().toLowerCase();return l.includes(o)?(await s(n(),`default`,i()),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:void 0}})),e(`Session color reset to default`,{display:`system`}),null):a.includes(o)?(await s(n(),o,i()),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:o}})),e(`Session color set to: ${o}`,{display:`system`}),null):(e(`Invalid color "${o}". Available colors: ${a.join(`, `)}, default`,{display:`system`}),null)}var l;e((()=>{t(),r(),o(),l=[`default`,`reset`,`none`,`gray`,`grey`]}))();export{c as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qi as e,Vi as t,qi as n}from"./loadAgentsDir-D206qwP3.js";e();export{t as clearCommandsCache,n as getCommands};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,l as t}from"./commitAttribution-ChAgixdj.js";t();export{e as isInternalModelRepo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nt as r}from"./state-ix0xIunV.js";import{n as i,t as a}from"./cwd-CYmmnQVS.js";import{a as o,p as s}from"./debug-BrXObCdR.js";import{T as c,_ as l,g as u,r as d,w as f}from"./git-Do0wJvux.js";import{n as p,r as m}from"./execFileNoThrow-D244NytW.js";import{o as h}from"./log-BMCygSzM.js";import{
|
|
2
|
-
`).filter(Boolean),i=0;for(let e of r)if(e.includes(`file changed`)||e.includes(`files changed`)){let t=e.match(/(\d+) insertions?/),n=e.match(/(\d+) deletions?/),r=t?parseInt(t[1],10):0,a=n?parseInt(n[1],10):0;i+=(r+a)*40}return i}catch{return 0}}async function R(e){let t=M();try{let n=await p(u(),[`diff`,`--cached`,`--name-status`,`--`,e],{cwd:t,timeout:5e3});if(n.code===0&&n.stdout)return n.stdout.trim().startsWith(`D `)}catch{}return!1}function z(e,t){let n={};for(let[t,r]of e.fileStates)n[t]=r;return{type:`attribution-snapshot`,messageId:t,surface:e.surface,fileStates:n,promptCount:e.promptCount,promptCountAtLastCommit:e.promptCountAtLastCommit,permissionPromptCount:e.permissionPromptCount,permissionPromptCountAtLastCommit:e.permissionPromptCountAtLastCommit,escapeCount:e.escapeCount,escapeCountAtLastCommit:e.escapeCountAtLastCommit}}function B(e){let t=F(),n=e[e.length-1];if(!n)return t;t.surface=n.surface;for(let[e,r]of Object.entries(n.fileStates))t.fileStates.set(e,r);return t.promptCount=n.promptCount??0,t.promptCountAtLastCommit=n.promptCountAtLastCommit??0,t.permissionPromptCount=n.permissionPromptCount??0,t.permissionPromptCountAtLastCommit=n.permissionPromptCountAtLastCommit??0,t.escapeCount=n.escapeCount??0,t.escapeCountAtLastCommit=n.escapeCountAtLastCommit??0,t}function V(e,t){t(B(e))}function H(e,t){let n={...e,promptCount:e.promptCount+1};return t(z(n,w())),n}var U,W,G,K=e((()=>{t(),i(),o(),m(),s(),j(),c(),l(),h(),
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nt as r}from"./state-ix0xIunV.js";import{n as i,t as a}from"./cwd-CYmmnQVS.js";import{a as o,p as s}from"./debug-BrXObCdR.js";import{T as c,_ as l,g as u,r as d,w as f}from"./git-Do0wJvux.js";import{n as p,r as m}from"./execFileNoThrow-D244NytW.js";import{o as h}from"./log-BMCygSzM.js";import{_ as g,mi as _,pi as v}from"./model-CKkOnnnx.js";import{basename as y,extname as b,join as x,posix as S,sep as C}from"path";import{randomUUID as w}from"crypto";import{stat as T}from"fs/promises";function E(e){let t=S.sep+e.split(C).join(S.sep).replace(/^\/+/,``),n=y(e).toLowerCase(),r=b(e).toLowerCase();if(D.has(n)||O.has(r))return!0;let i=n.split(`.`);if(i.length>2){let e=`.`+i.slice(-2).join(`.`);if(O.has(e))return!0}for(let e of k)if(t.includes(e))return!0;for(let e of A)if(e.test(n))return!0;return!1}var D,O,k,A,j=e((()=>{D=new Set([`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,`bun.lockb`,`bun.lock`,`composer.lock`,`gemfile.lock`,`cargo.lock`,`poetry.lock`,`pipfile.lock`,`shrinkwrap.json`,`npm-shrinkwrap.json`]),O=new Set([`.lock`,`.min.js`,`.min.css`,`.min.html`,`.bundle.js`,`.bundle.css`,`.generated.ts`,`.generated.js`,`.d.ts`]),k=[`/dist/`,`/build/`,`/out/`,`/output/`,`/node_modules/`,`/vendor/`,`/vendored/`,`/third_party/`,`/third-party/`,`/external/`,`/.next/`,`/.nuxt/`,`/.svelte-kit/`,`/coverage/`,`/__pycache__/`,`/.tox/`,`/venv/`,`/.venv/`,`/target/release/`,`/target/debug/`],A=[/^.*\.min\.[a-z]+$/i,/^.*-min\.[a-z]+$/i,/^.*\.bundle\.[a-z]+$/i,/^.*\.generated\.[a-z]+$/i,/^.*\.gen\.[a-z]+$/i,/^.*\.auto\.[a-z]+$/i,/^.*_generated\.[a-z]+$/i,/^.*_gen\.[a-z]+$/i,/^.*\.pb\.(go|js|ts|py|rb)$/i,/^.*_pb2?\.py$/i,/^.*\.pb\.h$/i,/^.*\.grpc\.[a-z]+$/i,/^.*\.swagger\.[a-z]+$/i,/^.*\.openapi\.[a-z]+$/i]}));function M(){return d(a())??r()}function N(){return W}function P(){return process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}function F(){return{fileStates:new Map,sessionBaselines:new Map,surface:P(),startingHeadSha:null,promptCount:0,promptCountAtLastCommit:0,permissionPromptCount:0,permissionPromptCountAtLastCommit:0,escapeCount:0,escapeCountAtLastCommit:0}}async function I(e,t){let r=M(),i=n(),a={},o=[],s=new Set,c={},l=0,u=0,d=new Map,f=new Map;for(let t of e){s.add(t.surface);let e=t.sessionBaselines instanceof Map?t.sessionBaselines:new Map(Object.entries(t.sessionBaselines??{}));for(let[t,n]of e)f.has(t)||f.set(t,n);let n=t.fileStates instanceof Map?t.fileStates:new Map(Object.entries(t.fileStates??{}));for(let[e,t]of n){let n=d.get(e);n?d.set(e,{...t,claudeContribution:n.claudeContribution+t.claudeContribution}):d.set(e,t)}}let p=await Promise.all(t.map(async t=>{if(E(t))return{type:`generated`,file:t};let n=x(r,t),i=d.get(t),a=f.get(t),o=e[0].surface,s=0,c=0;if(await R(t))if(i)s=i.claudeContribution,c=0;else{let e=await L(t);c=e>0?e:100}else try{let e=await T(n);if(i)s=i.claudeContribution,c=0;else if(a){let n=await L(t);c=n>0?n:e.size}else c=e.size}catch{return null}s=Math.max(0,s),c=Math.max(0,c);let l=s+c,u=l>0?Math.round(s/l*100):0;return{type:`file`,file:t,claudeChars:s,humanChars:c,percent:u,surface:o}}));for(let e of p)if(e){if(e.type===`generated`){o.push(e.file);continue}a[e.file]={claudeChars:e.claudeChars,humanChars:e.humanChars,percent:e.percent,surface:e.surface},l+=e.claudeChars,u+=e.humanChars,c[e.surface]=(c[e.surface]??0)+e.claudeChars}let m=l+u,h=m>0?Math.round(l/m*100):0,g={};for(let[e,t]of Object.entries(c))g[e]={claudeChars:t,percent:m>0?Math.round(t/m*100):0};return{version:1,summary:{claudePercent:h,claudeChars:l,humanChars:u,surfaces:Array.from(s)},files:a,surfaceBreakdown:g,excludedGenerated:o,sessions:[i]}}async function L(e){let t=M();try{let n=await p(u(),[`diff`,`--cached`,`--stat`,`--`,e],{cwd:t,timeout:5e3});if(n.code!==0||!n.stdout)return 0;let r=n.stdout.split(`
|
|
2
|
+
`).filter(Boolean),i=0;for(let e of r)if(e.includes(`file changed`)||e.includes(`files changed`)){let t=e.match(/(\d+) insertions?/),n=e.match(/(\d+) deletions?/),r=t?parseInt(t[1],10):0,a=n?parseInt(n[1],10):0;i+=(r+a)*40}return i}catch{return 0}}async function R(e){let t=M();try{let n=await p(u(),[`diff`,`--cached`,`--name-status`,`--`,e],{cwd:t,timeout:5e3});if(n.code===0&&n.stdout)return n.stdout.trim().startsWith(`D `)}catch{}return!1}function z(e,t){let n={};for(let[t,r]of e.fileStates)n[t]=r;return{type:`attribution-snapshot`,messageId:t,surface:e.surface,fileStates:n,promptCount:e.promptCount,promptCountAtLastCommit:e.promptCountAtLastCommit,permissionPromptCount:e.permissionPromptCount,permissionPromptCountAtLastCommit:e.permissionPromptCountAtLastCommit,escapeCount:e.escapeCount,escapeCountAtLastCommit:e.escapeCountAtLastCommit}}function B(e){let t=F(),n=e[e.length-1];if(!n)return t;t.surface=n.surface;for(let[e,r]of Object.entries(n.fileStates))t.fileStates.set(e,r);return t.promptCount=n.promptCount??0,t.promptCountAtLastCommit=n.promptCountAtLastCommit??0,t.permissionPromptCount=n.permissionPromptCount??0,t.permissionPromptCountAtLastCommit=n.permissionPromptCountAtLastCommit??0,t.escapeCount=n.escapeCount??0,t.escapeCountAtLastCommit=n.escapeCountAtLastCommit??0,t}function V(e,t){t(B(e))}function H(e,t){let n={...e,promptCount:e.promptCount+1};return t(z(n,w())),n}var U,W,G,K=e((()=>{t(),i(),o(),m(),s(),j(),c(),l(),h(),g(),v(),U=`github.com:anthropics/claude-cli-internal,github.com/anthropics/claude-cli-internal,github.com:anthropics/anthropic,github.com/anthropics/anthropic,github.com:anthropics/apps,github.com/anthropics/apps,github.com:anthropics/casino,github.com/anthropics/casino,github.com:anthropics/dbt,github.com/anthropics/dbt,github.com:anthropics/dotfiles,github.com/anthropics/dotfiles,github.com:anthropics/terraform-config,github.com/anthropics/terraform-config,github.com:anthropics/hex-export,github.com/anthropics/hex-export,github.com:anthropics/feedback-v2,github.com/anthropics/feedback-v2,github.com:anthropics/labs,github.com/anthropics/labs,github.com:anthropics/argo-rollouts,github.com/anthropics/argo-rollouts,github.com:anthropics/starling-configs,github.com/anthropics/starling-configs,github.com:anthropics/ts-tools,github.com/anthropics/ts-tools,github.com:anthropics/ts-capsules,github.com/anthropics/ts-capsules,github.com:anthropics/feldspar-testing,github.com/anthropics/feldspar-testing,github.com:anthropics/trellis,github.com/anthropics/trellis,github.com:anthropics/claude-for-hiring,github.com/anthropics/claude-for-hiring,github.com:anthropics/forge-web,github.com/anthropics/forge-web,github.com:anthropics/infra-manifests,github.com/anthropics/infra-manifests,github.com:anthropics/mycro_manifests,github.com/anthropics/mycro_manifests,github.com:anthropics/mycro_configs,github.com/anthropics/mycro_configs,github.com:anthropics/mobile-apps,github.com/anthropics/mobile-apps`.split(`,`),W=null,G=_(async()=>{if(W!==null)return W===`internal`;let e=await f(M());if(!e)return W=`none`,!1;let t=U.some(t=>e.includes(t));return W=t?`internal`:`external`,t})}));export{P as a,H as c,G as d,B as f,M as i,K as l,I as n,L as o,z as p,F as r,N as s,V as t,R as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,ui as n}from"./src-CDCSSo0U2.js";import{en as r,rn as i}from"./state-ix0xIunV.js";import{Ao as a,DS as o,ES as s,Gu as c,KE as l,ME as u,NE as d,Sl as f,Wu as p,XE as m,ZE as h,_l as g,bE as _,dl as v,eD as y,fh as b,hl as x,jE as S,ll as C,lt as w,mE as T,ph as E,qE as D,tD as O,ut as k,vl as A,xl as j,yl as M,yn as N,zo as P}from"./loadAgentsDir-D206qwP3.js";import{R as F,z as I}from"./debug-BrXObCdR.js";import{o as L,s as R}from"./log-BMCygSzM.js";function z(e,t){let r=b(`tip`),i=s(`app:toggleTranscript`,`Global`,`ctrl+o`),a=[...e.options.verbose?[]:[`(${i} to see full summary)`],...t?[t]:[],...r?[r]:[]];return n.dim(`Compacted `+a.join(`
|
|
2
|
+
`))}async function B(e,t){let n=e.getAppState(),r=await w(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=p({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([u(),S()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{t(),r(),k(),d(),o(),y(),f(),m(),l(),x(),C(),T(),I(),N(),L(),P(),E(),c(),V=async(e,t)=>{let{abortController:n}=t,{messages:r}=t;if(r=a(r),r.length===0)throw Error(`No messages to compact`);let o=e.trim();try{if(!o){let e=await v(r,t.agentId);if(e)return u.cache.clear?.(),g(),O(t.options.querySource??`compact`,t.agentId),i(),h(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await D(r,t)).messages,n=await j(e,t,await B(t,e),!1,o,!1);return _(void 0),h(),u.cache.clear?.(),g(),{type:`compact`,compactionResult:n,displayText:z(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(M):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(A):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./loadAgentsDir-D206qwP3.js";import{b as e,c as t,g as n,n as r,o as i,r as a,y as o}from"./config-DmomySWC.js";n();export{r as checkHasTrustDialogAccepted,a as enableConfigs,i as getCurrentProjectConfig,t as getGlobalConfig,o as saveCurrentProjectConfig,e as saveGlobalConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,l as c,n as l,o as u}from"./envUtils-DSxRz_kt.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{Ai as f,Br as p,Di as m,Ei as h,Fi as g,Fr as _,Hr as v,Kr as ee,Pi as te,Pr as ne,Rr as re,Ti as ie,Ur as ae,Vr as oe,en as se,ji as ce,nt as le,ot as y,qr as ue,vi as de,vt as fe,wi as pe,yi as me,zr as he}from"./state-ix0xIunV.js";import{n as ge,t as _e}from"./cwd-CYmmnQVS.js";import{C as ve,I as b,S as ye,a as be,d as x,k as xe,l as S,nt as Se,p as Ce,rt as we,w as C,z as Te}from"./debug-BrXObCdR.js";import{Bn as Ee,Kn as De,Qt as Oe,Vn as ke,Xn as Ae,Yt as w,Zn as je,Zt as Me,c as T,en as Ne,g as Pe,n as Fe,qn as Ie}from"./settings-DfWP5y6X.js";import{M as Le,_ as Re,j as ze,n as Be}from"./git-Do0wJvux.js";import{d as Ve,o as He,s as Ue,u as We}from"./log-BMCygSzM.js";import{m as Ge}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{a as E,i as Ke}from"./path-D5U-tm91.js";import{C as qe,f as Je}from"./file-DcZWPH2V.js";import{f as Ye,p as Xe,s as Ze,u as Qe}from"./types-C-MRCL8J.js";import{n as $e,r as D}from"./analytics-BotDBGh0.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as nt,resolve as rt,sep as it}from"path";import{unwatchFile as at,watchFile as ot}from"fs";import{randomBytes as st}from"crypto";var j,ct=t((()=>{g(),ke(),ie(),h(),j=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)te(t,pe(e)),e=Ee(e);return t}:m}));function lt(e){return f(e,Ie,j)}var ut=t((()=>{ce(),ct(),De()}));function dt(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(c(e))return!1;if(s(e))return!0;if(c(process.env.CLAUDE_CODE_SIMPLE)||c(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=Fe();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function ft(){return!1}function pt(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:l()}function mt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=nt(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=nt(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+it).normalize(`NFC`)}function ht(){return mt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function gt(){return mt(T(`policySettings`)?.autoMemoryDirectory??T(`flagSettings`)?.autoMemoryDirectory??T(`localSettings`)?.autoMemoryDirectory??T(`userSettings`)?.autoMemoryDirectory,!0)}function _t(){return ht()!==void 0}function vt(){return Be(y())??y()}function yt(){return A(M(),St)}function bt(e){return nt(e).startsWith(M())}var xt,St,M,Ct=t((()=>{o(),se(),u(),Re(),Ke(),Pe(),xt=`memory`,St=`MEMORY.md`,M=a(()=>(ht()??gt())||(A(A(pt(),`projects`),Ge(vt()),xt)+it).normalize(`NFC`),()=>y())}));function wt(e,t,n,i){if(!r(e))return e;t=v(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=oe(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:me(t[a+1])?[]:{})}Ae(c,l,u),c=c[l]}return e}var Tt=t((()=>{je(),ae(),de(),i(),p()}));function Et(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=re(e,o);n(s,o)&&wt(a,v(o,e),s)}return a}var Dt=t((()=>{he(),Tt(),ae()}));function N(e,t){if(e==null)return{};var n=ee(lt(e),function(e){return[e]});return t=ne(t),Et(e,n,function(e,n){return t(e,n[0])})}var Ot=t((()=>{ue(),_(),Dt(),ut()})),kt=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),At=n((e=>{var t=kt();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),jt=n(((e,t)=>{t.exports=At()})),Mt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Nt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=Mt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Pt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Ft=n(((t,n)=>{var r=e(`path`),i=d(),a=jt(),o=Nt(),s=Pt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),It=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Lt=n(((e,t)=>{var n=Ft(),{toPromise:r,toSync:i,toSyncOptions:a}=It();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function P(){return F||(F=Lt()),F}function Rt(e,t){return P().lock(e,t)}function zt(e,t){return P().lockSync(e,t)}function Bt(e,t){return P().unlock(e,t)}function Vt(e,t){return P().check(e,t)}var F,Ht=t((()=>{}));function I(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Ut(){return G||(G=Wt())}function Wt(){if(fe())return!0;let e=B(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=E(_e());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=E(rt(n,`..`));if(t===n)break;n=t}return!1}function L(e){let t=K.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function R(e){let t=null;try{$t(w(),I,n=>{let r=e(n);return r===n?n:(t={...r,projects:Jt(n.projects)},t)})&&t&&z(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=V(w(),I);if(L(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Jt(r.projects)},Qt(w(),t,W),z(t)}}function Gt(){return X}function Kt(){let e=J+Y;e>0&&D(`tengu_config_cache_stats`,{cache_hits:J,cache_misses:Y,hit_rate:J/e}),J=0,Y=0}function qt(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Jt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Yt(){if(Z)return;Z=!0;let e=w();ot(e,{interval:hn,persistent:!1},t=>{t.mtimeMs<=K.mtime||x().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=Qe(Xe(e));typeof n!=`object`||!n||(K={config:qt({...I(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),we(async()=>{at(e),Z=!1})}function z(e){K={config:e,mtime:Date.now()},q=null}function B(){if(K.config)return J++,K.config;Y++;try{let e=null;try{e=x().statSync(w())}catch{}let t=qt(V(w(),I));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,Yt(),t}catch{return qt(V(w(),I))}}function Xt(){let e=B().remoteControlAtStartup;return e!==void 0&&e}function Zt(e){let t=B();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Qt(e,t,n){let r=k(e);x().mkdirSync(r),qe(e,C(N(t,(e,t)=>C(e)!==C(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++}function $t(e,t,n){let r=t(),i=k(e),a=x();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=zt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Claude instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),q&&e===w())try{let t=a.statSync(e);(t.mtimeMs!==q.mtime||t.size!==q.size)&&D(`tengu_config_stale_write`,{read_mtime:q.mtime,write_mtime:t.mtimeMs,read_size:q.size,write_size:t.size})}catch(e){if(b(e)!==`ENOENT`)throw e}let l=V(e,t);if(e===w()&&L(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=N(u,(e,t)=>C(e)!==C(r[t]));try{let t=O(e),n=tn();try{a.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){b(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return qe(e,C(d,null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++,!0}finally{o&&o()}}function en(){if(Q)return;let e=Date.now();Le(`info`,`enable_configs_started`),Q=!0,V(w(),I,!0),Le(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function tn(){return A(l(),`backups`)}function nn(e){let t=x(),n=O(e),r=tn();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function V(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=x();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=ve(Xe(n));return{...t(),...e}}catch(n){throw new xe(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=nn(e);return n&&process.stderr.write(`\nClaude configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof xe&&n)throw i;if(i instanceof xe){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!H){H=!0;try{Ue(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{H=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=tn();try{r.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=nn(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,l as c,n as l,o as u}from"./envUtils-DSxRz_kt.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{Ai as f,Br as p,Di as m,Ei as h,Fi as g,Fr as _,Hr as v,Kr as ee,Pi as te,Pr as ne,Rr as re,Ti as ie,Ur as ae,Vr as oe,en as se,ji as ce,nt as le,ot as y,qr as ue,vi as de,vt as fe,wi as pe,yi as me,zr as he}from"./state-ix0xIunV.js";import{n as ge,t as _e}from"./cwd-CYmmnQVS.js";import{C as ve,I as b,S as ye,a as be,d as x,k as xe,l as S,nt as Se,p as Ce,rt as we,w as C,z as Te}from"./debug-BrXObCdR.js";import{Bn as Ee,Kn as De,Qt as Oe,Vn as ke,Xn as Ae,Yt as w,Zn as je,Zt as Me,c as T,en as Ne,g as Pe,n as Fe,qn as Ie}from"./settings-BovzmwMP.js";import{M as Le,_ as Re,j as ze,n as Be}from"./git-Do0wJvux.js";import{d as Ve,o as He,s as Ue,u as We}from"./log-BMCygSzM.js";import{m as Ge}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{a as E,i as Ke}from"./path-D5U-tm91.js";import{C as qe,f as Je}from"./file-DcZWPH2V.js";import{f as Ye,p as Xe,s as Ze,u as Qe}from"./types-C-MRCL8J.js";import{n as $e,r as D}from"./analytics-BotDBGh0.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as nt,resolve as rt,sep as it}from"path";import{unwatchFile as at,watchFile as ot}from"fs";import{randomBytes as st}from"crypto";var j,ct=t((()=>{g(),ke(),ie(),h(),j=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)te(t,pe(e)),e=Ee(e);return t}:m}));function lt(e){return f(e,Ie,j)}var ut=t((()=>{ce(),ct(),De()}));function dt(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(c(e))return!1;if(s(e))return!0;if(c(process.env.CLAUDE_CODE_SIMPLE)||c(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=Fe();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function ft(){return!1}function pt(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:l()}function mt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=nt(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=nt(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+it).normalize(`NFC`)}function ht(){return mt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function gt(){return mt(T(`policySettings`)?.autoMemoryDirectory??T(`flagSettings`)?.autoMemoryDirectory??T(`localSettings`)?.autoMemoryDirectory??T(`userSettings`)?.autoMemoryDirectory,!0)}function _t(){return ht()!==void 0}function vt(){return Be(y())??y()}function yt(){return A(M(),St)}function bt(e){return nt(e).startsWith(M())}var xt,St,M,Ct=t((()=>{o(),se(),u(),Re(),Ke(),Pe(),xt=`memory`,St=`MEMORY.md`,M=a(()=>(ht()??gt())||(A(A(pt(),`projects`),Ge(vt()),xt)+it).normalize(`NFC`),()=>y())}));function wt(e,t,n,i){if(!r(e))return e;t=v(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=oe(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:me(t[a+1])?[]:{})}Ae(c,l,u),c=c[l]}return e}var Tt=t((()=>{je(),ae(),de(),i(),p()}));function Et(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=re(e,o);n(s,o)&&wt(a,v(o,e),s)}return a}var Dt=t((()=>{he(),Tt(),ae()}));function N(e,t){if(e==null)return{};var n=ee(lt(e),function(e){return[e]});return t=ne(t),Et(e,n,function(e,n){return t(e,n[0])})}var Ot=t((()=>{ue(),_(),Dt(),ut()})),kt=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),At=n((e=>{var t=kt();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),jt=n(((e,t)=>{t.exports=At()})),Mt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Nt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=Mt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Pt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Ft=n(((t,n)=>{var r=e(`path`),i=d(),a=jt(),o=Nt(),s=Pt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),It=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Lt=n(((e,t)=>{var n=Ft(),{toPromise:r,toSync:i,toSyncOptions:a}=It();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function P(){return F||(F=Lt()),F}function Rt(e,t){return P().lock(e,t)}function zt(e,t){return P().lockSync(e,t)}function Bt(e,t){return P().unlock(e,t)}function Vt(e,t){return P().check(e,t)}var F,Ht=t((()=>{}));function I(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Ut(){return G||(G=Wt())}function Wt(){if(fe())return!0;let e=B(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=E(_e());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=E(rt(n,`..`));if(t===n)break;n=t}return!1}function L(e){let t=K.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function R(e){let t=null;try{$t(w(),I,n=>{let r=e(n);return r===n?n:(t={...r,projects:Jt(n.projects)},t)})&&t&&z(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=V(w(),I);if(L(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Jt(r.projects)},Qt(w(),t,W),z(t)}}function Gt(){return X}function Kt(){let e=J+Y;e>0&&D(`tengu_config_cache_stats`,{cache_hits:J,cache_misses:Y,hit_rate:J/e}),J=0,Y=0}function qt(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Jt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Yt(){if(Z)return;Z=!0;let e=w();ot(e,{interval:hn,persistent:!1},t=>{t.mtimeMs<=K.mtime||x().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=Qe(Xe(e));typeof n!=`object`||!n||(K={config:qt({...I(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),we(async()=>{at(e),Z=!1})}function z(e){K={config:e,mtime:Date.now()},q=null}function B(){if(K.config)return J++,K.config;Y++;try{let e=null;try{e=x().statSync(w())}catch{}let t=qt(V(w(),I));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,Yt(),t}catch{return qt(V(w(),I))}}function Xt(){let e=B().remoteControlAtStartup;return e!==void 0&&e}function Zt(e){let t=B();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Qt(e,t,n){let r=k(e);x().mkdirSync(r),qe(e,C(N(t,(e,t)=>C(e)!==C(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++}function $t(e,t,n){let r=t(),i=k(e),a=x();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=zt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Claude instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),q&&e===w())try{let t=a.statSync(e);(t.mtimeMs!==q.mtime||t.size!==q.size)&&D(`tengu_config_stale_write`,{read_mtime:q.mtime,write_mtime:t.mtimeMs,read_size:q.size,write_size:t.size})}catch(e){if(b(e)!==`ENOENT`)throw e}let l=V(e,t);if(e===w()&&L(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=N(u,(e,t)=>C(e)!==C(r[t]));try{let t=O(e),n=tn();try{a.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){b(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return qe(e,C(d,null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++,!0}finally{o&&o()}}function en(){if(Q)return;let e=Date.now();Le(`info`,`enable_configs_started`),Q=!0,V(w(),I,!0),Le(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function tn(){return A(l(),`backups`)}function nn(e){let t=x(),n=O(e),r=tn();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function V(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=x();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=ve(Xe(n));return{...t(),...e}}catch(n){throw new xe(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=nn(e);return n&&process.stderr.write(`\nClaude configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof xe&&n)throw i;if(i instanceof xe){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!H){H=!0;try{Ue(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{H=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=tn();try{r.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=nn(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
|
|
2
2
|
`),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
|
|
3
3
|
`)}return t()}}function rn(){let e=$(),t=B();if(!t.projects)return U;let n=t.projects[e]??U;return typeof n.allowedTools==`string`&&(n.allowedTools=Qe(n.allowedTools)??[]),n}function an(e){let t=$(),n=null;try{$t(w(),I,r=>{let i=r.projects?.[t]??U,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&z(n)}catch(r){S(`Failed to save config with lock: ${r}`,{level:`error`});let i=V(w(),I);if(L(i)){S(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??U,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Qt(w(),n,W),z(n)}}function on(){return ln()!==null}function sn(){return on()&&!c(process.env.FORCE_AUTOUPDATE_PLUGINS)}function cn(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function ln(){if(!c(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(c(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=We();if(e)return{type:`env`,envVar:e};let t=B();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function un(){let e=B();if(e.userID)return e.userID;let t=st(32).toString(`hex`);return R(e=>({...e,userID:t})),t}function dn(){if(!B().firstStartTime){let e=new Date().toISOString();R(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function fn(e){let t=le();switch(e){case`User`:return A(l(),`CLAUDE.md`);case`Local`:return A(t,`CLAUDE.local.md`);case`Project`:return A(t,`CLAUDE.md`);case`Managed`:return A(Oe(),`CLAUDE.md`);case`AutoMem`:return yt();default:return A(l(),`CLAUDE.md`)}}function pn(){return A(Oe(),`.claude`,`rules`)}function mn(){return A(l(),`rules`)}var H,U,W,G,K,q,J,Y,X,hn,Z,Q,$,gn=t((()=>{o(),Ot(),se(),Ct(),$e(),ge(),Se(),be(),ze(),Me(),u(),Te(),Je(),Ce(),Re(),Ze(),Ye(),Ht(),He(),Ke(),Ve(),Ne(),ye(),H=!1,U={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1},W=I(),G=!1,{...W},{...U},K={config:null,mtime:0},q=null,J=0,Y=0,X=0,we(async()=>{Kt()}),hn=1e3,Z=!1,Q=!1,$=a(()=>{let e=le();return E(Be(e)||rt(e))})}));export{yt as A,j as B,Ht as C,N as D,Ot as E,bt as F,dt as I,ft as L,pt as M,_t as N,wt as O,Ct as P,lt as R,Vt as S,Bt as T,ct as V,on as _,ln as a,R as b,B as c,fn as d,un as f,gn as g,mn as h,cn as i,M as j,Tt as k,Gt as l,Xt as m,Ut as n,rn as o,$ as p,en as r,Zt as s,W as t,pn as u,dn as v,Rt as w,sn as x,an as y,ut as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-XKw6FI_m.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
|