claude-code-best 2.6.13 → 2.7.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-BqR8LhJq.js +1 -0
- package/dist/chunks/App-DkBMWXkK.js +1 -0
- package/dist/chunks/ApproveApiKey-5xd0lUV7.js +1 -0
- package/dist/chunks/ApproveApiKey-Dmr2VaVA.js +1 -0
- package/dist/chunks/AssistantSessionChooser-C7rigDkQ.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-RtEwbumC.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-7s3ULbNF.js +1 -0
- package/dist/chunks/ClaudeInChromeOnboarding-Bjv-sERa.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-BTysDIlI.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DosNL91g.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-Cc1yaM-M.js +1 -0
- package/dist/chunks/DesktopHandoff-Cy89ZB_9.js +1 -0
- package/dist/chunks/DevChannelsDialog-ws8prcNK.js +1 -0
- package/dist/chunks/DiffDialog-BhqgxA7o.js +3 -0
- package/dist/chunks/Doctor-BWouB_9X.js +1 -0
- package/dist/chunks/Doctor-Ts5k8hn1.js +3 -0
- package/dist/chunks/ExitFlow-BBoImtT_.js +2 -0
- package/dist/chunks/Feedback-BVbSMBwY.js +2 -0
- package/dist/chunks/Grove-CTQrX7WO.js +1 -0
- package/dist/chunks/Grove-ZMHK4CBZ.js +11 -0
- package/dist/chunks/HybridTransport-B9g074Y1.js +4 -0
- package/dist/chunks/ITermBackend-DaFK8DOH.js +1 -0
- package/dist/chunks/InvalidConfigDialog-BkZkVKB4.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-Lr60eQWj.js +1 -0
- package/dist/chunks/MCPConnectionManager-DmJ6dLOp.js +1 -0
- package/dist/chunks/McpParsingWarnings-CE2pQPXV.js +1 -0
- package/dist/chunks/MessageSelector-BT1FDbwv.js +3 -0
- package/dist/chunks/Messages-DT2gDtrJ.js +11 -0
- package/dist/chunks/Onboarding-DsqnXQel.js +1 -0
- package/dist/chunks/OverageCreditUpsell-UWtCrOmN.js +1 -0
- package/dist/chunks/PluginSettings-OJQz3d5V.js +17 -0
- package/dist/chunks/PromptInputFooterSuggestions-BImBB6Yk.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-CblAb9vk.js +1 -0
- package/dist/chunks/QueryEngine-_re1pGHr.js +1 -0
- package/dist/chunks/REPL-eBTeslsR.js +147 -0
- package/dist/chunks/REPL-wIg0cBqS.js +1 -0
- package/dist/chunks/RemoteCallout-DMQai8_P.js +1 -0
- package/dist/chunks/RemoteSessionManager-DQmsHvj_.js +2 -0
- package/dist/chunks/ResumeConversation-D81hDeTl.js +1 -0
- package/dist/chunks/SSETransport-BbeM6bi9.js +4 -0
- package/dist/chunks/SearchExtraToolsTool-QbJQCWXd.js +1 -0
- package/dist/chunks/SentryErrorBoundary-BQJXHbWh.js +2 -0
- package/dist/chunks/SentryErrorBoundary-Cnw74oVG.js +1 -0
- package/dist/chunks/Settings-DiXc-_IG.js +2 -0
- package/dist/chunks/TeleportProgress-B3oRJlWH.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-GPuEipFy.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-CcDuR6o9.js +1 -0
- package/dist/chunks/ThemePicker-BjSRjA_L.js +1 -0
- package/dist/chunks/TmuxBackend-BE3zsPKE.js +9 -0
- package/dist/chunks/TrustDialog-B6Qg0xUr.js +1 -0
- package/dist/chunks/ValidationErrorsList-C5BoLiye.js +2 -0
- package/dist/chunks/WelcomeV2-BJAKZYz1.js +1 -0
- package/dist/chunks/WindowsTerminalBackend-BcwpxU2Q.js +2 -0
- package/dist/chunks/add-dir-OR7-VVcq.js +1 -0
- package/dist/chunks/agentDisplay-CMqTUh0A.js +1 -0
- package/dist/chunks/agents-DRtgUZ6t.js +103 -0
- package/dist/chunks/agents-EolUGDZB.js +2 -0
- package/dist/chunks/ant-Bgl31h7a.js +1 -0
- package/dist/chunks/api-BpQPVgif.js +1 -0
- package/dist/chunks/api-xFvB7WoB.js +1 -0
- package/dist/chunks/asciicast-CJObpRg9.js +1 -0
- package/dist/chunks/asciicast-Dr_Div_R.js +4 -0
- package/dist/chunks/assistant-CENsWvTb.js +1 -0
- package/dist/chunks/assistant-CHawoD04.js +1 -0
- package/dist/chunks/assistant-s7XNIA76.js +1 -0
- package/dist/chunks/auth-DX12yVM8.js +1 -0
- package/dist/chunks/auth-h6VL9BbC.js +1 -0
- package/dist/chunks/autoMode-BDzVqEPm.js +45 -0
- package/dist/chunks/autonomy-CeqOXzJl.js +19 -0
- package/dist/chunks/autonomy-D2YudQnH.js +1 -0
- package/dist/chunks/autonomyPanel-B0OQV4lv.js +1 -0
- package/dist/chunks/backgroundHousekeeping-CvHD981l.js +17 -0
- package/dist/chunks/backgroundHousekeeping-DMkk-QoZ.js +1 -0
- package/dist/chunks/banner-DNLUJFS_.js +2 -0
- package/dist/chunks/bg-D_H-uZDS.js +9 -0
- package/dist/chunks/bg-FtpmvQuT.js +1 -0
- package/dist/chunks/branch-D44HjlJp.js +3 -0
- package/dist/chunks/bridge-4sldfa8u.js +2 -0
- package/dist/chunks/bridgeConfig-BM7iHryd.js +1 -0
- package/dist/chunks/bridgeConfig-CcCNsSBX.js +1 -0
- package/dist/chunks/bridgeEnabled-CYddgTU1.js +1 -0
- package/dist/chunks/bridgeEnabled-DoT2l1Oj.js +1 -0
- package/dist/chunks/bridgeMain-DaO51duk.js +68 -0
- package/dist/chunks/bridgeMain-Dc4-ZK69.js +1 -0
- package/dist/chunks/bridgeMessaging-IlSWKGmC.js +1 -0
- package/dist/chunks/bridgePointer-fFD_tbSk.js +1 -0
- package/dist/chunks/browser-DwnUS505.js +1 -0
- package/dist/chunks/btw-CrdUyRUP.js +1 -0
- package/dist/chunks/buddy-Ci0hdCf9.js +3 -0
- package/dist/chunks/bypassPermissionsKillswitch-BWOlc_sK.js +1 -0
- package/dist/chunks/caches-BHRJHGlc.js +1 -0
- package/dist/chunks/caches-CitduRKp.js +3 -0
- package/dist/chunks/ccrClient-yNKhQYnf.js +1 -0
- package/dist/chunks/changeDetector-B1tCH9Pa.js +1 -0
- package/dist/chunks/channelNotification-D8NPg8I8.js +1 -0
- package/dist/chunks/channelNotification-oE3eipDZ.js +1 -0
- package/dist/chunks/chrome-CwAwCY0V.js +1 -0
- package/dist/chunks/chromeNativeHost-63xqELw-.js +1 -0
- package/dist/chunks/claudeDesktop-CX1AsJie.js +1 -0
- package/dist/chunks/cleanup-C0gyKaOb.js +1 -0
- package/dist/chunks/clear-B5D08sZ0.js +1 -0
- package/dist/chunks/cliLaunch-8aeIk2ts.js +1 -0
- package/dist/chunks/client-un1k_6md.js +1 -0
- package/dist/chunks/color-BtVvrSvq.js +1 -0
- package/dist/chunks/commands--qEK1j9j.js +1 -0
- package/dist/chunks/commitAttribution-AEb-sE-t.js +1 -0
- package/dist/chunks/commitAttribution-HP_CWP0X.js +2 -0
- package/dist/chunks/common-BBRP_KzA.js +1 -0
- package/dist/chunks/common-BD4Q7osK.js +1 -0
- package/dist/chunks/common-C56I-_O3.js +1 -0
- package/dist/chunks/compact-BNhxD2UA.js +3 -0
- package/dist/chunks/companion-BlhNrZiL.js +1 -0
- package/dist/chunks/completionCache-BHSsdkBs.js +1 -0
- package/dist/chunks/completionCache-Daqaxlf3.js +4 -0
- package/dist/chunks/computerUseLock-BoEK9xYv.js +1 -0
- package/dist/chunks/config-9z8716kz.js +1 -0
- package/dist/chunks/config-f8Cx16Z6.js +1 -0
- package/dist/chunks/context-BdOjhAmM.js +1 -0
- package/dist/chunks/context-noninteractive-CnaDbgvf.js +54 -0
- package/dist/chunks/context-noninteractive-DRM7gbFk.js +1 -0
- package/dist/chunks/conversation-B9pq-m4L.js +1 -0
- package/dist/chunks/conversation-DUxXVrGj.js +1 -0
- package/dist/chunks/copy-Cjl0-hg1.js +7 -0
- package/dist/chunks/createSSHSession-CYaHalxc.js +6 -0
- package/dist/chunks/createSession-DoR2K7ay.js +1 -0
- package/dist/chunks/createSession-VlSLvi7J.js +1 -0
- package/dist/chunks/cronJitterConfig-DjSd7nvj.js +6 -0
- package/dist/chunks/crossProjectResume-CDWr5DFl.js +40 -0
- package/dist/chunks/daemon-FAp0WyY6.js +2 -0
- package/dist/chunks/datadog-CahWdK03.js +1 -0
- package/dist/chunks/datadog-DPkKCR8M.js +1 -0
- package/dist/chunks/debug-DIYxb3SF.js +1 -0
- package/dist/chunks/debug-otxXY3j-.js +5 -0
- package/dist/chunks/debugUtils-CiEnbhiz.js +1 -0
- package/dist/chunks/desktop-y3mzgaWo.js +1 -0
- package/dist/chunks/detached-Brq3-vHi.js +5 -0
- package/dist/chunks/detectRepository-CSN3yxkq.js +1 -0
- package/dist/chunks/detectRepository-CbR0WgtE.js +1 -0
- package/dist/chunks/detection-BPPZCanO.js +1 -0
- package/dist/chunks/detection-DrdKrqbQ.js +1 -0
- package/dist/chunks/diff-hpp0dp6U.js +1 -0
- package/dist/chunks/directoryCompletion-DAc3u1K2.js +1 -0
- package/dist/chunks/doctor-B230p0R_.js +1 -0
- package/dist/chunks/earlyInput-vv9abU2L.js +1 -0
- package/dist/chunks/effort-D7i2v6vd.js +9 -0
- package/dist/chunks/entry-Du3gtq9o.js +14 -0
- package/dist/chunks/env-BH-OBzcA.js +1 -0
- package/dist/chunks/envLessBridgeConfig-CKD4eOEe.js +1 -0
- package/dist/chunks/envLessBridgeConfig-DI0ouryy.js +1 -0
- package/dist/chunks/escHotkey-DfdC44i7.js +259 -0
- package/dist/chunks/execFileNoThrow-B_aZH_GP.js +1 -0
- package/dist/chunks/execSyncWrapper-Bn7EJqtD.js +1 -0
- package/dist/chunks/executor-BJb5d6mo.js +1 -0
- package/dist/chunks/executor-Dmn3RTuI.js +1561 -0
- package/dist/chunks/exit-fntBGxEC.js +1 -0
- package/dist/chunks/export-Dy9M7FnZ.js +2 -0
- package/dist/chunks/exportRenderer-Ckv4v0ye.js +1 -0
- package/dist/chunks/extra-usage-DLEvlKzs.js +1 -0
- package/dist/chunks/extra-usage-core-3KkeQSve.js +1 -0
- package/dist/chunks/extra-usage-noninteractive-DUezD54f.js +1 -0
- package/dist/chunks/extra-usage-pU11YXHS.js +1 -0
- package/dist/chunks/extraUsage-B-l-oe-7.js +1 -0
- package/dist/chunks/extractMemories-CXarlmZp.js +1 -0
- package/dist/chunks/fast-BzfzSH7K.js +1 -0
- package/dist/chunks/fast-CbLu_WYL.js +1 -0
- package/dist/chunks/feedback-DiyZIbov.js +1 -0
- package/dist/chunks/firstPartyEventLogger-Dig8Mv7_.js +1 -0
- package/dist/chunks/flushGate-Ci3NHOV4.js +1 -0
- package/dist/chunks/gates-CtkQH6jy.js +1 -0
- package/dist/chunks/gates-xscCu8-N.js +1 -0
- package/dist/chunks/gemini-BCuY2aYj.js +1 -0
- package/dist/chunks/generateRecap-DA0SNyFR.js +1 -0
- package/dist/chunks/generateSessionName-BtQ4NGXP.js +1 -0
- package/dist/chunks/genericProcessUtils-D-78JZxz.js +23 -0
- package/dist/chunks/git-BZEgupMC.js +1 -0
- package/dist/chunks/git-DayFjsvj.js +6 -0
- package/dist/chunks/githubRepoPathMapping-C5RkiJWj.js +1 -0
- package/dist/chunks/goal-B6GHfd9J.js +3 -0
- package/dist/chunks/grok-DDM6xYuy.js +1 -0
- package/dist/chunks/growthbook-D-Po5Uxl.js +1 -0
- package/dist/chunks/heapdump-DHlUfpVV.js +5 -0
- package/dist/chunks/help-BulgC9m7.js +1 -0
- package/dist/chunks/hooks-D5AcFnD1.js +1 -0
- package/dist/chunks/hooks-jxIrev-X.js +79 -0
- package/dist/chunks/hostAdapter-BvraKy0o.js +1 -0
- package/dist/chunks/hostGuard-CWijeIyE.js +1 -0
- package/dist/chunks/ide-tx4qMFln.js +2 -0
- package/dist/chunks/inboundAttachments-C93Q7Dvt.js +1 -0
- package/dist/chunks/inboundAttachments-DxcFiX4f.js +1 -0
- package/dist/chunks/initReplBridge-BEldrf6f.js +1 -0
- package/dist/chunks/insights-HEsEDeCQ.js +822 -0
- package/dist/chunks/install-DRsM0bJO.js +1 -0
- package/dist/chunks/install-github-app-BVK5Z95c.js +147 -0
- package/dist/chunks/install-slack-app-DCw3O2J_.js +1 -0
- package/dist/chunks/instrumentation-DJ-R1s8C.js +12 -0
- package/dist/chunks/job-CUz_OGIq.js +2 -0
- package/dist/chunks/jwtUtils-DVyv2jab.js +1 -0
- package/dist/chunks/keybindings-Chr5nGBu.js +2 -0
- package/dist/chunks/lang-C7kJlPIh.js +1 -0
- package/dist/chunks/language-CQXwoDkI.js +1 -0
- package/dist/chunks/language-Lx3WlBN6.js +1 -0
- package/dist/chunks/launchAgentsPlatform-Fsslu42L.js +1 -0
- package/dist/chunks/launchAutofixPr-Cww8uS_5.js +18 -0
- package/dist/chunks/launchLocalMemory-BywmyvSJ.js +3 -0
- package/dist/chunks/launchLocalVault-BU3a5NV7.js +3 -0
- package/dist/chunks/launchMemoryStores-QUCODCJS.js +1 -0
- package/dist/chunks/launchOnboarding-BriZ0oIA.js +8 -0
- package/dist/chunks/launchSchedule-uLm7zt_B.js +1 -0
- package/dist/chunks/launchSkillStore-DMo2bV8X.js +1 -0
- package/dist/chunks/launchTeleport-DgQWSfXM.js +3 -0
- package/dist/chunks/launchVault-DfnBBFne.js +1 -0
- package/dist/chunks/loadAgentsDir-Br5fGLLI.js +4697 -0
- package/dist/chunks/loadAgentsDir-DDYPdQKP.js +1 -0
- package/dist/chunks/loadPluginHooks-C4soqr6g.js +1 -0
- package/dist/chunks/localSearch-CELyiWF6.js +1 -0
- package/dist/chunks/localSearch-DhZMcy5t.js +1 -0
- package/dist/chunks/log-DS97_rIr.js +1 -0
- package/dist/chunks/login-CvvIpkpq.js +1 -0
- package/dist/chunks/login-DjgITOAw.js +1 -0
- package/dist/chunks/logoV2Utils-BN_HrHSc.js +1 -0
- package/dist/chunks/logout-DOFJpZEJ.js +1 -0
- package/dist/chunks/magicDocs-2Zr7bYY_.js +57 -0
- package/dist/chunks/main-BafHJuKH.js +31 -0
- package/dist/chunks/main-D61CvHRy.js +1312 -0
- package/dist/chunks/mappers-BCiceNt3.js +1 -0
- package/dist/chunks/mcp-BV4m1Gbl.js +2 -0
- package/dist/chunks/mcp-CrAgAK9u.js +1 -0
- package/dist/chunks/mcp-DK4m73gO.js +6 -0
- package/dist/chunks/mcpServer-7zyXl9Wg.js +1 -0
- package/dist/chunks/mcpServer-sa9Z183j.js +1 -0
- package/dist/chunks/memoize-CPexXTP7.js +1 -0
- package/dist/chunks/memory-BrJPVgxn.js +1 -0
- package/dist/chunks/mode-Cr-NTlRa.js +2 -0
- package/dist/chunks/model-CCjuMV6k.js +1 -0
- package/dist/chunks/model-aJS_plgM.js +1 -0
- package/dist/chunks/onChangeAppState-C9EvI3EH.js +1 -0
- package/dist/chunks/openai-Cvb_-1A-.js +10 -0
- package/dist/chunks/overageCreditGrant-cGQilawd.js +1 -0
- package/dist/chunks/panel-DO_faHV-.js +1 -0
- package/dist/chunks/panelCall-DqZuxAf0.js +1 -0
- package/dist/chunks/parser-BXWr_mLL.js +1 -0
- package/dist/chunks/parser-DbKSpFRq.js +1 -0
- package/dist/chunks/passes-DsrceO14.js +1 -0
- package/dist/chunks/path-nCzt96pE.js +1 -0
- package/dist/chunks/paths-DfGsIjPm.js +39 -0
- package/dist/chunks/permissions-CjPIu4IE.js +3 -0
- package/dist/chunks/pipeTransport-C5u1K0wu.js +1 -0
- package/dist/chunks/plan-YjMAcn6g.js +1 -0
- package/dist/chunks/platform-DYZVoA9J.js +2 -0
- package/dist/chunks/plugin-Oux5bBQj.js +1 -0
- package/dist/chunks/pluginAutoupdate-Dl9U-fbk.js +1 -0
- package/dist/chunks/pluginBlocklist-BzI5DNeN.js +1 -0
- package/dist/chunks/pluginCliCommands-CExAcsaR.js +1 -0
- package/dist/chunks/pluginFlagging-BeqrbhgG.js +1 -0
- package/dist/chunks/pluginOperations-s0FQGOBm.js +2 -0
- package/dist/chunks/pluginStartupCheck-BVag9B-T.js +1 -0
- package/dist/chunks/pluginStartupCheck-BuorUEEf.js +1 -0
- package/dist/chunks/plugins-DTQHVJtY.js +4 -0
- package/dist/chunks/policyLimits-zoyF_6O4.js +1 -0
- package/dist/chunks/pollConfig-C19GiX7i.js +1 -0
- package/dist/chunks/poor-Bx5vvamq.js +1 -0
- package/dist/chunks/poorMode-BCoeB5zB.js +1 -0
- package/dist/chunks/poorMode-CTd_csCl.js +1 -0
- package/dist/chunks/print-UXl3rG8y.js +39 -0
- package/dist/chunks/privacy-settings-e43D9a4o.js +1 -0
- package/dist/chunks/processBashCommand-CvR9-gf8.js +1 -0
- package/dist/chunks/processSlashCommand-CB3wyAX7.js +6 -0
- package/dist/chunks/projectContext-D3_u80TY.js +1 -0
- package/dist/chunks/prompt-53lRY98R.js +1 -0
- package/dist/chunks/prompt-B8M-HLIS.js +227 -0
- package/dist/chunks/prompt-CooZNM1u.js +1 -0
- package/dist/chunks/promptEditor-CHiopfD7.js +4 -0
- package/dist/chunks/protocolHandler-DjivYn8H.js +13 -0
- package/dist/chunks/proxy-nPT6a6QY.js +99 -0
- package/dist/chunks/rate-limit-options-B-vndk5W.js +1 -0
- package/dist/chunks/rcDebugLog-BoroyfjB.js +11 -0
- package/dist/chunks/referral-DOqhciQu.js +1 -0
- package/dist/chunks/refresh-C8uLznwm.js +1 -0
- package/dist/chunks/registerProtocol-4lQ7O4Cc.js +36 -0
- package/dist/chunks/registry-q6v98JYd.js +1 -0
- package/dist/chunks/release-notes-C7JHshX3.js +4 -0
- package/dist/chunks/releaseNotes-CXY-xAja.js +2 -0
- package/dist/chunks/reload-plugins-DLS5lQcc.js +1 -0
- package/dist/chunks/remote-env-DhHea8yK.js +1 -0
- package/dist/chunks/remoteBridgeCore-BhOLhQIA.js +1 -0
- package/dist/chunks/remoteControlServer-CI0F83pg.js +3 -0
- package/dist/chunks/rename-DiKWWCzB.js +1 -0
- package/dist/chunks/renderOptions-DKe32LfM.js +1 -0
- package/dist/chunks/resume-DA4ToJFW.js +2 -0
- package/dist/chunks/runtimeObserver-BfVC8KK9.js +1 -0
- package/dist/chunks/runtimeObserver-DetZ5Tek.js +10 -0
- package/dist/chunks/sandbox-adapter-wh4cKN45.js +1 -0
- package/dist/chunks/sandbox-toggle-D8MgV0DT.js +1 -0
- package/dist/chunks/searchExtraTools-DbPpcAPw.js +1 -0
- package/dist/chunks/sentry-C3sL9nhF.js +13 -0
- package/dist/chunks/session-Bd-4QCqc.js +2 -0
- package/dist/chunks/sessionDiscovery-D_KPF86E.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-COne5L2E.js +1 -0
- package/dist/chunks/sessionMemory-0Jqo1_MV.js +1 -0
- package/dist/chunks/sessionMemory-BDt_8bNB.js +1 -0
- package/dist/chunks/sessionMemoryUtils-BFIJ1nqF.js +1 -0
- package/dist/chunks/sessionObserver-CEky1SLb.js +1 -0
- package/dist/chunks/sessionObserver-CQxIKV8D.js +20 -0
- package/dist/chunks/sessionStorage-D1XhqZyW.js +1 -0
- package/dist/chunks/sessionTitle-CB0ZEkS_.js +14 -0
- package/dist/chunks/sessionTracing-BIKXLTJZ.js +11 -0
- package/dist/chunks/settingsSync-pI3L3CeR.js +1 -0
- package/dist/chunks/setup-BSi50fkU.js +1 -0
- package/dist/chunks/setup-DjsmjRKQ.js +2 -0
- package/dist/chunks/setup-Dq0_SRA1.js +9 -0
- package/dist/chunks/shadowedRuleDetection-DvAjOOPL.js +1 -0
- package/dist/chunks/shellQuote-D8XPeqkc.js +1 -0
- package/dist/chunks/sideQuestion-BrTA8ooG.js +20 -0
- package/dist/chunks/sink-CqWxcRl9.js +1 -0
- package/dist/chunks/sink-Dkat5kH9.js +1 -0
- package/dist/chunks/sinks--frMI4-5.js +2 -0
- package/dist/chunks/sinks-CvPAVcMY.js +1 -0
- package/dist/chunks/skill-learning-2LV0yuwF.js +5 -0
- package/dist/chunks/skillChangeDetector-B5CGPl7e.js +1 -0
- package/dist/chunks/skillGapStore-Dc29T-OG.js +1 -0
- package/dist/chunks/skillGapStore-KzRf6Ezr.js +5 -0
- package/dist/chunks/skillGenerator-BdOHsgc4.js +8 -0
- package/dist/chunks/skillLearning-CdcVIG14.js +1 -0
- package/dist/chunks/skillLearning-DXWMxSA2.js +1 -0
- package/dist/chunks/skillPanel-zMY8o-86.js +28 -0
- package/dist/chunks/skillSearchPanel-l8aolUP8.js +21 -0
- package/dist/chunks/skills-BeMWJPup.js +1 -0
- package/dist/chunks/sprites-qel_EgTP.js +1 -0
- package/dist/chunks/startupProfiler-CnDpob1v.js +3 -0
- package/dist/chunks/startupProfiler-TrMfE6Q4.js +1 -0
- package/dist/chunks/stats-CEBfahqM.js +1 -0
- package/dist/chunks/status-C9KXyfDk.js +1 -0
- package/dist/chunks/statusNoticeHelpers-CxoN9oDh.js +1 -0
- package/dist/chunks/stickers-eHrGA1W5.js +1 -0
- package/dist/chunks/tag-Dvl7Us9y.js +11 -0
- package/dist/chunks/tasks-BhiwUF0n.js +1 -0
- package/dist/chunks/teamHelpers-COQazluD.js +1 -0
- package/dist/chunks/teamHelpers-Mgfrv-Jf.js +1 -0
- package/dist/chunks/teammateModeSnapshot-8EWjlA-s.js +1 -0
- package/dist/chunks/teammateModeSnapshot-BV-P8s5r.js +1 -0
- package/dist/chunks/teleport-U5Zgqw3H.js +1 -0
- package/dist/chunks/templateJobs-C3idypN_.js +12 -0
- package/dist/chunks/terminalSetup-CmAEgt-5.js +33 -0
- package/dist/chunks/terminalSetup-mvAN4no7.js +1 -0
- package/dist/chunks/theme-BD2H4vJi.js +1 -0
- package/dist/chunks/thinkback-BOByXYp2.js +1 -0
- package/dist/chunks/thinkback-Dzu2mnNF.js +1 -0
- package/dist/chunks/thinkback-play-BX1K2UMY.js +1 -0
- package/dist/chunks/tmux-DruHFjDy.js +1 -0
- package/dist/chunks/toolEventObserver-B6cLV_dK.js +1 -0
- package/dist/chunks/toolEventObserver-i6it3p2_.js +1 -0
- package/dist/chunks/toolPool--2gNFbrz.js +1 -0
- package/dist/chunks/toolPool-dNV2JxUI.js +1 -0
- package/dist/chunks/trustedDevice-DY8OosTr.js +1 -0
- package/dist/chunks/trustedDevice-zya_Ml1N.js +1 -0
- package/dist/chunks/tui-KoYD82tT.js +6 -0
- package/dist/chunks/types-D5R26wwH.js +17 -0
- package/dist/chunks/udsClient-RkYuzeZC.js +1 -0
- package/dist/chunks/ultrareviewCommand-CCkKby4J.js +3 -0
- package/dist/chunks/undercover-CIutVLEO.js +1 -0
- package/dist/chunks/undercover-D9O2McNG.js +31 -0
- package/dist/chunks/up-BPM85EYl.js +12 -0
- package/dist/chunks/updateCCB-Bmn3Y63Y.js +11 -0
- package/dist/chunks/upgrade-D3rVOeHO.js +1 -0
- package/dist/chunks/upgrade-Dq3l14ZY.js +1 -0
- package/dist/chunks/upload-1PmElPfW.js +1 -0
- package/dist/chunks/upstreamproxy-BBTSJnad.js +11 -0
- package/dist/chunks/usage-B5G8FOZ3.js +1 -0
- package/dist/chunks/usage-VtTu7beE.js +1 -0
- package/dist/chunks/useMainLoopModel-CaQLIr1V.js +1 -0
- package/dist/chunks/useManagePlugins-BvoeOnqq.js +1 -0
- package/dist/chunks/useMergedTools-C133BfRp.js +1 -0
- package/dist/chunks/useSearchInput-CROB7AbC.js +1 -0
- package/dist/chunks/useSettingsErrors-DRxtFXoe.js +1 -0
- package/dist/chunks/useVoice-BQ9aSFJe.js +1 -0
- package/dist/chunks/util-BZnJgF79.js +1 -0
- package/dist/chunks/utils-4gsxQpga.js +1 -0
- package/dist/chunks/validatePlugin-DlrnBhPA.js +1 -0
- package/dist/chunks/vim-BXQCLoFJ.js +1 -0
- package/dist/chunks/voice-CeRmLRHT.js +2 -0
- package/dist/chunks/voice-QHyDff3f.js +8 -0
- package/dist/chunks/voiceModeEnabled-Bq_rttkL.js +1 -0
- package/dist/chunks/voiceModeEnabled-CLAVCVLW.js +1 -0
- package/dist/chunks/voiceStreamSTT-BDKenO5F.js +1 -0
- package/dist/chunks/voiceStreamSTT-CL52x8wZ.js +1 -0
- package/dist/chunks/which-BnEnzWhs.js +1 -0
- package/dist/chunks/windowsPaths-43st5EQF.js +1 -0
- package/dist/chunks/windowsPaths-DerzGPcz.js +2 -0
- package/dist/chunks/workSecret-qRMNrQy2.js +1 -0
- package/dist/chunks/workerRegistry-BUD3lBk_.js +1 -0
- package/dist/chunks/worktree-C0f9Ke-R.js +1 -0
- package/dist/chunks/xml-DvVQHZ1N.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-BKIYdg96.js +0 -1
- package/dist/chunks/App-BAwWP3iN.js +0 -1
- package/dist/chunks/ApproveApiKey-CJFvgVKS.js +0 -1
- package/dist/chunks/ApproveApiKey-da08NX2f.js +0 -1
- package/dist/chunks/AssistantSessionChooser-DQMKGO_q.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-Jtiqm4k2.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-D7TJ4Qn1.js +0 -1
- package/dist/chunks/ClaudeInChromeOnboarding-CuPz5Xfi.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CRC6kEV1.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-J0uv5XzG.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-CE4OlAHo.js +0 -1
- package/dist/chunks/DesktopHandoff-B_vNnZS5.js +0 -1
- package/dist/chunks/DevChannelsDialog-kjRnWtNf.js +0 -1
- package/dist/chunks/DiffDialog-CSBWOnXJ.js +0 -3
- package/dist/chunks/Doctor-DhK599q8.js +0 -1
- package/dist/chunks/Doctor-VJ5ZGb8g.js +0 -3
- package/dist/chunks/ExitFlow-M5XPGBHL.js +0 -2
- package/dist/chunks/Feedback-FHvqI2bu.js +0 -2
- package/dist/chunks/Grove-68muTpx6.js +0 -1
- package/dist/chunks/Grove-BC2IZIhN.js +0 -11
- package/dist/chunks/HybridTransport-Df_FceV2.js +0 -4
- package/dist/chunks/ITermBackend-DkpK9X1H.js +0 -1
- package/dist/chunks/InvalidConfigDialog-Cm6Yvt00.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-Ai3D8AL1.js +0 -1
- package/dist/chunks/MCPConnectionManager-BqNXYQEr.js +0 -1
- package/dist/chunks/McpParsingWarnings-BZcVbGhE.js +0 -1
- package/dist/chunks/MessageSelector-BXOoEogr.js +0 -3
- package/dist/chunks/Messages-F6OIAv8C.js +0 -11
- package/dist/chunks/Onboarding-n1aA7tmN.js +0 -1
- package/dist/chunks/OverageCreditUpsell-Bt23I92r.js +0 -1
- package/dist/chunks/PluginSettings-Dgu23nzv.js +0 -17
- package/dist/chunks/PromptInputFooterSuggestions-uiV23aG4.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-D84vnNKM.js +0 -1
- package/dist/chunks/QueryEngine-CEodAvI2.js +0 -1
- package/dist/chunks/REPL-CTTa9BK0.js +0 -97
- package/dist/chunks/REPL-IO7wsKaQ.js +0 -1
- package/dist/chunks/RemoteCallout-BYKqws96.js +0 -1
- package/dist/chunks/RemoteSessionManager-Dq0W_fcj.js +0 -2
- package/dist/chunks/ResumeConversation-CxzeCdL8.js +0 -1
- package/dist/chunks/SSETransport-CJrrD1ln.js +0 -4
- package/dist/chunks/SearchExtraToolsTool-DI-36R5p.js +0 -1
- package/dist/chunks/SentryErrorBoundary-BKPxEWOf.js +0 -1
- package/dist/chunks/SentryErrorBoundary-CcI0kkLW.js +0 -2
- package/dist/chunks/Settings-CGcBR9CD.js +0 -2
- package/dist/chunks/TeleportProgress-C7muqjDw.js +0 -1
- package/dist/chunks/TeleportRepoMismatchDialog-B3pUiRc2.js +0 -1
- package/dist/chunks/TeleportResumeWrapper-ClyBQR3K.js +0 -1
- package/dist/chunks/ThemePicker-CGIB6YiW.js +0 -1
- package/dist/chunks/TmuxBackend-m2ldrneQ.js +0 -9
- package/dist/chunks/TrustDialog-o5kqmn6m.js +0 -1
- package/dist/chunks/ValidationErrorsList-D7bXMb0U.js +0 -2
- package/dist/chunks/WelcomeV2-Ckp3JPnA.js +0 -1
- package/dist/chunks/WindowsTerminalBackend-DsDqNWSP.js +0 -2
- package/dist/chunks/add-dir-DTP3NrLy.js +0 -1
- package/dist/chunks/agentDisplay-BEn43jMP.js +0 -1
- package/dist/chunks/agents-3ii2LyeQ.js +0 -2
- package/dist/chunks/agents-g0PDZl_l.js +0 -103
- package/dist/chunks/ant-PZvt_t1G.js +0 -1
- package/dist/chunks/api-BRckHGQ5.js +0 -1
- package/dist/chunks/api-DBvyymX6.js +0 -1
- package/dist/chunks/asciicast-C3nf97NR.js +0 -1
- package/dist/chunks/asciicast-DIsaWcsJ.js +0 -4
- package/dist/chunks/assistant-BBmaU8-A.js +0 -1
- package/dist/chunks/assistant-CMaN0QzY.js +0 -1
- package/dist/chunks/assistant-CVhvOfqJ.js +0 -1
- package/dist/chunks/auth-BXzbkJcE.js +0 -1
- package/dist/chunks/auth-Cud9tPJB.js +0 -1
- package/dist/chunks/autoMode-BREcJLYf.js +0 -45
- package/dist/chunks/autonomy-CuQizTZi.js +0 -1
- package/dist/chunks/autonomy-h9vver1r.js +0 -19
- package/dist/chunks/autonomyPanel-DVyrTxfP.js +0 -1
- package/dist/chunks/backgroundHousekeeping-DwA5WO9N.js +0 -1
- package/dist/chunks/backgroundHousekeeping-Ij_q7KN8.js +0 -17
- package/dist/chunks/banner-32EBTKI7.js +0 -2
- package/dist/chunks/bg-DK0E4ZtW.js +0 -9
- package/dist/chunks/bg-Dbh5z3Y8.js +0 -1
- package/dist/chunks/branch-B9AQFFTX.js +0 -3
- package/dist/chunks/bridge-BkL7g0ua.js +0 -2
- package/dist/chunks/bridgeConfig-BPP3lJRh.js +0 -1
- package/dist/chunks/bridgeConfig-BZQBBfap.js +0 -1
- package/dist/chunks/bridgeEnabled-Bkmqv-2V.js +0 -1
- package/dist/chunks/bridgeEnabled-BwBjPmEE.js +0 -1
- package/dist/chunks/bridgeMain-CbGj0plH.js +0 -68
- package/dist/chunks/bridgeMain-DpQRGiMo.js +0 -1
- package/dist/chunks/bridgeMessaging-C-ZFPTiZ.js +0 -1
- package/dist/chunks/bridgePointer-B2FPGDWR.js +0 -1
- package/dist/chunks/browser-fLRXxIsQ.js +0 -1
- package/dist/chunks/btw-BSme4Kzi.js +0 -1
- package/dist/chunks/buddy-DX94yYTy.js +0 -3
- package/dist/chunks/bypassPermissionsKillswitch-Crl2aipx.js +0 -1
- package/dist/chunks/caches-DeXmHls9.js +0 -3
- package/dist/chunks/caches-U1iFQIc7.js +0 -1
- package/dist/chunks/ccrClient-BYD1ONzC.js +0 -1
- package/dist/chunks/changeDetector-PaQPe1HQ.js +0 -1
- package/dist/chunks/channelNotification-Aq0p9f-W.js +0 -1
- package/dist/chunks/channelNotification-B0QskFjB.js +0 -1
- package/dist/chunks/chrome-B8ByN3u6.js +0 -1
- package/dist/chunks/chromeNativeHost-DX8f9Y2L.js +0 -1
- package/dist/chunks/claudeDesktop-C1qQs6os.js +0 -1
- package/dist/chunks/cleanup-Pv6U3HiI.js +0 -1
- package/dist/chunks/clear-CeJ5tgg8.js +0 -1
- package/dist/chunks/cliLaunch-BQa48gsr.js +0 -1
- package/dist/chunks/client-B7AdqRap.js +0 -1
- package/dist/chunks/color-OlMWmMnJ.js +0 -1
- package/dist/chunks/commands-BwfOl3fk.js +0 -1
- package/dist/chunks/commitAttribution-C479aqmn.js +0 -2
- package/dist/chunks/commitAttribution-CZ1OOh8F.js +0 -1
- package/dist/chunks/common-B379wT22.js +0 -1
- package/dist/chunks/common-B_BC3eMY.js +0 -1
- package/dist/chunks/common-CMCv4N_v.js +0 -1
- package/dist/chunks/compact-Dq-J7j1C.js +0 -3
- package/dist/chunks/companion-CtJjyD3N.js +0 -1
- package/dist/chunks/completionCache-DHfUBBMH.js +0 -1
- package/dist/chunks/completionCache-DORrtxkS.js +0 -4
- package/dist/chunks/computerUseLock-BjoDJH2h.js +0 -1
- package/dist/chunks/config-DcnYYwCy.js +0 -1
- package/dist/chunks/config-_KcvL7RX.js +0 -1
- package/dist/chunks/context-CShSBp-i.js +0 -1
- package/dist/chunks/context-noninteractive-BApFNncX.js +0 -54
- package/dist/chunks/context-noninteractive-uMvPKhng.js +0 -1
- package/dist/chunks/conversation-BlUHkj1_.js +0 -1
- package/dist/chunks/conversation-CCzL-eYb.js +0 -1
- package/dist/chunks/copy-DIMR3Q3S.js +0 -7
- package/dist/chunks/createSSHSession-DvSnUdsD.js +0 -6
- package/dist/chunks/createSession-D8tcktmP.js +0 -1
- package/dist/chunks/createSession-DaT4x1E6.js +0 -1
- package/dist/chunks/cronJitterConfig-C2a-Ybqm.js +0 -6
- package/dist/chunks/crossProjectResume-B3Chhiwf.js +0 -40
- package/dist/chunks/daemon-CCtZ9wY3.js +0 -2
- package/dist/chunks/datadog-BYNSi8R3.js +0 -1
- package/dist/chunks/datadog-DCukMGn4.js +0 -1
- package/dist/chunks/debug-DM5ezCBS.js +0 -1
- package/dist/chunks/debug-UI3T040K.js +0 -5
- package/dist/chunks/debugUtils-BBMFODKH.js +0 -1
- package/dist/chunks/desktop-BXj3JEMV.js +0 -1
- package/dist/chunks/detached-D300jlhj.js +0 -5
- package/dist/chunks/detectRepository-CBk3S2zv.js +0 -1
- package/dist/chunks/detectRepository-DCTvg4p0.js +0 -1
- package/dist/chunks/detection-CQsNad64.js +0 -1
- package/dist/chunks/detection-DJ-vTbBf.js +0 -1
- package/dist/chunks/diff-D3Xuv_4J.js +0 -1
- package/dist/chunks/directoryCompletion-D7EGwonO.js +0 -1
- package/dist/chunks/doctor-B5-jh6lS.js +0 -1
- package/dist/chunks/earlyInput-RoVleNEN.js +0 -1
- package/dist/chunks/effort-CpHnXRxJ.js +0 -9
- package/dist/chunks/entry-YXnIL7B7.js +0 -14
- package/dist/chunks/env-chR0gV31.js +0 -1
- package/dist/chunks/envLessBridgeConfig-CcgSiwvA.js +0 -1
- package/dist/chunks/envLessBridgeConfig-MaElAFPV.js +0 -1
- package/dist/chunks/escHotkey-Cyz0yyh1.js +0 -259
- package/dist/chunks/execFileNoThrow-CuQN1sz8.js +0 -1
- package/dist/chunks/execSyncWrapper-C2XQnFVo.js +0 -1
- package/dist/chunks/executor-4EeD8GNm.js +0 -1561
- package/dist/chunks/executor-BHEuNh5F.js +0 -1
- package/dist/chunks/exit-DKG0r57m.js +0 -1
- package/dist/chunks/export-BNbcpW3p.js +0 -2
- package/dist/chunks/exportRenderer-pYMIcnO4.js +0 -1
- package/dist/chunks/extra-usage-DTXphHAD.js +0 -1
- package/dist/chunks/extra-usage-H-U38bGx.js +0 -1
- package/dist/chunks/extra-usage-core-N4VLj0ye.js +0 -1
- package/dist/chunks/extra-usage-noninteractive-BGUiGr3a.js +0 -1
- package/dist/chunks/extraUsage-X6CmSsdg.js +0 -1
- package/dist/chunks/extractMemories-C8R4DJVc.js +0 -1
- package/dist/chunks/fast-BJwQnvAP.js +0 -1
- package/dist/chunks/fast-DMkPYQmQ.js +0 -1
- package/dist/chunks/feedback-DLcYu4id.js +0 -1
- package/dist/chunks/firstPartyEventLogger-C00GfHTl.js +0 -1
- package/dist/chunks/flushGate-0DZFLUEb.js +0 -1
- package/dist/chunks/gates-DP4JyL5e.js +0 -1
- package/dist/chunks/gates-DeLWne9R.js +0 -1
- package/dist/chunks/gemini-CnKaXUJJ.js +0 -1
- package/dist/chunks/generateRecap-BUS2DEdj.js +0 -1
- package/dist/chunks/generateSessionName-CnPPgvyy.js +0 -1
- package/dist/chunks/genericProcessUtils-BGvcwuPt.js +0 -23
- package/dist/chunks/git-CN3qtTb_.js +0 -6
- package/dist/chunks/git-D23Mzu_K.js +0 -1
- package/dist/chunks/githubRepoPathMapping-CnXpQRPY.js +0 -1
- package/dist/chunks/grok-C2BUbWJR.js +0 -1
- package/dist/chunks/growthbook-CPTqwUyC.js +0 -1
- package/dist/chunks/heapdump-pamjtM2a.js +0 -5
- package/dist/chunks/help-z7XnNKDT.js +0 -1
- package/dist/chunks/hooks-BEAaBqmd.js +0 -1
- package/dist/chunks/hooks-iTfSDH96.js +0 -79
- package/dist/chunks/hostAdapter-DWD430of.js +0 -1
- package/dist/chunks/hostGuard-zim_4F9V.js +0 -1
- package/dist/chunks/ide-BK8Td_CD.js +0 -2
- package/dist/chunks/inboundAttachments-DQ4Czsr5.js +0 -1
- package/dist/chunks/inboundAttachments-Dq3IYudc.js +0 -1
- package/dist/chunks/initReplBridge-BeGirV3Q.js +0 -1
- package/dist/chunks/insights-DfD6PMkd.js +0 -822
- package/dist/chunks/install-CNq--Fit.js +0 -1
- package/dist/chunks/install-github-app-Dhq_T_EJ.js +0 -147
- package/dist/chunks/install-slack-app-mz5O3xo_.js +0 -1
- package/dist/chunks/instrumentation-CM0poWjx.js +0 -12
- package/dist/chunks/job-CKI1I_Va.js +0 -2
- package/dist/chunks/jwtUtils-CpXwh_du.js +0 -1
- package/dist/chunks/keybindings-5qahtcNc.js +0 -2
- package/dist/chunks/lang-BMNwfSRv.js +0 -1
- package/dist/chunks/language-DXpi4083.js +0 -1
- package/dist/chunks/language-GlWQb4l9.js +0 -1
- package/dist/chunks/launchAgentsPlatform-BU4bAPan.js +0 -1
- package/dist/chunks/launchAutofixPr-B80p6iq-.js +0 -18
- package/dist/chunks/launchLocalMemory-CDAa9B30.js +0 -3
- package/dist/chunks/launchLocalVault-B19lF8tP.js +0 -3
- package/dist/chunks/launchMemoryStores-C6wJI-8V.js +0 -1
- package/dist/chunks/launchOnboarding-BIlwEdkk.js +0 -8
- package/dist/chunks/launchSchedule-DjMh3--x.js +0 -1
- package/dist/chunks/launchSkillStore-Bs5thijU.js +0 -1
- package/dist/chunks/launchTeleport-CDlWx4xC.js +0 -3
- package/dist/chunks/launchVault-C40NAyOp.js +0 -1
- package/dist/chunks/loadAgentsDir-BYqiLHDS.js +0 -1
- package/dist/chunks/loadAgentsDir-C9Ee_fs1.js +0 -4672
- package/dist/chunks/loadPluginHooks-DaETszNq.js +0 -1
- package/dist/chunks/localSearch-B3zijtEM.js +0 -1
- package/dist/chunks/localSearch-BTGnGPVi.js +0 -1
- package/dist/chunks/log-CzsijfHZ.js +0 -1
- package/dist/chunks/login-B3IQj5YQ.js +0 -1
- package/dist/chunks/login-CUM0odSh.js +0 -1
- package/dist/chunks/logoV2Utils-CW73xjcW.js +0 -1
- package/dist/chunks/logout-B3hPrJSX.js +0 -1
- package/dist/chunks/magicDocs-BysWdjbO.js +0 -57
- package/dist/chunks/main-CnAyCMYQ.js +0 -1108
- package/dist/chunks/main-D9fUXJiD.js +0 -31
- package/dist/chunks/mappers-D1SAyuKF.js +0 -1
- package/dist/chunks/mcp-BIiXcANN.js +0 -1
- package/dist/chunks/mcp-BLcZi9zs.js +0 -2
- package/dist/chunks/mcp-nOKz2_By.js +0 -6
- package/dist/chunks/mcpServer-CJOTyq3O.js +0 -1
- package/dist/chunks/mcpServer-DaiouIKs.js +0 -1
- package/dist/chunks/memoize-DxwLawI2.js +0 -1
- package/dist/chunks/memory-DtFuXZHl.js +0 -1
- package/dist/chunks/mode-BPNUYCpk.js +0 -2
- package/dist/chunks/model-Cky6xlFt.js +0 -1
- package/dist/chunks/model-DC5bOhtE.js +0 -1
- package/dist/chunks/onChangeAppState-pafR88Yw.js +0 -1
- package/dist/chunks/openai-BOxlfR-k.js +0 -10
- package/dist/chunks/overageCreditGrant-BmmOYjTh.js +0 -1
- package/dist/chunks/panel-s9fbCKfl.js +0 -1
- package/dist/chunks/parser-CmngCwjB.js +0 -1
- package/dist/chunks/parser-SWIZo39J.js +0 -1
- package/dist/chunks/passes-CqiFdifM.js +0 -1
- package/dist/chunks/path-B3lx7yHn.js +0 -1
- package/dist/chunks/paths-C2JRlUsH.js +0 -39
- package/dist/chunks/permissions-BHJUxNga.js +0 -3
- package/dist/chunks/pipeTransport-BTYiqf9e.js +0 -1
- package/dist/chunks/plan-CF_ClJlj.js +0 -1
- package/dist/chunks/platform-CuyedWpe.js +0 -2
- package/dist/chunks/plugin-Bz3RKbru.js +0 -1
- package/dist/chunks/pluginAutoupdate-Ck0wWoNE.js +0 -1
- package/dist/chunks/pluginBlocklist-7dlesHcW.js +0 -1
- package/dist/chunks/pluginCliCommands-D502zE25.js +0 -1
- package/dist/chunks/pluginFlagging-DfHARfd-.js +0 -1
- package/dist/chunks/pluginOperations-BBRf8tuH.js +0 -2
- package/dist/chunks/pluginStartupCheck-BKEhWQR2.js +0 -1
- package/dist/chunks/pluginStartupCheck-ZcaocOSL.js +0 -1
- package/dist/chunks/plugins-JnZ3lNqG.js +0 -4
- package/dist/chunks/policyLimits-CtOjYdHx.js +0 -1
- package/dist/chunks/pollConfig-Duecunu0.js +0 -1
- package/dist/chunks/poor-CUwZAV9z.js +0 -1
- package/dist/chunks/poorMode-DOoZ0U-8.js +0 -1
- package/dist/chunks/poorMode-DRcH1fuh.js +0 -1
- package/dist/chunks/print-D9IhN66j.js +0 -39
- package/dist/chunks/privacy-settings-DmbuvR-R.js +0 -1
- package/dist/chunks/processBashCommand-Cg8we9vS.js +0 -1
- package/dist/chunks/processSlashCommand-BBQQEGZd.js +0 -6
- package/dist/chunks/projectContext-D5FgyE-d.js +0 -1
- package/dist/chunks/prompt-7Vt8FUX_.js +0 -1
- package/dist/chunks/prompt-Cj0hg3CU.js +0 -1
- package/dist/chunks/prompt-thBQB2X5.js +0 -222
- package/dist/chunks/promptEditor-C8B2TEXp.js +0 -4
- package/dist/chunks/protocolHandler-BUKWgksO.js +0 -13
- package/dist/chunks/proxy-CfZp-wce.js +0 -99
- package/dist/chunks/rate-limit-options-PruvKAQt.js +0 -1
- package/dist/chunks/rcDebugLog-CIS3PU-H.js +0 -11
- package/dist/chunks/referral-CXmDvb7V.js +0 -1
- package/dist/chunks/refresh-C_FDHRT7.js +0 -1
- package/dist/chunks/registerProtocol-WxQUBybC.js +0 -36
- package/dist/chunks/registry-CeBTik9J.js +0 -1
- package/dist/chunks/release-notes-aZ6QUVnT.js +0 -4
- package/dist/chunks/releaseNotes-2GPd_O_r.js +0 -2
- package/dist/chunks/reload-plugins-BDh4ZhHi.js +0 -1
- package/dist/chunks/remote-env-BIOFHNQC.js +0 -1
- package/dist/chunks/remoteBridgeCore-DyA_2GrL.js +0 -1
- package/dist/chunks/remoteControlServer-BjW9GsPd.js +0 -3
- package/dist/chunks/rename-CKlAeppY.js +0 -1
- package/dist/chunks/renderOptions-rmj4Mkls.js +0 -1
- package/dist/chunks/resume-Dm71Aeni.js +0 -2
- package/dist/chunks/runtimeObserver-BYOo5dT0.js +0 -1
- package/dist/chunks/runtimeObserver-CA7pdBvT.js +0 -10
- package/dist/chunks/sandbox-adapter-C7TBAehE.js +0 -1
- package/dist/chunks/sandbox-toggle-fHc9E9xW.js +0 -1
- package/dist/chunks/searchExtraTools-CpFsg_tS.js +0 -1
- package/dist/chunks/sentry-B1g5Tgp2.js +0 -13
- package/dist/chunks/session-C46oy7nX.js +0 -2
- package/dist/chunks/sessionDiscovery-CtrJ2Bfr.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-dwF5SFoS.js +0 -1
- package/dist/chunks/sessionMemory-BqCsLnFl.js +0 -1
- package/dist/chunks/sessionMemory-D4-Ymn0Q.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BKdYMir6.js +0 -1
- package/dist/chunks/sessionObserver-Bfu8q0_K.js +0 -1
- package/dist/chunks/sessionObserver-DoBuLaCJ.js +0 -20
- package/dist/chunks/sessionStorage-CUUU_J4D.js +0 -1
- package/dist/chunks/sessionTitle-BOM0LQlq.js +0 -14
- package/dist/chunks/sessionTracing-BEKULg2L.js +0 -11
- package/dist/chunks/settingsSync-BIsGiZhM.js +0 -1
- package/dist/chunks/setup-C3FOTg1s.js +0 -1
- package/dist/chunks/setup-ChF37I92.js +0 -9
- package/dist/chunks/setup-DvFPFV-3.js +0 -2
- package/dist/chunks/shadowedRuleDetection-spwhhTXF.js +0 -1
- package/dist/chunks/shellQuote-DgjT8KBA.js +0 -1
- package/dist/chunks/sideQuestion-iy7kJEkr.js +0 -20
- package/dist/chunks/sink-D6dxOYIw.js +0 -1
- package/dist/chunks/sink-FeQonv8-.js +0 -1
- package/dist/chunks/sinks-DKMqKJ66.js +0 -1
- package/dist/chunks/sinks-zNh_PVeS.js +0 -2
- package/dist/chunks/skill-learning-ChAFwJf0.js +0 -5
- package/dist/chunks/skillChangeDetector-8LVraP0Y.js +0 -1
- package/dist/chunks/skillGapStore-CUws9CQ6.js +0 -5
- package/dist/chunks/skillGapStore-CdPgIARS.js +0 -1
- package/dist/chunks/skillGenerator-CLtTRIjy.js +0 -8
- package/dist/chunks/skillLearning-CBosoKl-.js +0 -1
- package/dist/chunks/skillLearning-f7-aknmS.js +0 -1
- package/dist/chunks/skillPanel-Cd0AFEZf.js +0 -28
- package/dist/chunks/skillSearchPanel-VWiAbmdr.js +0 -21
- package/dist/chunks/skills-oQtI4eDn.js +0 -1
- package/dist/chunks/sprites-Cp4_DJUI.js +0 -1
- package/dist/chunks/startupProfiler-DnXZaX4A.js +0 -3
- package/dist/chunks/startupProfiler-SOE--nM9.js +0 -1
- package/dist/chunks/stats-B1X-nxO8.js +0 -1
- package/dist/chunks/status-BtCnWZEv.js +0 -1
- package/dist/chunks/statusNoticeHelpers-B6GW2gMe.js +0 -1
- package/dist/chunks/stickers-BMh2qjgF.js +0 -1
- package/dist/chunks/tag-B6WpuUE_.js +0 -11
- package/dist/chunks/tasks-DIOPZDoF.js +0 -1
- package/dist/chunks/teamHelpers-9p7wPcXj.js +0 -1
- package/dist/chunks/teamHelpers-PLGwYL4x.js +0 -1
- package/dist/chunks/teammateModeSnapshot-DO-3AkNP.js +0 -1
- package/dist/chunks/teammateModeSnapshot-DU8JCRRs.js +0 -1
- package/dist/chunks/teleport-DPUoWpD4.js +0 -1
- package/dist/chunks/templateJobs-DOSQvjx0.js +0 -12
- package/dist/chunks/terminalSetup-DdHkyElj.js +0 -33
- package/dist/chunks/terminalSetup-tSFJeCVl.js +0 -1
- package/dist/chunks/theme-Hf1fhR3q.js +0 -1
- package/dist/chunks/thinkback-5QYAbr0P.js +0 -1
- package/dist/chunks/thinkback-B5IraP81.js +0 -1
- package/dist/chunks/thinkback-play-Bqv85sjY.js +0 -1
- package/dist/chunks/tmux-CvbhsfwG.js +0 -1
- package/dist/chunks/toolEventObserver-B-mqmRv0.js +0 -1
- package/dist/chunks/toolEventObserver-_Fk1dSYg.js +0 -1
- package/dist/chunks/toolPool-C2KLBvek.js +0 -1
- package/dist/chunks/toolPool-CiEaFfxq.js +0 -1
- package/dist/chunks/trustedDevice-BowIKqqC.js +0 -1
- package/dist/chunks/trustedDevice-f8HslQu2.js +0 -1
- package/dist/chunks/tui-geoc3zxu.js +0 -6
- package/dist/chunks/types-Csi32ZXh.js +0 -17
- package/dist/chunks/udsClient-BdPOrL1H.js +0 -1
- package/dist/chunks/ultrareviewCommand-DbmRN6Lg.js +0 -3
- package/dist/chunks/undercover-Ch9wnIbk.js +0 -31
- package/dist/chunks/undercover-X6-EJ_7K.js +0 -1
- package/dist/chunks/up-D-U4wUCe.js +0 -12
- package/dist/chunks/updateCCB-DFHrOTEX.js +0 -11
- package/dist/chunks/upgrade-B6Ih-Ubj.js +0 -1
- package/dist/chunks/upgrade-CC4cnsnt.js +0 -1
- package/dist/chunks/upload-DSTB33ZR.js +0 -1
- package/dist/chunks/upstreamproxy-Ci5T_JCo.js +0 -11
- package/dist/chunks/usage-CNqpSfd2.js +0 -1
- package/dist/chunks/usage-DiZsjcMM.js +0 -1
- package/dist/chunks/useMainLoopModel-Bo6iEtB3.js +0 -1
- package/dist/chunks/useManagePlugins-Cvj0XfLp.js +0 -1
- package/dist/chunks/useMergedTools-BEpwy0Ec.js +0 -1
- package/dist/chunks/useSearchInput-YiO4crrI.js +0 -1
- package/dist/chunks/useSettingsErrors-BE-PITl4.js +0 -1
- package/dist/chunks/useVoice-D1sKPiqb.js +0 -1
- package/dist/chunks/util-C8_5375U.js +0 -1
- package/dist/chunks/utils-Dmh9vBcg.js +0 -1
- package/dist/chunks/validatePlugin-BQA60S_J.js +0 -1
- package/dist/chunks/vim-oNiLgw0C.js +0 -1
- package/dist/chunks/voice-BcA5h8ya.js +0 -8
- package/dist/chunks/voice-CGsMzVaA.js +0 -2
- package/dist/chunks/voiceModeEnabled-DprM_JSH.js +0 -1
- package/dist/chunks/voiceModeEnabled-Dpx-sP8V.js +0 -1
- package/dist/chunks/voiceStreamSTT-CASv4SGl.js +0 -1
- package/dist/chunks/voiceStreamSTT-CaI5Uz-7.js +0 -1
- package/dist/chunks/which-DqSAIvp2.js +0 -1
- package/dist/chunks/windowsPaths-C9CigqoF.js +0 -1
- package/dist/chunks/windowsPaths-swxCp7bX.js +0 -2
- package/dist/chunks/workSecret-mS2OrpxF.js +0 -1
- package/dist/chunks/workerRegistry-CCYrYthd.js +0 -1
- package/dist/chunks/worktree-C9WNXNFR.js +0 -1
- package/dist/chunks/xml-BW5T-oW-.js +0 -1
- /package/dist/chunks/{InProcessTransport-gJLr5CIx.js → InProcessTransport-B0mmAoxw.js} +0 -0
- /package/dist/chunks/{attributionHooks-Br5LZ6bk.js → attributionHooks-DZJjA8p9.js} +0 -0
- /package/dist/chunks/{attributionTrailer-BMTuK4Ax.js → attributionTrailer-CZY9XTcr.js} +0 -0
- /package/dist/chunks/{autoModeDenials-D8eQ1CoM.js → autoModeDenials-CGAtAGGf.js} +0 -0
- /package/dist/chunks/{bedrockClient-Ci523Btx.js → bedrockClient-DZgaJTHp.js} +0 -0
- /package/dist/chunks/{ccshareResume-CqNm2k-J.js → ccshareResume-CZggHNOf.js} +0 -0
- /package/dist/chunks/{connectHeadless-DFCrE6O4.js → connectHeadless-KNT0Sg7Z.js} +0 -0
- /package/dist/chunks/{dangerousBackend-Du0K4q5Z.js → dangerousBackend-ByOAEFld.js} +0 -0
- /package/dist/chunks/{earlyInput-feVuZGzR.js → earlyInput-BFcdUMaX.js} +0 -0
- /package/dist/chunks/{eventLoopStallDetector-XfubcyMN.js → eventLoopStallDetector-l83_98VR.js} +0 -0
- /package/dist/chunks/{fpsMetrics-CEQt6Tk1.js → fpsMetrics-DOI_SIeY.js} +0 -0
- /package/dist/chunks/{fuse-TM-TeOo_.js → fuse-Bp7rmZ5x.js} +0 -0
- /package/dist/chunks/{instinctParser-CJPM8VjX.js → instinctParser-Bxhe2LOF.js} +0 -0
- /package/dist/chunks/{lockfile-Y1hwdHrQ.js → lockfile-CeCEBLtN.js} +0 -0
- /package/dist/chunks/{mobile-umu5P0cM.js → mobile-Cydobb55.js} +0 -0
- /package/dist/chunks/{observationStore-gFvWXJmc.js → observationStore-BaPq7CKI.js} +0 -0
- /package/dist/chunks/{openaiShared-Dy78YERG.js → openaiShared-Crt0cZLO.js} +0 -0
- /package/dist/chunks/{output-style-BmEQscMd.js → output-style-BkOnFmfe.js} +0 -0
- /package/dist/chunks/{parseConnectUrl-C6cvMkkH.js → parseConnectUrl-BFNiff4c.js} +0 -0
- /package/dist/chunks/{poller-Dbo07OEA.js → poller-DADqVTWi.js} +0 -0
- /package/dist/chunks/{postCommitAttribution-DhFkZMxJ.js → postCommitAttribution-CA9Z2sqn.js} +0 -0
- /package/dist/chunks/{projectContext-iWPqcl0Z.js → projectContext-CwJlxP2Y.js} +0 -0
- /package/dist/chunks/{rewind-DAn-nNs-.js → rewind-DTk4TFYB.js} +0 -0
- /package/dist/chunks/{sanitization-JYRkZFrK.js → sanitization-DD414_3t.js} +0 -0
- /package/dist/chunks/{sdkHeapDumpMonitor-DKtfJW5o.js → sdkHeapDumpMonitor-fNRF2fbK.js} +0 -0
- /package/dist/chunks/{server-CswFAYwN.js → server-DTd90dmm.js} +0 -0
- /package/dist/chunks/{serverBanner-CImTYGhY.js → serverBanner-B7UaaCCl.js} +0 -0
- /package/dist/chunks/{serverLog-Bwt7XEmk.js → serverLog-DRvGpDtt.js} +0 -0
- /package/dist/chunks/{sessionDataUploader-CKRXCBxI.js → sessionDataUploader-BDsz_1Uy.js} +0 -0
- /package/dist/chunks/{sessionManager-Ca2O821f.js → sessionManager-Bh-Z-YXy.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./context-noninteractive-BApFNncX.js";t();export{n as call,e as collectContextData};
|
|
@@ -1 +0,0 @@
|
|
|
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 ee,qn as c,yn as l}from"./state-sIHsFpDu.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{o as f,s as p}from"./log-CzsijfHZ.js";import{$t as m,Au as h,Cn as g,EE as _,Fn as v,Gm as y,Gv as b,H_ as x,In as S,Km as C,Mv as w,Nn as T,Nv as E,Oi as D,Ot as O,Pr as k,Qv as A,Ti as j,Tt as M,V_ as N,_E as P,cb as F,cd as I,gr as L,hi as R,ju as z,lb as B,ld as V,mn as H,or as U,vE as W,wE as G}from"./loadAgentsDir-C9Ee_fs1.js";import{C as K,y as q}from"./rcDebugLog-CIS3PU-H.js";import{l as J,r as Y}from"./commitAttribution-C479aqmn.js";import{n as X,t as Z}from"./caches-DeXmHls9.js";import{randomUUID as Q}from"crypto";function $(){let e=I();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:u,loadedNestedMemoryPaths:f,getAppState:h,setAppState:g,setConversationId:_}){let y=H();await m(`clear`,{getAppState:h,setAppState:g,signal:AbortSignal.timeout(y),timeoutMs:y});let S=a();S&&d(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:S});let w=new Set,O=[],A=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(h)for(let e of Object.values(h().tasks))A(e)||(z(e)?(w.add(e.agentId),O.push(e)):B(e)&&w.add(e.identity.agentId));t(()=>[]),$();{let{setContextBlocked:t}=(q(),e(K));t(!1)}_&&_(Q()),Z(w),c(null),r(null),i(null),l(),C(ee()),o.clear(),u?.clear(),f?.clear(),g&&g(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!A(r)){t[n]=r;continue}try{r.status===`running`&&(x(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){p(e)}T(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}}}),b(),U(),s({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=n()),await R();for(let e of O)e.status===`running`&&v(e.id,L(G(e.agentId)));{let{saveMode:t}=(k(),e(D)),{isCoordinatorMode:n}=(W(),e(P));t(n()?`coordinator`:`normal`)}let N=M();N&&j(N);let F=await E(`clear`);F.length>0&&t(()=>F)}var ne=t((()=>{V(),o(),u(),F(),h(),N(),_(),J(),g(),f(),A(),y(),w(),k(),S(),O(),X()}));export{ne as n,te as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./conversation-BlUHkj1_.js";e();export{t as clearConversation};
|
|
@@ -1,7 +0,0 @@
|
|
|
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-C2JRlUsH.js";import{n as _,r as v}from"./analytics-DqMQntaB.js";import{Do as y,Fk as b,Lx as x,Pk as S,Rx as C,Vo as w,es as T}from"./loadAgentsDir-C9Ee_fs1.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=S.lexer(T(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)(x,{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((()=>{b(),L=t(r(),1),C(),c(),_(),f(),w(),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};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{Jt as n,on as r}from"./paths-C2JRlUsH.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,n,r}from"./createSession-DaT4x1E6.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
|
|
@@ -1 +0,0 @@
|
|
|
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-Cud9tPJB.js`),{getOrganizationUUID:p}=await import(`./client-B7AdqRap.js`),{getOauthConfig:m}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:h}=await import(`./api-DBvyymX6.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DCTvg4p0.js`),{getDefaultBranch:_}=await import(`./git-D23Mzu_K.js`),{getMainLoopModel:v}=await import(`./model-Cky6xlFt.js`),{default:y}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-BPP3lJRh.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-Cud9tPJB.js`),{getOrganizationUUID:a}=await import(`./client-B7AdqRap.js`),{getOauthConfig:o}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:c}=await import(`./api-DBvyymX6.js`),{default:l}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-BPP3lJRh.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-Cud9tPJB.js`),{getOrganizationUUID:i}=await import(`./client-B7AdqRap.js`),{getOauthConfig:a}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:o}=await import(`./api-DBvyymX6.js`),{default:c}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-BPP3lJRh.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-Cud9tPJB.js`),{getOrganizationUUID:c}=await import(`./client-B7AdqRap.js`),{getOauthConfig:l}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:u}=await import(`./api-DBvyymX6.js`),{default:d}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-BPP3lJRh.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};
|
|
@@ -1,6 +0,0 @@
|
|
|
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-C2JRlUsH.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{An as De,Cg as Oe,Cn as ke,G as Ae,Gs as je,K as Me,Ks as Ne,Sg as Pe,Tg as Fe,UD as Ie,UO as Le,Vs as Re,WD as ze,WO as Be,_g as Ve,af as He,bg as Ue,cg as We,dD as P,dg as Ge,fg as Ke,fu as qe,gD as F,gg as Je,hg as I,kn as Ye,lg as Xe,mD as L,mg as Ze,of as Qe,pg as $e,pu as et,qt as tt,ug as R,vg as nt,wg as rt,xg as it,yg as at,zs as ot}from"./loadAgentsDir-C9Ee_fs1.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-thBQB2X5.js";import{n as ht,r as gt}from"./cron-DiW7eIPP.js";import{d as _t,h as vt}from"./rcDebugLog-CIS3PU-H.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(),Fe();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(Ke(),s(Ot())).optional(),sdkMcpServers:s(a()).optional(),jsonSchema:o(a(),c()).optional(),systemPrompt:a().optional(),appendSystemPrompt:a().optional(),agents:o(a(),Xe()).optional(),promptSuggestions:u().optional(),agentProgressSummaries:u().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));M(()=>m({commands:s(rt()),agents:s(R()),output_style:a(),available_output_styles:s(a()),models:s(Je()),account:We(),pid:i().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:Ge().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(nt()).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:Ve(),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(I())}).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:$e(),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(),Ze())}).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(rt()),agents:s(R()),plugins:s(m({name:a(),path:a(),source:a().optional()})),mcpServers:s(I()),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([at(),it(),Pe(),Ue(),nn(),U(),rn(),an()])),M(()=>l([Oe(),U(),nn(),an(),on()])),n(),y(),pe(),E(),k(),ge(),ye(),De(),_(),O(),N(),L(),He(),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:P(e.toolPermissionContext,t)})),F(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(),Ie(),_t(),et(),ke(),Me();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(),_(),L();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 qe),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&&ze(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 Ae(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},Ye(),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=tt(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){F(i);let e=P(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`}}}}Be();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:Le(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(),je();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=Re();if(Object.keys(t).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let n;try{n=await Ne()}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 ot(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};
|
|
@@ -1,40 +0,0 @@
|
|
|
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-C2JRlUsH.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{Ey as me,Ii as he,Ir as ge,Li as _e,Lx as ve,Or as j,Pr as ye,Rr as M,Rx as be,Ux as xe,Wx as Se,Xy as Ce,Yu as we,Yy as Te,Zu as Ee,__ as De,aC as Oe,br as ke,g_ as Ae,iC as N,qr as je,qw as Me,wy as Ne,xi as Pe}from"./loadAgentsDir-C9Ee_fs1.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-CXmDvb7V.js";import{t as Re}from"./SearchBox-DfOmUoaI.js";import{n as ze,t as Be}from"./useSearchInput-YiO4crrI.js";import{n as Ve,t as I}from"./Messages-F6OIAv8C.js";import{n as He,t as Ue}from"./fuse-TM-TeOo_.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),M(e)&&je(e).then(i)},[e]);let a=M(e)&&r===null,o=r??e,s=j(o)||``,c=we();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)(N,{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)(N,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var R,z,B=e((()=>{R=t(l(),1),g(),Fe(),Ee(),A(),ye(),Oe(),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)(ve,{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(),be(),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=ge(),T=process.env.USER_TYPE===`ant`,[oe]=u(),ce=Te(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),[_e,ye]=J.useState(!1),M=J.useMemo(()=>re(),[]),[be,Se]=J.useState(``),[Ce,we]=J.useState(0),[Ee,De]=J.useState(new Set),[Oe,Ae]=J.useState(null),[je,Me]=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)),he(M).then(e=>{ye(e.length>1)})},[M]);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=j(e);return!!(t&&n===t||e.customTitle||ke(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)),_e&&!A&&(t=t.filter(e=>e.projectPath===M)),t},[e,w,nt,k,O,_e,A,M]),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]),$=Oe?.value.log??null,bt=()=>{if(!w||!$)return``;let e=j($);if(!e)return``;let t=Z.filter(t=>j(t)===e);if(!(t.length>1))return``;let n=Ee.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},xt=J.useCallback(async()=>{let e=$?j($):void 0;if(!$||!e){F(`list`),Se(``);return}be.trim()&&(await Pe(e,be.trim(),$.fullPath),w&&s&&s()),F(`list`),Se(``)},[$,be,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:``}),Me(t+1))},[Z]),Dt=J.useCallback(e=>{Ae(e);let t=Z.findIndex(t=>j(t)===j(e.value.log));t>=0&&Me(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`),Se(``)},{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&&_e){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`),Se(``),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),_e&&!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&&je+At*2>=Z.length&&l(At*3)},[je,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:[` `,`(`,je,` 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)(Ne,{}),(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)(xe,{value:be,onChange:Se,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:Oe?.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?Ee.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(De(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&&De(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:Ct}):(0,Y.jsx)(ve,{options:yt,onChange:e=>{let t=Z[parseInt(e,10)];t&&o(t)},visibleOptionCount:At,onCancel:i,onFocus:Et,defaultFocusValue:Oe?.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)(N,{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)(N,{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)(N,{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)(N,{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`}),_e&&(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)(N,{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=j(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(),Me(),g(),Fe(),oe(),A(),_e(),ce(),D(),ye(),Ce(),Oe(),be(),Re(),B(),me(),et(),Se(),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(M(e))try{return await je(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 De({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(),ye(),Ae(),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=j(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=j(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${P([e.projectPath])} && claude --resume ${i}`,projectPath:e.projectPath}}var kt=e((()=>{x(),F(),ye()}));export{lt as a,Dt as i,kt as n,yt as o,St as r,Ot as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
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-D9fUXJiD.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./datadog-DCukMGn4.js";t();export{e as shutdownDatadog};
|
|
@@ -1 +0,0 @@
|
|
|
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-C2JRlUsH.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e,s as t}from"./debug-UI3T040K.js";t();export{e as logForDebugging};
|
|
@@ -1,5 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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-B_vNnZS5.js";async function a(e){return(0,o.jsx)(i,{onDone:e})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
|
|
@@ -1,5 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,o as t,s as n}from"./detectRepository-CBk3S2zv.js";e();export{t as parseGitHubRepository,n as parseGitRemote};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1 +0,0 @@
|
|
|
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-CSBWOnXJ.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
|
|
@@ -1 +0,0 @@
|
|
|
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-B3lx7yHn.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./jsx-runtime-D-D469L8.js";import{n,t as r}from"./Doctor-VJ5ZGb8g.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./earlyInput-feVuZGzR.js";export{e as startCapturingEarlyInput};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";import{t as r}from"./jsx-runtime-D-D469L8.js";import{lo as i,oo as a}from"./paths-C2JRlUsH.js";import{n as o,r as s}from"./analytics-DqMQntaB.js";import{HS as c,VS as l,WS as u,cj as d,hj as f,ij as p,nj as m,sj as h,tj as g}from"./loadAgentsDir-C9Ee_fs1.js";import{n as _,t as v}from"./useMainLoopModel-Bo6iEtB3.js";function y(e){let t=f(e);if(t!==void 0){let e=i(`userSettings`,{effortLevel:t});if(e.error)return{message:`Failed to set effort level: ${e.error.message}`}}s(`tengu_effort_command`,{effort:e});let n=m();if(n!==void 0&&n!==e){let n=process.env.CLAUDE_CODE_EFFORT_LEVEL;return t===void 0?{message:`Not applied: CLAUDE_CODE_EFFORT_LEVEL=${n} overrides effort this session, and ${e} is session-only (nothing saved)`,effortUpdate:{value:e}}:{message:`CLAUDE_CODE_EFFORT_LEVEL=${n} overrides this session — clear it and ${e} takes over`,effortUpdate:{value:e}}}let r=p(e);return{message:`Set effort level to ${e}${t===void 0?` (this session only)`:``}: ${r}`,effortUpdate:{value:e}}}function b(e,t){let n=m(),r=n===null?void 0:n??e;return r===void 0?{message:`Effort level: auto (currently ${g(t,e)})`}:{message:`Current effort level: ${r} (${p(r)})`}}function x(){let e=i(`userSettings`,{effortLevel:void 0});return e.error?{message:`Failed to set effort level: ${e.error.message}`}:(s(`tengu_effort_command`,{effort:`auto`}),m()==null?{message:`Effort level set to auto`,effortUpdate:{value:void 0}}:{message:`Cleared effort from settings, but CLAUDE_CODE_EFFORT_LEVEL=${process.env.CLAUDE_CODE_EFFORT_LEVEL} still controls this session`,effortUpdate:{value:void 0}})}function S(e){let t=e.toLowerCase();return t===`auto`||t===`unset`?x():d(t)?y(t):{message:`Invalid argument: ${e}. Valid options are: low, medium, high, max, auto`}}function C({onDone:e}){let{message:t}=b(c(e=>e.effortValue),_());return e(t),null}function w({result:e,onDone:t}){let n=u(),{effortUpdate:r,message:i}=e;return E.useEffect(()=>{r&&n(e=>({...e,effortValue:r.value})),t(i)},[n,r,i,t]),null}async function T(e,t,n){if(n=n?.trim()||``,O.includes(n)){e(`Usage: /effort [low|medium|high|xhigh|max|auto]
|
|
2
|
-
|
|
3
|
-
Effort levels:
|
|
4
|
-
- low: Quick, straightforward implementation
|
|
5
|
-
- medium: Balanced approach with standard testing
|
|
6
|
-
- high: Comprehensive implementation with extensive testing
|
|
7
|
-
- xhigh: Extended reasoning beyond high, short of max; including ChatGPT Codex models
|
|
8
|
-
- max: Maximum capability with deepest reasoning; maps to xhigh for ChatGPT Codex models
|
|
9
|
-
- auto: Use the default effort level for your model`);return}return!n||n===`current`||n===`status`?(0,D.jsx)(C,{onDone:e}):(0,D.jsx)(w,{result:S(n),onDone:e})}var E,D,O;e((()=>{E=t(n(),1),v(),o(),l(),h(),a(),D=r(),O=[`help`,`-h`,`--help`]}))();export{T as call,S as executeEffort,b as showCurrentEffort};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./classPrivateFieldSet2-EAQNhHs8.js";import{Cn as f,Ln as p,Mn as m,Tt as h,Xn as g,Yn as _,_r as ee,kt as v,nn as y,un as b,vt as te,wn as x}from"./schemas-BGAvj1T4.js";import{t as ne}from"./v4-f1i_CNUT.js";import{Tt as re,cn as ie,jr as S,lr as C}from"./state-sIHsFpDu.js";import{Ac as ae,Dr as oe,Pr as se,_c as ce,no as le,oo as ue}from"./paths-C2JRlUsH.js";import{l as de,p as fe}from"./sessionStoragePortable-DJZ_6cL8.js";import{$E as pe,Ca as me,Dv as he,G as ge,K as _e,Mf as ve,Nf as ye,Ov as be,Pr as xe,QE as Se,Sa as Ce,Xu as we,Yi as Te,Zu as Ee,_p as De,ea as Oe,gp as ke,i as Ae,o as je,xr as Me}from"./loadAgentsDir-C9Ee_fs1.js";import{Bn as Ne,Vn as Pe}from"./prompt-thBQB2X5.js";import{o as Fe,t as Ie}from"./fileStateCache-C7-TxF8G.js";import{t as Le}from"./QueryEngine-CEodAvI2.js";import*as w from"node:path";import{dirname as Re}from"node:path";import{randomUUID as ze}from"node:crypto";import{Readable as Be,Writable as Ve}from"node:stream";ne();var T={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},E={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},He=x({_meta:m(p(),g()).nullish(),terminal:v().optional().default(!1)}),Ue=x({_meta:m(p(),g()).nullish(),label:p().nullish(),name:p(),optional:v().optional().default(!1),secret:v().optional().default(!0)}),We=x({_meta:m(p(),g()).nullish(),description:p().nullish(),id:p(),name:p()}),Ge=x({_meta:m(p(),g()).nullish(),description:p().nullish(),id:p(),link:p().nullish(),name:p(),vars:h(Ue)}),Ke=x({_meta:m(p(),g()).nullish(),args:h(p()).optional(),description:p().nullish(),env:m(p(),p()).optional(),id:p(),name:p()}),qe=_([Ge.and(x({type:b(`env_var`)})),Ke.and(x({type:b(`terminal`)})),We]),Je=x({_meta:m(p(),g()).nullish(),methodId:p()}),Ye=x({_meta:m(p(),g()).nullish()}),Xe=x({_meta:m(p(),g()).nullish(),blob:p(),mimeType:p().nullish(),uri:p()}),Ze=x({default:v().nullish(),description:p().nullish(),title:p().nullish()}),Qe=x({_meta:m(p(),g()).nullish()}),$e=x({_meta:m(p(),g()).nullish()}),et=x({amount:f(),currency:p()}),tt=x({_meta:m(p(),g()).nullish(),terminalId:p()}),nt=x({_meta:m(p(),g()).nullish(),newText:p(),oldText:p().nullish(),path:p()}),rt=_([p(),f(),f(),v(),h(p())]),it=y(_([x({content:m(p(),rt).nullish()}).and(x({action:b(`accept`)})),x({action:b(`decline`)}),x({action:b(`cancel`)})]),x({_meta:m(p(),g()).nullish()})),at=x({_meta:m(p(),g()).nullish()}),ot=p(),st=x({_meta:m(p(),g()).nullish(),elicitationId:ot}),ct=b(`object`),lt=b(`string`),ut=x({_meta:m(p(),g()).nullish()}),dt=x({_meta:m(p(),g()).nullish(),form:at.nullish(),url:ut.nullish()}),ft=x({const:p(),title:p()}),pt=x({_meta:m(p(),g()).nullish(),name:p(),value:p()}),mt=x({code:_([b(-32700),b(-32600),b(-32601),b(-32602),b(-32603),b(-32800),b(-32e3),b(-32002),b(-32042),f().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:g().optional(),message:p()}),ht=g(),gt=g(),_t=g(),vt=x({_meta:m(p(),g()).nullish(),readTextFile:v().optional().default(!1),writeTextFile:v().optional().default(!1)}),yt=x({_meta:m(p(),g()).nullish(),name:p(),value:p()}),bt=x({_meta:m(p(),g()).nullish(),name:p(),title:p().nullish(),version:p()}),xt=x({default:f().nullish(),description:p().nullish(),maximum:f().nullish(),minimum:f().nullish(),title:p().nullish()}),St=x({_meta:m(p(),g()).nullish()}),Ct=x({_meta:m(p(),g()).nullish(),additionalDirectories:h(p()).optional(),cursor:p().nullish(),cwd:p().nullish()}),wt=x({_meta:m(p(),g()).nullish()}),Tt=x({_meta:m(p(),g()).nullish(),logout:wt.nullish()}),Et=x({_meta:m(p(),g()).nullish()}),Dt=x({_meta:m(p(),g()).nullish()}),Ot=x({_meta:m(p(),g()).nullish(),http:v().optional().default(!1),sse:v().optional().default(!1)}),kt=x({_meta:m(p(),g()).nullish(),headers:h(yt),name:p(),url:p()}),At=x({_meta:m(p(),g()).nullish(),headers:h(yt),name:p(),url:p()}),jt=x({_meta:m(p(),g()).nullish(),args:h(p()),command:p(),env:h(pt),name:p()}),D=_([kt.and(x({type:b(`http`)})),At.and(x({type:b(`sse`)})),jt]),O=p(),Mt=x({_meta:m(p(),g()).nullish(),description:p().nullish(),modelId:O,name:p()}),Nt=_([b(`error`),b(`warning`),b(`information`),b(`hint`)]),Pt=x({_meta:m(p(),g()).nullish()}),Ft=x({_meta:m(p(),g()).nullish()}),It=x({_meta:m(p(),g()).nullish()}),Lt=x({_meta:m(p(),g()).nullish()}),Rt=x({_meta:m(p(),g()).nullish()}),zt=x({_meta:m(p(),g()).nullish(),maxCount:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Bt=x({diff:p(),uri:p()}),Vt=x({endLine:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:p()}),Ht=x({_meta:m(p(),g()).nullish()}),Ut=x({_meta:m(p(),g()).nullish()}),Wt=x({languageId:p(),text:p(),uri:p()}),Gt=x({_meta:m(p(),g()).nullish(),maxCount:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Kt=_([b(`rejected`),b(`ignored`),b(`replaced`),b(`cancelled`)]),qt=x({excerpts:h(Vt),uri:p()}),Jt=x({_meta:m(p(),g()).nullish()}),Yt=x({_meta:m(p(),g()).nullish()}),Xt=x({name:p(),owner:p(),remoteUrl:p()}),Zt=x({_meta:m(p(),g()).nullish()}),Qt=x({_meta:m(p(),g()).nullish(),jump:Ht.nullish(),rename:Yt.nullish(),searchAndReplace:Zt.nullish()}),$t=x({id:p(),isRegex:v().nullish(),replace:p(),search:p(),uri:p()}),en=_([b(`automatic`),b(`diagnostic`),b(`manual`)]),tn=x({_meta:m(p(),g()).nullish(),maxCount:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),nn=x({_meta:m(p(),g()).nullish(),diagnostics:Pt.nullish(),editHistory:zt.nullish(),openFiles:Ut.nullish(),recentFiles:Gt.nullish(),relatedSnippets:Jt.nullish(),userActions:tn.nullish()}),rn=x({_meta:m(p(),g()).nullish(),additionalDirectories:h(p()).optional(),cwd:p(),mcpServers:h(D)}),an=x({default:f().nullish(),description:p().nullish(),maximum:f().nullish(),minimum:f().nullish(),title:p().nullish()}),on=p(),sn=_([b(`allow_once`),b(`allow_always`),b(`reject_once`),b(`reject_always`)]),cn=x({_meta:m(p(),g()).nullish(),kind:sn,name:p(),optionId:on}),ln=_([b(`high`),b(`medium`),b(`low`)]),un=_([b(`pending`),b(`in_progress`),b(`completed`)]),dn=x({_meta:m(p(),g()).nullish(),content:p(),priority:ln,status:un}),fn=x({_meta:m(p(),g()).nullish(),entries:h(dn)}),k=x({character:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),pn=x({id:p(),position:k,uri:p()}),mn=x({id:p(),newName:p(),position:k,uri:p()}),hn=x({action:p(),position:k,timestampMs:f(),uri:p()}),gn=_([b(`utf-16`),b(`utf-32`),b(`utf-8`)]),_n=x({_meta:m(p(),g()).nullish(),auth:He.optional().default({terminal:!1}),elicitation:dt.nullish(),fs:vt.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Qt.nullish(),positionEncodings:h(gn).optional(),terminal:v().optional().default(!1)}),vn=x({_meta:m(p(),g()).nullish(),audio:v().optional().default(!1),embeddedContext:v().optional().default(!1),image:v().optional().default(!1)}),yn=f().int().gte(0).lte(65535),bn=x({_meta:m(p(),g()).nullish(),clientCapabilities:_n.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:bt.nullish(),protocolVersion:yn}),A=x({end:k,start:k}),xn=x({message:p(),range:A,severity:Nt,uri:p()}),Sn=x({languageId:p(),lastFocusedMs:f().nullish(),uri:p(),visibleRange:A.nullish()}),Cn=x({_meta:m(p(),g()).nullish(),diagnostics:h(xn).nullish(),editHistory:h(Bt).nullish(),openFiles:h(Sn).nullish(),recentFiles:h(Wt).nullish(),relatedSnippets:h(qt).nullish(),userActions:h(hn).nullish()}),wn=x({newText:p(),range:A}),Tn=_([x({cursorPosition:k.nullish(),edits:h(wn),id:p(),uri:p()}).and(x({kind:b(`edit`)})),pn.and(x({kind:b(`jump`)})),mn.and(x({kind:b(`rename`)})),$t.and(x({kind:b(`searchAndReplace`)}))]),En=x({_meta:m(p(),g()).nullish(),content:p()}),Dn=x({_meta:m(p(),g()).nullish()}),j=_([f(),p()]).nullable();x({_meta:m(p(),g()).nullish(),requestId:j});var On=x({requestId:j}),kn=te([`assistant`,`user`]),M=x({_meta:m(p(),g()).nullish(),audience:h(kn).nullish(),lastModified:p().nullish(),priority:f().nullish()}),An=x({_meta:m(p(),g()).nullish(),annotations:M.nullish(),data:p(),mimeType:p()}),jn=x({_meta:m(p(),g()).nullish(),annotations:M.nullish(),data:p(),mimeType:p(),uri:p().nullish()}),Mn=x({_meta:m(p(),g()).nullish(),annotations:M.nullish(),description:p().nullish(),mimeType:p().nullish(),name:p(),size:f().nullish(),title:p().nullish(),uri:p()}),Nn=x({_meta:m(p(),g()).nullish(),optionId:on}),Pn=_([x({outcome:b(`cancelled`)}),Nn.and(x({outcome:b(`selected`)}))]),Fn=x({_meta:m(p(),g()).nullish(),outcome:Pn}),In=x({_meta:m(p(),g()).nullish()}),Ln=x({_meta:m(p(),g()).nullish()}),Rn=x({currentValue:v()}),zn=p(),Bn=p(),Vn=_([b(`mode`),b(`model`),b(`thought_level`),p()]),N=p(),Hn=x({_meta:m(p(),g()).nullish(),description:p().nullish(),name:p(),value:N}),Un=x({_meta:m(p(),g()).nullish(),group:zn,name:p(),options:h(Hn)}),P=y(_([x({currentValue:N,options:_([h(Hn),h(Un)])}).and(x({type:b(`select`)})),Rn.and(x({type:b(`boolean`)}))]),x({_meta:m(p(),g()).nullish(),category:Vn.nullish(),description:p().nullish(),id:Bn,name:p()})),Wn=x({_meta:m(p(),g()).nullish(),configOptions:h(P)}),Gn=x({_meta:m(p(),g()).nullish()}),F=p(),Kn=x({_meta:m(p(),g()).nullish(),id:p(),sessionId:F}),qn=x({_meta:m(p(),g()).nullish(),sessionId:F}),Jn=x({_meta:m(p(),g()).nullish(),sessionId:F}),Yn=x({_meta:m(p(),g()).nullish(),sessionId:F}),Xn=x({_meta:m(p(),g()).nullish(),args:h(p()).optional(),command:p(),cwd:p().nullish(),env:h(pt).optional(),outputByteLimit:f().nullish(),sessionId:F}),Zn=x({_meta:m(p(),g()).nullish(),sessionId:F,uri:p()}),Qn=x({_meta:m(p(),g()).nullish(),position:k,sessionId:F,uri:p(),version:f(),visibleRange:A}),$n=x({_meta:m(p(),g()).nullish(),languageId:p(),sessionId:F,text:p(),uri:p(),version:f()}),er=x({_meta:m(p(),g()).nullish(),sessionId:F,uri:p()}),tr=x({_meta:m(p(),g()).nullish(),additionalDirectories:h(p()).optional(),cwd:p(),mcpServers:h(D).optional(),sessionId:F}),nr=x({_meta:m(p(),g()).nullish(),sessionId:F,terminalId:p()}),rr=x({_meta:m(p(),g()).nullish(),additionalDirectories:h(p()).optional(),cwd:p(),mcpServers:h(D),sessionId:F}),ir=x({_meta:m(p(),g()).nullish(),limit:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:p(),sessionId:F}),ar=x({_meta:m(p(),g()).nullish(),id:p(),reason:Kt.nullish(),sessionId:F}),or=x({_meta:m(p(),g()).nullish(),sessionId:F,terminalId:p()}),sr=x({_meta:m(p(),g()).nullish(),additionalDirectories:h(p()).optional(),cwd:p(),mcpServers:h(D).optional(),sessionId:F}),cr=x({_meta:m(p(),g()).nullish(),additionalDirectories:h(p()).optional(),cwd:p(),sessionId:F,title:p().nullish(),updatedAt:p().nullish()}),lr=x({_meta:m(p(),g()).nullish(),nextCursor:p().nullish(),sessions:h(cr)}),ur=x({_meta:m(p(),g()).nullish(),title:p().nullish(),updatedAt:p().nullish()}),dr=x({_meta:m(p(),g()).nullish()}),I=p(),fr=x({_meta:m(p(),g()).nullish(),currentModeId:I}),pr=x({_meta:m(p(),g()).nullish(),description:p().nullish(),id:I,name:p()}),L=x({_meta:m(p(),g()).nullish(),availableModes:h(pr),currentModeId:I}),R=x({_meta:m(p(),g()).nullish(),availableModels:h(Mt),currentModelId:O}),mr=x({_meta:m(p(),g()).nullish(),configOptions:h(P).nullish(),models:R.nullish(),modes:L.nullish(),sessionId:F}),hr=x({_meta:m(p(),g()).nullish(),configOptions:h(P).nullish(),models:R.nullish(),modes:L.nullish()}),gr=x({_meta:m(p(),g()).nullish(),configOptions:h(P).nullish(),models:R.nullish(),modes:L.nullish(),sessionId:F}),_r=x({_meta:m(p(),g()).nullish(),configOptions:h(P).nullish(),models:R.nullish(),modes:L.nullish()}),vr=x({_meta:m(p(),g()).nullish()}),yr=x({_meta:m(p(),g()).nullish(),additionalDirectories:In.nullish(),close:Ln.nullish(),fork:Gn.nullish(),list:dr.nullish(),resume:vr.nullish()}),br=y(_([x({type:b(`boolean`),value:v()}),x({value:N})]),x({_meta:m(p(),g()).nullish(),configId:Bn,sessionId:F})),xr=x({_meta:m(p(),g()).nullish(),configOptions:h(P)}),Sr=x({_meta:m(p(),g()).nullish(),modeId:I,sessionId:F}),Cr=x({_meta:m(p(),g()).nullish()}),wr=x({_meta:m(p(),g()).nullish(),modelId:O,sessionId:F}),Tr=x({_meta:m(p(),g()).nullish()}),Er=x({_meta:m(p(),g()).nullish(),sessionId:F}),Dr=_([b(`end_turn`),b(`max_tokens`),b(`max_turn_requests`),b(`refusal`),b(`cancelled`)]),Or=_([b(`email`),b(`uri`),b(`date`),b(`date-time`)]),kr=x({default:p().nullish(),description:p().nullish(),enum:h(p()).nullish(),format:Or.nullish(),maxLength:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:h(ft).nullish(),pattern:p().nullish(),title:p().nullish()}),Ar=x({_meta:m(p(),g()).nullish(),context:Cn.nullish(),position:k,selection:A.nullish(),sessionId:F,triggerKind:en,uri:p(),version:f()}),jr=x({_meta:m(p(),g()).nullish(),suggestions:h(Tn)}),Mr=x({_meta:m(p(),g()).nullish(),terminalId:p()}),Nr=x({_meta:m(p(),g()).nullish(),exitCode:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:p().nullish()}),Pr=x({_meta:m(p(),g()).nullish(),sessionId:F,terminalId:p()}),Fr=x({_meta:m(p(),g()).nullish(),exitStatus:Nr.nullish(),output:p(),truncated:v()}),Ir=x({_meta:m(p(),g()).nullish(),annotations:M.nullish(),text:p()}),Lr=x({range:A.nullish(),text:p()}),Rr=x({_meta:m(p(),g()).nullish(),contentChanges:h(Lr),sessionId:F,uri:p(),version:f()});x({method:p(),params:_([qn,$n,Rr,Zn,er,Qn,Kn,ar,ht]).nullish()});var zr=_([b(`full`),b(`incremental`)]),Br=x({_meta:m(p(),g()).nullish(),syncKind:zr}),Vr=x({_meta:m(p(),g()).nullish(),didChange:Br.nullish(),didClose:Ft.nullish(),didFocus:It.nullish(),didOpen:Lt.nullish(),didSave:Rt.nullish()}),Hr=x({_meta:m(p(),g()).nullish(),document:Vr.nullish()}),Ur=x({_meta:m(p(),g()).nullish(),context:nn.nullish(),events:Hr.nullish()}),Wr=x({_meta:m(p(),g()).nullish(),auth:Tt.optional().default({}),loadSession:v().optional().default(!1),mcpCapabilities:Ot.optional().default({http:!1,sse:!1}),nes:Ur.nullish(),positionEncoding:gn.nullish(),promptCapabilities:vn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:yr.optional().default({})}),Gr=x({_meta:m(p(),g()).nullish(),agentCapabilities:Wr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:bt.nullish(),authMethods:h(qe).optional().default([]),protocolVersion:yn}),Kr=_([x({_meta:m(p(),g()).nullish(),mimeType:p().nullish(),text:p(),uri:p()}),Xe]),qr=x({_meta:m(p(),g()).nullish(),annotations:M.nullish(),resource:Kr}),z=_([Ir.and(x({type:b(`text`)})),jn.and(x({type:b(`image`)})),An.and(x({type:b(`audio`)})),Mn.and(x({type:b(`resource_link`)})),qr.and(x({type:b(`resource`)}))]),Jr=x({_meta:m(p(),g()).nullish(),content:z}),B=x({_meta:m(p(),g()).nullish(),content:z,messageId:p().nullish()}),Yr=x({_meta:m(p(),g()).nullish(),messageId:p().nullish(),prompt:h(z),sessionId:F}),Xr=x({anyOf:h(ft)}),Zr=_([Jr.and(x({type:b(`content`)})),nt.and(x({type:b(`diff`)})),Mr.and(x({type:b(`terminal`)}))]),V=p(),Qr=x({sessionId:F,toolCallId:V.nullish()}),$r=y(_([Qr,On]),x({elicitationId:ot,url:p().url()})),ei=x({_meta:m(p(),g()).nullish(),line:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:p()}),ti=_([b(`pending`),b(`in_progress`),b(`completed`),b(`failed`)]),ni=_([b(`read`),b(`edit`),b(`delete`),b(`move`),b(`search`),b(`execute`),b(`think`),b(`fetch`),b(`switch_mode`),b(`other`)]),ri=x({_meta:m(p(),g()).nullish(),content:h(Zr).optional(),kind:ni.optional(),locations:h(ei).optional(),rawInput:g().optional(),rawOutput:g().optional(),status:ti.optional(),title:p(),toolCallId:V}),ii=x({_meta:m(p(),g()).nullish(),content:h(Zr).nullish(),kind:ni.nullish(),locations:h(ei).nullish(),rawInput:g().optional(),rawOutput:g().optional(),status:ti.nullish(),title:p().nullish(),toolCallId:V}),ai=x({_meta:m(p(),g()).nullish(),options:h(cn),sessionId:F,toolCall:ii}),oi=x({_meta:m(p(),g()).nullish(),hint:p()}),si=x({_meta:m(p(),g()).nullish(),description:p(),input:oi.nullish(),name:p()}),ci=x({_meta:m(p(),g()).nullish(),availableCommands:h(si)}),li=_([x({enum:h(p()),type:lt}),Xr]),ui=x({default:h(p()).nullish(),description:p().nullish(),items:li,maxItems:f().nullish(),minItems:f().nullish(),title:p().nullish()}),di=_([kr.and(x({type:b(`string`)})),an.and(x({type:b(`number`)})),xt.and(x({type:b(`integer`)})),Ze.and(x({type:b(`boolean`)})),ui.and(x({type:b(`array`)}))]),fi=x({description:p().nullish(),properties:m(p(),di).optional().default({}),required:h(p()).nullish(),title:p().nullish(),type:ct.optional().default(`object`)}),pi=y(_([y(_([Qr,On]),x({requestedSchema:fi})).and(x({mode:b(`form`)})),$r.and(x({mode:b(`url`)}))]),x({_meta:m(p(),g()).nullish(),message:p()})),mi=x({cachedReadTokens:f().nullish(),cachedWriteTokens:f().nullish(),inputTokens:f(),outputTokens:f(),thoughtTokens:f().nullish(),totalTokens:f()});_([x({id:j,result:_([Gr,Ye,Dt,gr,hr,lr,mr,_r,$e,Cr,xr,x({_meta:m(p(),g()).nullish(),stopReason:Dr,usage:mi.nullish(),userMessageId:p().nullish()}),Tr,Er,jr,Qe,_t])}),x({error:mt,id:j})]);var hi=x({_meta:m(p(),g()).nullish(),cost:et.nullish(),size:f(),used:f()}),gi=_([B.and(x({sessionUpdate:b(`user_message_chunk`)})),B.and(x({sessionUpdate:b(`agent_message_chunk`)})),B.and(x({sessionUpdate:b(`agent_thought_chunk`)})),ri.and(x({sessionUpdate:b(`tool_call`)})),ii.and(x({sessionUpdate:b(`tool_call_update`)})),fn.and(x({sessionUpdate:b(`plan`)})),ci.and(x({sessionUpdate:b(`available_commands_update`)})),fr.and(x({sessionUpdate:b(`current_mode_update`)})),Wn.and(x({sessionUpdate:b(`config_option_update`)})),ur.and(x({sessionUpdate:b(`session_info_update`)})),hi.and(x({sessionUpdate:b(`usage_update`)}))]),_i=x({_meta:m(p(),g()).nullish(),sessionId:F,update:gi});x({method:p(),params:_([_i,st,ht]).nullish()});var vi=x({_meta:m(p(),g()).nullish(),sessionId:F,terminalId:p()}),yi=x({_meta:m(p(),g()).nullish(),exitCode:f().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:p().nullish()}),bi=x({name:p(),uri:p()}),xi=x({_meta:m(p(),g()).nullish(),repository:Xt.nullish(),workspaceFolders:h(bi).nullish(),workspaceUri:p().nullish()});x({id:j,method:p(),params:_([bn,Je,Et,rn,rr,Ct,tr,sr,Yn,Sr,br,Yr,wr,xi,Ar,Jn,gt]).nullish()});var Si=x({_meta:m(p(),g()).nullish(),content:p(),path:p(),sessionId:F});x({id:j,method:p(),params:_([Si,ir,ai,Xn,Pr,or,vi,nr,pi,gt]).nullish()}),_([x({id:j,result:_([x({_meta:m(p(),g()).nullish()}),En,Fn,tt,Fr,Dn,yi,St,it,_t])}),x({error:mt,id:j})]),e(),d(),r(),s(),i(),o();function Ci(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a)break;if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
|
|
2
|
-
`);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
|
|
3
|
-
`,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}ne();var wi,H=new WeakMap,Ti=class{constructor(e,t){l(this,H,void 0);let n=e(this);u(H,this,new ji(async(e,t)=>{switch(e){case T.initialize:{let e=bn.parse(t);return n.initialize(e)}case T.session_new:{let e=rn.parse(t);return n.newSession(e)}case T.session_load:{if(!n.loadSession)throw Z.methodNotFound(e);let r=rr.parse(t);return n.loadSession(r)}case T.session_list:{if(!n.listSessions)throw Z.methodNotFound(e);let r=Ct.parse(t);return n.listSessions(r)}case T.session_fork:{if(!n.unstable_forkSession)throw Z.methodNotFound(e);let r=tr.parse(t);return n.unstable_forkSession(r)}case T.session_resume:{if(!n.unstable_resumeSession)throw Z.methodNotFound(e);let r=sr.parse(t);return n.unstable_resumeSession(r)}case T.session_close:{if(!n.unstable_closeSession)throw Z.methodNotFound(e);let r=Yn.parse(t);return n.unstable_closeSession(r)}case T.session_set_mode:{if(!n.setSessionMode)throw Z.methodNotFound(e);let r=Sr.parse(t);return await n.setSessionMode(r)??{}}case T.authenticate:{let e=Je.parse(t);return await n.authenticate(e)??{}}case T.logout:{if(!n.unstable_logout)throw Z.methodNotFound(e);let r=Et.parse(t);return await n.unstable_logout(r)??{}}case T.session_prompt:{let e=Yr.parse(t);return n.prompt(e)}case T.session_set_model:{if(!n.unstable_setSessionModel)throw Z.methodNotFound(e);let r=wr.parse(t);return await n.unstable_setSessionModel(r)??{}}case T.session_set_config_option:{if(!n.setSessionConfigOption)throw Z.methodNotFound(e);let r=br.parse(t);return n.setSessionConfigOption(r)}case T.nes_start:{if(!n.unstable_startNes)throw Z.methodNotFound(e);let r=xi.parse(t);return n.unstable_startNes(r)}case T.nes_suggest:{if(!n.unstable_suggestNes)throw Z.methodNotFound(e);let r=Ar.parse(t);return n.unstable_suggestNes(r)}case T.nes_close:{if(!n.unstable_closeNes)throw Z.methodNotFound(e);let r=Jn.parse(t);return await n.unstable_closeNes(r)??{}}default:if(n.extMethod)return n.extMethod(e,t);throw Z.methodNotFound(e)}},async(e,t)=>{switch(e){case T.session_cancel:{let e=qn.parse(t);return n.cancel(e)}case T.document_did_open:{if(!n.unstable_didOpenDocument)return;let e=$n.parse(t);return n.unstable_didOpenDocument(e)}case T.document_did_change:{if(!n.unstable_didChangeDocument)return;let e=Rr.parse(t);return n.unstable_didChangeDocument(e)}case T.document_did_close:{if(!n.unstable_didCloseDocument)return;let e=Zn.parse(t);return n.unstable_didCloseDocument(e)}case T.document_did_save:{if(!n.unstable_didSaveDocument)return;let e=er.parse(t);return n.unstable_didSaveDocument(e)}case T.document_did_focus:{if(!n.unstable_didFocusDocument)return;let e=Qn.parse(t);return n.unstable_didFocusDocument(e)}case T.nes_accept:{if(!n.unstable_acceptNes)return;let e=Kn.parse(t);return n.unstable_acceptNes(e)}case T.nes_reject:{if(!n.unstable_rejectNes)return;let e=ar.parse(t);return n.unstable_rejectNes(e)}default:if(n.extNotification)return n.extNotification(e,t);throw Z.methodNotFound(e)}},t))}async sessionUpdate(e){return await c(H,this).sendNotification(E.session_update,e)}async requestPermission(e){return await c(H,this).sendRequest(E.session_request_permission,e)}async readTextFile(e){return await c(H,this).sendRequest(E.fs_read_text_file,e)}async writeTextFile(e){return await c(H,this).sendRequest(E.fs_write_text_file,e)??{}}async createTerminal(e){return new Ei((await c(H,this).sendRequest(E.terminal_create,e)).terminalId,e.sessionId,c(H,this))}async unstable_createElicitation(e){return await c(H,this).sendRequest(E.elicitation_create,e)}async unstable_completeElicitation(e){return await c(H,this).sendNotification(E.elicitation_complete,e)}async extMethod(e,t){return await c(H,this).sendRequest(e,t)}async extNotification(e,t){return await c(H,this).sendNotification(e,t)}get signal(){return c(H,this).signal}get closed(){return c(H,this).closed}},U=new WeakMap,W=new WeakMap;wi=Symbol.asyncDispose;var Ei=class{constructor(e,n,r){t(this,`id`,void 0),l(this,U,void 0),l(this,W,void 0),this.id=e,u(U,this,n),u(W,this,r)}async currentOutput(){return await c(W,this).sendRequest(E.terminal_output,{sessionId:c(U,this),terminalId:this.id})}async waitForExit(){return await c(W,this).sendRequest(E.terminal_wait_for_exit,{sessionId:c(U,this),terminalId:this.id})}async kill(){return await c(W,this).sendRequest(E.terminal_kill,{sessionId:c(U,this),terminalId:this.id})??{}}async release(){return await c(W,this).sendRequest(E.terminal_release,{sessionId:c(U,this),terminalId:this.id})??{}}async[wi](){await this.release()}},G=new WeakMap,Di=new WeakMap,Oi=new WeakMap,ki=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakMap,Ai=new WeakMap,Y=new WeakSet,ji=class{constructor(e,t,r){a(this,Y),l(this,G,new Map),l(this,Di,0),l(this,Oi,void 0),l(this,ki,void 0),l(this,K,void 0),l(this,q,Promise.resolve()),l(this,J,new AbortController),l(this,Ai,void 0),u(Oi,this,e),u(ki,this,t),u(K,this,r),u(Ai,this,new Promise(e=>{c(J,this).signal.addEventListener(`abort`,()=>e())})),n(Y,this,Mi).call(this)}get signal(){return c(J,this).signal}get closed(){return c(Ai,this)}async sendRequest(e,t){var r,i;n(Y,this,Ri).call(this);let a=(u(Di,this,(r=c(Di,this),i=r++,r)),i),o=new Promise((e,t)=>{c(G,this).set(a,{resolve:e,reject:t})});return await n(Y,this,X).call(this,{jsonrpc:`2.0`,id:a,method:e,params:t}),o}async sendNotification(e,t){n(Y,this,Ri).call(this),await n(Y,this,X).call(this,{jsonrpc:`2.0`,method:e,params:t})}};async function Mi(){let e;try{let e=c(K,this).readable.getReader();try{for(;!c(J,this).signal.aborted;){let{value:t,done:r}=await e.read();if(r)break;if(t)try{n(Y,this,Pi).call(this,t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&n(Y,this,X).call(this,{jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{n(Y,this,Ni).call(this,e)}}function Ni(e){if(c(J,this).signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of c(G,this).values())e.reject(t);c(G,this).clear(),c(J,this).abort(t)}async function Pi(e){if(`method`in e&&`id`in e){let t=await n(Y,this,Fi).call(this,e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await n(Y,this,X).call(this,{jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await n(Y,this,Ii).call(this,e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else `id`in e?n(Y,this,Li).call(this,e):console.error(`Invalid message`,{message:e})}async function Fi(e,t){try{return{result:await c(Oi,this).call(this,e,t)??null}}catch(e){if(e instanceof Z)return e.toResult();if(e instanceof ee)return Z.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return Z.internalError(t?JSON.parse(t):{}).toResult()}catch{return Z.internalError({details:t}).toResult()}}}async function Ii(e,t){try{return await c(ki,this).call(this,e,t),{result:null}}catch(e){if(e instanceof Z)return e.toResult();if(e instanceof ee)return Z.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return Z.internalError(t?JSON.parse(t):{}).toResult()}catch{return Z.internalError({details:t}).toResult()}}}function Li(e){let t=c(G,this).get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new Z(n,r,i))}c(G,this).delete(e.id)}else console.error(`Got response to unknown request`,e.id)}function Ri(){if(c(J,this).signal.aborted)throw c(J,this).signal.reason??Error(`ACP connection closed`)}async function X(e){return u(q,this,c(q,this).then(async()=>{let t=c(K,this).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{n(Y,this,Ni).call(this,e)})),c(q,this)}var Z=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};ie(),de(),ae(),ue(),Pe(),Fe(),pe(),be(),Ee(),Oe(),xe(),_e(),je();var zi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,Bi={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function Vi(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=Bi[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!zi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Hi(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ui=256;function Wi(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ui?t:t.slice(0,Ui-1)+`…`}function Gi(e,t){if(!t)return e;let n=w.resolve(t),r=w.resolve(e);return r.startsWith(n+w.sep)||r===n?w.relative(n,r).replaceAll(`\\`,`/`):e}function Ki(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return t+`
|
|
4
|
-
`+e+(e.endsWith(`
|
|
5
|
-
`)?``:`
|
|
6
|
-
`)+t}var qi=console;function Q(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let n=i?.command??`Terminal`,r=i?.description;return{title:n,kind:`execute`,content:t?[{type:`terminal`,terminalId:e.id}]:r?[{type:`content`,content:{type:`text`,text:r}}]:[]}}case`Read`:{let e=i?.file_path??`File`,t=i?.offset,r=i?.limit,a=``;return r&&r>0?a=` (${t??1} - ${(t??1)+r-1})`:t&&(a=` (from line ${t})`),{title:`Read ${e?Gi(e,n):`File`}${a}`,kind:`read`,locations:e?[{path:e,line:t??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?Gi(e,n):void 0;return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:e?[{type:`diff`,path:e,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:e?[{path:e}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?Gi(e,n):void 0;return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:e?[{type:`diff`,path:e,oldText:t||null,newText:r}]:[],locations:e?[{path:e}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,n=`Find`;return e&&(n+=` \`${e}\``),t&&(n+=` \`${t}\``),{title:n,kind:`search`,content:[],locations:e?[{path:e}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`WebFetch`:{let e=i?.url??``,t=i?.prompt;return{title:e?`Fetch ${e}`:`Fetch`,kind:`fetch`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`WebSearch`:{let e=`"${i?.query??`Web search`}"`,t=i?.allowed_domains,n=i?.blocked_domains;return t&&t.length>0&&(e+=` (allowed: ${t.join(`, `)})`),n&&n.length>0&&(e+=` (blocked: ${n.join(`, `)})`),{title:e,kind:`fetch`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function Ji(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Yi(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:Ki(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:Ki(e.text)}:Xi(e,!1)}))}:{};case`Bash`:{let e=``,a=+!!r,o=String(t.id);if(i&&typeof i==`object`&&!Array.isArray(i)&&i.type===`bash_code_execution_result`){let t=i;e=[t.stdout,t.stderr].filter(Boolean).join(`
|
|
7
|
-
`),a=t.return_code??+!!r}else typeof i==`string`?e=i:Array.isArray(i)&&i.length>0&&(e=i.map(e=>e.type===`text`?e.text:``).join(`
|
|
8
|
-
`));return n?{content:[{type:`terminal`,terminalId:o}],_meta:{terminal_info:{terminal_id:o},terminal_output:{terminal_id:o,data:e},terminal_exit:{terminal_id:o,exit_code:a,signal:null}}}:e.trim()?{content:[{type:`content`,content:{type:`text`,text:`\`\`\`console\n${e.trimEnd()}\n\`\`\``}}]}:{}}case`Edit`:case`Write`:return{};case`ExitPlanMode`:return{title:`Exited Plan Mode`};default:return Yi(i??``,r)}}function Yi(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:Xi(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function Xi(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_search_result`:return n(`${e.title} (${e.url})`);case`web_search_tool_result_error`:return n(`Error: ${e.error_code}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
|
|
9
|
-
`)||``)}case`text_editor_code_execution_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);default:try{return{type:`text`,text:JSON.stringify(e)}}catch{return{type:`text`,text:`[content]`}}}}function Zi(e,t){if(t.aborted)return Promise.resolve({done:!0,value:void 0});let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e.next(),r]).finally(()=>{n&&t.removeEventListener(`abort`,n)})}async function Qi(e,t,n,r,i,a,o,s){let c=`end_turn`,l={inputTokens:0,outputTokens:0,cachedReadTokens:0,cachedWriteTokens:0},u=null,d=null,f=2e5,p=!1;try{for(;!r.aborted;){let s=await Zi(t,r);if(s.done||r.aborted)break;let m=s.value;if(m==null)continue;let h=m;switch(h.type){case`system`:h.subtype===`compact_boundary`&&(u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:0,size:f}}),await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
10
|
-
|
|
11
|
-
Compacting completed.`}}}));break;case`result`:{let t=h.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=h.modelUsage;if(i&&d){let e=ia(i,d);e?.contextWindow&&(f=e.contextWindow)}let a=u??l.inputTokens+l.outputTokens+l.cachedReadTokens+l.cachedWriteTokens,o=h.total_cost_usd;await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:a,size:f,cost:o==null?void 0:{amount:o,currency:`USD`}}});let s=h.subtype,p=h.is_error;if(r.aborted){c=`cancelled`;break}switch(s){case`success`:h.stop_reason===`max_tokens`&&(c=`max_tokens`),p&&(c=`end_turn`);break;case`error_during_execution`:c=h.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=ea(h,e,i,n,{clientCapabilities:a,cwd:o});for(let e of t)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=h.message,r=h.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s=$i(h,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p});for(let e of s)await n.sessionUpdate(e);break}case`user`:break;case`progress`:{let t=h.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:0,size:f}}),await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
|
|
12
|
-
|
|
13
|
-
Compacting completed.`}}});break;default:qi.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}function $i(e,t,n,r,i){let a=e.message;if(!a)return[];let o=a.content;if(!o)return[];if(typeof o==`string`)return[{sessionId:t,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:o}}}];let s=i?.streamingActive?o.filter(e=>e.type!==`text`&&e.type!==`thinking`):o;return s.length===0?[]:$(s,`assistant`,t,n,r,void 0,i)}function ea(e,t,n,r,i){let a=e.event;if(!a)return[];switch(a.type){case`content_block_start`:{let o=a.content_block;return o?$([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd}):[]}case`content_block_delta`:{let o=a.delta;return o?$([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd}):[]}case`message_start`:case`message_delta`:case`message_stop`:case`content_block_stop`:return[];default:return[]}}function $(e,t,n,r,i,a,o){let s=[];for(let i of e){let e=i.type,a=null;switch(e){case`text`:case`text_delta`:{let e=i.text??``;a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,content:{type:`text`,text:e}};break}case`thinking`:case`thinking_delta`:a={sessionUpdate:`agent_thought_chunk`,content:{type:`text`,text:i.thinking??``}};break;case`image`:{let e=i.source;e?.type===`base64`&&(a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,content:{type:`image`,data:e.data,mimeType:e.media_type}});break}case`tool_use`:case`server_tool_use`:case`mcp_tool_use`:{let t=i.id??``,n=i.name??`unknown`,s=i.input,c=t in r;if(r[t]={type:e,id:t,name:n,input:s},n===`TodoWrite`){let e=s?.todos;Array.isArray(e)&&(a={sessionUpdate:`plan`,entries:e.map(e=>({content:e.content,status:ta(e.status),priority:`medium`}))})}else{let e=s?{...s}:{};a=c?{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call_update`,rawInput:e,...Q({name:n,id:t,input:s??{}},!1,o?.cwd)}:{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call`,rawInput:e,status:`pending`,...Q({name:n,id:t,input:s??{}},!1,o?.cwd)}}break}case`tool_result`:case`mcp_tool_result`:{let e=i.tool_use_id??``,t=r[e];if(!t)break;if(t.name!==`TodoWrite`){let n=Ji(i,{name:t.name,id:t.id},!1);a={_meta:{claudeCode:{toolName:t.name}},toolCallId:e,sessionUpdate:`tool_call_update`,status:i.is_error===!0?`failed`:`completed`,rawOutput:i.content,...n}}break}case`redacted_thinking`:case`input_json_delta`:case`citations_delta`:case`signature_delta`:case`container_upload`:case`compaction`:case`compaction_delta`:break}if(a){if(o?.parentToolUseId){let e=a._meta;a._meta={...e,claudeCode:{...e?.claudeCode??{},parentToolUseId:o.parentToolUseId}}}s.push({sessionId:n,update:a})}}return s}function ta(e){return e===`in_progress`?`in_progress`:e===`completed`?`completed`:`pending`}async function na(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){qi.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=$(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a});for(let e of t)await n.sessionUpdate(e)}}}function ra(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;return n}function ia(e,t){let n=null,r=0;for(let i of Object.keys(e)){let e=ra(i,t);e>r&&(r=e,n=i)}return n?e[n]??null:null}function aa(e,t,n,r,i,a,o){return async(n,s,c,l,u,d)=>{let f=sa(r);if(n.name===`ExitPlanMode`)return oa(e,t,u,s,f,i,a,o);if(d!==void 0)return d;try{let e=await ge(n,s,c,l,u);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:u}}let p=Q({name:n.name,id:u,input:s},f,i),m={toolCallId:u,title:p.title,kind:p.kind,status:`pending`,rawInput:s},h=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`}];try{let n=await e.requestPermission({sessionId:t,toolCall:m,options:h});if(n.outcome.outcome===`cancelled`)return{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`}};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:s}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function oa(e,t,n,r,i,a,o,s){let c=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&c.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let l=Q({name:`ExitPlanMode`,id:n,input:r},i,a),u={toolCallId:n,title:l.title,kind:l.kind,status:`pending`,rawInput:r},d=await e.requestPermission({sessionId:t,toolCall:u,options:c});if(d.outcome.outcome===`cancelled`)return{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(d.outcome.outcome===`selected`&&`optionId`in d.outcome&&d.outcome.optionId!==void 0){let n=d.outcome.optionId;if(c.some(e=>e.optionId===n)&&(n===`default`||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function sa(e){if(!e)return!1;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}function ca(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(la(n,r))}else if(e.type===`resource`){let n=e.resource;n&&typeof n.text==`string`&&t.push(n.text)}}return t.filter(e=>e.length>0).join(`
|
|
14
|
-
`)}function la(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}ke(),se(),ye(),e();var ua=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,agentInfo:{name:`claude-code`,title:`Claude Code`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0}},promptCapabilities:{image:!0,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{fork:{},list:{},resume:{},close:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){let t=await De({dir:e.cwd??void 0,limit:100}),n=[];for(let e of t)e.cwd&&n.push({sessionId:e.sessionId,cwd:e.cwd,title:Wi(e.summary??``),updatedAt:new Date(e.lastModified).toISOString()});return{sessions:n}}async unstable_forkSession(e){let t=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async prompt(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=ca(e.prompt);if(!n.trim())return{stopReason:`end_turn`};let r=t.cancelGeneration;if(t.promptRunning){let e=ze();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==r)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),S(e.sessionId,re());let r=t.queryEngine.submitMessage(n),{stopReason:i,usage:a}=await Qi(e.sessionId,r,this.conn,t.queryEngine.getAbortSignal(),t.toolUseCache,this.clientCapabilities,t.cwd,()=>t.cancelled);return t.cancelled?{stopReason:`cancelled`}:{stopReason:i,usage:a?{inputTokens:a.inputTokens,outputTokens:a.outputTokens,cachedReadTokens:a.cachedReadTokens,cachedWriteTokens:a.cachedWriteTokens,totalTokens:a.inputTokens+a.outputTokens+a.cachedReadTokens+a.cachedWriteTokens}:void 0}}catch(n){if(t.cancelled)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(this.teardownSession(e.sessionId),Error(`The Claude Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=Sa(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async setSessionConfigOption(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);if(!t.configOptions.find(t=>t.id===e.configId))throw Error(`Unknown config option: ${e.configId}`);let n=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,n),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:n}})):e.configId===`model`&&t.queryEngine.setModel(n),this.syncSessionConfigState(t,e.configId,n),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:n}:t),{configOptions:t.configOptions}}async createSession(e,t={}){ce();let n=t.sessionId??ze(),r=e.cwd;S(n,re()),C(r);let i=process.cwd(),a=!1;try{process.chdir(r),a=!0}catch{}try{let i=Ne(),a=we(i),o=e._meta,s=ga(o,`permissionMode`),c=s?o?.permissionMode:void 0,l=this.getSetting(`permissions.defaultMode`),u=pa(c,s,l),d=aa(this.conn,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,this.clientCapabilities,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),f=_a(l),p={...Se(),toolPermissionContext:{...i,mode:u,isBypassPermissionsModeAvailable:f}},[m,h]=await Promise.all([Te(r),Ae(r)]);p.agentDefinitions=h;let g=new Le({cwd:r,tools:a,commands:m,mcpClients:[],agents:h.activeAgents,canUseTool:d,getAppState:()=>p,setAppState:e=>{let t=e(p);Object.assign(p,t)},readFileCache:new Ie(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),_={currentModeId:u,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},...f?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},ee=ve(),v=oe(),y={availableModels:ee.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:v};g.setModel(v);let b=wa(_,y),te={queryEngine:g,cancelled:!1,cancelGeneration:0,cwd:r,modes:_,models:y,configOptions:b,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:this.clientCapabilities,appState:p,commands:m,sessionFingerprint:Hi({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,te),{sessionId:n,models:y,modes:_,configOptions:b}}finally{a&&process.chdir(i)}}async getOrCreateSession(e){let t=this.sessions.get(e.sessionId);if(t){if(Hi({cwd:e.cwd,mcpServers:e.mcpServers})===t.sessionFingerprint){let n=await fe(e.sessionId,e.cwd);return S(e.sessionId,n?Re(n.filePath):null),C(e.cwd),await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:t.modes,models:t.models,configOptions:t.configOptions}}await this.teardownSession(e.sessionId)}let n=await fe(e.sessionId,e.cwd),r=n?Re(n.filePath):null;S(e.sessionId,r),C(e.cwd);let i;if(n)try{let t=await Me(e.sessionId);t&&t.messages.length>0&&(i=he(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let a=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:i});if(i&&i.length>0){let t=this.sessions.get(e.sessionId);t&&await na(e.sessionId,i,this.conn,t.toolUseCache,this.clientCapabilities,t.cwd)}return{sessionId:a.sessionId,modes:a.modes,models:a.models,configOptions:a.configOptions}}async teardownSession(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async replaySessionHistory(e){try{let t=await Me(e.sessionId);if(!t||t.messages.length===0)return;let n=he(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await na(e.sessionId,n,this.conn,r.toolUseCache,this.clientCapabilities,r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}applySessionMode(e,t){if(!fa(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async updateConfigOption(e,t,n){let r=this.sessions.get(e);r&&(this.syncSessionConfigState(r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}syncSessionConfigState(e,t,n){t===`mode`?e.modes={...e.modes,currentModeId:n}:t===`model`&&(e.models={...e.models,currentModelId:n})}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}getSetting(e){let t=le();return e.split(`.`).reduce((e,t)=>{if(!(!e||typeof e!=`object`))return e[t]},t)}},da=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function fa(e){return da.includes(e)}function pa(e,t,n){if(t){let t=ma(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!_a(n))throw Error(`Mode not available: bypassPermissions requires a local ACP bypass opt-in.`);return t}return ha(n)??`default`}function ma(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return Vi(e,t)}function ha(e){if(e!=null)try{return Vi(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function ga(e,t){return!!e&&Object.hasOwn(e,t)}function _a(e){return va()&&(ya()||ba(e))}function va(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid==`function`?process.getuid()!==0:!0}function ya(){return process.env.ACP_PERMISSION_MODE===`bypassPermissions`||xa(process.env.CLAUDE_CODE_ACP_ALLOW_BYPASS_PERMISSIONS)}function ba(e){try{return Vi(e)===`bypassPermissions`}catch{return!1}}function xa(e){return e===`1`||e?.toLowerCase()===`true`}function Sa(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),Ca(e),n}Ca(e)}function Ca(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}function wa(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}ae(),me();function Ta(e,t){let n=Be.toWeb(e);return Ci(Ve.toWeb(t),n)}async function Ea(){ce(),Ce();let e=Ta(process.stdin,process.stdout),t,n=new Ti(e=>(t=new ua(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{Ea as runAcpAgent};
|