@readmagic/workmate 0.0.8 → 0.0.10
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-Vmmm7p1c.js +1 -0
- package/dist/chunks/App-C2yQjBgY.js +1 -0
- package/dist/chunks/ApproveApiKey-CKbv5C1x.js +1 -0
- package/dist/chunks/ApproveApiKey-MscC-ssL.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-CL5NWsFL.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-CLSACUmo.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-BqNxQOXJ.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-C0-psohX.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-4mOvEer_.js +1 -0
- package/dist/chunks/DiffDialog-9AYwtupw.js +6 -0
- package/dist/chunks/Doctor-DmgAwce2.js +1 -0
- package/dist/chunks/Doctor-jEs9chPk.js +3 -0
- package/dist/chunks/ExitFlow-DVKxFdpX.js +2 -0
- package/dist/chunks/Grove-B9-hhkZA.js +11 -0
- package/dist/chunks/{HybridTransport-BJPOG2wl.js → HybridTransport-MxJ_W_np.js} +3 -3
- package/dist/chunks/InvalidConfigDialog-o9DF1REI.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-YyQcHocx.js +1 -0
- package/dist/chunks/MCPConnectionManager-CUTuaa8T.js +1 -0
- package/dist/chunks/MCPToolListView-CvqB4nCw.js +1 -0
- package/dist/chunks/McpParsingWarnings-BCpfHaBK.js +1 -0
- package/dist/chunks/MessageSelector-BLzw172f.js +3 -0
- package/dist/chunks/Messages-4K5sLmNh.js +11 -0
- package/dist/chunks/Onboarding-ClwHS5rh.js +1 -0
- package/dist/chunks/{PermissionDialog-0ya1CU5k.js → PermissionDialog-Cb3z8OUP.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-Dl9Hg9Mf.js → PressEnterToContinue-Dq0Imo9c.js} +1 -1
- package/dist/chunks/PromptInputFooterSuggestions-BSA9NrZc.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-Bb4KdIX_.js +1 -0
- package/dist/chunks/QueryEngine-DPHLSsax.js +1 -0
- package/dist/chunks/REPL-Bf46iQCN.js +1 -0
- package/dist/chunks/REPL-DIaAo9M9.js +133 -0
- package/dist/chunks/RemoteSessionManager-CS6mywIn.js +2 -0
- package/dist/chunks/ResumeConversation-Br2KsBoe.js +1 -0
- package/dist/chunks/{SSETransport-CrwbKuVt.js → SSETransport-CoxQ8YpH.js} +1 -1
- package/dist/chunks/{SearchBox-vfLXEPed.js → SearchBox-C9vUA4IM.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-i_YO3QvV.js +1 -0
- package/dist/chunks/Settings-BMXysXIx.js +2 -0
- package/dist/chunks/TeleportProgress-Doucj-50.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-B5I73j7Y.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-D6kpr2c6.js +1 -0
- package/dist/chunks/ThemePicker-DrC8tlp0.js +1 -0
- package/dist/chunks/{TrustDialog-BukWGvHZ.js → TrustDialog-Fk4m_Sy4.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-DokTJQwi.js → ValidationErrorsList-D_OUa4RT.js} +1 -1
- package/dist/chunks/WelcomeV2-DvfQHnZY.js +1 -0
- package/dist/chunks/add-dir-CZ6Clvq8.js +1 -0
- package/dist/chunks/{agentDisplay-DBQYOaOh.js → agentDisplay-B755vMZE.js} +1 -1
- package/dist/chunks/{agents-HlKk68Qc.js → agents-CIvP8l0s.js} +1 -1
- package/dist/chunks/agents-DHnNg4h6.js +103 -0
- package/dist/chunks/allErrors-CU89tF-z.js +1 -0
- package/dist/chunks/analytics-DJobLaWP.js +1 -0
- package/dist/chunks/api-BSeE6MwB.js +1 -0
- package/dist/chunks/{api-CF5IVtj0.js → api-nSHc_GIQ.js} +1 -1
- package/dist/chunks/auth-5QB6tsfB.js +15 -0
- package/dist/chunks/auth-BIGJth5U.js +1 -0
- package/dist/chunks/auth-CDQMhIZP.js +1 -0
- package/dist/chunks/{autoMode-Cr0AhS1G.js → autoMode-BnUiK9Cu.js} +4 -4
- package/dist/chunks/{autonomy-ARUQt-Lu.js → autonomy-C1aSgWPQ.js} +1 -1
- package/dist/chunks/autonomy-Src6sKCp.js +15 -0
- package/dist/chunks/{autonomyPanel-BQK9MoeB.js → autonomyPanel-DnHpuiy4.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-B-cw0UcS.js +17 -0
- package/dist/chunks/backgroundHousekeeping-BS_8z3_x.js +1 -0
- package/dist/chunks/{banner-Ca7rki2V.js → banner-D0P7wXdw.js} +1 -1
- package/dist/chunks/bg-50rllUNh.js +1 -0
- package/dist/chunks/{bg-DxRHF1yn.js → bg-DAPORXF3.js} +2 -2
- package/dist/chunks/branch-DFWa4Oxo.js +3 -0
- package/dist/chunks/{break-cache-BKvoMOZx.js → break-cache-Chj9i9MP.js} +2 -2
- package/dist/chunks/{bridgeConfig-jDEva6Eh.js → bridgeConfig-Bb6URf4Q.js} +1 -1
- package/dist/chunks/bridgeConfig-BeqChxJC.js +1 -0
- package/dist/chunks/bridgeMessaging-C3huGcR3.js +1 -0
- package/dist/chunks/{bridgePointer-DIM0sj0x.js → bridgePointer-DLYyvRKb.js} +1 -1
- package/dist/chunks/bridgeStatusUtil-DFMftajD.js +1 -0
- package/dist/chunks/btw-DSK9R2C8.js +1 -0
- package/dist/chunks/caches-BTQAW9zc.js +1 -0
- package/dist/chunks/caches-BVtSCnV1.js +1 -0
- package/dist/chunks/{capacityWake-CKOiRELo.js → capacityWake-amzeeBz0.js} +1 -1
- package/dist/chunks/{ccrClient-BC2q3k44.js → ccrClient-Bu7Tf1Z5.js} +1 -1
- package/dist/chunks/{claudeDesktop-DQXL5bGm.js → claudeDesktop-CsJfF1b-.js} +1 -1
- package/dist/chunks/{clear-1etSJhdg.js → clear-ClFDpWVJ.js} +1 -1
- package/dist/chunks/{cliLaunch-CQjLYRzM.js → cliLaunch-BWcoyZDP.js} +1 -1
- package/dist/chunks/client-BWQ4-rN7.js +1 -0
- package/dist/chunks/{client-DQwf_b9o.js → client-DFlE4fYh.js} +1 -1
- package/dist/chunks/client-c-3-PW1F.js +1 -0
- package/dist/chunks/commands-Bi7k3Wg-.js +1 -0
- package/dist/chunks/compact-J-h0Yf4b.js +2 -0
- package/dist/chunks/config-CVHMRMwd.js +1 -0
- package/dist/chunks/config-Do1870_d.js +3 -0
- package/dist/chunks/config-yyFe87vW.js +1 -0
- package/dist/chunks/context-Tb1Ca2Q-.js +1 -0
- package/dist/chunks/{context-noninteractive-Ct_ttQfP.js → context-noninteractive-D5iQhasu.js} +2 -2
- package/dist/chunks/context-noninteractive-soPYKAc9.js +1 -0
- package/dist/chunks/conversation-CSEtUxOY.js +1 -0
- package/dist/chunks/conversation-Dk1WDQuN.js +1 -0
- package/dist/chunks/{createSSHSession-BmHXA2me.js → createSSHSession-CJtzNQdZ.js} +1 -1
- package/dist/chunks/{createSession-C4rukWkv.js → createSession-DkT1GL8y.js} +1 -1
- package/dist/chunks/createSession-eE8mswkv.js +1 -0
- package/dist/chunks/crossProjectResume-04n3Ppy9.js +40 -0
- package/dist/chunks/cwd-Cfdf7z7s.js +1 -0
- package/dist/chunks/cwd-ClLru_7T.js +1 -0
- package/dist/chunks/datadog-DjeJThpV.js +1 -0
- package/dist/chunks/{debug-RZ4NuXyS.js → debug-RAynG_nM.js} +4 -4
- package/dist/chunks/{debugUtils-D30M1cbN.js → debugUtils-DX0KAXNK.js} +1 -1
- package/dist/chunks/{detached-jrVP11oU.js → detached-X_yjYR7x.js} +1 -1
- package/dist/chunks/{detectRepository-CFiHe6Rv.js → detectRepository-DgpNd87p.js} +1 -1
- package/dist/chunks/detectRepository-ctF9KDbb.js +1 -0
- package/dist/chunks/{diff-BKiK3xHv.js → diff-jEJJe58I.js} +1 -1
- package/dist/chunks/directoryCompletion-BbXR2bfy.js +1 -0
- package/dist/chunks/doctor-B-Wag4C1.js +1 -0
- package/dist/chunks/earlyInput-BEjRkAtH.js +1 -0
- package/dist/chunks/{earlyInput-BTC_Wucv.js → earlyInput-IghoCjG5.js} +1 -1
- package/dist/chunks/entry-oIqjxIjQ.js +14 -0
- package/dist/chunks/envUtils-BDhHQY0-.js +1 -0
- package/dist/chunks/esm-Cf4nSRjF.js +1 -0
- package/dist/chunks/{execFileNoThrow-CCX-JY8h.js → execFileNoThrow-Dwu6psHW.js} +1 -1
- package/dist/chunks/{execSyncWrapper-dhRSYGFW.js → execSyncWrapper-BTZJjCuv.js} +1 -1
- package/dist/chunks/exit-BtW7LfRX.js +1 -0
- package/dist/chunks/extraUsage-Mi66JwFZ.js +1 -0
- package/dist/chunks/extractMemories-CUrdiNcr.js +1 -0
- package/dist/chunks/fast-BU4iUZ8E.js +1 -0
- package/dist/chunks/fast-C60p6AqJ.js +1 -0
- package/dist/chunks/featureCheck-D6FjD-nt.js +1 -0
- package/dist/chunks/featureCheck-JOur3pHb.js +1 -0
- package/dist/chunks/fileSuggestions-BMfQIDdW.js +3 -0
- package/dist/chunks/firstPartyEventLogger-B3cXgR67.js +5 -0
- package/dist/chunks/firstPartyEventLogger-BfCYN7lt.js +1 -0
- package/dist/chunks/flushGate-DgSDVGKZ.js +1 -0
- package/dist/chunks/{fpsMetrics-Cf_hdtiJ.js → fpsMetrics-DffAomdg.js} +1 -1
- package/dist/chunks/gemini-BwvSxGgn.js +1 -0
- package/dist/chunks/generateSessionName-DlrdedOk.js +1 -0
- package/dist/chunks/{genericProcessUtils-DVfMHhfy.js → genericProcessUtils-CmsUPyRz.js} +1 -1
- package/dist/chunks/{git-BerW9bId.js → git-2c7WlGDL.js} +1 -1
- package/dist/chunks/git-XtKbtJMc.js +1 -0
- package/dist/chunks/githubRepoPathMapping-DbWG4hFQ.js +1 -0
- package/dist/chunks/goal-ZmSRBx4q.js +3 -0
- package/dist/chunks/grok-BXMvezWb.js +1 -0
- package/dist/chunks/grove-CeOjTaY6.js +7 -0
- package/dist/chunks/help-5DNZO6_H.js +1 -0
- package/dist/chunks/{hooks-BZJTWD07.js → hooks-C637tFtd.js} +2 -2
- package/dist/chunks/hooks-DWg07LmS.js +1 -0
- package/dist/chunks/initReplBridge-D1h10vQ9.js +1 -0
- package/dist/chunks/{install-BI---dv0.js → install-C-6ItpH0.js} +1 -1
- package/dist/chunks/{instrumentation-CcWzhGfE.js → instrumentation-DaiPDUst.js} +4 -4
- package/dist/chunks/intl-D2kgJmX7.js +1 -0
- package/dist/chunks/{job-B0ftcqPF.js → job-BeYzQUiR.js} +1 -1
- package/dist/chunks/{jwtUtils-C0cE-1Ey.js → jwtUtils-CUPXdX3W.js} +1 -1
- package/dist/chunks/keybindings-DgIPdBy9.js +2 -0
- package/dist/chunks/launchLocalMemory-CE4J98xO.js +3 -0
- package/dist/chunks/launchOnboarding-BfTdC6vp.js +8 -0
- package/dist/chunks/{loadAgentsDir-ByO8eJqU.js → loadAgentsDir-C7lOqvfh.js} +2233 -2454
- package/dist/chunks/loadAgentsDir-zikjxLvn.js +1 -0
- package/dist/chunks/loadPluginHooks-Cp8MSwAc.js +1 -0
- package/dist/chunks/{localSearch-CHHCH16D.js → localSearch-BKrznW5x.js} +1 -1
- package/dist/chunks/localSearch-ZFyFy5FN.js +1 -0
- package/dist/chunks/log-CezCRpAN.js +1 -0
- package/dist/chunks/logoV2Utils-BkQfyQ1-.js +1 -0
- package/dist/chunks/{magicDocs-C5i5ruuU.js → magicDocs-BpVcON9o.js} +3 -3
- package/dist/chunks/main-9r5gLzUW.js +605 -0
- package/dist/chunks/{main-BLD4QAQg.js → main-CvOv59-7.js} +4 -4
- package/dist/chunks/managedEnv-B61yLpwp.js +1 -0
- package/dist/chunks/{managedEnv-C-9XSN14.js → managedEnv-DhWRJ5DK.js} +1 -1
- package/dist/chunks/{mappers-CHRFic5q.js → mappers-bOab8ipV.js} +1 -1
- package/dist/chunks/mcp-BckPBjaM.js +6 -0
- package/dist/chunks/mcp-CS1DA3JL.js +1 -0
- package/dist/chunks/mcp-VcGPYCkW.js +2 -0
- package/dist/chunks/{memoize-B8hfb1JN.js → memoize-DsqYrbeR.js} +1 -1
- package/dist/chunks/memory-C5ohwh-T.js +1 -0
- package/dist/chunks/{modalContext-DFjKLCB6.js → modalContext-CUThy6Ph.js} +1 -1
- package/dist/chunks/mode-DlKnUM8l.js +2 -0
- package/dist/chunks/model-BGu1AGq0.js +1 -0
- package/dist/chunks/model-BsZ4sP_H.js +1 -0
- package/dist/chunks/model-D19IIcll.js +1 -0
- package/dist/chunks/modelOptions-CxP067Qv.js +1 -0
- package/dist/chunks/nativeInstaller-QB8cEJ18.js +1 -0
- package/dist/chunks/oauth-BN2I0_jl.js +1 -0
- package/dist/chunks/oauth-C9VBDB0Y.js +1 -0
- package/dist/chunks/omit-DDUIPHnl.js +1 -0
- package/dist/chunks/onChangeAppState-RBl6H7ho.js +1 -0
- package/dist/chunks/{openai-DPH6rXOZ.js → openai-B9C2XN5Q.js} +3 -3
- package/dist/chunks/{panel-mD094ALT.js → panel-KW-wmEvU.js} +1 -1
- package/dist/chunks/{parser-dbHRgXb8.js → parser-BwPXQomy.js} +1 -1
- package/dist/chunks/parser-xSBaQRLH.js +1 -0
- package/dist/chunks/partition-D-UhsUCx.js +1 -0
- package/dist/chunks/permissions-BoLXYN1j.js +3 -0
- package/dist/chunks/pidLock-nJHbufJN.js +3 -0
- package/dist/chunks/plan-CyU2zrCK.js +1 -0
- package/dist/chunks/{platform-DCXXznJg.js → platform-BMPbglug.js} +1 -1
- package/dist/chunks/plugin-C6-GQke5.js +17 -0
- package/dist/chunks/pluginAutoupdate-SlRFJlTT.js +1 -0
- package/dist/chunks/{pluginBlocklist-PwHHD3nj.js → pluginBlocklist-n6Imlh3y.js} +1 -1
- package/dist/chunks/pluginCliCommands-Bd96zSOQ.js +1 -0
- package/dist/chunks/{pluginFlagging-pBxSselw.js → pluginFlagging-DZaYzecY.js} +1 -1
- package/dist/chunks/pluginOperations-D90IRawu.js +2 -0
- package/dist/chunks/pluginStartupCheck-Bxkxpm4k.js +1 -0
- package/dist/chunks/{pluginStartupCheck-Di4LjHXf.js → pluginStartupCheck-CB2q2dLv.js} +1 -1
- package/dist/chunks/plugins-B9eSjLSA.js +4 -0
- package/dist/chunks/poorMode-BAnubpn1.js +1 -0
- package/dist/chunks/{poorMode-CYXmr_mU.js → poorMode-DEwQOAJt.js} +1 -1
- package/dist/chunks/print-eCRv_Li-.js +26 -0
- package/dist/chunks/processBashCommand-B5F2Cl7K.js +1 -0
- package/dist/chunks/processSlashCommand-BC_D3cH5.js +5 -0
- package/dist/chunks/{projectContext-D9MDwJUF.js → projectContext-CIxul6vA.js} +1 -1
- package/dist/chunks/{projectContext-BaDZBAoK.js → projectContext-RUMJB798.js} +1 -1
- package/dist/chunks/prompt-C1JPqinc.js +1 -0
- package/dist/chunks/prompt-DZhBz_Vu.js +1 -0
- package/dist/chunks/prompt-M2lu8_Oa.js +139 -0
- package/dist/chunks/promptEditor-DhcZY-iu.js +4 -0
- package/dist/chunks/{protocolHandler-RNKkhq91.js → protocolHandler-CkFaJKKo.js} +1 -1
- package/dist/chunks/{proxy-BmtEnJ02.js → proxy-CuMaO_YV.js} +1 -1
- package/dist/chunks/reconciler-B4GDm_iC.js +1 -0
- package/dist/chunks/refresh-DBVizOzg.js +1 -0
- package/dist/chunks/{registerProtocol-DoKqmqu2.js → registerProtocol-CsNYRZKr.js} +1 -1
- package/dist/chunks/reload-plugins-B7JAE3b4.js +1 -0
- package/dist/chunks/{remoteBridgeCore-Cddqv2WW.js → remoteBridgeCore-CFLJhsB6.js} +1 -1
- package/dist/chunks/remoteManagedSettings-xh_MViZH.js +1 -0
- package/dist/chunks/rename-BCp2Vtqu.js +1 -0
- package/dist/chunks/{renderOptions-ChLwxtVu.js → renderOptions-Q5oCLFIC.js} +1 -1
- package/dist/chunks/resume-DVCSzKvv.js +2 -0
- package/dist/chunks/{ripgrep-gaT9Njwi.js → ripgrep-DvOOsDMv.js} +1 -1
- package/dist/chunks/ripgrep-e-iewvTf.js +1 -0
- package/dist/chunks/{runtimeObserver-Dbxxw4ls.js → runtimeObserver-CS_3BDNo.js} +4 -4
- package/dist/chunks/{runtimeObserver-CsIwinzh.js → runtimeObserver-DYUva6g-.js} +1 -1
- package/dist/chunks/sandbox-adapter-BFZFHplu.js +1 -0
- package/dist/chunks/sandbox-toggle--zNSKce_.js +1 -0
- package/dist/chunks/searchExtraTools-ui5y2VSE.js +1 -0
- package/dist/chunks/session-CO3gEqQP.js +2 -0
- package/dist/chunks/sessionFileAccessHooks-CZvCqQJ6.js +1 -0
- package/dist/chunks/sessionObserver-Ba7um95p.js +1 -0
- package/dist/chunks/{sessionObserver-DoYc0ZOP.js → sessionObserver-YkRHC-Aa.js} +2 -2
- package/dist/chunks/sessionState-Bifmu95-.js +11 -0
- package/dist/chunks/sessionStorage-CedwLLQs.js +1 -0
- package/dist/chunks/{sessionStoragePortable-Cx6JQ5Ye.js → sessionStoragePortable-JZnGwqUM.js} +1 -1
- package/dist/chunks/sessionTitle-COBSgSXS.js +14 -0
- package/dist/chunks/sessionTracing-BrNx1k2V.js +11 -0
- package/dist/chunks/settings-DkDH7WQT.js +1 -0
- package/dist/chunks/settings-DnptdP79.js +20 -0
- package/dist/chunks/settingsSync-PmU7SmkU.js +1 -0
- package/dist/chunks/setup-BEsBuzsk.js +3 -0
- package/dist/chunks/shadowedRuleDetection-DEaw-X5j.js +1 -0
- package/dist/chunks/{shellQuote-BUVKMu_P.js → shellQuote-BYeOv3Ip.js} +1 -1
- package/dist/chunks/{sideQuestion-C780iYwd.js → sideQuestion-D0OKljee.js} +3 -3
- package/dist/chunks/sinks-BJHgxz6Y.js +1 -0
- package/dist/chunks/sinks-D5-yhcgU.js +2 -0
- package/dist/chunks/skillChangeDetector-Dd0WPdkO.js +1 -0
- package/dist/chunks/{skillGapStore-Dc1arohs.js → skillGapStore-N_kmvXML.js} +2 -2
- package/dist/chunks/{skillLifecycle-DP6mY1Kp.js → skillLifecycle-C4F5RXuh.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CpLTImaL.js → skillSearchPanel-CftorvAM.js} +4 -4
- package/dist/chunks/skills-C4CTRN9o.js +1 -0
- package/dist/chunks/{src-CDCSSo0U2.js → src-P_wYS_NJ2.js} +1 -1
- package/dist/chunks/{src-CST_jFnT.js → src-r6ZFgWPx2.js} +1 -1
- package/dist/chunks/startupProfiler-D4FBdEQr.js +1 -0
- package/dist/chunks/{startupProfiler-DCn_NxMH.js → startupProfiler-L_UWZ03w.js} +3 -3
- package/dist/chunks/{state-Cn_m2NOf.js → state-BAGmpVBn.js} +1 -1
- package/dist/chunks/state-BemZdQIl.js +1 -0
- package/dist/chunks/state-D_lk6z-C.js +1 -0
- package/dist/chunks/{staticRender-BIxpgNUq.js → staticRender-DrU6eWoq.js} +1 -1
- package/dist/chunks/{stats-Duk7_xjQ.js → stats-IzV0_vEc.js} +1 -1
- package/dist/chunks/{status-peiVB_2j.js → status-CeVP_uDT.js} +1 -1
- package/dist/chunks/status-Dzuw3hBv.js +2 -0
- package/dist/chunks/statusNoticeHelpers-Bb9gxdSt.js +1 -0
- package/dist/chunks/{stringUtils-B6FudhoZ.js → stringUtils-C84IJ91d.js} +1 -1
- package/dist/chunks/subprocessEnv-CZkA9Cdp.js +1 -0
- package/dist/chunks/{subprocessEnv-vrwzMgKn.js → subprocessEnv-Ci8VV_bi.js} +1 -1
- package/dist/chunks/switcher-4KzBvuKH.js +1 -0
- package/dist/chunks/{switcher-BAMqSX7Z.js → switcher-CCs9xl1z.js} +1 -1
- package/dist/chunks/{syncCache-Zl9kZRRl.js → syncCache-CBRiRU5x.js} +1 -1
- package/dist/chunks/tasks-DZDhgx0w.js +1 -0
- package/dist/chunks/teleport-Bw0jSxe9.js +1 -0
- package/dist/chunks/{templateJobs-DR5fKFiO.js → templateJobs-CrNPEKkh.js} +1 -1
- package/dist/chunks/{terminalSetup-DgRBt-JJ.js → terminalSetup-CBqcwQll.js} +1 -1
- package/dist/chunks/terminalSetup-D-N8YPiQ.js +33 -0
- package/dist/chunks/{theme-Bz6esfST.js → theme-Dazsirbw.js} +1 -1
- package/dist/chunks/{tmux-DSU9tYIo.js → tmux-DewYVEBm.js} +1 -1
- package/dist/chunks/{toolEventObserver-BSekCkM2.js → toolEventObserver-lnHJ9fLQ.js} +1 -1
- package/dist/chunks/toolPool-CkXFlqsn.js +1 -0
- package/dist/chunks/{trustedDevice-B0x9X0fb.js → trustedDevice-CFf5yaG-.js} +1 -1
- package/dist/chunks/trustedDevice-CuwSv8dG.js +1 -0
- package/dist/chunks/{types-D7_37tP2.js → types-3j8PS-Du.js} +1 -1
- package/dist/chunks/{udsClient-CHoMMH28.js → udsClient-e9dIkwVA.js} +1 -1
- package/dist/chunks/updateCCB-BPe9_FW6.js +11 -0
- package/dist/chunks/{upstreamproxy-Hmq-n8fw.js → upstreamproxy-DF00RzGG.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js +1 -0
- package/dist/chunks/useMainLoopModel-2-eujv0n.js +1 -0
- package/dist/chunks/useManagePlugins-CYBIkaB1.js +1 -0
- package/dist/chunks/useMergedTools-Dk5cPqLc.js +1 -0
- package/dist/chunks/useSearchInput-C7Y1I9P9.js +1 -0
- package/dist/chunks/useSettingsErrors-DAEO7AyB.js +1 -0
- package/dist/chunks/{userAgent-BxTG7IMk.js → userAgent-CIq27vUR.js} +1 -1
- package/dist/chunks/util-VO98TdOz.js +1 -0
- package/dist/chunks/{validatePlugin-AHl-g4ct.js → validatePlugin-Kk6pxnO2.js} +1 -1
- package/dist/chunks/vim-EYQn94Kx.js +1 -0
- package/dist/chunks/{which-CHLNJmtJ.js → which-DzFN5TNM.js} +1 -1
- package/dist/chunks/{windowsPaths-o62uq6LF.js → windowsPaths-BU3yQWTB.js} +1 -1
- package/dist/chunks/windowsPaths-DgZ3YY4a.js +1 -0
- package/dist/chunks/{workSecret-DG9shvG0.js → workSecret-DUqdPy44.js} +1 -1
- package/dist/chunks/workerRegistry-C07BcZIw.js +6 -0
- package/dist/chunks/worktree-dFUkhVE_.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +0 -1
- package/dist/chunks/App-Ba52HvYC.js +0 -1
- package/dist/chunks/ApproveApiKey-CEIfuUh0.js +0 -1
- package/dist/chunks/ApproveApiKey-D2MLQu2P.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-GYhq--JR.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-C-CTa-95.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +0 -1
- package/dist/chunks/DiffDialog-AC5DSJrq.js +0 -6
- package/dist/chunks/Doctor-B9Rxsoy0.js +0 -1
- package/dist/chunks/Doctor-lhUBhEy5.js +0 -3
- package/dist/chunks/ExitFlow-Cu8SoQHs.js +0 -2
- package/dist/chunks/Grove-Bc4CofEj.js +0 -11
- package/dist/chunks/InvalidConfigDialog-BI13il58.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-CtOheV1K.js +0 -1
- package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +0 -1
- package/dist/chunks/MCPToolListView-dkofcJs4.js +0 -1
- package/dist/chunks/McpParsingWarnings-BS4JoR5l.js +0 -1
- package/dist/chunks/MessageSelector-B88b2ypw.js +0 -3
- package/dist/chunks/Messages-BPeI7lLV.js +0 -11
- package/dist/chunks/Onboarding-c2fQ8Io_.js +0 -1
- package/dist/chunks/PromptInputFooterSuggestions-D1cH9sDX.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-DDD5WuK0.js +0 -1
- package/dist/chunks/QueryEngine-Cv_meCam.js +0 -1
- package/dist/chunks/REPL-BXhAQOXb.js +0 -139
- package/dist/chunks/REPL-YqjLnr3A.js +0 -1
- package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +0 -2
- package/dist/chunks/ResumeConversation-CIZCjms9.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +0 -1
- package/dist/chunks/Settings-CyUm0AtU.js +0 -2
- package/dist/chunks/TeleportProgress-C3qyp5zy.js +0 -1
- package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +0 -1
- package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +0 -1
- package/dist/chunks/ThemePicker-EQ6hPUeI.js +0 -1
- package/dist/chunks/WelcomeV2-Ci9VwPYh.js +0 -1
- package/dist/chunks/add-dir-DPQV0qml.js +0 -1
- package/dist/chunks/agents-DmybpgDN.js +0 -103
- package/dist/chunks/allErrors-BPn_2TrB.js +0 -1
- package/dist/chunks/analytics-CkYUHW_U.js +0 -1
- package/dist/chunks/ant-DjdvlLOo.js +0 -1
- package/dist/chunks/api-AMgj1zf_.js +0 -1
- package/dist/chunks/asciicast-BJNYO5sh.js +0 -4
- package/dist/chunks/asciicast-CH6hdK0a.js +0 -1
- package/dist/chunks/attributionTrailer-oKKrF3z8.js +0 -1
- package/dist/chunks/auth-CNjDn1VY.js +0 -15
- package/dist/chunks/auth-CZzP483s.js +0 -1
- package/dist/chunks/auth-DDSBm_Yj.js +0 -1
- package/dist/chunks/autonomy-D4xZLOdJ.js +0 -15
- package/dist/chunks/backgroundHousekeeping--eBgphcg.js +0 -17
- package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +0 -1
- package/dist/chunks/bg-BK_9J6F6.js +0 -1
- package/dist/chunks/branch-BYq0zpzT.js +0 -3
- package/dist/chunks/bridgeConfig-C82un7rJ.js +0 -1
- package/dist/chunks/bridgeMessaging-YqYdl6ej.js +0 -1
- package/dist/chunks/btw-CUV3nRrE.js +0 -1
- package/dist/chunks/caches-BZ59_En6.js +0 -1
- package/dist/chunks/caches-Cg-HtWKG.js +0 -1
- package/dist/chunks/client-DQXvVKND.js +0 -1
- package/dist/chunks/client-DkgC-mFB.js +0 -1
- package/dist/chunks/color-CBsNbt1s.js +0 -1
- package/dist/chunks/commands-qM5z_Uld.js +0 -1
- package/dist/chunks/compact-BclJiRJe.js +0 -2
- package/dist/chunks/completionCache-BMHAktkM.js +0 -1
- package/dist/chunks/config-CE058cvr.js +0 -3
- package/dist/chunks/config-D81avYye.js +0 -1
- package/dist/chunks/config-DpOOllGk.js +0 -1
- package/dist/chunks/context-noninteractive-DJb8H_hN.js +0 -1
- package/dist/chunks/context-sR9fJmXE.js +0 -1
- package/dist/chunks/conversation-D48Kt3ar.js +0 -1
- package/dist/chunks/conversation-fOFTa7k5.js +0 -1
- package/dist/chunks/createSession-CSwlW2T2.js +0 -1
- package/dist/chunks/crossProjectResume-lDFB2ZcY.js +0 -40
- package/dist/chunks/cwd-5Xr-Qka6.js +0 -1
- package/dist/chunks/cwd-C5ce-7WB.js +0 -1
- package/dist/chunks/daemon-ZtpTZWgQ.js +0 -2
- package/dist/chunks/datadog-BJn5ECIu.js +0 -1
- package/dist/chunks/detectRepository-DqQvyj_a.js +0 -1
- package/dist/chunks/directoryCompletion-BagQcynj.js +0 -1
- package/dist/chunks/doctor-BEHYm34V.js +0 -1
- package/dist/chunks/earlyInput-xcoTbKQn.js +0 -1
- package/dist/chunks/entry-BzL1MFQG.js +0 -14
- package/dist/chunks/envUtils-DSxRz_kt.js +0 -1
- package/dist/chunks/esm-BLPbfHQd.js +0 -1
- package/dist/chunks/eventLoopStallDetector-Cg_RXU1q.js +0 -1
- package/dist/chunks/exit-DE2YiAhQ.js +0 -1
- package/dist/chunks/extraUsage-Dw7AXiH7.js +0 -1
- package/dist/chunks/extractMemories-DxTUMiv3.js +0 -1
- package/dist/chunks/fast-CHmMkIpE.js +0 -1
- package/dist/chunks/fast-uQASHWqR.js +0 -1
- package/dist/chunks/featureCheck-CrJeuheQ.js +0 -1
- package/dist/chunks/featureCheck-HslM03dr.js +0 -1
- package/dist/chunks/fileSuggestions-Dyu2kQtE.js +0 -3
- package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +0 -5
- package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +0 -1
- package/dist/chunks/flushGate-Cnsu4HET.js +0 -1
- package/dist/chunks/gemini-Cudre91e.js +0 -1
- package/dist/chunks/generateRecap-CiFxXlmH.js +0 -1
- package/dist/chunks/generateSessionName-DitoBxJT.js +0 -1
- package/dist/chunks/git-D6dOU2mT.js +0 -1
- package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +0 -1
- package/dist/chunks/goal-DuUayfDg.js +0 -3
- package/dist/chunks/grok-tRbmZzEh.js +0 -1
- package/dist/chunks/grove-Cv19v6Sv.js +0 -7
- package/dist/chunks/help-DkqxbFDM.js +0 -1
- package/dist/chunks/hooks-CsP42iOp.js +0 -1
- package/dist/chunks/initReplBridge-DdsSWVqN.js +0 -1
- package/dist/chunks/intl-cKc-V6Mq.js +0 -1
- package/dist/chunks/keybindings-DZU3vwo3.js +0 -2
- package/dist/chunks/language-DHhXLb_Y.js +0 -1
- package/dist/chunks/language-s-dLbdVz.js +0 -1
- package/dist/chunks/launchLocalMemory-twLxpPvg.js +0 -3
- package/dist/chunks/launchOnboarding-BWz2XSb9.js +0 -8
- package/dist/chunks/lib-rQZENxQg.js +0 -8
- package/dist/chunks/loadAgentsDir-CMNFLt7R.js +0 -1
- package/dist/chunks/loadPluginHooks-BPnxcgrL.js +0 -1
- package/dist/chunks/localSearch-DzQODFap.js +0 -1
- package/dist/chunks/log-CZ0zYP_c.js +0 -1
- package/dist/chunks/logoV2Utils-CGUJ-5gY.js +0 -1
- package/dist/chunks/main-D4Uk-WUs.js +0 -862
- package/dist/chunks/managedEnv-DLVRBaA9.js +0 -1
- package/dist/chunks/mcp-BMVdGknC.js +0 -1
- package/dist/chunks/mcp-COS5RJFS.js +0 -6
- package/dist/chunks/mcp-tGsOW1GN.js +0 -2
- package/dist/chunks/memory-DR6poqeH.js +0 -1
- package/dist/chunks/mode-QV-NW1Wd.js +0 -2
- package/dist/chunks/model-BF_4ebyl.js +0 -1
- package/dist/chunks/model-BNU_ulDJ.js +0 -1
- package/dist/chunks/model-CwO-g1RW.js +0 -1
- package/dist/chunks/nativeInstaller-B-lNJjM-.js +0 -1
- package/dist/chunks/oauth-BqJqV-2M.js +0 -1
- package/dist/chunks/oauth-C8X_p8Gc.js +0 -1
- package/dist/chunks/omit-DZCEXri5.js +0 -1
- package/dist/chunks/onChangeAppState-BmfM5g-D.js +0 -1
- package/dist/chunks/p-map-B1EeBuI8.js +0 -1
- package/dist/chunks/p-map-HKDr3iDo.js +0 -1
- package/dist/chunks/panelCall-SbffM7G4.js +0 -1
- package/dist/chunks/parser-DrBC8nWp.js +0 -1
- package/dist/chunks/partition-DKuAFJkc.js +0 -1
- package/dist/chunks/path-Cv9QMBAX.js +0 -1
- package/dist/chunks/permissions-ey-bfanE.js +0 -3
- package/dist/chunks/pidLock-DJnS_38v.js +0 -3
- package/dist/chunks/pipeTransport-DVOKR4c_.js +0 -1
- package/dist/chunks/plan-Brg9XnRr.js +0 -1
- package/dist/chunks/plugin-CRwa39Y1.js +0 -17
- package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +0 -1
- package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +0 -1
- package/dist/chunks/pluginOperations-C7p_Qr2r.js +0 -2
- package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +0 -1
- package/dist/chunks/plugins-DUKNjLq6.js +0 -4
- package/dist/chunks/poorMode-CejPNCp-.js +0 -1
- package/dist/chunks/print-gyTOCJzk.js +0 -23
- package/dist/chunks/processBashCommand-Cze9vCm6.js +0 -1
- package/dist/chunks/processSlashCommand-BRajh1v7.js +0 -5
- package/dist/chunks/prompt-B7joRiqj.js +0 -139
- package/dist/chunks/prompt-DqSMh2x9.js +0 -1
- package/dist/chunks/prompt-Eysh8Et_.js +0 -1
- package/dist/chunks/promptEditor-R_acDAgI.js +0 -4
- package/dist/chunks/reconciler-BfkO6X2X.js +0 -4
- package/dist/chunks/refresh-C1X3sptR.js +0 -1
- package/dist/chunks/reload-plugins-C0osFcNh.js +0 -1
- package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +0 -1
- package/dist/chunks/rename-B3tf-YiD.js +0 -1
- package/dist/chunks/replBridgeHandle-CNwNIijW.js +0 -1
- package/dist/chunks/resume-Be1G_GBL.js +0 -2
- package/dist/chunks/ripgrep-C2PhTJDh.js +0 -1
- package/dist/chunks/rollback-BPWRKlIZ.js +0 -11
- package/dist/chunks/sandbox-adapter-C6GBuJPB.js +0 -1
- package/dist/chunks/sandbox-toggle-jEySONTW.js +0 -1
- package/dist/chunks/sdkHeapDumpMonitor-WdXUV7DV.js +0 -1
- package/dist/chunks/searchExtraTools-C_UTryh_.js +0 -1
- package/dist/chunks/session-DDI1Eb2x.js +0 -2
- package/dist/chunks/sessionDataUploader-CaCjwsA2.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +0 -1
- package/dist/chunks/sessionMemory-CQBxPkTQ.js +0 -1
- package/dist/chunks/sessionMemory-s0ALUHvc.js +0 -1
- package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +0 -1
- package/dist/chunks/sessionObserver-C2sYqWL3.js +0 -1
- package/dist/chunks/sessionState-CjNY991n.js +0 -11
- package/dist/chunks/sessionStorage-DqsY-7pi.js +0 -1
- package/dist/chunks/sessionTitle-B0OYf5nM.js +0 -14
- package/dist/chunks/sessionTracing-CwsXt_uA.js +0 -11
- package/dist/chunks/settings-BWtOA9A7.js +0 -1
- package/dist/chunks/settings-hQDLwPVj.js +0 -20
- package/dist/chunks/settingsSync-DdFagwHV.js +0 -1
- package/dist/chunks/setup-DzC22EkN.js +0 -3
- package/dist/chunks/shadowedRuleDetection-C86PTj1m.js +0 -1
- package/dist/chunks/sinks-5G_xhc1Q.js +0 -1
- package/dist/chunks/sinks-Cftq7Es0.js +0 -2
- package/dist/chunks/skillChangeDetector-plLveEbf.js +0 -1
- package/dist/chunks/skills-zGYaYfFV.js +0 -1
- package/dist/chunks/startupProfiler-JbpAkfNE.js +0 -1
- package/dist/chunks/state-C2OSZkV1.js +0 -1
- package/dist/chunks/state-DU9lRJ9x.js +0 -1
- package/dist/chunks/status-CFw-FpZM.js +0 -2
- package/dist/chunks/statusNoticeHelpers-B5U5c9PE.js +0 -1
- package/dist/chunks/subprocessEnv-BSQSomcK.js +0 -1
- package/dist/chunks/switcher-hgBgVzLb.js +0 -1
- package/dist/chunks/tasks-BxpyRhmD.js +0 -1
- package/dist/chunks/teleport-CwxeD5vL.js +0 -1
- package/dist/chunks/terminalSetup-DlaFWI81.js +0 -33
- package/dist/chunks/toolPool-B7SIoDw5.js +0 -1
- package/dist/chunks/trustedDevice-CjHQtVkO.js +0 -1
- package/dist/chunks/up-B8wBSpLg.js +0 -12
- package/dist/chunks/updateCCB-D_kGQKPT.js +0 -11
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +0 -1
- package/dist/chunks/useMainLoopModel-BICP6_Fi.js +0 -1
- package/dist/chunks/useManagePlugins-DtbY_vPL.js +0 -1
- package/dist/chunks/useMergedTools-Ckx2IEhF.js +0 -1
- package/dist/chunks/useSearchInput-BAgljZUl.js +0 -1
- package/dist/chunks/useSettingsErrors-CAJR_wpd.js +0 -1
- package/dist/chunks/util-DDtmyq_r.js +0 -1
- package/dist/chunks/vim-kg-mRVbu.js +0 -1
- package/dist/chunks/windowsPaths-Pmx8LDR6.js +0 -1
- package/dist/chunks/workerRegistry-C7H_lsQX.js +0 -6
- package/dist/chunks/worktree-O2p-mJdF.js +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{Bi as n,Cr as r,Db as i,Du as a,Fi as o,Ou as s,Tf as c,U as l,W as u,cr as d,i as f,jb as p,nc as m,nl as h,o as g,rc as _,rl as v,wf as ee}from"./loadAgentsDir-C7lOqvfh.js";import{A as y,C as b,M as x,O as S,P as C,b as w,j as T,l as te,m as E,p as D,v as O,w as k}from"./external-CEp-aPkt.js";import{r as ne}from"./lazySchema-B4D4qJVE.js";import{Bn as re,Wt as A,_r as ie,et as ae,gr as oe,ht as se,or as j}from"./state-BemZdQIl.js";import{f as ce,g as le}from"./settings-DnptdP79.js";import{h as ue,r as de}from"./config-Do1870_d.js";import{l as fe,p as M,r as pe}from"./sessionStoragePortable-JZnGwqUM.js";import{_ as me,u as he}from"./model-BsZ4sP_H.js";import{bn as ge,yn as _e}from"./prompt-M2lu8_Oa.js";import{n as ve,r as ye}from"./managedEnv-DhWRJ5DK.js";import{t as be}from"./QueryEngine-DPHLSsax.js";import{n as xe,t as Se}from"./modelOptions-CxP067Qv.js";import{dirname as Ce}from"node:path";import{randomUUID as N}from"node:crypto";import{Readable as we,Writable as Te}from"node:stream";import{unlink as Ee}from"node:fs/promises";import*as P from"node:path/posix";import{isAbsolute as De,resolve as Oe}from"node:path/posix";ne();var F={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},I={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},ke=k({_meta:S(y(),x()).nullish(),terminal:E().optional().default(!1)}),Ae=k({_meta:S(y(),x()).nullish(),label:y().nullish(),name:y(),optional:E().optional().default(!1),secret:E().optional().default(!0)}),je=k({_meta:S(y(),x()).nullish(),description:y().nullish(),id:y(),name:y()}),Me=k({_meta:S(y(),x()).nullish(),description:y().nullish(),id:y(),link:y().nullish(),name:y(),vars:D(Ae)}),Ne=k({_meta:S(y(),x()).nullish(),args:D(y()).optional(),description:y().nullish(),env:S(y(),y()).optional(),id:y(),name:y()}),Pe=T([Me.and(k({type:w(`env_var`)})),Ne.and(k({type:w(`terminal`)})),je]),Fe=k({_meta:S(y(),x()).nullish(),methodId:y()}),Ie=k({_meta:S(y(),x()).nullish()}),Le=k({_meta:S(y(),x()).nullish(),blob:y(),mimeType:y().nullish(),uri:y()}),Re=k({default:E().nullish(),description:y().nullish(),title:y().nullish()}),ze=k({_meta:S(y(),x()).nullish()}),Be=k({_meta:S(y(),x()).nullish()}),Ve=k({amount:b(),currency:y()}),He=k({_meta:S(y(),x()).nullish(),terminalId:y()}),Ue=k({_meta:S(y(),x()).nullish(),newText:y(),oldText:y().nullish(),path:y()}),We=T([y(),b(),b(),E(),D(y())]),Ge=O(T([k({content:S(y(),We).nullish()}).and(k({action:w(`accept`)})),k({action:w(`decline`)}),k({action:w(`cancel`)})]),k({_meta:S(y(),x()).nullish()})),Ke=k({_meta:S(y(),x()).nullish()}),qe=y(),Je=k({_meta:S(y(),x()).nullish(),elicitationId:qe}),Ye=w(`object`),Xe=w(`string`),Ze=k({_meta:S(y(),x()).nullish()}),Qe=k({_meta:S(y(),x()).nullish(),form:Ke.nullish(),url:Ze.nullish()}),$e=k({const:y(),title:y()}),et=k({_meta:S(y(),x()).nullish(),name:y(),value:y()}),tt=k({code:T([w(-32700),w(-32600),w(-32601),w(-32602),w(-32603),w(-32800),w(-32e3),w(-32002),w(-32042),b().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:x().optional(),message:y()}),nt=x(),rt=x(),it=x(),at=k({_meta:S(y(),x()).nullish(),readTextFile:E().optional().default(!1),writeTextFile:E().optional().default(!1)}),ot=k({_meta:S(y(),x()).nullish(),name:y(),value:y()}),st=k({_meta:S(y(),x()).nullish(),name:y(),title:y().nullish(),version:y()}),ct=k({default:b().nullish(),description:y().nullish(),maximum:b().nullish(),minimum:b().nullish(),title:y().nullish()}),lt=k({_meta:S(y(),x()).nullish()}),ut=k({_meta:S(y(),x()).nullish(),additionalDirectories:D(y()).optional(),cursor:y().nullish(),cwd:y().nullish()}),dt=k({_meta:S(y(),x()).nullish()}),ft=k({_meta:S(y(),x()).nullish(),logout:dt.nullish()}),pt=k({_meta:S(y(),x()).nullish()}),mt=k({_meta:S(y(),x()).nullish()}),ht=k({_meta:S(y(),x()).nullish(),http:E().optional().default(!1),sse:E().optional().default(!1)}),gt=k({_meta:S(y(),x()).nullish(),headers:D(ot),name:y(),url:y()}),_t=k({_meta:S(y(),x()).nullish(),headers:D(ot),name:y(),url:y()}),vt=k({_meta:S(y(),x()).nullish(),args:D(y()),command:y(),env:D(et),name:y()}),L=T([gt.and(k({type:w(`http`)})),_t.and(k({type:w(`sse`)})),vt]),yt=y(),bt=k({_meta:S(y(),x()).nullish(),description:y().nullish(),modelId:yt,name:y()}),xt=T([w(`error`),w(`warning`),w(`information`),w(`hint`)]),St=k({_meta:S(y(),x()).nullish()}),Ct=k({_meta:S(y(),x()).nullish()}),wt=k({_meta:S(y(),x()).nullish()}),Tt=k({_meta:S(y(),x()).nullish()}),Et=k({_meta:S(y(),x()).nullish()}),Dt=k({_meta:S(y(),x()).nullish(),maxCount:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Ot=k({diff:y(),uri:y()}),kt=k({endLine:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:y()}),At=k({_meta:S(y(),x()).nullish()}),jt=k({_meta:S(y(),x()).nullish()}),Mt=k({languageId:y(),text:y(),uri:y()}),Nt=k({_meta:S(y(),x()).nullish(),maxCount:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=T([w(`rejected`),w(`ignored`),w(`replaced`),w(`cancelled`)]),Ft=k({excerpts:D(kt),uri:y()}),It=k({_meta:S(y(),x()).nullish()}),Lt=k({_meta:S(y(),x()).nullish()}),Rt=k({name:y(),owner:y(),remoteUrl:y()}),zt=k({_meta:S(y(),x()).nullish()}),Bt=k({_meta:S(y(),x()).nullish(),jump:At.nullish(),rename:Lt.nullish(),searchAndReplace:zt.nullish()}),Vt=k({id:y(),isRegex:E().nullish(),replace:y(),search:y(),uri:y()}),Ht=T([w(`automatic`),w(`diagnostic`),w(`manual`)]),Ut=k({_meta:S(y(),x()).nullish(),maxCount:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Wt=k({_meta:S(y(),x()).nullish(),diagnostics:St.nullish(),editHistory:Dt.nullish(),openFiles:jt.nullish(),recentFiles:Nt.nullish(),relatedSnippets:It.nullish(),userActions:Ut.nullish()}),Gt=k({_meta:S(y(),x()).nullish(),additionalDirectories:D(y()).optional(),cwd:y(),mcpServers:D(L)}),Kt=k({default:b().nullish(),description:y().nullish(),maximum:b().nullish(),minimum:b().nullish(),title:y().nullish()}),qt=y(),Jt=T([w(`allow_once`),w(`allow_always`),w(`reject_once`),w(`reject_always`)]),Yt=k({_meta:S(y(),x()).nullish(),kind:Jt,name:y(),optionId:qt}),Xt=T([w(`high`),w(`medium`),w(`low`)]),Zt=T([w(`pending`),w(`in_progress`),w(`completed`)]),Qt=k({_meta:S(y(),x()).nullish(),content:y(),priority:Xt,status:Zt}),$t=k({_meta:S(y(),x()).nullish(),entries:D(Qt)}),R=k({character:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),en=k({id:y(),position:R,uri:y()}),tn=k({id:y(),newName:y(),position:R,uri:y()}),nn=k({action:y(),position:R,timestampMs:b(),uri:y()}),rn=T([w(`utf-16`),w(`utf-32`),w(`utf-8`)]),an=k({_meta:S(y(),x()).nullish(),auth:ke.optional().default({terminal:!1}),elicitation:Qe.nullish(),fs:at.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Bt.nullish(),positionEncodings:D(rn).optional(),terminal:E().optional().default(!1)}),on=k({_meta:S(y(),x()).nullish(),audio:E().optional().default(!1),embeddedContext:E().optional().default(!1),image:E().optional().default(!1)}),sn=b().int().gte(0).lte(65535),cn=k({_meta:S(y(),x()).nullish(),clientCapabilities:an.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:st.nullish(),protocolVersion:sn}),z=k({end:R,start:R}),ln=k({message:y(),range:z,severity:xt,uri:y()}),un=k({languageId:y(),lastFocusedMs:b().nullish(),uri:y(),visibleRange:z.nullish()}),dn=k({_meta:S(y(),x()).nullish(),diagnostics:D(ln).nullish(),editHistory:D(Ot).nullish(),openFiles:D(un).nullish(),recentFiles:D(Mt).nullish(),relatedSnippets:D(Ft).nullish(),userActions:D(nn).nullish()}),fn=k({newText:y(),range:z}),pn=T([k({cursorPosition:R.nullish(),edits:D(fn),id:y(),uri:y()}).and(k({kind:w(`edit`)})),en.and(k({kind:w(`jump`)})),tn.and(k({kind:w(`rename`)})),Vt.and(k({kind:w(`searchAndReplace`)}))]),mn=k({_meta:S(y(),x()).nullish(),content:y()}),hn=k({_meta:S(y(),x()).nullish()}),B=T([b(),y()]).nullable();k({_meta:S(y(),x()).nullish(),requestId:B});var gn=k({requestId:B}),_n=te([`assistant`,`user`]),V=k({_meta:S(y(),x()).nullish(),audience:D(_n).nullish(),lastModified:y().nullish(),priority:b().nullish()}),vn=k({_meta:S(y(),x()).nullish(),annotations:V.nullish(),data:y(),mimeType:y()}),yn=k({_meta:S(y(),x()).nullish(),annotations:V.nullish(),data:y(),mimeType:y(),uri:y().nullish()}),bn=k({_meta:S(y(),x()).nullish(),annotations:V.nullish(),description:y().nullish(),mimeType:y().nullish(),name:y(),size:b().nullish(),title:y().nullish(),uri:y()}),xn=k({_meta:S(y(),x()).nullish(),optionId:qt}),Sn=T([k({outcome:w(`cancelled`)}),xn.and(k({outcome:w(`selected`)}))]),Cn=k({_meta:S(y(),x()).nullish(),outcome:Sn}),wn=k({_meta:S(y(),x()).nullish()}),Tn=k({_meta:S(y(),x()).nullish()}),En=k({currentValue:E()}),Dn=y(),On=y(),kn=T([w(`mode`),w(`model`),w(`thought_level`),y()]),An=y(),jn=k({_meta:S(y(),x()).nullish(),description:y().nullish(),name:y(),value:An}),Mn=k({_meta:S(y(),x()).nullish(),group:Dn,name:y(),options:D(jn)}),H=O(T([k({currentValue:An,options:T([D(jn),D(Mn)])}).and(k({type:w(`select`)})),En.and(k({type:w(`boolean`)}))]),k({_meta:S(y(),x()).nullish(),category:kn.nullish(),description:y().nullish(),id:On,name:y()})),Nn=k({_meta:S(y(),x()).nullish(),configOptions:D(H)}),Pn=k({_meta:S(y(),x()).nullish()}),U=y(),Fn=k({_meta:S(y(),x()).nullish(),id:y(),sessionId:U}),In=k({_meta:S(y(),x()).nullish(),sessionId:U}),Ln=k({_meta:S(y(),x()).nullish(),sessionId:U}),Rn=k({_meta:S(y(),x()).nullish(),sessionId:U}),zn=k({_meta:S(y(),x()).nullish(),args:D(y()).optional(),command:y(),cwd:y().nullish(),env:D(et).optional(),outputByteLimit:b().nullish(),sessionId:U}),Bn=k({_meta:S(y(),x()).nullish(),sessionId:U,uri:y()}),Vn=k({_meta:S(y(),x()).nullish(),position:R,sessionId:U,uri:y(),version:b(),visibleRange:z}),Hn=k({_meta:S(y(),x()).nullish(),languageId:y(),sessionId:U,text:y(),uri:y(),version:b()}),Un=k({_meta:S(y(),x()).nullish(),sessionId:U,uri:y()}),Wn=k({_meta:S(y(),x()).nullish(),additionalDirectories:D(y()).optional(),cwd:y(),mcpServers:D(L).optional(),sessionId:U}),Gn=k({_meta:S(y(),x()).nullish(),sessionId:U,terminalId:y()}),Kn=k({_meta:S(y(),x()).nullish(),additionalDirectories:D(y()).optional(),cwd:y(),mcpServers:D(L),sessionId:U}),qn=k({_meta:S(y(),x()).nullish(),limit:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:y(),sessionId:U}),Jn=k({_meta:S(y(),x()).nullish(),id:y(),reason:Pt.nullish(),sessionId:U}),Yn=k({_meta:S(y(),x()).nullish(),sessionId:U,terminalId:y()}),Xn=k({_meta:S(y(),x()).nullish(),additionalDirectories:D(y()).optional(),cwd:y(),mcpServers:D(L).optional(),sessionId:U}),Zn=k({_meta:S(y(),x()).nullish(),additionalDirectories:D(y()).optional(),cwd:y(),sessionId:U,title:y().nullish(),updatedAt:y().nullish()}),Qn=k({_meta:S(y(),x()).nullish(),nextCursor:y().nullish(),sessions:D(Zn)}),$n=k({_meta:S(y(),x()).nullish(),title:y().nullish(),updatedAt:y().nullish()}),er=k({_meta:S(y(),x()).nullish()}),W=y(),tr=k({_meta:S(y(),x()).nullish(),currentModeId:W}),nr=k({_meta:S(y(),x()).nullish(),description:y().nullish(),id:W,name:y()}),G=k({_meta:S(y(),x()).nullish(),availableModes:D(nr),currentModeId:W}),K=k({_meta:S(y(),x()).nullish(),availableModels:D(bt),currentModelId:yt}),rr=k({_meta:S(y(),x()).nullish(),configOptions:D(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),ir=k({_meta:S(y(),x()).nullish(),configOptions:D(H).nullish(),models:K.nullish(),modes:G.nullish()}),ar=k({_meta:S(y(),x()).nullish(),configOptions:D(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),or=k({_meta:S(y(),x()).nullish(),configOptions:D(H).nullish(),models:K.nullish(),modes:G.nullish()}),sr=k({_meta:S(y(),x()).nullish()}),cr=k({_meta:S(y(),x()).nullish(),additionalDirectories:wn.nullish(),close:Tn.nullish(),fork:Pn.nullish(),list:er.nullish(),resume:sr.nullish()}),lr=O(T([k({type:w(`boolean`),value:E()}),k({value:An})]),k({_meta:S(y(),x()).nullish(),configId:On,sessionId:U})),ur=k({_meta:S(y(),x()).nullish(),configOptions:D(H)}),dr=k({_meta:S(y(),x()).nullish(),modeId:W,sessionId:U}),fr=k({_meta:S(y(),x()).nullish()}),pr=k({_meta:S(y(),x()).nullish(),modelId:yt,sessionId:U}),mr=k({_meta:S(y(),x()).nullish()}),hr=k({_meta:S(y(),x()).nullish(),sessionId:U}),gr=T([w(`end_turn`),w(`max_tokens`),w(`max_turn_requests`),w(`refusal`),w(`cancelled`)]),_r=T([w(`email`),w(`uri`),w(`date`),w(`date-time`)]),vr=k({default:y().nullish(),description:y().nullish(),enum:D(y()).nullish(),format:_r.nullish(),maxLength:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:D($e).nullish(),pattern:y().nullish(),title:y().nullish()}),yr=k({_meta:S(y(),x()).nullish(),context:dn.nullish(),position:R,selection:z.nullish(),sessionId:U,triggerKind:Ht,uri:y(),version:b()}),br=k({_meta:S(y(),x()).nullish(),suggestions:D(pn)}),xr=k({_meta:S(y(),x()).nullish(),terminalId:y()}),Sr=k({_meta:S(y(),x()).nullish(),exitCode:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:y().nullish()}),Cr=k({_meta:S(y(),x()).nullish(),sessionId:U,terminalId:y()}),wr=k({_meta:S(y(),x()).nullish(),exitStatus:Sr.nullish(),output:y(),truncated:E()}),Tr=k({_meta:S(y(),x()).nullish(),annotations:V.nullish(),text:y()}),Er=k({range:z.nullish(),text:y()}),Dr=k({_meta:S(y(),x()).nullish(),contentChanges:D(Er),sessionId:U,uri:y(),version:b()});k({method:y(),params:T([In,Hn,Dr,Bn,Un,Vn,Fn,Jn,nt]).nullish()});var Or=T([w(`full`),w(`incremental`)]),kr=k({_meta:S(y(),x()).nullish(),syncKind:Or}),Ar=k({_meta:S(y(),x()).nullish(),didChange:kr.nullish(),didClose:Ct.nullish(),didFocus:wt.nullish(),didOpen:Tt.nullish(),didSave:Et.nullish()}),jr=k({_meta:S(y(),x()).nullish(),document:Ar.nullish()}),Mr=k({_meta:S(y(),x()).nullish(),context:Wt.nullish(),events:jr.nullish()}),Nr=k({_meta:S(y(),x()).nullish(),auth:ft.optional().default({}),loadSession:E().optional().default(!1),mcpCapabilities:ht.optional().default({http:!1,sse:!1}),nes:Mr.nullish(),positionEncoding:rn.nullish(),promptCapabilities:on.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:cr.optional().default({})}),Pr=k({_meta:S(y(),x()).nullish(),agentCapabilities:Nr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:st.nullish(),authMethods:D(Pe).optional().default([]),protocolVersion:sn}),Fr=T([k({_meta:S(y(),x()).nullish(),mimeType:y().nullish(),text:y(),uri:y()}),Le]),Ir=k({_meta:S(y(),x()).nullish(),annotations:V.nullish(),resource:Fr}),Lr=T([Tr.and(k({type:w(`text`)})),yn.and(k({type:w(`image`)})),vn.and(k({type:w(`audio`)})),bn.and(k({type:w(`resource_link`)})),Ir.and(k({type:w(`resource`)}))]),Rr=k({_meta:S(y(),x()).nullish(),content:Lr}),zr=k({_meta:S(y(),x()).nullish(),content:Lr,messageId:y().nullish()}),Br=k({_meta:S(y(),x()).nullish(),messageId:y().nullish(),prompt:D(Lr),sessionId:U}),Vr=k({anyOf:D($e)}),Hr=T([Rr.and(k({type:w(`content`)})),Ue.and(k({type:w(`diff`)})),xr.and(k({type:w(`terminal`)}))]),Ur=y(),Wr=k({sessionId:U,toolCallId:Ur.nullish()}),Gr=O(T([Wr,gn]),k({elicitationId:qe,url:y().url()})),Kr=k({_meta:S(y(),x()).nullish(),line:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:y()}),qr=T([w(`pending`),w(`in_progress`),w(`completed`),w(`failed`)]),Jr=T([w(`read`),w(`edit`),w(`delete`),w(`move`),w(`search`),w(`execute`),w(`think`),w(`fetch`),w(`switch_mode`),w(`other`)]),Yr=k({_meta:S(y(),x()).nullish(),content:D(Hr).optional(),kind:Jr.optional(),locations:D(Kr).optional(),rawInput:x().optional(),rawOutput:x().optional(),status:qr.optional(),title:y(),toolCallId:Ur}),Xr=k({_meta:S(y(),x()).nullish(),content:D(Hr).nullish(),kind:Jr.nullish(),locations:D(Kr).nullish(),rawInput:x().optional(),rawOutput:x().optional(),status:qr.nullish(),title:y().nullish(),toolCallId:Ur}),Zr=k({_meta:S(y(),x()).nullish(),options:D(Yt),sessionId:U,toolCall:Xr}),Qr=k({_meta:S(y(),x()).nullish(),hint:y()}),$r=k({_meta:S(y(),x()).nullish(),description:y(),input:Qr.nullish(),name:y()}),ei=k({_meta:S(y(),x()).nullish(),availableCommands:D($r)}),ti=T([k({enum:D(y()),type:Xe}),Vr]),ni=k({default:D(y()).nullish(),description:y().nullish(),items:ti,maxItems:b().nullish(),minItems:b().nullish(),title:y().nullish()}),ri=T([vr.and(k({type:w(`string`)})),Kt.and(k({type:w(`number`)})),ct.and(k({type:w(`integer`)})),Re.and(k({type:w(`boolean`)})),ni.and(k({type:w(`array`)}))]),ii=k({description:y().nullish(),properties:S(y(),ri).optional().default({}),required:D(y()).nullish(),title:y().nullish(),type:Ye.optional().default(`object`)}),ai=O(T([O(T([Wr,gn]),k({requestedSchema:ii})).and(k({mode:w(`form`)})),Gr.and(k({mode:w(`url`)}))]),k({_meta:S(y(),x()).nullish(),message:y()})),oi=k({cachedReadTokens:b().nullish(),cachedWriteTokens:b().nullish(),inputTokens:b(),outputTokens:b(),thoughtTokens:b().nullish(),totalTokens:b()});T([k({id:B,result:T([Pr,Ie,mt,ar,ir,Qn,rr,or,Be,fr,ur,k({_meta:S(y(),x()).nullish(),stopReason:gr,usage:oi.nullish(),userMessageId:y().nullish()}),mr,hr,br,ze,it])}),k({error:tt,id:B})]);var si=k({_meta:S(y(),x()).nullish(),cost:Ve.nullish(),size:b(),used:b()}),ci=T([zr.and(k({sessionUpdate:w(`user_message_chunk`)})),zr.and(k({sessionUpdate:w(`agent_message_chunk`)})),zr.and(k({sessionUpdate:w(`agent_thought_chunk`)})),Yr.and(k({sessionUpdate:w(`tool_call`)})),Xr.and(k({sessionUpdate:w(`tool_call_update`)})),$t.and(k({sessionUpdate:w(`plan`)})),ei.and(k({sessionUpdate:w(`available_commands_update`)})),tr.and(k({sessionUpdate:w(`current_mode_update`)})),Nn.and(k({sessionUpdate:w(`config_option_update`)})),$n.and(k({sessionUpdate:w(`session_info_update`)})),si.and(k({sessionUpdate:w(`usage_update`)}))]),li=k({_meta:S(y(),x()).nullish(),sessionId:U,update:ci});k({method:y(),params:T([li,Je,nt]).nullish()});var ui=k({_meta:S(y(),x()).nullish(),sessionId:U,terminalId:y()}),di=k({_meta:S(y(),x()).nullish(),exitCode:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:y().nullish()}),fi=k({name:y(),uri:y()}),pi=k({_meta:S(y(),x()).nullish(),repository:Rt.nullish(),workspaceFolders:D(fi).nullish(),workspaceUri:y().nullish()});k({id:B,method:y(),params:T([cn,Fe,pt,Gt,Kn,ut,Wn,Xn,Rn,dr,lr,Br,pr,pi,yr,Ln,rt]).nullish()});var mi=k({_meta:S(y(),x()).nullish(),content:y(),path:y(),sessionId:U});k({id:B,method:y(),params:T([mi,qn,Zr,zn,Cr,Yn,ui,Gn,ai,rt]).nullish()}),T([k({id:B,result:T([k({_meta:S(y(),x()).nullish()}),mn,Cn,He,wr,hn,di,lt,Ge,it])}),k({error:tt,id:B})]),e();function hi(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
|
|
2
|
+
`);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}let t=n.trim();if(t)try{let n=JSON.parse(t);e.enqueue(n)}catch(e){console.error(`Failed to parse JSON message:`,t,e)}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
|
|
3
|
+
`,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}ne();var gi,_i=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case F.initialize:{let e=cn.parse(t);return r.initialize(e)}case F.session_new:{let e=Gt.parse(t);return r.newSession(e)}case F.session_load:{if(!r.loadSession)throw q.methodNotFound(e);let n=Kn.parse(t);return r.loadSession(n)}case F.session_list:{if(!r.listSessions)throw q.methodNotFound(e);let n=ut.parse(t);return r.listSessions(n)}case F.session_fork:{if(!r.unstable_forkSession)throw q.methodNotFound(e);let n=Wn.parse(t);return r.unstable_forkSession(n)}case F.session_resume:{if(!r.unstable_resumeSession)throw q.methodNotFound(e);let n=Xn.parse(t);return r.unstable_resumeSession(n)}case F.session_close:{if(!r.unstable_closeSession)throw q.methodNotFound(e);let n=Rn.parse(t);return r.unstable_closeSession(n)}case F.session_set_mode:{if(!r.setSessionMode)throw q.methodNotFound(e);let n=dr.parse(t);return await r.setSessionMode(n)??{}}case F.authenticate:{let e=Fe.parse(t);return await r.authenticate(e)??{}}case F.logout:{if(!r.unstable_logout)throw q.methodNotFound(e);let n=pt.parse(t);return await r.unstable_logout(n)??{}}case F.session_prompt:{let e=Br.parse(t);return r.prompt(e)}case F.session_set_model:{if(!r.unstable_setSessionModel)throw q.methodNotFound(e);let n=pr.parse(t);return await r.unstable_setSessionModel(n)??{}}case F.session_set_config_option:{if(!r.setSessionConfigOption)throw q.methodNotFound(e);let n=lr.parse(t);return r.setSessionConfigOption(n)}case F.nes_start:{if(!r.unstable_startNes)throw q.methodNotFound(e);let n=pi.parse(t);return r.unstable_startNes(n)}case F.nes_suggest:{if(!r.unstable_suggestNes)throw q.methodNotFound(e);let n=yr.parse(t);return r.unstable_suggestNes(n)}case F.nes_close:{if(!r.unstable_closeNes)throw q.methodNotFound(e);let n=Ln.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw q.methodNotFound(e)}},a=async(e,t)=>{switch(e){case F.session_cancel:{let e=In.parse(t);return r.cancel(e)}case F.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Hn.parse(t);return r.unstable_didOpenDocument(e)}case F.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Dr.parse(t);return r.unstable_didChangeDocument(e)}case F.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Bn.parse(t);return r.unstable_didCloseDocument(e)}case F.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Un.parse(t);return r.unstable_didSaveDocument(e)}case F.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Vn.parse(t);return r.unstable_didFocusDocument(e)}case F.nes_accept:{if(!r.unstable_acceptNes)return;let e=Fn.parse(t);return r.unstable_acceptNes(e)}case F.nes_reject:{if(!r.unstable_rejectNes)return;let e=Jn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw q.methodNotFound(e)}};this.connection=new yi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(I.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(I.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(I.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(I.fs_write_text_file,e)??{}}async createTerminal(e){return new vi((await this.connection.sendRequest(I.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(I.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(I.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};gi=Symbol.asyncDispose;var vi=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(I.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(I.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(I.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(I.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[gi](){await this.release()}},yi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof C)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof C)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new q(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},q=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};oe(),A(),le(),ge(),ue(),p(),v(),_(),n(),u(),g(),ye();function J(e,t){if(e)return t?De(e)?e:Oe(t,e):e}var bi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,xi={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function Si(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=xi[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!bi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Ci(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var wi=256;function Ti(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=wi?t:t.slice(0,wi-1)+`…`}function Ei(e,t){if(!t)return e;let n=P.resolve(t),r=P.resolve(e);return r.startsWith(n+P.sep)||r===n?P.relative(n,r):e}function Di(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return t+`
|
|
4
|
+
`+e+(e.endsWith(`
|
|
5
|
+
`)?``:`
|
|
6
|
+
`)+t}function Y(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let e=i?.command??`Terminal`,t=i?.description;return{title:e,kind:`execute`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Read`:{let e=i?.file_path,t=e??`File`,r=i?.offset,a=i?.limit,o=``;a&&a>0?o=` (${r??1} - ${(r??1)+a-1})`:r&&(o=` (from line ${r})`);let s=t?Ei(t,n):`File`,c=J(e,n);return{title:`Read ${s}${o}`,kind:`read`,locations:c?[{path:c,line:r??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?Ei(e,n):void 0,a=J(e,n);return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:a?[{type:`diff`,path:a,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:a?[{path:a}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?Ei(e,n):void 0,o=J(e,n);return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:o?[{type:`diff`,path:o,oldText:t||null,newText:r}]:[],locations:o?[{path:o}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,r=J(e,n),a=`Find`;return e&&(a+=` \`${e}\``),t&&(a+=` \`${t}\``),{title:a,kind:`search`,content:[],locations:r?[{path:r}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function Oi(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:ki(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function ki(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`resource_link`:{let t=e.uri;return{type:`resource_link`,uri:t,name:e.name??t,mimeType:e.mimeType}}case`resource`:{let t=e.resource;return{type:`resource`,resource:{uri:t?.uri??``,mimeType:t?.mimeType,...typeof t?.text==`string`?{text:t.text}:{},...typeof t?.blob==`string`?{blob:t.blob}:{}}}}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
|
|
7
|
+
`)||``)}case`text_editor_code_execution_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);default:try{return{type:`text`,text:JSON.stringify(e)}}catch{return{type:`text`,text:`[content]`}}}}function Ai(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Oi(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:Di(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:Di(e.text)}:ki(e,!1)}))}:{};case`Bash`:{let e=``;if(i&&typeof i==`object`&&!Array.isArray(i)&&i.type===`bash_code_execution_result`){let t=i;e=[t.stdout,t.stderr].filter(Boolean).join(`
|
|
8
|
+
`)}else typeof i==`string`?e=i:Array.isArray(i)&&i.length>0&&(e=i.map(e=>e.type===`text`?e.text:``).join(`
|
|
9
|
+
`));return e.trim()?{content:[{type:`content`,content:{type:`text`,text:`\`\`\`console\n${e.trimEnd()}\n\`\`\``}}]}:{}}case`Edit`:case`Write`:return{};case`ExitPlanMode`:return{title:`Exited Plan Mode`};default:return Oi(i??``,r)}}function ji(e){return e===`in_progress`?`in_progress`:e===`completed`?`completed`:`pending`}function X(e,t,n,r,i,a,o){let s=[];for(let i of e){let e=i.type,a=null;switch(e){case`text`:case`text_delta`:{let e=i.text??``;a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`thinking`:case`thinking_delta`:{let e=i.thinking??``;a={sessionUpdate:`agent_thought_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`image`:{let e=i.source;e?.type===`base64`&&(a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`image`,data:e.data,mimeType:e.media_type}});break}case`tool_use`:case`server_tool_use`:case`mcp_tool_use`:{let t=i.id??``,n=i.name??`unknown`,s=i.input,c=t in r;if(r[t]={type:e,id:t,name:n,input:s},n===`TodoWrite`){let e=s?.todos;Array.isArray(e)&&(a={sessionUpdate:`plan`,entries:e.map(e=>({content:e.content,status:ji(e.status),priority:`medium`}))})}else{let e=s?{...s}:{};a=c?{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call_update`,status:`in_progress`,rawInput:e,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}:{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call`,rawInput:e,status:`pending`,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}}break}case`tool_result`:case`mcp_tool_result`:{let e=i.tool_use_id??``,t=r[e];if(!t)break;if(t.name!==`TodoWrite`){let n=Ai(i,{name:t.name,id:t.id},!1);a={_meta:{claudeCode:{toolName:t.name}},toolCallId:e,sessionUpdate:`tool_call_update`,status:i.is_error===!0?`failed`:`completed`,rawOutput:i.content,...n}}break}case`redacted_thinking`:case`input_json_delta`:case`citations_delta`:case`signature_delta`:case`container_upload`:case`compaction`:case`compaction_delta`:break}if(a){if(o?.parentToolUseId){let e=a._meta;a._meta={...e,claudeCode:{...e?.claudeCode??{},parentToolUseId:o.parentToolUseId}}}s.push({sessionId:n,update:a})}}return s}function Mi(e,t,n,r,i){let a=e.message;if(!a)return[];let o=a.content;if(!o)return[];if(typeof o==`string`)return[{sessionId:t,update:{sessionUpdate:`agent_message_chunk`,...i?.messageId?{messageId:i.messageId}:{},content:{type:`text`,text:o}}}];let s=i?.streamingActive?o.filter(e=>e.type!==`text`&&e.type!==`thinking`):o;return s.length===0?[]:X(s,`assistant`,t,n,r,void 0,i)}function Ni(e,t,n,r,i){let a=e.event;if(!a)return[];switch(a.type){case`content_block_start`:{let o=a.content_block;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`content_block_delta`:{let o=a.delta;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`message_start`:case`message_delta`:case`message_stop`:case`content_block_stop`:return[];default:return[]}}function Pi(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;return n}function Fi(e,t){let n=null,r=0;for(let i of Object.keys(e)){let e=Pi(i,t);e>r&&(r=e,n=i)}return n?e[n]??null:null}var Ii=console;function Li(e,t){if(t.aborted)return Promise.resolve({done:!0,value:void 0});let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e.next(),r]).finally(()=>{n&&t.removeEventListener(`abort`,n)})}async function Ri(e,t,n,r,i,a,o,s){let c=`end_turn`,l={inputTokens:0,outputTokens:0,cachedReadTokens:0,cachedWriteTokens:0},u=null,d=null,f=2e5,p=!1,m=null;try{for(;!r.aborted;){let s=await Li(t,r);if(s.done||r.aborted)break;let h=s.value;if(h==null)continue;let g=h;switch(g.type){case`system`:g.subtype===`compact_boundary`&&(u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
10
|
+
|
|
11
|
+
Compacting completed.`}}}));break;case`result`:{let t=g.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=g.modelUsage;if(i&&d){let e=Fi(i,d);e?.contextWindow&&(f=e.contextWindow)}u!==null&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:u,size:f}});let a=g.subtype,o=g.is_error;if(r.aborted){c=`cancelled`;break}switch(a){case`success`:{let e=g.stop_reason;c=e===`max_tokens`?`max_tokens`:e===`refusal`?`refusal`:`end_turn`,o&&(c=`end_turn`);break}case`error_during_execution`:c=g.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=g.parent_tool_use_id;t===null&&m===null&&(m=N());let r=Ni(g,e,i,n,{clientCapabilities:a,cwd:o,messageId:t===null?m??void 0:void 0});for(let e of r)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=g.message,r=g.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s;r===null&&(m===null&&(m=N()),s=m);let c=Mi(g,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p,messageId:s});for(let e of c)await n.sessionUpdate(e);r===null&&(m=null);break}case`user`:break;case`progress`:{let t=g.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
12
|
+
|
|
13
|
+
Compacting completed.`}}});break;default:Ii.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function zi(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Ii.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=N();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=X(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:N()});for(let e of t)await n.sessionUpdate(e)}}}function Bi(e,t,n,r,i,a,o,s){return async(n,c,u,d,f,p)=>{let m=Hi(r);if(n.name===`ExitPlanMode`)return Vi(e,t,f,c,m,i,a,o,s);if(p!==void 0)return p;try{let e=await l(n,c,u,d,f);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:f}}let h=Y({name:n.name,id:f,input:c},m,i),g={toolCallId:f,title:h.title,kind:h.kind,status:`pending`,rawInput:c},_=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:g,options:_});if(n.outcome.outcome===`cancelled`)return s?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:f};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:c}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Vi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=Y({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Hi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}me(),xe(),ee(),fe(),e(),s(),r();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`claude-code`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||ae(),n=await pe(t),r=await c({dir:t}),i=[];for(let e of r){if(!e.cwd||await pe(e.cwd)!==n)continue;let t=Ti(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Ui(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await M(e.sessionId);if(t)try{await Ee(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw q.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Ui(e){let t;try{let n=await d(e);n&&n.messages.length>0&&(t=a(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Wi=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Gi(e){return Wi.includes(e)}function Ki(e,t,n){if(t){let t=qi(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Xi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return Ji(n)??`default`}function qi(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return Si(e,t)}function Ji(e){if(e!=null)try{return Si(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Yi(e,t){return!!e&&Object.hasOwn(e,t)}function Xi(){return Zi()}function Zi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Qi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function $i(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function ea(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}A();function ta(){return ce().permissions?.defaultMode}async function na(e,t={}){de();let n=t.sessionId??N(),r=e.cwd;j(n,se()),re(r);let a=process.cwd(),s=!1;try{process.chdir(r),s=!0}catch{}ie(),ve();try{let a=_e(),s=h(a),c=e._meta,l=Yi(c,`permissionMode`),u=Ki(l?c?.permissionMode:void 0,l,ta()),d=$(this),p=this.conn,g=Bi(p,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,d,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),_=Xi(),v={...m(),toolPermissionContext:{...a,mode:u,isBypassPermissionsModeAvailable:_}},[ee,y]=await Promise.all([o(r),f(r)]);v.agentDefinitions=y;let b=new be({cwd:r,tools:s,commands:ee,mcpClients:[],agents:y.activeAgents,canUseTool:g,getAppState:()=>v,setAppState:e=>{let t=e(v);Object.assign(v,t)},readFileCache:new i(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),x={currentModeId:u,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},..._?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},S=Se(),C=he(),w={availableModels:S.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:C};b.setModel(C);let T=Qi(x,w),te={queryEngine:b,cancelled:!1,cancelGeneration:0,cwd:r,modes:x,models:w,configOptions:T,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:d,appState:v,commands:ee,sessionFingerprint:Ci({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,te),{sessionId:n,modes:x,models:w,configOptions:T}}finally{s&&process.chdir(a)}}Object.assign(Z.prototype,{createSession:na}),s(),r(),A(),fe();async function ra(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Ci({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await M(e.sessionId,e.cwd);return j(e.sessionId,r?Ce(r.filePath):null),re(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await M(e.sessionId,e.cwd),i=r?Ce(r.filePath):null;j(e.sessionId,i),re(e.cwd);let o;if(r)try{let t=await d(e.sessionId);t&&t.messages.length>0&&(o=a(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let s=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:o});if(t&&o&&o.length>0){let t=this.sessions.get(e.sessionId);t&&await zi(e.sessionId,o,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:s.sessionId,modes:s.modes,models:s.models,configOptions:s.configOptions}}async function ia(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function aa(e){try{let t=await d(e.sessionId);if(!t||t.messages.length===0)return;let n=a(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await zi(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function oa(e,t){if(!Gi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function sa(e,t,n){let r=this.sessions.get(e);r&&(ea(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:ra,teardownSession:ia,replaySessionHistory:aa,applySessionMode:oa,updateConfigOption:sa});function ca(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(la(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
|
|
14
|
+
`)}function la(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function ua(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),da(e),n}da(e)}function da(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}A();async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=ca(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=N();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),j(e.sessionId,se());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Ri(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await ma(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Claude Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=ua(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function pa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=$i(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),ea(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function ma(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=Ti(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:fa,setSessionConfigOption:pa}),ue(),ye();function ha(e,t){let n=we.toWeb(e);return hi(Te.toWeb(t),n)}async function ga(){de(),ve();let e=ha(process.stdin,process.stdout),t,n=new _i(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ga as runAcpAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{homedir as r}from"os";import{join as i}from"path";function a(e){let t=process.env.NODE_OPTIONS;return t?t.split(/\s+/).includes(e):!1}function o(e){if(!e)return!1;if(typeof e==`boolean`)return e;let t=e.toLowerCase().trim();return[`1`,`true`,`yes`,`on`].includes(t)}function s(e){if(e===void 0)return!1;if(typeof e==`boolean`)return!e;if(!e)return!1;let t=e.toLowerCase().trim();return[`0`,`false`,`no`,`off`].includes(t)}function c(){return o(process.env.CLAUDE_CODE_SIMPLE)||process.argv.includes(`--bare`)}function l(e){let t={};if(e)for(let n of e){let[e,...r]=n.split(`=`);if(!e||r.length===0)throw Error(`Invalid environment variable format: ${n}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`);t[e]=r.join(`=`)}return t}function u(){return process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION||`us-east-1`}function d(){return process.env.CLOUD_ML_REGION||`us-east5`}function f(){return o(process.env.CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR)}function p(){return!1}function m(){return!1}function h(e){if(e){let t=_.find(([t])=>e.startsWith(t));if(t)return process.env[t[1]]||d()}return d()}var g,_,v=e((()=>{n(),g=t(()=>(process.env.CLAUDE_CONFIG_DIR??i(r(),`.claude`)).normalize(`NFC`),()=>process.env.CLAUDE_CONFIG_DIR),_=[[`claude-haiku-4-5`,`VERTEX_REGION_CLAUDE_HAIKU_4_5`],[`claude-3-5-haiku`,`VERTEX_REGION_CLAUDE_3_5_HAIKU`],[`claude-3-5-sonnet`,`VERTEX_REGION_CLAUDE_3_5_SONNET`],[`claude-3-7-sonnet`,`VERTEX_REGION_CLAUDE_3_7_SONNET`],[`claude-opus-4-1`,`VERTEX_REGION_CLAUDE_4_1_OPUS`],[`claude-opus-4`,`VERTEX_REGION_CLAUDE_4_0_OPUS`],[`claude-sonnet-4-6`,`VERTEX_REGION_CLAUDE_4_6_SONNET`],[`claude-sonnet-4-5`,`VERTEX_REGION_CLAUDE_4_5_SONNET`],[`claude-sonnet-4`,`VERTEX_REGION_CLAUDE_4_0_SONNET`]]}));export{a,s as c,p as d,l as f,h as i,o as l,g as n,v as o,f as p,d as r,c as s,u as t,m as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{l as r,o as i}from"./envUtils-BDhHQY0-.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{E as s,O as c,S as l,i as u,l as d,n as f,s as p,v as m}from"./esm-lWlUmoUA.js";import{C as h,D as g,E as _,I as v,O as y,S as ee,V as te,_ as ne,a as b,d as re,k as ie,l as ae,n as oe,p as se,s as ce,t as le,w as ue,x as de,y as x}from"./esm-Cb-L4oAk.js";import{a as S,r as fe,t as pe}from"./esm-Bx6rTxIs.js";import{C as me,R as he,Wt as ge,pt as _e,tt as ve}from"./state-BemZdQIl.js";import{S as ye,a as be,w as xe,z as Se}from"./debug-RAynG_nM.js";import{Gt as C,Jt as Ce,Wt as we,qt as Te}from"./settings-DnptdP79.js";import{d as Ee,m as De}from"./git-2c7WlGDL.js";import{r as Oe,t as ke}from"./execFileNoThrow-Dwu6psHW.js";import{a as Ae,n as je,o as Me,r as Ne}from"./platform-BMPbglug.js";import{An as Pe,Bt as Fe,Ft as Ie,Gt as Le,_ as Re,jn as ze,u as Be}from"./model-BsZ4sP_H.js";import{i as Ve,t as He}from"./genericProcessUtils-CmsUPyRz.js";import{arch as Ue,hostname as We,platform as Ge,release as Ke}from"os";import{extname as qe}from"path";import{stat as Je}from"fs/promises";import{inspect as Ye}from"util";import*as Xe from"process";import{AsyncLocalStorage as Ze}from"async_hooks";function Qe(){return process.platform===`linux`&&r(process.env.CLAUDE_CODE_BUBBLEWRAP)}function $e(){return process.platform===`linux`?w??!1:!1}async function et(){if(T!==void 0)return T;if(process.platform===`darwin`)return T=null,null;try{let e=await He(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of we)if(e.includes(t))return T=t,t}}catch{}return T=null,null}async function tt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&C.platform!==`darwin`?await et()||`pycharm`:C.terminal}function nt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&C.platform!==`darwin`?T===void 0?`pycharm`:T||`pycharm`:C.terminal}async function rt(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await et()}var it,w,T,E,at=e((()=>{n(),Ce(),i(),Oe(),Ve(),it=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ke(`test`,[`-f`,`/.dockerenv`]);return e===0}),w=null,process.platform===`linux`&&Je(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{w=!0},()=>{w=!1}),E={...C,terminal:nt(),getIsDocker:it,getIsBubblewrapSandbox:Qe,isMuslEnvironment:$e,getTerminalWithJetBrainsDetectionAsync:tt,initJetBrainsDetection:rt}}));function ot(e){return st?.has(e)??!1}var st,ct=e((()=>{be(),Se()}));function D(){return O.getStore()}function lt(e,t){return O.run(e,t)}function ut(e){return e?.agentType===`subagent`}function dt(){let e=D();if(!(!ut(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function ft(){let e=D();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var O,pt=e((()=>{O=new Ze}));function mt(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function ht(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function gt(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&ot(t))}function _t(e,t,n){let r=vt(e);return!r||!Et.has(r.serverName)&&!gt(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function vt(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function yt(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function k(e,t=0){if(typeof e==`string`)return e.length>Dt?`${e.slice(0,Ot)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=kt)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,M).map(e=>k(e,t+1));return e.length>M&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,M).map(([e,n])=>[e,k(n,t+1)]);return n.length>M&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function bt(e){if(!ht())return;let t=xe(k(e));return t.length>j&&(t=t.slice(0,j)+`…[truncated]`),t}function A(e){let t=qe(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>At?`other`:n}function xt(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=A(t);e&&(r.add(e),n=e)}for(let t of e.split(Mt)){if(!t)continue;let e=t.split(Nt);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(jt.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=A(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function St(){let e=D();if(e)return{agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};let t=process.env.CLAUDE_CODE_AGENT_ID,n=process.env.CLAUDE_CODE_PARENT_SESSION_ID,r=t?`standalone`:void 0;if(t||r||n)return{...t?{agentId:t}:{},...r?{agentType:r}:{},...n?{parentSessionId:n}:{}};let i=ve();return i?{parentSessionId:i}:{}}function Ct(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(N&&P){let e=n-P;e>0&&(r=(t.user-N.user+(t.system-N.system))/(e*1e3)*100)}return N=t,P=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function wt(e={}){let t=e.model?String(e.model):Be(),n=typeof e.betas==`string`?e.betas:Pe(t).join(`,`),[r,i]=await Promise.all([Ft(),Ee()]),a=Ct();return{model:t,sessionId:_e(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(he()),clientType:me(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...St(),...Ie()&&{subscriptionType:Ie()},...i&&{rh:i}}}function Tt(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,skillMode:o,observerMode:s,...c}=e,l={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(l.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(l.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(l.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(l.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(l.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(l.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(l.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(l.github_action_ref=r.githubActionRef),r.wslVersion&&(l.wsl_version=r.wslVersion),r.linuxDistroId&&(l.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(l.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(l.linux_kernel=r.linuxKernel),r.vcs&&(l.vcs=r.vcs),r.versionBase&&(l.version_base=r.versionBase);let u={session_id:c.sessionId,model:c.model,user_type:c.userType,is_interactive:c.isInteractive===`true`,client_type:c.clientType};if(c.betas&&(u.betas=c.betas),c.entrypoint&&(u.entrypoint=c.entrypoint),c.agentSdkVersion&&(u.agent_sdk_version=c.agentSdkVersion),c.sweBenchRunId&&(u.swe_bench_run_id=c.sweBenchRunId),c.sweBenchInstanceId&&(u.swe_bench_instance_id=c.sweBenchInstanceId),c.sweBenchTaskId&&(u.swe_bench_task_id=c.sweBenchTaskId),c.agentId&&(u.agent_id=c.agentId),c.parentSessionId&&(u.parent_session_id=c.parentSessionId),c.agentType&&(u.agent_type=c.agentType),t.githubActionsMetadata){let e=t.githubActionsMetadata;l.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let d;return(t.accountUuid||t.organizationUuid)&&(d={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:l,...i&&{process:Buffer.from(xe(i)).toString(`base64`)},...d&&{auth:d},core:u,additional:{...a&&{rh:a},...o&&{skill_mode:o},...s&&{observer_mode:s},...n}}}var Et,Dt,Ot,j,M,kt,At,jt,Mt,Nt,Pt,Ft,N,P,It=e((()=>{n(),Ce(),at(),ze(),Re(),ge(),i(),ct(),Fe(),De(),Me(),pt(),ye(),Et=new Set,Dt=512,Ot=128,j=4*1024,M=20,kt=2,At=10,jt=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),Mt=/\s*(?:&&|\|\||[;|])\s*/,Nt=/\s+/,Pt=t(()=>{let e=`0.0.10`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),Ft=t(async()=>{let[e,t,n,i]=await Promise.all([C.getPackageManagers(),C.getRuntimes(),Ne(),je()]);return{platform:Te(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:C.arch,nodeVersion:C.nodeVersion,terminal:E.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:C.isRunningWithBun(),isCi:r(process.env.CI),isClaubbit:r(process.env.CLAUBBIT),isClaudeCodeRemote:r(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:C.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:r(process.env.GITHUB_ACTIONS),isClaudeCodeAction:r(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Le(),version:`0.0.10`,versionBase:Pt(),buildTime:`2026-08-12T15:59:36.773Z`,deploymentEnvironment:C.detectDeploymentEnvironment(),...r(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Ae()&&{wslVersion:Ae()},...n??{},...i.length>0?{vcs:i.join(`,`)}:{}}}),N=null,P=null}));function Lt(e){return e.setValue(zt,!0)}function Rt(e){return e.getValue(zt)===!0}var zt,Bt=e((()=>{f(),zt=c(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function Vt(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Ht(n)){p.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!Ut(r)){p.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Ht(e){return typeof e==`string`&&e!==``}function Ut(e){return e==null?!0:Array.isArray(e)?Wt(e):Gt(typeof e)}function Wt(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(Gt(e)){t=e;continue}return!1}return!1}}return!0}function Gt(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var Kt=e((()=>{f()}));function qt(){return e=>{p.error(Jt(e))}}function Jt(e){return typeof e==`string`?e:JSON.stringify(Yt(e))}function Yt(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Xt=e((()=>{f()}));function Zt(e){try{Qt(e)}catch{}}var Qt,$t=e((()=>{Xt(),Qt=qt()}));function en(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){p.warn(`Unknown value ${Ye(t)} for ${e}, expected a number, using defaults`);return}return n}function F(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}var tn=e((()=>{f()})),nn,rn=e((()=>{nn=`2.9.0`})),an,on=e((()=>{an=`process.runtime.name`})),I,sn=e((()=>{rn(),x(),on(),I={[g]:`opentelemetry`,[an]:`node`,[_]:ie,[y]:nn}})),L,cn=e((()=>{tn(),sn(),L=performance})),ln=e((()=>{cn()}));function R(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*vn)]}function un(e){return gn(R(L.timeOrigin),R(typeof e==`number`?e:L.now()))}function dn(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=z),[n,r]}function fn(e){return e[0]*1e6+e[1]/1e3}function pn(e){return e[0]+e[1]/z}function mn(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function hn(e){return mn(e)||typeof e==`number`||e instanceof Date}function gn(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=z&&(n[1]-=z,n[0]+=1),n}var _n,vn,z,yn=e((()=>{ln(),_n=9,vn=10**6,z=10**_n})),B,bn=e((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(B||(B={}))}));function xn(e){if(!Sn(e)||Cn(e)!==En)return!1;let t=An(e);if(t===null)return!0;let n=U.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&V.call(n)===kn}function Sn(e){return typeof e==`object`&&!!e}function Cn(e){return e==null?e===void 0?On:Dn:W&&W in Object(e)?wn(e):Tn(e)}function wn(e){let t=U.call(e,W),n=e[W],r=!1;try{e[W]=void 0,r=!0}catch{}let i=G.call(e);return r&&(t?e[W]=n:delete e[W]),i}function Tn(e){return G.call(e)}var En,Dn,On,V,kn,An,H,U,W,G,jn=e((()=>{En=`[object Object]`,Dn=`[object Null]`,On=`[object Undefined]`,V=Function.prototype.toString,kn=V.call(Object),An=Object.getPrototypeOf,H=Object.prototype,U=H.hasOwnProperty,W=Symbol?Symbol.toStringTag:void 0,G=H.toString}));function Mn(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Nn(t,e.shift(),0,n);return t}function K(e){return q(e)?e.slice():e}function Nn(e,t,n=0,r){let i;if(!(n>Ln)){if(n++,Y(e)||Y(t)||Fn(t))i=K(t);else if(q(e)){if(i=e.slice(),q(t))for(let e=0,n=t.length;e<n;e++)i.push(K(t[e]));else if(J(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=K(t[r]))}}}else if(J(e))if(J(t)){if(!In(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Y(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Pn(e,s,r)||Pn(t,s,r))delete i[s];else{if(J(a)&&J(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Nn(i[s],c,n,r)}}}}else i=t;return i}}function Pn(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function q(e){return Array.isArray(e)}function Fn(e){return typeof e==`function`}function J(e){return!Y(e)&&!q(e)&&!Fn(e)&&typeof e==`object`}function Y(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function In(e,t){return!(!xn(e)||!xn(t))}var Ln,Rn=e((()=>{jn(),Ln=20})),zn,Bn=e((()=>{a(),zn=class{constructor(){o(this,`_promise`,void 0),o(this,`_resolve`,void 0),o(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),Vn,Hn=e((()=>{Bn(),a(),Vn=class{constructor(e,t){o(this,`_isCalled`,!1),o(this,`_deferred`,new zn),o(this,`_callback`,void 0),o(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function Un(e,t){return new Promise(n=>{d.with(Lt(d.active()),()=>{e.export(t,n)})})}var Wn=e((()=>{f(),Bt()})),Gn,X=e((()=>{Bt(),Kt(),$t(),Xt(),yn(),bn(),ln(),Rn(),Hn(),Wn(),Gn={_export:Un}}));function Kn(){if(Z===void 0)try{let e=globalThis.process.argv0;Z=e?`unknown_service:${e}`:`unknown_service`}catch{Z=`unknown_service`}return Z}var Z,qn=e((()=>{})),Q,Jn=e((()=>{Q=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function Yn(e,t){return er.FromAttributeList(Object.entries(e),t)}function Xn(){return Yn({[ue]:Kn(),[_]:I[_],[g]:I[g],[y]:I[y]})}function Zn(e){return e.map(([e,t])=>Q(t)?[e,t.catch(t=>{p.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function Qn(e){if(typeof e==`string`||e===void 0)return e;p.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function $n(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;p.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var er,tr=e((()=>{f(),X(),x(),qn(),Jn(),a(),er=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Zn(t),r._asyncAttributesPending=t.filter(([e,t])=>Q(t)).length>0,r}constructor(e,t){o(this,`_rawAttributes`,void 0),o(this,`_asyncAttributesPending`,!1),o(this,`_schemaUrl`,void 0),o(this,`_memoizedAttributes`,void 0);let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Q(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Zn(this._rawAttributes),this._schemaUrl=Qn(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Q(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&p.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Q(n)){p.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=$n(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),nr,rr,ir=e((()=>{f(),x(),X(),a(),nr=class{constructor(){o(this,`_MAX_LENGTH`,255),o(this,`_COMMA_SEPARATOR`,`,`),o(this,`_LABEL_KEY_VALUE_SPLITTER`,`=`)}detect(e){let t={},n=F(`OTEL_RESOURCE_ATTRIBUTES`),r=F(`OTEL_SERVICE_NAME`);if(n)try{let e=this._parseResourceAttributes(n);Object.assign(t,e)}catch(e){p.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return r&&(t[ue]=r),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},rr=new nr})),ar,or,sr,cr,lr,ur=e((()=>{ar=`host.arch`,or=`host.id`,sr=`host.name`,cr=`os.type`,lr=`os.version`}));async function dr(){if(!$)switch(Xe.platform){case`darwin`:$=(await import(`./getMachineId-darwin-CsRhaP3y.js`)).getMachineId;break;case`linux`:$=(await import(`./getMachineId-linux-Bd7UBNRQ.js`)).getMachineId;break;case`freebsd`:$=(await import(`./getMachineId-bsd-Cut1kHoA.js`)).getMachineId;break;case`win32`:$=(await import(`./getMachineId-win-DamF2CH_.js`)).getMachineId;break;default:$=(await import(`./getMachineId-unsupported-vFGP8E_8.js`)).getMachineId;break}return $()}var $,fr=e((()=>{})),pr,mr,hr=e((()=>{pr=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},mr=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),gr,_r,vr=e((()=>{ur(),fr(),hr(),gr=class{detect(e){return{attributes:{[sr]:We(),[ar]:pr(Ue()),[or]:dr()}}}},_r=new gr})),yr,br,xr=e((()=>{ur(),hr(),yr=class{detect(e){return{attributes:{[cr]:mr(Ge()),[lr]:Ke()}}}},br=new yr})),Sr=e((()=>{vr(),xr(),ur()})),Cr=e((()=>{Sr()})),wr=e((()=>{ir(),Cr()})),Tr=e((()=>{tr(),wr(),qn()}));function Er(e){return Dr(e,new WeakSet)}function Dr(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Dr(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Dr(e,t))}return!1}var Or=e((()=>{})),kr,Ar=e((()=>{f(),b(),x(),Or(),a(),kr=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){o(this,`hrTime`,void 0),o(this,`hrTimeObserved`,void 0),o(this,`spanContext`,void 0),o(this,`resource`,void 0),o(this,`instrumentationScope`,void 0),o(this,`attributes`,{}),o(this,`_severityText`,void 0),o(this,`_severityNumber`,void 0),o(this,`_body`,void 0),o(this,`_eventName`,void 0),o(this,`_attributesCount`,0),o(this,`_droppedAttributesCount`,0),o(this,`_isReadonly`,!1),o(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:s,severityText:c,body:l,attributes:d={},exception:f,context:p}=n,h=Date.now();if(this.hrTime=ne(r??h),this.hrTimeObserved=ne(i??h),p){let e=u.getSpanContext(p);e&&m(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=c,this.body=l,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(d),f!=null&&this._setException(f)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return p.warn(`Invalid attribute key: ${e}`),this;if(!Er(t))return p.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&p.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return p.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(de,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(h,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(h,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(de,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ee,n.stack),t=!0)}t||p.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&p.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),jr,Mr=e((()=>{pe(),f(),Ar(),a(),jr=class{constructor(e,t){o(this,`instrumentationScope`,void 0),o(this,`_sharedState`,void 0),o(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||d.active(),r=e.severityNumber??S.UNSPECIFIED;if(r!==S.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=u.getSpanContext(n);if(e&&m(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return}let i=new kr(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==S.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||d.active();if(t.traceBased){let e=u.getSpanContext(r);if(e&&m(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),Nr,Pr=e((()=>{Nr=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),Fr,Ir=e((()=>{b(),a(),Fr=class{constructor(e,t){o(this,`processors`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>ae(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function Lr(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Rr=e((()=>{})),zr,Br=e((()=>{zr=`otel.sdk.log.created`})),Vr,Hr=e((()=>{Br(),a(),Vr=class{constructor(e){o(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(zr,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),Ur,Wr=e((()=>{Ur=`0.215.0`})),Gr,Kr,qr,Jr=e((()=>{f(),pe(),Pr(),Ir(),Rr(),Hr(),Wr(),a(),Gr={disabled:!1,minimumSeverity:S.UNSPECIFIED,traceBased:!1},Kr=()=>({...Gr}),qr=class{constructor(e,t,n,r,i,a){o(this,`loggers`,new Map),o(this,`activeProcessor`,void 0),o(this,`registeredLogRecordProcessors`,[]),o(this,`resource`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),o(this,`logRecordLimits`,void 0),o(this,`processors`,void 0),o(this,`loggerMetrics`,void 0),o(this,`_loggerConfigurator`,void 0),o(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Fr(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Nr,this._loggerConfigurator=i??Kr;let c=a?a.getMeter(`@opentelemetry/sdk-logs`,Ur):s();this.loggerMetrics=new Vr(c)}getLoggerConfig(e){let t=Lr(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),Yr,Xr=e((()=>{f(),pe(),le(),b(),Mr(),Jr(),a(),Yr=class{constructor(e={}){o(this,`_shutdownOnce`,void 0),o(this,`_sharedState`,void 0);let t={resource:e.resource??oe(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Kr,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new qr(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new ce(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return p.warn(`A shutdown LoggerProvider cannot provide a Logger`),fe;e||p.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new jr({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(p.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(p.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),Zr,Qr=e((()=>{b(),Zr=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:se(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:re.SUCCESS})}}}));async function $r(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var ei,ti,ni=e((()=>{f(),b(),a(),ei=class{constructor(e,t,n){o(this,`_exportCompleted`,void 0),o(this,`_exportScheduledPromise`,void 0),o(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await $r(t),await d.with(te(d.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){v(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===re.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},ti=class{constructor(e,t){o(this,`_maxExportBatchSize`,void 0),o(this,`_maxQueueSize`,void 0),o(this,`_scheduledDelayMillis`,void 0),o(this,`_exportTimeoutMillis`,void 0),o(this,`_exporter`,void 0),o(this,`_currentExport`,null),o(this,`_finishedLogRecords`,[]),o(this,`_timer`,void 0),o(this,`_shutdownOnce`,void 0),o(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new ce(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(p.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new ei(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){v(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new ei(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,v(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),ri,ii=e((()=>{ni(),ri=class extends ti{onShutdown(){}}})),ai=e((()=>{ii()})),oi=e((()=>{ai()})),si=e((()=>{Xr(),Qr(),oi()}));export{xt as $,pn as A,Zt as B,Mn as C,un as D,gn as E,cn as F,Bt as G,Kt as H,L as I,vt as J,Rt as K,en as L,hn as M,mn as N,dn as O,R as P,A as Q,F as R,Rn as S,bn as T,Ut as U,$t as V,Vt as W,bt as X,yt as Y,wt as Z,Yn as _,Qr as a,ft as at,Vn as b,Tr as c,pt as ct,_r as d,rt as dt,It as et,vr as f,at as ft,tr as g,Xn as h,Zr as i,Tt as it,yn as j,fn as k,xr as l,lt,ir as m,ri as n,_t as nt,Yr as o,D as ot,rr as p,Lt as q,ii as r,mt as rt,Xr as s,dt as st,si as t,ht as tt,br as u,E as ut,X as v,B as w,Hn as x,Gn as y,tn as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as m,t as h}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{i as g,n as _,r as v,t as y}from"./figures-5ThXQEtq.js";import{n as b,t as x}from"./cwd-
|
|
1
|
+
import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as m,t as h}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{i as g,n as _,r as v,t as y}from"./figures-5ThXQEtq.js";import{n as b,t as x}from"./cwd-Cfdf7z7s.js";import{S as ee,T as te}from"./debug-RAynG_nM.js";import{o as ne,s as re}from"./log-CezCRpAN.js";import{aborted as ie,callbackify as S,debuglog as ae,inspect as oe,promisify as se,stripVTControlCharacters as ce}from"node:util";import C,{execArgv as le,execPath as ue,hrtime as de,platform as fe}from"node:process";import w from"node:path";import{ChildProcess as pe,execFile as me,spawn as he,spawnSync as ge}from"node:child_process";import{appendFileSync as _e,createReadStream as ve,createWriteStream as ye,readFileSync as be,statSync as xe,writeFileSync as Se}from"node:fs";import{constants as T}from"node:os";import Ce from"node:tty";import{EventEmitter as we,addAbortListener as Te,on as Ee,once as E,setMaxListeners as De}from"node:events";import{Duplex as Oe,PassThrough as ke,Readable as D,Transform as Ae,Writable as je,getDefaultHighWaterMark as Me}from"node:stream";import{StringDecoder as Ne}from"node:string_decoder";import{fileURLToPath as Pe}from"node:url";import{Buffer as Fe}from"node:buffer";import{scheduler as Ie,setImmediate as Le,setTimeout as Re}from"node:timers/promises";import{serialize as ze}from"node:v8";import{finished as O}from"node:stream/promises";function k(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var A=t((()=>{})),Be,Ve,He,Ue,We=t((()=>{Be=(e,t)=>{let n=Ue(Ve(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},Ve=e=>He(e)?e.toString():e,He=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,Ue=e=>e instanceof URL?Pe(e):e})),Ge,Ke=t((()=>{A(),We(),Ge=(e,t=[],n={})=>{let r=Be(e,`First argument`),[i,a]=k(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!k(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]}})),qe,Je,j,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,M=t((()=>{({toString:qe}=Object.prototype),Je=e=>qe.call(e)===`[object ArrayBuffer]`,j=e=>qe.call(e)===`[object Uint8Array]`,Ye=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Xe=new TextEncoder,Ze=e=>Xe.encode(e),Qe=new TextDecoder,$e=e=>Qe.decode(e),et=(e,t)=>tt(e,t).join(``),tt=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new Ne(t),r=e.map(e=>typeof e==`string`?Ze(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},nt=e=>e.length===1&&j(e[0])?e[0]:it(rt(e)),rt=e=>e.map(e=>typeof e==`string`?Ze(e):e),it=e=>{let t=new Uint8Array(at(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},at=e=>{let t=0;for(let n of e)t+=n.length;return t}})),ot,st,ct,lt,ut,dt,ft,pt,mt,ht=t((()=>{A(),M(),ot=e=>Array.isArray(e)&&Array.isArray(e.raw),st=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=ct({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},ct=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=lt(i,e.raw[r]),c=ft(n,a,o);if(r===t.length)return c;let l=t[r],u=Array.isArray(l)?l.map(e=>pt(e)):[pt(l)];return ft(c,u,s)},lt=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=ut.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(ut.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
|
|
2
2
|
`?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=dt[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},ut=new Set([` `,` `,`\r`,`
|
|
3
3
|
`]),dt={x:3,u:5},ft=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],pt=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(k(e)&&(`stdout`in e||`isMaxBuffer`in e))return mt(e);throw e instanceof pe||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},mt=({stdout:e})=>{if(typeof e==`string`)return e;if(j(e))return $e(e);throw TypeError(e===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${typeof e}" stdout in template expression`)}})),N,gt,P,_t,F=t((()=>{N=e=>gt.includes(e),gt=[C.stdin,C.stdout,C.stderr],P=[`stdin`,`stdout`,`stderr`],_t=e=>P[e]??`stdio[${e}]`})),vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,I=t((()=>{A(),F(),vt=e=>{let t={...e};for(let n of At)t[n]=yt(e,n);return t},yt=(e,t)=>{let n=Array.from({length:bt(e)+1}),r=xt(e[t],n,t);return Ot(r,t)},bt=({stdio:e})=>Array.isArray(e)?Math.max(e.length,P.length):P.length,xt=(e,t,n)=>k(e)?St(e,t,n):t.fill(e),St=(e,t,n)=>{for(let r of Object.keys(e).sort(Ct))for(let i of Tt(r,n,t))t[i]=e[r];return t},Ct=(e,t)=>wt(e)<wt(t)?1:-1,wt=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,Tt=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=Et(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
|
|
4
4
|
It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{S as t,T as n}from"./debug-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{S as t,T as n}from"./debug-RAynG_nM.js";import{execSync as r}from"child_process";function i(e,t){return n`execSync: ${e.slice(0,100)}`,r(e,t)}var a=e((()=>{t()}));export{a as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{QT as t,St as n,Tt as r,ZT as i,bc as a,rf as o,tf as s,xc as c}from"./loadAgentsDir-C7lOqvfh.js";import{fi as l}from"./src-P_wYS_NJ2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{n as d,t as f}from"./ExitFlow-DVKxFdpX.js";import{spawnSync as p}from"child_process";function m(){return t(_)??`Goodbye!`}async function h(e){if(c())return e(),p(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=n()!==null;return t?(0,g.jsx)(f,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(m()),await s(0,`prompt_input_exit`),null)}var g,_;e((()=>{i(),l(),d(),a(),o(),r(),g=u(),_=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{h as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Cg as n,Ip as r,Lp as i,nd as a,qC as o,td as s,wg as c}from"./loadAgentsDir-C7lOqvfh.js";import{D as l,Gt as u,I as d,P as f,T as p,fi as m,t as h,x as g}from"./src-P_wYS_NJ2.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{Bt as v,G as y,Gn as b,Gt as x,Kn as S,_ as C,et as w,nt as T,rt as E,tt as D,x as O}from"./model-BsZ4sP_H.js";import{n as k,t as A}from"./useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js";import{n as j,t as M}from"./modelOptions-CxP067Qv.js";function N({initial:e,sessionModel:t,onSelect:n,onCancel:i,isStandaloneCommand:o,showFastModeNotice:s,headerText:m}){let h=k(),_=e===null?I:e,[v,x]=(0,P.useState)(_),S=c(e=>E()?e.fastMode:!1),[C,w]=(0,P.useState)(()=>new Set(b(_)?[_.replace(/\[1m\]/i,``)]:[])),A=(0,P.useCallback)(()=>{if(!v||v===I)return;let e=v.replace(/\[1m\]/i,``);w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[v]),j=(0,P.useMemo)(()=>M(S??!1),[S]),N=(0,P.useMemo)(()=>e!==null&&!j.some(t=>t.value===e)?[...j,{value:e,label:O(e),description:`Current model`}]:j,[j,e]),L=(0,P.useMemo)(()=>N.map(e=>({...e,value:e.value===null?I:e.value})),[N]),R=(0,P.useMemo)(()=>L.some(e=>e.value===_)?_:L[0]?.value??void 0,[L,_]),z=Math.min(10,L.length),B=Math.max(0,L.length-z),V=L.find(e=>e.value===v)?.label,H=v!==void 0&&v!==I&&C.has(v.replace(/\[1m\]/i,``)),U=(0,P.useCallback)(e=>{x(e)},[]);u({"modelPicker:toggle1M":()=>A()},{context:`ModelPicker`});function W(e){if(e===I){n(null);return}let t=e.replace(/\[1m\]/i,``);n(C.has(t)?`${t}[1m]`:t)}let G=(0,F.jsxs)(d,{flexDirection:`column`,children:[(0,F.jsxs)(d,{flexDirection:`column`,children:[(0,F.jsxs)(d,{marginBottom:1,flexDirection:`column`,children:[(0,F.jsx)(f,{color:`remember`,bold:!0,children:`Select model`}),(0,F.jsx)(f,{dimColor:!0,children:m??`Choose a model for this and future sessions. Use Space to toggle 1M context.`}),t&&(0,F.jsxs)(f,{dimColor:!0,children:[`Currently using `,O(t),` for this session (set by plan mode). Selecting a model will undo this.`]})]}),(0,F.jsxs)(d,{flexDirection:`column`,marginBottom:1,children:[(0,F.jsx)(d,{flexDirection:`column`,children:(0,F.jsx)(a,{defaultValue:_,defaultFocusValue:R,options:L,onChange:W,onFocus:U,onCancel:i??(()=>{}),visibleOptionCount:z})}),B>0&&(0,F.jsx)(d,{paddingLeft:3,children:(0,F.jsxs)(f,{dimColor:!0,children:[`and `,B,` more…`]})})]}),(0,F.jsx)(d,{marginBottom:1,flexDirection:`column`,children:H?(0,F.jsxs)(f,{dimColor:!0,children:[`1M context on`,(0,F.jsx)(f,{color:`subtle`,children:` · Space to toggle`})]}):(0,F.jsxs)(f,{color:`subtle`,children:[`1M context off`,V?` for ${V}`:``,(0,F.jsx)(f,{color:`subtle`,children:` · Space to toggle`})]})}),E()?s?(0,F.jsx)(d,{marginBottom:1,children:(0,F.jsxs)(f,{dimColor:!0,children:[`Fast mode is `,(0,F.jsx)(f,{bold:!0,children:`ON`}),` and available with `,y,` only (/fast). Switching to other models turn off fast mode.`]})}):D()&&!T()?(0,F.jsx)(d,{marginBottom:1,children:(0,F.jsxs)(f,{dimColor:!0,children:[`Use `,(0,F.jsx)(f,{bold:!0,children:`/fast`}),` to turn on Fast mode (`,y,` only).`]})}):null:null]}),o&&(0,F.jsx)(f,{dimColor:!0,italic:!0,children:h.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,F.jsxs)(p,{children:[(0,F.jsx)(l,{shortcut:`Enter`,action:`confirm`}),(0,F.jsx)(r,{action:`select:cancel`,context:`Select`,fallback:`Esc`,description:`exit`})]})})]});return o?(0,F.jsx)(g,{color:`permission`,children:G}):G}var P,F,I,L=e((()=>{m(),P=t(m(),1),S(),A(),w(),h(),o(),n(),C(),j(),i(),s(),F=_(),I=`__NO_PREFERENCE__`}));function R(e,t,n){if(!x())return!1;if(t)return!0;if(e===null||!b(e))return!1;let r=e.toLowerCase().replace(/\[1m\]$/,``).trim(),i=r===`opus`||r.includes(`opus-4-6`)||r.includes(`opus-4-7`),a=r===`sonnet`||r.includes(`sonnet-4-6`);return i&&n?!1:i||a}var z=e((()=>{v(),S()}));export{L as i,R as n,N as r,z as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Bc as e,Rc as t,Vc as n,zc as r}from"./loadAgentsDir-C7lOqvfh.js";n();export{t as drainPendingExtraction,r as executeExtractMemories,e as initExtractMemories};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Cg as n,Eg as r,qC as i,wg as a}from"./loadAgentsDir-C7lOqvfh.js";import{Gt as o,I as s,Lt as c,P as l,di as u,fi as d,j as f,t as p,ui as m,y as h}from"./src-P_wYS_NJ2.js";import{t as g}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as _,g as v,x as y}from"./settings-DnptdP79.js";import{c as b,h as x}from"./config-Do1870_d.js";import{n as S,r as C}from"./analytics-DJobLaWP.js";import{l as w,v as T}from"./startupProfiler-L_UWZ03w.js";import{G as E,H as D,J as O,K as k,U as A,W as j,X as M,et as N,it as P,lt as F,q as I,rt as L}from"./model-BsZ4sP_H.js";import{n as R,t as z}from"./systemTheme-Ceakddth.js";function B({cooldown:e}){return e?(0,H.jsx)(l,{color:`promptBorder`,dimColor:!0,children:`↯`}):(0,H.jsx)(l,{color:`fastMode`,children:`↯`})}function V(e=!0,t=!1){if(!e)return`↯`;let n=R(b().theme);return t?m.dim(f(`promptBorder`,n)(`↯`)):f(`fastMode`,n)(`↯`)}var H,U=e((()=>{u(),d(),_(),p(),x(),z(),H=g()}));function W(e,t){k(),y(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!P(e.mainLoopModel);return{...e,...t?{mainLoopModel:I(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function G({onDone:e,unavailableReason:t}){let n=a(e=>e.mainLoopModel),i=a(e=>e.fastMode),u=r(),[d,f]=(0,J.useState)(i??!1),p=O(),m=p.status===`cooldown`,g=t!==null,_=D(A(!0));function v(){g||(W(d,u),C(`tengu_fast_mode_toggled`,{enabled:d,source:`picker`}),d?e(`${V(d)} Fast mode ON${P(n)?``:` · model set to ${E}`} · ${_}`):(u(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function y(){if(g){i&&W(!1,u),e(`Fast mode OFF`,{display:`system`});return}e(i?`${V()} Kept Fast mode ON`:`Kept Fast mode OFF`,{display:`system`})}function b(){g||f(e=>!e)}return o({"confirm:yes":v,"confirm:nextField":b,"confirm:next":b,"confirm:previous":b,"confirm:cycleMode":b,"confirm:toggle":b},{context:`Confirmation`}),(0,Y.jsxs)(h,{title:(0,Y.jsxs)(l,{children:[(0,Y.jsx)(B,{cooldown:m}),` Fast mode (research preview)`]}),subtitle:`High-speed mode for ${E}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:y,color:`fastMode`,inputGuide:e=>e.pending?(0,Y.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):g?(0,Y.jsx)(l,{children:`Esc to cancel`}):(0,Y.jsx)(l,{children:`Tab to toggle · Enter to confirm · Esc to cancel`}),children:[t?(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsx)(l,{color:`error`,children:t})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(s,{flexDirection:`column`,gap:0,marginLeft:2,children:(0,Y.jsxs)(s,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(l,{bold:!0,children:`Fast mode`}),(0,Y.jsx)(l,{color:d?`fastMode`:void 0,bold:d,children:d?`ON `:`OFF`}),(0,Y.jsx)(l,{dimColor:!0,children:_})]})}),m&&p.status===`cooldown`&&(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsxs)(l,{color:`warning`,children:[p.reason===`overloaded`?`Fast mode overloaded and is temporarily unavailable`:`You've hit your fast limit`,` · resets in `,w(p.resetAt-Date.now(),{hideTrailingZeros:!0})]})})]}),(0,Y.jsxs)(l,{dimColor:!0,children:[`Learn more:`,` `,(0,Y.jsx)(c,{url:`https://code.claude.com/docs/en/fast-mode`,children:`https://code.claude.com/docs/en/fast-mode`})]})]})}async function K(e,t,n){let r=M();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return W(e,n),C(`tengu_fast_mode_toggled`,{enabled:e,source:`shortcut`}),e?`${V(!0)} Fast mode ON${P(i)?``:` · model set to ${E}`} · ${D(A(!0))}`:`Fast mode OFF`}async function q(e,t,n){if(!L())return null;await F();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await K(r===`on`,t.getAppState,t.setAppState)),null;let i=M();return C(`tengu_fast_mode_picker_shown`,{unavailable_reason:i??``}),(0,Y.jsx)(G,{onDone:e,unavailableReason:i})}var J,Y,X=e((()=>{d(),J=t(d(),1),p(),U(),i(),S(),n(),N(),T(),j(),v(),Y=g()}));export{U as a,V as i,q as n,X as r,G as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./fast-BU4iUZ8E.js";t();export{n as FastModePicker,e as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(){return process.env.SKILL_LEARNING_ENABLED===`1`||process.env.FEATURE_SKILL_LEARNING===`1`}var n=e((()=>{}));export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./featureCheck-D6FjD-nt.js";t();export{e as isSkillLearningEnabled};
|
|
@@ -0,0 +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{Bt as a,Pt as o,_ as s,g as c,p as l,vn as u}from"./loadAgentsDir-C7lOqvfh.js";import{lr as d,ur as f}from"./state-BemZdQIl.js";import{n as p,t as m}from"./cwd-Cfdf7z7s.js";import{F as h,a as g,d as _,l as v,p as ee,z as y}from"./debug-RAynG_nM.js";import{ar as b,g as x,n as te,sr as ne}from"./settings-DnptdP79.js";import{c as re,h as ie}from"./config-Do1870_d.js";import{m as ae,p as oe,r as S}from"./git-2c7WlGDL.js";import{n as se,r as ce}from"./execFileNoThrow-Dwu6psHW.js";import{o as le,s as C}from"./log-CezCRpAN.js";import{n as ue,r as w}from"./analytics-DJobLaWP.js";import{a as de,s as fe}from"./ripgrep-DvOOsDMv.js";import*as T from"path";import{statSync as pe}from"fs";function me(e,t,n){if(t===0)return n?k:0;let r=e.charCodeAt(t-1);return he(r)?be:ge(r)&&_e(e.charCodeAt(t))?D:0}function he(e){return e===47||e===92||e===45||e===95||e===46||e===32}function ge(e){return e>=97&&e<=122}function _e(e){return e>=65&&e<=90}function E(){return new Promise(e=>setImmediate(e))}function ve(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 ye,be,D,O,k,A,j,M,N,P,F,xe=e((()=>{n(),ye=16,be=8,D=6,O=4,k=8,A=3,j=1,M=100,N=64,P=new Int32Array(N),F=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 E(),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 E(),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=ve(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+k+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:p,readyCount:m}=this;for(let e=0;e<m;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],m=a[0],h=0,g=[],_=r.indexOf(m);if(_===-1)continue;g[h++]=_;for(let e=_+1;e<r.length;e++){if(r.charCodeAt(e)!==m.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(g[h++]=e)}let v=u[e],ee=p[e],y=Math.max(0,32-(ee>>2)),b=-1/0;for(let e=0;e<h;e++){P[0]=g[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+=O:n+=A+i*j,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*ye+o-n;f+=me(v,P[0],!0);for(let e=1;e<i;e++)f+=me(v,P[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:v,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:v,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let h=c.length,g=Math.max(h,1),_=Array(h);for(let e=0;e<h;e++){let t=c[e].path,n=e/g;_[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return _}}}));function I(){return z||(z=new F),z}function Se(){z=null,B=null,H++,U=null,W=[],G=[],K=[],V.clear(),q=null,J=null,Y=0,X=null,Z=null,Q=null}function Ce(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 we(){let e=S(m());if(!e)return null;try{return pe(T.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function Te(e,t,n){return n===t?e:e.map(e=>{let r=T.join(t,e);return T.relative(n,r)})}async function Ee(e){if(e.length===0||!z||W.length===0)return;let t=await ke(e),n=[...W,...G,...K,...e,...t],r=Ce(n);if(r===Q){v(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await z.loadFromFileListAsync(n).done,Q=r,v(`[FileIndex] rebuilt index with ${W.length} tracked + ${e.length} untracked files`)}async function De(e,t){let n=`${e}:${t}`;if(J===n)return q;let r=_(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,Be.default)(),s=!1,c=a.flatMap(e=>i.map(t=>T.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,v(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return q=u,J=n,u}async function Oe(e,t){let n=Date.now();v(`[FileIndex] getFilesUsingGit called`);let r=m(),i=S(r);if(!i)return v(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await se(oe(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(v(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return v(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=Te(o.stdout.trim().split(`
|
|
2
|
+
`).filter(Boolean),i,r),c=await De(i,r);if(c){let e=s.length;s=c.filter(s),v(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}W=s;let l=Date.now()-n;if(v(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),w(`tengu_file_suggestions_git_ls_files`,{file_count:s.length,tracked_count:s.length,untracked_count:0,duration_ms:l}),!U){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=H;U=se(oe(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===H&&e.code===0){let t=Te(e.stdout.trim().split(`
|
|
3
|
+
`).filter(Boolean),i,r),n=await De(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),v(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}v(`[FileIndex] background untracked fetch: ${t.length} files`),Ee(t)}}).catch(e=>{v(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{U=null})}return s}catch(e){return v(`[FileIndex] git ls-files error: ${h(e)}`),null}}async function ke(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)Ae(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await E(),n=performance.now());return[...t].map(e=>e+T.sep)}function Ae(e,t,n,r){for(let i=t;i<n;i++){let t=T.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=T.dirname(t);if(e===t)break;r.add(t),t=e}}}async function je(e){return(await Promise.all(l.map(t=>s(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function Me(e,t){v(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await Oe(e,t);if(n!==null)return v(`[FileIndex] using git ls-files result (${n.length} files)`),n;v(`[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 fe(i,`.`,e)).map(e=>T.relative(m(),e)),o=Date.now()-r;return v(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),w(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function Ne(){let e=AbortSignal.timeout(1e4),t=I();try{let n=te(),r=re(),i=n.respectGitignore??r.respectGitignore??!0,a=m(),[o,s]=await Promise.all([Me(e,i),je(a)]);G=s;let c=[...o,...s],l=await ke(c);K=l;let u=[...l,...c],d=Ce(u);d===Z?v(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,Z=d,Q=null)}catch(e){C(e)}return t}function Pe(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 Fe(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=Pe(n,r),n===``)return``}return n}function L(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Ie(e,t){return e.search(t,$).map(e=>L(e.path,e.score))}function R(){if(B)return;let e=we();if(z&&!(e!==null&&e!==X)&&Date.now()-Y<He)return;let t=H,n=Date.now();I(),B=Ne().then(r=>t===H?(B=null,V.emit(),X=e,Y=Date.now(),v(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(v(`[FileIndex] Cache refresh failed: ${h(e)}`),C(e),t===H&&(B=null),I()))}async function Le(){let e=_(),t=m();try{return(await e.readdir(t)).map(e=>{let n=T.join(t,e.name),r=T.relative(t,n);return e.isDirectory()?r+T.sep:r})}catch(e){return C(e),[]}}async function Re(e,t=!1){if(!e&&!t)return[];if(te().fileSuggestion?.type===`command`)return(await a({...o(),query:e})).slice(0,$).map(L);if(e===``||e===`.`||e===`./`){let e=await Le();return R(),e.slice(0,$).map(L)}let n=Date.now();try{let t=B!==null;R();let r=e,i=`.`+T.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=b(r));let a=z?Ie(z,r):[],o=Date.now()-n;return v(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),w(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return C(e),[]}}function ze(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 Be,z,B,V,Ve,H,U,W,G,K,q,J,Y,X,Z,Q,$,He,Ue=e((()=>{Be=t(i(),1),c(),xe(),ue(),ie(),p(),g(),y(),ce(),ee(),ae(),u(),le(),ne(),de(),x(),f(),z=null,B=null,V=d(),Ve=V.subscribe,H=0,U=null,W=[],G=[],K=[],q=null,J=null,Y=0,X=null,Z=null,Q=null,$=15,He=5e3}));export{Ue as a,Re as i,Se as n,Ve as o,Fe as r,R as s,ze as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{l as r,n as i,o as a}from"./envUtils-BDhHQY0-.js";import{n as o,t as s}from"./defineProperty-C-QyHrDq.js";import{T as c,w as l,y as u}from"./esm-Cb-L4oAk.js";import{n as d,t as f}from"./axios-DaWTGg7G.js";import{Wt as p,pt as m,z as ee}from"./state-BemZdQIl.js";import{n as te,t as ne}from"./cwd-Cfdf7z7s.js";import{F as re,H as ie,S as ae,W as oe,w as h,z as se}from"./debug-RAynG_nM.js";import{Jt as ce,qt as le}from"./settings-DnptdP79.js";import{c as ue,d as g,h as _,n as de}from"./config-Do1870_d.js";import{c as fe,o as pe}from"./execFileNoThrow-Dwu6psHW.js";import{d as me,o as he,p as v,s as y}from"./log-CezCRpAN.js";import{a as ge,i as _e,o as ve}from"./platform-BMPbglug.js";import{l as ye,s as be}from"./types-3j8PS-Du.js";import{i as xe,n as Se}from"./analytics-DJobLaWP.js";import{n as Ce,r as b}from"./startupProfiler-L_UWZ03w.js";import{$n as we,Bt as x,Fr as Te,Ft as Ee,Gt as De,Ir as Oe,Nt as ke,Ot as Ae,_n as je,jt as S,nr as Me,vn as Ne,zt as Pe}from"./model-BsZ4sP_H.js";import{n as Fe,t as Ie}from"./userAgent-CIq27vUR.js";import{Z as Le,_ as Re,c as ze,et as C,it as Be,n as Ve,o as He,t as Ue,v as We,w}from"./esm-Cf4nSRjF.js";import*as T from"path";import{randomUUID as E}from"crypto";import{appendFile as Ge,mkdir as D,readdir as Ke,unlink as O,writeFile as qe}from"fs/promises";function k(){return r(process.env.CLAUDE_CODE_USE_BEDROCK)||r(process.env.CLAUDE_CODE_USE_VERTEX)||r(process.env.CLAUDE_CODE_USE_FOUNDRY)||v()}function Je(){return v()}var A=e((()=>{a(),me()}));async function Ye(){j===null&&!M&&(M=Qe(),j=await M,M=null,N.cache.clear?.())}function Xe(){j=null,M=null,N.cache.clear?.(),P.cache.clear?.()}function Ze(){if(j!==null)return j;let e=S();if(e?.emailAddress)return e.emailAddress}async function Qe(){let e=S();if(e?.emailAddress)return e.emailAddress}var j,M,N,P,F=e((()=>{fe(),n(),p(),x(),_(),te(),ce(),a(),j=null,M=null,N=t(e=>{let t=g(),n=ue(),i,a,o;if(e&&(i=Ee()??void 0,a=ke()??void 0,i&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(o=e)}let s=S(),c=s?.organizationUuid,l=s?.accountUuid;return{deviceId:t,sessionId:m(),email:Ze(),appVersion:`0.0.10`,platform:le(),organizationUuid:c,accountUuid:l,userType:process.env.USER_TYPE,subscriptionType:i,rateLimitTier:a,firstTokenTime:o,...r(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}}),P=t(async()=>{let e=await pe(`git config --get user.email`,{shell:!0,reject:!1,cwd:ne()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function $e(){return{seconds:0,nanos:0}}function I(e){return e!=null}var L,et=e((()=>{L={fromJSON(e){return{seconds:I(e.seconds)?globalThis.Number(e.seconds):0,nanos:I(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return L.fromPartial(e??{})},fromPartial(e){let t=$e();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function tt(){return{account_id:0,organization_uuid:``,account_uuid:``}}function R(e){return e!=null}var z,nt=e((()=>{z={fromJSON(e){return{account_id:R(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:R(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:R(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return z.fromPartial(e??{})},fromPartial(e){let t=tt();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function rt(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function it(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function at(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function ot(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function st(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function B(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):st(L.fromJSON(e))}function V(e){return e!=null}var H,U,W,G,ct=e((()=>{et(),nt(),H={fromJSON(e){return{actor_id:V(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:V(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:V(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return H.fromPartial(e??{})},fromPartial(e){let t=rt();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},U={fromJSON(e){return{platform:V(e.platform)?globalThis.String(e.platform):``,node_version:V(e.node_version)?globalThis.String(e.node_version):``,terminal:V(e.terminal)?globalThis.String(e.terminal):``,package_managers:V(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:V(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:V(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:V(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:V(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:V(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:V(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:V(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:V(e.version)?globalThis.String(e.version):``,github_event_name:V(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:V(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:V(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:V(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:V(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:V(e.github_actions_metadata)?H.fromJSON(e.github_actions_metadata):void 0,arch:V(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:V(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:V(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:V(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:V(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:V(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:V(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:V(e.version_base)?globalThis.String(e.version_base):``,coworker_type:V(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:V(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:V(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:V(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:V(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:V(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:V(e.vcs)?globalThis.String(e.vcs):``,platform_raw:V(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=H.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=it();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?H.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},W={fromJSON(e){return{slack_team_id:V(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:V(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:V(e.trigger)?globalThis.String(e.trigger):``,creation_method:V(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return W.fromPartial(e??{})},fromPartial(e){let t=at();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},G={fromJSON(e){return{event_name:V(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:V(e.client_timestamp)?B(e.client_timestamp):void 0,model:V(e.model)?globalThis.String(e.model):``,session_id:V(e.session_id)?globalThis.String(e.session_id):``,user_type:V(e.user_type)?globalThis.String(e.user_type):``,betas:V(e.betas)?globalThis.String(e.betas):``,env:V(e.env)?U.fromJSON(e.env):void 0,entrypoint:V(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:V(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:V(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:V(e.client_type)?globalThis.String(e.client_type):``,process:V(e.process)?globalThis.String(e.process):``,additional_metadata:V(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:V(e.auth)?z.fromJSON(e.auth):void 0,server_timestamp:V(e.server_timestamp)?B(e.server_timestamp):void 0,event_id:V(e.event_id)?globalThis.String(e.event_id):``,device_id:V(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:V(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:V(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:V(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:V(e.email)?globalThis.String(e.email):``,agent_id:V(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:V(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:V(e.agent_type)?globalThis.String(e.agent_type):``,slack:V(e.slack)?W.fromJSON(e.slack):void 0,team_name:V(e.team_name)?globalThis.String(e.team_name):``,skill_name:V(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:V(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:V(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=U.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=z.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=W.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=ot();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?U.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?z.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?W.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function K(){return T.join(i(),`telemetry`)}function lt(e){if(!d.isAxiosError(e))return re(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var q,J,Y,ut=e((()=>{We(),f(),p(),ct(),x(),_(),a(),se(),Me(),be(),he(),je(),ae(),Fe(),Te(),Se(),C(),o(),q=E(),J=`1p_failed_events.`,Y=class{constructor(e={}){s(this,`endpoint`,void 0),s(this,`timeout`,void 0),s(this,`maxBatchSize`,void 0),s(this,`skipAuth`,void 0),s(this,`batchDelayMs`,void 0),s(this,`baseBackoffDelayMs`,void 0),s(this,`maxBackoffDelayMs`,void 0),s(this,`maxAttempts`,void 0),s(this,`isKilled`,void 0),s(this,`pendingExports`,[]),s(this,`isShutdown`,!1),s(this,`schedule`,void 0),s(this,`cancelBackoff`,null),s(this,`attempts`,0),s(this,`isRetrying`,!1),s(this,`lastExportErrorContext`,void 0);let t=e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`);this.endpoint=`${t}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.skipAuth=e.skipAuth??!1,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return T.join(K(),`${J}${m()}.${q}.json`)}async loadEventsFromFile(e){try{return await ye(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await O(e)}catch{}else await D(K(),{recursive:!0}),await qe(e,t.map(e=>h(e)).join(`
|
|
2
|
+
`)+`
|
|
3
|
+
`,`utf8`)}catch(e){y(e)}}async appendEventsToFile(e,t){if(t.length!==0)try{await D(K(),{recursive:!0}),await Ge(e,t.map(e=>h(e)).join(`
|
|
4
|
+
`)+`
|
|
5
|
+
`,`utf8`)}catch(e){y(e)}}async deleteFile(e){try{await O(e)}catch{}}async retryPreviousBatches(){try{let e=`${J}${m()}.`,t;try{t=(await Ke(K())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(q))}catch(e){if(ie(e))return;throw e}for(let e of t){let t=T.join(K(),e);this.retryFileInBackground(t)}}catch(e){y(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}let n=await this.sendEventsInBatches(t);n.length===0?await this.deleteFile(e):await this.saveEventsToFile(e,n)}async export(e,t){if(this.isShutdown){t({code:w.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:w.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:w.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:w.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:w.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:w.SUCCESS})}catch(e){y(e),t({code:w.FAILED,error:oe(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=lt(i);for(let r=e;r<t.length;r++)n.push(...t[r]);break}e<t.length-1&&this.batchDelayMs>0&&await Ne(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;y(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff()}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":Ie(),"x-service-name":`claude-code`},n=de()||ee(),r=this.skipAuth||!n;if(!r&&De()){let e=Ae();Pe()?e&&Oe(e.expiresAt)&&(r=!0):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:we(),a=!i.error,o=a?{...t,...i.headers}:t;try{let t=await d.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&d.isAxiosError(n)&&n.response?.status===401){let n=await d.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}throw n}}logSuccess(e,t,n){}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{},r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){t.push({event_type:`ClaudeCodeInternalEvent`,event_data:G.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:m(),additional_metadata:Buffer.from(h({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=Be(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=xe(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:G.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(h(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush()}async forceFlush(){await Promise.all(this.pendingExports)}}}));function X(e){return!1}var dt=e((()=>{}));function ft(){return{}}function pt(e){let t=ft()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}async function mt(){if($)try{await $.shutdown()}catch{}}function Z(){return!k()}async function ht(e,t,n={}){try{let r=await Le({model:n.model,betas:n.betas}),i={event_name:t,event_id:E(),core_metadata:r,user_metadata:N(!0),event_metadata:n},a=g();a&&(i.user_id=a),e.emit({body:t,attributes:i})}catch{}}function gt(e,t={}){Z()&&(!Q||X(`firstParty`)||ht(Q,e,t))}function _t(){if(b(`1p_event_logging_start`),!Z())return;b(`1p_event_after_config`);let e=parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||vt.toString(),10),t=yt,n=bt,r=_e(),i={[l]:`claude-code`,[c]:`0.0.10`};if(r===`wsl`){let e=ge();e&&(i[`wsl.version`]=e)}$=new He({resource:Re(i),processors:[new Ve(new Y({maxBatchSize:t,isKilled:()=>X(`firstParty`)}),{scheduledDelayMillis:e,maxExportBatchSize:t,maxQueueSize:n})]}),Q=$.getLogger(`com.anthropic.claude_code.events`,`0.0.10`)}var vt,yt,bt,Q,$,xt=e((()=>{ze(),Ue(),u(),_(),ve(),Ce(),F(),A(),ut(),C(),dt(),vt=1e4,yt=200,bt=8192,Q=null,$=null}));export{gt as a,P as c,Xe as d,A as f,Z as i,Ye as l,Je as m,xt as n,pt as o,k as p,_t as r,mt as s,ft as t,F as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./firstPartyEventLogger-B3cXgR67.js";e();export{t as initialize1PEventLogging};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,C as r,m as i,w as a}from"./external-CEp-aPkt.js";import{n as o,r as s,t as c}from"./lazySchema-B4D4qJVE.js";import{F as l,a as u,l as d,z as f}from"./debug-RAynG_nM.js";import{A as p,dt as m,ft as h,j as g}from"./sessionState-Bifmu95-.js";import"./bridgeMessaging-C3huGcR3.js";import{i as _}from"./workSecret-DUqdPy44.js";import{t as v}from"./ccrClient-Bu7Tf1Z5.js";import{n as y,t as b}from"./SSETransport-CoxQ8YpH.js";s(),c(),m();var x={init_retry_max_attempts:3,init_retry_base_delay_ms:500,init_retry_jitter_fraction:.25,init_retry_max_delay_ms:4e3,http_timeout_ms:1e4,uuid_dedup_buffer_size:2e3,heartbeat_interval_ms:2e4,heartbeat_jitter_fraction:.1,token_refresh_buffer_ms:3e5,teardown_archive_timeout_ms:1500,connect_timeout_ms:15e3,min_version:`0.0.0`,should_show_app_upgrade_message:!1},S=o(()=>a({init_retry_max_attempts:r().int().min(1).max(10).default(3),init_retry_base_delay_ms:r().int().min(100).default(500),init_retry_jitter_fraction:r().min(0).max(1).default(.25),init_retry_max_delay_ms:r().int().min(500).default(4e3),http_timeout_ms:r().int().min(2e3).default(1e4),uuid_dedup_buffer_size:r().int().min(100).max(5e4).default(2e3),heartbeat_interval_ms:r().int().min(5e3).max(3e4).default(2e4),heartbeat_jitter_fraction:r().min(0).max(.5).default(.1),token_refresh_buffer_ms:r().int().min(3e4).max(18e5).default(3e5),teardown_archive_timeout_ms:r().int().min(500).max(2e3).default(1500),connect_timeout_ms:r().int().min(5e3).max(6e4).default(15e3),min_version:n().refine(e=>{try{return h(e,`0.0.0`),!0}catch{return!1}}).default(`0.0.0`),should_show_app_upgrade_message:i().default(!1)}));async function C(){let e=x,t=S().safeParse(e);return t.success?t.data:x}async function w(){let e=await C();return e.min_version&&h(`0.0.10`,e.min_version)?`Your version of Work Mate (0.0.10) is too old for Remote Control.\nVersion ${e.min_version} or higher is required. Run \`claude update\` to update.`:null}y(),u(),f(),p();function T(e){return{write:t=>e.write(t),writeBatch:t=>e.writeBatch(t),close:()=>e.close(),isConnectedStatus:()=>e.isConnectedStatus(),getStateLabel:()=>e.getStateLabel(),setOnData:t=>e.setOnData(t),setOnClose:t=>e.setOnClose(t),setOnConnect:t=>e.setOnConnect(t),connect:()=>void e.connect(),getLastSequenceNum:()=>0,get droppedBatchCount(){return e.droppedBatchCount},reportState:()=>{},reportMetadata:()=>{},reportDelivery:()=>{},flush:()=>Promise.resolve()}}async function E(e){let{sessionUrl:t,ingressToken:n,sessionId:r,initialSequenceNum:i,getAuthToken:a}=e,o;a?o=()=>{let e=a();return e?{Authorization:`Bearer ${e}`}:{}}:g(n);let s=e.epoch??await _(t,n);d(`[bridge:repl] CCR v2: worker sessionId=${r} epoch=${s}${e.epoch===void 0?` (via registerWorker)`:` (from /bridge)`}`);let c=new URL(t);c.pathname=c.pathname.replace(/\/$/,``)+`/worker/events/stream`;let u=new b(c,{},r,void 0,i,o),f,p=new v(u,new URL(t),{getAuthHeaders:o,heartbeatIntervalMs:e.heartbeatIntervalMs,heartbeatJitterFraction:e.heartbeatJitterFraction,onEpochMismatch:()=>{d(`[bridge:repl] CCR v2: epoch superseded (409) — closing for poll-loop recovery`);try{p.close(),u.close(),f?.(4090)}catch(e){d(`[bridge:repl] CCR v2: error during epoch-mismatch cleanup: ${l(e)}`,{level:`error`})}throw Error(`epoch superseded`)}});u.setOnEvent(e=>{p.reportDelivery(e.event_id,`received`),p.reportDelivery(e.event_id,`processed`)});let m,h=!1,y=!1;return{write(e){return p.writeEvent(e)},async writeBatch(e){for(let t of e){if(y)break;await p.writeEvent(t)}},close(){y=!0,p.close(),u.close()},isConnectedStatus(){return h},getStateLabel(){return u.isClosedStatus()?`closed`:u.isConnectedStatus()?h?`connected`:`init`:`connecting`},setOnData(e){u.setOnData(e)},setOnClose(e){f=e,u.setOnClose(t=>{p.close(),e(t??4092)})},setOnConnect(e){m=e},getLastSequenceNum(){return u.getLastSequenceNum()},droppedBatchCount:0,reportState(e){p.reportState(e)},reportMetadata(e){p.reportMetadata(e)},reportDelivery(e,t){p.reportDelivery(e,t)},flush(){return p.flush()},connect(){e.outboundOnly||u.connect(),p.initialize(s).then(()=>{h=!0,d(`[bridge:repl] v2 transport ready for writes (epoch=${s}, sse=${u.isConnectedStatus()?`open`:`opening`})`),m?.()},e=>{d(`[bridge:repl] CCR v2 initialize failed: ${l(e)}`,{level:`error`}),p.close(),u.close(),f?.(4091)})}}}e();var D=class{constructor(){t(this,`_active`,!1),t(this,`_pending`,[])}get active(){return this._active}get pendingCount(){return this._pending.length}start(){this._active=!0}end(){return this._active=!1,this._pending.splice(0)}enqueue(...e){return this._active?(this._pending.push(...e),!0):!1}drop(){this._active=!1;let e=this._pending.length;return this._pending.length=0,e}deactivate(){this._active=!1}};export{C as a,w as i,T as n,E as r,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-P_wYS_NJ2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";var r=e(t(),1),i=n(),a=(0,r.createContext)(void 0);function o({getFpsMetrics:e,children:t}){return(0,i.jsx)(a.Provider,{value:e,children:t})}function s(){return(0,r.useContext)(a)}export{s as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Ya as n,ga as r,it as i,qa as a,st as o}from"./loadAgentsDir-C7lOqvfh.js";import{F as s,a as c,l,z as u}from"./debug-RAynG_nM.js";import{a as d,l as f}from"./proxy-CuMaO_YV.js";import{K as p,M as m,W as h,Y as g,Z as _,et as v,q as y}from"./sessionState-Bifmu95-.js";import{n as b,r as x}from"./SSETransport-CoxQ8YpH.js";import{randomUUID as S}from"crypto";function C(){return(process.env.GEMINI_BASE_URL||E).replace(/\/+$/,``)}function w(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*T(e){let t=await(e.fetchOverride??fetch)(`${C()}/${w(e.model)}:streamGenerateContent?alt=sse`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-goog-api-key":process.env.GEMINI_API_KEY||``},body:JSON.stringify(e.body),signal:e.signal,...d({forAnthropicAPI:!1})});if(!t.ok){let e=await t.text();throw Error(`Gemini API request failed (${t.status} ${t.statusText}): ${e||`empty response body`}`)}if(!t.body)throw Error(`Gemini API returned no response body`);let n=t.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,D);let{frames:a,remaining:o}=x(i);i=o;for(let e of a)if(!(!e.data||e.data===`[DONE]`))try{yield JSON.parse(e.data)}catch(e){throw Error(`Failed to parse Gemini SSE payload: ${s(e)}`)}}i+=r.decode();let{frames:e}=x(i);for(let t of e)if(!(!t.data||t.data===`[DONE]`))try{yield JSON.parse(t.data)}catch(e){throw Error(`Failed to parse trailing Gemini SSE payload: ${s(e)}`)}}finally{n.releaseLock()}}var E,D,O=e((()=>{b(),u(),f(),E=`https://generativelanguage.googleapis.com/v1beta`,D={stream:!0}}));async function*k(e,t,i,s,c,u){try{let r=v(c.model),d=n(e,i),f=(await Promise.all(i.map(e=>o(e,{getToolPermissionContext:c.getToolPermissionContext,tools:i,agents:c.agents,allowedAgentTypes:c.allowedAgentTypes,model:c.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),{contents:m,systemInstruction:b}=g(d,t),x=y(f),C=p(c.toolChoice),w=T({model:r,signal:s,fetchOverride:c.fetchOverride,body:{contents:m,...b&&{systemInstruction:b},...x.length>0&&{tools:x},...C&&{toolConfig:{functionCallingConfig:C}},generationConfig:{...c.temperatureOverride!==void 0&&{temperature:c.temperatureOverride},...u.type!==`disabled`&&{thinkingConfig:{includeThoughts:!0,...u.type===`enabled`&&{thinkingBudget:u.budgetTokens}}}}}});l(`[Gemini] Calling model=${r}, messages=${m.length}, tools=${x.length}`);let E=h(w,r),D={},O=null,k=0,A=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,k=Date.now()-A;break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.type===`thinking`?r.signature=n.signature:r[_]=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:a([t],i,c.agentId)},requestId:void 0,type:`assistant`,uuid:S(),timestamp:new Date().toISOString()};break}case`message_delta`:case`message_stop`:break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:k}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);l(`[Gemini] Error: ${t}`,{level:`error`}),yield r({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{i(),c(),t(),O(),m()}))();export{k as queryModelGemini};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$ as t,Ba as n,Oa as r,et as i,yv as a}from"./loadAgentsDir-C7lOqvfh.js";import{F as o,a as s,l as c,z as l}from"./debug-RAynG_nM.js";import{s as u,u as d}from"./types-3j8PS-Du.js";import{at as f}from"./sessionState-Bifmu95-.js";import{r as p,t as m}from"./sessionTitle-COBSgSXS.js";async function h(e,t){let n=m(e);if(!n)return null;try{let e=await i({systemPrompt:f([`Generate a short kebab-case name (2-4 words) that captures the main topic of this conversation. Use lowercase words separated by hyphens. Examples: "fix-login-bug", "add-auth-feature", "refactor-api-client", "debug-test-failures". Return JSON with a "name" field.`]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{name:{type:`string`}},required:[`name`],additionalProperties:!1}},signal:t,options:{querySource:`rename_generate_name`,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,mcpTools:[]}}),a=d(Array.isArray(e.message.content)?r(e.message.content):e.message.content);return a&&typeof a==`object`&&`name`in a&&typeof a.name==`string`?a.name:null}catch(e){return c(`generateSessionName failed: ${o(e)}`,{level:`error`}),null}}var g=e((()=>{t(),s(),l(),u(),n(),p(),a()}));export{g as n,h as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-Dwu6psHW.js";function i(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}async function a(e,t=10){if(process.platform===`win32`){let r=await n(`powershell.exe`,[`-NoProfile`,`-Command`,`
|
|
2
2
|
$pid = ${String(e)}
|
|
3
3
|
$ancestors = @()
|
|
4
4
|
for ($i = 0; $i -lt ${t}; $i++) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{Wt as a,cr as o}from"./state-BemZdQIl.js";import{n as s,t as c}from"./cwd-Cfdf7z7s.js";import{S as ee,a as te,d as l,nt as ne,p as u,rt as re,w as ie}from"./debug-RAynG_nM.js";import{r as ae,t as d}from"./execFileNoThrow-Dwu6psHW.js";import{o as oe}from"./log-CezCRpAN.js";import{n as f,t as se}from"./memoize-DsqYrbeR.js";import{r as ce,t as le}from"./which-DzFN5TNM.js";import{basename as ue,dirname as p,join as m,resolve as h,sep as g}from"path";import{readFileSync as _,realpathSync as v,statSync as y,unwatchFile as b,watchFile as de}from"fs";import{createHash as fe}from"crypto";import{readFile as x,readdir as pe,stat as me}from"fs/promises";function S(e,t,n){let r=he();if(!r)return;let i={timestamp:new Date().toISOString(),level:e,event:t,data:n??{}},a=l(),o=ie(i)+`
|
|
2
2
|
`;try{a.appendFileSync(r,o)}catch{try{a.mkdirSync(p(r)),a.appendFileSync(r,o)}catch{}}}function he(){return process.env.CLAUDE_CODE_DIAGNOSTICS_FILE}async function ge(e,t,n){let r=Date.now();S(`info`,`${e}_started`);try{let i=await t(),a=n?n(i):{};return S(`info`,`${e}_completed`,{duration_ms:Date.now()-r,...a}),i}catch(t){throw S(`error`,`${e}_failed`,{duration_ms:Date.now()-r}),t}}var C=e((()=>{u(),ee()}));async function w(e,t,n,r){try{return _e(await x(m(e,`config`),`utf-8`),t,n,r)}catch{return null}}function _e(e,t,n,r){let i=e.split(`
|
|
3
3
|
`),a=t.toLowerCase(),o=r.toLowerCase(),s=!1;for(let e of i){let t=e.trim();if(t.length===0||t[0]===`#`||t[0]===`;`)continue;if(t[0]===`[`){s=xe(t,a,n);continue}if(!s)continue;let r=ve(t);if(r&&r.key.toLowerCase()===o)return r.value}return null}function ve(e){let t=0;for(;t<e.length&&Se(e[t]);)t++;if(t===0)return null;let n=e.slice(0,t);for(;t<e.length&&(e[t]===` `||e[t]===` `);)t++;if(t>=e.length||e[t]!==`=`)return null;for(t++;t<e.length&&(e[t]===` `||e[t]===` `);)t++;return{key:n,value:ye(e,t)}}function ye(e,t){let n=``,r=!1,i=t;for(;i<e.length;){let t=e[i];if(!r&&(t===`#`||t===`;`))break;if(t===`"`){r=!r,i++;continue}if(t===`\\`&&i+1<e.length){let t=e[i+1];if(r){switch(t){case`n`:n+=`
|
|
4
4
|
`;break;case`t`:n+=` `;break;case`b`:n+=`\b`;break;case`"`:n+=`"`;break;case`\\`:n+=`\\`;break;default:n+=t;break}i+=2;continue}if(t===`\\`){n+=`\\`,i+=2;continue}}n+=t,i++}return r||(n=be(n)),n}function be(e){let t=e.length;for(;t>0&&(e[t-1]===` `||e[t-1]===` `);)t--;return e.slice(0,t)}function xe(e,t,n){let r=1;for(;r<e.length&&e[r]!==`]`&&e[r]!==` `&&e[r]!==` `&&e[r]!==`"`;)r++;if(e.slice(1,r).toLowerCase()!==t)return!1;if(n===null)return r<e.length&&e[r]===`]`;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r>=e.length||e[r]!==`"`)return!1;r++;let i=``;for(;r<e.length&&e[r]!==`"`;){if(e[r]===`\\`&&r+1<e.length){let t=e[r+1];if(t===`\\`||t===`"`){i+=t,r+=2;continue}i+=t,r+=2;continue}i+=e[r],r++}return r>=e.length||e[r]!==`"`||(r++,r>=e.length||e[r]!==`]`)?!1:i===n}function Se(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`-`}var T=e((()=>{}));function Ce(){N.clear()}async function E(e){let t=h(e??c()),n=N.get(t);if(n!==void 0)return n;let r=V(t);if(!r)return N.set(t,null),null;let i=m(r,`.git`);try{if((await me(i)).isFile()){let e=(await x(i,`utf-8`)).trim();if(e.startsWith(`gitdir:`)){let n=h(r,e.slice(7).trim());return N.set(t,n),n}}return N.set(t,i),i}catch{return N.set(t,null),null}}function D(e){return!(!e||e.startsWith(`-`)||e.startsWith(`/`)||e.includes(`..`)||e.split(`/`).some(e=>e===`.`||e===``)||!/^[a-zA-Z0-9/._+@-]+$/.test(e))}function O(e){return/^[0-9a-f]{40}$/.test(e)||/^[0-9a-f]{64}$/.test(e)}async function k(e){try{let t=(await x(m(e,`HEAD`),`utf-8`)).trim();if(t.startsWith(`ref:`)){let n=t.slice(4).trim();if(n.startsWith(`refs/heads/`)){let e=n.slice(11);return D(e)?{type:`branch`,name:e}:null}if(!D(n))return null;let r=await A(e,n);return r?{type:`detached`,sha:r}:{type:`detached`,sha:``}}return O(t)?{type:`detached`,sha:t}:null}catch{return null}}async function A(e,t){let n=await j(e,t);if(n)return n;let r=await M(e);return r&&r!==e?j(r,t):null}async function j(e,t){try{let n=(await x(m(e,t),`utf-8`)).trim();if(n.startsWith(`ref:`)){let t=n.slice(4).trim();return D(t)?A(e,t):null}return O(n)?n:null}catch{}try{let n=await x(m(e,`packed-refs`),`utf-8`);for(let e of n.split(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,m as n,r,u as i}from"./git-2c7WlGDL.js";n();export{r as findGitRoot,t as getBranch,e as getDefaultBranch,i as getRemoteUrl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Wt as e,et as t}from"./state-BemZdQIl.js";import{a as n,l as r}from"./debug-RAynG_nM.js";import{Cn as i,On as a}from"./settings-DnptdP79.js";import{c as o,h as s,y as c}from"./config-Do1870_d.js";import{S as l,m as u,r as d,x as f}from"./git-2c7WlGDL.js";import{a as p,i as m,n as h}from"./detectRepository-DgpNd87p.js";import{realpath as g}from"fs/promises";e(),s(),n(),m(),i(),l(),u();async function _(){try{let e=await h();if(!e){r(`Not in a GitHub repository, skipping path mapping update`);return}let n=t(),i=d(n)??n,a;try{a=(await g(i)).normalize(`NFC`)}catch{a=i}let s=e.toLowerCase(),l=o().githubRepoPaths?.[s]??[];if(l[0]===a){r(`Path ${a} already tracked for repo ${s}`);return}let u=l.filter(e=>e!==a),f=[a,...u];c(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:f}})),r(`Added ${a} to tracked paths for repo ${s}`)}catch(e){r(`Error updating repo path mapping: ${e}`)}}function v(e){let t=o(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function y(e){let t=await Promise.all(e.map(a));return e.filter((e,n)=>t[n])}async function b(e,t){try{let n=await f(e);if(!n)return!1;let r=p(n);return r?r.toLowerCase()===t.toLowerCase():!1}catch{return!1}}function x(e,t){let n=o(),i=e.toLowerCase(),a=n.githubRepoPaths?.[i]??[],s=a.filter(e=>e!==t);if(s.length===a.length)return;let l={...n.githubRepoPaths};s.length===0?delete l[i]:l[i]=s,c(e=>({...e,githubRepoPaths:l})),r(`Removed ${t} from tracked paths for repo ${i}`)}export{b as a,_ as i,v as n,x as r,y as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Iy as t,ab as n,bl as r,cb as i,db as a,fb as o,ib as s,jy as c,lb as l,nb as u,nd as d,ob as f,pb as p,rb as m,tb as h,td as g,xl as _,yl as v}from"./loadAgentsDir-C7lOqvfh.js";import{I as y,P as b,fi as x,t as S}from"./src-P_wYS_NJ2.js";import{t as C}from"./jsx-runtime-Bb4Xn-E0.js";import{n as w,t as T}from"./PermissionDialog-Cb3z8OUP.js";function E({currentGoal:e,newObjective:t,onConfirm:r,onCancel:i}){function a(e){e===`yes`?r():i()}let o=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`;return(0,D.jsx)(T,{color:`warning`,title:`Replace active goal?`,children:(0,D.jsxs)(y,{flexDirection:`column`,marginTop:1,paddingX:1,children:[(0,D.jsx)(b,{children:`A goal is already in progress. Replacing it will reset all progress and counters.`}),(0,D.jsxs)(y,{marginTop:1,flexDirection:`column`,children:[(0,D.jsx)(b,{dimColor:!0,children:`Current goal:`}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Objective: `}),e.objective]}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Status: `}),n(e.status)]}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Time: `}),s(e)]}),(0,D.jsxs)(b,{children:[(0,D.jsx)(b,{dimColor:!0,children:`· Tokens: `}),o]})]}),(0,D.jsxs)(y,{marginTop:1,flexDirection:`column`,children:[(0,D.jsx)(b,{dimColor:!0,children:`New objective:`}),(0,D.jsx)(b,{children:t})]}),(0,D.jsx)(y,{marginTop:1,children:(0,D.jsx)(d,{options:[{label:`Yes, replace the goal`,value:`yes`},{label:`No, keep the current goal`,value:`no`}],onChange:a,onCancel:i})})]})})}var D,O=e((()=>{x(),S(),g(),w(),l(),D=C()}));function k(e){let t=e.split(`
|
|
2
|
+
`)[0]??e;return t.length<=I?t:t.slice(0,I)+`…`}function A(){t(e=>e.origin===`goal-continuation`||e.origin===`goal-budget-limit`)}function j(){let e=f();if(!e)return"No active goal. Set one with `/goal <objective>`.";let t=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`,r=[`Goal: ${e.objective}`,`Status: ${n(e.status)}`,`Time: ${s(e)}`,`Tokens: ${t}`,`Continuation turns: ${e.turnsExecuted}`];return e.status===`max_turns`&&r.push("Hint: Max continuation turns reached (150). Run `/goal continue` to reset and continue."),r.join(`
|
|
3
|
+
`)}function M(e){return p(e),i(),r(),`Goal set.`}async function N(e,t,n){let i=n.trim();if(!i||i.toLowerCase()===`status`)return e(j(),{display:`system`}),null;let s=i.toLowerCase();if(s===`clear`){let t=h();return t&&(_(),A()),e(t?`Goal cleared.`:`No active goal to clear.`,{display:`system`}),null}if(s===`pause`){let t=a();return t&&(r(),A()),e(t?`Goal paused.`:`No active goal to pause.`,{display:`system`}),null}if(s===`resume`){if(f()?.status===`max_turns`)return e("Goal reached max continuation turns (150). Run `/goal continue` to reset turn counter and continue.",{display:`system`}),null;let t=o();return t&&r(),e(t?`Goal resumed.`:`No paused goal to resume.`,{display:`system`,shouldQuery:!!t}),null}if(s===`continue`){let t=m();return t&&r(),e(t?`Goal continuation counter reset (0/150). Continuing...`:`Current goal is not in max-turns state.`,{display:`system`,shouldQuery:!!t}),null}if(s===`complete`){let t=u();return t&&(r(),A()),e(t?`Goal marked complete.`:`No active goal to complete.`,{display:`system`}),null}if(i.length>F)return e(`Goal objective is too long (${i.length} chars; limit ${F}). Save the detailed instructions to a file and reference it from a shorter objective.`,{display:`system`}),null;let c=f();return c&&c.status!==`complete`?(0,P.jsx)(E,{currentGoal:c,newObjective:i,onConfirm:()=>{A(),e(M(i),{display:`system`,shouldQuery:!0,displayArgs:k(i),metaMessages:[`<goal-objective-updated>\n${i}\n</goal-objective-updated>`]})},onCancel:()=>{e(`Kept the current goal. New objective discarded.`,{display:`system`})}}):(e(M(i),{display:`system`,shouldQuery:!0,displayArgs:k(i),metaMessages:[`<goal-objective-updated>\n${i}\n</goal-objective-updated>`]}),null)}var P,F,I;e((()=>{x(),l(),v(),c(),O(),P=C(),F=4e3,I=80}))();export{N as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Jy as n,OT as r,Qy as i,Ya as a,ga as o,it as s,kT as c,qa as l,st as u}from"./loadAgentsDir-C7lOqvfh.js";import{a as d,l as f}from"./debug-RAynG_nM.js";import{V as p,W as m}from"./model-BsZ4sP_H.js";import{F as h,I as g,M as _,N as v,R as y,nt as b}from"./sessionState-Bifmu95-.js";import{n as x,t as S}from"./openaiShared-G2-w4gJt.js";import{randomUUID as C}from"crypto";async function*w(e,t,i,s,c){try{let o=b(c.model),d=a(e,i),m=(await Promise.all(i.map(e=>u(e,{getToolPermissionContext:c.getToolPermissionContext,tools:i,agents:c.agents,allowedAgentTypes:c.allowedAgentTypes,model:c.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),_=y(d,t),S=g(m),w=h(c.toolChoice),T=r({maxRetries:0,fetchOverride:c.fetchOverride,source:c.querySource});f(`[Grok] Calling model=${o}, messages=${_.length}, tools=${S.length}`);let E=v(await T.chat.completions.create({model:o,messages:_,...S.length>0&&{tools:S,...w&&{tool_choice:w}},stream:!0,stream_options:{include_usage:!0},...c.temperatureOverride!==void 0&&{temperature:c.temperatureOverride}},{signal:s}),o),D={},O=null,k={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},A=0,j=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,A=Date.now()-j,e.message.usage&&(k=x(k,e.message.usage));break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:l([t],i,c.agentId)},requestId:void 0,type:`assistant`,uuid:C(),timestamp:new Date().toISOString()};break}case`message_delta`:{let t=e.usage;t&&(k=x(k,t));break}case`message_stop`:break}e.type===`message_stop`&&k.input_tokens+k.output_tokens>0&&n(p(o,k),k,c.model),yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:A}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);f(`[Grok] Error: ${t}`,{level:`error`}),yield o({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{c(),S(),_(),t(),s(),d(),i(),m()}))();export{w as queryModelGrok};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{n as e,t}from"./memoize-BK3gG5ob.js";import{n,t as r}from"./axios-DaWTGg7G.js";import{rf as i,tf as a}from"./loadAgentsDir-C7lOqvfh.js";import{a as o,l as s}from"./debug-RAynG_nM.js";import{c,h as l,y as u}from"./config-Do1870_d.js";import{a as d,n as f}from"./process-gEbdy6uY.js";import{d as p,f as m,o as h,s as g}from"./log-CezCRpAN.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{l as y,u as b}from"./oauth-C9VBDB0Y.js";import{$n as x,Bt as S,Kt as C,jt as w,nr as T,rr as E,tr as D}from"./model-BsZ4sP_H.js";import{n as O,t as k}from"./userAgent-CIq27vUR.js";r(),t(),_(),S(),o(),i(),p(),f(),b(),l(),T(),h(),O();var A=1440*60*1e3,j=e(async()=>{if(m())return{success:!1};try{return{success:!0,data:(await E(()=>{let e=x();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return n.get(`${y().BASE_API_URL}/api/oauth/account/settings`,{headers:{...e.headers,"User-Agent":k()}})})).data}}catch(e){return g(e),j.cache.clear?.(),{success:!1}}});async function M(){try{await E(()=>{let e=x();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return n.post(`${y().BASE_API_URL}/api/oauth/account/grove_notice_viewed`,{},{headers:{...e.headers,"User-Agent":k()}})}),j.cache.clear?.()}catch(e){g(e)}}async function N(e){try{await E(()=>{let t=x();if(t.error)throw Error(`Failed to get auth headers: ${t.error}`);return n.patch(`${y().BASE_API_URL}/api/oauth/account/settings`,{grove_enabled:e},{headers:{...t.headers,"User-Agent":k()}})}),j.cache.clear?.()}catch(e){g(e)}}async function P(){if(!C())return!1;let e=w()?.accountUuid;if(!e)return!1;let t=c().groveConfigCache?.[e];return t?Date.now()-t.timestamp>A?(s(`Grove: Cache stale, returning cached data and refreshing in background`),F(e),t.grove_enabled):(s(`Grove: Using fresh cached config`),t.grove_enabled):(s(`Grove: No cache, fetching config in background (dialog skipped this session)`),F(e),!1)}async function F(e){try{let t=await I();if(!t.success)return;let n=t.data.grove_enabled,r=c().groveConfigCache?.[e];if(r?.grove_enabled===n&&Date.now()-r.timestamp<=A)return;u(t=>({...t,groveConfigCache:{...t.groveConfigCache,[e]:{grove_enabled:n,timestamp:Date.now()}}}))}catch(e){s(`Grove: Failed to fetch and store config: ${e}`)}}var I=e(async()=>{if(m())return{success:!1};try{let{grove_enabled:e,domain_excluded:t,notice_is_grace_period:r,notice_reminder_frequency:i}=(await E(()=>{let e=x();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return n.get(`${y().BASE_API_URL}/api/claude_code_grove`,{headers:{...e.headers,"User-Agent":D()},timeout:3e3})})).data;return{success:!0,data:{grove_enabled:e,domain_excluded:t??!1,notice_is_grace_period:r??!0,notice_reminder_frequency:i}}}catch(e){return s(`Failed to fetch Grove notice config: ${e}`),{success:!1}}});function L(e,t,n){if(!e.success||!t.success)return!1;let r=e.data,i=t.data;if(r.grove_enabled!==null)return!1;if(n||!i.notice_is_grace_period)return!0;let a=i.notice_reminder_frequency;return a!==null&&r.grove_notice_viewed_at?Math.floor((Date.now()-new Date(r.grove_notice_viewed_at).getTime())/(1e3*60*60*24))>=a:r.grove_notice_viewed_at==null}async function R(){let[e,t]=await Promise.all([j(),I()]);if(L(e,t,!1)){let e=t.success?t.data:null;v(`tengu_grove_print_viewed`,{dismissable:e?.notice_is_grace_period}),e===null||e.notice_is_grace_period?(d(`
|
|
2
|
+
An update to our Consumer Terms and Privacy Policy will take effect on October 8, 2025. Run \`claude\` to review the updated terms.
|
|
3
|
+
|
|
4
|
+
`),await M()):(d(`
|
|
5
|
+
[ACTION REQUIRED] An update to our Consumer Terms and Privacy Policy has taken effect on October 8, 2025. You must run \`claude\` to review the updated terms.
|
|
6
|
+
|
|
7
|
+
`),await a(1))}}export{P as a,j as i,R as n,M as o,I as r,N as s,L as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$C as n,Bi as r,JC as i,Ni as a,Oi as o,YC as s,nd as c,qC as l,rd as u}from"./loadAgentsDir-C7lOqvfh.js";import{I as d,Lt as f,P as p,Wt as m,a as h,fi as g,n as _,ot as v,r as y,t as b,x}from"./src-P_wYS_NJ2.js";import{t as S}from"./jsx-runtime-Bb4Xn-E0.js";import{b as C,y as w}from"./startupProfiler-L_UWZ03w.js";import{n as T,t as E}from"./useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js";import{n as D,r as O}from"./modalContext-CUThy6Ph.js";import{n as k,t as A}from"./PromptInputHelpMenu-Bb4KdIX_.js";function j({commands:e,maxHeight:t,columns:n,title:r,onCancel:i,emptyMessage:o}){let{headerFocused:s,focusHeader:l}=h(),u=Math.max(1,n-10),f=Math.max(1,Math.floor((t-10)/2)),m=(0,M.useMemo)(()=>{let t=new Set;return e.filter(e=>t.has(e.name)?!1:(t.add(e.name),!0)).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({label:`/${e.name}`,value:e.name,description:C(a(e),u,!0)}))},[e,u]);return(0,N.jsx)(d,{flexDirection:`column`,paddingY:1,children:e.length===0&&o?(0,N.jsx)(p,{dimColor:!0,children:o}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(p,{children:r}),(0,N.jsx)(d,{marginTop:1,children:(0,N.jsx)(c,{options:m,visibleOptionCount:f,onCancel:i,disableSelection:!0,hideIndexes:!0,layout:`compact-vertical`,onUpFromFirstItem:l,isDisabled:s})})]})})}var M,N,P=e((()=>{g(),M=t(g(),1),r(),w(),b(),u(),N=S()}));function F(){return(0,I.jsxs)(d,{flexDirection:`column`,paddingY:1,gap:1,children:[(0,I.jsxs)(d,{flexDirection:`column`,gap:1,children:[(0,I.jsx)(p,{bold:!0,children:`Getting started`}),(0,I.jsxs)(d,{flexDirection:`column`,children:[(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`1. `}),(0,I.jsx)(p,{children:`Ask a question or describe a task — Claude will explore your code and respond.`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`2. `}),(0,I.jsx)(p,{children:`When Claude wants to edit files or run commands, you review and approve each action.`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`3. `}),(0,I.jsx)(p,{children:`Type `}),(0,I.jsx)(p,{bold:!0,children:`/help`}),(0,I.jsx)(p,{children:` for commands, or `}),(0,I.jsx)(p,{bold:!0,children:`?`}),(0,I.jsx)(p,{children:` for shortcuts.`})]})]})]}),(0,I.jsxs)(d,{flexDirection:`column`,children:[(0,I.jsx)(d,{children:(0,I.jsx)(p,{bold:!0,children:`Shortcuts`})}),(0,I.jsx)(A,{gap:2,fixedWidth:!0})]})]})}var I,L=e((()=>{g(),b(),k(),I=S()}));function R({onClose:e,commands:t}){let{rows:n,columns:r}=v(),i=Math.floor(n/2),a=O(),c=()=>e(`Help dialog dismissed`,{display:`system`});m(`help:dismiss`,c,{context:`Help`});let l=T(c),u=s(`help:dismiss`,`Help`,`esc`),h=o(),g=t.filter(e=>h.has(e.name)&&!e.isHidden),b=t.filter(e=>!h.has(e.name)&&!e.isHidden),S=[(0,z.jsx)(_,{title:`general`,children:(0,z.jsx)(F,{})},`general`)];return S.push((0,z.jsx)(_,{title:`commands`,children:(0,z.jsx)(j,{commands:g,maxHeight:i,columns:r,title:`Browse default commands:`,onCancel:c})},`commands`)),S.push((0,z.jsx)(_,{title:`custom-commands`,children:(0,z.jsx)(j,{commands:b,maxHeight:i,columns:r,title:`Browse custom commands:`,emptyMessage:`No custom commands found`,onCancel:c})},`custom`)),(0,z.jsx)(d,{flexDirection:`column`,height:a?void 0:i,children:(0,z.jsxs)(x,{color:`professionalBlue`,children:[(0,z.jsx)(y,{title:`Work Mate v0.0.10`,color:`professionalBlue`,defaultTab:`general`,children:S}),(0,z.jsx)(d,{marginTop:1,children:(0,z.jsxs)(p,{children:[`For more help: `,(0,z.jsx)(f,{url:`https://code.claude.com/docs/en/overview`})]})}),(0,z.jsx)(d,{marginTop:1,children:(0,z.jsx)(p,{dimColor:!0,children:l.pending?(0,z.jsxs)(z.Fragment,{children:[`Press `,l.keyName,` again to exit`]}):(0,z.jsxs)(p,{italic:!0,children:[u,` to cancel`]})})})]})})}var z,B=e((()=>{g(),E(),i(),r(),D(),n(),b(),l(),P(),L(),z=S()})),V,H;e((()=>{B(),V=S(),H=async(e,{options:{commands:t}})=>(0,V.jsx)(R,{commands:t,onClose:e})}))();export{H as call};
|