claude-code-best 2.5.0 → 2.6.0
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-Cj5bvJgD.js +1 -0
- package/dist/chunks/App-2tgSv9lb.js +1 -0
- package/dist/chunks/ApproveApiKey-DWa-XTLb.js +1 -0
- package/dist/chunks/ApproveApiKey-SIUwkD8j.js +1 -0
- package/dist/chunks/AssistantSessionChooser-DF9eeJZS.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-DXJdube9.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-BOSW4Zdy.js +1 -0
- package/dist/chunks/ClaudeInChromeOnboarding-BW4XHmkw.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-B8oAAHSI.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Bz0JyaOG.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-DYhmGSkx.js +1 -0
- package/dist/chunks/DesktopHandoff-CcsM_OAS.js +1 -0
- package/dist/chunks/DevChannelsDialog-DXRgY00D.js +1 -0
- package/dist/chunks/Dialog-DYFGqyDs.js +1 -0
- package/dist/chunks/DiffDialog-PvNZfZby.js +3 -0
- package/dist/chunks/Doctor--B1HUENo.js +1 -0
- package/dist/chunks/Doctor-CE_jL9jC.js +3 -0
- package/dist/chunks/ExitFlow-C4ybxKPn.js +2 -0
- package/dist/chunks/Feedback-B5rPGl_C.js +2 -0
- package/dist/chunks/Grove-C2YjB3zL.js +1 -0
- package/dist/chunks/Grove-CKVpREDU.js +11 -0
- package/dist/chunks/HybridTransport-Byjvz-DL.js +4 -0
- package/dist/chunks/ITermBackend-Co9XpeS4.js +1 -0
- package/dist/chunks/InProcessTransport-DB52dh4f.js +1 -0
- package/dist/chunks/InvalidConfigDialog-CNsqbNU3.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-ClnZaN6b.js +1 -0
- package/dist/chunks/ListItem-OFARanN7.js +1 -0
- package/dist/chunks/MCPConnectionManager-CDsa79pu.js +1 -0
- package/dist/chunks/McpParsingWarnings-DZkzoeZf.js +1 -0
- package/dist/chunks/MessageSelector-CkeGQPNM.js +3 -0
- package/dist/chunks/Messages-PfbzLYOU.js +11 -0
- package/dist/chunks/Onboarding-BwoGQB4g.js +1 -0
- package/dist/chunks/OverageCreditUpsell-Q5g2YjQw.js +1 -0
- package/dist/chunks/PermissionDialog-5MlJf7ew.js +1 -0
- package/dist/chunks/PluginSettings-B2ASJ0Rx.js +17 -0
- package/dist/chunks/PressEnterToContinue-BdA9zDGs.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-D4lMVCqj.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-BvLtS6an.js +1 -0
- package/dist/chunks/QueryEngine-Av0G5fze.js +1 -0
- package/dist/chunks/REPL-DCwqua0C.js +1 -0
- package/dist/chunks/REPL-Dh8vzGmF.js +97 -0
- package/dist/chunks/RemoteCallout-BV_hoz98.js +1 -0
- package/dist/chunks/RemoteSessionManager-Cxoy1ud2.js +2 -0
- package/dist/chunks/ResumeConversation-B3WuB8rs.js +1 -0
- package/dist/chunks/SSETransport-pIm26VJq.js +4 -0
- package/dist/chunks/SearchBox-DfOmUoaI.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-D70C-cmA.js +1 -0
- package/dist/chunks/SentryErrorBoundary-B6EWoJml.js +2 -0
- package/dist/chunks/SentryErrorBoundary-oJUBarGg.js +1 -0
- package/dist/chunks/Settings-CreAhCsb.js +2 -0
- package/dist/chunks/TeleportProgress-DPzGpyyM.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-DqWQX6j8.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-DPSO0S49.js +1 -0
- package/dist/chunks/ThemePicker-DueihHcy.js +1 -0
- package/dist/chunks/TmuxBackend-BNaZNAeP.js +9 -0
- package/dist/chunks/TrustDialog-CIzAlGn9.js +1 -0
- package/dist/chunks/TungstenTool-C5IqKVr0.js +1 -0
- package/dist/chunks/TungstenTool-V-Bwqlx3.js +1 -0
- package/dist/chunks/ValidationErrorsList-1k1qbsRo.js +2 -0
- package/dist/chunks/WelcomeV2-CR6TtXXM.js +1 -0
- package/dist/chunks/WindowsTerminalBackend-C5SeTXqC.js +2 -0
- package/dist/chunks/add-dir-DAMizKzF.js +1 -0
- package/dist/chunks/agentDisplay-B9z7i8b_.js +1 -0
- package/dist/chunks/agents-D5u0p1UC.js +103 -0
- package/dist/chunks/agents-DCh_gEvJ.js +2 -0
- package/dist/chunks/ajv-B_OpU_Uh.js +8 -0
- package/dist/chunks/analytics-DqMQntaB.js +1 -0
- package/dist/chunks/ant-DRJq-cEg.js +1 -0
- package/dist/chunks/api-B6URs6nc.js +1 -0
- package/dist/chunks/api-Dz_3z1kl.js +1 -0
- package/dist/chunks/asciicast-aoKFhc7C.js +1 -0
- package/dist/chunks/asciicast-o5Zg4dJt.js +4 -0
- package/dist/chunks/assistant-BRGDWkKB.js +1 -0
- package/dist/chunks/assistant-tPxOUa-Z.js +1 -0
- package/dist/chunks/assistant-zVegFdAO.js +1 -0
- package/dist/chunks/attributionHooks-PygdohOh.js +1 -0
- package/dist/chunks/attributionTrailer-BpvhXgRP.js +1 -0
- package/dist/chunks/auth-CqURlg4d.js +1 -0
- package/dist/chunks/auth-D4isgfuK.js +1 -0
- package/dist/chunks/autoMode-DVt4K4I2.js +45 -0
- package/dist/chunks/autoModeDenials-Cp6VFdsm.js +1 -0
- package/dist/chunks/autonomy-BZzW8QJZ.js +1 -0
- package/dist/chunks/autonomy-Ffv0QIyl.js +19 -0
- package/dist/chunks/autonomyPanel-MwuzDvv_.js +1 -0
- package/dist/chunks/axios-DLnc2dVy.js +1 -0
- package/dist/chunks/axios-DhfaybwJ.js +12 -0
- package/dist/chunks/backgroundHousekeeping-CYnAG60-.js +17 -0
- package/dist/chunks/backgroundHousekeeping-DUmxC6h0.js +1 -0
- package/dist/chunks/banner-CVXH2xts.js +2 -0
- package/dist/chunks/base64-js-DIVSFswY.js +1 -0
- package/dist/chunks/bedrockClient-qi1-JCOK.js +15 -0
- package/dist/chunks/bg-DK0E4ZtW.js +9 -0
- package/dist/chunks/bg-Dbh5z3Y8.js +1 -0
- package/dist/chunks/branch-DXefFdDE.js +3 -0
- package/dist/chunks/break-cache-ByJ7U2Ts.js +8 -0
- package/dist/chunks/bridge-qr4GQW_c.js +2 -0
- package/dist/chunks/bridgeConfig-CJ-KznTS.js +1 -0
- package/dist/chunks/bridgeConfig-CNbOKpAg.js +1 -0
- package/dist/chunks/bridgeEnabled-5vsPrjuq.js +1 -0
- package/dist/chunks/bridgeEnabled-BUJTCUHY.js +1 -0
- package/dist/chunks/bridgeMain-BimZwc2P.js +68 -0
- package/dist/chunks/bridgeMain-DYL4fl6A.js +1 -0
- package/dist/chunks/bridgeMessaging-BiE0CTqq.js +1 -0
- package/dist/chunks/bridgePointer-FvAMj3re.js +1 -0
- package/dist/chunks/browser-fLRXxIsQ.js +1 -0
- package/dist/chunks/btw-FpimqEqk.js +1 -0
- package/dist/chunks/buddy-BA3Cr067.js +3 -0
- package/dist/chunks/bundledMode-kSQejuY4.js +1 -0
- package/dist/chunks/bypassPermissionsKillswitch-CSC9p8mO.js +1 -0
- package/dist/chunks/caches-BUBkfP2Q.js +3 -0
- package/dist/chunks/caches-CTfNpKhW.js +1 -0
- package/dist/chunks/capacityWake-BXlUpptF.js +1 -0
- package/dist/chunks/ccrClient-BOxUn9EJ.js +1 -0
- package/dist/chunks/ccshareResume-DWLjTF22.js +1 -0
- package/dist/chunks/changeDetector-Y9KV5LgG.js +1 -0
- package/dist/chunks/channelNotification-CC7Xb06W.js +1 -0
- package/dist/chunks/channelNotification-l3EXKDNB.js +1 -0
- package/dist/chunks/chokidar-BcI3rIKm.js +1 -0
- package/dist/chunks/chokidar-SzksMqYp.js +1 -0
- package/dist/chunks/chrome-BnKyWWQL.js +1 -0
- package/dist/chunks/chromeNativeHost-4U39yLtd.js +1 -0
- package/dist/chunks/chunk-DR8-3Aex.js +1 -0
- package/dist/chunks/classPrivateFieldSet2-EAQNhHs8.js +1 -0
- package/dist/chunks/claudeDesktop-D0S1eq1F.js +1 -0
- package/dist/chunks/cleanup-Bg_gFgcj.js +1 -0
- package/dist/chunks/clear-OUVFUt8Z.js +1 -0
- package/dist/chunks/cliLaunch-BQa48gsr.js +1 -0
- package/dist/chunks/client-B47ZvTMo.js +1 -0
- package/dist/chunks/client-CPn1wQyc.js +7 -0
- package/dist/chunks/client-_sjL0I7A.js +35 -0
- package/dist/chunks/color-D5MCzz9h.js +1 -0
- package/dist/chunks/color-convert-ULbeSgNC.js +1 -0
- package/dist/chunks/commands-FJGWgQsa.js +1 -0
- package/dist/chunks/commitAttribution-BFshsh2H.js +2 -0
- package/dist/chunks/commitAttribution-DSv9FggK.js +1 -0
- package/dist/chunks/common-B379wT22.js +1 -0
- package/dist/chunks/common-B_BC3eMY.js +1 -0
- package/dist/chunks/common-CMCv4N_v.js +1 -0
- package/dist/chunks/compact-DWNaf1wR.js +3 -0
- package/dist/chunks/companion-CyK_Dr1U.js +1 -0
- package/dist/chunks/completionCache-DHfUBBMH.js +1 -0
- package/dist/chunks/completionCache-DORrtxkS.js +4 -0
- package/dist/chunks/computerUseLock-BjoDJH2h.js +1 -0
- package/dist/chunks/config-BdCuh6eA.js +1 -0
- package/dist/chunks/config-DNz6Eitr.js +1 -0
- package/dist/chunks/connectHeadless-CwsFt-Mh.js +1 -0
- package/dist/chunks/constants-41VpZw2G.js +1 -0
- package/dist/chunks/context-BOjdTj0i.js +1 -0
- package/dist/chunks/context-noninteractive-Bd2HO-vU.js +1 -0
- package/dist/chunks/context-noninteractive-k2ibficU.js +54 -0
- package/dist/chunks/controlMessageCompat-BJhFiS7u.js +1 -0
- package/dist/chunks/conversation-BP0phkOY.js +1 -0
- package/dist/chunks/conversation-Ci8O_eZ-.js +1 -0
- package/dist/chunks/copy-B0VUJ2rH.js +7 -0
- package/dist/chunks/createSSHSession-DqmkCS_k.js +6 -0
- package/dist/chunks/createSession-B9MhWusY.js +1 -0
- package/dist/chunks/createSession-CJEsHz58.js +1 -0
- package/dist/chunks/cron-DiW7eIPP.js +1 -0
- package/dist/chunks/cronJitterConfig-BzPaa52I.js +6 -0
- package/dist/chunks/crossProjectResume-tWsqBUHc.js +40 -0
- package/dist/chunks/cwd--iizewsn.js +1 -0
- package/dist/chunks/cwd-BgpSJxd7.js +1 -0
- package/dist/chunks/daemon-VYRit6Aq.js +2 -0
- package/dist/chunks/dangerousBackend-BU_PHGR2.js +1 -0
- package/dist/chunks/datadog-Bd1s_VFj.js +1 -0
- package/dist/chunks/datadog-DJowkWhh.js +1 -0
- package/dist/chunks/debug-DM5ezCBS.js +1 -0
- package/dist/chunks/debug-UI3T040K.js +5 -0
- package/dist/chunks/debugUtils-BBMFODKH.js +1 -0
- package/dist/chunks/defineProperty-80gRi2ZW.js +1 -0
- package/dist/chunks/desktop-BDowrzvG.js +1 -0
- package/dist/chunks/detached-D300jlhj.js +5 -0
- package/dist/chunks/detect-libc-DNuQfUvI.js +1 -0
- package/dist/chunks/detectRepository-CBk3S2zv.js +1 -0
- package/dist/chunks/detectRepository-DCTvg4p0.js +1 -0
- package/dist/chunks/detection-CQsNad64.js +1 -0
- package/dist/chunks/detection-DJ-vTbBf.js +1 -0
- package/dist/chunks/diff-auU5sUOw.js +1 -0
- package/dist/chunks/directoryCompletion-DP_4B1GL.js +1 -0
- package/dist/chunks/dist-CanSxOZ1.js +5 -0
- package/dist/chunks/dist-Cg1a1Exw.js +29 -0
- package/dist/chunks/dist-Q7YNoZ0H.js +20 -0
- package/dist/chunks/dist-es-4z5T3Jzm.js +1 -0
- package/dist/chunks/dist-es-B2jg52tM2.js +1 -0
- package/dist/chunks/dist-es-B6OXHQ1S.js +1 -0
- package/dist/chunks/dist-es-B8NEy5hc.js +1 -0
- package/dist/chunks/dist-es-BVGppqE4.js +1 -0
- package/dist/chunks/dist-es-Bcw5GZko.js +1 -0
- package/dist/chunks/dist-es-BoIJpncb.js +9 -0
- package/dist/chunks/dist-es-Bu_Fshi1.js +1 -0
- package/dist/chunks/dist-es-C-1vn4OP2.js +1 -0
- package/dist/chunks/dist-es-C41b_0B5.js +1 -0
- package/dist/chunks/dist-es-CCZYybbG2.js +1 -0
- package/dist/chunks/dist-es-CLK1mey-.js +1 -0
- package/dist/chunks/dist-es-CQz2aNf72.js +1 -0
- package/dist/chunks/dist-es-CSfI8B8l.js +1 -0
- package/dist/chunks/dist-es-CUZBYppo.js +1 -0
- package/dist/chunks/dist-es-CZkzHpjF.js +1 -0
- package/dist/chunks/dist-es-Cbf0_D8d.js +5 -0
- package/dist/chunks/dist-es-ChHe-SVL.js +1 -0
- package/dist/chunks/dist-es-ClYOf0My.js +1 -0
- package/dist/chunks/dist-es-D-kJbj4A2.js +1 -0
- package/dist/chunks/dist-es-D1LN6CJd.js +1 -0
- package/dist/chunks/dist-es-DC1sC3ph.js +1 -0
- package/dist/chunks/dist-es-DGn8uOwQ2.js +1 -0
- package/dist/chunks/dist-es-DK5fTeKM2.js +1 -0
- package/dist/chunks/dist-es-DN7otr6F.js +1 -0
- package/dist/chunks/dist-es-DPM0mPK5.js +1 -0
- package/dist/chunks/dist-es-DqZAh3nG.js +1 -0
- package/dist/chunks/dist-es-DuAZyxJ02.js +5 -0
- package/dist/chunks/dist-es-HVQrM0oE.js +1 -0
- package/dist/chunks/dist-es-OVleIB54.js +1 -0
- package/dist/chunks/dist-es-UAs0rdXg.js +1 -0
- package/dist/chunks/dist-es-WvMMuHmx2.js +1 -0
- package/dist/chunks/dist-es-fjXft-jH.js +1 -0
- package/dist/chunks/dist-es-hdN_ShpZ.js +3 -0
- package/dist/chunks/dist-es-neiUvMJb.js +1 -0
- package/dist/chunks/dist-es-yMYpDtui2.js +1 -0
- package/dist/chunks/dist-es-zjcbuB72.js +1 -0
- package/dist/chunks/distRoot-CcxmnzqQ.js +1 -0
- package/dist/chunks/doctor-bKPp6AeL.js +1 -0
- package/dist/chunks/earlyInput-JGJo1zcC.js +1 -0
- package/dist/chunks/earlyInput-tRkbxFv2.js +2 -0
- package/dist/chunks/effort-BQj2QnnA.js +9 -0
- package/dist/chunks/entry-CUu6-QhT.js +14 -0
- package/dist/chunks/env-chR0gV31.js +1 -0
- package/dist/chunks/envLessBridgeConfig-CixkwbRF.js +1 -0
- package/dist/chunks/envLessBridgeConfig-Ju4W58xf.js +1 -0
- package/dist/chunks/envUtils-BWeoiL4Y.js +1 -0
- package/dist/chunks/escHotkey-Cyz0yyh1.js +259 -0
- package/dist/chunks/esm--xjzB1hI.js +1 -0
- package/dist/chunks/esm-B2HIF0XY.js +1 -0
- package/dist/chunks/esm-BGQPWnJy.js +1 -0
- package/dist/chunks/esm-C-1qL9Mn.js +1 -0
- package/dist/chunks/esm-C3jcs1DH.js +1 -0
- package/dist/chunks/esm-C97WL9nC.js +1 -0
- package/dist/chunks/esm-CIL-SKM8.js +1 -0
- package/dist/chunks/esm-CJlBxjtx.js +1 -0
- package/dist/chunks/esm-CsGLyWmS.js +56 -0
- package/dist/chunks/esm-DQHmDm-H.js +1 -0
- package/dist/chunks/esm-DcdOXSzi.js +1 -0
- package/dist/chunks/esm-DhNYgGTV.js +1 -0
- package/dist/chunks/esm-DxPW7qPs.js +1 -0
- package/dist/chunks/esm-FBUWr3vI.js +1 -0
- package/dist/chunks/esm-QgL6y---.js +10 -0
- package/dist/chunks/esm-v0kPjgVS.js +1 -0
- package/dist/chunks/esm-vIn-YV_h.js +1 -0
- package/dist/chunks/event-streams-BV7ngMXu.js +1 -0
- package/dist/chunks/eventLoopStallDetector-Dnh1fc31.js +1 -0
- package/dist/chunks/execAsync-BkA6ogic.js +1 -0
- package/dist/chunks/execFileNoThrow-CuQN1sz8.js +1 -0
- package/dist/chunks/execSyncWrapper-C2XQnFVo.js +1 -0
- package/dist/chunks/execa-CGue6Z3n.js +34 -0
- package/dist/chunks/executor-4EeD8GNm.js +1561 -0
- package/dist/chunks/executor-BHEuNh5F.js +1 -0
- package/dist/chunks/exit-DijkO8eo.js +1 -0
- package/dist/chunks/exit-_obETqBv.js +2 -0
- package/dist/chunks/export-DA-bBZkX.js +2 -0
- package/dist/chunks/exportRenderer-3y4tGdSB.js +1 -0
- package/dist/chunks/extra-usage-CS6VwKJt.js +1 -0
- package/dist/chunks/extra-usage-DGHEQOrY.js +1 -0
- package/dist/chunks/extra-usage-core-DOgT4u4i.js +1 -0
- package/dist/chunks/extra-usage-noninteractive-DYnfiRlV.js +1 -0
- package/dist/chunks/extraUsage-CfxgfpX_.js +1 -0
- package/dist/chunks/extractMemories-jvjCvtpC.js +1 -0
- package/dist/chunks/fast-Bbtx_Bs1.js +1 -0
- package/dist/chunks/fast-CzRUJBTK.js +1 -0
- package/dist/chunks/featureCheck-Cm0YNDXO.js +1 -0
- package/dist/chunks/featureCheck-p7OeCYzj.js +1 -0
- package/dist/chunks/feedback-FoXtdHAV.js +1 -0
- package/dist/chunks/figures-gfT9mM8P.js +1 -0
- package/dist/chunks/fileStateCache-C7-TxF8G.js +1 -0
- package/dist/chunks/files-DYvAZGxp.js +2 -0
- package/dist/chunks/firstPartyEventLogger-KIwaBY-E.js +1 -0
- package/dist/chunks/flushGate-C2Icy43G.js +1 -0
- package/dist/chunks/foundry-sdk-BFN5VDFQ.js +1 -0
- package/dist/chunks/fpsMetrics-DeezdcwV.js +1 -0
- package/dist/chunks/fuse-Ch_OAlm3.js +1 -0
- package/dist/chunks/gates-CbQLZHtm.js +1 -0
- package/dist/chunks/gates-DSI3vpwO.js +1 -0
- package/dist/chunks/gemini-BrNJGX4k.js +1 -0
- package/dist/chunks/generateRecap-B0fvSCjo.js +1 -0
- package/dist/chunks/generateSessionName-DvRYa39O.js +1 -0
- package/dist/chunks/genericProcessUtils-BGvcwuPt.js +23 -0
- package/dist/chunks/getMachineId-bsd-BMtYGBUL.js +1 -0
- package/dist/chunks/getMachineId-darwin-CiLdFH7z.js +2 -0
- package/dist/chunks/getMachineId-linux-Cr27rIeY.js +1 -0
- package/dist/chunks/getMachineId-unsupported-ceiBLwAN.js +1 -0
- package/dist/chunks/getMachineId-win-DFTmsQHq.js +1 -0
- package/dist/chunks/git-CN3qtTb_.js +6 -0
- package/dist/chunks/git-D23Mzu_K.js +1 -0
- package/dist/chunks/githubRepoPathMapping-Dut3d6nn.js +1 -0
- package/dist/chunks/graceful-fs-Cgc0rjGF.js +2 -0
- package/dist/chunks/grok-Ftoheab3.js +1 -0
- package/dist/chunks/growthbook-BynnuVTn.js +1 -0
- package/dist/chunks/hash-BRmOQc3c.js +1 -0
- package/dist/chunks/heapdump-hQ_w0LPC.js +5 -0
- package/dist/chunks/help-DQsHHv6r.js +1 -0
- package/dist/chunks/hooks-BLLL4iPv.js +1 -0
- package/dist/chunks/hooks-BhVDc8yb.js +79 -0
- package/dist/chunks/hostAdapter-D1eWmmhu.js +1 -0
- package/dist/chunks/hostGuard-zim_4F9V.js +1 -0
- package/dist/chunks/httpAuthSchemes-Wq4XWeLL.js +13 -0
- package/dist/chunks/ide-CPmMXLL-.js +2 -0
- package/dist/chunks/inboundAttachments-Bmf6vYsE.js +1 -0
- package/dist/chunks/inboundAttachments-D-p91z3w.js +1 -0
- package/dist/chunks/index.min-BJnb9GQI.js +1 -0
- package/dist/chunks/initReplBridge-BiHXpDEY.js +1 -0
- package/dist/chunks/insights-CTlTyvjj.js +822 -0
- package/dist/chunks/install-IPuD3Lq8.js +1 -0
- package/dist/chunks/install-github-app-Bmu_sA9e.js +147 -0
- package/dist/chunks/install-slack-app-Rfl81Jqo.js +1 -0
- package/dist/chunks/instinctParser-DHMa8xa0.js +1 -0
- package/dist/chunks/instrumentation-DWwmOmr0.js +12 -0
- package/dist/chunks/intl-Pse97ORk.js +1 -0
- package/dist/chunks/isObject-DaxDnPKm.js +1 -0
- package/dist/chunks/isSymbol-Dp3irZaY.js +1 -0
- package/dist/chunks/job-BXEt0izn.js +2 -0
- package/dist/chunks/json-bigint-OxRwRvup.js +8 -0
- package/dist/chunks/jsx-runtime-D-D469L8.js +1 -0
- package/dist/chunks/jws-2vqRyZtR.js +3 -0
- package/dist/chunks/jwtUtils-CpXwh_du.js +1 -0
- package/dist/chunks/keybindings-DRDgVvqz.js +2 -0
- package/dist/chunks/lang-D3ZHlfT6.js +1 -0
- package/dist/chunks/language-B_-BfBT4.js +1 -0
- package/dist/chunks/language-DcSjogBx.js +1 -0
- package/dist/chunks/launchAgentsPlatform-BPm_VMln.js +1 -0
- package/dist/chunks/launchAutofixPr-D2qac07g.js +2 -0
- package/dist/chunks/launchCommand-Du91jxMC.js +1 -0
- package/dist/chunks/launchLocalMemory-D_hBbXKE.js +3 -0
- package/dist/chunks/launchLocalVault-CPzNWvQ9.js +3 -0
- package/dist/chunks/launchMemoryStores-Djq2KhKb.js +1 -0
- package/dist/chunks/launchOnboarding-Bh6E7vdc.js +8 -0
- package/dist/chunks/launchSchedule-C988bQ-5.js +1 -0
- package/dist/chunks/launchSkillStore-DqrP6Gme.js +1 -0
- package/dist/chunks/launchTeleport-DFhybaq_.js +3 -0
- package/dist/chunks/launchVault-p_CSK4ZQ.js +1 -0
- package/dist/chunks/lazySchema-2sOku3cX.js +1 -0
- package/dist/chunks/lib-B4Q0Nrpb.js +14 -0
- package/dist/chunks/lib-Ca3QWJjN.js +2 -0
- package/dist/chunks/lib-inCisXen.js +8 -0
- package/dist/chunks/loadAgentsDir-Ci5mr0vm.js +4601 -0
- package/dist/chunks/loadAgentsDir-vB1QEZ7H.js +1 -0
- package/dist/chunks/loadPluginHooks-xYCEZ6t5.js +1 -0
- package/dist/chunks/loadSso-sDs471GC.js +1 -0
- package/dist/chunks/localSearch-DtVqtfvk.js +1 -0
- package/dist/chunks/localSearch-Vpn6W5aY.js +1 -0
- package/dist/chunks/lockfile-DBwdlC3K.js +1 -0
- package/dist/chunks/log-CzsijfHZ.js +1 -0
- package/dist/chunks/login-D-N78G6r.js +1 -0
- package/dist/chunks/login-D9IWjvza.js +1 -0
- package/dist/chunks/logoV2Utils-SAulcC5x.js +1 -0
- package/dist/chunks/logout-CFggVS-9.js +1 -0
- package/dist/chunks/magicDocs-BfoeYhin.js +57 -0
- package/dist/chunks/main-C6be1KFk.js +31 -0
- package/dist/chunks/main-DhMlhVj3.js +1108 -0
- package/dist/chunks/mappers-uIrAj-Wd.js +1 -0
- package/dist/chunks/mcp-CAYGNxCb.js +1 -0
- package/dist/chunks/mcp-COQap0SM.js +6 -0
- package/dist/chunks/mcp-DlM0OC6R.js +2 -0
- package/dist/chunks/mcpServer-1SnOWb8_.js +1 -0
- package/dist/chunks/mcpServer-DXvS3v4x.js +1 -0
- package/dist/chunks/memoize-DNnuA2aU.js +1 -0
- package/dist/chunks/memoize-DxwLawI2.js +1 -0
- package/dist/chunks/memory-XccPLQLt.js +1 -0
- package/dist/chunks/mobile-umu5P0cM.js +2 -0
- package/dist/chunks/modalContext-CmSKRyea.js +1 -0
- package/dist/chunks/model-CbiDGGJU.js +1 -0
- package/dist/chunks/model-DdbcxKub.js +1 -0
- package/dist/chunks/normalization-Cox8C0dP.js +1 -0
- package/dist/chunks/oauth-CdZEzMww.js +1 -0
- package/dist/chunks/oauth-CmensepG.js +1 -0
- package/dist/chunks/observationStore-tvkldXUo.js +4 -0
- package/dist/chunks/onChangeAppState-Dp0JIXd8.js +1 -0
- package/dist/chunks/open-CDditBQ-.js +1 -0
- package/dist/chunks/openai-6KcHd4Hw.js +10 -0
- package/dist/chunks/openaiShared-D5lOejS1.js +16 -0
- package/dist/chunks/output-style-XDb9-2Kk.js +1 -0
- package/dist/chunks/overageCreditGrant-DYiB4sr-.js +1 -0
- package/dist/chunks/p-map-9Ud1LOrJ.js +1 -0
- package/dist/chunks/p-map-D7WEmnBE.js +1 -0
- package/dist/chunks/package-BhL7chzt.js +1 -0
- package/dist/chunks/panel-ByW1omJn.js +1 -0
- package/dist/chunks/panel-Bz_8td5D.js +1 -0
- package/dist/chunks/parseConnectUrl-BS6i9JPo.js +1 -0
- package/dist/chunks/parser-CmngCwjB.js +1 -0
- package/dist/chunks/parser-SWIZo39J.js +1 -0
- package/dist/chunks/passes-Cbc6T_Tj.js +1 -0
- package/dist/chunks/path-C4kbwvSH.js +1 -0
- package/dist/chunks/paths-Q2255dD7.js +39 -0
- package/dist/chunks/permissions-BLzPHh_3.js +3 -0
- package/dist/chunks/permissions-DXLfdE7b.js +1 -0
- package/dist/chunks/permissions-Ps_D01ZB.js +1 -0
- package/dist/chunks/pipeTransport-D7NIp3aA.js +1 -0
- package/dist/chunks/plan-DloFVJK7.js +1 -0
- package/dist/chunks/platform-CuyedWpe.js +2 -0
- package/dist/chunks/plist-BO4ZqMZc.js +6 -0
- package/dist/chunks/plugin-XR9IBPMM.js +1 -0
- package/dist/chunks/pluginAutoupdate-Cr9hP0zG.js +1 -0
- package/dist/chunks/pluginBlocklist-CM9uP8CY.js +1 -0
- package/dist/chunks/pluginCliCommands-BQkrvES5.js +1 -0
- package/dist/chunks/pluginFlagging-CJ1--2Kw.js +1 -0
- package/dist/chunks/pluginOperations-B0rLuSvo.js +2 -0
- package/dist/chunks/pluginStartupCheck-Bjdc8zhz.js +1 -0
- package/dist/chunks/pluginStartupCheck-Cu2ezD51.js +1 -0
- package/dist/chunks/plugins-BgOP_8TX.js +4 -0
- package/dist/chunks/policyLimits-CKy_gTEt.js +1 -0
- package/dist/chunks/pollConfig-DhptuhFw.js +1 -0
- package/dist/chunks/poller-Ds0Y6Cir.js +1 -0
- package/dist/chunks/poor-DF0aqXDx.js +1 -0
- package/dist/chunks/poorMode-C5Frra4j.js +1 -0
- package/dist/chunks/poorMode-DJvjO2nW.js +1 -0
- package/dist/chunks/postCommitAttribution-Ehmwzzuq.js +1 -0
- package/dist/chunks/print-CPtR0KTa.js +39 -0
- package/dist/chunks/privacy-settings-e-7lc7Un.js +1 -0
- package/dist/chunks/process-CWupreF6.js +1 -0
- package/dist/chunks/process-DMKLUQIO.js +1 -0
- package/dist/chunks/processBashCommand-D5dC6Mya.js +1 -0
- package/dist/chunks/processSlashCommand-DHRUtZ-C.js +6 -0
- package/dist/chunks/projectContext-0fpRKUeH.js +1 -0
- package/dist/chunks/projectContext-eXMSfgdZ.js +1 -0
- package/dist/chunks/prompt-4tea6NJQ.js +54 -0
- package/dist/chunks/prompt-CQC-mh6u.js +1 -0
- package/dist/chunks/prompt-DEPUnJdB.js +222 -0
- package/dist/chunks/prompt-DawxLANl.js +1 -0
- package/dist/chunks/promptEditor-Ci-h04-5.js +4 -0
- package/dist/chunks/protocolHandler-DhqM32qE.js +13 -0
- package/dist/chunks/protocols-CAyQOlkr.js +7 -0
- package/dist/chunks/proxy-CfZp-wce.js +99 -0
- package/dist/chunks/rate-limit-options-B0l29Zx8.js +1 -0
- package/dist/chunks/rcDebugLog-BbPkkigY.js +11 -0
- package/dist/chunks/referral-ByevBJrE.js +1 -0
- package/dist/chunks/refresh-B_CwwIRX.js +1 -0
- package/dist/chunks/registerProtocol-DzhaQH02.js +36 -0
- package/dist/chunks/registry-DkHA4cRu.js +1 -0
- package/dist/chunks/release-notes-CZthYkei.js +4 -0
- package/dist/chunks/releaseNotes-CwKpIsyd.js +2 -0
- package/dist/chunks/reload-plugins-DxWfXvrN.js +1 -0
- package/dist/chunks/remote-env-BiRLWIrh.js +1 -0
- package/dist/chunks/remoteBridgeCore-nz1fPY1U.js +1 -0
- package/dist/chunks/remoteControlServer-FzLUxh2B.js +3 -0
- package/dist/chunks/rename-DmGuyncE.js +1 -0
- package/dist/chunks/renderOptions-BiyC2rj1.js +1 -0
- package/dist/chunks/resume-7GeU7RMS.js +2 -0
- package/dist/chunks/rewind-CXplHgh_.js +1 -0
- package/dist/chunks/rollback-DbSpxmJE.js +11 -0
- package/dist/chunks/runtimeObserver-Duod-ign.js +10 -0
- package/dist/chunks/runtimeObserver-OgM9ZYxZ.js +1 -0
- package/dist/chunks/sandbox-adapter-CxkhKgaa.js +1 -0
- package/dist/chunks/sandbox-toggle-Cc96R6Ox.js +1 -0
- package/dist/chunks/sanitization-CYp-9DbE.js +1 -0
- package/dist/chunks/satisfies-BaHgd_ie.js +1 -0
- package/dist/chunks/schemas-BGAvj1T4.js +40 -0
- package/dist/chunks/sdk-DEtgRZvI.js +1 -0
- package/dist/chunks/sdkHeapDumpMonitor--fevrC5z.js +1 -0
- package/dist/chunks/searchExtraTools-DQ6e601b.js +1 -0
- package/dist/chunks/semver-Cq33BYay.js +1 -0
- package/dist/chunks/semver-Tw0AFar5.js +1 -0
- package/dist/chunks/sentry-BUHYuYGj.js +13 -0
- package/dist/chunks/server-C5XZSlto.js +1 -0
- package/dist/chunks/server-DzOdtq8A.js +1 -0
- package/dist/chunks/serverBanner-WlSYP-f8.js +1 -0
- package/dist/chunks/serverLog-DtsUvDiY.js +1 -0
- package/dist/chunks/session-DgLqm7ZI.js +2 -0
- package/dist/chunks/sessionDataUploader-Ctjo1bgR.js +1 -0
- package/dist/chunks/sessionDiscovery-DgNea6qa.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-7Svz-7S-.js +1 -0
- package/dist/chunks/sessionManager-Dw72ZUTg.js +1 -0
- package/dist/chunks/sessionMemory-DIrR3zvb.js +1 -0
- package/dist/chunks/sessionMemory-_dmj8lcH.js +1 -0
- package/dist/chunks/sessionMemoryUtils-BdQtSkRx.js +1 -0
- package/dist/chunks/sessionObserver-CuWMVPlT.js +20 -0
- package/dist/chunks/sessionObserver-_adufOGQ.js +1 -0
- package/dist/chunks/sessionStorage-W7okgAlQ.js +1 -0
- package/dist/chunks/sessionStoragePortable-BI9q2WcJ.js +3 -0
- package/dist/chunks/sessionTitle-DzkMzHer.js +14 -0
- package/dist/chunks/sessionTracing-DTjmc0EF.js +11 -0
- package/dist/chunks/settingsSync-CfYDkakY.js +1 -0
- package/dist/chunks/setup-BKUG46jQ.js +9 -0
- package/dist/chunks/setup-CmLngvpJ.js +1 -0
- package/dist/chunks/setup-TqJ7-Nxh.js +2 -0
- package/dist/chunks/shadowedRuleDetection-DesT0yKM.js +1 -0
- package/dist/chunks/shellQuote-DgjT8KBA.js +1 -0
- package/dist/chunks/sideQuestion-BAq0YyKY.js +20 -0
- package/dist/chunks/signin-QEeYpJZw.js +1 -0
- package/dist/chunks/sink-B3uP8Cf8.js +1 -0
- package/dist/chunks/sink-CaWMZBw_.js +1 -0
- package/dist/chunks/sinks-COcy5GnB.js +2 -0
- package/dist/chunks/sinks-oFfsKySL.js +1 -0
- package/dist/chunks/skill-learning-DOIMPtWE.js +5 -0
- package/dist/chunks/skillChangeDetector-CA_Tdx8N.js +1 -0
- package/dist/chunks/skillGapStore-CWuw1dYh.js +1 -0
- package/dist/chunks/skillGapStore-DpEoKhn-.js +5 -0
- package/dist/chunks/skillGenerator-9y3Q4YoO.js +8 -0
- package/dist/chunks/skillLearning-BhM09bQD.js +1 -0
- package/dist/chunks/skillLearning-_o2D06yM.js +1 -0
- package/dist/chunks/skillPanel-Dt24mZTZ.js +28 -0
- package/dist/chunks/skillSearchPanel-gaXN64Fu.js +21 -0
- package/dist/chunks/skills-Dx3dMHYk.js +1 -0
- package/dist/chunks/slashCommandParsing-Cari0pNg.js +1 -0
- package/dist/chunks/sleep-8Eb9j_Ly.js +1 -0
- package/dist/chunks/sprites-5OAB-Ui2.js +1 -0
- package/dist/chunks/src-BIPP3_mo.js +26 -0
- package/dist/chunks/src-BJz1KAd_.js +6 -0
- package/dist/chunks/src-BRAdBA8A.js +1 -0
- package/dist/chunks/src-BRC_BuUP.js +1 -0
- package/dist/chunks/src-BaB-bpCj.js +5 -0
- package/dist/chunks/src-BlLavFUS.js +7 -0
- package/dist/chunks/src-C5yhFG0C.js +19 -0
- package/dist/chunks/src-CI_jaaBj.js +2 -0
- package/dist/chunks/src-CRsA-Z4y.js +1 -0
- package/dist/chunks/src-CYLfL70h.js +1 -0
- package/dist/chunks/src-DJXCzwyJ.js +1 -0
- package/dist/chunks/src-DJXKJavk.js +1 -0
- package/dist/chunks/src-Di342QoJ.js +53 -0
- package/dist/chunks/src-DsMd9Q9e.js +2 -0
- package/dist/chunks/src-DzH9IdOo.js +1 -0
- package/dist/chunks/src-hdbPEvzO.js +9 -0
- package/dist/chunks/src-poaoYkuc.js +1 -0
- package/dist/chunks/src-x7u_sB6m.js +1 -0
- package/dist/chunks/sso-oidc-BX1MlBX0.js +1 -0
- package/dist/chunks/startupProfiler-DnXZaX4A.js +3 -0
- package/dist/chunks/startupProfiler-SOE--nM9.js +1 -0
- package/dist/chunks/state-B2GIOsTB.js +1 -0
- package/dist/chunks/state-Ce1HlR-H.js +1 -0
- package/dist/chunks/state-sIHsFpDu.js +1 -0
- package/dist/chunks/staticRender-Br64h1E1.js +1 -0
- package/dist/chunks/stats-TUExo9iU.js +1 -0
- package/dist/chunks/status-Dghaz1my.js +1 -0
- package/dist/chunks/statusNoticeHelpers-DVZSSXeK.js +1 -0
- package/dist/chunks/stdio-BEEzuxaZ.js +1 -0
- package/dist/chunks/stdio-D4cT86R0.js +3 -0
- package/dist/chunks/stickers-2K05wjSp.js +1 -0
- package/dist/chunks/store-DhI7Lcan.js +1 -0
- package/dist/chunks/sts-BDFJ-6QE.js +1 -0
- package/dist/chunks/subprocessEnv-CggQWZCx.js +1 -0
- package/dist/chunks/subprocessEnv-DV6q6o6w.js +1 -0
- package/dist/chunks/supports-color-lkzOMQ6u.js +1 -0
- package/dist/chunks/systemPromptSections-BcN_XBTx.js +1 -0
- package/dist/chunks/systemPromptSections-DB93ZNWP.js +1 -0
- package/dist/chunks/systemTheme-dDbitcxB.js +1 -0
- package/dist/chunks/tag-ZcVkzFjz.js +11 -0
- package/dist/chunks/tasks-DbB33ekt.js +1 -0
- package/dist/chunks/teamHelpers-BmN9nKz-.js +1 -0
- package/dist/chunks/teamHelpers-yeTNtZbb.js +1 -0
- package/dist/chunks/teammate-DMYOtLTK.js +1 -0
- package/dist/chunks/teammateModeSnapshot-CPjJJDL1.js +1 -0
- package/dist/chunks/teammateModeSnapshot-CsNIJTKi.js +1 -0
- package/dist/chunks/teleport-JHgpwZIh.js +1 -0
- package/dist/chunks/templateJobs-Db630FZD.js +12 -0
- package/dist/chunks/terminalSetup-DJqWE8fc.js +33 -0
- package/dist/chunks/terminalSetup-ygKHrVKR.js +1 -0
- package/dist/chunks/theme-MmfFhdTD.js +1 -0
- package/dist/chunks/thinkback-CrNirB0V.js +1 -0
- package/dist/chunks/thinkback-Quc7KPmi.js +1 -0
- package/dist/chunks/thinkback-play-CQ1s7oqg.js +1 -0
- package/dist/chunks/tmux-CvbhsfwG.js +1 -0
- package/dist/chunks/toolEventObserver-BqMplcIk.js +1 -0
- package/dist/chunks/toolEventObserver-DBq2XBYY.js +1 -0
- package/dist/chunks/toolPool-BkCtTKXz.js +1 -0
- package/dist/chunks/toolPool-C7bOwJfR.js +1 -0
- package/dist/chunks/trustedDevice-C9Zevohz.js +1 -0
- package/dist/chunks/trustedDevice-DEuQUTbz.js +1 -0
- package/dist/chunks/tui-BVc2q4Xv.js +6 -0
- package/dist/chunks/turndown.es-Bv06VjMb.js +69 -0
- package/dist/chunks/types-CQ1wrnQ0.js +1 -0
- package/dist/chunks/types-Csi32ZXh.js +17 -0
- package/dist/chunks/types-RJTEOuIt.js +3 -0
- package/dist/chunks/udsClient-BvG_Jip0.js +1 -0
- package/dist/chunks/ultrareviewCommand-DrlfRrXq.js +3 -0
- package/dist/chunks/undercover-CBeHiWUd.js +1 -0
- package/dist/chunks/undercover-DKn95mh9.js +31 -0
- package/dist/chunks/up-D-U4wUCe.js +12 -0
- package/dist/chunks/updateCCB-CJ7dCUan.js +11 -0
- package/dist/chunks/upgrade-Degqbu8S.js +1 -0
- package/dist/chunks/upgrade-ucJ-lnlY.js +1 -0
- package/dist/chunks/upload-pTZQCPLt.js +1 -0
- package/dist/chunks/upstreamproxy-DcLeL2XX.js +11 -0
- package/dist/chunks/usage-D96a7Cke.js +1 -0
- package/dist/chunks/usage-DVQMUMcC.js +1 -0
- package/dist/chunks/useKeybinding-FsOnjW6T.js +1 -0
- package/dist/chunks/useMainLoopModel-B7ch2o9K.js +1 -0
- package/dist/chunks/useManagePlugins-BfGzHMvO.js +1 -0
- package/dist/chunks/useMergedTools-TemEvCrX.js +1 -0
- package/dist/chunks/useSearchInput-B-V4kIa-.js +1 -0
- package/dist/chunks/useSettingsErrors-B2JGz1s8.js +1 -0
- package/dist/chunks/useVoice-BuwYDm2U.js +1 -0
- package/dist/chunks/util-CeIKZmj9.js +1 -0
- package/dist/chunks/utils-CwhszpkT.js +1 -0
- package/dist/chunks/v4-f1i_CNUT.js +1 -0
- package/dist/chunks/validatePlugin-BlVho93x.js +1 -0
- package/dist/chunks/vertex-sdk-CSGw3fvU.js +9 -0
- package/dist/chunks/vim-DUZQCWUP.js +1 -0
- package/dist/chunks/voice-BkRIHZiM.js +2 -0
- package/dist/chunks/voice-DXiiy8HX.js +8 -0
- package/dist/chunks/voiceModeEnabled-CPQUE3PU.js +1 -0
- package/dist/chunks/voiceModeEnabled-DB8GCzAF.js +1 -0
- package/dist/chunks/voiceStreamSTT-DgoDscHn.js +1 -0
- package/dist/chunks/voiceStreamSTT-Dr_wH1Kh.js +1 -0
- package/dist/chunks/which-DqSAIvp2.js +1 -0
- package/dist/chunks/windowsPaths-C9CigqoF.js +1 -0
- package/dist/chunks/windowsPaths-swxCp7bX.js +2 -0
- package/dist/chunks/workSecret-mS2OrpxF.js +1 -0
- package/dist/chunks/workerRegistry-CT7_kjvY.js +1 -0
- package/dist/chunks/worktree-DU3xtwKW.js +1 -0
- package/dist/chunks/worktreeModeEnabled-Db6b_Iy_.js +1 -0
- package/dist/chunks/worktreeModeEnabled-THQb19xR.js +1 -0
- package/dist/chunks/wrapper-BSK0MCQH.js +1 -0
- package/dist/chunks/wrapper-D5qL1aQL.js +6 -0
- package/dist/chunks/xdg-CBxMmQux.js +1 -0
- package/dist/chunks/xml-DD_ldd3X.js +1 -0
- package/dist/chunks/zod-DT6hytkp.js +1 -0
- package/dist/cli.js +1 -10978
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./figures-gfT9mM8P.js";import{Rn as r,b as i,o as a,t as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Zc as l,el as u,nc as d,tc as f}from"./paths-Q2255dD7.js";import{b as p,x as m}from"./startupProfiler-DnXZaX4A.js";import{Dk as h,Ek as g,Lo as _,Oo as v,al as y,rl as b}from"./loadAgentsDir-Ci5mr0vm.js";import{Fn as x,In as S,Mn as C,Pn as w,hn as T,in as E,rn as D,xn as O}from"./prompt-DEPUnJdB.js";import{n as k,t as ee}from"./staticRender-Br64h1E1.js";function A(e){let t=[];return j(e,t),M(e,t),P(e,t),F(e,t),I(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function j(e,t){e.percentage>=B&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function M(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<L||r<R)continue;let a=N(n.name,r,i);a&&t.push(a)}}function N(e,t,n){let r=p(t);switch(e){case x:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case T:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case C:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};case D:return{severity:`info`,title:`WebFetch results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Web page content can be very large. Consider extracting only the specific information needed.`,savingsTokens:Math.floor(t*.4)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function P(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===T);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=L&&r>=R||a>=z&&n.resultTokens>=R&&t.push({severity:`info`,title:`File reads using ${p(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function F(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=V&&n>=H){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${l(e.path)} (${p(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${p(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function I(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<B&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var L,R,z,B,V,H,U=e((()=>{S(),O(),w(),E(),u(),m(),L=15,R=1e4,z=5,B=80,V=5,H=5e3}));function W({suggestions:e}){return e.length===0?null:(0,G.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,G.jsx)(i,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,G.jsxs)(s,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,G.jsxs)(s,{children:[(0,G.jsx)(a,{status:e.severity,withSpace:!0}),(0,G.jsx)(i,{bold:!0,children:e.title}),e.savingsTokens?(0,G.jsxs)(i,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,p(e.savingsTokens)]}):null]}),(0,G.jsx)(s,{marginLeft:2,children:(0,G.jsx)(i,{dimColor:!0,children:e.detail})})]},t))]})}var G,K=e((()=>{t(),r(),o(),m(),G=c()}));function q(){return null}function J(e){let t=new Map;for(let n of e){let e=f(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Q){let r=t.get(e);r&&n.set(e,r)}return n}function Y({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:a,gridRows:o,model:c,memoryFiles:u,mcpTools:d,deferredBuiltinTools:f=[],systemTools:m,systemPromptSections:h,agents:g,skills:_,messageBreakdown:v,cacheHitRate:y,cacheThreshold:b}=e,x=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==Z&&!e.isDeferred),S=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),C=f.length>0,w=t.find(e=>e.name===Z);return(0,X.jsxs)(s,{flexDirection:`column`,paddingLeft:1,children:[(0,X.jsx)(i,{bold:!0,children:`Context Usage`}),(0,X.jsxs)(s,{flexDirection:`row`,gap:2,children:[(0,X.jsx)(s,{flexDirection:`column`,flexShrink:0,children:o.map((e,t)=>(0,X.jsx)(s,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,X.jsx)(i,{dimColor:!0,children:`⛶ `},t):e.categoryName===Z?(0,X.jsx)(i,{color:e.color,children:`⛝ `},t):(0,X.jsx)(i,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,X.jsxs)(s,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,X.jsxs)(i,{dimColor:!0,children:[c,` · `,p(n),`/`,p(r),` tokens (`,a,`%)`]}),(0,X.jsx)(q,{}),y!==void 0&&b!==void 0&&(0,X.jsxs)(i,{color:y<b?`warning`:void 0,children:[`Cache hit rate: `,y.toFixed(0),`%`,y<b?` (below ${b}% threshold)`:``]}),(0,X.jsx)(i,{children:` `}),(0,X.jsx)(i,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),x.map((e,t)=>{let n=p(e.tokens),a=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,o=e.name===Z,c=e.name,l=e.isDeferred?` `:o?`⛝`:`⛁`;return(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{color:e.color,children:l}),(0,X.jsxs)(i,{children:[` `,c,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[n,` tokens (`,a,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{dimColor:!0,children:`⛶`}),(0,X.jsx)(i,{children:` Free space: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),w&&w.tokens>0&&(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{color:w.color,children:`⛝`}),(0,X.jsxs)(i,{dimColor:!0,children:[` `,w.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(w.tokens),` tokens (`,(w.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,X.jsxs)(s,{flexDirection:`column`,marginLeft:-1,children:[d.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`MCP tools`}),(0,X.jsxs)(i,{dimColor:!0,children:[` · /mcp`,S?` (loaded on-demand)`:``]})]}),d.some(e=>e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Loaded`}),d.filter(e=>e.isLoaded).map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),S&&d.some(e=>!e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Available`}),d.filter(e=>!e.isLoaded).map((e,t)=>(0,X.jsx)(s,{children:(0,X.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!S&&d.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),(m&&m.length>0||C)&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] System tools`}),C&&(0,X.jsx)(i,{dimColor:!0,children:` (some loaded on-demand)`})]}),(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Loaded`}),m?.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},`sys-${t}`)),f.filter(e=>e.isLoaded).map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},`def-${t}`))]}),C&&f.some(e=>!e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Available`}),f.filter(e=>!e.isLoaded).map((e,t)=>(0,X.jsx)(s,{children:(0,X.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]})]}),h&&h.length>0&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] System prompt sections`}),h.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),g.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Custom agents`}),(0,X.jsx)(i,{dimColor:!0,children:` · /agents`})]}),Array.from(J(g).entries()).map(([e,t])=>(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.agentType,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]},e))]}),u.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Memory files`}),(0,X.jsx)(i,{dimColor:!0,children:` · /memory`})]}),u.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,l(e.path),`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),_&&_.tokens>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Skills`}),(0,X.jsx)(i,{dimColor:!0,children:` · /skills`})]}),Array.from(J(_.skillFrontmatter).entries()).map(([e,t])=>(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]},e))]}),v&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Message breakdown`}),(0,X.jsxs)(s,{flexDirection:`column`,marginLeft:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Tool calls: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.toolCallTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Tool results: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.toolResultTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Attachments: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.attachmentTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Assistant messages (non-tool): `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.assistantMessageTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`User messages (non-tool-result): `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.userMessageTokens),` tokens`]})]})]}),v.toolCallsByType.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top tools`}),v.toolCallsByType.slice(0,5).map((e,t)=>(0,X.jsxs)(s,{marginLeft:1,children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[`calls `,p(e.callTokens),`, results `,p(e.resultTokens)]})]},t))]}),v.attachmentsByType.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top attachments`}),v.attachmentsByType.slice(0,5).map((e,t)=>(0,X.jsxs)(s,{marginLeft:1,children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]})]})]}),(0,X.jsx)(W,{suggestions:A(e)})]})}var X,Z,Q,te=e((()=>{r(),o(),U(),u(),m(),d(),K(),X=c(),Z=`Autocompact buffer`,Q=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function ne(e){return v(e)}async function re(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=ne(n),{messages:s}=await h(o),c=process.stdout.columns||80,l=r();return e(await k((0,$.jsx)(Y,{data:await b(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{r(),te(),g(),y(),_(),ee(),$=c()}))();export{re as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./context-noninteractive-k2ibficU.js";t();export{n as call,e as collectContextData};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{nc as t,tc as n}from"./paths-Q2255dD7.js";import{b as r,x as i}from"./startupProfiler-DnXZaX4A.js";import{Dk as a,Ek as o,Lo as s,Oo as c,al as l,rl as u}from"./loadAgentsDir-Ci5mr0vm.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:i,agentDefinitions:o,customSystemPrompt:s,appendSystemPrompt:l}}=e,d=c(t),{messages:f}=await a(d),p=n();return u(f,r,async()=>p.toolPermissionContext,i,o,void 0,{options:{customSystemPrompt:s,appendSystemPrompt:l}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:i,rawMaxTokens:a,percentage:o,model:s,memoryFiles:c,mcpTools:l,agents:u,skills:d,messageBreakdown:f,systemTools:p,systemPromptSections:m}=e,h=`## Context Usage
|
|
2
|
+
|
|
3
|
+
`;h+=`**Model:** ${s} \n`,h+=`**Tokens:** ${r(i)} / ${r(a)} (${o}%)\n`,h+=`
|
|
4
|
+
`;let g=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(g.length>0){h+=`### Estimated usage by category
|
|
5
|
+
|
|
6
|
+
`,h+=`| Category | Tokens | Percentage |
|
|
7
|
+
`,h+=`|----------|--------|------------|
|
|
8
|
+
`;for(let e of g){let t=(e.tokens/a*100).toFixed(1);h+=`| ${e.name} | ${r(e.tokens)} | ${t}% |\n`}let e=t.find(e=>e.name===`Free space`);if(e&&e.tokens>0){let t=(e.tokens/a*100).toFixed(1);h+=`| Free space | ${r(e.tokens)} | ${t}% |\n`}let n=t.find(e=>e.name===`Autocompact buffer`);if(n&&n.tokens>0){let e=(n.tokens/a*100).toFixed(1);h+=`| Autocompact buffer | ${r(n.tokens)} | ${e}% |\n`}h+=`
|
|
9
|
+
`}if(l.length>0){h+=`### MCP Tools
|
|
10
|
+
|
|
11
|
+
`,h+=`| Tool | Server | Tokens |
|
|
12
|
+
`,h+=`|------|--------|--------|
|
|
13
|
+
`;for(let e of l)h+=`| ${e.name} | ${e.serverName} | ${r(e.tokens)} |\n`;h+=`
|
|
14
|
+
`}if(p&&p.length>0&&process.env.USER_TYPE===`ant`){h+=`### [ANT-ONLY] System Tools
|
|
15
|
+
|
|
16
|
+
`,h+=`| Tool | Tokens |
|
|
17
|
+
`,h+=`|------|--------|
|
|
18
|
+
`;for(let e of p)h+=`| ${e.name} | ${r(e.tokens)} |\n`;h+=`
|
|
19
|
+
`}if(m&&m.length>0&&process.env.USER_TYPE===`ant`){h+=`### [ANT-ONLY] System Prompt Sections
|
|
20
|
+
|
|
21
|
+
`,h+=`| Section | Tokens |
|
|
22
|
+
`,h+=`|---------|--------|
|
|
23
|
+
`;for(let e of m)h+=`| ${e.name} | ${r(e.tokens)} |\n`;h+=`
|
|
24
|
+
`}if(u.length>0){h+=`### Custom Agents
|
|
25
|
+
|
|
26
|
+
`,h+=`| Agent Type | Source | Tokens |
|
|
27
|
+
`,h+=`|------------|--------|--------|
|
|
28
|
+
`;for(let e of u){let t;switch(e.source){case`projectSettings`:t=`Project`;break;case`userSettings`:t=`User`;break;case`localSettings`:t=`Local`;break;case`flagSettings`:t=`Flag`;break;case`policySettings`:t=`Policy`;break;case`plugin`:t=`Plugin`;break;case`built-in`:t=`Built-in`;break;default:t=String(e.source)}h+=`| ${e.agentType} | ${t} | ${r(e.tokens)} |\n`}h+=`
|
|
29
|
+
`}if(c.length>0){h+=`### Memory Files
|
|
30
|
+
|
|
31
|
+
`,h+=`| Type | Path | Tokens |
|
|
32
|
+
`,h+=`|------|------|--------|
|
|
33
|
+
`;for(let e of c)h+=`| ${e.type} | ${e.path} | ${r(e.tokens)} |\n`;h+=`
|
|
34
|
+
`}if(d&&d.tokens>0&&d.skillFrontmatter.length>0){h+=`### Skills
|
|
35
|
+
|
|
36
|
+
`,h+=`| Skill | Source | Tokens |
|
|
37
|
+
`,h+=`|-------|--------|--------|
|
|
38
|
+
`;for(let e of d.skillFrontmatter)h+=`| ${e.name} | ${n(e.source)} | ${r(e.tokens)} |\n`;h+=`
|
|
39
|
+
`}if(f&&process.env.USER_TYPE===`ant`){if(h+=`### [ANT-ONLY] Message Breakdown
|
|
40
|
+
|
|
41
|
+
`,h+=`| Category | Tokens |
|
|
42
|
+
`,h+=`|----------|--------|
|
|
43
|
+
`,h+=`| Tool calls | ${r(f.toolCallTokens)} |\n`,h+=`| Tool results | ${r(f.toolResultTokens)} |\n`,h+=`| Attachments | ${r(f.attachmentTokens)} |\n`,h+=`| Assistant messages (non-tool) | ${r(f.assistantMessageTokens)} |\n`,h+=`| User messages (non-tool-result) | ${r(f.userMessageTokens)} |\n`,h+=`
|
|
44
|
+
`,f.toolCallsByType.length>0){h+=`#### Top Tools
|
|
45
|
+
|
|
46
|
+
`,h+=`| Tool | Call Tokens | Result Tokens |
|
|
47
|
+
`,h+=`|------|-------------|---------------|
|
|
48
|
+
`;for(let e of f.toolCallsByType)h+=`| ${e.name} | ${r(e.callTokens)} | ${r(e.resultTokens)} |\n`;h+=`
|
|
49
|
+
`}if(f.attachmentsByType.length>0){h+=`#### Top Attachments
|
|
50
|
+
|
|
51
|
+
`,h+=`| Attachment | Tokens |
|
|
52
|
+
`,h+=`|------------|--------|
|
|
53
|
+
`;for(let e of f.attachmentsByType)h+=`| ${e.name} | ${r(e.tokens)} |\n`;h+=`
|
|
54
|
+
`}}return h}var m=e((()=>{o(),l(),i(),s(),t()}));export{d as n,m as r,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){if(typeof e!=`object`||!e)return e;let t=e;if(`requestId`in t&&!(`request_id`in t)&&(t.request_id=t.requestId,delete t.requestId),`response`in t&&t.response!==null&&typeof t.response==`object`){let e=t.response;`requestId`in e&&!(`request_id`in e)&&(e.request_id=e.requestId,delete e.requestId)}return e}export{e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./conversation-Ci8O_eZ-.js";e();export{t as clearConversation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t}from"./chunk-DR8-3Aex.js";import{Ct as n,Jn as r,Xn as i,Z as a,cn as o,gn as s,ot as c,qn as l,yn as u}from"./state-sIHsFpDu.js";import{n as d,r as f}from"./analytics-DqMQntaB.js";import{o as p,s as m}from"./log-CzsijfHZ.js";import{$y as h,Ar as g,Cv as _,Du as v,Eu as y,F_ as b,Fv as x,Hm as S,Hv as C,Mn as w,P_ as T,Qy as E,Sv as D,Um as O,Yt as k,ad as A,cE as j,di as M,fr as N,gE as P,id as F,jn as ee,kn as I,mE as L,nr as R,sE as z,un as B,wi as V,wt as H,xi as U,xt as W,yn as G}from"./loadAgentsDir-Ci5mr0vm.js";import{C as K,y as q}from"./rcDebugLog-BbPkkigY.js";import{l as J,r as Y}from"./commitAttribution-BFshsh2H.js";import{n as X,t as Z}from"./caches-BUBkfP2Q.js";import{randomUUID as Q}from"crypto";function $(){let e=F();if(!e)return;e.markTranscriptReset?.();let t={type:`status`,subtype:`status`,status:`conversation_cleared`,message:`conversation_cleared`,uuid:Q()};e.writeSdkMessages([t])}async function te({setMessages:t,readFileState:o,discoveredSkillNames:d,loadedNestedMemoryPaths:p,getAppState:y,setAppState:S,setConversationId:C}){let w=B();await k(`clear`,{getAppState:y,setAppState:S,signal:AbortSignal.timeout(w),timeoutMs:w});let T=a();T&&f(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:T});let E=new Set,D=[],A=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(y)for(let e of Object.values(y().tasks))A(e)||(v(e)?(E.add(e.agentId),D.push(e)):h(e)&&E.add(e.identity.agentId));t(()=>[]),$();{let{setContextBlocked:t}=(q(),e(K));t(!1)}C&&C(Q()),Z(E),l(null),r(null),i(null),u(),O(c()),o.clear(),d?.clear(),p?.clear(),S&&S(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!A(r)){t[n]=r;continue}try{r.status===`running`&&(b(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){m(e)}I(n)}return{...e,tasks:t,attribution:Y(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),x(),R(),s({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=n()),await M();for(let e of D)e.status===`running`&&ee(e.id,N(L(e.agentId)));{let{saveMode:t}=(g(),e(V)),{isCoordinatorMode:n}=(j(),e(z));t(n()?`coordinator`:`normal`)}let P=W();P&&U(P);let F=await _(`clear`);F.length>0&&t(()=>F)}var ne=t((()=>{A(),o(),d(),E(),y(),T(),P(),J(),G(),p(),C(),S(),D(),g(),w(),H(),X()}));export{ne as n,te as t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Cn as n,Rn as r,b as i,g as a,h as o,p as s,t as c,tn as l,x as u}from"./src-Di342QoJ.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Ac as f,Oo as p,Pc as m,Sc as h,jo as g}from"./paths-Q2255dD7.js";import{n as _,r as v}from"./analytics-DqMQntaB.js";import{Co as y,Dx as b,Lo as x,Ox as S,Tk as C,Xo as w,wk as T}from"./loadAgentsDir-Ci5mr0vm.js";import{tmpdir as E}from"os";import{join as D}from"path";import{mkdir as O,writeFile as k}from"fs/promises";function A(e){let t=T.lexer(w(e)),n=[];for(let e of t)if(e.type===`code`){let t=e;n.push({code:t.text,lang:t.lang})}return n}function j(e){let t=[];for(let n=e.length-1;n>=0&&t.length<V;n--){let r=e[n];if(r?.type!==`assistant`||r.isApiErrorMessage)continue;let i=r.message.content;if(!Array.isArray(i))continue;let a=y(i,`
|
|
2
|
+
|
|
3
|
+
`);a&&t.push(a)}return t}function M(e){if(e){let t=e.replace(/[^a-zA-Z0-9]/g,``);if(t&&t!==`plaintext`)return`.${t}`}return`.txt`}async function N(e,t){let n=D(z,t);return await O(z,{recursive:!0}),await k(n,e,`utf-8`),n}async function P(e,t){let n=await l(e);n&&process.stdout.write(n);let r=p(e,`
|
|
4
|
+
`)+1,i=e.length;try{return`Copied to clipboard (${i} characters, ${r} lines)\nAlso written to ${await N(e,t)}`}catch{return`Copied to clipboard (${i} characters, ${r} lines)`}}function F(e,t){let r=e.split(`
|
|
5
|
+
`)[0]??``;if(n(r)<=t)return r;let i=``,a=0,o=t-1;for(let e of r){let t=n(e);if(a+t>o)break;i+=e,a+=t}return i+`…`}function I({fullText:e,codeBlocks:t,messageAge:n,onDone:r}){let c=(0,L.useRef)(`full`),l=[{label:`Full response`,value:`full`,description:`${e.length} chars, ${p(e,`
|
|
6
|
+
`)+1} lines`},...t.map((e,t)=>{let n=p(e.code,`
|
|
7
|
+
`)+1;return{label:F(e.code,60),value:t,description:[e.lang,n>1?`${n} lines`:void 0].filter(Boolean).join(`, `)||void 0}}),{label:`Always copy full response`,value:`always`,description:`Skip this picker in the future (revert via /config)`}];function d(n){if(n===`full`||n===`always`)return{text:e,filename:B};let r=t[n];return{text:r.code,filename:`copy${M(r.lang)}`,blockIndex:n}}async function f(e){let i=d(e);if(e===`always`){h().copyFullResponse||m(e=>({...e,copyFullResponse:!0})),v(`tengu_copy`,{block_count:t.length,always:!0,message_age:n}),r(`${await P(i.text,i.filename)}\nPreference saved. Use /config to change copyFullResponse`);return}v(`tengu_copy`,{selected_block:i.blockIndex,block_count:t.length,message_age:n}),r(await P(i.text,i.filename))}async function g(e){let i=d(e);v(`tengu_copy`,{selected_block:i.blockIndex,block_count:t.length,message_age:n,write_shortcut:!0});try{r(`Written to ${await N(i.text,i.filename)}`)}catch(e){r(`Failed to write file: ${e instanceof Error?e.message:e}`)}}function _(e){e.key===`w`&&(e.preventDefault(),g(c.current))}return(0,R.jsx)(s,{children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:_,children:[(0,R.jsx)(i,{dimColor:!0,children:`Select content to copy:`}),(0,R.jsx)(b,{options:l,hideIndexes:!1,onFocus:e=>{c.current=e},onChange:e=>{f(e)},onCancel:()=>{r(`Copy cancelled`,{display:`system`})}}),(0,R.jsx)(i,{dimColor:!0,children:(0,R.jsxs)(o,{children:[(0,R.jsx)(a,{shortcut:`enter`,action:`copy`}),(0,R.jsx)(a,{shortcut:`w`,action:`write to file`}),(0,R.jsx)(a,{shortcut:`esc`,action:`cancel`})]})})]})})}var L,R,z,B,V,H;e((()=>{C(),L=t(r(),1),S(),c(),_(),f(),x(),g(),R=d(),z=D(E(),`claude`),B=`response.md`,V=20,H=async(e,t,n)=>{let r=j(t.messages);if(r.length===0)return e(`No assistant message to copy`),null;let i=0,a=n?.trim();if(a){let t=Number(a);if(!Number.isInteger(t)||t<1)return e(`Usage: /copy [N] where N is 1 (latest), 2, 3, \u2026 Got: ${a}`),null;if(t>r.length)return e(`Only ${r.length} assistant ${r.length===1?`message`:`messages`} available to copy`),null;i=t-1}let o=r[i],s=A(o),c=h();return s.length===0||c.copyFullResponse?(v(`tengu_copy`,{always:c.copyFullResponse,block_count:s.length,message_age:i}),e(await P(o,B)),null):(0,R.jsx)(I,{fullText:o,codeBlocks:s,messageAge:i,onDone:e})}}))();export{H as call,j as collectRecentAssistantTexts,M as fileExtension};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{Jt as n,on as r}from"./paths-Q2255dD7.js";import{E as i,T as a,d as o,s,w as c}from"./debug-UI3T040K.js";import{l,u}from"./oauth-CdZEzMww.js";import{i as d,t as f}from"./cliLaunch-BQa48gsr.js";import{resolve as p}from"path";import{existsSync as m,unlinkSync as h}from"fs";import{randomUUID as g}from"crypto";s(),c(),e();function _(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}var v=2e3,y=15e3,b=3,x=class{constructor(e,n){t(this,`proc`,void 0),t(this,`options`,void 0),t(this,`connected`,!1),t(this,`disconnected`,!1),t(this,`readLoopAbort`,null),t(this,`reconnectAttempt`,0),t(this,`maxReconnectAttempts`,void 0),t(this,`userInitiatedDisconnect`,!1),t(this,`reconnecting`,!1),this.proc=e,this.options=n,this.maxReconnectAttempts=n.maxReconnectAttempts??b}connect(){this.connected||(this.readLoopAbort=new AbortController,this.startReadLoop(),this.monitorExit(),this.connected=!0,this.options.onConnected())}async startReadLoop(){let e=this.proc.stdout;if(!e){this.options.onError(Error(`SSH process stdout is not available`));return}let t=e.getReader(),n=new TextDecoder,r=``;try{for(;!this.disconnected;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
|
|
2
|
+
`);r=a.pop()??``;for(let e of a){let t=e.trim();t&&this.processLine(t)}}}catch(e){this.disconnected||this.options.onError(e instanceof Error?e:Error(String(e)))}finally{t.releaseLock(),!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}}monitorExit(){if(this.proc.exitCode!==null){this.userInitiatedDisconnect||this.handleProcessExit();return}this.proc.exited.then(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}).catch(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()})}async handleProcessExit(){if(!(this.disconnected||this.reconnecting)){if(this.connected=!1,!this.options.reconnect){this.disconnected=!0,this.options.onDisconnected();return}if(this.reconnectAttempt>=this.maxReconnectAttempts){this.disconnected=!0,this.options.onDisconnected();return}this.reconnecting=!0;try{await this.attemptReconnect()}finally{this.reconnecting=!1}}}async attemptReconnect(){let e=this.options.reconnect;for(;this.reconnectAttempt<this.maxReconnectAttempts;){this.reconnectAttempt++,this.options.onReconnecting(this.reconnectAttempt,this.maxReconnectAttempts);let t=Math.min(v*2**(this.reconnectAttempt-1),y);if(await new Promise(e=>setTimeout(e,t)),this.userInitiatedDisconnect)return;try{this.proc=await e(),this.reconnectAttempt=0,this.connected=!0,this.startReadLoop(),this.monitorExit(),this.options.onConnected();return}catch(e){o(`[SSH] reconnect attempt ${this.reconnectAttempt} failed: ${e instanceof Error?e.message:String(e)}`)}}this.disconnected=!0,this.options.onDisconnected()}processLine(e){let t;try{t=a(e)}catch{return}if(!_(t))return;let n=t;if(n.type===`control_request`){let e=n;e.request.subtype===`can_use_tool`?this.options.onPermissionRequest(e.request,e.request_id):(o(`[SSH] Unsupported control request subtype: ${e.request.subtype}`),this.sendErrorResponse(e.request_id,`Unsupported control request subtype: ${e.request.subtype}`));return}n.type!==`control_response`&&n.type!==`keep_alive`&&n.type!==`control_cancel_request`&&n.type!==`streamlined_text`&&n.type!==`streamlined_tool_use_summary`&&!(n.type===`system`&&n.subtype===`post_turn_summary`)&&this.options.onMessage(n)}writeToStdin(e){try{let t=this.proc.stdin;if(!t||typeof t==`number`||this.disconnected)return!1;let n=new TextEncoder().encode(e+`
|
|
3
|
+
`);return t.write(n),t.flush?.(),!0}catch{return!1}}async sendMessage(e){let t=i({type:`user`,message:{role:`user`,content:e},parent_tool_use_id:null,session_id:``});return this.writeToStdin(t)}sendInterrupt(){let e=i({type:`control_request`,request_id:crypto.randomUUID(),request:{subtype:`interrupt`}});this.writeToStdin(e)}respondToPermissionRequest(e,t){let n=i({type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}});this.writeToStdin(n)}sendErrorResponse(e,t){let n=i({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}});this.writeToStdin(n)}disconnect(){if(!this.disconnected){this.userInitiatedDisconnect=!0,this.disconnected=!0,this.connected=!1,this.readLoopAbort?.abort();try{let e=this.proc.stdin;e&&typeof e!=`number`&&e.end?.()}catch{}try{this.proc.kill()}catch{}}}isConnected(){return this.connected&&!this.disconnected}};r(),u(),s();var S=process.platform===`win32`;function C(){let e=process.env.ANTHROPIC_API_KEY;if(e)return{"x-api-key":e};let t=n();return t?.accessToken?{Authorization:`Bearer ${t.accessToken}`}:{}}function w(){return process.env.ANTHROPIC_BASE_URL||l().BASE_API_URL}async function T(e,t){if(t&&e.headers.get(`x-auth-nonce`)!==t)return new Response(`Forbidden`,{status:403});let n=w(),r=new URL(e.url),i=`${n}${r.pathname}${r.search}`,a=C();if(Object.keys(a).length===0)return new Response(JSON.stringify({error:`No API credentials available on local machine`}),{status:401,headers:{"content-type":`application/json`}});let s=new Headers(e.headers);for(let[e,t]of Object.entries(a))s.set(e,t);s.delete(`host`),s.delete(`x-auth-nonce`),o(`[SSHAuthProxy] ${e.method} ${r.pathname} -> ${i}`);try{let t=await fetch(i,{method:e.method,headers:s,body:e.body,duplex:`half`}),n=new Headers(t.headers);return n.delete(`content-encoding`),n.delete(`content-length`),new Response(t.body,{status:t.status,statusText:t.statusText,headers:n})}catch(e){let t=e instanceof Error?e.message:String(e);return o(`[SSHAuthProxy] upstream error: ${t}`),new Response(JSON.stringify({error:`Proxy upstream error: ${t}`}),{status:502,headers:{"content-type":`application/json`}})}}async function E(){let e=g();return S?O(e):D(e)}async function D(e){let t=`/tmp/claude-ssh-auth-${e}.sock`,n=Bun.serve({unix:t,fetch:e=>T(e,null)});return o(`[SSHAuthProxy] listening on unix:${t}`),{proxy:{stop(){n.stop(!0);try{h(t)}catch{}}},localAddress:t,authEnv:{ANTHROPIC_AUTH_SOCKET:t}}}async function O(e){let t=g(),n=Bun.serve({port:0,hostname:`127.0.0.1`,fetch:e=>T(e,t)}),r=n.port;return o(`[SSHAuthProxy] listening on TCP 127.0.0.1:${r} (nonce-protected)`),{proxy:{stop(){n.stop(!0)}},localAddress:`127.0.0.1:${r}`,authEnv:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${r}`,ANTHROPIC_AUTH_NONCE:t}}}s();var k=15e3,A=class extends Error{constructor(e){super(e),this.name=`SSHProbeError`}};async function j(e,t){t?.(`Probing remote host…`);let n=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=10`,e,`CLAUDE_BIN=$(test -x "$HOME/.local/bin/claude" && echo "$HOME/.local/bin/claude" || command -v claude 2>/dev/null); echo "$CLAUDE_BIN"; $CLAUDE_BIN --version 2>/dev/null; uname -sm; pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`pipe`}),r=await Promise.race([n.exited,new Promise((e,t)=>setTimeout(()=>t(new A(`SSH probe timed out after ${k/1e3}s`)),k))]),i=await new Response(n.stdout).text(),a=await new Response(n.stderr).text();if(r!==0)throw new A(`SSH probe failed: ${a.trim()||`exit code ${r}`}`);let s=i.split(`
|
|
4
|
+
`).map(e=>e.trim()).filter(Boolean);o(`[SSHProbe] raw lines: ${JSON.stringify(s)}`);let c=s.findIndex(e=>/^(Linux|Darwin)\s/.test(e));if(c===-1)throw new A(`Could not detect remote platform (uname output missing)`);let l=c>=2&&s[c-2]||null,u=c>=1&&s[c-1]||null,d=u&&/^\d+\.\d+/.test(u)?u:null,f=l!==null&&l.startsWith(`/`),p=s[c+1]||`/`,[m,h]=s[c].split(/\s+/),g=m===`Darwin`?`darwin`:`linux`,_=h===`aarch64`||h===`arm64`?`arm64`:`x64`;return t?.(`Detected ${g}/${_}`),{hasBinary:f&&d!==null,remoteVersion:d,remotePlatform:g,remoteArch:_,defaultCwd:p,binaryPath:f?l:null}}s();var M=6e4,N=`~/.local/bin`,P=`claude-code-cli.js`,F=`claude`;async function I(e,t,n=M){let r=Bun.spawn([`ssh`,`-o`,`ConnectTimeout=10`,e,t],{stdout:`pipe`,stderr:`pipe`}),i=setTimeout(()=>r.kill(),n);try{let[e,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]),n=await r.exited;return{stdout:e.trim(),stderr:t.trim(),exitCode:n}}finally{clearTimeout(i)}}function L(){let e=p(import.meta.dir,`../..`),t=p(e,`dist/cli.js`);if(m(t))return t;let n=p(e,`src/entrypoints/cli.tsx`);if(m(n))return n;throw Error("Cannot find local CLI binary to deploy. Run `bun run build` first.")}async function R(e){let{host:t,remotePlatform:n,remoteArch:r,localVersion:i,onProgress:a}=e;if(n!==`linux`&&n!==`darwin`)throw Error(`Remote platform "${n}" is not supported. Only linux and darwin are supported.`);o(`[SSHDeploy] deploying to ${t} (${n}/${r}, v${i})`);let s=L();o(`[SSHDeploy] local binary: ${s}`),a?.(`Creating remote directory...`);let c=await I(t,`mkdir -p ${N}`);if(c.exitCode!==0)throw Error(`Failed to create remote directory: ${c.stderr}`);a?.(`Uploading binary...`);let l=`${N}/${P}`,u=Bun.spawn([`scp`,`-o`,`ConnectTimeout=10`,s,`${t}:${l}`],{stdout:`pipe`,stderr:`pipe`}),d=setTimeout(()=>u.kill(),M),f=await new Response(u.stderr).text(),p=await u.exited;if(clearTimeout(d),p!==0)throw Error(`SCP upload failed (exit ${p}): ${f.trim()}`);a?.(`Installing wrapper script...`);let m=await I(t,[`cat > ${N}/${F} << 'WRAPPER'`,`#!/bin/sh`,`exec bun ${N}/${P} "$@"`,`WRAPPER`,`chmod +x ${N}/${F}`].join(`
|
|
5
|
+
`));if(m.exitCode!==0)throw Error(`Failed to install wrapper script: ${m.stderr}`);a?.(`Verifying installation...`);let h=await I(t,`${N}/${F} --version`);if(h.exitCode!==0)throw Error(`Binary deployed but verification failed (exit ${h.exitCode}): ${h.stderr}`);return o(`[SSHDeploy] deployed successfully, remote version: ${h.stdout}`),a?.(`Deployed v${h.stdout}`),`${N}/${F}`}d(),s(),c();var z=3e4,B=20,V=class extends Error{constructor(e){super(e),this.name=`SSHSessionError`}};async function H(e,t){let{host:n,localVersion:r,extraCliArgs:i,remoteBin:a}=e,s=t?.onProgress,c,l=`/`;if(a){s?.(`Using custom remote binary, skipping probe/deploy…`),c=a,o(`[SSH] custom remoteBin: ${a}`);try{let e=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=5`,n,`pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`ignore`});await e.exited;let t=(await new Response(e.stdout).text()).trim();t.startsWith(`/`)&&(l=t)}catch{}}else{let e=await j(n,s);o(`[SSH] probe result: ${JSON.stringify(e)}`),l=e.defaultCwd,c=e.binaryPath??`~/.local/bin/claude`,(!e.hasBinary||e.remoteVersion!==r)&&(s?.(e.hasBinary?`Updating remote binary (${e.remoteVersion} → ${r})…`:`Deploying binary to remote…`),c=await R({host:n,remotePlatform:e.remotePlatform,remoteArch:e.remoteArch,localVersion:r,onProgress:s}))}let{proxy:u,localAddress:d,authEnv:f}=await E();o(`[SSH] auth proxy listening on ${d}`);let p=g().slice(0,8),m=process.platform===`win32`,h=[];for(let[e,t]of Object.entries(f))h.push(`${e}=${t}`);h.push(c,`--output-format`,`stream-json`,`--input-format`,`stream-json`,`--verbose`,`-p`),e.cwd&&h.push(`--cwd`,e.cwd),e.permissionMode&&h.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&h.push(`--dangerously-skip-permissions`),h.push(...i);let _=[`ssh`];if(m){let e=d.split(`:`)[1],t=1e4+Math.floor(Math.random()*5e4);_.push(`-R`,`${t}:127.0.0.1:${e}`);let n=h.findIndex(e=>e.startsWith(`ANTHROPIC_BASE_URL=`));n!==-1&&(h[n]=`ANTHROPIC_BASE_URL=http://127.0.0.1:${t}`)}else{let e=`/tmp/claude-ssh-auth-${p}.sock`;_.push(`-R`,`${e}:${d}`),_.push(`-o`,`StreamLocalBindUnlink=yes`);let t=h.indexOf(`ANTHROPIC_AUTH_SOCKET=${f.ANTHROPIC_AUTH_SOCKET}`);t!==-1&&(h[t]=`ANTHROPIC_AUTH_SOCKET=${e}`)}_.push(n,h.join(` `)),s?.(`Starting remote session…`),o(`[SSH] spawning: ${_.join(` `)}`);let v;try{v=Bun.spawn(_,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`})}catch(e){throw u.stop(),new V(`Failed to spawn SSH process: ${e instanceof Error?e.message:String(e)}`)}let y=[];G(v,y);let b;if(a){let t=await Promise.race([v.exited.then(e=>e),new Promise(e=>setTimeout(()=>e(null),3e3))]);if(t!==null){u.stop();let e=y.join(``).trim();throw new V(`Remote process exited immediately (code ${t})${e?`: ${e}`:``}`)}b=e.cwd||l||`/`}else try{b=await W(v,e.cwd||l)}catch(e){throw u.stop(),v.kill(),e}o(`[SSH] remote session initialized, remoteCwd=${b}`);let S=v,C=async()=>{o(`[SSH] reconnect: re-spawning SSH process with --continue`);let e=[..._],t=e.length-1,n=e[t];n.includes(`--continue`)||(e[t]=n.replace(/ -p(?:\s|$)/,` -p --continue `));let r=Bun.spawn(e,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`}),i=[];return G(r,i),await W(r,b),S=r,y.length=0,y.push(...i),r};return{remoteCwd:b,get proc(){return S},proxy:u,createManager(e){return new x(S,{...e,reconnect:C})},getStderrTail(){return y.slice(-B).join(``)}}}async function U(e){let{proxy:t,authEnv:n}=await E(),r=[`--output-format`,`stream-json`,`--input-format`,`stream-json`,`-p`];e.cwd&&r.push(`--cwd`,e.cwd),e.permissionMode&&r.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&r.push(`--dangerously-skip-permissions`);let i=f(r),a;try{a=Bun.spawn([i.execPath,...i.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...i.env,...n}})}catch(e){throw t.stop(),new V(`Failed to spawn local CLI process: ${e instanceof Error?e.message:String(e)}`)}o(`[SSH] local session spawned, waiting for init message...`);let s=[];G(a,s);let c;try{c=await W(a,e.cwd)}catch(e){throw t.stop(),a.kill(),e}o(`[SSH] local session initialized, remoteCwd=${c}`);let l=a,u=async()=>{o(`[SSH] local reconnect: re-spawning CLI with --continue`);let e=[...r];e.includes(`--continue`)||e.push(`--continue`);let t=f(e),i=Bun.spawn([t.execPath,...t.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...t.env,...n}}),a=[];return G(i,a),await W(i,c),l=i,s.length=0,s.push(...a),i};return{remoteCwd:c,get proc(){return l},proxy:t,createManager(e){return new x(l,{...e,reconnect:u})},getStderrTail(){return s.slice(-B).join(``)}}}async function W(e,t){let n=e.stdout;if(!n)throw new V(`Child process stdout is not readable`);let r=n.getReader(),i=new TextDecoder,o=``,s=Date.now()+z;try{for(;Date.now()<s;){let e=s-Date.now(),n=await Promise.race([r.read(),new Promise((t,n)=>setTimeout(()=>n(new V(`Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.`)),e))]);if(n.done)throw new V(`Child process exited before sending init message`);o+=i.decode(n.value,{stream:!0});let c=o.split(`
|
|
6
|
+
`);o=c.pop()??``;for(let e of c){let n=e.trim();if(n)try{let e=a(n);if(e.type===`system`&&e.subtype===`init`)return r.releaseLock(),e.cwd||t||process.cwd()}catch{}}}}catch(e){throw r.releaseLock(),e instanceof V?e:new V(`Error reading init message: ${e instanceof Error?e.message:String(e)}`)}throw r.releaseLock(),new V(`Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.`)}function G(e,t){let n=e.stderr;if(!n)return;let r=n.getReader(),i=new TextDecoder;(async()=>{try{for(;;){let{done:e,value:n}=await r.read();if(e)break;t.push(i.decode(n,{stream:!0})),t.length>B*2&&t.splice(0,t.length-B)}}catch{}})()}export{V as SSHSessionError,U as createLocalSSHSession,H as createSSHSession};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r}from"./createSession-CJEsHz58.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{L as t,V as n,d as r,s as i}from"./debug-UI3T040K.js";import{c as a,d as o,i as s,o as c}from"./debugUtils-BBMFODKH.js";async function l({environmentId:e,title:n,events:i,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-CqURlg4d.js`),{getOrganizationUUID:p}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:m}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:h}=await import(`./api-Dz_3z1kl.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DCTvg4p0.js`),{getDefaultBranch:_}=await import(`./git-D23Mzu_K.js`),{getMainLoopModel:v}=await import(`./model-DdbcxKub.js`),{default:y}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-CNbOKpAg.js`),x=u?.()??f()?.accessToken;if(!x)return r(`[bridge] No access token for session creation`),null;let S=b()?`self-hosted`:await p();if(!S)return r(`[bridge] No org UUID for session creation`),null;let C=null,w=null;if(a){let{parseGitRemote:e}=await import(`./detectRepository-DCTvg4p0.js`),t=e(a);if(t){let{host:e,owner:n,name:r}=t,i=o||await _()||void 0;C={type:`git_repository`,url:`https://${e}/${n}/${r}`,revision:i},w={type:`git_repository`,git_info:{type:`github`,repo:`${n}/${r}`,branches:[`claude/${o||`task`}`]}}}else{let e=g(a);if(e){let[t,n]=e.split(`/`);if(t&&n){let e=o||await _()||void 0;C={type:`git_repository`,url:`https://github.com/${t}/${n}`,revision:e},w={type:`git_repository`,git_info:{type:`github`,repo:`${t}/${n}`,branches:[`claude/${o||`task`}`]}}}}}}let T={...n!==void 0&&{title:n},events:i,session_context:{sources:C?[C]:[],outcomes:w?[w]:[],model:v()},environment_id:e,source:`remote-control`,...d&&{permission_mode:d}},E={...h(x),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":S},D=`${l??m().BASE_API_URL}/v1/sessions`,O;try{O=await y.post(D,T,{headers:E,signal:c,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session creation request failed: ${t(e)}`),null}if(!(O.status===200||O.status===201)){let e=s(O.data);return r(`[bridge] Session creation failed with status ${O.status}${e?`: ${e}`:``}`),null}let k=O.data;return!k||typeof k!=`object`||!(`id`in k)||typeof k.id!=`string`?(r(`[bridge] No session ID in response`),null):k.id}async function u(e,n){let{getClaudeAIOAuthTokens:i}=await import(`./auth-CqURlg4d.js`),{getOrganizationUUID:a}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:o}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:c}=await import(`./api-Dz_3z1kl.js`),{default:l}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-CNbOKpAg.js`),d=n?.getAccessToken?.()??i()?.accessToken;if(!d)return r(`[bridge] No access token for session fetch`),null;let f=u()?`self-hosted`:await a();if(!f)return r(`[bridge] No org UUID for session fetch`),null;let p={...c(d),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":f},m=`${n?.baseUrl??o().BASE_API_URL}/v1/sessions/${e}`;r(`[bridge] Fetching session ${e}`);let h;try{h=await l.get(m,{headers:p,timeout:1e4,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session fetch request failed: ${t(e)}`),null}if(h.status!==200){let e=s(h.data);return r(`[bridge] Session fetch failed with status ${h.status}${e?`: ${e}`:``}`),null}return h.data}async function d(e,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-CqURlg4d.js`),{getOrganizationUUID:i}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:a}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:o}=await import(`./api-Dz_3z1kl.js`),{default:c}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-CNbOKpAg.js`),u=t?.getAccessToken?.()??n()?.accessToken;if(!u){r(`[bridge] No access token for session archive`);return}let d=l()?`self-hosted`:await i();if(!d){r(`[bridge] No org UUID for session archive`);return}let f={...o(u),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":d},p=`${t?.baseUrl??a().BASE_API_URL}/v1/sessions/${e}/archive`;r(`[bridge] Archiving session ${e}`);let m=await c.post(p,{},{headers:f,timeout:t?.timeoutMs??1e4,validateStatus:e=>e<500});if(m.status===200)r(`[bridge] Session ${e} archived successfully`);else{let e=s(m.data);r(`[bridge] Session archive failed with status ${m.status}${e?`: ${e}`:``}`)}}async function f(e,n,i){let{getClaudeAIOAuthTokens:a}=await import(`./auth-CqURlg4d.js`),{getOrganizationUUID:c}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:l}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:u}=await import(`./api-Dz_3z1kl.js`),{default:d}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-CNbOKpAg.js`),p=i?.getAccessToken?.()??a()?.accessToken;if(!p){r(`[bridge] No access token for session title update`);return}let m=f()?`self-hosted`:await c();if(!m){r(`[bridge] No org UUID for session title update`);return}let h={...u(p),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":m},g=o(e),_=`${i?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${n}`);try{let e=await d.patch(_,{title:n},{headers:h,timeout:1e4,validateStatus:e=>e<500});if(e.status===200)r(`[bridge] Session title updated successfully`);else{let t=s(e.data);r(`[bridge] Session title update failed with status ${e.status}${t?`: ${t}`:``}`)}}catch(e){r(`[bridge] Session title update request failed: ${t(e)}`)}}var p=e((()=>{i(),n(),c(),a()}));export{f as a,p as i,l as n,u as r,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";function t(e,t){let{min:n,max:r}=t,i=new Set;for(let t of e.split(`,`)){let e=t.match(/^\*(?:\/(\d+))?$/);if(e){let t=e[1]?parseInt(e[1],10):1;if(t<1)return null;for(let e=n;e<=r;e+=t)i.add(e);continue}let a=t.match(/^(\d+)-(\d+)(?:\/(\d+))?$/);if(a){let e=parseInt(a[1],10),t=parseInt(a[2],10),o=a[3]?parseInt(a[3],10):1,s=n===0&&r===6;if(e>t||o<1||e<n||t>(s?7:r))return null;for(let n=e;n<=t;n+=o)i.add(s&&n===7?0:n);continue}if(t.match(/^\d+$/)){let e=parseInt(t,10);if(n===0&&r===6&&e===7&&(e=0),e<n||e>r)return null;i.add(e);continue}return null}return i.size===0?null:Array.from(i).sort((e,t)=>e-t)}function n(e){let n=e.trim().split(/\s+/);if(n.length!==5)return null;let r=[];for(let e=0;e<5;e++){let i=t(n[e],s[e]);if(!i)return null;r.push(i)}return{minute:r[0],hour:r[1],dayOfMonth:r[2],month:r[3],dayOfWeek:r[4]}}function r(e,t){let n=new Set(e.minute),r=new Set(e.hour),i=new Set(e.dayOfMonth),a=new Set(e.month),o=new Set(e.dayOfWeek),s=e.dayOfMonth.length===31,c=e.dayOfWeek.length===7,l=new Date(t.getTime());l.setSeconds(0,0),l.setMinutes(l.getMinutes()+1);for(let e=0;e<527040;e++){let e=l.getMonth()+1;if(!a.has(e)){l.setMonth(l.getMonth()+1,1),l.setHours(0,0,0,0);continue}let t=l.getDate(),u=l.getDay();if(!(s&&c||(s?o.has(u):c?i.has(t):i.has(t)||o.has(u)))){l.setDate(l.getDate()+1),l.setHours(0,0,0,0);continue}if(!r.has(l.getHours())){l.setHours(l.getHours()+1,0,0,0);continue}if(!n.has(l.getMinutes())){l.setMinutes(l.getMinutes()+1);continue}return l}return null}function i(e,t){return new Date(2e3,0,1,t,e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`})}function a(e,t){let n=new Date;return n.setUTCHours(t,e,0,0),n.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`,timeZoneName:`short`})}function o(e,t){let n=t?.utc??!1,r=e.trim().split(/\s+/);if(r.length!==5)return e;let[o,s,l,u,d]=r,f=o.match(/^\*\/(\d+)$/);if(f&&s===`*`&&l===`*`&&u===`*`&&d===`*`){let e=parseInt(f[1],10);return e===1?`Every minute`:`Every ${e} minutes`}if(o.match(/^\d+$/)&&s===`*`&&l===`*`&&u===`*`&&d===`*`){let e=parseInt(o,10);return e===0?`Every hour`:`Every hour at :${e.toString().padStart(2,`0`)}`}let p=s.match(/^\*\/(\d+)$/);if(o.match(/^\d+$/)&&p&&l===`*`&&u===`*`&&d===`*`){let e=parseInt(p[1],10),t=parseInt(o,10),n=t===0?``:` at :${t.toString().padStart(2,`0`)}`;return e===1?`Every hour${n}`:`Every ${e} hours${n}`}if(!o.match(/^\d+$/)||!s.match(/^\d+$/))return e;let m=parseInt(o,10),h=parseInt(s,10),g=n?a:i;if(l===`*`&&u===`*`&&d===`*`)return`Every day at ${g(m,h)}`;if(l===`*`&&u===`*`&&d.match(/^\d$/)){let e=parseInt(d,10)%7,t;if(n){let n=new Date,r=(e-n.getUTCDay()+7)%7;n.setUTCDate(n.getUTCDate()+r),n.setUTCHours(h,m,0,0),t=c[n.getDay()]}else t=c[e];if(t)return`Every ${t} at ${g(m,h)}`}return l===`*`&&u===`*`&&d===`1-5`?`Weekdays at ${g(m,h)}`:e}var s,c,l=e((()=>{s=[{min:0,max:59},{min:0,max:23},{min:1,max:31},{min:1,max:12},{min:0,max:6}],c=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]}));export{n as i,o as n,l as r,r as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./defineProperty-80gRi2ZW.js";import{Cn as i,Ln as a,Mn as o,Tt as s,Xn as c,Yn as l,kt as u,ln as d,un as f,vt as p,wn as m,wt as h}from"./schemas-BGAvj1T4.js";import{n as g,t as _}from"./v4-f1i_CNUT.js";import{Ct as v,St as ee,cn as y,gr as te,gt as b,ot as x,ut as S,vn as ne}from"./state-sIHsFpDu.js";import{Fl as C,Il as re,S as w,Ss as ie,al as ae,el as oe,v as se,xs as ce}from"./paths-Q2255dD7.js";import{E as T,L as le,R as ue,T as de,V as E,X as fe,Y as pe,d as D,k as me,s as O,w as k}from"./debug-UI3T040K.js";import{n as he,r as A}from"./analytics-DqMQntaB.js";import{n as ge,o as _e}from"./process-DMKLUQIO.js";import{F as ve,P as ye,n as be,v as xe}from"./git-CN3qtTb_.js";import{o as Se,s as j}from"./log-CzsijfHZ.js";import{s as Ce,u as we}from"./types-Csi32ZXh.js";import{n as M,t as N}from"./lazySchema-2sOku3cX.js";import{a as Te,i as Ee}from"./genericProcessUtils-BGvcwuPt.js";import{En as De,Fs as Oe,G as ke,Hs as Ae,K as je,Ls as Me,ND as Ne,NO as Pe,PD as Fe,PO as Ie,Sg as Le,Tn as Re,Ut as ze,Vs as Be,_g as Ve,ag as He,bg as Ue,cg as We,cu as Ge,dg as Ke,fg as P,gg as qe,hg as Je,iD as F,lg as Ye,lu as Xe,mg as Ze,nf as Qe,oD as I,og as $e,pg as et,sg as L,tD as R,tf as tt,ug as nt,vg as rt,xg as it,yg as at,yn as ot}from"./loadAgentsDir-Ci5mr0vm.js";import{B as z,H as st,I as B,J as ct,K as lt,R as ut,V as dt,W as ft,q as pt,z as mt}from"./prompt-DEPUnJdB.js";import{n as ht,r as gt}from"./cron-DiW7eIPP.js";import{d as _t,h as vt}from"./rcDebugLog-BbPkkigY.js";import{t as yt}from"./controlMessageCompat-BJhFiS7u.js";import{dirname as bt,isAbsolute as xt,join as St,resolve as Ct}from"path";import{randomUUID as V}from"crypto";import{mkdir as wt,readFile as Tt,unlink as Et,writeFile as H}from"fs/promises";_(),N(),Le();var Dt=M(()=>c()),Ot=M(()=>m({matcher:a().optional(),hookCallbackIds:s(a()),timeout:i().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),kt=M(()=>m({subtype:f(`initialize`),hooks:o(Ye(),s(Ot())).optional(),sdkMcpServers:s(a()).optional(),jsonSchema:o(a(),c()).optional(),systemPrompt:a().optional(),appendSystemPrompt:a().optional(),agents:o(a(),$e()).optional(),promptSuggestions:u().optional(),agentProgressSummaries:u().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));M(()=>m({commands:s(it()),agents:s(L()),output_style:a(),available_output_styles:s(a()),models:s(et()),account:He(),pid:i().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:We().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var At=M(()=>m({subtype:f(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),jt=M(()=>m({subtype:f(`can_use_tool`),tool_name:a(),input:o(a(),c()),permission_suggestions:s(Je()).optional(),blocked_path:a().optional(),decision_reason:a().optional(),title:a().optional(),display_name:a().optional(),tool_use_id:a(),agent_id:a().optional(),description:a().optional()}).describe(`Requests permission to use a tool with the given input.`)),Mt=M(()=>m({subtype:f(`set_permission_mode`),mode:Ze(),ultraplan:u().optional().describe(`@internal CCR ultraplan session marker.`)}).describe(`Sets the permission mode for tool execution handling.`)),Nt=M(()=>m({subtype:f(`set_model`),model:a().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Pt=M(()=>m({subtype:f(`set_max_thinking_tokens`),max_thinking_tokens:i().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),Ft=M(()=>m({subtype:f(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));M(()=>m({mcpServers:s(P())}).describe(`Response containing the current status of all MCP server connections.`));var It=M(()=>m({subtype:f(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Lt=M(()=>m({name:a(),tokens:i(),color:a(),isDeferred:u().optional()})),Rt=M(()=>m({color:a(),isFilled:u(),categoryName:a(),tokens:i(),percentage:i(),squareFullness:i()}));M(()=>m({categories:s(Lt()),totalTokens:i(),maxTokens:i(),rawMaxTokens:i(),percentage:i(),gridRows:s(s(Rt())),model:a(),memoryFiles:s(m({path:a(),type:a(),tokens:i()})),mcpTools:s(m({name:a(),serverName:a(),tokens:i(),isLoaded:u().optional()})),deferredBuiltinTools:s(m({name:a(),tokens:i(),isLoaded:u()})).optional(),systemTools:s(m({name:a(),tokens:i()})).optional(),systemPromptSections:s(m({name:a(),tokens:i()})).optional(),agents:s(m({agentType:a(),source:a(),tokens:i()})),slashCommands:m({totalCommands:i(),includedCommands:i(),tokens:i()}).optional(),skills:m({totalSkills:i(),includedSkills:i(),tokens:i(),skillFrontmatter:s(m({name:a(),source:a(),tokens:i()}))}).optional(),autoCompactThreshold:i().optional(),isAutoCompactEnabled:u(),messageBreakdown:m({toolCallTokens:i(),toolResultTokens:i(),attachmentTokens:i(),assistantMessageTokens:i(),userMessageTokens:i(),toolCallsByType:s(m({name:a(),callTokens:i(),resultTokens:i()})),attachmentsByType:s(m({name:a(),tokens:i()}))}).optional(),apiUsage:m({input_tokens:i(),output_tokens:i(),cache_creation_input_tokens:i(),cache_read_input_tokens:i()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var zt=M(()=>m({subtype:f(`rewind_files`),user_message_id:a(),dry_run:u().optional()}).describe(`Rewinds file changes made since a specific user message.`));M(()=>m({canRewind:u(),error:a().optional(),filesChanged:s(a()).optional(),insertions:i().optional(),deletions:i().optional()}).describe(`Result of a rewindFiles operation.`));var Bt=M(()=>m({subtype:f(`cancel_async_message`),message_uuid:a()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));M(()=>m({cancelled:u()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var Vt=M(()=>m({subtype:f(`seed_read_state`),path:a(),mtime:i()}).describe(`Seeds the readFileState cache with a path+mtime entry. Use when a prior Read was removed from context (e.g. by snip) so Edit validation would fail despite the client having observed the Read. The mtime lets the CLI detect if the file changed since the seeded Read — same staleness check as the normal path.`)),Ht=M(()=>m({subtype:f(`hook_callback`),callback_id:a(),input:nt(),tool_use_id:a().optional()}).describe(`Delivers a hook callback with its input data.`)),Ut=M(()=>m({subtype:f(`mcp_message`),server_name:a(),message:Dt()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),Wt=M(()=>m({subtype:f(`mcp_set_servers`),servers:o(a(),Ke())}).describe(`Replaces the set of dynamically managed MCP servers.`));M(()=>m({added:s(a()),removed:s(a()),errors:o(a(),a())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var Gt=M(()=>m({subtype:f(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));M(()=>m({commands:s(it()),agents:s(L()),plugins:s(m({name:a(),path:a(),source:a().optional()})),mcpServers:s(P()),error_count:i()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var Kt=M(()=>m({subtype:f(`mcp_reconnect`),serverName:a()}).describe(`Reconnects a disconnected or failed MCP server.`)),qt=M(()=>m({subtype:f(`mcp_toggle`),serverName:a(),enabled:u()}).describe(`Enables or disables an MCP server.`)),Jt=M(()=>m({subtype:f(`stop_task`),task_id:a()}).describe(`Stops a running task.`)),Yt=M(()=>m({subtype:f(`apply_flag_settings`),settings:o(a(),c())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),Xt=M(()=>m({subtype:f(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));M(()=>m({effective:o(a(),c()),sources:s(m({source:p([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:o(a(),c())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:m({model:a(),effort:p([`low`,`medium`,`high`,`xhigh`,`max`]).nullable()}).optional().describe("Runtime-resolved values after env overrides, session state, and model-specific defaults are applied. Unlike `effective` (disk merge), these reflect what will actually be sent to the API.")}).describe(`Effective merged settings plus raw per-source settings in merge order.`));var Zt=M(()=>m({subtype:f(`elicitation`),mcp_server_name:a(),message:a(),mode:p([`form`,`url`]).optional(),url:a().optional(),elicitation_id:a().optional(),requested_schema:o(a(),c()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),Qt=M(()=>m({action:p([`accept`,`decline`,`cancel`]),content:o(a(),c()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),$t=M(()=>l([At(),jt(),kt(),Mt(),Nt(),Pt(),Ft(),It(),Ht(),Ut(),zt(),Bt(),Vt(),Wt(),Gt(),Kt(),qt(),Jt(),Yt(),Xt(),Zt()])),U=M(()=>m({type:f(`control_request`),request_id:a(),request:$t()})),en=M(()=>m({subtype:f(`success`),request_id:a(),response:o(a(),c()).optional()})),tn=M(()=>m({subtype:f(`error`),request_id:a(),error:a(),pending_permission_requests:s(d(()=>U())).optional()})),nn=M(()=>m({type:f(`control_response`),response:l([en(),tn()])})),rn=M(()=>m({type:f(`control_cancel_request`),request_id:a()}).describe(`Cancels a currently open control request.`)),an=M(()=>m({type:f(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),on=M(()=>m({type:f(`update_environment_variables`),variables:o(a(),a())}).describe(`Updates environment variables at runtime.`));M(()=>l([qe(),rt(),at(),Ve(),nn(),U(),rn(),an()])),M(()=>l([Ue(),U(),nn(),an(),on()])),n(),y(),pe(),E(),k(),ge(),ye(),De(),_(),O(),N(),F(),tt(),M(()=>g.object({tool_name:g.string().describe(`The name of the tool requesting permission`),input:g.record(g.string(),g.unknown()).describe(`The input for the tool`),tool_use_id:g.string().optional().describe(`The unique tool use request ID`)}));var sn=M(()=>g.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),cn=M(()=>g.object({behavior:g.literal(`allow`),updatedInput:g.record(g.string(),g.unknown()),updatedPermissions:g.array(Qe()).optional().catch(e=>{D(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:g.string().optional(),decisionClassification:sn()})),ln=M(()=>g.object({behavior:g.literal(`deny`),message:g.string(),interrupt:g.boolean().optional(),toolUseID:g.string().optional(),decisionClassification:sn()})),W=M(()=>g.union([cn(),ln()]));function G(e,t,n,r){let i={type:`permissionPromptTool`,permissionPromptToolName:t.name,toolResult:e};if(e.behavior===`allow`){let t=e.updatedPermissions;t&&(r.setAppState(e=>({...e,toolPermissionContext:R(e.toolPermissionContext,t)})),I(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(D(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}he(),Se(),oe(),ce(),w(),Ne(),_t(),Xe(),ot(),je();var un=/\u2028|\u2029/g;function dn(e){return e.replace(un,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function fn(e){return dn(T(e))}O(),k(),_(),F();var pn=`SandboxNetworkAccess`;function mn(e){if(e){if(e.type===`classifier`)return e.reason;switch(e.type){case`rule`:case`mode`:case`subcommandResults`:case`permissionPromptTool`:return;case`hook`:case`asyncAgent`:case`sandboxOverride`:case`workingDir`:case`safetyCheck`:case`other`:return e.reason}}}function hn(e,t,n,r){let i;try{i=e.getActivityDescription?.(t)??e.getToolUseSummary?.(t)??e.userFacingName(t)}catch{i=e.name}return{tool_name:e.name,action_description:i,tool_use_id:n,request_id:r,input:t}}var gn=1e3,_n=class{constructor(e,t){r(this,`structuredInput`,void 0),r(this,`pendingRequests`,new Map),r(this,`restoredWorkerState`,Promise.resolve(null)),r(this,`inputClosed`,!1),r(this,`unexpectedResponseCallback`,void 0),r(this,`resolvedToolUseIds`,new Set),r(this,`prependedLines`,[]),r(this,`onControlRequestSent`,void 0),r(this,`onControlRequestResolved`,void 0),r(this,`outbound`,new Ge),this.input=e,this.replayUserMessages=t,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>gn)){let e=this.resolvedToolUseIds.values().next().value;e!==void 0&&this.resolvedToolUseIds.delete(e)}}flushInternalEvents(){return Promise.resolve()}get internalEventsPending(){return 0}prependUserMessage(e){this.prependedLines.push(T({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})+`
|
|
2
|
+
`)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
|
|
3
|
+
`);if(t===-1)break;let n=e.slice(0,t);e=e.slice(t+1);let r=await this.processLine(n);r&&(ve(`info`,`cli_stdin_message_parsed`,{type:r.type}),yield r)}}.bind(this);yield*t();for await(let n of this.input)e+=n,yield*t();if(e){let t=await this.processLine(e);t&&(yield t)}this.inputClosed=!0;for(let e of this.pendingRequests.values())e.reject(Error(`Tool permission stream closed before response received`))}getPendingPermissionRequests(){return Array.from(this.pendingRequests.values()).map(e=>e.request).filter(e=>e.request.subtype===`can_use_tool`)}setUnexpectedResponseCallback(e){this.unexpectedResponseCallback=e}injectControlResponse(e){let t=e.response,n=t?.request_id;if(!n)return;let r=this.pendingRequests.get(n);if(r)if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n),this.write({type:`control_cancel_request`,request_id:n}),t.subtype===`error`)r.reject(Error(t.error));else{let e=t.response;if(r.schema)try{r.resolve(r.schema.parse(e))}catch(e){r.reject(e)}else r.resolve({})}}setOnControlRequestSent(e){this.onControlRequestSent=e}setOnControlRequestResolved(e){this.onControlRequestResolved=e}async processLine(e){if(e)try{let t=yt(de(e));if(t.type===`keep_alive`)return;if(t.type===`update_environment_variables`){let e=t.variables??{},n=Object.keys(e);for(let[t,n]of Object.entries(e))process.env[t]=n;D(`[structuredIO] applied update_environment_variables: ${n.join(`, `)}`);return}if(t.type===`control_response`){let e=`uuid`in t&&typeof t.uuid==`string`?t.uuid:void 0;e&&Fe(e,`completed`);let n=t.response,r=this.pendingRequests.get(n.request_id);if(!r){let e=(n.subtype===`success`?n.response:void 0)?.toolUseID;if(typeof e==`string`&&this.resolvedToolUseIds.has(e)){D(`Ignoring duplicate control_response for already-resolved toolUseID=${e} request_id=${n.request_id}`);return}this.unexpectedResponseCallback&&await this.unexpectedResponseCallback(t);return}if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n.request_id),r.request.request.subtype===`can_use_tool`&&this.onControlRequestResolved&&this.onControlRequestResolved(n.request_id),n.subtype===`error`){r.reject(Error(n.error??`Unknown error`));return}let i=n.response;if(r.schema)try{r.resolve(r.schema.parse(i))}catch(e){r.reject(e)}else r.resolve({});return this.replayUserMessages?t:void 0}if(t.type!==`user`&&t.type!==`control_request`&&t.type!==`assistant`&&t.type!==`system`){D(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||vn(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&vn(`Error: Expected message role 'user', got '${t.message?.role}'`),t)}catch(t){console.error(`Error parsing streaming input line: ${e}: ${t}`),process.exit(1)}}async write(e){_e(fn(e)+`
|
|
4
|
+
`)}async sendRequest(e,t,n,r=V()){let i={type:`control_request`,request_id:r,request:e};if(this.inputClosed)throw Error(`Stream closed`);if(n?.aborted)throw Error(`Request aborted`);this.outbound.enqueue(i),e.subtype===`can_use_tool`&&this.onControlRequestSent&&this.onControlRequestSent(i);let a=()=>{this.outbound.enqueue({type:`control_cancel_request`,request_id:r});let e=this.pendingRequests.get(r);e&&(this.trackResolvedToolUseId(e.request),e.reject(new me))};n&&n.addEventListener(`abort`,a,{once:!0});try{return await new Promise((n,i)=>{this.pendingRequests.set(r,{request:{type:`control_request`,request_id:r,request:e},resolve:e=>{n(e)},reject:i,schema:t})})}finally{n&&n.removeEventListener(`abort`,a),this.pendingRequests.delete(r)}}createCanUseTool(e){return async(t,n,r,i,a,o)=>{let s=o??await ke(t,n,r,i,a);if(s.behavior===`allow`||s.behavior===`deny`)return s;let c=new AbortController,l=r.abortController.signal,u=()=>c.abort();l.addEventListener(`abort`,u,{once:!0});try{let i=yn(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=V();e?.(hn(t,n,a,o));let l=this.sendRequest({subtype:`can_use_tool`,tool_name:t.name,input:n,permission_suggestions:s.suggestions,blocked_path:s.blockedPath,decision_reason:mn(s.decisionReason),tool_use_id:a,agent_id:r.agentId},W(),c.signal,o).then(e=>({source:`sdk`,result:e})),u=await Promise.race([i,l]);return u.source===`hook`?u.decision?(l.catch(()=>{}),c.abort(),u.decision):G((await l).result,t,n,r):G(u.result,t,n,r)}catch(e){return G({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&vt(`running`),l.removeEventListener(`abort`,u)}}}createHookCallback(e,t){return{type:`callback`,timeout:t,callback:async(t,n,r)=>{try{return await this.sendRequest({subtype:`hook_callback`,callback_id:e,input:t,tool_use_id:n||void 0},Re(),r)}catch(t){return console.error(`Error in hook callback ${e}:`,t),{}}}}}async handleElicitation(e,t,n,r,i,a,o){try{return await this.sendRequest({subtype:`elicitation`,mcp_server_name:e,message:t,mode:i,url:a,elicitation_id:o,requested_schema:n},Qt(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:pn,input:{host:e.host},tool_use_id:V(),description:`Allow network connection to ${e.host}?`},W())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},m({mcp_response:h()}))).mcp_response}};function vn(e){console.error(e),process.exit(1)}async function yn(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=ze(e,t,n,r,a,i,r.abortController.signal);for await(let e of o)if(e.permissionRequestResult&&(e.permissionRequestResult.behavior===`allow`||e.permissionRequestResult.behavior===`deny`)){let t=e.permissionRequestResult;if(t.behavior===`allow`){let e=t.updatedInput||n,i=t.updatedPermissions??[];if(i.length>0){I(i);let e=R(r.getAppState().toolPermissionContext,i);r.setAppState(t=>t.toolPermissionContext===e?t:{...t,toolPermissionContext:e})}return{behavior:`allow`,updatedInput:e,userModified:!1,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}else return{behavior:`deny`,message:t.message||`Permission denied by PermissionRequest hook`,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}}Ie();function bn(e){if(e.type!==`user`)return;let t=e.message?.content;if(!t||Array.isArray(t)&&t.length===0)return;let n=`uuid`in e&&typeof e.uuid==`string`?e.uuid:void 0;return{content:Array.isArray(t)?xn(t):t,uuid:n}}function xn(e){return e.some(Sn)?e.map(e=>{if(!Sn(e))return e;let t=e.source,n=typeof t.mediaType==`string`&&t.mediaType?t.mediaType:Pe(e.source.data);return{...e,source:{type:`base64`,media_type:n,data:e.source.data}}}):e}function Sn(e){return e.type!==`image`||e.source?.type!==`base64`?!1:!e.source.media_type}C(),O(),E(),xe(),Be();function Cn(e,t,n){let r=[],i=[],a=[];for(let[o,s]of Object.entries(e)){let e=t[o],c=Tn(s.source,n?.projectRoot);e?s.sourceIsFallback||re(c,e.source)?a.push(o):i.push({name:o,declaredSource:c,materializedSource:e.source}):r.push(o)}return{missing:r,sourceChanged:i,upToDate:a}}async function wn(e){let t=Me();if(Object.keys(t).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let n;try{n=await Ae()}catch(e){j(e),n={}}let r=Cn(t,n,{projectRoot:x()}),i=[...r.missing.map(e=>({name:e,source:Tn(t[e].source),action:`install`})),...r.sourceChanged.map(({name:e,declaredSource:t})=>({name:e,source:t,action:`update`}))],a=[],o=[];for(let t of i){if(e?.skip?.(t.name,t.source)){a.push(t.name);continue}if(t.action===`update`&&ie(t.source)&&!await ae(t.source.path)){D(`[reconcile] '${t.name}' declared path does not exist; keeping materialized entry`),a.push(t.name);continue}o.push(t)}if(o.length===0)return{installed:[],updated:[],failed:[],upToDate:r.upToDate,skipped:a};D(`[reconcile] ${o.length} marketplace(s): ${o.map(e=>`${e.name}(${e.action})`).join(`, `)}`);let s=[],c=[],l=[];for(let t=0;t<o.length;t++){let{name:n,source:r,action:i}=o[t];e?.onProgress?.({type:`installing`,name:n,action:i,index:t+1,total:o.length});try{let t=await Oe(r);i===`install`?s.push(n):c.push(n),e?.onProgress?.({type:`installed`,name:n,alreadyMaterialized:t.alreadyMaterialized})}catch(t){let r=le(t);l.push({name:n,error:r}),e?.onProgress?.({type:`failed`,name:n,error:r}),j(t)}}return{installed:s,updated:c,failed:l,upToDate:r.upToDate,skipped:a}}function Tn(e,t){if((e.source===`directory`||e.source===`file`)&&!xt(e.path)){let n=t??x(),r=be(n);return{...e,path:Ct(r??n,e.path)}}return e}function K(e){return St(e??S(),kn)}async function En(e){let t;try{t=await Tt(K(e),`utf8`)}catch{return}let n=An().safeParse(we(t,!1));return n.success?n.data:void 0}async function Dn(e,t){let n=K(t),r=T(e);try{return await H(n,r,{flag:`wx`}),!0}catch(e){let t=ue(e);if(t===`EEXIST`)return!1;if(t===`ENOENT`){await wt(bt(n),{recursive:!0});try{return await H(n,r,{flag:`wx`}),!0}catch(e){if(ue(e)===`EEXIST`)return!1;throw e}}throw e}}function q(e){Y?.(),Y=fe(async()=>{await J(e)})}async function On(e){let t=e?.dir,n=e?.lockIdentity??v(),r={sessionId:n,pid:process.pid,acquiredAt:Date.now()};if(await Dn(r,t))return X=void 0,q(e),D(`[ScheduledTasks] acquired scheduler lock (PID ${process.pid})`),!0;let i=await En(t);return i?.sessionId===n?(i.pid!==process.pid&&(await H(K(t),T(r)),q(e)),!0):i&&Te(i.pid)?(X!==i.sessionId&&(X=i.sessionId,D(`[ScheduledTasks] scheduler lock held by session ${i.sessionId} (PID ${i.pid})`)),!1):(i&&D(`[ScheduledTasks] recovering stale scheduler lock from PID ${i.pid}`),await Et(K(t)).catch(()=>{}),await Dn(r,t)?(X=void 0,q(e),!0):!1)}async function J(e){Y?.(),Y=void 0,X=void 0;let t=e?.dir,n=e?.lockIdentity??v(),r=await En(t);if(!(!r||r.sessionId!==n))try{await Et(K(t)),D(`[ScheduledTasks] released scheduler lock`)}catch{}}var kn,An,Y,X,jn=e((()=>{_(),y(),O(),E(),Ee(),Ce(),N(),k(),kn=St(`.claude`,`scheduled_tasks.lock`),An=M(()=>m({sessionId:a(),pid:i(),acquiredAt:i()}))})),Mn=t({buildMissedTaskNotification:()=>Fn,createCronScheduler:()=>Pn,isRecurringTaskAged:()=>Nn});function Nn(e,t,n){return n===0?!1:!!(e.recurring&&!e.permanent&&t-e.createdAt>=n)}function Pn(e){let{onFire:t,isLoading:n,assistantMode:r=!1,onFireTask:i,onMissed:a,dir:o,lockIdentity:s,getJitterConfig:c,isKilled:l,filter:u}=e,d=o||s?{dir:o,lockIdentity:s}:void 0,f=[],p=new Map,m=new Set,h=new Set,g=null,_=null,v=null,y=null,x=!1,S=!1;async function C(e){let n=await pt(o);if(x||(f=n,!e))return;let r=ut(n,Date.now()).filter(e=>!e.recurring&&!m.has(e.id)&&(!u||u(e)));if(r.length>0){for(let e of r)m.add(e.id),p.set(e.id,1/0);A(`tengu_scheduled_task_missed`,{count:r.length,taskIds:r.map(e=>e.id).join(`,`)}),a?a(r):t(Fn(r)),ct(r.map(e=>e.id),o).catch(e=>D(`[ScheduledTasks] failed to remove missed tasks: ${e}`)),D(`[ScheduledTasks] surfaced ${r.length} missed one-shot task(s)`)}}function re(){if(l?.()||n()&&!r)return;let e=Date.now(),a=new Set,s=[],d=c?.()??B;function m(n,r){if(u&&!u(n)||(a.add(n.id),h.has(n.id)))return;let c=p.get(n.id);if(c===void 0&&(c=n.recurring?st(n.cron,n.lastFiredAt??n.createdAt,n.id,d)??1/0:lt(n.cron,n.createdAt,n.id,d)??1/0,p.set(n.id,c),D(`[ScheduledTasks] scheduled ${n.id} for ${c===1/0?`never`:new Date(c).toISOString()}`)),e<c)return;D(`[ScheduledTasks] firing ${n.id}${n.recurring?` (recurring)`:``}`),A(`tengu_scheduled_task_fire`,{recurring:n.recurring??!1,taskId:n.id}),i?i(n):t(n.prompt);let l=Nn(n,e,d.recurringMaxAgeMs);if(l){let t=Math.floor((e-n.createdAt)/1e3/60/60);D(`[ScheduledTasks] recurring task ${n.id} aged out (${t}h since creation), deleting after final fire`),A(`tengu_scheduled_task_expired`,{taskId:n.id,ageHours:t})}if(n.recurring&&!l){let t=st(n.cron,e,n.id,d)??1/0;p.set(n.id,t),r||s.push(n.id)}else r?(ne([n.id]),p.delete(n.id)):(h.add(n.id),ct([n.id],o).catch(e=>D(`[ScheduledTasks] failed to remove task ${n.id}: ${e}`)).finally(()=>h.delete(n.id)),p.delete(n.id))}if(S){for(let e of f)m(e,!1);if(s.length>0){for(let e of s)h.add(e);ft(s,e,o).catch(e=>D(`[ScheduledTasks] failed to persist lastFiredAt: ${e}`)).finally(()=>{for(let e of s)h.delete(e)})}}if(o===void 0)for(let e of ee())m(e,!0);if(a.size===0){p.clear();return}for(let e of p.keys())a.has(e)||p.delete(e)}async function w(){if(x)return;g&&(clearInterval(g),g=null);let{default:e}=await import(`./chokidar-BcI3rIKm.js`);if(x)return;if(S=await On(d).catch(()=>!1),x){S&&(S=!1,J(d));return}S||(v=setInterval(()=>{On(d).then(e=>{if(x){e&&J(d);return}e&&(S=!0,v&&(clearInterval(v),v=null))}).catch(e=>D(String(e),{level:`error`}))},Q),v.unref?.()),C(!0);let t=mt(o);y=e.watch(t,{persistent:!1,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:In},ignorePermissionErrors:!0}),y.on(`add`,()=>void C(!1)),y.on(`change`,()=>void C(!1)),y.on(`unlink`,()=>{x||(f=[],p.clear())}),_=setInterval(re,Z),_.unref?.()}return{start(){if(x=!1,o!==void 0){D(`[ScheduledTasks] scheduler start() — dir=${o}, hasTasks=${z(o)}`),w();return}if(D(`[ScheduledTasks] scheduler start() — enabled=${b()}, hasTasks=${z()}`),!b()&&(r||z())&&te(!0),b()){w();return}g=setInterval(e=>{b()&&e()},Z,w),g.unref?.()},stop(){x=!0,g&&(clearInterval(g),g=null),_&&(clearInterval(_),_=null),v&&(clearInterval(v),v=null),y?.close(),y=null,S&&(S=!1,J(d))},getNextFireTime(){let e=1/0;for(let t of p.values())t<e&&(e=t);return e===1/0?null:e}}}function Fn(e){let t=e.length>1;return`${`The following one-shot scheduled task${t?`s were`:` was`} missed while Claude was not running. ${t?`They have`:`It has`} already been removed from .claude/scheduled_tasks.json.\n\nDo NOT execute ${t?`these prompts`:`this prompt`} yet. First use the AskUserQuestion tool to ask whether to run ${t?`each one`:`it`} now. Only execute if the user confirms.`}\n\n${e.map(e=>{let t=`[${ht(e.cron)}, created ${new Date(e.createdAt).toLocaleString()}]`,n=(e.prompt.match(/`+/g)??[]).reduce((e,t)=>Math.max(e,t.length),0),r="`".repeat(Math.max(3,n+1));return`${t}\n${r}\n${e.prompt}\n${r}`}).join(`
|
|
5
|
+
|
|
6
|
+
`)}`}var Z,In,Q,Ln=e((()=>{y(),gt(),dt(),jn(),O(),Z=1e3,In=300,Q=5e3})),Rn=t({getCronJitterConfig:()=>zn});function zn(){let e=se(`tengu_kairos_cron_config`,B,Bn),t=Hn().safeParse(e);return t.success?t.data:B}var Bn,$,Vn,Hn,Un=e((()=>{_(),dt(),N(),Bn=60*1e3,$=1800*1e3,Vn=720*60*60*1e3,Hn=M(()=>m({recurringFrac:i().min(0).max(1),recurringCapMs:i().int().min(0).max($),oneShotMaxMs:i().int().min(0).max($),oneShotFloorMs:i().int().min(0).max($),oneShotMinuteMod:i().int().min(1).max(60),recurringMaxAgeMs:i().int().min(0).max(Vn).default(B.recurringMaxAgeMs)}).refine(e=>e.oneShotFloorMs<=e.oneShotMaxMs))}));export{Mn as a,wn as c,_n as d,fn as f,Pn as i,bn as l,G as m,zn as n,Ln as o,W as p,Un as r,Cn as s,Rn as t,pn as u};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{Cn as i,F as a,In as o,Ln as s,Mn as c,Rn as l,T as u,Ut as d,_ as f,b as p,g as m,h,l as ee,m as te,t as g,tt as _,x as v,xt as y}from"./src-Di342QoJ.js";import{t as b}from"./jsx-runtime-D-D469L8.js";import{Ct as ne,cn as x,ot as re}from"./state-sIHsFpDu.js";import{Mr as ie,Pr as ae}from"./paths-Q2255dD7.js";import{T as S,d as C,s as w,w as T}from"./debug-UI3T040K.js";import{n as oe,r as E}from"./analytics-DqMQntaB.js";import{i as se,v as ce}from"./git-CN3qtTb_.js";import{a as le,o as D,s as ue}from"./log-CzsijfHZ.js";import{b as O,x as de}from"./teammate-DMYOtLTK.js";import{E as k,g as fe,p as pe,x as A}from"./startupProfiler-DnXZaX4A.js";import{Ar as me,By as he,Dx as ge,Gu as _e,JS as j,Lw as ve,Mi as ye,Mr as be,Ni as xe,Nx as Se,Ox as M,Pr as Ce,Px as we,Ur as Te,YS as Ee,_i as De,gr as Oe,gy as ke,m_ as Ae,my as je,p_ as Me,qu as Ne,wr as N,zy as Pe}from"./loadAgentsDir-Ci5mr0vm.js";import{i as P,r as F}from"./shellQuote-DgjT8KBA.js";import{t as Fe}from"./useKeybinding-FsOnjW6T.js";import{l as Ie,u as Le}from"./referral-ByevBJrE.js";import{t as Re}from"./SearchBox-DfOmUoaI.js";import{n as ze,t as Be}from"./useSearchInput-B-V4kIa-.js";import{n as Ve,t as I}from"./Messages-PfbzLYOU.js";import{n as He,t as Ue}from"./fuse-Ch_OAlm3.js";import{sep as L}from"path";function We({log:e,onExit:t,onSelect:n}){let[r,i]=R.useState(null);R.useEffect(()=>{i(null),Ce(e)&&Te(e).then(i)},[e]);let a=Ce(e)&&r===null,o=r??e,s=N(o)||``,c=_e();return _(`confirm:no`,t,{context:`Confirmation`}),_(`confirm:yes`,(0,R.useCallback)(()=>{n(r??e)},[n,r,e]),{context:`Confirmation`}),a?(0,z.jsxs)(v,{flexDirection:`column`,padding:1,children:[(0,z.jsx)(ee,{message:`Loading session…`}),(0,z.jsx)(p,{dimColor:!0,children:(0,z.jsx)(h,{children:(0,z.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,z.jsxs)(v,{flexDirection:`column`,children:[(0,z.jsx)(I,{messages:o.messages,tools:c,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:s,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,z.jsxs)(v,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,z.jsxs)(p,{children:[fe(o.modified),` · `,o.messageCount,` messages`,o.gitBranch?` · ${o.gitBranch}`:``]}),(0,z.jsx)(p,{dimColor:!0,children:(0,z.jsxs)(h,{children:[(0,z.jsx)(m,{shortcut:`Enter`,action:`resume`}),(0,z.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var R,z,B=e((()=>{R=t(l(),1),g(),Fe(),Ne(),A(),me(),Ee(),Ve(),z=b()}));function Ge(e,t){if(e===H)return 3+U;let n=i(e),r=t?Math.min(n,t-U-W):n;return Math.max(0,r)+U+W}function Ke(e,t){let n=t-U-W;return i(e)<=n?e:n<=1?e.charAt(0):k(e,n)}function qe({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(G,K),s=n-a-o-2,c=Math.max(0,Math.min(t,e.length-1)),l=Math.max(20,Math.floor(s/2)),u=e.map(e=>Ge(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-$e,n=u[c]??0;for(d=c,f=c+1;d>0||f<e.length;){let r=d>0,i=f<e.length;if(r){let e=(u[d-1]??0)+1;if(n+e<=t){d--,n+=e;continue}}if(i){let e=(u[f]??0)+1;if(n+e<=t){f++,n+=e;continue}}break}}let m=d,h=e.length-f,ee=e.slice(d,f),te=ee.map((e,t)=>d+t);return(0,V.jsxs)(v,{flexDirection:`row`,gap:1,children:[(0,V.jsx)(p,{color:`suggestion`,children:i}),m>0&&(0,V.jsxs)(p,{dimColor:!0,children:[Je,m]}),ee.map((e,t)=>{let n=te[t]===c,r=e===H?e:`#${Ke(e,l-U)}`;return(0,V.jsxs)(p,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),h>0?(0,V.jsxs)(p,{dimColor:!0,children:[Ye,h,Xe]}):(0,V.jsx)(p,{dimColor:!0,children:Ze})]})}var V,H,U,W,Je,Ye,Xe,Ze,Qe,$e,G,K,et=e((()=>{l(),g(),A(),V=b(),H=`All`,U=2,W=1,Je=`← `,Ye=`→`,Xe=` (tab to cycle)`,Ze=`(tab to cycle)`,Qe=2,$e=2+Qe+1,G=1+Qe+15,K=14}));function tt({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:o=`expanded`,isDisabled:s=!1,hideIndexes:c=!1,isNodeExpanded:l,onExpand:u,onCollapse:d,getParentPrefix:f,getChildPrefix:p,onUpFromFirstItem:m}){let[h,ee]=q.useState(new Set),te=q.useRef(!1),g=q.useRef(null),_=q.useCallback(e=>l?l(e):h.has(e),[l,h]),y=q.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=_(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,_]),b=q.useCallback(e=>e?`▼ `:`▶ `,[]),ne=q.useCallback(e=>` ▸ `,[]),x=f??b,re=p??ne,ie=q.useCallback(e=>{let t=``;return e.hasChildren?t=x(e.isExpanded):e.depth>0&&(t=re(e.depth)),t+e.node.label},[x,re]),ae=q.useMemo(()=>y.map(e=>({label:ie(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[y,ie]),S=q.useMemo(()=>{let e=new Map;return y.forEach(t=>e.set(t.node.id,t.node)),e},[y]),C=q.useCallback(e=>y.find(t=>t.node.id===e),[y]),w=q.useCallback((e,t)=>{let n=C(e);!n||!n.hasChildren||(t?u?u(e):ee(t=>new Set(t).add(e)):d?d(e):ee(t=>{let n=new Set(t);return n.delete(e),n}))},[C,u,d]);return(0,nt.jsx)(v,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=C(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),w(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),w(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),te.current=!0,w(t.parentId,!1),r)){let e=S.get(t.parentId);e&&r(e)}}}},children:(0,nt.jsx)(ge,{options:ae,onChange:q.useCallback(e=>{let n=S.get(e);n&&t(n)},[S,t]),onFocus:q.useCallback(e=>{if(te.current){te.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=S.get(e);t&&r(t)}},[r,S]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:m})})}var q,nt,rt=e((()=>{q=t(l(),1),g(),M(),nt=b()}));function it(e,t){return k(e.replace(/\s+/g,` `).trim(),t)}function at({before:e,match:t,after:n},r){return o.dim(e)+r(t)+o.dim(n)}function ot(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function st(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?mt:i?X:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${it(le(e),l)}${c}${s}`}function ct(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=pe(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function lt({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:i,onSelect:o,onLogsChanged:s,onLoadMore:l,initialSearchQuery:ee,showAllProjects:g=!1,onToggleAllProjects:b,onAgenticSearch:x}){let ie=a(),ae=n===void 0?ie.columns:n,S=Le(i),C=d(),w=be(),T=process.env.USER_TYPE===`ant`,[oe]=u(),ce=Pe(oe),D=J.useMemo(()=>e=>c(e,ce.warning),[ce.warning]),ue=process.env.USER_TYPE===`ant`,[O,de]=J.useState(null),[k,fe]=J.useState(!1),[A,me]=J.useState(!1),[he,_e]=J.useState(!1),ve=J.useMemo(()=>re(),[]),[xe,M]=J.useState(``),[Ce,we]=J.useState(0),[Te,Ee]=J.useState(new Set),[ke,Ae]=J.useState(null),[Me,Ne]=J.useState(1),[P,F]=J.useState(`list`),[Fe,Ie]=J.useState(null),Re=J.useRef(null),[Be,Ve]=J.useState(0),[I,He]=J.useState({status:`idle`}),[L,R]=J.useState(!1),z=J.useRef(null),{query:B,setQuery:Ge,cursorOffset:Ke}=ze({isActive:P===`search`&&I.status!==`searching`,onExit:()=>{F(`list`),E(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{F(`list`),E(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:ee||``}),V=J.useDeferredValue(B),[H,U]=J.useState(``);J.useEffect(()=>{if(!V){U(``);return}let e=setTimeout(U,300,V);return()=>clearTimeout(e)},[V]);let[W,Je]=J.useState(null),[Ye,Xe]=J.useState(!1);J.useEffect(()=>{se().then(e=>de(e)),ye(ve).then(e=>{_e(e.length>1)})},[ve]);let Ze=J.useMemo(()=>new Map(e.map(e=>[e,dt(e)])),[e]),Qe=J.useMemo(()=>T?new Ue(e.map(e=>({log:e,searchableText:Ze.get(e)??``})).filter(e=>e.searchableText),{keys:[`searchableText`],threshold:gt,ignoreLocation:!0,includeScore:!0}):null,[e,Ze,T]),$e=J.useMemo(()=>pt(e),[e]),G=$e.length>0,K=J.useMemo(()=>G?[`All`,...$e]:[],[G,$e]),et=K.length>0&&Be<K.length?Be:0,q=K[et],nt=q===`All`?void 0:q,rt=+!!G,lt=J.useMemo(()=>{let t=e;return w&&(t=e.filter(e=>{let t=ne(),n=N(e);return!!(t&&n===t||e.customTitle||Oe(e.messages)||e.firstPrompt||e.customTitle)})),nt!==void 0&&(t=t.filter(e=>e.tag===nt)),k&&O&&(t=t.filter(e=>e.gitBranch===O)),he&&!A&&(t=t.filter(e=>e.projectPath===ve)),t},[e,w,nt,k,O,he,A,ve]),ut=J.useMemo(()=>{if(!B)return lt;let e=B.toLowerCase();return lt.filter(t=>{let n=le(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[lt,B]);J.useEffect(()=>{T&&V&&V!==H&&Xe(!0)},[V,H,T]),J.useEffect(()=>{if(!T||!H||!Qe){Je(null),Xe(!1);return}let e=setTimeout((e,t,n,r)=>{let i=e.search(t);i.sort((e,t)=>{let n=new Date(e.item.log.modified).getTime(),r=new Date(t.item.log.modified).getTime()-n;return Math.abs(r)>_t?r:(e.score??1)-(t.score??1)}),n({results:i.map(e=>({log:e.item.log,score:e.score,searchableText:e.item.searchableText})),query:t}),r(!1)},0,Qe,H,Je,Xe);return()=>{clearTimeout(e)}},[H,Qe,T]);let{filteredLogs:mt,snippets:X}=J.useMemo(()=>{let e=new Map,t=ut;if(W&&H&&W.query===H){for(let t of W.results)if(t.searchableText){let n=ot(t.searchableText,H,vt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=W.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ut,W,H]),Z=J.useMemo(()=>I.status===`results`&&I.results.length>0?I.results:mt,[I,mt]),Q=Math.max(30,ae-4),ht=J.useMemo(()=>{if(!w)return[];let e=ft(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?at(i,D):null;if(t.length===1){let t=ct(n,{showProjectPath:g});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:st(n,Q),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=Z.indexOf(t),i=X.get(t),a=i?at(i,D):null,o=ct(t,{isChild:!0,showProjectPath:g});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:st(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=ct(n,{showProjectPath:g});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:st(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[w,Z,Q,g,X,D]),yt=J.useMemo(()=>w?[]:Z.map((e,t)=>{let n=it(le(e)+(e.isSidechain?` (sidechain)`:``),Q),r=pe(e),i=g&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?at(a,D):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[w,Z,D,Q,g,X]),$=ke?.value.log??null,bt=()=>{if(!w||!$)return``;let e=N($);if(!e)return``;let t=Z.filter(t=>N(t)===e);if(!(t.length>1))return``;let n=Te.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},xt=J.useCallback(async()=>{let e=$?N($):void 0;if(!$||!e){F(`list`),M(``);return}xe.trim()&&(await De(e,xe.trim(),$.fullPath),w&&s&&s()),F(`list`),M(``)},[$,xe,s,w]),St=J.useCallback(()=>{F(`list`),E(`tengu_session_search_toggled`,{enabled:!1})},[]),Ct=J.useCallback(()=>{F(`search`),E(`tengu_session_search_toggled`,{enabled:!0})},[]),wt=J.useCallback(async()=>{if(!B.trim()||!x||!ue)return;z.current?.abort();let t=new AbortController;z.current=t,He({status:`searching`}),E(`tengu_agentic_search_started`,{query_length:B.length});try{let n=await x(B,e,t.signal);if(t.signal.aborted)return;He({status:`results`,results:n,query:B}),E(`tengu_agentic_search_completed`,{query_length:B.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;He({status:`error`,message:e instanceof Error?e.message:`Search failed`}),E(`tengu_agentic_search_error`,{query_length:B.length})}},[B,x,ue,e]);J.useEffect(()=>{I.status!==`idle`&&I.status!==`searching`&&(I.status===`results`&&I.query!==B||I.status===`error`)&&He({status:`idle`})},[B,I]),J.useEffect(()=>()=>{z.current?.abort()},[]);let Tt=J.useRef(I.status);J.useEffect(()=>{let e=Tt.current;if(Tt.current=I.status,e===`searching`&&I.status===`results`){if(w&&ht.length>0)Ae(ht[0]);else if(!w&&Z.length>0){let e=Z[0];Ae({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[I.status,w,ht,Z]);let Et=J.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Re.current===t.toString()||(Re.current=t.toString(),Ae({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Ne(t+1))},[Z]),Dt=J.useCallback(e=>{Ae(e);let t=Z.findIndex(t=>N(t)===N(e.value.log));t>=0&&Ne(t+1)},[Z]);_(`confirm:no`,()=>{z.current?.abort(),He({status:`idle`}),E(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:P!==`preview`&&I.status===`searching`}),_(`confirm:no`,()=>{F(`list`),M(``)},{context:`Settings`,isActive:P===`rename`&&I.status!==`searching`}),_(`confirm:no`,()=>{Ge(``),R(!1),i?.()},{context:`Confirmation`,isActive:P!==`preview`&&P!==`rename`&&P!==`search`&&L&&I.status!==`searching`}),y((e,t)=>{if(P!==`preview`&&I.status!==`searching`&&P!==`rename`)if(P===`search`)e.toLowerCase()===`n`&&t.ctrl?St():(t.return||t.downArrow)&&B.trim()&&x&&ue&&I.status!==`results`&&R(!0);else{if(L){if(t.return){wt(),R(!1);return}else if(t.downArrow){R(!1);return}else if(t.upArrow){F(`search`),R(!1);return}}if(G&&t.tab){let e=t.shift?-1:1;Ve(t=>{let n=((t<K.length?t:0)+K.length+e)%K.length,r=K[n];return E(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:$e.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&b)b(),E(`tengu_session_all_projects_toggled`,{enabled:!g});else if(r===`b`&&t.ctrl){let e=!k;fe(e),E(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&he){let e=!A;me(e),E(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(F(`search`),E(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&$?(F(`rename`),M(``),E(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&$?(Ie($),F(`preview`),E(`tengu_session_preview_opened`,{messageCount:$.messageCount})):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(F(`search`),Ge(e),E(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let Ot=[];k&&O&&Ot.push(O),he&&!A&&Ot.push(`current worktree`);let kt=8+ +(Ot.length>0&&P!==`search`)+rt,At=Math.max(1,Math.floor((t-kt-2)/3));return J.useEffect(()=>{l&&Me+At*2>=Z.length&&l(At*3)},[Me,At,Z.length,l]),e.length===0?null:P===`preview`&&Fe&&w?(0,Y.jsx)(We,{log:Fe,onExit:()=>{F(`list`),Ie(null)},onSelect:o}):(0,Y.jsxs)(v,{flexDirection:`column`,height:t-1,children:[(0,Y.jsx)(v,{flexShrink:0,children:(0,Y.jsx)(te,{color:`suggestion`})}),(0,Y.jsx)(v,{flexShrink:0,children:(0,Y.jsx)(p,{children:` `})}),G?(0,Y.jsx)(qe,{tabs:K,selectedIndex:et,availableWidth:ae,showAllProjects:g}):(0,Y.jsx)(v,{flexShrink:0,children:(0,Y.jsxs)(p,{bold:!0,color:`suggestion`,children:[`Resume Session`,P===`list`&&Z.length>At&&(0,Y.jsxs)(p,{dimColor:!0,children:[` `,`(`,Me,` of `,Z.length,`)`]})]})}),(0,Y.jsx)(f,{query:B,isFocused:P===`search`,isTerminalFocused:C,cursorOffset:Ke}),Ot.length>0&&P!==`search`&&(0,Y.jsx)(v,{flexShrink:0,paddingLeft:2,children:(0,Y.jsx)(p,{dimColor:!0,children:(0,Y.jsx)(h,{children:Ot})})}),(0,Y.jsx)(v,{flexShrink:0,children:(0,Y.jsx)(p,{children:` `})}),I.status===`searching`&&(0,Y.jsxs)(v,{paddingLeft:1,flexShrink:0,children:[(0,Y.jsx)(je,{}),(0,Y.jsx)(p,{children:` Searching…`})]}),I.status===`results`&&I.results.length>0&&(0,Y.jsx)(v,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(p,{dimColor:!0,italic:!0,children:`Claude found these results:`})}),I.status===`results`&&I.results.length===0&&mt.length===0&&(0,Y.jsx)(v,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(p,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),I.status===`error`&&mt.length===0&&(0,Y.jsx)(v,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(p,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!B.trim()&&x&&ue&&I.status!==`searching`&&I.status!==`results`&&I.status!==`error`&&(0,Y.jsxs)(v,{flexShrink:0,flexDirection:`column`,children:[(0,Y.jsxs)(v,{flexDirection:`row`,gap:1,children:[(0,Y.jsx)(p,{color:L?`suggestion`:void 0,children:L?r.pointer:` `}),(0,Y.jsx)(p,{color:L?`suggestion`:void 0,bold:L,children:`Search deeply using Claude →`})]}),(0,Y.jsx)(v,{height:1})]}),I.status===`searching`?null:P===`rename`&&$?(0,Y.jsxs)(v,{paddingLeft:2,flexDirection:`column`,children:[(0,Y.jsx)(p,{bold:!0,children:`Rename session:`}),(0,Y.jsx)(v,{paddingTop:1,children:(0,Y.jsx)(Se,{value:xe,onChange:M,onSubmit:xt,placeholder:le($,`Enter new session name`),columns:ae,cursorOffset:Ce,onChangeCursorOffset:we,showCursor:!0})})]}):w?(0,Y.jsx)(tt,{nodes:ht,onSelect:e=>{o(e.value.log)},onFocus:Dt,onCancel:i,focusNodeId:ke?.id,visibleOptionCount:At,layout:`expanded`,isDisabled:P===`search`||L,hideIndexes:!1,isNodeExpanded:e=>{if(P===`search`||k)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Te.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(Ee(e=>new Set(e).add(t)),E(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Ee(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:Ct}):(0,Y.jsx)(ge,{options:yt,onChange:e=>{let t=Z[parseInt(e,10)];t&&o(t)},visibleOptionCount:At,onCancel:i,onFocus:Et,defaultFocusValue:ke?.id.toString(),layout:`expanded`,isDisabled:P===`search`||L,onUpFromFirstItem:Ct}),(0,Y.jsx)(v,{paddingLeft:2,children:S.pending?(0,Y.jsxs)(p,{dimColor:!0,children:[`Press `,S.keyName,` again to exit`]}):P===`rename`?(0,Y.jsx)(p,{dimColor:!0,children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(m,{shortcut:`Enter`,action:`save`}),(0,Y.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I.status===`searching`?(0,Y.jsx)(p,{dimColor:!0,children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(p,{children:`Searching with Claude…`}),(0,Y.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):L?(0,Y.jsx)(p,{dimColor:!0,children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(m,{shortcut:`Enter`,action:`search`}),(0,Y.jsx)(m,{shortcut:`↓`,action:`skip`}),(0,Y.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P===`search`?(0,Y.jsx)(p,{dimColor:!0,children:(0,Y.jsxs)(h,{children:[(0,Y.jsx)(p,{children:Ye&&T?`Searching…`:`Type to Search`}),(0,Y.jsx)(m,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,Y.jsx)(p,{dimColor:!0,children:(0,Y.jsxs)(h,{children:[b&&(0,Y.jsx)(m,{shortcut:`Ctrl+A`,action:`show ${g?`current dir`:`all projects`}`}),O&&(0,Y.jsx)(m,{shortcut:`Ctrl+B`,action:`toggle branch`}),he&&(0,Y.jsx)(m,{shortcut:`Ctrl+W`,action:`show ${A?`current worktree`:`all worktrees`}`}),(0,Y.jsx)(m,{shortcut:`Ctrl+V`,action:`preview`}),(0,Y.jsx)(m,{shortcut:`Ctrl+R`,action:`rename`}),(0,Y.jsx)(p,{children:`Type to search`}),(0,Y.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),bt()&&(0,Y.jsx)(p,{children:bt()})]})})})]})}function ut(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function dt(e){let t=(e.messages.length<=Z?e.messages:[...e.messages.slice(0,Q),...e.messages.slice(-Q)]).map(ut).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>ht?n.slice(0,ht):n}function ft(e){let t=new Map;for(let n of e){let e=N(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function pt(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var J,Y,mt,X,Z,Q,ht,gt,_t,vt,yt=e((()=>{s(),n(),He(),J=t(l(),1),x(),Ie(),Be(),ve(),g(),Fe(),oe(),A(),xe(),ce(),D(),me(),he(),Ee(),M(),Re(),B(),ke(),et(),we(),rt(),Y=b(),mt=2,X=4,Z=2e3,Q=1e3,ht=5e4,gt=.3,_t=60*1e3,vt=50}));function $(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function bt(e){if(e.length===0)return``;let t=(e.length<=wt?e:[...e.slice(0,wt/2),...e.slice(-wt/2)]).map($).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>Ct?t.slice(0,Ct)+`…`:t}function xt(e,t){return!!(le(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&bt(e.messages).toLowerCase().includes(t))}async function St(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>xt(e,r)),a;if(i.length>=Tt)a=i.slice(0,Tt);else{let e=t.filter(e=>!xt(e,r)),n=Tt-i.length;a=[...i,...e.slice(0,n)]}C(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${O(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(Ce(e))try{return await Te(e)}catch(t){return ue(t),e}return e}),s=await Promise.all(o);C(`Agentic search: loaded ${O(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
|
|
2
|
+
${s.map((e,t)=>{let n=[`${t}:`],r=le(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=bt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
|
|
3
|
+
`)}
|
|
4
|
+
|
|
5
|
+
Search query: "${e}"
|
|
6
|
+
|
|
7
|
+
Find the sessions that are most relevant to this query.`;C(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=ie();C(`Agentic search using model: ${e}`);let t=(await Ae({model:e,system:Et,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(!t||t.type!==`text`)return C(`No text content in agentic search response`),[];C(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return C(`Could not find JSON in agentic search response`),[];let i=(S(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return C(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return ue(e),C(`Agentic search error: ${e}`),[]}}var Ct,wt,Tt,Et,Dt=e((()=>{de(),w(),D(),ae(),me(),Me(),T(),Ct=2e3,wt=100,Tt=100,Et=`Your goal is to find relevant sessions based on a user's search query.
|
|
8
|
+
|
|
9
|
+
You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
|
|
10
|
+
|
|
11
|
+
Each session may include:
|
|
12
|
+
- Title (display name or custom title)
|
|
13
|
+
- Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
|
|
14
|
+
- Branch (git branch name, shown as [branch: name])
|
|
15
|
+
- Summary (AI-generated summary)
|
|
16
|
+
- First message (beginning of the conversation)
|
|
17
|
+
- Transcript (excerpt of conversation content)
|
|
18
|
+
|
|
19
|
+
IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
|
|
20
|
+
|
|
21
|
+
For each session, consider (in order of priority):
|
|
22
|
+
1. Exact tag matches (highest priority - user explicitly categorized this session)
|
|
23
|
+
2. Partial tag matches or tag-related terms
|
|
24
|
+
3. Title matches (custom titles or first message content)
|
|
25
|
+
4. Branch name matches
|
|
26
|
+
5. Summary and transcript content matches
|
|
27
|
+
6. Semantic similarity and related concepts
|
|
28
|
+
|
|
29
|
+
CRITICAL: Be VERY inclusive in your matching. Include sessions that:
|
|
30
|
+
- Contain the query term anywhere in any field
|
|
31
|
+
- Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
|
|
32
|
+
- Discuss topics that could be related to the query
|
|
33
|
+
- Have transcripts that mention the concept even in passing
|
|
34
|
+
|
|
35
|
+
When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
|
|
36
|
+
|
|
37
|
+
Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
|
|
38
|
+
|
|
39
|
+
Respond with ONLY the JSON object, no markdown formatting:
|
|
40
|
+
{"relevant_indices": [2, 5, 0]}`}));function Ot(e,t,n){let r=re();if(!t||!e.projectPath||e.projectPath===r)return{isCrossProject:!1};if(process.env.USER_TYPE!==`ant`){let t=N(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${P([e.projectPath])} && claude --resume ${t}`,projectPath:e.projectPath}}if(n.some(t=>e.projectPath===t||e.projectPath.startsWith(t+L)))return{isCrossProject:!0,isSameRepoWorktree:!0,projectPath:e.projectPath};let i=N(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${P([e.projectPath])} && claude --resume ${i}`,projectPath:e.projectPath}}var kt=e((()=>{x(),F(),me()}));export{lt as a,Dt as i,kt as n,yt as o,St as r,Ot as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,j as n,ot as r}from"./state-sIHsFpDu.js";import{AsyncLocalStorage as i}from"async_hooks";function a(e,t){return c.run(e,t)}function o(){return c.getStore()??n()}function s(){try{return o()}catch{return r()}}var c,l=e((()=>{t(),c=new i}));export{a as i,l as n,o as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./cwd--iizewsn.js";e();export{t as getCwd};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";async function t(e,t,r){let i=r?r.trim().split(/\s+/):[],a=i[0]||`status`;return a===`attach`?(e("Use `claude daemon attach` from the CLI. Attach is not available inside the REPL.",{display:`system`}),null):(e((await n(async()=>{if(a===`bg`)await(await import(`./bg-Dbh5z3Y8.js`)).handleBgStart(i.slice(1));else{let{daemonMain:e}=await import(`./main-C6be1KFk.js`);await e([a,...i.slice(1)])}})).join(`
|
|
2
|
+
`)||`Done.`,{display:`system`}),null)}async function n(e){let t=[],n=console.log,r=console.error;console.log=(...e)=>t.push(e.map(String).join(` `)),console.error=(...e)=>t.push(e.map(String).join(` `));try{await e()}finally{console.log=n,console.error=r}return t}e((()=>{}))();export{t as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{};export{e as DangerousBackend};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{n as r,t as i}from"./axios-DhfaybwJ.js";import{Ac as a,Ec as o,Fa as s,G as c,J as l,Na as u,Pr as d,br as f,ci as p,ct as m,lt as h,ri as g}from"./paths-Q2255dD7.js";import{o as _,s as v}from"./log-CzsijfHZ.js";import{createHash as y}from"crypto";function b(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}async function x(){if(N.length===0)return;let e=N;N=[];try{await r.post(E,e,{headers:{"Content-Type":`application/json`,"DD-API-KEY":D},timeout:A})}catch(e){v(e)}}function S(){P||(P=setTimeout(()=>{P=null,x()},T()).unref())}async function C(){P&&(clearTimeout(P),P=null),await x()}async function w(e,t){if(u()!==`firstParty`)return;let n=F;if(n===null&&(n=await I()),!(!n||!j.has(e)))try{let{envContext:n,...r}=await c({model:t.model,betas:t.betas}),i={...r,...n,...t,userBucket:R()};if(typeof i.toolName==`string`&&i.toolName.startsWith(`mcp__`)&&(i.toolName=`mcp`),process.env.USER_TYPE!==`ant`&&typeof i.model==`string`){let e=f(i.model.replace(/\[1m]$/i,``));i.model=e in g?e:`other`}if(typeof i.version==`string`&&(i.version=i.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,`$1`)),i.status!==void 0&&i.status!==null){let e=String(i.status);i.http_status=e;let t=e.charAt(0);t>=`1`&&t<=`5`&&(i.http_status_range=`${t}xx`),delete i.status}let a=i,o={ddsource:`nodejs`,ddtags:[`event:${e}`,...M.filter(e=>a[e]!==void 0&&a[e]!==null).map(e=>`${b(e)}:${a[e]}`)].join(`,`),message:e,service:`claude-code`,hostname:`claude-code`,env:process.env.USER_TYPE};for(let[e,t]of Object.entries(i))t!=null&&(o[b(e)]=t);N.push(o),N.length>=k?(P&&(clearTimeout(P),P=null),x()):S()}catch(e){v(e)}}function T(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||``,10)||O}var E,D,O,k,A,j,M,N,P,F,I,L,R,z=e((()=>{i(),n(),a(),_(),d(),s(),p(),m(),l(),E=process.env.DATADOG_LOGS_ENDPOINT??``,D=process.env.DATADOG_API_KEY??``,O=15e3,k=100,A=5e3,j=new Set(`chrome_bridge_connection_succeeded.chrome_bridge_connection_failed.chrome_bridge_disconnected.chrome_bridge_tool_call_completed.chrome_bridge_tool_call_error.chrome_bridge_tool_call_started.chrome_bridge_tool_call_timeout.tengu_api_error.tengu_api_success.tengu_brief_mode_enabled.tengu_brief_mode_toggled.tengu_brief_send.tengu_cancel.tengu_compact_failed.tengu_exit.tengu_flicker.tengu_init.tengu_model_fallback_triggered.tengu_oauth_error.tengu_oauth_success.tengu_oauth_token_refresh_failure.tengu_oauth_token_refresh_success.tengu_oauth_token_refresh_lock_acquiring.tengu_oauth_token_refresh_lock_acquired.tengu_oauth_token_refresh_starting.tengu_oauth_token_refresh_completed.tengu_oauth_token_refresh_lock_releasing.tengu_oauth_token_refresh_lock_released.tengu_query_error.tengu_session_file_read.tengu_started.tengu_tool_use_error.tengu_tool_use_granted_in_prompt_permanent.tengu_tool_use_granted_in_prompt_temporary.tengu_tool_use_rejected_in_prompt.tengu_tool_use_success.tengu_uncaught_exception.tengu_unhandled_rejection.tengu_voice_recording_started.tengu_voice_toggled.tengu_team_mem_sync_pull.tengu_team_mem_sync_push.tengu_team_mem_sync_started.tengu_team_mem_entries_capped`.split(`.`)),M=[`arch`,`clientType`,`errorType`,`http_status_range`,`http_status`,`kairosActive`,`model`,`platform`,`provider`,`skillMode`,`subscriptionType`,`toolName`,`userBucket`,`userType`,`version`,`versionBase`],N=[],P=null,F=null,I=t(async()=>{if(h()||!E||!D)return F=!1,!1;try{return F=!0,!0}catch(e){return v(e),F=!1,!1}}),L=30,R=t(()=>{let e=o(),t=y(`sha256`).update(e).digest(`hex`);return parseInt(t.slice(0,8),16)%L})}));export{w as i,I as n,C as r,z as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./datadog-Bd1s_VFj.js";t();export{e as shutdownDatadog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,s as t}from"./debug-UI3T040K.js";t();export{e as logForDebugging};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{a as t,c as n,n as r,o as i,s as a,t as o}from"./isObject-DaxDnPKm.js";import{d as s,f as c,l,n as u,t as d,u as f}from"./memoize-DNnuA2aU.js";import{n as p,s as ee,u as m}from"./envUtils-BWeoiL4Y.js";import{g as te}from"./client-_sjL0I7A.js";import{n as ne,t as re}from"./defineProperty-80gRi2ZW.js";import{i as ie,r as ae}from"./isSymbol-Dp3irZaY.js";import{Ai as oe,Bi as se,Ci as ce,Ct as le,Di as ue,Gi as de,Ji as fe,Ki as pe,Li as me,Ni as he,Oi as h,Pi as ge,Qi as _e,Ri as ve,Si as ye,Ui as be,Wi as xe,Zi as Se,_i as Ce,bi as we,cn as Te,gi as Ee,hi as De,ia as Oe,ki as ke,li as g,mi as Ae,pi as je,qi as Me,ra as Ne,ui as _,vi as Pe,wi as Fe,xi as Ie,yi as Le,zi as Re}from"./state-sIHsFpDu.js";import{t as ze}from"./sdk-DEtgRZvI.js";import{a as Be,n as Ve}from"./process-DMKLUQIO.js";import{homedir as He}from"os";import*as v from"path";import{dirname as Ue,join as We}from"path";import*as y from"fs";import{closeSync as Ge,fsyncSync as Ke,openSync as qe,writeFileSync as Je}from"fs";import{appendFile as Ye,mkdir as Xe,open as b,readFile as Ze,readdir as Qe,rename as $e,rm as et,rmdir as tt,stat as nt,symlink as rt,unlink as it}from"fs/promises";var at,ot,st=e((()=>{o(),at=Object.create,ot=function(){function e(){}return function(t){if(!r(t))return{};if(at)return at(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}()}));function ct(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var lt=e((()=>{})),x,ut=e((()=>{c(),x=function(){try{var e=s(Object,`defineProperty`);return e({},``,{}),e}catch{}}()}));function dt(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var ft=e((()=>{}));function S(e,t,n){t==`__proto__`&&x?x(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var C=e((()=>{ut()}));function w(e,t,n){var r=e[t];(!(pt.call(e,t)&&l(r,n))||n===void 0&&!(t in e))&&S(e,t,n)}var pt,T=e((()=>{C(),f(),pt=Object.prototype.hasOwnProperty}));function E(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?S(n,s,c):w(n,s,c)}return n}var D=e((()=>{T(),C()}));function mt(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ht=e((()=>{}));function gt(e){if(!r(e))return mt(e);var t=ye(e),n=[];for(var i in e)i==`constructor`&&(t||!_t.call(e,i))||n.push(i);return n}var _t,vt=e((()=>{o(),Ie(),ht(),_t=Object.prototype.hasOwnProperty}));function O(e){return Pe(e)?ce(e,!0):gt(e)}var k=e((()=>{Fe(),vt(),Ce()})),A,yt=e((()=>{Le(),A=we(Object.getPrototypeOf,Object)}));function bt(e,t){return e&&E(t,Ee(t),e)}var xt=e((()=>{D(),De()}));function St(e,t){return e&&E(t,O(t),e)}var Ct=e((()=>{D(),k()}));function wt(e,t){if(t)return e.slice();var n=e.length,r=Ot?Ot(n):new e.constructor(n);return e.copy(r),r}var Tt,Et,Dt,Ot,kt=e((()=>{a(),Tt=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Et=Tt&&typeof module==`object`&&module&&!module.nodeType&&module,Dt=Et&&Et.exports===Tt?n.Buffer:void 0,Ot=Dt?Dt.allocUnsafe:void 0}));function At(e,t){return E(e,me(e),t)}var jt=e((()=>{D(),ve()})),Mt,Nt=e((()=>{fe(),yt(),ve(),Re(),Mt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Me(t,me(e)),e=A(e);return t}:se}));function Pt(e,t){return E(e,Mt(e),t)}var Ft=e((()=>{D(),Nt()}));function It(e){return be(e,O,Mt)}var Lt=e((()=>{xe(),Nt(),k()}));function Rt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&zt.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}var zt,Bt=e((()=>{zt=Object.prototype.hasOwnProperty}));function j(e){var t=new e.constructor(e.byteLength);return new Se(t).set(new Se(e)),t}var M=e((()=>{_e()}));function Vt(e,t){var n=t?j(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Ht=e((()=>{M()}));function Ut(e){var t=new e.constructor(e.source,Wt.exec(e));return t.lastIndex=e.lastIndex,t}var Wt,Gt=e((()=>{Wt=/\w*$/}));function Kt(e){return P?Object(P.call(e)):{}}var N,P,qt=e((()=>{i(),N=t?t.prototype:void 0,P=N?N.valueOf:void 0}));function Jt(e,t){var n=t?j(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Yt=e((()=>{M()}));function Xt(e,t,n){var r=e.constructor;switch(t){case on:return j(e);case Zt:case Qt:return new r(+e);case sn:return Vt(e,n);case cn:case ln:case un:case dn:case fn:case pn:case mn:case hn:case gn:return Jt(e,n);case $t:return new r;case en:case rn:return new r(e);case tn:return Ut(e);case nn:return new r;case an:return Kt(e)}}var Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n=e((()=>{M(),Ht(),Gt(),qt(),Yt(),Zt=`[object Boolean]`,Qt=`[object Date]`,$t=`[object Map]`,en=`[object Number]`,tn=`[object RegExp]`,nn=`[object Set]`,rn=`[object String]`,an=`[object Symbol]`,on=`[object ArrayBuffer]`,sn=`[object DataView]`,cn=`[object Float32Array]`,ln=`[object Float64Array]`,un=`[object Int8Array]`,dn=`[object Int16Array]`,fn=`[object Int32Array]`,pn=`[object Uint8Array]`,mn=`[object Uint8ClampedArray]`,hn=`[object Uint16Array]`,gn=`[object Uint32Array]`}));function vn(e){return typeof e.constructor==`function`&&!ye(e)?ot(A(e)):{}}var yn=e((()=>{st(),yt(),Ie()}));function bn(e){return ie(e)&&g(e)==xn}var xn,Sn=e((()=>{_(),ae(),xn=`[object Map]`})),F,Cn,wn=e((()=>{Sn(),oe(),ue(),F=h&&h.isMap,Cn=F?ke(F):bn}));function Tn(e){return ie(e)&&g(e)==En}var En,Dn=e((()=>{_(),ae(),En=`[object Set]`})),I,On,kn=e((()=>{Dn(),oe(),ue(),I=h&&h.isSet,On=I?ke(I):Tn}));function L(e,t,n,i,a,o){var s,c=t&An,l=t&jn,u=t&Mn;if(n&&(s=a?n(e,i,a,o):n(e)),s!==void 0)return s;if(!r(e))return e;var d=pe(e);if(d){if(s=Rt(e),!c)return ct(e,s)}else{var f=g(e),p=f==z||f==Ln;if(ge(e))return wt(e,c);if(f==B||f==R||p&&!a){if(s=l||p?{}:vn(e),!c)return l?Pt(e,St(s,e)):At(e,bt(s,e))}else{if(!V[f])return a?e:{};s=Xt(e,f,c)}}o||(o=new Ne);var ee=o.get(e);if(ee)return ee;o.set(e,s),On(e)?e.forEach(function(r){s.add(L(r,t,n,r,e,o))}):Cn(e)&&e.forEach(function(r,i){s.set(i,L(r,t,n,i,e,o))});var m=d?void 0:(u?l?It:je:l?O:Ee)(e);return dt(m||e,function(r,i){m&&(i=r,r=e[i]),w(s,i,L(r,t,n,i,e,o))}),s}var An,jn,Mn,R,Nn,Pn,Fn,In,z,Ln,Rn,zn,B,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,V,nr=e((()=>{Oe(),ft(),T(),xt(),Ct(),kt(),lt(),jt(),Ft(),Ae(),Lt(),_(),Bt(),_n(),yn(),de(),he(),wn(),o(),kn(),De(),k(),An=1,jn=2,Mn=4,R=`[object Arguments]`,Nn=`[object Array]`,Pn=`[object Boolean]`,Fn=`[object Date]`,In=`[object Error]`,z=`[object Function]`,Ln=`[object GeneratorFunction]`,Rn=`[object Map]`,zn=`[object Number]`,B=`[object Object]`,Bn=`[object RegExp]`,Vn=`[object Set]`,Hn=`[object String]`,Un=`[object Symbol]`,Wn=`[object WeakMap]`,Gn=`[object ArrayBuffer]`,Kn=`[object DataView]`,qn=`[object Float32Array]`,Jn=`[object Float64Array]`,Yn=`[object Int8Array]`,Xn=`[object Int16Array]`,Zn=`[object Int32Array]`,Qn=`[object Uint8Array]`,$n=`[object Uint8ClampedArray]`,er=`[object Uint16Array]`,tr=`[object Uint32Array]`,V={},V[R]=V[Nn]=V[Gn]=V[Kn]=V[Pn]=V[Fn]=V[qn]=V[Jn]=V[Yn]=V[Xn]=V[Zn]=V[Rn]=V[zn]=V[B]=V[Bn]=V[Vn]=V[Hn]=V[Un]=V[Qn]=V[$n]=V[er]=V[tr]=!0,V[In]=V[z]=V[Wn]=!1}));function rr(e){return L(e,ir|ar)}var ir,ar,or=e((()=>{nr(),ir=1,ar=4}));function sr(e){return H.add(e),()=>H.delete(e)}async function cr(){await Promise.all(Array.from(H).map(e=>e()))}var H,lr=e((()=>{H=new Set}));function ur({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function d(){s||(s=setTimeout(u,t))}function f(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,d(),(a.length>=n||o>=r)&&f()},flush:u,dispose(){u()}}}var dr=e((()=>{}));function fr(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n&&n[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n&&n[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r&&r[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i&&i[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function pr(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function mr(e,t){return t?pr(fr(e),t):!0}var hr,gr=e((()=>{d(),hr=u(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function _r(e){return e instanceof W||e instanceof te||e instanceof Error&&e.name===`AbortError`}function vr(e,t){return e instanceof Error&&e.message===t}function yr(e){return e instanceof Error?e:Error(String(e))}function br(e){return e instanceof Error?e.message:String(e)}function U(e){if(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`)return e.code}function xr(e){return U(e)===`ENOENT`}function Sr(e){if(e&&typeof e==`object`&&`path`in e&&typeof e.path==`string`)return e.path}function Cr(e,t=5){if(!(e instanceof Error))return String(e);if(!e.stack)return e.message;let n=e.stack.split(`
|
|
2
|
+
`),r=n[0]??e.message,i=n.slice(1).filter(e=>e.trim().startsWith(`at `));return i.length<=t?e.stack:[r,...i.slice(0,t)].join(`
|
|
3
|
+
`)}function wr(e){let t=U(e);return t===`ENOENT`||t===`EACCES`||t===`EPERM`||t===`ENOTDIR`||t===`ELOOP`}function Tr(e){let t=br(e);if(!e||typeof e!=`object`||!(`isAxiosError`in e)||!e.isAxiosError)return{kind:`other`,message:t};let n=e,r=n.response?.status;return r===401||r===403?{kind:`auth`,status:r,message:t}:n.code===`ECONNABORTED`?{kind:`timeout`,status:r,message:t}:n.code===`ECONNREFUSED`||n.code===`ENOTFOUND`?{kind:`network`,status:r,message:t}:{kind:`http`,status:r,message:t}}var Er,Dr,W,Or,kr,Ar,jr,Mr=e((()=>{ze(),ne(),Er=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},Dr=class extends Error{},W=class extends Error{constructor(e){super(e),this.name=`AbortError`}},Or=class extends Error{constructor(e,t,n){super(e),re(this,`filePath`,void 0),re(this,`defaultConfig`,void 0),this.name=`ConfigParseError`,this.filePath=t,this.defaultConfig=n}},kr=class extends Error{constructor(e,t,n,r){super(`Shell command failed`),this.stdout=e,this.stderr=t,this.code=n,this.interrupted=r,this.name=`ShellError`}},Ar=class extends Error{constructor(e,t){super(e),this.formattedMessage=t,this.name=`TeleportOperationError`}},jr=class extends Error{constructor(e,t){super(e),re(this,`telemetryMessage`,void 0),this.name=`TelemetrySafeError`,this.telemetryMessage=t??e}}}));function Nr(){return Lr}function Pr(e,t,n){return G`JSON.stringify(${e})`,JSON.stringify(e,t,n)}function Fr(e,t){return G`structuredClone(${e})`,structuredClone(e,t)}function Ir(e,t,n){if(G`fs.writeFileSync(${e}, ${t})`,typeof n==`object`&&n&&`flush`in n&&n.flush===!0){let r=typeof n==`object`&&`encoding`in n?n.encoding:void 0,i=typeof n==`object`&&`mode`in n?n.mode:void 0,a;try{a=qe(e,`w`,i),Je(a,t,{encoding:r??void 0}),Ke(a)}finally{a!==void 0&&Ge(a)}}else Je(e,t,n)}var Lr,G,Rr,zr=e((()=>{Te(),fi(),(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return process.env.USER_TYPE===`ant`?300:1/0})(),Lr={[Symbol.dispose](){}},G=Nr,Rr=(e,t)=>(G`JSON.parse(${e})`,t===void 0?JSON.parse(e):JSON.parse(e,t))}));function Br(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}var Vr=e((()=>{}));function Hr(e,t){if(t.startsWith(`//`)||t.startsWith(`\\\\`))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};try{let n=e.lstatSync(t);if(n.isFIFO()||n.isSocket()||n.isCharacterDevice()||n.isBlockDevice())return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let r=e.realpathSync(t);return{resolvedPath:r,isSymlink:r!==t,isCanonical:!0}}catch{return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}function Ur(e,t,n){let{resolvedPath:r}=Hr(e,t);return n.has(r)?!0:(n.add(r),!1)}function Wr(e,t){let n=t,r=[];for(;n!==v.dirname(n);){let t;try{t=e.lstatSync(n)}catch{r.unshift(v.basename(n)),n=v.dirname(n);continue}if(t.isSymbolicLink())try{let t=e.realpathSync(n);return r.length===0?t:v.join(t,...r)}catch{let t=e.readlinkSync(n),i=v.isAbsolute(t)?t:v.resolve(v.dirname(n),t);return r.length===0?i:v.join(i,...r)}try{let t=e.realpathSync(n);if(t!==n)return r.length===0?t:v.join(t,...r)}catch{}return}}function Gr(e){let t=e;t===`~`?t=He().normalize(`NFC`):t.startsWith(`~/`)&&(t=v.join(He().normalize(`NFC`),t.slice(2)));let n=new Set,r=K();if(n.add(t),t.startsWith(`//`)||t.startsWith(`\\\\`))return Array.from(n);try{let e=t,i=new Set;for(let a=0;a<40&&!i.has(e);a++){if(i.add(e),!r.existsSync(e)){if(e===t){let e=Wr(r,t);e!==void 0&&n.add(e)}break}let a=r.lstatSync(e);if(a.isFIFO()||a.isSocket()||a.isCharacterDevice()||a.isBlockDevice()||!a.isSymbolicLink())break;let o=r.readlinkSync(e),s=v.isAbsolute(o)?o:v.resolve(v.dirname(e),o);n.add(s),e=s}}catch{}let{resolvedPath:i,isSymlink:a}=Hr(r,t);return a&&i!==t&&n.add(i),Array.from(n)}function K(){return Xr}async function Kr(e,t,n){try{var r=Br();let i=r.a(await b(e,`r`)),a=(await i.stat()).size;if(a<=t)return null;let o=Math.min(a-t,n),s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await i.read(s,c,o-c,t+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:a}}catch(e){r.e=e}finally{await r.d()}}async function qr(e,t){try{var n=Br();let r=n.a(await b(e,`r`)),i=(await r.stat()).size;if(i===0)return{content:``,bytesRead:0,bytesTotal:0};let a=Math.max(0,i-t),o=i-a,s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await r.read(s,c,o-c,a+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:i}}catch(e){n.e=e}finally{await n.d()}}async function*Jr(e){let t=1024*4,n=await b(e,`r`);try{let e=(await n.stat()).size,r=Buffer.alloc(0),i=Buffer.alloc(t);for(;e>0;){let a=Math.min(t,e);e-=a,await n.read(i,0,a,e);let o=Buffer.concat([i.subarray(0,a),r]),s=o.indexOf(10);if(s===-1){r=o;continue}r=Buffer.from(o.subarray(0,s));let c=o.toString(`utf8`,s+1).split(`
|
|
4
|
+
`);for(let e=c.length-1;e>=0;e--){let t=c[e];t&&(yield t)}}r.length>0&&(yield r.toString(`utf8`))}finally{await n.close()}}var Yr,Xr,Zr=e((()=>{Mr(),zr(),Vr(),Yr={cwd(){return process.cwd()},existsSync(e){return G`fs.existsSync(${e})`,y.existsSync(e)},async stat(e){return nt(e)},async readdir(e){return Qe(e,{withFileTypes:!0})},async unlink(e){return it(e)},async rmdir(e){return tt(e)},async rm(e,t){return et(e,t)},async mkdir(e,t){try{await Xe(e,{recursive:!0,...t})}catch(e){if(U(e)!==`EEXIST`)throw e}},async readFile(e,t){return Ze(e,{encoding:t.encoding})},async rename(e,t){return $e(e,t)},statSync(e){return G`fs.statSync(${e})`,y.statSync(e)},lstatSync(e){return G`fs.lstatSync(${e})`,y.lstatSync(e)},readFileSync(e,t){return G`fs.readFileSync(${e})`,y.readFileSync(e,{encoding:t.encoding})},readFileBytesSync(e){return G`fs.readFileBytesSync(${e})`,y.readFileSync(e)},readSync(e,t){G`fs.readSync(${e}, ${t.length} bytes)`;let n;try{n=y.openSync(e,`r`);let r=Buffer.alloc(t.length);return{buffer:r,bytesRead:y.readSync(n,r,0,t.length,0)}}finally{n&&y.closeSync(n)}},appendFileSync(e,t,n){if(G`fs.appendFileSync(${e}, ${t.length} chars)`,n?.mode!==void 0)try{let r=y.openSync(e,`ax`,n.mode);try{y.appendFileSync(r,t)}finally{y.closeSync(r)}return}catch(e){if(U(e)!==`EEXIST`)throw e}y.appendFileSync(e,t)},copyFileSync(e,t){G`fs.copyFileSync(${e} → ${t})`,y.copyFileSync(e,t)},unlinkSync(e){G`fs.unlinkSync(${e})`,y.unlinkSync(e)},renameSync(e,t){G`fs.renameSync(${e} → ${t})`,y.renameSync(e,t)},linkSync(e,t){G`fs.linkSync(${e} → ${t})`,y.linkSync(e,t)},symlinkSync(e,t,n){G`fs.symlinkSync(${e} → ${t})`,y.symlinkSync(e,t,n)},readlinkSync(e){return G`fs.readlinkSync(${e})`,y.readlinkSync(e)},realpathSync(e){return G`fs.realpathSync(${e})`,y.realpathSync(e).normalize(`NFC`)},mkdirSync(e,t){G`fs.mkdirSync(${e})`;let n={recursive:!0};t?.mode!==void 0&&(n.mode=t.mode);try{y.mkdirSync(e,n)}catch(e){if(U(e)!==`EEXIST`)throw e}},readdirSync(e){return G`fs.readdirSync(${e})`,y.readdirSync(e,{withFileTypes:!0})},readdirStringSync(e){return G`fs.readdirStringSync(${e})`,y.readdirSync(e)},isDirEmptySync(e){return G`fs.isDirEmptySync(${e})`,this.readdirSync(e).length===0},rmdirSync(e){G`fs.rmdirSync(${e})`,y.rmdirSync(e)},rmSync(e,t){G`fs.rmSync(${e})`,y.rmSync(e,t)},createWriteStream(e){return y.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return Ze(e);let n=await b(e,`r`);try{let{size:e}=await n.stat(),r=Math.min(e,t),i=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:e}=await n.read(i,a,r-a,a);if(e===0)break;a+=e}return a<r?i.subarray(0,a):i}finally{await n.close()}}},Xr=Yr}));function Qr(){let e=J()||process.env.USER_TYPE===`ant`;return li=!0,J.cache.clear?.(),e}function $r(e){return process.env.USER_TYPE!==`ant`&&!J()||typeof process>`u`||process.versions===void 0||process.versions.node===void 0?!1:mr(e,ui())}function ei(e){Z=e}function ti(){return Z}async function ni(e,t,n,r){e&&await Xe(t,{recursive:!0}).catch(()=>{}),await Ye(n,r),di()}function ri(){}function ii(){if(!Q){let e=null;Q=ur({writeFn:t=>{let n=oi(),r=Ue(n),i=e!==r;if(e=r,J()){if(i)try{K().mkdirSync(r)}catch{}K().appendFileSync(n,t),di();return}$=$.then(ni.bind(null,i,r,n,t)).catch(ri)},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:J()}),sr(async()=>{Q?.dispose(),await $})}return Q}function ai(e,{level:t}={level:`debug`}){if(q[t]<q[ci()]||!$r(e))return;Z&&e.includes(`
|
|
5
|
+
`)&&(e=Pr(e));let n=`${new Date().toISOString()} [${t.toUpperCase()}] ${e.trim()}\n`;if(Y()){Be(n);return}ii().write(n)}function oi(){return X()??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??We(p(),`debug`,`${le()}.txt`)}function si(e,t){process.env.USER_TYPE===`ant`&&t instanceof Error&&t.stack&&ai(`[ANT-ONLY] ${e} stack trace:\n${t.stack}`,{level:`error`})}var q,ci,li,J,ui,Y,X,Z,Q,$,di,fi=e((()=>{d(),Te(),dr(),lr(),gr(),ee(),Zr(),Ve(),zr(),q={verbose:0,debug:1,info:2,warn:3,error:4},ci=u(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(q,e)?e:`debug`}),li=!1,J=u(()=>li||m(process.env.DEBUG)||m(process.env.DEBUG_SDK)||process.argv.includes(`--debug`)||process.argv.includes(`-d`)||Y()||process.argv.some(e=>e.startsWith(`--debug=`))||X()!==null),ui=u(()=>{let e=process.argv.find(e=>e.startsWith(`--debug=`));return e?hr(e.substring(8)):null}),Y=u(()=>process.argv.includes(`--debug-to-stderr`)),X=u(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith(`--debug-file=`))return t.substring(13);if(t===`--debug-file`&&e+1<process.argv.length)return process.argv[e+1]}return null}),Z=!1,Q=null,$=Promise.resolve(),di=u(async()=>{try{let e=oi(),t=We(Ue(e),`latest`);await it(t).catch(()=>{}),await rt(e,t)}catch{}})}));export{or as $,Er as A,vr as B,Fr as C,lt as Ct,G as D,Pr as E,Ar as F,Cr as G,_r as H,Tr as I,dr as J,yr as K,br as L,Dr as M,kr as N,Ir as O,jr as P,rr as Q,U as R,Vr as S,ct as St,Rr as T,xr as U,Mr as V,wr as W,sr as X,lr as Y,cr as Z,Kr as _,T as _t,ti as a,Yt as at,qr as b,x as bt,J as c,wt as ct,ai as d,yt as dt,L as et,ei as f,k as ft,Ur as g,w as gt,Zr as h,D as ht,oi as i,Jt as it,Or as j,W as k,Y as l,kt as lt,Gr as m,E as mt,X as n,vn as nt,ci as o,It as ot,K as p,O as pt,ur as q,ui as r,yn as rt,fi as s,Lt as st,Qr as t,nr as tt,si as u,A as ut,Jr as v,S as vt,zr as w,Br as x,ut as xt,Hr as y,C as yt,Sr as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{E as n,L as r,V as i,d as a,s as o,w as s}from"./debug-UI3T040K.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";var u=t({setCseShimGate:()=>d,toCompatSessionId:()=>f,toInfraSessionId:()=>p});function d(e){m=e}function f(e){return!e.startsWith(`cse_`)||m&&!m()?e:`session_`+e.slice(4)}function p(e){return e.startsWith(`session_`)?`cse_`+e.slice(8):e}var m,h=e((()=>{}));function g(e){return e.replace(w,(e,t,n)=>n.length<T?`"${t}":"[REDACTED]"`:`"${t}":"${`${n.slice(0,8)}...${n.slice(-4)}`}"`)}function _(e){let t=e.replace(/\n/g,`\\n`);return t.length<=C?t:t.slice(0,C)+`... (${t.length} chars)`}function v(e){let t=g(typeof e==`string`?e:n(e));return t.length<=C?t:t.slice(0,C)+`... (${t.length} chars)`}function y(e){let t=r(e);if(e&&typeof e==`object`&&`response`in e){let n=e.response;if(n?.data&&typeof n.data==`object`){let e=n.data,r=typeof e.message==`string`?e.message:typeof e.error==`object`&&e.error&&`message`in e.error&&typeof e.error.message==`string`?e.error.message:void 0;if(r)return`${t}: ${r}`}}return t}function b(e){if(e&&typeof e==`object`&&`response`in e&&e.response&&typeof e.response.status==`number`)return e.response.status}function x(e){if(!(!e||typeof e!=`object`)){if(`message`in e&&typeof e.message==`string`)return e.message;if(`error`in e&&e.error!==null&&typeof e.error==`object`&&`message`in e.error&&typeof e.error.message==`string`)return e.error.message}}function S(e,t,n){t&&a(t),l(`tengu_bridge_repl_skipped`,{reason:e,...n!==void 0&&{v2:n}})}var C,w,T,E=e((()=>{c(),o(),i(),s(),C=2e3,w=RegExp(`"(${[`session_ingress_token`,`environment_secret`,`access_token`,`secret`,`token`].join(`|`)})"\\s*:\\s*"([^"]*)"`,`g`),T=16}));export{b as a,h as c,f as d,p as f,x as i,u as l,_ as n,E as o,y as r,S as s,v as t,d as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}var n=e((()=>{}));function r(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}var i=e((()=>{n()}));function a(e){var n=r(e,`string`);return t(n)==`symbol`?n:n+``}var o=e((()=>{n(),i()}));function s(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=e((()=>{o()}));export{n as i,c as n,t as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./DesktopHandoff-CcsM_OAS.js";async function a(e){return(0,o.jsx)(i,{onDone:e})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./defineProperty-80gRi2ZW.js";import{i as r,o as i,t as a}from"./cliLaunch-BQa48gsr.js";import{dirname as o}from"path";import{closeSync as s,createReadStream as c,mkdirSync as l,openSync as u,readSync as d,statSync as f,unwatchFile as p,watchFile as m}from"fs";import{createInterface as h}from"readline";async function g(e){let t=0;try{if(t=f(e).size,t>0){let n=h({input:c(e,{start:0,end:t-1})});for await(let e of n)process.stdout.write(e+`
|
|
2
|
+
`)}}catch{}return console.log(`
|
|
3
|
+
[tail] Watching for new output... (Ctrl+C to detach)
|
|
4
|
+
`),new Promise(n=>{let r=()=>{p(e),process.removeListener(`SIGINT`,r),console.log(`
|
|
5
|
+
[tail] Detached from session.`),n()};process.on(`SIGINT`,r),m(e,{interval:300},()=>{try{let n=f(e);if(n.size<=t)return;let r=u(e,`r`);try{let e=Buffer.alloc(n.size-t);d(r,e,0,e.length,t),process.stdout.write(e),t=n.size}finally{s(r)}}catch{}})})}var _=e((()=>{})),v;e((()=>{r(),_(),t(),v=class{constructor(){n(this,`name`,`detached`),n(this,`supportsInteractiveInput`,!1)}async available(){return!0}async start(e){l(o(e.logPath),{recursive:!0});let t=u(e.logPath,`a`),n=i(a(e.args,{env:{...e.env,CLAUDE_CODE_SESSION_KIND:`bg`,CLAUDE_CODE_SESSION_NAME:e.sessionName,CLAUDE_CODE_SESSION_LOG:e.logPath}}),{detached:!0,stdio:[`ignore`,t,t],cwd:e.cwd});return n.unref(),s(t),{pid:n.pid??0,sessionName:e.sessionName,logPath:e.logPath,engineUsed:`detached`}}async attach(e){if(!e.logPath)throw Error(`Session ${e.sessionId} has no log path.`);await g(e.logPath)}}}))();export{v as DetachedEngine};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./chunk-DR8-3Aex.js";var n=t(((e,t)=>{var n=()=>process.platform===`linux`,r=null;t.exports={isLinux:n,getReport:()=>{if(!r)if(n()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,r=process.report.getReport(),process.report.excludeNetwork=e}else r={};return r}}})),r=t(((t,n)=>{var r=e(`fs`),i=`/usr/bin/ldd`,a=`/proc/self/exe`,o=2048;n.exports={LDD_PATH:i,SELF_PATH:a,readFileSync:e=>{let t=r.openSync(e,`r`),n=Buffer.alloc(o),i=r.readSync(t,n,0,o,0);return r.close(t,()=>{}),n.subarray(0,i)},readFile:e=>new Promise((t,n)=>{r.open(e,`r`,(e,i)=>{if(e)n(e);else{let e=Buffer.alloc(o);r.read(i,e,0,o,0,(n,a)=>{t(e.subarray(0,a)),r.close(i,()=>{})})}})})}})),i=t(((e,t)=>{t.exports={interpreterPath:e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),n=e.readUInt16LE(54),r=e.readUInt16LE(56);for(let i=0;i<r;i++){let r=t+i*n;if(e.readUInt32LE(r)===3){let t=e.readUInt32LE(r+8),n=e.readUInt32LE(r+32);return e.subarray(t,t+n).toString().replace(/\0.*$/g,``)}}return null}}})),a=t(((t,a)=>{var o=e(`child_process`),{isLinux:s,getReport:c}=n(),{LDD_PATH:l,SELF_PATH:u,readFile:d,readFileSync:f}=r(),{interpreterPath:p}=i(),m,h,g,_=`getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true`,v=``,y=()=>v||new Promise(e=>{o.exec(_,(t,n)=>{v=t?` `:n,e(v)})}),b=()=>{if(!v)try{v=o.execSync(_,{encoding:`utf8`})}catch{v=` `}return v},x=`glibc`,S=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,C=`musl`,w=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),T=()=>{let e=c();return e.header&&e.header.glibcVersionRuntime?x:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(w)?C:null},E=e=>{let[t,n]=e.split(/[\r\n]+/);return t&&t.includes(x)?x:n&&n.includes(C)?C:null},D=e=>{if(e){if(e.includes(`/ld-musl-`))return C;if(e.includes(`/ld-linux-`))return x}return null},O=e=>(e=e.toString(),e.includes(`musl`)?C:e.includes(`GNU C Library`)?x:null),k=async()=>{if(h!==void 0)return h;h=null;try{h=O(await d(l))}catch{}return h},A=()=>{if(h!==void 0)return h;h=null;try{h=O(f(l))}catch{}return h},j=async()=>{if(m!==void 0)return m;m=null;try{m=D(p(await d(u)))}catch{}return m},M=()=>{if(m!==void 0)return m;m=null;try{m=D(p(f(u)))}catch{}return m},N=async()=>{let e=null;return s()&&(e=await j(),e||(e=await k(),e||(e=T()),e||(e=E(await y())))),e},P=()=>{let e=null;return s()&&(e=M(),e||(e=A(),e||(e=T()),e||(e=E(b())))),e},F=async()=>s()&&await N()!==x,I=()=>s()&&P()!==x,L=async()=>{if(g!==void 0)return g;g=null;try{let e=(await d(l)).match(S);e&&(g=e[1])}catch{}return g},R=()=>{if(g!==void 0)return g;g=null;try{let e=f(l).match(S);e&&(g=e[1])}catch{}return g},z=()=>{let e=c();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},B=e=>e.trim().split(/\s+/)[1],V=e=>{let[t,n,r]=e.split(/[\r\n]+/);return t&&t.includes(x)?B(t):n&&r&&n.includes(C)?B(r):null};a.exports={GLIBC:x,MUSL:C,family:N,familySync:P,isNonGlibcLinux:F,isNonGlibcLinuxSync:I,version:async()=>{let e=null;return s()&&(e=await L(),e||(e=z()),e||(e=V(await y()))),e},versionSync:()=>{let e=null;return s()&&(e=R(),e||(e=z()),e||(e=V(b()))),e}}}));export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{d as t,s as n}from"./debug-UI3T040K.js";import{n as r,t as i}from"./cwd--iizewsn.js";import{m as a,v as o}from"./git-CN3qtTb_.js";function s(){m.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=i();if(m.has(e))return m.get(e)??null;try{let n=await a();if(t(`Git remote URL: ${n}`),!n)return t(`No git remote URL found`),m.set(e,null),null;let r=d(n);return t(`Parsed repository: ${r?`${r.host}/${r.owner}/${r.name}`:null} from URL: ${n}`),m.set(e,r),r}catch(n){return t(`Error detecting repository: ${n}`),m.set(e,null),null}}function u(){let e=m.get(i());return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}function d(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return p(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return p(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function f(e){let n=e.trim(),r=d(n);if(r)return r.host===`github.com`?`${r.owner}/${r.name}`:null;if(!n.includes(`://`)&&!n.includes(`@`)&&n.includes(`/`)){let e=n.split(`/`);if(e.length===2&&e[0]&&e[1]){let t=e[1].replace(/\.git$/,``);return`${e[0]}/${t}`}}return t(`Could not parse repository from: ${n}`),null}function p(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var m,h=e((()=>{r(),n(),o(),m=new Map}));export{h as a,u as i,c as n,f as o,l as r,d as s,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,o as t,s as n}from"./detectRepository-CBk3S2zv.js";e();export{t as parseGitHubRepository,n as parseGitRemote};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{a as t,n}from"./env-chR0gV31.js";import{r,t as i}from"./execFileNoThrow-CuQN1sz8.js";import{c as a,o}from"./constants-41VpZw2G.js";function s(){return!!g}async function c(){return v===null&&(v=!!g),v}function l(){return _||null}async function u(){return(await i(o,[`-V`])).code===0}async function d(){return process.env.WT_SESSION?!0:(await i(`where.exe`,[`wt.exe`])).code===0}function f(){if(y!==null)return y;let e=process.env.TERM_PROGRAM,t=!!process.env.ITERM_SESSION_ID,r=n.terminal===`iTerm.app`;return y=e===`iTerm.app`||t||r,y}function p(){return b===null&&(b=!!process.env.WT_SESSION),b}async function m(){return(await i(`it2`,[`session`,`list`])).code===0}function h(){v=null,y=null,b=null}var g,_,v,y,b,x,S=e((()=>{t(),r(),a(),g=process.env.TMUX,_=process.env.TMUX_PANE,v=null,y=null,b=null,x=`it2`}));export{p as a,m as c,h as d,f as i,u as l,l as n,c as o,S as r,s,x as t,d as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,d as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"./detection-CQsNad64.js";s();export{l as IT2_COMMAND,a as getLeaderPaneId,r as isInITerm2,e as isInWindowsTerminal,o as isInsideTmux,c as isInsideTmuxSync,t as isIt2CliAvailable,i as isTmuxAvailable,u as isWindowsTerminalAvailable,n as resetDetectionCache};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./jsx-runtime-D-D469L8.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-PvNZfZby.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{h as t,p as n}from"./debug-UI3T040K.js";import{n as r,t as i}from"./cwd--iizewsn.js";import{o as a,s as o}from"./log-CzsijfHZ.js";import{n as s,t as c}from"./index.min-BJnb9GQI.js";import{i as l,n as u}from"./path-C4kbwvSH.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||i(),prefix:``};let n=u(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:n,prefix:``}:{directory:f(n),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await n().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return o(e),[]}}async function _(e,t={}){let{basePath:n=i(),maxResults:r=10}=t,{directory:a,prefix:o}=h(e,n),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,r).map(e=>({id:e.path,displayText:e.name+`/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let r=`${e}:${t}`,i=w.get(r);if(i)return i;try{let i=(await n().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(r,i),i}catch(e){return o(e),[]}}async function b(e,t={}){let{basePath:n=i(),maxResults:r=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,n),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,r),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.`+m))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?t+`/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{s(),r(),t(),a(),l(),x=500,S=300*1e3,C=new c({max:x,ttl:S}),w=new c({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./chunk-DR8-3Aex.js";import{t as i}from"./src-BaB-bpCj.js";import{createHash as a}from"node:crypto";var o,s=t((()=>{o=`ffffffff-ffff-ffff-ffff-ffffffffffff`})),c,l=t((()=>{c=`00000000-0000-0000-0000-000000000000`})),u,d=t((()=>{u=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i}));function f(e){return typeof e==`string`&&u.test(e)}var p=t((()=>{d()}));function m(e){if(!f(e))throw TypeError(`Invalid UUID`);let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var h=t((()=>{p()}));function g(e,t=0){return(v[e[t+0]]+v[e[t+1]]+v[e[t+2]]+v[e[t+3]]+`-`+v[e[t+4]]+v[e[t+5]]+`-`+v[e[t+6]]+v[e[t+7]]+`-`+v[e[t+8]]+v[e[t+9]]+`-`+v[e[t+10]]+v[e[t+11]]+v[e[t+12]]+v[e[t+13]]+v[e[t+14]]+v[e[t+15]]).toLowerCase()}function _(e,t=0){let n=g(e,t);if(!f(n))throw TypeError(`Stringified UUID is invalid`);return n}var v,y=t((()=>{p(),v=[];for(let e=0;e<256;++e)v.push((e+256).toString(16).slice(1))}));function b(){return crypto.getRandomValues(x)}var x,S=t((()=>{x=new Uint8Array(16)}));function C(e,t,n){let r,i=e?._v6??!1;if(e){let t=Object.keys(e);t.length===1&&t[0]===`_v6`&&(e=void 0)}if(e)r=T(e.random??e.rng?.()??b(),e.msecs,e.nsecs,e.clockseq,e.node,t,n);else{let e=Date.now(),a=b();w(E,e,a),r=T(a,E.msecs,E.nsecs,i?void 0:E.clockseq,i?void 0:E.node,t,n)}return t??g(r)}function w(e,t,n){return e.msecs??(e.msecs=-1/0),e.nsecs??(e.nsecs=0),t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=n.slice(10,16),e.node[0]|=1,e.clockseq=(n[8]<<8|n[9])&16383),e.msecs=t,e}function T(e,t,n,r,i,a,o=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!a)a=new Uint8Array(16),o=0;else if(o<0||o+16>a.length)throw RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);t??(t=Date.now()),n??(n=0),r??(r=(e[8]<<8|e[9])&16383),i??(i=e.slice(10,16)),t+=0xb1d069b5400;let s=((t&268435455)*1e4+n)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=s&255;let c=t/4294967296*1e4&268435455;a[o++]=c>>>8&255,a[o++]=c&255,a[o++]=c>>>24&15|16,a[o++]=c>>>16&255,a[o++]=r>>>8|128,a[o++]=r&255;for(let e=0;e<6;++e)a[o++]=i[e];return a}var E,D=t((()=>{S(),y(),E={}}));function O(e){let t=k(typeof e==`string`?m(e):e);return typeof e==`string`?g(t):t}function k(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}var A=t((()=>{h(),y()}));function ee(e){return Array.isArray(e)?e=Buffer.from(e):typeof e==`string`&&(e=Buffer.from(e,`utf8`)),a(`md5`).update(e).digest()}var te=t((()=>{}));function ne(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function j(e,t,n,r,i,a){let o=typeof n==`string`?ne(n):n,s=typeof r==`string`?m(r):r;if(typeof r==`string`&&(r=m(r)),r?.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let c=new Uint8Array(16+o.length);if(c.set(s),c.set(o,s.length),c=t(c),c[6]=c[6]&15|e,c[8]=c[8]&63|128,i){if(a??(a=0),a<0||a+16>i.length)throw RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[a+e]=c[e];return i}return g(c)}var M,N,P=t((()=>{h(),y(),M=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`,N=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`}));function F(e,t,n,r){return j(48,ee,e,t,n,r)}var re=t((()=>{te(),P(),F.DNS=M,F.URL=N}));function I(e,t,n){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():L(e,t,n)}function L(e,t,n){e=e||{};let r=e.random??e.rng?.()??b();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return g(r)}var R=t((()=>{S(),y()}));function z(e){return Array.isArray(e)?e=Buffer.from(e):typeof e==`string`&&(e=Buffer.from(e,`utf8`)),a(`sha1`).update(e).digest()}var B=t((()=>{}));function V(e,t,n,r){return j(80,z,e,t,n,r)}var H=t((()=>{B(),P(),V.DNS=M,V.URL=N}));function U(e,t,n){e??(e={}),n??(n=0);let r=C({...e,_v6:!0},new Uint8Array(16));if(r=O(r),t){if(n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;e++)t[n+e]=r[e];return t}return g(r)}var W=t((()=>{y(),D(),A()}));function G(e){let t=K(typeof e==`string`?m(e):e);return typeof e==`string`?g(t):t}function K(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}var q=t((()=>{h(),y()}));function J(e,t,n){let r;if(e)r=X(e.random??e.rng?.()??b(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=b();Y(Z,e,i),r=X(i,Z.msecs,Z.seq,t,n)}return t??g(r)}function Y(e,t,n){return e.msecs??(e.msecs=-1/0),e.seq??(e.seq=0),t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function X(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??(t=Date.now()),n??(n=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9]),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}var Z,ie=t((()=>{S(),y(),Z={}}));function ae(e){if(!f(e))throw TypeError(`Invalid UUID`);return parseInt(e.slice(14,15),16)}var oe=t((()=>{p()})),se=n({MAX:()=>o,NIL:()=>c,parse:()=>m,stringify:()=>_,v1:()=>C,v1ToV6:()=>O,v3:()=>F,v4:()=>I,v5:()=>V,v6:()=>U,v6ToV1:()=>G,v7:()=>J,validate:()=>f,version:()=>ae}),Q=t((()=>{s(),l(),h(),y(),D(),A(),re(),R(),H(),W(),q(),ie(),p(),oe()})),ce=r((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t};Object.defineProperty(t,`__esModule`,{value:!0}),t.req=t.json=t.toBuffer=void 0;var a=i(e(`http`)),o=i(e(`https`));async function s(e){let t=0,n=[];for await(let r of e)t+=r.length,n.push(r);return Buffer.concat(n,t)}t.toBuffer=s;async function c(e){let t=(await s(e)).toString(`utf8`);try{return JSON.parse(t)}catch(e){let n=e;throw n.message+=` (input: ${t})`,n}}t.json=c;function l(e,t={}){let n=((typeof e==`string`?e:e.href).startsWith(`https:`)?o:a).request(e,t),r=new Promise((e,t)=>{n.once(`response`,e).once(`error`,t).end()});return n.then=r.then.bind(r),n}t.req=l})),$=r((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},a=t&&t.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(t,`__esModule`,{value:!0}),t.Agent=void 0;var o=i(e(`net`)),s=i(e(`http`)),c=e(`https`);a(ce(),t);var l=Symbol(`AgentBaseInternalState`);t.Agent=class extends s.Agent{constructor(e){super(e),this[l]={}}isSecureEndpoint(e){if(e){if(typeof e.secureEndpoint==`boolean`)return e.secureEndpoint;if(typeof e.protocol==`string`)return e.protocol===`https:`}let{stack:t}=Error();return typeof t==`string`?t.split(`
|
|
2
|
+
`).some(e=>e.indexOf(`(https.js:`)!==-1||e.indexOf(`node:https:`)!==-1):!1}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]||(this.sockets[e]=[]);let t=new o.Socket({writable:!1});return this.sockets[e].push(t),this.totalSocketCount++,t}decrementSockets(e,t){if(!this.sockets[e]||t===null)return;let n=this.sockets[e],r=n.indexOf(t);r!==-1&&(n.splice(r,1),this.totalSocketCount--,n.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?c.Agent.prototype.getName.call(this,e):super.getName(e)}createSocket(e,t,n){let r={...t,secureEndpoint:this.isSecureEndpoint(t)},i=this.getName(r),a=this.incrementSockets(i);Promise.resolve().then(()=>this.connect(e,r)).then(o=>{if(this.decrementSockets(i,a),o instanceof s.Agent)try{return o.addRequest(e,r)}catch(e){return n(e)}this[l].currentSocket=o,super.createSocket(e,t,n)},e=>{this.decrementSockets(i,a),n(e)})}createConnection(){let e=this[l].currentSocket;if(this[l].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[l].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[l]&&(this[l].defaultPort=e)}get protocol(){return this[l].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[l]&&(this[l].protocol=e)}}})),le=r((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.parseProxyResponse=void 0;var n=(0,t(i()).default)(`https-proxy-agent:parse-proxy-response`);function r(e){return new Promise((t,r)=>{let i=0,a=[];function o(){let t=e.read();t?u(t):e.once(`readable`,o)}function s(){e.removeListener(`end`,c),e.removeListener(`error`,l),e.removeListener(`readable`,o)}function c(){s(),n(`onend`),r(Error(`Proxy connection ended before receiving CONNECT response`))}function l(e){s(),n(`onerror %o`,e),r(e)}function u(c){a.push(c),i+=c.length;let l=Buffer.concat(a,i),u=l.indexOf(`\r
|
|
3
|
+
\r
|
|
4
|
+
`);if(u===-1){n(`have not received end of HTTP headers yet...`),o();return}let d=l.slice(0,u).toString(`ascii`).split(`\r
|
|
5
|
+
`),f=d.shift();if(!f)return e.destroy(),r(Error(`No header received from proxy CONNECT response`));let p=f.split(` `),m=+p[1],h=p.slice(2).join(` `),g={};for(let t of d){if(!t)continue;let n=t.indexOf(`:`);if(n===-1)return e.destroy(),r(Error(`Invalid header from proxy CONNECT response: "${t}"`));let i=t.slice(0,n).toLowerCase(),a=t.slice(n+1).trimStart(),o=g[i];typeof o==`string`?g[i]=[o,a]:Array.isArray(o)?o.push(a):g[i]=a}n(`got proxy server response: %o %o`,f,g),s(),t({connect:{statusCode:m,statusText:h,headers:g},buffered:l})}e.on(`error`,l),e.on(`end`,c),o()})}e.parseProxyResponse=r})),ue=r((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),a=t&&t.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},o=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,`__esModule`,{value:!0}),t.HttpsProxyAgent=void 0;var s=a(e(`net`)),c=a(e(`tls`)),l=o(e(`assert`)),u=o(i()),d=$(),f=e(`url`),p=le(),m=(0,u.default)(`https-proxy-agent`),h=e=>e.servername===void 0&&e.host&&!s.isIP(e.host)?{...e,servername:e.host}:e,g=class extends d.Agent{constructor(e,t){super(t),this.options={path:void 0},this.proxy=typeof e==`string`?new f.URL(e):e,this.proxyHeaders=t?.headers??{},m(`Creating new HttpsProxyAgent instance: %o`,this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={ALPNProtocols:[`http/1.1`],...t?v(t,`headers`):null,host:n,port:r}}async connect(e,t){let{proxy:n}=this;if(!t.host)throw TypeError(`No "host" provided`);let r;n.protocol===`https:`?(m("Creating `tls.Socket`: %o",this.connectOpts),r=c.connect(h(this.connectOpts))):(m("Creating `net.Socket`: %o",this.connectOpts),r=s.connect(this.connectOpts));let i=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders},a=s.isIPv6(t.host)?`[${t.host}]`:t.host,o=`CONNECT ${a}:${t.port} HTTP/1.1\r\n`;if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i[`Proxy-Authorization`]=`Basic ${Buffer.from(e).toString(`base64`)}`}i.Host=`${a}:${t.port}`,i[`Proxy-Connection`]||(i[`Proxy-Connection`]=this.keepAlive?`Keep-Alive`:`close`);for(let e of Object.keys(i))o+=`${e}: ${i[e]}\r\n`;let u=(0,p.parseProxyResponse)(r);r.write(`${o}\r\n`);let{connect:d,buffered:f}=await u;if(e.emit(`proxyConnect`,d),this.emit(`proxyConnect`,d,e),d.statusCode===200)return e.once(`socket`,_),t.secureEndpoint?(m(`Upgrading socket connection to TLS`),c.connect({...v(h(t),`host`,`path`,`port`),socket:r})):r;r.destroy();let g=new s.Socket({writable:!1});return g.readable=!0,e.once(`socket`,e=>{m(`Replaying proxy buffer for failed request`),(0,l.default)(e.listenerCount(`data`)>0),e.push(f),e.push(null)}),g}};g.protocols=[`http`,`https`],t.HttpsProxyAgent=g;function _(e){e.resume()}function v(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}}));export{I as a,Q as i,$ as n,se as r,ue as t};
|