@readmagic/workmate 0.0.13 → 0.0.15
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-DcVnvL_u.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-0Qdg3Rh7.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-CH9x1Ngp.js → AgentsMdExternalIncludesDialog-D6DopTxc.js} +1 -1
- package/dist/chunks/App-BoI5EJry.js +1 -0
- package/dist/chunks/ApproveApiKey-BjlQDcMx.js +1 -0
- package/dist/chunks/ApproveApiKey-PWFcscjY.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-ClSMkcGp.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-KCZv-PXl.js +1 -0
- package/dist/chunks/DiffDialog-BGBkuVIn.js +6 -0
- package/dist/chunks/Doctor-CI04juFO.js +3 -0
- package/dist/chunks/Doctor-DCrqcW68.js +1 -0
- package/dist/chunks/ExitFlow-qrCDVA9i.js +2 -0
- package/dist/chunks/Grove-B-M3DWD3.js +11 -0
- package/dist/chunks/{HybridTransport-BQNLZNa_.js → HybridTransport-n5jji6SI.js} +2 -4
- package/dist/chunks/InvalidConfigDialog-By-j6fHE.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-C_reeMzL.js +1 -0
- package/dist/chunks/MCPConnectionManager-BNG7iSlw.js +1 -0
- package/dist/chunks/MCPToolListView-jw0tITfc.js +1 -0
- package/dist/chunks/{McpParsingWarnings-CUx2zexI.js → McpParsingWarnings-BeZ3Bn8N.js} +1 -1
- package/dist/chunks/MessageSelector-Ci6N-gCw.js +3 -0
- package/dist/chunks/Messages-D6CRTH2m.js +10 -0
- package/dist/chunks/{Onboarding-t-P6Q5O6.js → Onboarding-DDkVEq-G.js} +1 -1
- package/dist/chunks/PermissionDialog-BPhvs5xH.js +1 -0
- package/dist/chunks/PressEnterToContinue-Dwoh6CaW.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-R12fbdmp.js → PromptInputFooterSuggestions-BlhZuQ5F.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-kKyPIMau.js +1 -0
- package/dist/chunks/QueryEngine-DXpS0Ytq.js +1 -0
- package/dist/chunks/REPL-D1BCm7cR.js +128 -0
- package/dist/chunks/REPL-JQgCrSEv.js +1 -0
- package/dist/chunks/RemoteSessionManager-mWVrdNfS.js +2 -0
- package/dist/chunks/ResumeConversation-BzTn_1jS.js +1 -0
- package/dist/chunks/SSETransport-D86IVNn1.js +2 -0
- package/dist/chunks/{SearchBox-C9vUA4IM.js → SearchBox-CwwV0W-w.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-BXIja1MR.js +1 -0
- package/dist/chunks/Settings-D_i8HzEW.js +2 -0
- package/dist/chunks/{TeleportProgress-3hmIApkj.js → TeleportProgress-CW8mLRy2.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-BA1a66RK.js → TeleportRepoMismatchDialog-DZD32R-l.js} +1 -1
- package/dist/chunks/TeleportResumeWrapper-BhuUE1aq.js +1 -0
- package/dist/chunks/ThemePicker-ByQZgIbH.js +1 -0
- package/dist/chunks/{TrustDialog-Dpk03V1Y.js → TrustDialog-BzwibD_8.js} +1 -1
- package/dist/chunks/ValidationErrorsList-Cuq6W2yc.js +2 -0
- package/dist/chunks/add-dir-BQ-ljgk6.js +1 -0
- package/dist/chunks/{agentDisplay-D7bdOOG7.js → agentDisplay-tRprY4gB.js} +1 -1
- package/dist/chunks/agents-DMyQUXwl.js +101 -0
- package/dist/chunks/{agents-22wiC58F.js → agents-Dq4BCf0H.js} +1 -1
- package/dist/chunks/allErrors-CQWZ6BPw.js +1 -0
- package/dist/chunks/{api-f3GN2I_J.js → api-ClAyS7cQ.js} +1 -1
- package/dist/chunks/api-CpD5jeKe.js +1 -0
- package/dist/chunks/attributionHooks-C0aXyx9L.js +1 -0
- package/dist/chunks/{auth-Czy7GoRh.js → auth-CWAvPfX7.js} +7 -12
- package/dist/chunks/auth-DG5bkWDc.js +1 -0
- package/dist/chunks/auth-DuHfQBuH.js +1 -0
- package/dist/chunks/backgroundHousekeeping-kf_v7Vfr.js +1 -0
- package/dist/chunks/backgroundHousekeeping-rzQFJiND.js +17 -0
- package/dist/chunks/{banner-BcAM7iSx.js → banner-HfMnBd03.js} +2 -2
- package/dist/chunks/{bg-Ci7pG4eo.js → bg-DltfF1_K.js} +2 -2
- package/dist/chunks/branch-BWbCrXBJ.js +2 -0
- package/dist/chunks/{break-cache-4rlQORVk.js → break-cache-Cd1yQ-0h.js} +2 -3
- package/dist/chunks/bridgeConfig-CABsoOum.js +1 -0
- package/dist/chunks/{bridgeConfig-B80T_lw7.js → bridgeConfig-CPHAyzdg.js} +1 -1
- package/dist/chunks/{bridgeMessaging-DyvHd16Z.js → bridgeMessaging-vR7uQXB9.js} +1 -1
- package/dist/chunks/{bridgePointer-DHWK3LEe.js → bridgePointer-CiHy2tTN.js} +1 -1
- package/dist/chunks/bridgeStatusUtil-CHTx7XwJ.js +1 -0
- package/dist/chunks/btw-IGcgP-Qq.js +1 -0
- package/dist/chunks/caches-Dj1YhqrG.js +1 -0
- package/dist/chunks/caches-FP8mGB4k.js +1 -0
- package/dist/chunks/{capacityWake-ByL6fM6I.js → capacityWake-LRiPhPeM.js} +1 -1
- package/dist/chunks/{ccrClient-BALhzhPF.js → ccrClient--8aPutWE.js} +1 -1
- package/dist/chunks/claudeDesktop-CB3UCt7U.js +1 -0
- package/dist/chunks/{clear-B_yVyJXP.js → clear-CF-FZwpe.js} +1 -1
- package/dist/chunks/{cliLaunch-OPOtzhvA.js → cliLaunch-xIVvtPZy.js} +1 -1
- package/dist/chunks/{client-BMA05FW8.js → client-B7WkO81L.js} +1 -1
- package/dist/chunks/client-BCzhAEd0.js +1 -0
- package/dist/chunks/client-BU7upHOb.js +1 -0
- package/dist/chunks/commands-Cr1p7OPH.js +1 -0
- package/dist/chunks/compact-BrJGpEFZ.js +2 -0
- package/dist/chunks/{config-9rLTDOYW.js → config-BSkuQZNf.js} +1 -1
- package/dist/chunks/config-BohF3_IV.js +1 -0
- package/dist/chunks/{config-DMKtiMzJ.js → config-D78R57VA.js} +1 -1
- package/dist/chunks/context-DADnwl4t.js +1 -0
- package/dist/chunks/context-noninteractive-BAbzwNxu.js +1 -0
- package/dist/chunks/{context-noninteractive-CHzerxnH.js → context-noninteractive-kACWzgS1.js} +2 -2
- package/dist/chunks/conversation-C8w1DtXk.js +1 -0
- package/dist/chunks/conversation-Ds7zRD0x.js +1 -0
- package/dist/chunks/{createSSHSession-XkHMiGRN.js → createSSHSession-B71Plec6.js} +3 -4
- package/dist/chunks/{createSession-BNGm9fL4.js → createSession-BJeDECzt.js} +1 -1
- package/dist/chunks/createSession-Bozo4Bu8.js +1 -0
- package/dist/chunks/crossProjectResume-B1I6YzXr.js +40 -0
- package/dist/chunks/{datadog-3WUWcCFn.js → datadog-C9uqPA6N.js} +1 -1
- package/dist/chunks/{debug-Dr1SjdXn.js → debug-BQj6h99Q.js} +1 -1
- package/dist/chunks/debugUtils-B86DM1Sp.js +1 -0
- package/dist/chunks/{detached-CqfQYVOi.js → detached--wGwkuHX.js} +1 -2
- package/dist/chunks/{detectRepository-CMEkS5_2.js → detectRepository-Qy3zKoyn.js} +1 -1
- package/dist/chunks/detectRepository-tRUoPOKy.js +1 -0
- package/dist/chunks/{diff-CKlLimGq.js → diff-CzChvQyK.js} +1 -1
- package/dist/chunks/directoryCompletion-i2oWpaUe.js +1 -0
- package/dist/chunks/doctor-DdvdGkNX.js +1 -0
- package/dist/chunks/{entry-DCbq734V.js → entry-BoL8sy1Y.js} +5 -6
- package/dist/chunks/esm-DtcV71xh.js +1 -0
- package/dist/chunks/{execFileNoThrow-mXq4K0rl.js → execFileNoThrow-DYm1GeGn.js} +1 -1
- package/dist/chunks/{execSyncWrapper-Ne33rRiD.js → execSyncWrapper-CqvQqke-.js} +1 -1
- package/dist/chunks/exit-Af27f74w.js +1 -0
- package/dist/chunks/exit-s9XGerrH.js +1 -0
- package/dist/chunks/{extraUsage-C86bZVgt.js → extraUsage-DsFwXMAj.js} +1 -1
- package/dist/chunks/extractMemories-B1KbTMY0.js +1 -0
- package/dist/chunks/fast-BGU8p2uY.js +1 -0
- package/dist/chunks/fast-CuUjONVV.js +1 -0
- package/dist/chunks/{fileSuggestions-BalHmi1-.js → fileSuggestions-DU7gmksK.js} +2 -2
- package/dist/chunks/{firstPartyEventLogger-1RTgXHSz.js → firstPartyEventLogger-7pAyUdbp.js} +3 -5
- package/dist/chunks/firstPartyEventLogger-sMeCTEUW.js +1 -0
- package/dist/chunks/flushGate-4DfYr-Ru.js +1 -0
- package/dist/chunks/{fpsMetrics-DffAomdg.js → fpsMetrics-Dk_pnSHJ.js} +1 -1
- package/dist/chunks/gemini-Cll4fVQn.js +1 -0
- package/dist/chunks/generateSessionName-BgGMwpps.js +1 -0
- package/dist/chunks/{genericProcessUtils-Dc1pfb7J.js → genericProcessUtils-Bbcbi11g.js} +1 -1
- package/dist/chunks/git-BaSq69E7.js +1 -0
- package/dist/chunks/{git-CoQQ6YEf.js → git-DplvjXEY.js} +2 -3
- package/dist/chunks/{githubRepoPathMapping-CmpEaQoo.js → githubRepoPathMapping-Px3_GeD1.js} +1 -1
- package/dist/chunks/goal-D4E2WQVn.js +3 -0
- package/dist/chunks/grok-HF1PHxXb.js +1 -0
- package/dist/chunks/{grove-b9gGKgu4.js → grove-Bck1zFaD.js} +2 -2
- package/dist/chunks/help-DJp61Job.js +1 -0
- package/dist/chunks/{hooks-C-QMGvCg.js → hooks-CJ17byYD.js} +7 -7
- package/dist/chunks/hooks-CjR3Eq0Z.js +1 -0
- package/dist/chunks/initReplBridge-D09JEKHt.js +1 -0
- package/dist/chunks/install-Dd5fw0cA.js +1 -0
- package/dist/chunks/{instrumentation-DQ705pC7.js → instrumentation-jsPu6qqs.js} +4 -4
- package/dist/chunks/{job-BaMT6Lb2.js → job-BHhkQbvu.js} +1 -1
- package/dist/chunks/{jwtUtils-FQWtM6iM.js → jwtUtils-YCoZL0FW.js} +1 -1
- package/dist/chunks/keybindings-Ch5lzNB8.js +1 -0
- package/dist/chunks/{launchLocalMemory-CtZrkmaw.js → launchLocalMemory-DsaijVcO.js} +2 -2
- package/dist/chunks/launchOnboarding-DHOylaqn.js +8 -0
- package/dist/chunks/loadAgentsDir-8FioUEwX.js +1 -0
- package/dist/chunks/{loadAgentsDir-mcRW90aq.js → loadAgentsDir-CwEfQDOw.js} +661 -698
- package/dist/chunks/loadPluginHooks-C-Yk5KlI.js +1 -0
- package/dist/chunks/localSearch-BEnlgSB7.js +1 -0
- package/dist/chunks/localSearch-LcgRjjl3.js +1 -0
- package/dist/chunks/{log-27kCA_9u.js → log-BlJ7CcKG.js} +1 -1
- package/dist/chunks/{logoV2Utils--8OUQQPd.js → logoV2Utils-DG9GwFjl.js} +1 -1
- package/dist/chunks/{magicDocs-26J_l1De.js → magicDocs-qGHR3Cqh.js} +2 -2
- package/dist/chunks/main-CBVQ8bRm.js +356 -0
- package/dist/chunks/{main-CGLCy2pM.js → main-Zh18lf2J.js} +2 -2
- package/dist/chunks/{managedEnv-Ds6MlFQE.js → managedEnv-3MbOWrVs.js} +1 -1
- package/dist/chunks/managedEnv-B4YV3A_y.js +1 -0
- package/dist/chunks/{mappers-DwZw084m.js → mappers-CdY45PDA.js} +1 -1
- package/dist/chunks/mcp-BA8XQ6h1.js +1 -0
- package/dist/chunks/mcp-DI8pGrqi.js +2 -0
- package/dist/chunks/mcp-DvY_FibT.js +6 -0
- package/dist/chunks/{memoize-Co4vS6UF.js → memoize-_2f7NWDv.js} +1 -1
- package/dist/chunks/memory-C2U7CCmM.js +1 -0
- package/dist/chunks/{modalContext-CUThy6Ph.js → modalContext-wY9CeN4G.js} +1 -1
- package/dist/chunks/{mode-B80CHkqo.js → mode-ByV6NqmB.js} +2 -2
- package/dist/chunks/model-C73ETGu9.js +1 -0
- package/dist/chunks/model-CVG_RRTy.js +1 -0
- package/dist/chunks/model-CeG-iOKF.js +1 -0
- package/dist/chunks/modelOptions-A5jrCUBp.js +1 -0
- package/dist/chunks/nativeInstaller-CXFD8LDV.js +1 -0
- package/dist/chunks/{omit-KEhe84f4.js → omit-B65XeX8r.js} +1 -1
- package/dist/chunks/{onChangeAppState-Dq1tIEJI.js → onChangeAppState-EtUxsgYz.js} +1 -1
- package/dist/chunks/openai-Dx5mvMjY.js +10 -0
- package/dist/chunks/{panel-CoF2a-h4.js → panel-Bg_0PHE6.js} +1 -1
- package/dist/chunks/{parser-CUUiH40T.js → parser-a2S_eFyE.js} +1 -1
- package/dist/chunks/parser-x-w3ikxt.js +1 -0
- package/dist/chunks/{partition-DeT341qu.js → partition-8vZDG3rY.js} +1 -1
- package/dist/chunks/permissions-CJUBfBTr.js +3 -0
- package/dist/chunks/pidLock-tjm2n1Nd.js +3 -0
- package/dist/chunks/plan-eFur8bdH.js +1 -0
- package/dist/chunks/{platform-Dg1c9F_1.js → platform-DVeTi9mp.js} +2 -2
- package/dist/chunks/plugin-fYLRLdOY.js +17 -0
- package/dist/chunks/pluginAutoupdate-B4w7SSYc.js +1 -0
- package/dist/chunks/{pluginBlocklist-BfoLN9a-.js → pluginBlocklist-CMwb7gmY.js} +1 -1
- package/dist/chunks/{pluginCliCommands-Bc2Iybhz.js → pluginCliCommands-3YCj7Y3Q.js} +1 -1
- package/dist/chunks/{pluginFlagging-Cr0d0hBA.js → pluginFlagging-srvq9H7p.js} +1 -1
- package/dist/chunks/pluginOperations-C7BCR7pw.js +2 -0
- package/dist/chunks/{pluginStartupCheck-DiCDQQlr.js → pluginStartupCheck-BLc0U7W7.js} +1 -1
- package/dist/chunks/pluginStartupCheck-nzVDPI1k.js +1 -0
- package/dist/chunks/plugins-CPtmmDDi.js +4 -0
- package/dist/chunks/poorMode-DD88nPJ4.js +1 -0
- package/dist/chunks/{poorMode-DxgO_bUb.js → poorMode-wm2WkPF0.js} +1 -1
- package/dist/chunks/print-BCud0ukQ.js +14 -0
- package/dist/chunks/processBashCommand-C9-FonuX.js +1 -0
- package/dist/chunks/processSlashCommand-Bi8_1MRC.js +5 -0
- package/dist/chunks/{prompt-DIlq8NTy.js → prompt-Bm2EEG4F.js} +21 -23
- package/dist/chunks/prompt-CX_v9F3s.js +1 -0
- package/dist/chunks/prompt-V0WQJrkO2.js +1 -0
- package/dist/chunks/{promptEditor-BILqOGl1.js → promptEditor-DQ9fpdQD.js} +3 -3
- package/dist/chunks/protocolHandler--eQQuSyx.js +13 -0
- package/dist/chunks/{proxy-BEKNaTXI.js → proxy-C0j74LqT.js} +1 -1
- package/dist/chunks/reconciler-DgQ4y1Vn.js +1 -0
- package/dist/chunks/refresh-CayVRWUY.js +1 -0
- package/dist/chunks/registerProtocol-DrWIX3Lb.js +1 -0
- package/dist/chunks/{reload-plugins-CGb0HTsH.js → reload-plugins-6xcH3dLg.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BmteXmI9.js → remoteBridgeCore-BnZYGaMH.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-CwDGxL5p.js → remoteManagedSettings-CfFmrRze.js} +1 -1
- package/dist/chunks/rename-mDtCTbnD.js +1 -0
- package/dist/chunks/{renderOptions-45A-EdsK.js → renderOptions-CkqTbz6d.js} +1 -1
- package/dist/chunks/resume-DRvz4QFs.js +2 -0
- package/dist/chunks/ripgrep-Di-2j8Ws.js +1 -0
- package/dist/chunks/{ripgrep-DQ_ILUJV.js → ripgrep-DsLUmulz.js} +2 -2
- package/dist/chunks/{runtimeObserver-CtNY8Al2.js → runtimeObserver-Ba6SM-sI.js} +1 -1
- package/dist/chunks/{runtimeObserver-4ZqaCXYy.js → runtimeObserver-Dt5sGJVb.js} +4 -4
- package/dist/chunks/sandbox-adapter-Cmrd6tBj.js +1 -0
- package/dist/chunks/sandbox-toggle-DKcw3SbO.js +1 -0
- package/dist/chunks/searchExtraTools-DIgC0CFB.js +1 -0
- package/dist/chunks/{session-wb6X4Wrq.js → session-COVyD8UU.js} +2 -2
- package/dist/chunks/sessionFileAccessHooks-yAPDTrbm.js +1 -0
- package/dist/chunks/{sessionIdCompat-DMayYBrf.js → sessionIdCompat-Dgp6PW_1.js} +1 -1
- package/dist/chunks/sessionObserver-BizdPx8P.js +1 -0
- package/dist/chunks/{sessionObserver-BJQ5hwjU.js → sessionObserver-iAgSetlC.js} +2 -2
- package/dist/chunks/sessionState-zhvcDpb2.js +11 -0
- package/dist/chunks/sessionStorage-LMY409Ji.js +1 -0
- package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +3 -0
- package/dist/chunks/{sessionTitle-Cbzrb9jT.js → sessionTitle-QPRly1tZ.js} +2 -2
- package/dist/chunks/{sessionTracing-CEsm8pZL.js → sessionTracing-C4uqAdud.js} +2 -2
- package/dist/chunks/settings-BgHApyGL.js +1 -0
- package/dist/chunks/settings-CvhsRFaT.js +19 -0
- package/dist/chunks/settingsSync-BGo6dHJo.js +1 -0
- package/dist/chunks/setup-Bjw5VS6x.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-D5X5fhzj.js → shadowedRuleDetection-CzRAzcC1.js} +1 -1
- package/dist/chunks/{shellQuote-C_I6DHLV.js → shellQuote-D3Ocv_U-.js} +1 -1
- package/dist/chunks/{sideQuestion-BHRtwhyj.js → sideQuestion-oIYrx5ar.js} +3 -3
- package/dist/chunks/sinks-Bje3hCkR.js +1 -0
- package/dist/chunks/sinks-FaljTZ-c.js +1 -0
- package/dist/chunks/skillChangeDetector-v6mAYzXX.js +1 -0
- package/dist/chunks/{skillGapStore-BjQSSz2E.js → skillGapStore-CJjt3IW7.js} +2 -2
- package/dist/chunks/{skillLifecycle-Sp8strFv.js → skillLifecycle-BsgH84vl.js} +2 -2
- package/dist/chunks/{skillSearchPanel-3sYRez_Q.js → skillSearchPanel-CneXymsb.js} +4 -4
- package/dist/chunks/skills-DZRBy7vT.js +1 -0
- package/dist/chunks/{src-r6ZFgWPx2.js → src-D3yIF9I42.js} +1 -1
- package/dist/chunks/src-DL3w8VPk2.js +51 -0
- package/dist/chunks/{startupProfiler-Dc5r6LgE.js → startupProfiler-2sjXZkIP.js} +1 -1
- package/dist/chunks/startupProfiler-B2fyaBEa.js +1 -0
- package/dist/chunks/{staticRender-DrU6eWoq.js → staticRender-D9AbnQFr.js} +1 -1
- package/dist/chunks/{stats-BkadEKa-.js → stats-Dq-5qizS.js} +1 -1
- package/dist/chunks/status-BP_R8051.js +2 -0
- package/dist/chunks/status-CZYD3NGb.js +1 -0
- package/dist/chunks/statusNoticeHelpers-ODrnrLAZ.js +1 -0
- package/dist/chunks/{stringUtils-Df-Lnjxd.js → stringUtils-BjnclTLB.js} +3 -3
- package/dist/chunks/{switcher-uoQMHmEZ.js → switcher-BkGOeIzI.js} +1 -1
- package/dist/chunks/switcher-DwKN9daN.js +1 -0
- package/dist/chunks/{syncCache-BooMjgU6.js → syncCache-CpmpvjfC.js} +1 -1
- package/dist/chunks/tasks-CIUuwrX4.js +1 -0
- package/dist/chunks/teleport-IzyDplC7.js +1 -0
- package/dist/chunks/{templateJobs-BYYfF4m5.js → templateJobs-De57J461.js} +1 -3
- package/dist/chunks/{terminalSetup-CbXKCpWM.js → terminalSetup-DDvQ0K5e.js} +1 -1
- package/dist/chunks/terminalSetup-JJiXmszo.js +32 -0
- package/dist/chunks/theme-Nwii7354.js +1 -0
- package/dist/chunks/{tmux-d3cNCIZA.js → tmux-g0cQ0Buz.js} +1 -1
- package/dist/chunks/{toolEventObserver-BFEl47bq.js → toolEventObserver-Cq-uBb0-.js} +1 -1
- package/dist/chunks/toolPool-BBU4ll_p.js +1 -0
- package/dist/chunks/trustedDevice-BKzkA7fq.js +1 -0
- package/dist/chunks/{trustedDevice-BLiKbGpG.js → trustedDevice-DWZxDUxS.js} +1 -1
- package/dist/chunks/{types-BJ7qTz75.js → types-BomO8WUz.js} +1 -1
- package/dist/chunks/{udsClient-CF8BmZgN.js → udsClient-DSvRPCvR.js} +1 -1
- package/dist/chunks/upstreamproxy-DYoLvdM9.js +10 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-D48aDPG9.js +1 -0
- package/dist/chunks/useMainLoopModel-89eUU13X.js +1 -0
- package/dist/chunks/useManagePlugins-EqoQELMT.js +1 -0
- package/dist/chunks/useMergedTools-BJ4L9QSK.js +1 -0
- package/dist/chunks/{useSearchInput-KFKh2ozY.js → useSearchInput-DkVER3cm.js} +1 -1
- package/dist/chunks/useSettingsErrors-D3MlQ1GF.js +1 -0
- package/dist/chunks/{userAgent-DUrr02yh.js → userAgent-aoe_xVAb.js} +1 -1
- package/dist/chunks/util-g-5UX5gH.js +1 -0
- package/dist/chunks/validatePlugin-CSE8zjZn.js +1 -0
- package/dist/chunks/{vim-C4Hs5U2h.js → vim-s-wmybpU.js} +1 -1
- package/dist/chunks/{which-mplwBbc0.js → which-BR8YVCCW.js} +1 -1
- package/dist/chunks/{windowsPaths-C7Mdo9aU.js → windowsPaths-BmXyrasP.js} +1 -1
- package/dist/chunks/windowsPaths-BybjGW7e.js +1 -0
- package/dist/chunks/{workSecret-XLodD7tw.js → workSecret-BUd8cQ6-.js} +1 -1
- package/dist/chunks/workerRegistry-DGwy0YHB.js +2 -0
- package/dist/chunks/worktree-jjuORs7p.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-BzNj9rS6.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CDZPR488.js +0 -1
- package/dist/chunks/App-D-bYAYAl.js +0 -1
- package/dist/chunks/ApproveApiKey-BEGV9Zj9.js +0 -1
- package/dist/chunks/ApproveApiKey-CjacpIqq.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-A9hw_SV0.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-B0BizN_J.js +0 -1
- package/dist/chunks/DiffDialog-mQ-5_TSv.js +0 -6
- package/dist/chunks/Doctor-BC6IuQhd.js +0 -3
- package/dist/chunks/Doctor-i_5_AQd-.js +0 -1
- package/dist/chunks/ExitFlow-Bu2cVGpC.js +0 -2
- package/dist/chunks/Grove-D0nn8zOV.js +0 -11
- package/dist/chunks/InvalidConfigDialog-C5CIiSIE.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-Dq7hKXcO.js +0 -1
- package/dist/chunks/MCPConnectionManager-aDDsYkGM.js +0 -1
- package/dist/chunks/MCPToolListView-Cr0MDkzT.js +0 -1
- package/dist/chunks/MessageSelector-DwGOWKKL.js +0 -3
- package/dist/chunks/Messages-C1jh4ixt.js +0 -11
- package/dist/chunks/PermissionDialog-Cb3z8OUP.js +0 -1
- package/dist/chunks/PressEnterToContinue-Dq0Imo9c.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-BgADIzRj.js +0 -1
- package/dist/chunks/QueryEngine-HlLQJmsd.js +0 -1
- package/dist/chunks/REPL-Rs_JQkDc.js +0 -1
- package/dist/chunks/REPL-VKAmKkII.js +0 -133
- package/dist/chunks/RemoteSessionManager-BbgXeM-t.js +0 -2
- package/dist/chunks/ResumeConversation-66zbx12g.js +0 -1
- package/dist/chunks/SSETransport-BBQkdn4e.js +0 -4
- package/dist/chunks/SearchExtraToolsTool-Bq87I_vu.js +0 -1
- package/dist/chunks/Settings-BKdLcyXe.js +0 -2
- package/dist/chunks/TeleportResumeWrapper-BT4O-Wsi.js +0 -1
- package/dist/chunks/ThemePicker-DUlhcoso.js +0 -1
- package/dist/chunks/ValidationErrorsList-DSSUWdgd.js +0 -2
- package/dist/chunks/add-dir-BUr0z-VU.js +0 -1
- package/dist/chunks/agents-8ELI8RJo.js +0 -103
- package/dist/chunks/allErrors-C1eMbHSv.js +0 -1
- package/dist/chunks/api-DgjIFdMn.js +0 -1
- package/dist/chunks/attributionHooks-CUAoGkU6.js +0 -1
- package/dist/chunks/auth-B73a4Cob.js +0 -1
- package/dist/chunks/auth-D_0waidQ.js +0 -1
- package/dist/chunks/autoModeDenials-BxNzGJdR.js +0 -1
- package/dist/chunks/backgroundHousekeeping-C_ArdTFX.js +0 -17
- package/dist/chunks/backgroundHousekeeping-YJhvZ0dh.js +0 -1
- package/dist/chunks/branch-bb4-bErF.js +0 -3
- package/dist/chunks/bridgeConfig-DywkIo_k.js +0 -1
- package/dist/chunks/bridgeStatusUtil-DStiD05t.js +0 -1
- package/dist/chunks/btw-BRmV51bR.js +0 -1
- package/dist/chunks/caches-C5DIVdvI.js +0 -1
- package/dist/chunks/caches-zDZEgNKq.js +0 -1
- package/dist/chunks/claudeDesktop-Ct_hyICL.js +0 -1
- package/dist/chunks/client-7lIxWcaM.js +0 -1
- package/dist/chunks/client-DVg8PpFX.js +0 -1
- package/dist/chunks/commands-ByFXqW43.js +0 -1
- package/dist/chunks/compact-BUShp2eQ.js +0 -2
- package/dist/chunks/config-BwHNU_pI.js +0 -1
- package/dist/chunks/context-6Pk3iVhh.js +0 -1
- package/dist/chunks/context-noninteractive-DFwRQyFE.js +0 -1
- package/dist/chunks/conversation-5zb5XkSA.js +0 -1
- package/dist/chunks/conversation-JP2ZXrwu.js +0 -1
- package/dist/chunks/createSession-VTqzWAu6.js +0 -1
- package/dist/chunks/crossProjectResume-DxgQVYSi.js +0 -40
- package/dist/chunks/debugUtils-cK-iOsEV.js +0 -1
- package/dist/chunks/detectRepository-BsKZDRoI.js +0 -1
- package/dist/chunks/directoryCompletion-ByBTSuLu.js +0 -1
- package/dist/chunks/doctor-Bvx0u0sO.js +0 -1
- package/dist/chunks/esm-CtQkOk5D.js +0 -1
- package/dist/chunks/exit-BOhGfSlm.js +0 -2
- package/dist/chunks/exit-DTsz5Lcb.js +0 -1
- package/dist/chunks/extractMemories-6OnMgL2S.js +0 -1
- package/dist/chunks/fast-B2ziqJEA.js +0 -1
- package/dist/chunks/fast-BkhjaTkZ.js +0 -1
- package/dist/chunks/firstPartyEventLogger-CXMzhLrF.js +0 -1
- package/dist/chunks/flushGate-DWL05x7v.js +0 -1
- package/dist/chunks/gemini-BLpLJyli.js +0 -1
- package/dist/chunks/generateSessionName-CdbMksHi.js +0 -1
- package/dist/chunks/git-Bs1vtuvX.js +0 -1
- package/dist/chunks/goal-V3qix-i1.js +0 -3
- package/dist/chunks/grok-BLLATotv.js +0 -1
- package/dist/chunks/help-BR7UEr5R.js +0 -1
- package/dist/chunks/hooks-D6wtd0Qq.js +0 -1
- package/dist/chunks/initReplBridge-DyScxedy.js +0 -1
- package/dist/chunks/install-DGH_bjUh.js +0 -1
- package/dist/chunks/keybindings-CG292HS1.js +0 -2
- package/dist/chunks/launchOnboarding-CyOtdZkT.js +0 -8
- package/dist/chunks/loadAgentsDir-4UC4yLg1.js +0 -1
- package/dist/chunks/loadPluginHooks-CWI0RMUx.js +0 -1
- package/dist/chunks/localSearch-CCCDKpYx.js +0 -1
- package/dist/chunks/localSearch-D4hVR7-d.js +0 -1
- package/dist/chunks/main-DUjtDK1Q.js +0 -513
- package/dist/chunks/managedEnv-BuCurT_S.js +0 -1
- package/dist/chunks/mcp-CEKR7PjL.js +0 -6
- package/dist/chunks/mcp-DCAf2hHD.js +0 -1
- package/dist/chunks/mcp-mCuc8dNe.js +0 -2
- package/dist/chunks/memory-B5SkpC7u.js +0 -1
- package/dist/chunks/model-BqaneI4D.js +0 -1
- package/dist/chunks/model-C29_32BD.js +0 -1
- package/dist/chunks/model-NG8fvuT2.js +0 -1
- package/dist/chunks/modelOptions-CiZgZxZC.js +0 -1
- package/dist/chunks/nativeInstaller-DqbEfGSX.js +0 -1
- package/dist/chunks/openai-BvnsYTpQ.js +0 -10
- package/dist/chunks/parser-B2PlJg4C.js +0 -1
- package/dist/chunks/permissions-BPpeHxpk.js +0 -3
- package/dist/chunks/pidLock-DQGDoFQP.js +0 -3
- package/dist/chunks/plan-BRiC5ujG.js +0 -1
- package/dist/chunks/plugin-Dcg_GGR9.js +0 -17
- package/dist/chunks/pluginAutoupdate-ByH9IPC9.js +0 -1
- package/dist/chunks/pluginOperations-CKNyYjS-.js +0 -2
- package/dist/chunks/pluginStartupCheck-B48_cGgo.js +0 -1
- package/dist/chunks/plugins-BP_36tOl.js +0 -4
- package/dist/chunks/poorMode-Djw0P9Gu.js +0 -1
- package/dist/chunks/print-2uavraPq.js +0 -26
- package/dist/chunks/processBashCommand-g3sAMpHt.js +0 -1
- package/dist/chunks/processSlashCommand-tIbeCrv5.js +0 -5
- package/dist/chunks/prompt-DLv-Cd67.js +0 -1
- package/dist/chunks/prompt-DV5tCLRh.js +0 -1
- package/dist/chunks/protocolHandler-B83fCYI4.js +0 -13
- package/dist/chunks/reconciler-CDq6XgAS.js +0 -1
- package/dist/chunks/refresh-ysrhoWCo.js +0 -1
- package/dist/chunks/registerProtocol-DduKPsn_.js +0 -36
- package/dist/chunks/rename-1GLIUlYk.js +0 -1
- package/dist/chunks/resume-DWtlUiHW.js +0 -2
- package/dist/chunks/ripgrep-BLQnqPnE.js +0 -1
- package/dist/chunks/sandbox-adapter-BzjRQh_r.js +0 -1
- package/dist/chunks/sandbox-toggle-Bz49-F6e.js +0 -1
- package/dist/chunks/searchExtraTools-D6vj8qJ-.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-Da97UA2n.js +0 -1
- package/dist/chunks/sessionObserver-DXO4trhk.js +0 -1
- package/dist/chunks/sessionState-Bn3ESS5f.js +0 -11
- package/dist/chunks/sessionStorage-DlPVsQn9.js +0 -1
- package/dist/chunks/sessionStoragePortable-BhkGMZWp.js +0 -3
- package/dist/chunks/settings-3ionQKNv.js +0 -1
- package/dist/chunks/settings-DiBMs2gM.js +0 -20
- package/dist/chunks/settingsSync-eHaSngKo.js +0 -1
- package/dist/chunks/setup-DeyiuGNX.js +0 -3
- package/dist/chunks/sinks-Bgy2UNK-.js +0 -2
- package/dist/chunks/sinks-CgzLmim2.js +0 -1
- package/dist/chunks/skillChangeDetector-BlSP16j6.js +0 -1
- package/dist/chunks/skills-CJhWI8t1.js +0 -1
- package/dist/chunks/src-P_wYS_NJ2.js +0 -53
- package/dist/chunks/startupProfiler-CUlV07MD.js +0 -1
- package/dist/chunks/status-CDCurOqs.js +0 -2
- package/dist/chunks/status-yoQIQ2Ni.js +0 -1
- package/dist/chunks/statusNoticeHelpers-Sl4jjauz.js +0 -1
- package/dist/chunks/switcher-C-m6MUwE.js +0 -1
- package/dist/chunks/tasks-CHG_6sXQ.js +0 -1
- package/dist/chunks/teleport-C9KRE4X8.js +0 -1
- package/dist/chunks/terminalSetup-fwhFTxGi.js +0 -33
- package/dist/chunks/theme-MvX7hojJ.js +0 -1
- package/dist/chunks/toolPool-Cq74Cvjp.js +0 -1
- package/dist/chunks/trustedDevice-BGwujSqc.js +0 -1
- package/dist/chunks/updateCCB-CfckOy7T.js +0 -11
- package/dist/chunks/upstreamproxy-BuBFDFAD.js +0 -11
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-CPLBDluY.js +0 -1
- package/dist/chunks/useMainLoopModel-C00PbZ1Q.js +0 -1
- package/dist/chunks/useManagePlugins-DFaGntzJ.js +0 -1
- package/dist/chunks/useMergedTools-DYobZ5N4.js +0 -1
- package/dist/chunks/useSettingsErrors-BRgjvaHd.js +0 -1
- package/dist/chunks/util-D7uwPgF1.js +0 -1
- package/dist/chunks/validatePlugin-VukX52bx.js +0 -1
- package/dist/chunks/windowsPaths-B8p9tFRF.js +0 -1
- package/dist/chunks/workerRegistry-BA37PVbv.js +0 -6
- package/dist/chunks/worktree-Lik8xuKd.js +0 -1
- package/dist/chunks/xdg-DcF9ejUM.js +0 -1
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n,l as r,o as i,s as a}from"./envUtils-DcaKZlRU.js";import{n as o,t as s}from"./defineProperty-C-QyHrDq.js";import{n as c,t as l}from"./axios-DaWTGg7G.js";import{$g as u,$p as d,$v as f,Ah as p,BS as m,Bf as h,Bo as g,CS as _,CT as v,C_ as ee,Cm as y,Cn as b,Cu as x,Dm as S,E as C,Eg as te,En as w,Fb as ne,Fs as re,Gb as ie,Gc as ae,Gr as oe,Gv as se,H as ce,HS as le,Hb as ue,Hc as de,Hg as fe,Hx as pe,Ib as me,Is as T,Jb as he,Jc as ge,Jx as _e,Kb as ve,Kg as ye,M as be,MT as E,Mi as xe,NT as D,Nb as Se,No as O,Ns as Ce,OT as we,Pi as Te,Po as Ee,Ps as De,Px as Oe,Qd as ke,Ql as Ae,Qv as je,Qx as Me,Ro as Ne,S as Pe,SS as Fe,S_ as Ie,Sm as Le,Sn as Re,Sr as ze,Su as Be,T as Ve,Tg as He,Tn as Ue,U as We,Ug as Ge,Uo as k,Ut as A,Ux as Ke,Vc as qe,Vi as Je,Vt as Ye,Vx as Xe,Wb as Ze,Wc as Qe,Wv as $e,Xb as et,Xc as tt,Xd as j,Xn as nt,Yb as rt,Yc as it,Yd as at,Yg as ot,Ys as st,Zb as ct,Zc as lt,Zd as ut,Zg as dt,Zl as ft,_E as pt,_m as mt,_n as ht,_s as gt,ax as _t,b as vt,b_ as yt,bg as bt,bm as xt,br as St,cf as Ct,cx as wt,cy as Tt,db as Et,dc as Dt,ds as Ot,el as kt,em as At,er as jt,f as Mt,fo as Nt,fp as Pt,fs as Ft,gT as It,gm as Lt,gs as Rt,gy as zt,hm as Bt,hs as Vt,ic as Ht,ii as Ut,io as Wt,jx as Gt,kT as Kt,kh as qt,ki as Jt,lb as Yt,ls as Xt,ly as Zt,mm as Qt,ms as $t,mw as en,nc as tn,ny as nn,o as rn,oc as an,of as on,og as sn,oi as cn,oo as ln,ox as un,pm as dn,ps as fn,pw as pn,py as mn,qc as hn,qg as gn,qs as _n,qx as vn,rC as yn,rc as bn,ri as xn,ro as Sn,ry as Cn,s as wn,sg as Tn,si as En,ty as Dn,ub as On,uc as kn,uo as An,up as jn,us as Mn,uy as Nn,va as Pn,vi as Fn,vm as In,vs as Ln,wT as Rn,wm as zn,wn as Bn,x_ as Vn,xg as Hn,xm as Un,xn as Wn,xr as Gn,xx as Kn,y as qn,yT as Jn,yg as Yn,yi as Xn,ym as Zn,yu as Qn,za as $n,zb as er,zf as tr,zi as nr}from"./loadAgentsDir-mcRW90aq.js";import{A as M,C as N,M as P,O as F,b as I,f as rr,g as ir,j as L,l as R,m as z,p as B,u as ar,w as V,y as or}from"./external-CEp-aPkt.js";import{i as H,n as U,r as sr,t as cr}from"./lazySchema-B4D4qJVE.js";import{$t as lr,Gt as ur,M as dr,Mn as fr,Nn as pr,P as mr,Wt as hr,Y as gr,hn as _r,or as vr,pt as W,qn as yr,yn as br}from"./state-BPFYBqm1.js";import{n as xr,t as Sr}from"./cwd-Besi3Os3.js";import{C as Cr,E as wr,P as G,R as Tr,S as Er,U as Dr,a as Or,c as K,f as kr,i as Ar,nt as jr,tt as Mr,u as Nr,x as Pr}from"./debug-Dr1SjdXn.js";import{Bn as Fr,G as Ir,Rn as Lr,cr as Rr,d as zr,dt as Br,f as Vr,g as Hr,it as Ur,nt as Wr,or as Gr,vt as Kr}from"./settings-DiBMs2gM.js";import{F as qr,M as Jr}from"./config-9rLTDOYW.js";import{i as Yr,n as Xr,o as q}from"./process-gEbdy6uY.js";import{A as Zr,O as Qr,k as $r}from"./git-CoQQ6YEf.js";import{H as ei,c as ti,i as ni,o as ri,q as ii,s as J}from"./log-27kCA_9u.js";import{s as ai,u as oi}from"./types-BJ7qTz75.js";import{n as si,r as Y}from"./analytics-DJobLaWP.js";import{Bt as ci,C as li,Gr as ui,Mn as di,Y as fi,_ as pi,_n as mi,_r as hi,ai as gi,bt as _i,et as vi,ii as yi,it as bi,jn as xi,o as Si,qr as Ci,ri as wi,rt as Ti,si as Ei,tt as Di,u as Oi,vn as ki,vr as Ai,x as ji}from"./model-C29_32BD.js";import{at as Mi,bn as Ni,bt as Pi,ot as Fi,rn as Ii,vt as Li,xn as Ri,yt as zi}from"./prompt-DIlq8NTy.js";import{A as Bi,D as Vi,M as Hi,_ as Ui,a as Wi,c as Gi,k as Ki,l as qi,n as Ji,o as Yi,s as Xi,st as Zi,t as Qi,w as $i,x as ea}from"./sessionState-Bn3ESS5f.js";import{n as ta,t as na}from"./omit-KEhe84f4.js";import{a as ra,n as ia,t as aa}from"./bridgeConfig-B80T_lw7.js";import{i as oa,n as sa,s as ca}from"./mappers-DwZw084m.js";import{n as la,r as ua}from"./sessionTitle-Cbzrb9jT.js";import{t as da}from"./pollConfig-BgpfHQPJ.js";import{t as fa}from"./controlMessageCompat-IFu4Gc1y.js";import{n as pa,t as ma}from"./ccrClient-BALhzhPF.js";import{n as ha,t as ga}from"./HybridTransport-BQNLZNa_.js";import{n as _a,t as va}from"./SSETransport-BBQkdn4e.js";import{a as ya,n as ba}from"./grove-b9gGKgu4.js";import{o as xa}from"./remoteManagedSettings-CwDGxL5p.js";import{i as Sa,r as Ca}from"./auth-Czy7GoRh.js";import{t as wa}from"./pluginBlocklist-BfoLN9a-.js";import{t as Ta}from"./settingsSync-eHaSngKo.js";import{n as Ea,t as Da}from"./toolPool-Cq74Cvjp.js";import{t as Oa}from"./onChangeAppState-Dq1tIEJI.js";import{n as ka,r as Aa}from"./QueryEngine-HlLQJmsd.js";import{r as ja}from"./bridgeStatusUtil-DStiD05t.js";import{n as Ma,r as Na}from"./sideQuestion-BHRtwhyj.js";import{n as Pa,r as Fa}from"./context-noninteractive-CHzerxnH.js";import{n as Ia,t as La}from"./modelOptions-CiZgZxZC.js";import{a as Ra,o as za,t as Ba}from"./skillChangeDetector-BlSP16j6.js";import{n as Va}from"./reconciler-CDq6XgAS.js";import{n as Ha,t as Ua}from"./refresh-ysrhoWCo.js";import{basename as Wa,dirname as Ga,join as Ka}from"path";import{PassThrough as qa}from"stream";import{randomUUID as X}from"crypto";import{mkdir as Ja,readFile as Ya,stat as Xa,writeFile as Za}from"fs/promises";import{URL as Qa}from"url";import{cwd as $a}from"process";i(),o(),l(),hr(),Mr(),Tr(),Pr(),kr(),Xr(),Ar(),Qr(),ii(),ri(),Lr(),ai(),Hr(),Ei(),Ci(),Ai(),xi(),mi(),ci(),pi(),Ta(),sr(),cr();var eo=U(()=>V({inputTokens:N(),outputTokens:N(),cacheReadInputTokens:N(),cacheCreationInputTokens:N(),webSearchRequests:N(),costUSD:N(),contextWindow:N(),maxOutputTokens:N()})),to=U(()=>I(`json_schema`));U(()=>V({type:to()}));var no=U(()=>V({type:I(`json_schema`),schema:F(M(),P())}));U(()=>no());var ro=U(()=>R([`user`,`project`,`org`,`temporary`,`oauth`]));U(()=>R([`local`,`user`,`project`]).describe(`Config scope for settings.`)),U(()=>I(`context-1m-2025-08-07`));var io=U(()=>V({type:I(`adaptive`)}).describe(`Claude decides when and how much to think (Opus 4.6+).`)),ao=U(()=>V({type:I(`enabled`),budgetTokens:N().optional()}).describe(`Fixed thinking token budget (older models)`)),oo=U(()=>V({type:I(`disabled`)}).describe(`No extended thinking`));U(()=>L([io(),ao(),oo()]).describe(`Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.`));var so=U(()=>V({type:I(`stdio`).optional(),command:M(),args:B(M()).optional(),env:F(M(),M()).optional()})),co=U(()=>V({type:I(`sse`),url:M(),headers:F(M(),M()).optional()})),lo=U(()=>V({type:I(`http`),url:M(),headers:F(M(),M()).optional()})),uo=U(()=>V({type:I(`sdk`),name:M()})),fo=U(()=>L([so(),co(),lo(),uo()])),po=U(()=>V({type:I(`claudeai-proxy`),url:M(),id:M()})),mo=U(()=>L([fo(),po()])),ho=U(()=>V({name:M().describe(`Server name as configured`),status:R([`connected`,`failed`,`needs-auth`,`pending`,`disabled`]).describe(`Current connection status`),serverInfo:V({name:M(),version:M()}).optional().describe(`Server information (available when connected)`),error:M().optional().describe(`Error message (available when status is 'failed')`),config:mo().optional().describe(`Server configuration (includes URL for HTTP/SSE servers)`),scope:M().optional().describe(`Configuration scope (e.g., project, user, local, claudeai, managed)`),tools:B(V({name:M(),description:M().optional(),annotations:V({readOnly:z().optional(),destructive:z().optional(),openWorld:z().optional()}).optional()})).optional().describe(`Tools provided by this server (available when connected)`),capabilities:V({experimental:F(M(),P()).optional()}).optional().describe(`@internal Server capabilities (available when connected). experimental['claude/channel'] is only present if the server's plugin is on the approved channels allowlist — use its presence to decide whether to show an Enable-channel prompt.`)}).describe(`Status information for an MCP server connection.`));U(()=>V({added:B(M()).describe(`Names of servers that were added`),removed:B(M()).describe(`Names of servers that were removed`),errors:F(M(),M()).describe(`Map of server names to error messages for servers that failed to connect`)}).describe(`Result of a setMcpServers operation.`));var go=U(()=>R([`userSettings`,`projectSettings`,`localSettings`,`session`,`cliArg`])),_o=U(()=>R([`allow`,`deny`,`ask`])),vo=U(()=>V({toolName:M(),ruleContent:M().optional()})),yo=U(()=>ir(`type`,[V({type:I(`addRules`),rules:B(vo()),behavior:_o(),destination:go()}),V({type:I(`replaceRules`),rules:B(vo()),behavior:_o(),destination:go()}),V({type:I(`removeRules`),rules:B(vo()),behavior:_o(),destination:go()}),V({type:I(`setMode`),mode:or(()=>xo()),destination:go()}),V({type:I(`addDirectories`),directories:B(M()),destination:go()}),V({type:I(`removeDirectories`),directories:B(M()),destination:go()})])),bo=U(()=>R([`user_temporary`,`user_permanent`,`user_reject`]).describe(`Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs).`));U(()=>L([V({behavior:I(`allow`),updatedInput:F(M(),P()).optional(),updatedPermissions:B(yo()).optional(),toolUseID:M().optional(),decisionClassification:bo().optional()}),V({behavior:I(`deny`),message:M(),interrupt:z().optional(),toolUseID:M().optional(),decisionClassification:bo().optional()})]));var xo=U(()=>R([`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`,`auto`]).describe(`Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. 'auto' - Automatic mode (transcript classifier).`)),So=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`),Co=U(()=>R(So)),Z=U(()=>V({session_id:M(),transcript_path:M(),cwd:M(),permission_mode:M().optional(),agent_id:M().optional().describe(`Subagent identifier. Present only when the hook fires from within a subagent (e.g., a tool called by an AgentTool worker). Absent for the main thread, even in --agent sessions. Use this field (not agent_type) to distinguish subagent calls from main-thread calls.`),agent_type:M().optional().describe(`Agent type name (e.g., "general-purpose", "code-reviewer"). Present when the hook fires from within a subagent (alongside agent_id), or on the main thread of a session started with --agent (without agent_id).`)})),wo=U(()=>Z().and(V({hook_event_name:I(`PreToolUse`),tool_name:M(),tool_input:P(),tool_use_id:M()}))),To=U(()=>Z().and(V({hook_event_name:I(`PermissionRequest`),tool_name:M(),tool_input:P(),permission_suggestions:B(yo()).optional()}))),Eo=U(()=>Z().and(V({hook_event_name:I(`PostToolUse`),tool_name:M(),tool_input:P(),tool_response:P(),tool_use_id:M()}))),Do=U(()=>Z().and(V({hook_event_name:I(`PostToolUseFailure`),tool_name:M(),tool_input:P(),tool_use_id:M(),error:M(),is_interrupt:z().optional()}))),Oo=U(()=>Z().and(V({hook_event_name:I(`PermissionDenied`),tool_name:M(),tool_input:P(),tool_use_id:M(),reason:M()}))),ko=U(()=>Z().and(V({hook_event_name:I(`Notification`),message:M(),title:M().optional(),notification_type:M()}))),Ao=U(()=>Z().and(V({hook_event_name:I(`UserPromptSubmit`),prompt:M()}))),jo=U(()=>Z().and(V({hook_event_name:I(`SessionStart`),source:R([`startup`,`resume`,`clear`,`compact`]),agent_type:M().optional(),model:M().optional()}))),Mo=U(()=>Z().and(V({hook_event_name:I(`Setup`),trigger:R([`init`,`maintenance`])}))),No=U(()=>Z().and(V({hook_event_name:I(`Stop`),stop_hook_active:z(),last_assistant_message:M().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),Po=U(()=>Z().and(V({hook_event_name:I(`StopFailure`),error:js(),error_details:M().optional(),last_assistant_message:M().optional()}))),Fo=U(()=>Z().and(V({hook_event_name:I(`SubagentStart`),agent_id:M(),agent_type:M()}))),Io=U(()=>Z().and(V({hook_event_name:I(`SubagentStop`),stop_hook_active:z(),agent_id:M(),agent_transcript_path:M(),agent_type:M(),last_assistant_message:M().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),Lo=U(()=>Z().and(V({hook_event_name:I(`PreCompact`),trigger:R([`manual`,`auto`]),custom_instructions:M().nullable()}))),Ro=U(()=>Z().and(V({hook_event_name:I(`PostCompact`),trigger:R([`manual`,`auto`]),compact_summary:M().describe(`The conversation summary produced by compaction`)}))),zo=U(()=>Z().and(V({hook_event_name:I(`TeammateIdle`),teammate_name:M(),team_name:M()}))),Bo=U(()=>Z().and(V({hook_event_name:I(`TaskCreated`),task_id:M(),task_subject:M(),task_description:M().optional(),teammate_name:M().optional(),team_name:M().optional()}))),Vo=U(()=>Z().and(V({hook_event_name:I(`TaskCompleted`),task_id:M(),task_subject:M(),task_description:M().optional(),teammate_name:M().optional(),team_name:M().optional()}))),Ho=U(()=>Z().and(V({hook_event_name:I(`Elicitation`),mcp_server_name:M(),message:M(),mode:R([`form`,`url`]).optional(),url:M().optional(),elicitation_id:M().optional(),requested_schema:F(M(),P()).optional()})).describe(`Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.`)),Uo=U(()=>Z().and(V({hook_event_name:I(`ElicitationResult`),mcp_server_name:M(),elicitation_id:M().optional(),mode:R([`form`,`url`]).optional(),action:R([`accept`,`decline`,`cancel`]),content:F(M(),P()).optional()})).describe(`Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.`)),Wo=[`user_settings`,`project_settings`,`local_settings`,`policy_settings`,`skills`],Go=U(()=>Z().and(V({hook_event_name:I(`ConfigChange`),source:R(Wo),file_path:M().optional()}))),Ko=[`session_start`,`nested_traversal`,`path_glob_match`,`include`,`compact`],qo=[`User`,`Project`,`Local`,`Managed`],Jo=U(()=>Z().and(V({hook_event_name:I(`InstructionsLoaded`),file_path:M(),memory_type:R(qo),load_reason:R(Ko),globs:B(M()).optional(),trigger_file_path:M().optional(),parent_file_path:M().optional()}))),Yo=U(()=>Z().and(V({hook_event_name:I(`WorktreeCreate`),name:M()}))),Xo=U(()=>Z().and(V({hook_event_name:I(`WorktreeRemove`),worktree_path:M()}))),Zo=U(()=>Z().and(V({hook_event_name:I(`CwdChanged`),old_cwd:M(),new_cwd:M()}))),Qo=U(()=>Z().and(V({hook_event_name:I(`FileChanged`),file_path:M(),event:R([`change`,`add`,`unlink`])}))),$o=[`clear`,`resume`,`logout`,`prompt_input_exit`,`other`,`bypass_permissions_disabled`],es=U(()=>R($o)),ts=U(()=>Z().and(V({hook_event_name:I(`SessionEnd`),reason:es()}))),ns=U(()=>L([wo(),Eo(),Do(),Oo(),ko(),Ao(),jo(),ts(),No(),Po(),Fo(),Io(),Lo(),Ro(),To(),Mo(),zo(),Bo(),Vo(),Ho(),Uo(),Go(),Jo(),Yo(),Xo(),Zo(),Qo()])),rs=U(()=>V({async:I(!0),asyncTimeout:N().optional()})),is=U(()=>V({hookEventName:I(`PreToolUse`),permissionDecision:_o().optional(),permissionDecisionReason:M().optional(),updatedInput:F(M(),P()).optional(),additionalContext:M().optional()})),as=U(()=>V({hookEventName:I(`UserPromptSubmit`),additionalContext:M().optional()})),os=U(()=>V({hookEventName:I(`SessionStart`),additionalContext:M().optional(),initialUserMessage:M().optional(),watchPaths:B(M()).optional()})),ss=U(()=>V({hookEventName:I(`Setup`),additionalContext:M().optional()})),cs=U(()=>V({hookEventName:I(`SubagentStart`),additionalContext:M().optional()})),ls=U(()=>V({hookEventName:I(`PostToolUse`),additionalContext:M().optional(),updatedMCPToolOutput:P().optional()})),us=U(()=>V({hookEventName:I(`PostToolUseFailure`),additionalContext:M().optional()})),ds=U(()=>V({hookEventName:I(`PermissionDenied`),retry:z().optional()})),fs=U(()=>V({hookEventName:I(`Notification`),additionalContext:M().optional()})),ps=U(()=>V({hookEventName:I(`PermissionRequest`),decision:L([V({behavior:I(`allow`),updatedInput:F(M(),P()).optional(),updatedPermissions:B(yo()).optional()}),V({behavior:I(`deny`),message:M().optional(),interrupt:z().optional()})])})),ms=U(()=>V({hookEventName:I(`CwdChanged`),watchPaths:B(M()).optional()})),hs=U(()=>V({hookEventName:I(`FileChanged`),watchPaths:B(M()).optional()})),gs=U(()=>V({continue:z().optional(),suppressOutput:z().optional(),stopReason:M().optional(),decision:R([`approve`,`block`]).optional(),systemMessage:M().optional(),reason:M().optional(),hookSpecificOutput:L([is(),as(),os(),ss(),cs(),ls(),us(),ds(),fs(),ps(),_s(),vs(),ms(),hs(),ys()]).optional()})),_s=U(()=>V({hookEventName:I(`Elicitation`),action:R([`accept`,`decline`,`cancel`]).optional(),content:F(M(),P()).optional()}).describe(`Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.`)),vs=U(()=>V({hookEventName:I(`ElicitationResult`),action:R([`accept`,`decline`,`cancel`]).optional(),content:F(M(),P()).optional()}).describe(`Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server.`)),ys=U(()=>V({hookEventName:I(`WorktreeCreate`),worktreePath:M()}).describe(`Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead.`));U(()=>L([rs(),gs()]));var bs=U(()=>V({key:M().describe(`Unique key for this option, returned in the response`),label:M().describe(`Display text for this option`),description:M().optional().describe(`Optional description shown below the label`)}));U(()=>V({prompt:M().describe(`Request ID. Presence of this key marks the line as a prompt request.`),message:M().describe(`The prompt message to display to the user`),options:B(bs()).describe(`Available options for the user to choose from`)})),U(()=>V({prompt_response:M().describe(`The request ID from the corresponding prompt request`),selected:M().describe(`The key of the selected option`)}));var xs=U(()=>V({name:M().describe(`Skill name (without the leading slash)`),description:M().describe(`Description of what the skill does`),argumentHint:M().describe(`Hint for skill arguments (e.g., "<file>")`)}).describe(`Information about an available skill (invoked via /command syntax).`)),Ss=U(()=>V({name:M().describe(`Agent type identifier (e.g., "Explore")`),description:M().describe(`Description of when to use this agent`),model:M().optional().describe(`Model alias this agent uses. If omitted, inherits the parent's model`)}).describe(`Information about an available subagent that can be invoked via the Task tool.`)),Cs=U(()=>V({value:M().describe(`Model identifier to use in API calls`),displayName:M().describe(`Human-readable display name`),description:M().describe(`Description of the model's capabilities`),supportsAdaptiveThinking:z().optional().describe(`Whether this model supports adaptive thinking (Claude decides when and how much to think)`),supportsFastMode:z().optional().describe(`Whether this model supports fast mode`),supportsAutoMode:z().optional().describe(`Whether this model supports auto mode`)}).describe(`Information about an available model.`)),ws=U(()=>V({email:M().optional(),organization:M().optional(),subscriptionType:M().optional(),tokenSource:M().optional(),apiKeySource:M().optional(),apiProvider:R([`firstParty`,`bedrock`,`vertex`,`foundry`]).optional().describe(`Active API backend. Anthropic OAuth login only applies when "firstParty"; for 3P providers the other fields are absent and auth is external (AWS creds, gcloud ADC, etc.).`)}).describe(`Information about the logged in user's account.`)),Ts=U(()=>L([M(),F(M(),fo())])),Es=U(()=>V({description:M().describe(`Natural language description of when to use this agent`),tools:B(M()).optional().describe(`Array of allowed tool names. If omitted, inherits all tools from parent`),disallowedTools:B(M()).optional().describe(`Array of tool names to explicitly disallow for this agent`),prompt:M().describe(`The agent's system prompt`),model:M().optional().describe(`Model alias (e.g. 'sonnet', 'opus', 'haiku') or full model ID (e.g. 'claude-opus-4-5'). If omitted or 'inherit', uses the main model`),mcpServers:B(Ts()).optional(),criticalSystemReminder_EXPERIMENTAL:M().optional().describe(`Experimental: Critical reminder added to system prompt`),skills:B(M()).optional().describe(`Array of skill names to preload into the agent context`),initialPrompt:M().optional().describe(`Auto-submitted as the first user turn when this agent is the main thread agent. Slash commands are processed. Prepended to any user-provided prompt.`),maxTurns:N().int().positive().optional().describe(`Maximum number of agentic turns (API round-trips) before stopping`),background:z().optional().describe(`Run this agent as a background task (non-blocking, fire-and-forget) when invoked`),memory:R([`user`,`project`,`local`]).optional().describe(`Scope for auto-loading agent memory files. 'user' - ~/.workmate/agent-memory/<agentType>/, 'project' - .workmate/agent-memory/<agentType>/, 'local' - .workmate/agent-memory-local/<agentType>/`),permissionMode:xo().optional().describe(`Permission mode controlling how tool executions are handled`)}).describe(`Definition for a custom subagent that can be invoked via the Agent tool.`));U(()=>R([`user`,`project`,`local`]).describe(`Source for loading filesystem-based settings. 'user' - Global user settings (~/.workmate/settings.json). 'project' - Project settings (.workmate/settings.json). 'local' - Local settings (.workmate/settings.local.json).`)),U(()=>V({type:I(`local`).describe(`Plugin type. Currently only 'local' is supported`),path:M().describe(`Absolute or relative path to the plugin directory`)}).describe(`Configuration for loading a plugin.`)),U(()=>V({canRewind:z(),error:M().optional(),filesChanged:B(M()).optional(),insertions:N().optional(),deletions:N().optional()}).describe(`Result of a rewindFiles operation.`));var Ds=U(()=>P()),Os=U(()=>P()),ks=U(()=>P()),Q=U(()=>M()),As=U(()=>P()),js=U(()=>R([`authentication_failed`,`billing_error`,`rate_limit`,`invalid_request`,`server_error`,`unknown`,`max_output_tokens`])),Ms=U(()=>L([I(`compacting`),ar()])),Ns=U(()=>V({type:I(`user`),message:Ds(),parent_tool_use_id:M().nullable(),isSynthetic:z().optional(),tool_use_result:P().optional(),priority:R([`now`,`next`,`later`]).optional(),timestamp:M().optional().describe(`ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.`)})),Ps=U(()=>Ns().extend({uuid:Q().optional(),session_id:M().optional()})),Fs=U(()=>Ns().extend({uuid:Q(),session_id:M(),isReplay:I(!0)})),Is=U(()=>V({status:R([`allowed`,`allowed_warning`,`rejected`]),resetsAt:N().optional(),rateLimitType:R([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:N().optional(),overageStatus:R([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:N().optional(),overageDisabledReason:R([`overage_not_provisioned`,`org_level_disabled`,`org_level_disabled_until`,`out_of_credits`,`seat_tier_level_disabled`,`member_level_disabled`,`seat_tier_zero_credit_limit`,`group_zero_credit_limit`,`member_zero_credit_limit`,`org_service_level_disabled`,`org_service_zero_credit_limit`,`no_limits_configured`,`unknown`]).optional(),isUsingOverage:z().optional(),surpassedThreshold:N().optional()}).describe(`Rate limit information for claude.ai subscription users.`)),Ls=U(()=>V({type:I(`assistant`),message:Os(),parent_tool_use_id:M().nullable(),error:js().optional(),uuid:Q(),session_id:M()})),Rs=U(()=>V({type:I(`rate_limit_event`),rate_limit_info:Is(),uuid:Q(),session_id:M()}).describe(`Rate limit event emitted when rate limit info changes.`)),zs=U(()=>V({type:I(`streamlined_text`),text:M().describe(`Text content preserved from the assistant message`),session_id:M(),uuid:Q()}).describe(`@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.`)),Bs=U(()=>V({type:I(`streamlined_tool_use_summary`),tool_summary:M().describe(`Summary of tool calls (e.g., "Read 2 files, wrote 1 file")`),session_id:M(),uuid:Q()}).describe(`@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.`)),Vs=U(()=>V({tool_name:M(),tool_use_id:M(),tool_input:F(M(),P())})),Hs=U(()=>V({type:I(`result`),subtype:I(`success`),duration_ms:N(),duration_api_ms:N(),is_error:z(),num_turns:N(),result:M(),stop_reason:M().nullable(),total_cost_usd:N(),usage:As(),modelUsage:F(M(),eo()),permission_denials:B(Vs()),structured_output:P().optional(),fast_mode_state:fc().optional(),uuid:Q(),session_id:M()})),Us=U(()=>V({type:I(`result`),subtype:R([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),duration_ms:N(),duration_api_ms:N(),is_error:z(),num_turns:N(),stop_reason:M().nullable(),total_cost_usd:N(),usage:As(),modelUsage:F(M(),eo()),permission_denials:B(Vs()),errors:B(M()),fast_mode_state:fc().optional(),uuid:Q(),session_id:M()})),Ws=U(()=>L([Hs(),Us()])),Gs=U(()=>V({type:I(`system`),subtype:I(`init`),agents:B(M()).optional(),apiKeySource:ro(),betas:B(M()).optional(),claude_code_version:M(),cwd:M(),tools:B(M()),mcp_servers:B(V({name:M(),status:M()})),model:M(),permissionMode:xo(),slash_commands:B(M()),output_style:M(),skills:B(M()),plugins:B(V({name:M(),path:M(),source:M().optional().describe(`@internal Plugin source identifier in "name\\@marketplace" format. Sentinels: "name\\@inline" for --plugin-dir, "name\\@builtin" for built-in plugins.`)})),fast_mode_state:fc().optional(),uuid:Q(),session_id:M()})),Ks=U(()=>V({type:I(`stream_event`),event:ks(),parent_tool_use_id:M().nullable(),uuid:Q(),session_id:M()})),qs=U(()=>V({type:I(`system`),subtype:I(`compact_boundary`),compact_metadata:V({trigger:R([`manual`,`auto`]),pre_tokens:N(),preserved_segment:V({head_uuid:Q(),anchor_uuid:Q(),tail_uuid:Q()}).optional().describe(`Relink info for messagesToKeep. Loaders splice the preserved segment at anchor_uuid (summary for suffix-preserving, boundary for prefix-preserving partial compact) so resume includes preserved content. Unset when compaction summarizes everything (no messagesToKeep).`)}),uuid:Q(),session_id:M()})),Js=U(()=>V({type:I(`system`),subtype:I(`status`),status:Ms(),permissionMode:xo().optional(),uuid:Q(),session_id:M()})),Ys=U(()=>V({type:I(`system`),subtype:I(`post_turn_summary`),summarizes_uuid:M(),status_category:R([`blocked`,`waiting`,`completed`,`review_ready`,`failed`]),status_detail:M(),is_noteworthy:z(),title:M(),description:M(),recent_action:M(),needs_action:M(),artifact_urls:B(M()),uuid:Q(),session_id:M()}).describe(`@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.`)),Xs=U(()=>V({type:I(`system`),subtype:I(`api_retry`),attempt:N(),max_retries:N(),retry_delay_ms:N(),error_status:N().nullable(),error:js(),uuid:Q(),session_id:M()}).describe(`Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response.`)),Zs=U(()=>V({type:I(`system`),subtype:I(`local_command_output`),content:M(),uuid:Q(),session_id:M()}).describe(`Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.`)),Qs=U(()=>V({type:I(`system`),subtype:I(`hook_started`),hook_id:M(),hook_name:M(),hook_event:M(),uuid:Q(),session_id:M()})),$s=U(()=>V({type:I(`system`),subtype:I(`hook_progress`),hook_id:M(),hook_name:M(),hook_event:M(),stdout:M(),stderr:M(),output:M(),uuid:Q(),session_id:M()})),ec=U(()=>V({type:I(`system`),subtype:I(`hook_response`),hook_id:M(),hook_name:M(),hook_event:M(),output:M(),stdout:M(),stderr:M(),exit_code:N().optional(),outcome:R([`success`,`error`,`cancelled`]),uuid:Q(),session_id:M()})),tc=U(()=>V({type:I(`tool_progress`),tool_use_id:M(),tool_name:M(),parent_tool_use_id:M().nullable(),elapsed_time_seconds:N(),task_id:M().optional(),uuid:Q(),session_id:M()})),nc=U(()=>V({type:I(`auth_status`),isAuthenticating:z(),output:B(M()),error:M().optional(),uuid:Q(),session_id:M()})),rc=U(()=>V({type:I(`system`),subtype:I(`files_persisted`),files:B(V({filename:M(),file_id:M()})),failed:B(V({filename:M(),error:M()})),processed_at:M(),uuid:Q(),session_id:M()})),ic=U(()=>V({type:I(`system`),subtype:I(`task_notification`),task_id:M(),tool_use_id:M().optional(),status:R([`completed`,`failed`,`stopped`]),output_file:M(),summary:M(),usage:V({total_tokens:N(),tool_uses:N(),duration_ms:N()}).optional(),uuid:Q(),session_id:M()})),ac=U(()=>V({type:I(`system`),subtype:I(`task_started`),task_id:M(),tool_use_id:M().optional(),description:M(),task_type:M().optional(),workflow_name:M().optional().describe(`meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.`),prompt:M().optional(),uuid:Q(),session_id:M()})),oc=U(()=>V({type:I(`system`),subtype:I(`session_state_changed`),state:R([`idle`,`running`,`requires_action`]),uuid:Q(),session_id:M()}).describe(`Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.`)),sc=U(()=>V({type:I(`system`),subtype:I(`task_progress`),task_id:M(),tool_use_id:M().optional(),description:M(),usage:V({total_tokens:N(),tool_uses:N(),duration_ms:N()}),last_tool_name:M().optional(),summary:M().optional(),uuid:Q(),session_id:M()})),cc=U(()=>V({type:I(`tool_use_summary`),summary:M(),preceding_tool_use_ids:B(M()),uuid:Q(),session_id:M()})),lc=U(()=>V({type:I(`system`),subtype:I(`elicitation_complete`),mcp_server_name:M(),elicitation_id:M(),uuid:Q(),session_id:M()}).describe(`Emitted when an MCP server confirms that a URL-mode elicitation is complete.`)),uc=U(()=>V({type:I(`prompt_suggestion`),suggestion:M(),uuid:Q(),session_id:M()}).describe(`Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.`));U(()=>V({sessionId:M().describe(`Unique session identifier (UUID).`),summary:M().describe(`Display title for the session: custom title, auto-generated summary, or first prompt.`),lastModified:N().describe(`Last modified time in milliseconds since epoch.`),fileSize:N().optional().describe(`File size in bytes. Only populated for local JSONL storage.`),customTitle:M().optional().describe(`User-set session title via /rename.`),firstPrompt:M().optional().describe(`First meaningful user prompt in the session.`),gitBranch:M().optional().describe(`Git branch at the end of the session.`),cwd:M().optional().describe(`Working directory for the session.`),tag:M().optional().describe(`User-set session tag.`),createdAt:N().optional().describe(`Creation time in milliseconds since epoch, extracted from the first entry's timestamp.`)}).describe(`Session metadata returned by listSessions and getSessionInfo.`));var dc=U(()=>L([Ls(),Ps(),Fs(),Ws(),Gs(),Ks(),qs(),Js(),Xs(),Zs(),Qs(),$s(),ec(),tc(),nc(),ic(),ac(),sc(),oc(),rc(),cc(),Rs(),lc(),uc()])),fc=U(()=>R([`off`,`cooldown`,`on`]).describe(`Fast mode state: off, in cooldown after rate limit, or actively enabled.`));sr(),cr();var pc=U(()=>P()),mc=U(()=>V({matcher:M().optional(),hookCallbackIds:B(M()),timeout:N().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),hc=U(()=>V({subtype:I(`initialize`),hooks:F(Co(),B(mc())).optional(),sdkMcpServers:B(M()).optional(),jsonSchema:F(M(),P()).optional(),systemPrompt:M().optional(),appendSystemPrompt:M().optional(),agents:F(M(),Es()).optional(),promptSuggestions:z().optional(),agentProgressSummaries:z().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));U(()=>V({commands:B(xs()),agents:B(Ss()),output_style:M(),available_output_styles:B(M()),models:B(Cs()),account:ws(),pid:N().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:fc().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var gc=U(()=>V({subtype:I(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),_c=U(()=>V({subtype:I(`can_use_tool`),tool_name:M(),input:F(M(),P()),permission_suggestions:B(yo()).optional(),blocked_path:M().optional(),decision_reason:M().optional(),title:M().optional(),display_name:M().optional(),tool_use_id:M(),agent_id:M().optional(),description:M().optional()}).describe(`Requests permission to use a tool with the given input.`)),vc=U(()=>V({subtype:I(`set_permission_mode`),mode:xo()}).describe(`Sets the permission mode for tool execution handling.`)),yc=U(()=>V({subtype:I(`set_model`),model:M().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),bc=U(()=>V({subtype:I(`set_max_thinking_tokens`),max_thinking_tokens:N().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),xc=U(()=>V({subtype:I(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));U(()=>V({mcpServers:B(ho())}).describe(`Response containing the current status of all MCP server connections.`));var Sc=U(()=>V({subtype:I(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Cc=U(()=>V({name:M(),tokens:N(),color:M(),isDeferred:z().optional()})),wc=U(()=>V({color:M(),isFilled:z(),categoryName:M(),tokens:N(),percentage:N(),squareFullness:N()}));U(()=>V({categories:B(Cc()),totalTokens:N(),maxTokens:N(),rawMaxTokens:N(),percentage:N(),gridRows:B(B(wc())),model:M(),memoryFiles:B(V({path:M(),type:M(),tokens:N()})),mcpTools:B(V({name:M(),serverName:M(),tokens:N(),isLoaded:z().optional()})),deferredBuiltinTools:B(V({name:M(),tokens:N(),isLoaded:z()})).optional(),systemTools:B(V({name:M(),tokens:N()})).optional(),systemPromptSections:B(V({name:M(),tokens:N()})).optional(),agents:B(V({agentType:M(),source:M(),tokens:N()})),slashCommands:V({totalCommands:N(),includedCommands:N(),tokens:N()}).optional(),skills:V({totalSkills:N(),includedSkills:N(),tokens:N(),skillFrontmatter:B(V({name:M(),source:M(),tokens:N()}))}).optional(),autoCompactThreshold:N().optional(),isAutoCompactEnabled:z(),messageBreakdown:V({toolCallTokens:N(),toolResultTokens:N(),attachmentTokens:N(),assistantMessageTokens:N(),userMessageTokens:N(),toolCallsByType:B(V({name:M(),callTokens:N(),resultTokens:N()})),attachmentsByType:B(V({name:M(),tokens:N()}))}).optional(),apiUsage:V({input_tokens:N(),output_tokens:N(),cache_creation_input_tokens:N(),cache_read_input_tokens:N()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var Tc=U(()=>V({subtype:I(`rewind_files`),user_message_id:M(),dry_run:z().optional()}).describe(`Rewinds file changes made since a specific user message.`));U(()=>V({canRewind:z(),error:M().optional(),filesChanged:B(M()).optional(),insertions:N().optional(),deletions:N().optional()}).describe(`Result of a rewindFiles operation.`));var Ec=U(()=>V({subtype:I(`cancel_async_message`),message_uuid:M()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));U(()=>V({cancelled:z()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var Dc=U(()=>V({subtype:I(`seed_read_state`),path:M(),mtime:N()}).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.`)),Oc=U(()=>V({subtype:I(`hook_callback`),callback_id:M(),input:ns(),tool_use_id:M().optional()}).describe(`Delivers a hook callback with its input data.`)),kc=U(()=>V({subtype:I(`mcp_message`),server_name:M(),message:pc()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),Ac=U(()=>V({subtype:I(`mcp_set_servers`),servers:F(M(),fo())}).describe(`Replaces the set of dynamically managed MCP servers.`));U(()=>V({added:B(M()),removed:B(M()),errors:F(M(),M())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var jc=U(()=>V({subtype:I(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));U(()=>V({commands:B(xs()),agents:B(Ss()),plugins:B(V({name:M(),path:M(),source:M().optional()})),mcpServers:B(ho()),error_count:N()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var Mc=U(()=>V({subtype:I(`mcp_reconnect`),serverName:M()}).describe(`Reconnects a disconnected or failed MCP server.`)),Nc=U(()=>V({subtype:I(`mcp_toggle`),serverName:M(),enabled:z()}).describe(`Enables or disables an MCP server.`)),Pc=U(()=>V({subtype:I(`stop_task`),task_id:M()}).describe(`Stops a running task.`)),Fc=U(()=>V({subtype:I(`apply_flag_settings`),settings:F(M(),P())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),Ic=U(()=>V({subtype:I(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));U(()=>V({effective:F(M(),P()),sources:B(V({source:R([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:F(M(),P())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:V({model:M()}).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 Lc=U(()=>V({subtype:I(`elicitation`),mcp_server_name:M(),message:M(),mode:R([`form`,`url`]).optional(),url:M().optional(),elicitation_id:M().optional(),requested_schema:F(M(),P()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),Rc=U(()=>V({action:R([`accept`,`decline`,`cancel`]),content:F(M(),P()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),zc=U(()=>L([gc(),_c(),hc(),vc(),yc(),bc(),xc(),Sc(),Oc(),kc(),Tc(),Ec(),Dc(),Ac(),jc(),Mc(),Nc(),Pc(),Fc(),Ic(),Lc()])),Bc=U(()=>V({type:I(`control_request`),request_id:M(),request:zc()})),Vc=U(()=>V({subtype:I(`success`),request_id:M(),response:F(M(),P()).optional()})),Hc=U(()=>V({subtype:I(`error`),request_id:M(),error:M(),pending_permission_requests:B(or(()=>Bc())).optional()})),Uc=U(()=>V({type:I(`control_response`),response:L([Vc(),Hc()])})),Wc=U(()=>V({type:I(`control_cancel_request`),request_id:M()}).describe(`Cancels a currently open control request.`)),Gc=U(()=>V({type:I(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),Kc=U(()=>V({type:I(`update_environment_variables`),variables:F(M(),M())}).describe(`Updates environment variables at runtime.`));U(()=>L([dc(),zs(),Bs(),Ys(),Uc(),Bc(),Wc(),Gc()])),U(()=>L([Ps(),Bc(),Uc(),Gc(),Kc()])),Bn(),sr(),cr(),dt(),Ue(),U(()=>H.object({tool_name:H.string().describe(`The name of the tool requesting permission`),input:H.record(H.string(),H.unknown()).describe(`The input for the tool`),tool_use_id:H.string().optional().describe(`The unique tool use request ID`)}));var qc=U(()=>H.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),Jc=U(()=>H.object({behavior:H.literal(`allow`),updatedInput:H.record(H.string(),H.unknown()),updatedPermissions:H.array(w()).optional().catch(e=>{K(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:H.string().optional(),decisionClassification:qc()})),Yc=U(()=>H.object({behavior:H.literal(`deny`),message:H.string(),interrupt:H.boolean().optional(),toolUseID:H.string().optional(),decisionClassification:qc()})),Xc=U(()=>H.union([Jc(),Yc()]));function Zc(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:ot(e.toolPermissionContext,t)})),u(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(K(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}xr(),Rr(),Kr(),Ur(),Ni(),Ii(),v(),Jn(),ct(),Nn(),Vi(),Ge(),mt(),d(),ut(),Ji(),it(),de(),re(),De(),Wt(),$n(),nr(),ze(),Re(),ht(),We();var Qc=/\u2028|\u2029/g;function $c(e){return e.replace(Qc,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function el(e){return $c(Cr(e))}Ar(),Pr(),sr(),dt();var tl=`SandboxNetworkAccess`;function nl(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 rl(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 il=1e3,al=class{constructor(e,t){s(this,`input`,void 0),s(this,`replayUserMessages`,void 0),s(this,`structuredInput`,void 0),s(this,`pendingRequests`,new Map),s(this,`restoredWorkerState`,Promise.resolve(null)),s(this,`inputClosed`,!1),s(this,`unexpectedResponseCallback`,void 0),s(this,`resolvedToolUseIds`,new Set),s(this,`prependedLines`,[]),s(this,`onControlRequestSent`,void 0),s(this,`onControlRequestResolved`,void 0),s(this,`outbound`,new ge),this.input=e,this.replayUserMessages=t,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>il)){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(Cr({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&&($r(`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=fa(Er(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;K(`[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&&In(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)){K(`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`){K(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||ol(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&ol(`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){q(el(e)+`
|
|
4
|
-
`)}async sendRequest(e,t,n,r=X()){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 wr))};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 ce(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=sl(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=X();e?.(rl(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:nl(s.decisionReason),tool_use_id:a,agent_id:r.agentId},Xc(),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):Zc((await l).result,t,n,r):Zc(u.result,t,n,r)}catch(e){return Zc({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&Yi(`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},b(),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},Rc(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:tl,input:{host:e.host},tool_use_id:X(),description:`Allow network connection to ${e.host}?`},Xc())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},V({mcp_response:rr()}))).mcp_response}};function ol(e){console.error(e),process.exit(1)}async function sl(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=A(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){u(i);let e=ot(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`}}}}Bi(),_a();function cl(e,t={},n,i){if(r(process.env.CLAUDE_CODE_USE_CCR_V2)){let r=new Qa(e.href);return r.protocol===`wss:`?r.protocol=`https:`:r.protocol===`ws:`&&(r.protocol=`http:`),r.pathname=r.pathname.replace(/\/$/,``)+`/worker/events/stream`,new va(r,t,n,i)}if(e.protocol===`ws:`||e.protocol===`wss:`)return r(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ga(e,t,n,i):new ha(e,t,n,i);throw Error(`Unsupported protocol: ${e.protocol}`)}mt(),Ar(),Qr(),i(),Tr(),Xr(),Ji(),_a(),o();var ll=class extends al{constructor(e,t,n){let i=new qa({encoding:`utf8`});super(i,n),s(this,`url`,void 0),s(this,`transport`,void 0),s(this,`inputStream`,void 0),s(this,`isBridge`,!1),s(this,`isDebug`,!1),s(this,`ccrClient`,null),s(this,`keepAliveTimer`,null),this.inputStream=i,this.url=new Qa(e);let a={},o=Ki();o?a.Authorization=`Bearer ${o}`:K(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;c&&(a[`x-environment-runner-version`]=c);let l=()=>{let e={},t=Ki();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e};if(this.transport=cl(this.url,a,W(),l),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=Or(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&q(e.endsWith(`
|
|
5
|
-
`)?e:e+`
|
|
6
|
-
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),r(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof va))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new ma(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{$r(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof pa?e.reason:`unknown`}),J(Error(`CCRClient initialization failed: ${G(e)}`)),at(1,`other`)}),jr(async()=>this.ccrClient?.close()),Xn((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),Fn(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};Zn((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),qi((e,t)=>{this.ccrClient?.reportState(e,t)}),Gi(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let u=da().session_keepalive_interval_v2_ms;if(this.isBridge&&u>0&&(this.keepAliveTimer=setInterval(()=>{K(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{K(`[remote-io] keep_alive write failed: ${G(e)}`)})},u),this.keepAliveTimer.unref?.()),jr(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
|
|
7
|
-
`)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&q(el(e)+`
|
|
8
|
-
`)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};Li(),Ir(),Pi(),[...zi],Mr(),Ar();var ul=`[stdout-guard]`,dl=!1,$=``,fl=null;function pl(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function ml(){dl||(dl=!0,fl=process.stdout.write.bind(process.stdout),process.stdout.write=function(e,t,n){let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);$+=r;let i,a=!0;for(;(i=$.indexOf(`
|
|
9
|
-
`))!==-1;){let e=$.slice(0,i);$=$.slice(i+1),pl(e)?a=fl(e+`
|
|
10
|
-
`):(process.stderr.write(`${ul} ${e}\n`),K(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},jr(async()=>{$.length>0&&(fl&&pl($)?fl($+`
|
|
11
|
-
`):process.stderr.write(`${ul} ${$}\n`),$=``),fl&&(process.stdout.write=fl,fl=null),dl=!1}))}Jr(),we(),Hi(),vn(),Oe(),On(),Fi(),yt(),ye(),te(),Be(),kt(),st(),Rt(),Ne(),An(),rn(),Da(),Qn(),Tr(),ri(),Bi(),pt(),Ar(),ut();function hl(e){let t=process.env.CLAUDE_CODE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(K(`Exiting after ${n}ms of idle time`),j())},n))},stop(){i&&(clearTimeout(i),i=null)}}}na(),E(),_(),on(),en();function gl(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)?_l(t):t,uuid:n}}function _l(e){return e.some(vl)?e.map(e=>{if(!vl(e))return e;let t=e.source,n=typeof t.mediaType==`string`&&t.mediaType?t.mediaType:pn(e.source.data);return{...e,source:{type:`base64`,media_type:n,data:e.source.data}}}):e}function vl(e){return e.type!==`image`||e.source?.type!==`base64`?!1:!e.source.media_type}sr(),hr(),Ar(),i(),cr(),ra();var yl=3e4;function bl(e){K(`[bridge:inbound-attach] ${e}`)}var xl=U(()=>V({file_uuid:M(),file_name:M()})),Sl=U(()=>B(xl()));function Cl(e){if(typeof e!=`object`||!e||!(`file_attachments`in e))return[];let t=Sl().safeParse(e.file_attachments);return t.success?t.data:[]}function wl(e){return Wa(e).replace(/[^a-zA-Z0-9._-]/g,`_`)||`attachment`}function Tl(){return Ka(n(),`uploads`,W())}async function El(e){let t=aa();if(!t){bl(`skip: no oauth token`);return}let n;try{let r=`${ia()}/api/oauth/files/${encodeURIComponent(e.file_uuid)}/content`,i=await c.get(r,{headers:{Authorization:`Bearer ${t}`},responseType:`arraybuffer`,timeout:yl,validateStatus:()=>!0});if(i.status!==200){bl(`fetch ${e.file_uuid} failed: status=${i.status}`);return}n=Buffer.from(i.data)}catch(t){bl(`fetch ${e.file_uuid} threw: ${t}`);return}let r=wl(e.file_name),i=(e.file_uuid.slice(0,8)||X().slice(0,8)).replace(/[^a-zA-Z0-9_-]/g,`_`),a=Tl(),o=Ka(a,`${i}-${r}`);try{await Ja(a,{recursive:!0}),await Za(o,n)}catch(e){bl(`write ${o} failed: ${e}`);return}return bl(`resolved ${e.file_uuid} → ${o} (${n.length} bytes)`),o}async function Dl(e){if(e.length===0)return``;bl(`resolving ${e.length} attachment(s)`);let t=(await Promise.all(e.map(El))).filter(e=>e!==void 0);return t.length===0?``:t.map(e=>`@"${e}"`).join(` `)+` `}function Ol(e,t){if(!t)return e;if(typeof e==`string`)return t+e;let n=e.findLastIndex(e=>e.type===`text`);if(n!==-1){let r=e[n];if(r.type===`text`)return[...e.slice(0,n),{...r,text:t+r.text},...e.slice(n+1)]}return[...e,{type:`text`,text:t.trimEnd()}]}async function kl(e,t){let n=Cl(e);return n.length===0?t:Ol(t,await Dl(n))}vi(),$e(),Tn(),Dt(),tn(),Pe(),ua(),Ma();function Al(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:X(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(At(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:X(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}wi(),yn(),_t(),ve(),ue(),p(),S(),y(),Bt(),jn(),Qe(),sa(),Fa(),Ia(),Ar(),Pr();async function jl(){try{let e=await Ya(fn(),`utf-8`),t=Br().safeParse(Er(e));return t.success?t.data:(K(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function Ml(e){await Xt(fn(),Cr(e,null,2))}async function Nl(e,t){let n=Ft();if(!n)return;let r=await Pl(t);r!==null&&await Xt(Ka(n,Ot(e)),r)}async function Pl(e){let t=[Ka(e,`.claude-plugin`,`marketplace.json`),Ka(e,`marketplace.json`),e];for(let e of t)try{return await Ya(e,`utf-8`)}catch{}return null}async function Fl(){let e=await g();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await Nl(t,n.installLocation)}catch(e){K(`Failed to save marketplace JSON for ${t}: ${e}`)}await Ml({...await jl(),...e})}si(),Mr(),Ar(),Qr(),ri(),Ne(),Rt();async function Il(){let e=Ln();K(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await k();t&&(O(),ln(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Nr().mkdir($t()),await Nr().mkdir(Vt()));let n=Object.keys(Ee()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)K(`installPluginsForHeadless: no marketplaces declared`);else{let t=await Zr(`headless_marketplace_reconcile`,()=>Va({skip:e?(e,t)=>!gt(t):void 0,onProgress:e=>{e.type===`installed`?K(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&K(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&K(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(O(),ln(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Fl();let t=await wa();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&ln(`headlessPluginInstall: plugins changed`),e&&jr(Mn),i}catch(e){return J(e),!1}finally{Y(`tengu_headless_plugin_install`,r)}}si(),Ar(),Qr(),mt(),Ji(),ri(),Xr(),d(),ut(),Mr(),xr(),We(),hr(),ze(),ht(),$n(),Pr(),i(),Ua(),An(),f(),tr(),ft(),Tr();var Ll=(Ui(),e(ea)),Rl=1e4,zl=new Set,Bl=[];function Vl(e){if(zl.has(e))return!1;if(zl.add(e),Bl.push(e),Bl.length>Rl){let e=Bl.splice(0,Bl.length-Rl);for(let t of e)zl.delete(t)}return!0}function Hl(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Ul(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
|
|
12
|
-
`):e.flatMap(Hl)}function Wl(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Gl(e,t,n,i,a,o,s,c){if(Rn.subscribe(e=>{sn(e,n),Ti()&&n(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),Ll&&!Ll.isProactiveActive()&&r(process.env.CLAUDE_CODE_PROACTIVE)&&Ll.activateProactive(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),Qt(),dn(`runHeadless_entry`),await ya()&&await ba(),dn(`after_grove_check`),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
13
|
-
`),j(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
|
|
14
|
-
`),j(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
|
|
15
|
-
`),j(1);return}let l=tu(e,c);c.outputFormat===`stream-json`&&ml();let u=It.getSandboxUnavailableReason();if(u){if(It.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${u}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),j(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${u}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(It.isSandboxingEnabled())try{await It.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${G(e)}\n`),j(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&T(e=>{let t=(()=>{switch(e.type){case`started`:return{type:`system`,subtype:`hook_started`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,uuid:X(),session_id:W()};case`progress`:return{type:`system`,subtype:`hook_progress`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,stdout:e.stdout,stderr:e.stderr,output:e.output,uuid:X(),session_id:W()};case`response`:return{type:`system`,subtype:`hook_response`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,output:e.output,stdout:e.stdout,stderr:e.stderr,exit_code:e.exitCode,outcome:e.outcome,uuid:X(),session_id:W()}}})();l.write(t)}),c.setupTrigger&&await Ie(c.setupTrigger),dn(`before_loadInitialMessages`);let d=t(),{messages:f,turnInterruptionState:p,agentSetting:m}=await eu(n,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),h=ee();if(h&&l.prependUserMessage(h),!c.agent&&!gr()&&m){let{agentDefinition:e}=Ra(m,void 0,{activeAgents:s,allAgents:s});if(e){if(n(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!wn(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}cn(e.agentType)}}if(f.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){let e=f.find(e=>e.uuid===c.rewindFiles);if(!e||e.type!==`user`){process.stderr.write(`Error: --rewind-files requires a user message UUID, but ${c.rewindFiles} is not a user message in this session\n`),j(1);return}let r=t(),i=await Xl(c.rewindFiles,r,n,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),j(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),j(0);return}let g=typeof c.resume==`string`&&(!!At(c.resume)||c.resume.endsWith(`.jsonl`)),_=!!c.sdkUrl;if(!e&&!g&&!_){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
|
|
16
|
-
`),j(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
17
|
-
`),j(1);return}let v=lt(d.mcp.tools,d.toolPermissionContext),y=[...a,...v],b=Jl(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{n(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),Yi(`requires_action`,e)});c.permissionPromptToolName&&(y=y.filter(e=>!Ri(e,c.permissionPromptToolName))),Yr(),dn(`after_loadInitialMessages`),await ui(),dn(`after_modelStrings`);let x=c.outputFormat===`json`&&c.verbose,S=[],C;dn(`before_runHeadlessStreaming`);for await(let e of Kl(l,d.mcp.clients,[...i,...d.mcp.commands],y,f,b,o,t,n,s,c,p))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(x&&S.push(e),C=e);switch(c.outputFormat){case`json`:if(!C||C.type!==`result`)throw Error(`No messages returned`);if(c.verbose){q(Cr(S)+`
|
|
18
|
-
`);break}q(Cr(C)+`
|
|
19
|
-
`);break;case`stream-json`:break;default:if(!C||C.type!==`result`)throw Error(`No messages returned`);switch(C.subtype){case`success`:q(C.result.endsWith(`
|
|
20
|
-
`)?C.result:C.result+`
|
|
21
|
-
`);break;case`error_during_execution`:q(`Execution error`);break;case`error_max_turns`:q(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:q(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:q(`Error: Failed to provide valid structured output after maximum retries.
|
|
22
|
-
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(Lt(),qr())try{let{drainPendingExtraction:e}=await import(`./extractMemories-6OnMgL2S.js`);await e()}catch{}j(C?.type===`result`&&C?.is_error?1:0)}function Kl(e,n,i,o,s,c,l,u,d,f,p,g){let _=!1,v,ee=!1,y=null,b,x=e.outbound;process.on(`SIGINT`,()=>{$r(`info`,`shutdown_signal`,{signal:`SIGINT`}),b&&!b.signal.aborted&&b.abort(),at(0)}),jr(async()=>{let t={};for(let e of je(u()))h(e)&&(t[e.type]=(t[e.type]??0)+1);$r(`info`,`run_state_at_shutdown`,{run_active:_,run_phase:v,worker_status:Qi(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),Xi(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&x.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:X(),session_id:W()})});let S={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},C;p.enableAuthStatus&&(C=hi.getInstance().subscribe(e=>{x.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:W()})}));let te=e=>{let t=ca(e);t&&x.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:X(),session_id:W()})};se.add(te);let w=s,re=_n(s,$a(),100),ce=Yt(100),ue=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;g&&g.kind!==`none`&&ue&&(K(`[print.ts] Auto-resuming interrupted turn (kind: ${g.kind})`),$l(w,g.message),Cn({mode:`prompt`,value:g.message.message.content,uuid:X()}));let de=La().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?Si():li(t),r=Pt(n),i=bi(e.value),a=di(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),fe=p.userSpecifiedModel;function me(e,t){let n=Pn(e,ji(t));w.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&x.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:W(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let T=[],ge=[],ve=new Set;function ye(t){for(let n of t){if(n.type!==`connected`||ve.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(m,async(n,r)=>{ti(t,`Elicitation request received in print mode: ${Cr(n)}`);let i=n.params.mode===`url`?`url`:`form`;Y(`tengu_mcp_elicitation_shown`,{mode:i});let a=await he(t,n.params,r.signal);if(a)return ti(t,`Elicitation resolved by hook: ${Cr(a)}`),Y(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),u=await rt(t,l,r.signal,i,c);return Y(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler(le,e=>{let{elicitationId:n}=e.params;ti(t,`Elicitation completion notification: ${n}`),Ye({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),x.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:X(),session_id:W()})}),ve.add(t)}catch{}}}async function be(){let t=new Set(Object.keys(l)),n=new Set(T.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=T.some(e=>e.type===`pending`),o=T.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of T)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await ie(l,(t,n)=>e.sendMcpMessage(t,n));T=r.clients,ge=r.tools;let i=Fr([...n,...t]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(Wr(t)))),...ge]}})),gn(T)}}be();let E={clients:[],tools:[],configs:{}},Se=e=>{let t=tt(e.toolPermissionContext,e.mcp.tools),n=Kt(Ea([...o,...ge,...E.tools],t,e.toolPermissionContext.mode),`name`);p.permissionPromptToolName&&(n=n.filter(e=>!Ri(e,p.permissionPromptToolName)));let r=mr();if(r&&!p.jsonSchema){let e=Mi(r);`tool`in e&&(n=[...n,e.tool])}return n},O=null,we=0;function Ee(){if(!O)return;let e=Math.min(we,w.length),t=w.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);we=w.length,t.length>0&&O.writeMessages(t)}let De=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Oe(e){let t=async()=>{let t=new Set(T.map(e=>e.name)),n=await iu(e,{configs:l,clients:T,tools:ge},E,d);for(let e of Object.keys(l))delete l[e];if(Object.assign(l,n.newSdkState.configs),T=n.newSdkState.clients,ge=n.newSdkState.tools,E=n.newDynamicState,n.sdkServersChanged){let e=new Set(T.map(e=>e.name)),n=Fr([...t,...e]);d(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(Wr(t)))),...ge]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return De=De.then(t,t),De}function Ne(){let e=u(),t=e.mcp.clients,n=Kt([...e.mcp.tools,...E.tools],`name`),r=new Set([...t.map(e=>e.name),...T.map(e=>e.name)]);return[...t,...T,...E.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Gt(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function Pe(){try{await Promise.all([Promise.resolve(),Zr(`headless_managed_settings_wait`,()=>xa())]),await Il()&&await He()}catch(e){J(e)}}let Ie=null;a()||(r(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Ie=Pe():Pe());let Re=hl(()=>!_),ze=i,Be=f;async function Ve(){let{agentDefinitions:e}=await Ha(d);ze=await Te($a());let t=Be.filter(e=>e.source===`flagSettings`);Be=[...e.allAgents,...t]}async function He(){let{servers:e}=await pe(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(l))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Oe(t);r&&be(),K(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=Ba.subscribe(()=>{Jt(),Te($a()).then(e=>{ze=e})}),We=()=>{setTimeout(()=>{!Ll?.isProactiveActive()||Ll.isProactivePaused()||ee||(async()=>{let e=await zn({basePrompt:`<${ei}>${new Date().toLocaleTimeString()}</${ei}>`,currentDir:$a(),shouldCreate:()=>!ee});if(ee){await xt({commands:e});return}for(let t of e)Cn({...t,uuid:X()});Ge()})().catch(e=>{J(e),K(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};zt(()=>{b&&Tt(`now`).length>0&&b.abort(`interrupt`)});let Ge=async()=>{if(_)return;if(_=!0,v=void 0,Yi(`running`),Re.stop(),dn(`run_entry`),await be(),dn(`after_updateSdkMcp`),Ie){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ki(e).then(()=>`timeout`);await Promise.race([Ie,t])===`timeout`&&(J(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),Y(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Ie;Ie=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-CWI0RMUx.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=Dn(n);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Wl(r,mn(n));)i.push(Dn(n));let a=await Un(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Ul(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(p.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&x.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:W(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=u(),l=[...s.mcp.clients,...T,...E.clients];ye(l);let f=Se(s);for(let e of o)In(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&x.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:W(),uuid:X()})}let m=r.value,g=a.claimedCommands;if(e instanceof ll&&r.mode===`prompt`&&Y(`tengu_bridge_message_received`,{is_repl:!1}),S.abortController?.abort(),S.abortController=null,S.pendingSuggestion=null,S.pendingLastEmittedEntry=null,S.lastEmitted&&r.mode===`prompt`){let e=typeof m==`string`?m:m.find(e=>e.type===`text`)?.text;typeof e==`string`&&bn(S.lastEmitted.text,e,S.lastEmitted.emittedAt,S.lastEmitted.promptId,S.lastEmitted.generationRequestId),S.lastEmitted=null}b=et(),dn(`before_ask`),hn();let _=r,v=!1;try{if(await yi(_.workload??p.workload,async()=>{for await(let t of ka({commands:Kt([...ze,...s.mcp.commands],`name`),prompt:m,promptUuid:_.uuid,isMeta:_.isMeta,cwd:$a(),tools:f,verbose:p.verbose,mcpClients:l,thinkingConfig:p.thinkingConfig,maxTurns:p.maxTurns,maxBudgetUsd:p.maxBudgetUsd,taskBudget:p.taskBudget,canUseTool:c,userSpecifiedModel:fe,fallbackModel:p.fallbackModel,jsonSchema:mr()??p.jsonSchema,mutableMessages:w,getReadFileCache:()=>ce.size===0?re:Et(re,ce),setReadFileCache:e=>{re=e;for(let[e,t]of ce.entries()){let n=re.get(e);(!n||t.timestamp>n.timestamp)&&re.set(e,t)}ce.clear()},customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt,getAppState:u,setAppState:d,abortController:b,replayUserMessages:p.replayUserMessages,includePartialMessages:p.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:Be,orphanedPermission:_.orphanedPermission,setSDKStatus:e=>{x.enqueue({type:`system`,subtype:`status`,status:e,session_id:W(),uuid:X()})}}))if(Ee(),t.type===`result`){v=!!t.is_error;for(let e of $i())x.enqueue(e);je(u()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&h(e))?y=t:(y=null,x.enqueue(t))}else{for(let e of $i())x.enqueue(e);x.enqueue(t)}}),v)await Le({commands:g,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:$a(),priority:`later`,workload:_.workload??p.workload});else{let e=await Le({commands:g,outcome:{type:`completed`},currentDir:$a(),priority:`later`,workload:_.workload??p.workload});for(let t of e)Cn({...t,uuid:X()})}}catch(e){throw await Le({commands:g,outcome:{type:`failed`,error:e},currentDir:$a(),priority:`later`,workload:_.workload??p.workload}),e}for(let e of o)In(e,`completed`);if(Ee(),O?.sendResult(),p.promptSuggestions&&!t(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){S.abortController?.abort();let e=new AbortController;S.abortController=e;let t=kn();if(!t)Ht(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await an(e,w,u,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:X(),session_id:W()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};y?(S.pendingSuggestion=r,S.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(S.lastEmitted=i,x.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Ht(`aborted`,void 0,void 0,`sdk`);return}J(Dr(e))}finally{S.inflightPromise===n.promise&&(S.inflightPromise=null)}})(),S.inflightPromise=n.promise}}Lt(),ae(),Qt()}};do{for(let e of $i())x.enqueue(e);v=`draining_commands`,await a(),i=!1;{let e=je(u()).some(e=>h(e)),t=mn(n)!==void 0;(e||t)&&(i=!0,t||(v=`waiting_for_agents`,await ki(100)))}}while(i);y&&(x.enqueue(y),y=null,S.pendingSuggestion&&(x.enqueue(S.pendingSuggestion),S.pendingLastEmittedEntry&&(S.lastEmitted={...S.pendingLastEmittedEntry,emittedAt:Date.now()},S.pendingLastEmittedEntry=null),S.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:W(),total_cost_usd:0,usage:Zi,modelUsage:{},permission_denials:[],uuid:X(),errors:[G(t),...ni().map(e=>e.error)]})}catch{}S.abortController?.abort(),j(1);return}finally{if(v=`finally_flush`,await e.flushInternalEvents(),v=`finally_post_flush`,!ke()){Yi(`idle`);for(let e of $i())x.enqueue(e)}_=!1,Re.start()}if(Ll?.isProactiveActive()&&!Ll.isProactivePaused()&&mn(n)===void 0&&!ee){We();return}if(mn(n)!==void 0){Ge();return}ee&&(S.inflightPromise&&await Promise.race([S.inflightPromise,ki(5e3)]),S.abortController?.abort(),S.abortController=null,await Ce(),Ue(),C?.(),se.delete(te),x.done())},k=function(e,t){x.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},A=function(e,t){x.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},qe=new Set;e.setUnexpectedResponseCallback(async e=>{await nu({message:e,setAppState:d,handledToolUseIds:qe,onEnqueued:()=>{Ge()}})});let Xe=new Map,Qe=new Map,$e=new Set,it=new Map,ot=null;return(async()=>{let t=!1;$r(`info`,`cli_message_loop_started`);for await(let r of e.structuredInput){let a=`uuid`in r?r.uuid:void 0;if(a&&r.type!==`user`&&r.type!==`control_response`&&In(a,`completed`),r.type===`control_request`){let a=r,o=a.request;if(a.request.subtype===`interrupt`)d(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),b&&b.abort(),S.abortController?.abort(),S.abortController=null,S.lastEmitted=null,S.pendingSuggestion=null,k(a);else if(o.subtype===`end_session`){K(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),b&&b.abort(),S.abortController?.abort(),S.abortController=null,S.lastEmitted=null,S.pendingSuggestion=null,k(a);break}else if(a.request.subtype===`initialize`){if(a.request.sdkMcpServers&&a.request.sdkMcpServers.length>0)for(let e of a.request.sdkMcpServers)l[e]={type:`sdk`,name:e};await Yl(a.request,a.request_id,t,x,i,de,e,!!p.enableAuthStatus,p,f,u),a.request.promptSuggestions&&d(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),a.request.agentProgressSummaries&&yr(!0),t=!0,Zt()&&Ge()}else if(a.request.subtype===`set_permission_mode`){let e=a.request;d(t=>({...t,toolPermissionContext:Zl(e,a.request_id,t.toolPermissionContext,x)}))}else if(a.request.subtype===`set_model`){let e=a.request.model??`default`,t=e==="default"?Si():e;fe=t,fr(t),Wi({model:t}),me(e,t),k(a)}else if(a.request.subtype===`set_max_thinking_tokens`)a.request.max_thinking_tokens===null?p.thinkingConfig=void 0:a.request.max_thinking_tokens===0?p.thinkingConfig={type:`disabled`}:p.thinkingConfig={type:`enabled`,budgetTokens:a.request.max_thinking_tokens},k(a);else if(a.request.subtype===`mcp_status`)k(a,{mcpServers:Ne()});else if(a.request.subtype===`get_context_usage`)try{let e=u(),t=await Pa({messages:w,getAppState:u,options:{mainLoopModel:Oi(),tools:Se(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt}});k(a,{...t})}catch(e){A(a,G(e))}else if(a.request.subtype===`mcp_message`){let e=a.request,t=T.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),k(a)}else if(a.request.subtype===`rewind_files`){let e=u(),t=await Xl(a.request.user_message_id,e,d,a.request.dry_run??!1);t.canRewind||a.request.dry_run?k(a,t):A(a,t.error??`Unexpected error`)}else if(a.request.subtype===`cancel_async_message`){let e=a.request.message_uuid,t=nn(t=>t.uuid===e);k(a,{cancelled:t.length>0})}else if(a.request.subtype===`seed_read_state`){try{let e=Gr(a.request.path),t=Math.floor((await Xa(e)).mtimeMs);if(t<=a.request.mtime){let n=await Ya(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
23
|
-
`,`
|
|
24
|
-
`);ce.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}k(a)}else if(a.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Oe(a.request.servers);k(a,e),t&&be()}else if(a.request.subtype===`reload_plugins`)try{let e=await Ha(d),t=Be.filter(e=>e.source===`flagSettings`);Be=[...e.agentDefinitions.allAgents,...t];let n=[],[r,i,o]=await Promise.allSettled([Te($a()),He(),Nt()]);r.status===`fulfilled`?ze=r.value:J(r.reason),i.status===`rejected`&&J(i.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):J(o.reason),k(a,{commands:ze.filter(e=>e.userInvocable!==!1).map(e=>({name:Je(e),description:xe(e),argumentHint:e.argumentHint||``})),agents:Be.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Ne(),error_count:e.error_count})}catch(e){A(a,G(e))}else if(a.request.subtype===`mcp_reconnect`){let e=u(),{serverName:t}=a.request;ve.delete(t);let r=Ke(t)??n.find(e=>e.name===t)?.config??T.find(e=>e.name===t)?.config??E.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!r)A(a,`Server not found: ${t}`);else{let e=await Ze(t,r),n=Wr(t);if(d(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...D(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...D(r.mcp.commands,e=>Kn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:ta(r.mcp.resources,t)}})),E={...E,clients:[...E.clients.filter(e=>e.name!==t),e.client],tools:[...E.tools.filter(e=>!e.name?.startsWith(n)),...e.tools]},e.client.type===`connected`)ye([e.client]),k(a);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;A(a,t)}}}else if(a.request.subtype===`mcp_toggle`){let e=u(),{serverName:t,enabled:r}=a.request;ve.delete(t);let i=Ke(t)??n.find(e=>e.name===t)?.config??T.find(e=>e.name===t)?.config??E.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!i)A(a,`Server not found: ${t}`);else if(r){Me(t,!0);let e=await Ze(t,i),n=Wr(t);if(d(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...D(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...D(r.mcp.commands,e=>Kn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:ta(r.mcp.resources,t)}})),e.client.type===`connected`)ye([e.client]),k(a);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;A(a,t)}}else{Me(t,!1);let r=[...n,...T,...E.clients,...e.mcp.clients].find(e=>e.name===t);r&&r.type===`connected`&&await ne(t,i);let o=Wr(t);d(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:i}:e),tools:D(e.mcp.tools,e=>e.name?.startsWith(o)),commands:D(e.mcp.commands,e=>Kn(e,t)),resources:ta(e.mcp.resources,t)}})),k(a)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=u(),r=Ke(e)??n.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!r)A(a,`Server not found: ${e}`);else if(r.type!==`sse`&&r.type!==`http`)A(a,`Server type "${r.type}" does not support OAuth authentication`);else try{Xe.get(e)?.abort();let t=new AbortController;Xe.set(e,t);let n,i=new Promise(e=>{n=e}),o=un(e,r,e=>n(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{Qe.set(e,t)}}),s=await Promise.race([i,o.then(()=>null)]);s?k(a,{authUrl:s,requiresUserAction:!0}):k(a,{requiresUserAction:!1}),it.set(e,o),o.then(async()=>{if(_e(e)||$e.has(e))return;let t=await Ze(e,r),n=Wr(e);d(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...D(r.mcp.tools,e=>e.name?.startsWith(n)),...t.tools],commands:[...D(r.mcp.commands,t=>Kn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...r.mcp.resources,[e]:t.resources}:ta(r.mcp.resources,e)}})),E={...E,clients:[...E.clients.filter(t=>t.name!==e),t.client],tools:[...E.tools.filter(e=>!e.name?.startsWith(n)),...t.tools]}}).catch(t=>{K(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Xe.get(e)===t&&(Xe.delete(e),Qe.delete(e),$e.delete(e),it.delete(e))})}catch(e){A(a,G(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=Qe.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)A(a,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{$e.add(e),n(t);let r=it.get(e);if(r)try{await r,k(a)}catch(e){A(a,e instanceof Error?e.message:`OAuth authentication failed`)}else k(a)}}else A(a,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;ot?.service.cleanup(),Y(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Sa,n,r=new Promise(e=>{n=e}),i=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Ca(t),Y(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),ot?.service===t&&(ot=null)});ot={service:t,flow:i},i.catch(e=>K(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,i.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);k(a,{manualUrl:e,automaticUrl:t})}catch(e){A(a,G(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!ot)A(a,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&ot.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=ot;e.then(()=>{let e=_i();k(a,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:gi()}})},e=>A(a,G(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=u(),r=Ke(e)??n.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!r)A(a,`Server not found: ${e}`);else if(r.type!==`sse`&&r.type!==`http`)A(a,`Cannot clear auth for server type "${r.type}"`);else{await wt(e,r);let t=await Ze(e,r),n=Wr(e);d(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...D(r.mcp.tools,e=>e.name?.startsWith(n)),...t.tools],commands:[...D(r.mcp.commands,t=>Kn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...r.mcp.resources,[e]:t.resources}:ta(r.mcp.resources,e)}})),k(a,{})}}else if(a.request.subtype===`apply_flag_settings`){let e=Oi(),t=dr()??{},n=a.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];_r(r),Rn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?fr(void 0):fr(String(n.model)));let i=Oi();if(i!==e){fe=i;let e=n.model?String(n.model):`default`;Wi({model:i}),me(e,i)}k(a)}else if(a.request.subtype===`get_settings`){let e=Oi();k(a,{...zr(),applied:{model:e}})}else if(a.request.subtype===`stop_task`){let{task_id:e}=a.request;try{await Ae(e,{getAppState:u,setAppState:d}),k(a,{})}catch(e){A(a,G(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(b&&!b.signal.aborted?b:et()).signal;(async()=>{try{let r=await la(e,n);if(r&&t)try{En(W(),r)}catch(e){J(e)}k(a,{title:r})}catch(e){A(a,G(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=kn(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:et()}}:await Aa({tools:Se(u()),commands:ze,mcpClients:[...u().mcp.clients,...T,...E.clients],messages:w,readFileState:re,getAppState:u,setAppState:d,customSystemPrompt:p.systemPrompt,appendSystemPrompt:p.appendSystemPrompt,thinkingConfig:p.thinkingConfig,agents:Be}),r=await Na({question:e,cacheSafeParams:n});k(a,{response:r.response})}catch(e){A(a,G(e))}})()}else if(a.request.subtype===`set_proactive`)a.request.enabled?Ll.isProactiveActive()||(Ll.activateProactive(`command`),We()):Ll.deactivateProactive(),k(a);else if(o.subtype===`remote_control`)if(o.enabled)if(O)k(a,{session_url:Fe(O.bridgeSessionId,O.sessionIngressUrl),connect_url:ja(O.environmentId,O.sessionIngressUrl),environment_id:O.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-DyScxedy.js`),r=await n({onInboundMessage(e){let t=gl(e);if(!t)return;let{content:n,uuid:r}=t;Cn({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),Ge()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){b?.abort()},onSetModel(e){let t=e==="default"?Si():e;fe=t,fr(t)},onSetMaxThinkingTokens(e){e===null?p.thinkingConfig=void 0:e===0?p.thinkingConfig={type:`disabled`}:p.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),K(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),x.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:X(),session_id:W()})},initialMessages:w.length>0?w:void 0});r?(O=r,we=w.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),k(a,{session_url:Fe(r.bridgeSessionId,r.sessionIngressUrl),connect_url:ja(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):A(a,t??`Remote Control initialization failed`)}catch(e){A(a,G(e))}}else O&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await O.teardown(),O=null),k(a);else A(a,`Unsupported control request subtype: ${a.request.subtype}`);continue}else if(r.type===`control_response`){p.replayUserMessages&&x.enqueue(r);continue}else if(r.type===`keep_alive`)continue;else if(r.type===`update_environment_variables`)continue;else if(r.type===`assistant`||r.type===`system`){let e=oa([r]);w.push(...e),r.type===`assistant`&&p.replayUserMessages&&x.enqueue(r);continue}if(r.type!==`user`)continue;let o=r;if(t=!0,o.uuid){let e=W(),t=await nt(e,o.uuid);if(t||zl.has(o.uuid)){K(`Skipping duplicate user message: ${o.uuid}`),p.replayUserMessages&&(K(`Sending acknowledgment for duplicate user message: ${o.uuid}`),x.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&In(o.uuid,`completed`);continue}Vl(o.uuid)}Cn({mode:`prompt`,value:await kl(o,o.message.content),uuid:o.uuid,priority:o.priority}),d(e=>({...e,attribution:qt(e.attribution,e=>{oe(e).catch(e=>{K(`Attribution: Failed to save snapshot: ${e}`)})})})),Ge()}ee=!0,_||(S.inflightPromise&&await Promise.race([S.inflightPromise,ki(5e3)]),S.abortController?.abort(),S.abortController=null,await Ce(),Ue(),C?.(),se.delete(te),x.done())})(),x}function ql(e){let t=async(n,r,i,a,o,s)=>{let c=s??await ce(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=Wn(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Zc(Xc().parse(oi(h.content[0].text)),e,r,i)};return t}function Jl(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await ce(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Ri(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),j(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),j(1),Error(t)}i=ql(r)}return i(t,r,a,o,s,c)}}async function Yl(e,t,n,r,i,a,o,s,c,l,u){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Mt(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=gr()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(pr(t.agentType),!c.systemPrompt&&!wn(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&fr(li(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let d=Vr()?.outputStyle||`default`,f=await Sn(Sr()),p=_i();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});lr(t)}e.jsonSchema&&br(e.jsonSchema);let m={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:Je(e),description:xe(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:d,available_output_styles:Object.keys(f),models:a,account:{email:p?.email,organization:p?.organization,subscriptionType:p?.subscription,tokenSource:p?.tokenSource,apiKeySource:p?.apiKeySource,apiProvider:gi()},pid:process.pid};if(Ti()&&Di()){let e=u();m.fast_mode_state=fi(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:m}}),s){let e=hi.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:W()})}}async function Xl(e,t,n,r){if(!bt())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Yn(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Hn(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await He(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${G(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zl(e,t,n,r){if(e.mode===`bypassPermissions`){if(C())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!Ve()){let e=vt();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${qn(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...be(n.mode,e.mode,n),mode:e.mode}}function Ql(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:W(),total_cost_usd:0,usage:Zi,modelUsage:{},permission_denials:[],uuid:X(),errors:[e]};process.stdout.write(Cr(t)+`
|
|
25
|
-
`)}else process.stderr.write(e+`
|
|
26
|
-
`)}function $l(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function eu(e,t){let n=!ur();if(t.continue)try{Y(`tengu_continue_print`,{});let r=await x(void 0,void 0);if(r)return t.forkSession||r.sessionId&&(vr(fe(r.sessionId),r.fullPath?Ga(r.fullPath):null),n&&await xn()),za(r,e),Ut(t.forkSession?{...r,worktreeSession:void 0}:r),{messages:r.messages,turnInterruptionState:r.turnInterruptionState,agentSetting:r.agentSetting}}catch(e){return J(e),j(1),{messages:[]}}if(t.teleport)try{if(!Ct(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(Y(`tengu_teleport_print`,{}),typeof t.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:n,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-C9KRE4X8.js`);await i();let a=await r(t.teleport),{branchError:o}=await e(a.branch);return{messages:n(a.log,o)}}catch(e){return J(e),j(1),{messages:[]}}if(t.resume)try{Y(`tengu_resume_print`,{});let i=Al(typeof t.resume==`string`?t.resume:``);if(!i){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof t.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${t.resume}" is not a valid UUID`),Ql(e,t.outputFormat),j(1),{messages:[]}}if(r(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,n]=await Promise.all([St(i.sessionId),t.restoredWorkerState]);n&&(e(Oa(n)),typeof n.model==`string`&&fr(n.model))}else i.isUrl&&i.ingressUrl&&r(process.env.ENABLE_SESSION_PERSISTENCE)&&await Gn(i.sessionId,i.ingressUrl);let a=await x(i.sessionId,i.jsonlFile||void 0);if(!a||a.messages.length===0)return i.isUrl||r(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(t.sessionStartHooksPromise??Vn(`startup`))}:(Ql(`No conversation found with session ID: ${i.sessionId}`,t.outputFormat),j(1),{messages:[]});if(t.resumeSessionAt){let e=a.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return Ql(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),j(1),{messages:[]};a.messages=e>=0?a.messages.slice(0,e+1):[]}return!t.forkSession&&a.sessionId&&(vr(fe(a.sessionId),a.fullPath?Ga(a.fullPath):null),n&&await xn()),za(a,e),Ut(t.forkSession?{...a,worktreeSession:void 0}:a),{messages:a.messages,turnInterruptionState:a.turnInterruptionState,agentSetting:a.agentSetting}}catch(e){return J(e),Ql(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),j(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??Vn(`startup`))}}function tu(e,t){let n;return n=typeof e==`string`?e.trim()===``?qe([]):qe([Cr({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new ll(t.sdkUrl,n,t.replayUserMessages):new al(n,t.replayUserMessages)}async function nu({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(K(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return K(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await jt(t);return a?(r.add(t),K(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),Cn({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(K(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function ru(e){return{...e,scope:`dynamic`}}async function iu(e,t,n,r){let{allowed:i,blocked:a}=Xe(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await au(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function au(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i||!Se(r,ru(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){J(e)}await ne(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=ru(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await me(t,r);if(d.push(e),e.type===`connected`){let t=await er(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Dr(e);u[t]=n.message,J(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=ru(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Gl as runHeadless};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ca as t,Gg as n,Jm as r,RC as i,Wg as a,Xm as o,Ya as s,Ym as c,_p as l,ba as u,gp as d,nl as f,qm as p,rl as m,wa as h,zC as g,za as _}from"./loadAgentsDir-mcRW90aq.js";import{I as v,fi as y,t as b}from"./src-P_wYS_NJ2.js";import{t as x}from"./jsx-runtime-Bb4Xn-E0.js";import{A as S,P as C,R as w}from"./debug-Dr1SjdXn.js";import{g as T,n as E}from"./settings-DiBMs2gM.js";import{n as D,r as O}from"./analytics-DJobLaWP.js";import{bt as k,xt as A}from"./prompt-DIlq8NTy.js";import{randomUUID as j}from"crypto";y(),b(),r(),l(),o();var M=x();function N({input:e,progress:t,verbose:n}){return(0,M.jsxs)(v,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(d,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),t?(0,M.jsx)(c,{fullOutput:t.fullOutput,output:t.output,elapsedTimeSeconds:t.elapsedTimeSeconds,totalLines:t.totalLines,verbose:n}):p.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}w(),D(),i(),_(),T();function P(){return E().defaultShell??`bash`}r(),k(),n();async function F(n,r,i,o,c){let l=A()&&P()===`powershell`;O(`tengu_input_bash`,{powershell:l});let d=h({content:s({inputString:`<bash-input>${n}</bash-input>`,precedingInputBlocks:r})}),_;c({jsx:(0,M.jsx)(N,{input:n,progress:null,verbose:o.options.verbose}),shouldHidePromptInput:!1});try{let t={...o,setToolJSX:e=>{_=e?.jsx}},r=e=>{c({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:n,progress:e.data,verbose:o.options.verbose}),_]}),shouldHidePromptInput:!1,showSpinner:!1})},s=null;l&&(s=(m(),e(f)).PowerShellTool);let v=s??p,y=(s?await s.call({command:n,dangerouslyDisableSandbox:!0},t,void 0,void 0,r):await p.call({command:n,dangerouslyDisableSandbox:!0},t,void 0,void 0,r)).data;if(!y)throw Error(`No result received from shell command`);let b=y.stderr,x=await g(v,{...y,stderr:``},j()),S=typeof x.content==`string`?x.content:a(y.stdout);return{messages:[u(),d,...i,h({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${a(b)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof S?e.interrupted?{messages:[u(),d,t({toolUse:!1}),...i],shouldQuery:!1}:{messages:[u(),d,...i,h({content:`<bash-stdout>${a(e.stdout)}</bash-stdout><bash-stderr>${a(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[u(),d,...i,h({content:`<bash-stderr>Command failed: ${a(C(e))}</bash-stderr>`})],shouldQuery:!1}}finally{c(null)}}export{F as processBashCommand};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$p as t,Ba as n,Ca as r,Cf as i,Di as a,Dm as o,Ds as s,Em as c,Es as l,Fp as u,Gw as d,H as f,Hc as p,Ip as m,Kw as h,Mf as g,Mp as _,Ni as v,Np as y,O as b,Oa as x,Of as S,Pp as C,Pv as w,Qp as T,Ri as ee,S as E,Tf as D,Tm as O,U as k,Uc as A,Vi as j,Wa as te,Ww as ne,Xb as re,Xh as ie,Ya as M,Yh as ae,Zb as oe,_a as N,ba as P,cv as se,dc as ce,fc as le,g_ as ue,iy as de,jf as fe,ji as pe,jv as me,ks as he,lc as F,m_ as I,nT as L,nw as R,ov as ge,qa as _e,rw as ve,ry as ye,tT as be,tw as xe,uy as Se,wa as z,wf as Ce,xa as we,za as Te,zi as Ee}from"./loadAgentsDir-mcRW90aq.js";import{Gn as De,Wt as Oe,pt as ke,t as Ae}from"./state-BPFYBqm1.js";import{E as je,R as Me,c as B,f as Ne,i as V,k as H,u as Pe}from"./debug-Dr1SjdXn.js";import{Dt as Fe,Ot as Ie}from"./settings-DiBMs2gM.js";import{T as U,o as Le,q as Re,s as W,w as G}from"./log-27kCA_9u.js";import{n as ze,r as K}from"./analytics-DJobLaWP.js";import{_n as Be,ni as Ve,ri as He,vn as Ue}from"./model-C29_32BD.js";import{ct as We,ot as Ge}from"./esm-CtQkOk5D.js";import{E as Ke,T as qe,w as Je}from"./sessionTracing-CEsm8pZL.js";import{randomUUID as q}from"crypto";function Ye(e,t,n,r,i){let a=0;for(let o of Ie){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{B(`Removing one-shot hook for event ${o} in skill '${r}'`),m(e,t,o,s)}:void 0;C(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&B(`Registered ${a} hooks from skill '${r}'`)}var Xe=e((()=>{Fe(),V(),u()}));function Ze(e){let t=e.trim();if(!t.startsWith(`/`))return null;let n=t.slice(1).split(` `);if(!n[0])return null;let r=n[0],i=!1,a=1;n.length>1&&n[1]===`(MCP)`&&(r+=` (MCP)`,i=!0,a=2);let o=n.slice(a).join(` `);return{commandName:r,args:o,isMcp:i}}var Qe=e((()=>{}));function $e(){return!1}function J(){if(!$e())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function et(e,t,n,r,i,a,o){let s=T(),l=e.pluginInfo?h(e.pluginInfo.repository).marketplace:void 0;K(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...l&&{_PROTO_marketplace_name:l},...D(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:d,baseAgent:f,promptMessages:p}=await le(e,t,n);B(`Executing forked slash command /${e.name} with agent ${f.agentType}`);let m=n.options.allowBackgroundForkedSlashCommands===!0;if(m&&J(),m){let t=re(),r=j(e),i=Ve(),l=e=>de({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await O({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)ye(t)},m=async e=>{o?.runId&&await c({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await Ue(Q);let o=n.options.refreshTools?.()??n.options.tools,c=[];for await(let r of y({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))c.push(r);let m=F(c,`Command completed`);B(`Background forked command /${r} completed (agent ${s})`),l(`<scheduled-task-result command="/${r}">\n${m}\n</scheduled-task-result>`);try{await u()}catch(e){W(e)}})().catch(async e=>{W(e),l(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await m(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let _=[],v=[],b=`forked-command-${e.name}`,x=0,S=e=>(x++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:b,toolUseID:`${b}-${x}`,timestamp:new Date().toISOString(),uuid:q()}),C=()=>{i({jsx:g(v,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};C();try{for await(let t of y({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){_.push(t);let e=_e([t]);if(t.type===`assistant`){let r=me(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(v.push(S(t)),C())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(v.push(S(t)),C())}}}finally{i(null)}let w=F(_,`Command completed`);return B(`Forked slash command /${e.name} completed with agent ${s}`),{messages:[z({content:M({inputString:`/${j(e)} ${t}`.trim(),precedingInputBlocks:r})}),z({content:`<local-command-stdout>\n${w}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:w}}function tt(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function nt(e,t,r,i,o,s,c,l,u,f){let p=Ze(e);if(!p){K(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[P(),...i,z({content:M({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:m,args:g,isMcp:_}=p,v=_?`mcp`:a().has(m)?m:`custom`;if(!ee(m,o.options.commands)){let n=!1;try{await Pe().stat(`/${m}`),n=!0}catch{}if(tt(m)&&!n){K(`tengu_input_slash_invalid`,{input:m});let e=`Unknown skill: ${m}`;return{messages:[P(),...i,z({content:M({inputString:e,precedingInputBlocks:t})}),...g?[we(`Args from unknown skill: ${g}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let r=q();return De(r),K(`tengu_input_prompt`,{}),qe(`user_prompt`,{prompt_length:String(e.length),prompt:Ke(e),"prompt.id":r}),{messages:[z({content:M({inputString:e,precedingInputBlocks:t}),uuid:c}),...i],shouldQuery:!0}}let{messages:y,shouldQuery:b,allowedTools:x,model:S,command:C,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:O}=await rt(m,g,s,o,t,r,l,u,c,f);if(y.length===0){let e={input:v};if(C.type===`prompt`&&C.pluginInfo){let{pluginManifest:t,repository:n}=C.pluginInfo,{marketplace:r}=h(n),i=d(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,D(C.pluginInfo))}return K(`tengu_input_command`,{...e,invocation_trigger:`user-slash`}),{messages:[],shouldQuery:!1,model:S,nextInput:T,submitNextInput:E,deferAutonomyCompletion:O}}if(y.length===2&&y[1].type===`user`&&typeof y[1].message.content==`string`&&y[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||K(`tengu_input_slash_invalid`,{input:m}),{messages:[P(),...y],shouldQuery:b,allowedTools:x,model:S};let k={input:v};if(C.type===`prompt`&&C.pluginInfo){let{pluginManifest:e,repository:t}=C.pluginInfo,{marketplace:n}=h(t),r=d(n);k._PROTO_plugin_name=e.name,n&&(k._PROTO_marketplace_name=n),k.plugin_repository=r?t:`third-party`,k.plugin_name=r?e.name:`third-party`,r&&e.version&&(k.plugin_version=e.version),Object.assign(k,D(C.pluginInfo))}K(`tengu_input_command`,{...k,invocation_trigger:`user-slash`});let A=y.length>0&&y[0]&&n(y[0]);return{messages:b||y.every(te)||A?y:[P(),...y],shouldQuery:b,allowedTools:x,model:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:O}}async function rt(e,t,n,i,a,o,s,c,l,u){let d=v(e,i.options.commands);if(d.type===`prompt`&&d.userInvocable!==!1&&Ce(e),d.userInvocable===!1)return{messages:[z({content:M({inputString:`/${e}`,precedingInputBlocks:a})}),z({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:d};try{switch(d.type){case`local-jsx`:return new Promise(e=>{let r=!1,o=(n,i)=>{if(r=!0,i?.display===`skip`){e({messages:[],shouldQuery:!1,command:d,nextInput:i?.nextInput,submitNextInput:i?.submitNextInput});return}let o=(i?.metaMessages??[]).map(e=>z({content:e,isMeta:!0})),s=ie()&&typeof n==`string`&&n.endsWith(` dismissed`),c=i?.displayArgs??t;e({messages:i?.display===`system`?s?o:[N(Y(d,c)),N(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[z({content:M({inputString:Y(d,c),precedingInputBlocks:a})}),z(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${be}</local-command-stdout>`}),...o],shouldQuery:i?.shouldQuery??!1,command:d,nextInput:i?.nextInput,submitNextInput:i?.submitNextInput})};d.load().then(e=>e.call(o,{...i,canUseTool:c},t)).then(t=>{if(t!=null){if(i.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:d});return}r||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:d.immediate===!0})}}).catch(t=>{W(t),!r&&(r=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:d}))})});case`local`:{let e=z({content:M({inputString:Y(d,d.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:a})});try{let n=P(),r=await(await d.load()).call(t,i);if(r.type===`skip`)return{messages:[],shouldQuery:!1,command:d};if(r.type===`compact`){let t=[n,e,...r.displayText?[z({content:`<local-command-stdout>${r.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],i={...r.compactionResult,messagesToKeep:[...r.compactionResult.messagesToKeep??[],...t]};return se(),{messages:I(i),shouldQuery:!1,command:d}}return{messages:[e,N(`<local-command-stdout>${r.value}</local-command-stdout>`)],shouldQuery:!1,command:d,resultText:r.value}}catch(t){return W(t),{messages:[e,N(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:d}}}case`prompt`:try{return d.context===`fork`?await et(d,t,i,a,n,c??f,u):await Z(d,t,i,a,o,l)}catch(e){return e instanceof je?{messages:[z({content:M({inputString:Y(d,t),precedingInputBlocks:a})}),r({toolUse:!1})],shouldQuery:!1,command:d}:{messages:[z({content:M({inputString:Y(d,t),precedingInputBlocks:a})}),z({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:d}}}}catch(e){if(e instanceof H)return{messages:[z({content:M({inputString:e.message,precedingInputBlocks:a})})],shouldQuery:!1,command:d};throw e}}function Y(e,t){return x(j(e),t)}function X(e,t=`loading`){return[`<${G}>${e}</${G}>`,`<${U}>${e}</${U}>`,`<skill-format>true</skill-format>`].join(`
|
|
2
|
-
`)}function it(e,t){return[`<${G}>${e}</${G}>`,`<${U}>/${e}</${U}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
|
|
3
|
-
`)}function at(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?X(e.name,e.progressMessage):it(e.name,t)}async function ot(e,t,n,r,i=[]){let a=pe(e,n);if(!a)throw new H(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,n,r=[],i=[],a){let o=await e.getPromptForCommand(t,n),c=!R(`hooks`)||ve(e.source);if(e.hooks&&c){let t=ke();Ye(n.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let u=e.source?`${e.source}:${e.name}`:e.name,d=o.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
4
|
-
|
|
5
|
-
`);Ae(e.name,u,d,Ge()?.agentId??null);let f=at(e,t),p=b(e.allowedTools??[]),m=i.length>0||r.length>0?[...i,...r,...o]:o,h=await A(s(o.filter(e=>e.type===`text`).map(e=>e.text).join(` `),n,null,[],n.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[z({content:f,uuid:a}),z({content:m,isMeta:!0}),...h,l({type:`command_permissions`,allowedTools:p,model:e.model})],shouldQuery:!0,allowedTools:p,model:e.model,command:e}}var Q,$;e((()=>{Oe(),Ee(),L(),Re(),ze(),ue(),ge(),_(),fe(),oe(),We(),he(),V(),Me(),ce(),Ne(),ae(),p(),Xe(),Le(),Se(),Te(),E(),k(),ne(),xe(),Qe(),Be(),i(),Je(),S(),w(),t(),o(),He(),Q=200,$=1e4}))();export{X as formatSkillLoadingMetadata,ot as processPromptSlashCommand,nt as processSlashCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./prompt-DIlq8NTy.js";t();export{e as isDeferredTool};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Tw as e,yw as t}from"./loadAgentsDir-mcRW90aq.js";e();export{t as clearPromptCache};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{C as e,c as t,i as n,x as r}from"./debug-Dr1SjdXn.js";import{c as i,h as a}from"./config-9rLTDOYW.js";import{r as o,t as s}from"./execFileNoThrow-mXq4K0rl.js";import{n as c,t as l}from"./which-mplwBbc0.js";import{n as u,t as d}from"./githubRepoPathMapping-CmpEaQoo.js";import{n as f}from"./banner-BcAM7iSx.js";import{a as p,i as m,n as h}from"./registerProtocol-DduKPsn_.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";r(),m(),h(),a(),n(),o(),l();var y=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],b=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function x(){let e=i().deepLinkTerminal;if(e){let t=y.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let t=process.env.TERM_PROGRAM;if(t){let e=t.replace(/\.app$/i,``).toLowerCase(),n=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(n)return{name:n.name,command:n.app}}for(let e of y){let{code:t,stdout:n}=await s(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of y){let{code:t}=await s(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function S(){let e=process.env.TERMINAL;if(e){let t=await c(e);if(t)return{name:_(e),command:t}}let t=await c(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await c(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await c(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await c(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await c(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function w(){switch(process.platform){case`darwin`:return x();case`linux`:return S();case`win32`:return C();default:return null}}async function T(e,n){let r=await w();if(!r)return t(`No terminal emulator detected`,{level:`error`}),!1;t(`Launching in terminal: ${r.name} (${r.command})`);let i=[`--deep-link-origin`];switch(n.repo&&(i.push(`--deep-link-repo`,n.repo),n.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(n.lastFetchMs))),n.query&&i.push(`--prefill`,n.query),process.platform){case`darwin`:return E(r,e,i,n.cwd);case`linux`:return D(r,e,i,n.cwd);case`win32`:return O(r,e,i,n.cwd);default:return!1}}async function E(e,n,r,i){switch(e.command){case`iTerm`:{let{code:e}=await s(`osascript`,[`-e`,`tell application "iTerm"
|
|
2
|
-
if running then
|
|
3
|
-
create window with default profile
|
|
4
|
-
else
|
|
5
|
-
activate
|
|
6
|
-
end if
|
|
7
|
-
tell current session of current window
|
|
8
|
-
write text ${M(A(n,r,i))}
|
|
9
|
-
end tell
|
|
10
|
-
end tell`],{useCwd:!1});if(e===0)return!0;break}case`Terminal`:{let{code:e}=await s(`osascript`,[`-e`,`tell application "Terminal"
|
|
11
|
-
do script ${M(A(n,r,i))}
|
|
12
|
-
activate
|
|
13
|
-
end tell`],{useCwd:!1});return e===0}case`Ghostty`:{let t=[`-na`,e.command,`--args`,`--window-save-state=never`];i&&t.push(`--working-directory=${i}`),t.push(`-e`,n,...r);let{code:a}=await s(`open`,t,{useCwd:!1});if(a===0)return!0;break}case`Alacritty`:{let t=[`-na`,e.command,`--args`];i&&t.push(`--working-directory`,i),t.push(`-e`,n,...r);let{code:a}=await s(`open`,t,{useCwd:!1});if(a===0)return!0;break}case`kitty`:{let t=[`-na`,e.command,`--args`];i&&t.push(`--directory`,i),t.push(n,...r);let{code:a}=await s(`open`,t,{useCwd:!1});if(a===0)return!0;break}case`WezTerm`:{let t=[`-na`,e.command,`--args`,`start`];i&&t.push(`--cwd`,i),t.push(`--`,n,...r);let{code:a}=await s(`open`,t,{useCwd:!1});if(a===0)return!0;break}}return t(`Failed to launch ${e.name}, falling back to Terminal.app`),E({name:`Terminal.app`,command:`Terminal`},n,r,i)}async function D(e,t,n,r){let i,a;switch(e.name){case`gnome-terminal`:i=r?[`--working-directory=${r}`,`--`]:[`--`],i.push(t,...n);break;case`konsole`:i=r?[`--workdir`,r,`-e`]:[`-e`],i.push(t,...n);break;case`kitty`:i=r?[`--directory`,r]:[],i.push(t,...n);break;case`wezterm`:i=r?[`start`,`--cwd`,r,`--`]:[`start`,`--`],i.push(t,...n);break;case`alacritty`:i=r?[`--working-directory`,r,`-e`]:[`-e`],i.push(t,...n);break;case`ghostty`:i=r?[`--working-directory=${r}`,`-e`]:[`-e`],i.push(t,...n);break;case`xfce4-terminal`:case`mate-terminal`:i=r?[`--working-directory=${r}`,`-x`]:[`-x`],i.push(t,...n);break;case`tilix`:i=r?[`--working-directory=${r}`,`-e`]:[`-e`],i.push(t,...n);break;default:i=[`-e`,t,...n],a=r;break}return k(e.command,i,{cwd:a})}async function O(e,t,n,r){let i=[];switch(e.name){case`Windows Terminal`:r&&i.push(`-d`,r),i.push(`--`,t,...n);break;case`PowerShell`:{let e=r?`Set-Location ${N(r)}; `:``;i.push(`-NoExit`,`-Command`,`${e}& ${N(t)} ${n.map(N).join(` `)}`);break}default:{let e=r?`cd /d ${P(r)} && `:``;i.push(`/k`,`${e}${P(t)} ${n.map(e=>P(e)).join(` `)}`);break}}return k(e.command,i,{windowsVerbatimArguments:e.name===`Command Prompt`})}function k(e,n,r={}){return new Promise(i=>{let a=v(e,n,{detached:!0,stdio:`ignore`,cwd:r.cwd,windowsVerbatimArguments:r.windowsVerbatimArguments});a.once(`error`,n=>{t(`Failed to spawn ${e}: ${n.message}`,{level:`error`}),i(!1)}),a.once(`spawn`,()=>{a.unref(),i(!0)})})}function A(e,t,n){return`${n?`cd ${j(n)} && `:``}${[e,...t].map(j).join(` `)}`}function j(e){return`'${e.replace(/'/g,`'\\''`)}'`}function M(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function N(e){return`'${e.replace(/'/g,`''`)}'`}function P(e){return`"${e.replace(/"/g,``).replace(/%/g,`%%`).replace(/(\\+)$/,`$1$1`)}"`}n();async function F(n){t(`Handling deep link URI: ${n}`);let r;try{r=p(n)}catch(e){let t=e instanceof Error?e.message:String(e);return console.error(`Deep link error: ${t}`),1}t(`Parsed deep link action: ${e(r)}`);let{cwd:i,resolvedRepo:a}=await L(r),o=a?await f(i):void 0;return await T(process.execPath,{query:r.query,cwd:i,repo:a,lastFetchMs:o?.getTime()})?0:(console.error(`Failed to open a terminal. Make sure a supported terminal emulator is installed.`),1)}async function I(){if(process.env.__CFBundleIdentifier!==`com.anthropic.claude-code-url-handler`)return null;try{let{waitForUrlEvent:e}=await import(`./src-DLz3FZm1.js`),t=await e(5e3);return t?await F(t):null}catch{return null}}async function L(e){if(e.cwd)return{cwd:e.cwd};if(e.repo){let n=await d(u(e.repo));if(n[0])return t(`Resolved repo ${e.repo} → ${n[0]}`),{cwd:n[0],resolvedRepo:e.repo};t(`No local clone found for repo ${e.repo}, falling back to home`)}return{cwd:g()}}export{F as handleDeepLinkUri,I as handleUrlSchemeLaunch};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Mo as e,Po as t,Ro as n,zo as r}from"./loadAgentsDir-mcRW90aq.js";import{Wt as i,et as a}from"./state-BPFYBqm1.js";import{P as o,R as s,c,i as l}from"./debug-Dr1SjdXn.js";import{kn as u,vt as d,wn as f,yt as p}from"./settings-DiBMs2gM.js";import{m,n as h}from"./git-CoQQ6YEf.js";import{o as g,s as _}from"./log-27kCA_9u.js";import{ar as v,ir as y}from"./model-C29_32BD.js";import{isAbsolute as b,resolve as x}from"path";y(),i(),l(),s(),f(),m(),g(),n(),d();function S(e,t,n){let r=[],i=[],a=[];for(let[o,s]of Object.entries(e)){let e=t[o],c=w(s.source,n?.projectRoot);e?s.sourceIsFallback||v(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 C(n){let i=t();if(Object.keys(i).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let s;try{s=await r()}catch(e){_(e),s={}}let l=S(i,s,{projectRoot:a()}),d=[...l.missing.map(e=>({name:e,source:w(i[e].source),action:`install`})),...l.sourceChanged.map(({name:e,declaredSource:t})=>({name:e,source:t,action:`update`}))],f=[],m=[];for(let e of d){if(n?.skip?.(e.name,e.source)){f.push(e.name);continue}if(e.action===`update`&&p(e.source)&&!await u(e.source.path)){c(`[reconcile] '${e.name}' declared path does not exist; keeping materialized entry`),f.push(e.name);continue}m.push(e)}if(m.length===0)return{installed:[],updated:[],failed:[],upToDate:l.upToDate,skipped:f};c(`[reconcile] ${m.length} marketplace(s): ${m.map(e=>`${e.name}(${e.action})`).join(`, `)}`);let h=[],g=[],v=[];for(let t=0;t<m.length;t++){let{name:r,source:i,action:a}=m[t];n?.onProgress?.({type:`installing`,name:r,action:a,index:t+1,total:m.length});try{let t=await e(i);a===`install`?h.push(r):g.push(r),n?.onProgress?.({type:`installed`,name:r,alreadyMaterialized:t.alreadyMaterialized})}catch(e){let t=o(e);v.push({name:r,error:t}),n?.onProgress?.({type:`failed`,name:r,error:t}),_(e)}}return{installed:h,updated:g,failed:v,upToDate:l.upToDate,skipped:f}}function w(e,t){if((e.source===`directory`||e.source===`file`)&&!b(e.path)){let n=t??a(),r=h(n);return{...e,path:x(r??n,e.path)}}return e}export{C as n,S as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ch as t,D_ as n,E_ as r,aS as i,bs as a,do as o,fh as s,i as c,iS as l,mh as u,o as d,os as f,ss as p,uo as m,wh as h,xh as g,yh as _,ys as v}from"./loadAgentsDir-mcRW90aq.js";import{Wt as y,et as b}from"./state-BPFYBqm1.js";import{P as x,R as S,c as C,i as w}from"./debug-Dr1SjdXn.js";import{o as T,s as E}from"./log-27kCA_9u.js";async function D(e){C(`refreshActivePlugins: clearing all plugin caches`),f(),s();let t=await o(),[r,a]=await Promise.all([v(),c(b())]),{enabled:l,disabled:u,errors:d}=t,[p,m]=await Promise.all([Promise.all(l.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await i(e,d);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(l.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await h(e,d);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),_=p.reduce((e,t)=>e+t,0),y=m.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:l,disabled:u,commands:r,errors:O(e.plugins.errors,d),needsRefresh:!1},agentDefinitions:a,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),g();let S=!1;try{await n()}catch(e){S=!0,E(e),C(`refreshActivePlugins: loadPluginHooks failed: ${x(e)}`)}let w=l.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return C(`refreshActivePlugins: ${l.length} enabled, ${r.length} commands, ${a.allAgents.length} agents, ${w} hooks, ${_} MCP, ${y} LSP`),{enabled_count:l.length,disabled_count:u.length,command_count:r.length,agent_count:a.allAgents.length,hook_count:w,mcp_count:_,lsp_count:y,error_count:d.length+ +!!S,agentDefinitions:a,pluginCommands:r}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{y(),_(),d(),w(),S(),T(),p(),a(),r(),t(),l(),u(),m()}));export{D as n,A as t};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{o as n}from"./envUtils-DcaKZlRU.js";import{F as r,R as i,c as a,i as o}from"./debug-Dr1SjdXn.js";import{g as s,n as c}from"./settings-DiBMs2gM.js";import{r as l,t as u}from"./execFileNoThrow-mXq4K0rl.js";import{n as d,t as f}from"./which-mplwBbc0.js";import{a as p,r as m,t as h}from"./xdg-DcF9ejUM.js";import*as g from"os";import*as _ from"path";import{promises as v}from"fs";function y(e){let t=e,n=``,r=0;for(;t!==n&&r<10;)n=t,t=t.normalize(`NFKC`),t=t.replace(/[\p{Cf}\p{Co}\p{Cn}]/gu,``),t=t.replace(/[\u200B-\u200F]/g,``).replace(/[\u202A-\u202E]/g,``).replace(/[\u2066-\u2069]/g,``).replace(/[\uFEFF]/g,``).replace(/[\uE000-\uF8FF]/g,``),r++;if(r>=10)throw Error(`Unicode sanitization reached maximum iterations (10) for input: ${e.slice(0,100)}`);return t}var b=e((()=>{}));function x(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function S(e){let t=e.startsWith(`claude-cli://`)?e:e.startsWith(`claude-cli:`)?e.replace(`${C}:`,`${C}://`):null;if(!t)throw Error(`Invalid deep link: expected ${C}:// scheme, got "${e}"`);let n;try{n=new URL(t)}catch{throw Error(`Invalid deep link URL: "${e}"`)}if(n.hostname!==`open`)throw Error(`Unknown deep link action: "${n.hostname}"`);let r=n.searchParams.get(`cwd`)??void 0,i=n.searchParams.get(`repo`)??void 0,a=n.searchParams.get(`q`);if(r&&!r.startsWith(`/`)&&!/^[a-zA-Z]:[/\\]/.test(r))throw Error(`Invalid cwd in deep link: must be an absolute path, got "${r}"`);if(r&&x(r))throw Error(`Deep link cwd contains disallowed control characters`);if(r&&r.length>E)throw Error(`Deep link cwd exceeds ${E} characters (got ${r.length})`);if(i&&!w.test(i))throw Error(`Invalid repo in deep link: expected "owner/repo", got "${i}"`);let o;if(a&&a.trim().length>0){if(o=y(a.trim()),x(o))throw Error(`Deep link query contains disallowed control characters`);if(o.length>T)throw Error(`Deep link query exceeds ${T} characters (got ${o.length})`)}return{query:o,cwd:r,repo:i}}var C,w,T,E,D=e((()=>{b(),C=`claude-cli`,w=/^[\w.-]+\/[\w.-]+$/,T=5e3,E=4096})),O=t({MACOS_BUNDLE_ID:()=>z,ensureDeepLinkProtocolRegistered:()=>R,isProtocolHandlerCurrent:()=>L,registerProtocolHandler:()=>F});function k(){return _.join(m(),`applications`,V)}function A(e){return`Exec="${e}" --handle-uri %u`}function j(e){return`"${e}" --handle-uri "%1"`}async function M(e){let t=_.join(H,`Contents`);try{await v.rm(H,{recursive:!0})}catch(e){if(r(e)!==`ENOENT`)throw e}await v.mkdir(_.dirname(U),{recursive:!0});let n=`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleIdentifier</key>
|
|
6
|
-
<string>${z}</string>
|
|
7
|
-
<key>CFBundleName</key>
|
|
8
|
-
<string>${B}</string>
|
|
9
|
-
<key>CFBundleExecutable</key>
|
|
10
|
-
<string>claude</string>
|
|
11
|
-
<key>CFBundleVersion</key>
|
|
12
|
-
<string>1.0</string>
|
|
13
|
-
<key>CFBundlePackageType</key>
|
|
14
|
-
<string>APPL</string>
|
|
15
|
-
<key>LSBackgroundOnly</key>
|
|
16
|
-
<true/>
|
|
17
|
-
<key>CFBundleURLTypes</key>
|
|
18
|
-
<array>
|
|
19
|
-
<dict>
|
|
20
|
-
<key>CFBundleURLName</key>
|
|
21
|
-
<string>Work Mate Deep Link</string>
|
|
22
|
-
<key>CFBundleURLSchemes</key>
|
|
23
|
-
<array>
|
|
24
|
-
<string>${C}</string>
|
|
25
|
-
</array>
|
|
26
|
-
</dict>
|
|
27
|
-
</array>
|
|
28
|
-
</dict>
|
|
29
|
-
</plist>`;await v.writeFile(_.join(t,`Info.plist`),n),await v.symlink(e,U),await u(`/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister`,[`-R`,H],{useCwd:!1}),a(`Registered ${C}:// protocol handler at ${H}`)}async function N(e){await v.mkdir(_.dirname(k()),{recursive:!0});let t=`[Desktop Entry]
|
|
30
|
-
Name=${B}
|
|
31
|
-
Comment=Handle ${C}:// deep links for Work Mate
|
|
32
|
-
${A(e)}
|
|
33
|
-
Type=Application
|
|
34
|
-
NoDisplay=true
|
|
35
|
-
MimeType=x-scheme-handler/${C};
|
|
36
|
-
`;await v.writeFile(k(),t);let n=await d(`xdg-mime`);if(n){let{code:e}=await u(n,[`default`,V,`x-scheme-handler/${C}`],{useCwd:!1});if(e!==0)throw Object.assign(Error(`xdg-mime exited with code ${e}`),{code:`XDG_MIME_FAILED`})}a(`Registered ${C}:// protocol handler at ${k()}`)}async function P(e){for(let t of[[`add`,W,`/ve`,`/d`,`URL:${B}`,`/f`],[`add`,W,`/v`,`URL Protocol`,`/d`,``,`/f`],[`add`,G,`/ve`,`/d`,j(e),`/f`]]){let{code:e}=await u(`reg`,t,{useCwd:!1});if(e!==0)throw Object.assign(Error(`reg add exited with code ${e}`),{code:`REG_FAILED`})}a(`Registered ${C}:// protocol handler in Windows registry`)}async function F(e){let t=e??await I();switch(process.platform){case`darwin`:await M(t);break;case`linux`:await N(t);break;case`win32`:await P(t);break;default:throw Error(`Unsupported platform: ${process.platform}`)}}async function I(){let e=process.platform===`win32`?`claude.exe`:`claude`,t=_.join(h(),e);try{return await v.realpath(t),t}catch{return process.execPath}}async function L(e){try{switch(process.platform){case`darwin`:return await v.readlink(U)===e;case`linux`:return(await v.readFile(k(),`utf8`)).includes(A(e));case`win32`:{let{stdout:t,code:n}=await u(`reg`,[`query`,G,`/ve`],{useCwd:!1});return n===0&&t.includes(j(e))}default:return!1}}catch{return!1}}async function R(){c().disableDeepLinkRegistration}var z,B,V,H,U,W,G,K=e((()=>{D(),o(),n(),i(),l(),s(),f(),p(),z=`com.anthropic.claude-code-url-handler`,B=`Claude Code URL Handler`,V=`claude-code-url-handler.desktop`,H=_.join(g.homedir(),`Applications`,`Claude Code URL Handler.app`),U=_.join(H,`Contents`,`MacOS`,`claude`),W=`HKEY_CURRENT_USER\\Software\\Classes\\${C}`,G=`${W}\\shell\\open\\command`}));export{S as a,D as i,K as n,O as r,z as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Sr as t,_r as n,ai as r,ci as i,ja as a,za as o}from"./loadAgentsDir-mcRW90aq.js";import{Wt as s,pt as c}from"./state-BPFYBqm1.js";import{a as l,i as u,r as d}from"./bridgeConfig-B80T_lw7.js";import{n as f,t as p}from"./generateSessionName-CdbMksHi.js";async function m(e,t,o){let s;if(!o||o.trim()===``){let n=await p(a(t.messages),t.abortController.signal);if(!n)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;s=n}else s=o.trim();let l=c(),f=n();await i(l,s,f);let m=t.getAppState().replBridgeSessionId;if(m){let e=u();import(`./createSession-VTqzWAu6.js`).then(({updateBridgeSessionTitle:t})=>t(m,s,{baseUrl:d(),getAccessToken:e?()=>e:void 0}).catch(()=>{}))}return await r(l,s,f),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:s}})),e(`Session renamed to: ${s}`,{display:`system`}),null}e((()=>{s(),l(),o(),t(),f()}))();export{m as call};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$p as i,Au as a,Er as o,Fr as s,Lr as c,MC as l,Mr as u,Mu as d,Sr as f,Ti as p,em as m,hC as h,mC as g,mi as _,mr as v,sr as y,wi as b,wr as x}from"./loadAgentsDir-mcRW90aq.js";import{I as S,P as C,di as w,dr as T,fi as E,ot as D,t as O,ui as k}from"./src-P_wYS_NJ2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as j,et as M,pt as N}from"./state-BPFYBqm1.js";import{o as P,s as F}from"./log-27kCA_9u.js";import{n as I,r as L}from"./modalContext-CUThy6Ph.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./crossProjectResume-DxgQVYSi.js";function W(e){switch(e.resultType){case`sessionNotFound`:return`Session ${k.bold(e.arg)} was not found. Run ${k.bold(`/resume`)} without arguments to browse all sessions.`;case`multipleMatches`:return`Found ${e.count} sessions matching ${k.bold(e.arg)}. Run ${k.bold(`/resume`)} to pick one from the list.`}}function G({message:e,args:t,onDone:n}){return J.useEffect(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,Y.jsxs)(S,{flexDirection:`column`,children:[(0,Y.jsxs)(C,{dimColor:!0,children:[r.pointer,` /resume `,t]}),(0,Y.jsx)(g,{children:(0,Y.jsx)(C,{children:e})})]})}function K({onDone:e,onResume:t}){let[n,r]=J.useState([]),[i,l]=J.useState([]),[d,f]=J.useState(!0),[p,h]=J.useState(!1),[g,_]=J.useState(!1),{rows:y}=D(),x=L(),w=J.useCallback(async(t,n)=>{f(!0);try{let i=q(t?await u():await c(n),N());if(i.length===0){e(`No conversations found to resume`);return}r(i)}catch{e(`Failed to load conversations`)}finally{f(!1)}},[e]);J.useEffect(()=>{async function e(){let e=await b(M());l(e),w(!1,e)}e()},[w]);let E=J.useCallback(()=>{let e=!g;_(e),w(e,i)},[g,w,i]);async function O(n){let r=m(v(n));if(!r){e(`Failed to resume conversation`);return}let i=o(n)?await s(n):n,a=U(i,g);if(a.isCrossProject){if(a.isSameRepoWorktree){h(!0),t(r,i,`slash_command_picker`);return}let n=await T(a.command);n&&process.stdout.write(n),e([``,`This conversation is from a different directory.`,``,`To resume, run:`,` ${a.command}`,``,`(Command copied to clipboard)`,``].join(`
|
|
2
|
-
`),{display:`user`});return}h(!0),t(r,i,`slash_command_picker`)}function k(){e(`Resume cancelled`,{display:`system`})}return d?(0,Y.jsxs)(S,{children:[(0,Y.jsx)(a,{}),(0,Y.jsx)(C,{children:` Loading conversations…`})]}):p?(0,Y.jsxs)(S,{children:[(0,Y.jsx)(a,{}),(0,Y.jsx)(C,{children:` Resuming conversation…`})]}):(0,Y.jsx)(R,{logs:n,maxHeight:x?Math.floor(y/2):y-2,onCancel:k,onSelect:O,onLogsChanged:()=>w(g,i),showAllProjects:g,onToggleAllProjects:E,onAgenticSearch:H})}function q(e,t){return e.filter(e=>!e.isSidechain&&v(e)!==t)}var J,Y,X;e((()=>{w(),n(),J=t(E(),1),j(),V(),h(),d(),I(),l(),O(),z(),B(),p(),P(),f(),i(),Y=A(),X=async(e,t,n)=>{let r=async(n,r,i)=>{try{await t.resume?.(n,r,i),e(void 0,{display:`skip`})}catch(t){F(t),e(`Failed to resume: ${t.message}`)}},i=n?.trim();if(!i)return(0,Y.jsx)(K,{onDone:e,onResume:r},Date.now());let a=await c(await b(M()));if(a.length===0){let t=`No conversations found to resume.`;return(0,Y.jsx)(G,{message:t,args:i,onDone:()=>e(t)})}let l=m(i);if(l){let e=a.filter(e=>v(e)===l).sort((e,t)=>t.modified.getTime()-e.modified.getTime());if(e.length>0){let t=e[0];return r(l,o(t)?await s(t):t,`slash_command_session_id`),null}let t=await y(l);if(t)return r(l,t,`slash_command_session_id`),null}if(x()){let t=await _(i,{exact:!0});if(t.length===1){let e=t[0],n=v(e);if(n)return r(n,o(e)?await s(e):e,`slash_command_title`),null}if(t.length>1){let n=W({resultType:`multipleMatches`,arg:i,count:t.length});return(0,Y.jsx)(G,{message:n,args:i,onDone:()=>e(n)})}}let u=W({resultType:`sessionNotFound`,arg:i});return(0,Y.jsx)(G,{message:u,args:i,onDone:()=>e(u)})}}))();export{X as call,q as filterResumableSessions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t}from"./ripgrep-DQ_ILUJV.js";e();export{t as getRipgrepStatus};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gT as e,yT as t}from"./loadAgentsDir-mcRW90aq.js";t();export{e as SandboxManager};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{EC as t,ST as n,Xu as r,Zu as i,_T as a,gT as o,yT as s}from"./loadAgentsDir-mcRW90aq.js";import{Gt as c,H as l,I as u,Lt as d,P as f,a as p,fi as m,j as h,n as g,r as _,t as v,x as y}from"./src-P_wYS_NJ2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{O as x,Wt as S}from"./state-BPFYBqm1.js";import{f as C,g as w,s as T}from"./settings-DiBMs2gM.js";import{i as E,o as D}from"./platform-Dg1c9F_1.js";import{relative as O}from"path";function k(){let e=o.isSandboxingEnabled(),t=o.checkDependencies(),r=t.warnings.length>0?(0,A.jsx)(u,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,A.jsx)(f,{dimColor:!0,children:e},t))}):null;if(!e)return(0,A.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,A.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled`}),r]});let i=o.getFsReadConfig(),a=o.getFsWriteConfig(),s=o.getNetworkRestrictionConfig(),c=o.getAllowUnixSockets(),l=o.getExcludedCommands(),d=o.getLinuxGlobPatternWarnings();return(0,A.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,A.jsxs)(u,{flexDirection:`column`,children:[(0,A.jsx)(f,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,A.jsx)(f,{dimColor:!0,children:l.length>0?l.join(`, `):`None`})]}),i.denyOnly.length>0&&(0,A.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,A.jsxs)(f,{dimColor:!0,children:[`Denied: `,i.denyOnly.join(`, `)]}),i.allowWithinDeny&&i.allowWithinDeny.length>0&&(0,A.jsxs)(f,{dimColor:!0,children:[`Allowed within denied: `,i.allowWithinDeny.join(`, `)]})]}),a.allowOnly.length>0&&(0,A.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(f,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,A.jsxs)(f,{dimColor:!0,children:[`Allowed: `,a.allowOnly.join(`, `)]}),a.denyWithinAllow.length>0&&(0,A.jsxs)(f,{dimColor:!0,children:[`Denied within allowed: `,a.denyWithinAllow.join(`, `)]})]}),(s.allowedHosts&&s.allowedHosts.length>0||s.deniedHosts&&s.deniedHosts.length>0)&&(0,A.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,A.jsxs)(f,{bold:!0,color:`permission`,children:[`Network Restrictions`,n()?` (Managed)`:``,`:`]}),s.allowedHosts&&s.allowedHosts.length>0&&(0,A.jsxs)(f,{dimColor:!0,children:[`Allowed: `,s.allowedHosts.join(`, `)]}),s.deniedHosts&&s.deniedHosts.length>0&&(0,A.jsxs)(f,{dimColor:!0,children:[`Denied: `,s.deniedHosts.join(`, `)]})]}),c&&c.length>0&&(0,A.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(f,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,A.jsx)(f,{dimColor:!0,children:c.join(`, `)})]}),d.length>0&&(0,A.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(f,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,A.jsxs)(f,{dimColor:!0,children:[`The following patterns will be ignored: `,d.slice(0,3).join(`, `),d.length>3&&` (${d.length-3} more)`]})]}),r]})}var A,j=e((()=>{m(),v(),s(),A=b()}));function M({depCheck:e}){let t=E()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),r=e.errors.some(e=>e.includes(`bwrap`)),i=e.errors.some(e=>e.includes(`socat`)),a=e.warnings.length>0,o=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,N.jsxs)(u,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,N.jsx)(u,{flexDirection:`column`,children:(0,N.jsxs)(f,{children:[`seatbelt: `,(0,N.jsx)(f,{color:`success`,children:`built-in (macOS)`})]})}),(0,N.jsxs)(u,{flexDirection:`column`,children:[(0,N.jsxs)(f,{children:[`ripgrep (rg): `,n?(0,N.jsx)(f,{color:`error`,children:`not found`}):(0,N.jsx)(f,{color:`success`,children:`found`})]}),n&&(0,N.jsxs)(f,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(u,{flexDirection:`column`,children:[(0,N.jsxs)(f,{children:[`bubblewrap (bwrap):`,` `,r?(0,N.jsx)(f,{color:`error`,children:`not installed`}):(0,N.jsx)(f,{color:`success`,children:`installed`})]}),r&&(0,N.jsxs)(f,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,N.jsxs)(u,{flexDirection:`column`,children:[(0,N.jsxs)(f,{children:[`socat: `,i?(0,N.jsx)(f,{color:`error`,children:`not installed`}):(0,N.jsx)(f,{color:`success`,children:`installed`})]}),i&&(0,N.jsxs)(f,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,N.jsxs)(u,{flexDirection:`column`,children:[(0,N.jsxs)(f,{children:[`seccomp filter:`,` `,a?(0,N.jsx)(f,{color:`warning`,children:`not installed`}):(0,N.jsx)(f,{color:`success`,children:`installed`}),a&&(0,N.jsx)(f,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),a&&(0,N.jsxs)(u,{flexDirection:`column`,children:[(0,N.jsxs)(f,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,N.jsxs)(f,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,N.jsxs)(f,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),o.map(e=>(0,N.jsx)(f,{color:`error`,children:e},e))]})}var N,P=e((()=>{m(),v(),D(),N=b()}));function F({onComplete:e}){let t=o.isSandboxingEnabled(),n=o.areSandboxSettingsLockedByPolicy(),r=o.areUnsandboxedCommandsAllowed();return t?n?(0,L.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(f,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,L.jsx)(u,{marginTop:1,children:(0,L.jsxs)(f,{dimColor:!0,children:[`Current setting: `,r?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,L.jsx)(I,{onComplete:e,currentMode:r?`open`:`closed`}):(0,L.jsx)(u,{flexDirection:`column`,paddingY:1,children:(0,L.jsx)(f,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function I({onComplete:e,currentMode:t}){let[n]=l(),{headerFocused:i,focusHeader:a}=p(),s=h(`success`,n)(`(current)`),c=[{label:t===`open`?`Allow unsandboxed fallback ${s}`:`Allow unsandboxed fallback`,value:`open`},{label:t===`closed`?`Strict sandbox mode ${s}`:`Strict sandbox mode`,value:`closed`}];async function m(t){let n=t;await o.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,L.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(u,{marginBottom:1,children:(0,L.jsx)(f,{bold:!0,children:`Configure Overrides:`})}),(0,L.jsx)(r,{options:c,onChange:m,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:a,isDisabled:i}),(0,L.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,L.jsxs)(f,{dimColor:!0,children:[(0,L.jsx)(f,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Claude can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,L.jsxs)(f,{dimColor:!0,children:[(0,L.jsx)(f,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,L.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,L.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing#configure-sandboxing`,children:`code.workmate.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var L,R=e((()=>{m(),v(),s(),i(),L=b()}));function z({onComplete:e,depCheck:t}){let[n]=l(),r=o.isSandboxingEnabled(),i=o.isAutoAllowBashIfSandboxedEnabled(),a=t.warnings.length>0,s=C().sandbox?.network?.allowAllUnixSockets,u=a&&!s,d=r?i?`auto-allow`:`regular`:`disabled`,f=h(`success`,n)(`(current)`),p=[{label:d===`auto-allow`?`Sandbox BashTool, with auto-allow ${f}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:d===`regular`?`Sandbox BashTool, with regular permissions ${f}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:d===`disabled`?`No Sandbox ${f}`:`No Sandbox`,value:`disabled`}];async function m(t){switch(t){case`auto-allow`:await o.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await o.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await o.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}c({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let v=(0,V.jsx)(g,{title:`Mode`,children:(0,V.jsx)(B,{showSocketWarning:u,options:p,onSelect:m,onComplete:e})},`mode`),b=(0,V.jsx)(g,{title:`Overrides`,children:(0,V.jsx)(F,{onComplete:e})},`overrides`),x=(0,V.jsx)(g,{title:`Config`,children:(0,V.jsx)(k,{})},`config`);return(0,V.jsx)(y,{color:`permission`,children:(0,V.jsx)(_,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:t.errors.length>0?[(0,V.jsx)(g,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:t})},`dependencies`)]:[v,...a?[(0,V.jsx)(g,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:t})},`dependencies`)]:[],b,x]})})}function B({showSocketWarning:e,options:t,onSelect:n,onComplete:i}){let{headerFocused:a,focusHeader:o}=p();return(0,V.jsxs)(u,{flexDirection:`column`,paddingY:1,children:[e&&(0,V.jsx)(u,{marginBottom:1,children:(0,V.jsx)(f,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,V.jsx)(u,{marginBottom:1,children:(0,V.jsx)(f,{bold:!0,children:`Configure Mode:`})}),(0,V.jsx)(r,{options:t,onChange:n,onCancel:()=>i(void 0,{display:`skip`}),onUpFromFirstItem:o,isDisabled:a}),(0,V.jsxs)(u,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,V.jsxs)(f,{dimColor:!0,children:[(0,V.jsx)(f,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,V.jsxs)(f,{dimColor:!0,children:[`Learn more:`,` `,(0,V.jsx)(d,{url:`https://code.workmate.com/docs/en/sandboxing`,children:`code.workmate.com/docs/en/sandboxing`})]})]})]})}var V,H=e((()=>{m(),v(),t(),s(),w(),i(),j(),P(),R(),V=b()}));async function U(e,t,n){let r=C().theme||`light`,i=E();if(!o.isSupportedPlatform()){let t=i===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(h(`error`,r)(t)),null}let s=o.checkDependencies();if(!o.isPlatformInEnabledList())return e(h(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(o.areSandboxSettingsLockedByPolicy())return e(h(`error`,r)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let c=n?.trim()||``;if(!c)return(0,W.jsx)(z,{onComplete:e,depCheck:s});if(c){let t=c.split(` `)[0];if(t===`exclude`){let t=c.slice(8).trim();if(!t)return e(h(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);a(n);let i=T(`localSettings`),o=i?O(x(),i):`.workmate/settings.local.json`;return e(h(`success`,r)(`Added "${n}" to excluded commands in ${o}`)),null}else return e(h(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var W;e((()=>{m(),S(),H(),v(),D(),s(),w(),W=b()}))();export{U as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V_ as e,z_ as t}from"./loadAgentsDir-mcRW90aq.js";t();export{e as isSearchExtraToolsEnabled};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{oh as e,sh as t}from"./loadAgentsDir-mcRW90aq.js";e();export{t as registerSessionFileAccessHooks};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./sessionObserver-BJQ5hwjU.js";t();export{e as heuristicObserverBackend};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DcaKZlRU.js";import{t as i}from"./semver-DQo45qGo.js";import{Wt as a,Xn as o,mt as s,pt as c,z as l}from"./state-BPFYBqm1.js";import{P as u,R as d,c as f,f as p,i as m,nt as h,tt as g,u as _}from"./debug-Dr1SjdXn.js";import{O as ee,k as te}from"./git-CoQQ6YEf.js";import{Dr as ne,Er as re,Or as ie,Tr as v}from"./model-C29_32BD.js";import{randomUUID as y}from"crypto";function b(){return x||(x=i()),x}function ae(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)===1:b().gt(e,t,{loose:!0})}function oe(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)>=0:b().gte(e,t,{loose:!0})}function se(e,t){return typeof Bun<`u`?Bun.semver.order(e,t)===-1:b().lt(e,t,{loose:!0})}function ce(e,t){return typeof Bun<`u`?Bun.semver.satisfies(e,t):b().satisfies(e,t,{loose:!0})}var x,le=e((()=>{})),ue=e((()=>{})),de,fe=e((()=>{de={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:`standard`,cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:``,iterations:[],speed:`standard`}})),pe=e((()=>{}));function me(e){return e}var he=e((()=>{})),ge=e((()=>{ue(),fe(),pe(),he()}));function _e(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function ve(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=_e(t);if(n){let e=`OPENAI_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return ye[t]??t}var ye,be=e((()=>{ye={"claude-sonnet-4-20250514":`gpt-4o`,"claude-sonnet-4-5-20250929":`gpt-4o`,"claude-sonnet-4-6":`gpt-4o`,"claude-opus-4-20250514":`o3`,"claude-opus-4-1-20250805":`o3`,"claude-opus-4-5-20251101":`o3`,"claude-opus-4-6":`o3`,"claude-haiku-4-5-20251001":`gpt-4o-mini`,"claude-3-5-haiku-20241022":`gpt-4o-mini`,"claude-3-7-sonnet-20250219":`gpt-4o`,"claude-3-5-sonnet-20241022":`gpt-4o`}}));function xe(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Se(){let e=process.env.GROK_MODEL_MAP;if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}function Ce(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=xe(t),r=Se();if(r&&n&&r[n])return r[n];if(n){let e=`GROK_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return S[t]?S[t]:n&&C[n]?C[n]:t}var S,C,we=e((()=>{S={"claude-sonnet-4-20250514":`grok-3-mini-fast`,"claude-sonnet-4-5-20250929":`grok-3-mini-fast`,"claude-sonnet-4-6":`grok-3-mini-fast`,"claude-opus-4-20250514":`grok-4.20-reasoning`,"claude-opus-4-1-20250805":`grok-4.20-reasoning`,"claude-opus-4-5-20251101":`grok-4.20-reasoning`,"claude-opus-4-6":`grok-4.20-reasoning`,"claude-haiku-4-5-20251001":`grok-3-mini-fast`,"claude-3-5-haiku-20241022":`grok-3-mini-fast`,"claude-3-7-sonnet-20250219":`grok-3-mini-fast`,"claude-3-5-sonnet-20241022":`grok-3-mini-fast`},C={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function Te(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Ee(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=Te(t);if(!n)return t;let r=`GEMINI_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i;let a=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,o=process.env[a];if(o)return o;throw Error(`Gemini provider requires GEMINI_MODEL or ${r} (or ${a} for backward compatibility) to be configured.`)}var De=e((()=>{})),w,T=e((()=>{w=`_geminiThoughtSignature`}));function E(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Oe(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=Me(t);e.parts.length>0&&n.push(e);let i=t.message.content;if(Array.isArray(i))for(let e of i)typeof e!=`string`&&e.type===`tool_use`&&r.set(e.id,e.name);continue}if(t.type===`user`){let e=Ae(t,r);e.parts.length>0&&n.push(e)}}let i=ke(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function ke(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
2
|
-
|
|
3
|
-
`)}function Ae(e,t){let n=e.message.content;return typeof n==`string`?{role:`user`,parts:D(n)}:Array.isArray(n)?{role:`user`,parts:n.flatMap(e=>je(e,t))}:{role:`user`,parts:[]}}function je(e,t){if(typeof e==`string`)return D(e);if(e.type===`text`)return D(e.text);if(e.type===`tool_result`){let n=e;return[{functionResponse:{name:t.get(n.tool_use_id)??n.tool_use_id,response:Fe(n)}}]}if(e.type===`image`){let t=e.source;if(t?.type===`base64`&&typeof t.data==`string`)return[{inlineData:{mimeType:t.media_type||`image/png`,data:t.data}}];if(t?.type===`url`&&typeof t.url==`string`)return D(`[image: ${t.url}]`)}return[]}function Me(e){let t=e.message.content;if(typeof t==`string`)return{role:`model`,parts:D(t)};if(!Array.isArray(t))return{role:`model`,parts:[]};let n=[];for(let e of t){if(typeof e==`string`){n.push(...D(e));continue}if(e.type===`text`){n.push(...D(e.text,O(e)));continue}if(e.type===`thinking`){let t=Ne(e.thinking,e.signature);t&&n.push(t);continue}if(e.type===`tool_use`){let t=e;n.push({functionCall:{name:t.name,args:Pe(t.input)},...O(e)&&{thoughtSignature:O(e)}})}}return{role:`model`,parts:n}}function D(e,t){return typeof e!=`string`||e.length===0?[]:[{text:e,...t&&{thoughtSignature:t}}]}function Ne(e,t){if(!(typeof e!=`string`||e.length===0))return{text:e,thought:!0,...t&&{thoughtSignature:t}}}function Pe(e){if(typeof e==`string`){let t=E(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:t===null?{}:{value:t}}return e&&typeof e==`object`&&!Array.isArray(e)?e:e===void 0?{}:{value:e}}function Fe(e){let t=Ie(e.content);return t&&typeof t==`object`&&!Array.isArray(t)?e.is_error?{...t,is_error:!0}:t:{result:t,...e.is_error?{is_error:!0}:{}}}function Ie(e){if(typeof e==`string`)return E(e)??e;if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
4
|
-
`);return E(t)??t}return e??``}function O(e){let t=e[w];return typeof t==`string`&&t.length>0?t:void 0}var Le=e((()=>{T()}));function Re(e){if(typeof e==`string`)return qe.has(e)?e:void 0;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`&&qe.has(e)),n=Array.from(new Set(t));return n.length===0?void 0:n.length===1?n[0]:n}}function ze(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;if(typeof e==`string`)return`string`;if(typeof e==`boolean`)return`boolean`;if(typeof e==`number`)return Number.isInteger(e)?`integer`:`number`;if(typeof e==`object`)return`object`}function Be(e){let t=e.map(ze).filter(e=>e!==void 0),n=Array.from(new Set(t));if(n.length!==0)return n.length===1?n[0]:n}function Ve(e){return e===void 0?[`null`]:Array.isArray(e)?e.includes(`null`)?e:[...e,`null`]:e===`null`?e:[e,`null`]}function He(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).map(([e,t])=>[e,k(t)]).filter(([,e])=>Object.keys(e).length>0);if(t.length!==0)return Object.fromEntries(t)}function Ue(e){if(!Array.isArray(e))return;let t=e.map(e=>k(e)).filter(e=>Object.keys(e).length>0);return t.length>0?t:void 0}function k(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n={},r=Re(t.type);t.const===void 0?Array.isArray(t.enum)&&t.enum.length>0&&(n.enum=t.enum,r=r??Be(t.enum)):(n.enum=[t.const],r=r??ze(t.const)),r||(t.properties&&typeof t.properties==`object`?r=`object`:(t.items!==void 0||t.prefixItems!==void 0)&&(r=`array`)),t.nullable===!0&&(r=Ve(r)),r&&(n.type=r),typeof t.title==`string`&&(n.title=t.title),typeof t.description==`string`&&(n.description=t.description),typeof t.format==`string`&&(n.format=t.format),typeof t.pattern==`string`&&(n.pattern=t.pattern),typeof t.minimum==`number`?n.minimum=t.minimum:typeof t.exclusiveMinimum==`number`&&(n.minimum=t.exclusiveMinimum),typeof t.maximum==`number`?n.maximum=t.maximum:typeof t.exclusiveMaximum==`number`&&(n.maximum=t.exclusiveMaximum),typeof t.minItems==`number`&&(n.minItems=t.minItems),typeof t.maxItems==`number`&&(n.maxItems=t.maxItems),typeof t.minLength==`number`&&(n.minLength=t.minLength),typeof t.maxLength==`number`&&(n.maxLength=t.maxLength),typeof t.minProperties==`number`&&(n.minProperties=t.minProperties),typeof t.maxProperties==`number`&&(n.maxProperties=t.maxProperties);let i=He(t.properties);if(i&&(n.properties=i,n.propertyOrdering=Object.keys(i)),Array.isArray(t.required)){let e=t.required.filter(e=>typeof e==`string`);e.length>0&&(n.required=e)}if(typeof t.additionalProperties==`boolean`)n.additionalProperties=t.additionalProperties;else{let e=k(t.additionalProperties);Object.keys(e).length>0&&(n.additionalProperties=e)}let a=k(t.items);Object.keys(a).length>0&&(n.items=a);let o=Ue(t.prefixItems);o&&(n.prefixItems=o);let s=Ue(t.anyOf??t.oneOf);return s&&(n.anyOf=s),n}function We(e){let t=k(e);return Object.keys(t).length>0?t:{type:`object`,properties:{}}}function Ge(e){let t=e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e;return{name:t.name||``,description:t.description||``,parametersJsonSchema:We(t.input_schema??{type:`object`,properties:{}})}});return t.length>0?[{functionDeclarations:t}]:[]}function Ke(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return{mode:`AUTO`};case`any`:return{mode:`ANY`};case`tool`:return{mode:`ANY`,allowedFunctionNames:typeof t.name==`string`?[t.name]:void 0};default:return}}var qe,Je=e((()=>{qe=new Set([`string`,`number`,`integer`,`boolean`,`object`,`array`,`null`])}));async function*Ye(e,t){let n=`msg_${y().replace(/-/g,``).slice(0,24)}`,r=!1,i=!1,a=0,o=null,s=!1,c,l=0,u=0,d=0;for await(let i of e){let e=i.usageMetadata;e&&(l=e.promptTokenCount??l,u=(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0),d=e.cachedContentTokenCount??d),r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}});let f=i.candidates?.[0],p=f?.content?.parts??[];for(let e of p){if(e.functionCall){o&&(yield{type:`content_block_stop`,index:o.index},o=null),s=!0;let t=a++;yield{type:`content_block_start`,index:t,content_block:{type:`tool_use`,id:`toolu_${y().replace(/-/g,``).slice(0,24)}`,name:e.functionCall.name||``,input:{}}},e.thoughtSignature&&(yield{type:`content_block_delta`,index:t,delta:{type:`signature_delta`,signature:e.thoughtSignature}}),e.functionCall.args&&Object.keys(e.functionCall.args).length>0&&(yield{type:`content_block_delta`,index:t,delta:{type:`input_json_delta`,partial_json:JSON.stringify(e.functionCall.args)}}),yield{type:`content_block_stop`,index:t};continue}let t=Xe(e);if(t){(!o||o.type!==t)&&(o&&(yield{type:`content_block_stop`,index:o.index}),o={index:a++,type:t},yield{type:`content_block_start`,index:o.index,content_block:t===`thinking`?{type:`thinking`,thinking:``,signature:``}:{type:`text`,text:``}}),e.text&&(yield{type:`content_block_delta`,index:o.index,delta:t===`thinking`?{type:`thinking_delta`,thinking:e.text}:{type:`text_delta`,text:e.text}}),e.thoughtSignature&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}});continue}e.thoughtSignature&&o&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}})}f?.finishReason&&(c=f.finishReason)}r&&(o&&(yield{type:`content_block_stop`,index:o.index}),i||(yield{type:`message_delta`,delta:{stop_reason:Ze(c,s),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_creation_input_tokens:0,cache_read_input_tokens:d}},yield{type:`message_stop`},i=!0))}function Xe(e){return typeof e.text==`string`?e.thought?`thinking`:`text`:null}function Ze(e,t){switch(e){case`MAX_TOKENS`:return`max_tokens`;default:return t?`tool_use`:`end_turn`}}var Qe=e((()=>{}));function $e(e){if(!e||typeof e!=`object`)return null;let t=e,n=0;for(;t&&n<5;){if(t instanceof Error&&`code`in t&&typeof t.code==`string`){let e=t.code,n=ot.has(e);return{code:e,message:t.message,isSSLError:n}}if(t instanceof Error&&`cause`in t&&t.cause!==t)t=t.cause,n++;else break}return null}function et(e){let t=$e(e);return t?.isSSLError?`SSL certificate error (${t.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run /doctor for details.`:null}function tt(e){if(e.includes(`<!DOCTYPE html`)||e.includes(`<html`)){let t=e.match(/<title>([^<]+)<\/title>/);return t&&t[1]?t[1].trim():``}return e}function nt(e){let t=e.message;return t?tt(t):``}function rt(e){return typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null}function it(e){if(!rt(e))return null;let t=e.error,n=t?.error?.message;if(typeof n==`string`&&n.length>0){let e=tt(n);if(e.length>0)return e}let r=t?.message;if(typeof r==`string`&&r.length>0){let e=tt(r);if(e.length>0)return e}return null}function at(e){let t=$e(e);if(t){let{code:e,isSSLError:n}=t;if(e===`ETIMEDOUT`)return`Request timed out. Check your internet connection and proxy settings`;if(n)switch(e){case`UNABLE_TO_VERIFY_LEAF_SIGNATURE`:case`UNABLE_TO_GET_ISSUER_CERT`:case`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`:return`Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates`;case`CERT_HAS_EXPIRED`:return`Unable to connect to API: SSL certificate has expired`;case`CERT_REVOKED`:return`Unable to connect to API: SSL certificate has been revoked`;case`DEPTH_ZERO_SELF_SIGNED_CERT`:case`SELF_SIGNED_CERT_IN_CHAIN`:return`Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates`;case`ERR_TLS_CERT_ALTNAME_INVALID`:case`HOSTNAME_MISMATCH`:return`Unable to connect to API: SSL certificate hostname mismatch`;case`CERT_NOT_YET_VALID`:return`Unable to connect to API: SSL certificate is not yet valid`;default:return`Unable to connect to API: SSL error (${e})`}}if(e.message===`Connection error.`)return t?.code?`Unable to connect to API (${t.code})`:`Unable to connect to API. Check your internet connection`;if(!e.message)return it(e)??`API error (status ${e.status??`unknown`})`;let n=nt(e);return n!==e.message&&n.length>0?n:e.message}var ot,st=e((()=>{ot=new Set([`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`UNABLE_TO_GET_ISSUER_CERT`,`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`CERT_SIGNATURE_FAILURE`,`CERT_NOT_YET_VALID`,`CERT_HAS_EXPIRED`,`CERT_REVOKED`,`CERT_REJECTED`,`CERT_UNTRUSTED`,`DEPTH_ZERO_SELF_SIGNED_CERT`,`SELF_SIGNED_CERT_IN_CHAIN`,`CERT_CHAIN_TOO_LONG`,`PATH_LENGTH_EXCEEDED`,`ERR_TLS_CERT_ALTNAME_INVALID`,`HOSTNAME_MISMATCH`,`ERR_TLS_HANDSHAKE_TIMEOUT`,`ERR_SSL_WRONG_VERSION_NUMBER`,`ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC`])}));function ct(e,t,n){let r=[],i=lt(t);i&&r.push({role:`system`,content:i});for(let t of e)switch(t.type){case`user`:r.push(...ut(t));break;case`assistant`:r.push(...ft(t));break;default:break}return r}function lt(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
5
|
-
|
|
6
|
-
`)}function ut(e){let t=[],n=e.message.content;if(typeof n==`string`)t.push({role:`user`,content:n});else if(Array.isArray(n)){let e=[],r=[],i=[];for(let t of n)if(typeof t==`string`)e.push(t);else if(t.type===`text`)e.push(t.text);else if(t.type===`tool_result`)r.push(t);else if(t.type===`image`){let e=pt(t);e&&i.push(e)}for(let e of r)t.push(dt(e));if(i.length>0){let n=[];e.length>0&&n.push({type:`text`,text:e.join(`
|
|
7
|
-
`)}),n.push(...i),t.push({role:`user`,content:n})}else e.length>0&&t.push({role:`user`,content:e.join(`
|
|
8
|
-
`)})}return t}function dt(e){let t;return t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(e=>typeof e==`string`?e:`text`in e?e.text:``).filter(Boolean).join(`
|
|
9
|
-
`):``,{role:`tool`,tool_call_id:e.tool_use_id,content:t}}function ft(e){let t=e.message.content;if(typeof t==`string`)return[{role:`assistant`,content:t}];if(!Array.isArray(t))return[{role:`assistant`,content:``}];let n=[],r=[],i=[];for(let e of t)if(typeof e==`string`)n.push(e);else if(e.type===`text`)n.push(e.text);else if(e.type===`tool_use`){let t=e;r.push({id:t.id,type:`function`,function:{name:t.name,arguments:typeof t.input==`string`?t.input:JSON.stringify(t.input)}})}else if(e.type===`thinking`){let t=e.thinking;typeof t==`string`&&i.push(t)}return[{role:`assistant`,content:n.length>0?n.join(`
|
|
10
|
-
`):null,...r.length>0&&{tool_calls:r},...i.length>0&&{reasoning_content:i.join(`
|
|
11
|
-
`)}}]}function pt(e){let t=e.source;return t?t.type===`base64`&&typeof t.data==`string`?{type:`image_url`,image_url:{url:`data:${t.media_type||`image/png`};base64,${t.data}`}}:t.type===`url`&&typeof t.url==`string`?{type:`image_url`,image_url:{url:t.url}}:null:null}var mt=e((()=>{}));function ht(e){return e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e,n=t.name||``,r=t.description||``,i=t.input_schema;return{type:`function`,function:{name:n,description:r,parameters:A(i||{type:`object`,properties:{}})}}})}function A(e){if(!e||typeof e!=`object`)return e;let t={...e};`const`in t&&(t.enum=[t.const],delete t.const);for(let e of[`properties`,`definitions`,`$defs`,`patternProperties`]){let n=t[e];if(n&&typeof n==`object`){let r={};for(let[e,t]of Object.entries(n))r[e]=t&&typeof t==`object`?A(t):t;t[e]=r}}for(let e of[`items`,`additionalProperties`,`not`,`if`,`then`,`else`,`contains`,`propertyNames`]){let n=t[e];n&&typeof n==`object`&&!Array.isArray(n)&&(t[e]=A(n))}for(let e of[`anyOf`,`oneOf`,`allOf`]){let n=t[e];Array.isArray(n)&&(t[e]=n.map(e=>e&&typeof e==`object`?A(e):e))}return t}function gt(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return`auto`;case`any`:return`required`;case`tool`:return{type:`function`,function:{name:t.name}};default:return}}var _t=e((()=>{}));async function*vt(e,t){let n=`msg_${y().replace(/-/g,``).slice(0,24)}`,r=!1,i=-1,a=new Map,o=!1,s=!1,c=0,l=0,u=0,d=0,f=new Set,p=null,m=!1;for await(let h of e){let e=h.choices?.[0],g=e?.delta;if(h.usage){c=h.usage.prompt_tokens??c;let e=h.usage.prompt_tokens_details?.cached_tokens??d;l=Math.max(0,c-e),u=h.usage.completion_tokens??u,d=e}if(r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}}),!g)continue;let _=g.reasoning_content;if(_!=null&&(o||(i++,o=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`thinking`,thinking:``,signature:``}}),_!==``&&(yield{type:`content_block_delta`,index:i,delta:{type:`thinking_delta`,thinking:_}})),g.content!=null&&g.content!==``&&(s||(o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),i++,s=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:i,delta:{type:`text_delta`,text:g.content}}),g.tool_calls)for(let e of g.tool_calls){let t=e.index;if(!a.has(t)){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1),i++;let n=e.id||`toolu_${y().replace(/-/g,``).slice(0,24)}`,r=e.function?.name||``;a.set(t,{contentIndex:i,id:n,name:r,arguments:``}),f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`tool_use`,id:n,name:r,input:{}}}}let n=e.function?.arguments;n&&(a.get(t).arguments+=n,yield{type:`content_block_delta`,index:a.get(t).contentIndex,delta:{type:`input_json_delta`,partial_json:n}})}if(e?.finish_reason){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1);for(let[,e]of a)f.has(e.contentIndex)&&(yield{type:`content_block_stop`,index:e.contentIndex},f.delete(e.contentIndex));p=e.finish_reason,m=a.size>0}}for(let e of f)yield{type:`content_block_stop`,index:e};p!==null&&(yield{type:`message_delta`,delta:{stop_reason:p===`length`?`max_tokens`:m?`tool_use`:yt(p),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_read_input_tokens:d,cache_creation_input_tokens:0}},yield{type:`message_stop`})}function yt(e){switch(e){case`stop`:return`end_turn`;case`tool_calls`:return`tool_use`;case`length`:return`max_tokens`;case`content_filter`:return`end_turn`;default:return`end_turn`}}var bt=e((()=>{})),xt=e((()=>{ge(),be(),we(),De(),Le(),Je(),Qe(),T(),st(),mt(),_t(),bt()}));function St(){let e=s();if(e!==void 0)return e;let t=process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;if(!t){let e=ie(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??v,`session ingress token`);return o(e),e}let n=parseInt(t,10);if(Number.isNaN(n))return f(`CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR must be a valid file descriptor number, got: ${t}`,{level:`error`}),o(null),null;try{let e=_(),t=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${n}`:`/proc/self/fd/${n}`,r=e.readFileSync(t,{encoding:`utf8`}).trim();return r?(f(`Successfully read token from file descriptor ${n}`),o(r),ne(v,r,`session ingress token`),r):(f(`File descriptor contained empty token`,{level:`error`}),o(null),null)}catch(e){f(`Failed to read token from file descriptor ${n}: ${u(e)}`,{level:`error`});let t=ie(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??v,`session ingress token`);return o(t),t}}function Ct(){return process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||St()}function wt(){let e=Ct();if(!e)return{};if(e.startsWith(`sk-ant-sid`)){let t={Cookie:`sessionKey=${e}`},n=process.env.CLAUDE_CODE_ORGANIZATION_UUID;return n&&(t[`X-Organization-Uuid`]=n),t}return{Authorization:`Bearer ${e}`}}function Tt(e){process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN=e}var Et=e((()=>{a(),re(),m(),d(),p()}));function j(e){l()&&(M.length>=kt&&M.shift(),M.push(e))}function Dt(){return M.length===0?[]:M.splice(0).map(e=>({...e,uuid:y(),session_id:c()}))}function Ot(e,t,n){j({type:`system`,subtype:`task_notification`,task_id:e,tool_use_id:n?.toolUseId,status:t,output_file:n?.outputFile??``,summary:n?.summary??``,usage:n?.usage})}var kt,M,At=e((()=>{a(),kt=1e3,M=[]})),jt=t({activateProactive:()=>Mt,deactivateProactive:()=>Nt,getActivationSource:()=>Vt,getNextTickAt:()=>Bt,isContextBlocked:()=>Rt,isProactiveActive:()=>P,isProactivePaused:()=>Pt,pauseProactive:()=>Ft,resumeProactive:()=>It,setContextBlocked:()=>Lt,setNextTickAt:()=>zt,shouldTick:()=>Ut,subscribeToProactiveChanges:()=>Ht});function N(){for(let e of B)try{e()}catch{}}function P(){return F}function Mt(e){F||(F=!0,I=!1,L=!1,z=e,N())}function Nt(){F&&(F=!1,I=!1,L=!1,R=null,z=void 0,N())}function Pt(){return I}function Ft(){!F||I||(I=!0,R=null,N())}function It(){!F||!I||(I=!1,N())}function Lt(e){L!==e&&(L=e,e&&(R=null),N())}function Rt(){return L}function zt(e){R=e,N()}function Bt(){return!F||I||L?null:R}function Vt(){return z}function Ht(e){return B.add(e),()=>{B.delete(e)}}function Ut(){return F&&!I&&!L}var F,I,L,R,z,B,Wt=e((()=>{F=!1,I=!1,L=!1,R=null,B=new Set}));function Gt(){V(),q=setInterval(()=>{te(`debug`,`session_keepalive_heartbeat`,{refcount:W}),n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&U?.()},H)}function Kt(){V(),U!==null&&(J=setTimeout(()=>{te(`info`,`session_idle_30s`),J=null},H))}function V(){J!==null&&(clearTimeout(J),J=null)}function qt(e){U=e,W>0&&q===null&&Gt()}function Jt(){U=null,q!==null&&(clearInterval(q),q=null),V()}function Yt(){n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&U?.()}function Xt(){return U!==null}function Zt(e){W++,G.set(e,(G.get(e)??0)+1),W===1&&(K=Date.now(),U!==null&&q===null&&Gt()),$t||($t=!0,h(async()=>{te(`info`,`session_activity_at_shutdown`,{refcount:W,active:Object.fromEntries(G),oldest_activity_ms:W>0&&K!==null?Date.now()-K:null})}))}function Qt(e){W>0&&W--;let t=(G.get(e)??0)-1;t>0?G.set(e,t):G.delete(e),W===0&&q!==null&&(clearInterval(q),q=null,Kt())}var H,U,W,G,K,q,J,$t,en=e((()=>{g(),ee(),r(),H=3e4,U=null,W=0,G=new Map,K=null,q=null,J=null,$t=!1}));function tn(e){pn=e}function nn(e,t){if(X=e,!e||!t?.replayCurrent)return;let n=cn();Object.keys(n).length!==0&&e(n)}function rn(e){mn=e}function an(e){return!e||e.enabled!==!0?null:{enabled:!0,phase:e.phase===`standby`||e.phase===`sleeping`?e.phase:null,next_tick_at:typeof e.next_tick_at==`number`?e.next_tick_at:null,sleep_until:typeof e.sleep_until==`number`?e.sleep_until:null}}function on(e){return JSON.stringify(e)}function sn(e){let t={...$};for(let n of Object.keys(e)){let r=e[n];if(r===void 0){delete t[n];continue}t[n]=r}$=t}function cn(){let e={...$};return Q?e.automation_state={...Q}:`automation_state`in $&&(e.automation_state=$.automation_state??null),e}function ln(){return hn}function un(e,t){hn=e,pn?.(e,t),e===`requires_action`&&t?(Z=!0,Y({pending_action:t})):Z&&(Z=!1,Y({pending_action:null})),e===`idle`&&Y({task_summary:null}),e!==`idle`&&dn(P()?{enabled:!0,phase:null,next_tick_at:null,sleep_until:null}:null),n(process.env.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS)&&j({type:`system`,subtype:`session_state_changed`,state:e})}function Y(e){sn(e),X?.(e)}function dn(e){let t=an(e);on(t)!==on(Q)&&(Q=t,sn({automation_state:t}),X?.({automation_state:t}))}function fn(e){mn?.(e)}var pn,X,mn,Z,hn,Q,$,gn=e((()=>{Wt(),r(),At(),pn=null,X=null,mn=null,Z=!1,hn=`idle`,Q=null,$={}}));export{De as $,Et as A,$e as B,Ut as C,At as D,j as E,gt as F,Qe as G,et as H,ht as I,Je as J,Ke as K,_t as L,xt as M,vt as N,wt as O,bt as P,T as Q,ct as R,zt as S,Ot as T,st as U,at as V,Ye as W,Le as X,Oe as Y,w as Z,Wt as _,Y as a,me as at,Pt as b,nn as c,fe as ct,Xt as d,le as dt,Ee as et,qt as f,se as ft,Jt as g,Qt as h,fn as i,ve as it,Tt as j,Ct as k,tn as l,ae as lt,Zt as m,gn as n,Ce as nt,un as o,he as ot,Yt as p,ce as pt,Ge as q,dn as r,be as rt,rn as s,de as st,ln as t,we as tt,en as u,oe as ut,Rt as v,Dt as w,jt as x,P as y,mt as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Qr as e,Sr as t,kr as n}from"./loadAgentsDir-mcRW90aq.js";t();export{n as linkSessionToPR,e as recordTranscript};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{i as r,t as i}from"./hash-Tu-My5Vp.js";import{join as a}from"path";import{open as o,readdir as s,realpath as c,stat as l}from"fs/promises";import{promisify as u}from"util";import{execFile as d}from"child_process";async function f(e){try{let{stdout:t}=await p(`git`,[`worktree`,`list`,`--porcelain`],{cwd:e,timeout:5e3});return t?t.split(`
|
|
2
|
-
`).filter(e=>e.startsWith(`worktree `)).map(e=>e.slice(9).normalize(`NFC`)):[]}catch{return[]}}var p,m=e((()=>{p=u(d)}));function h(e){return typeof e==`string`&&B.test(e)?e:null}function g(e){if(!e.includes(`\\`))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function _(e,t){let n=[`"${t}":"`,`"${t}": "`];for(let t of n){let n=e.indexOf(t);if(n<0)continue;let r=n+t.length,i=r;for(;i<e.length;){if(e[i]===`\\`){i+=2;continue}if(e[i]===`"`)return g(e.slice(r,i));i++}}}function v(e,t){let n=[`"${t}":"`,`"${t}": "`],r;for(let t of n){let n=0;for(;;){let i=e.indexOf(t,n);if(i<0)break;let a=i+t.length,o=a;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]===`"`){r=g(e.slice(a,o));break}o++}n=o+1}}return r}function y(e){let t=0,n=``;for(;t<e.length;){let r=e.indexOf(`
|
|
3
|
-
`,t),i=r>=0?e.slice(t,r):e.slice(t);if(t=r>=0?r+1:e.length,!(!i.includes(`"type":"user"`)&&!i.includes(`"type": "user"`))&&!i.includes(`"tool_result"`)&&!(i.includes(`"isMeta":true`)||i.includes(`"isMeta": true`))&&!(i.includes(`"isCompactSummary":true`)||i.includes(`"isCompactSummary": true`)))try{let e=JSON.parse(i);if(e.type!==`user`)continue;let t=e.message;if(!t)continue;let r=t.content,a=[];if(typeof r==`string`)a.push(r);else if(Array.isArray(r))for(let e of r)e.type===`text`&&typeof e.text==`string`&&a.push(e.text);for(let e of a){let t=e.replace(/\n/g,` `).trim();if(!t)continue;let r=H.exec(t);if(r){n||(n=r[1]);continue}let i=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(t);if(i)return`! ${i[1].trim()}`;if(!V.test(t))return t.length>200&&(t=t.slice(0,200).trim()+`…`),t}}catch{}}return n||``}async function b(e,t,n){try{let r=await o(e,`r`);try{let e=await r.read(n,0,z,0);if(e.bytesRead===0)return{head:``,tail:``};let i=n.toString(`utf8`,0,e.bytesRead),a=Math.max(0,t-z),o=i;if(a>0){let e=await r.read(n,0,z,a);o=n.toString(`utf8`,0,e.bytesRead)}return{head:i,tail:o}}finally{await r.close()}}catch{return{head:``,tail:``}}}async function x(e){try{let t=await o(e,`r`);try{let e=await t.stat(),n=Buffer.allocUnsafe(z),r=await t.read(n,0,z,0);if(r.bytesRead===0)return null;let i=n.toString(`utf8`,0,r.bytesRead),a=Math.max(0,e.size-z),o=i;if(a>0){let e=await t.read(n,0,z,a);o=n.toString(`utf8`,0,e.bytesRead)}return{mtime:e.mtime.getTime(),size:e.size,head:i,tail:o}}finally{await t.close()}}catch{return null}}function S(e){return Math.abs(i(e)).toString(36)}function C(e){let t=e.replace(/[^a-zA-Z0-9]/g,`-`);if(t.length<=200)return t;let n=typeof Bun<`u`?Bun.hash(e).toString(36):S(e);return`${t.slice(0,200)}-${n}`}function w(){return a(t(),`projects`)}function T(e){return a(w(),C(e))}async function E(e){try{return(await c(e)).normalize(`NFC`)}catch{return e.normalize(`NFC`)}}async function D(e){let t=T(e);try{return await s(t),t}catch{let t=C(e);if(t.length<=200)return;let n=t.slice(0,200),r=w();try{let e=(await s(r,{withFileTypes:!0})).find(e=>e.isDirectory()&&e.name.startsWith(n+`-`));return e?a(r,e.name):void 0}catch{return}}}async function O(e,t){let n=`${e}.jsonl`;if(t){let e=await E(t),r=await D(e);if(r){let t=a(r,n);try{let n=await l(t);if(n.size>0)return{filePath:t,projectPath:e,fileSize:n.size}}catch{}}let i;try{i=await f(e)}catch{i=[]}for(let t of i){if(t===e)continue;let r=await D(t);if(!r)continue;let i=a(r,n);try{let e=await l(i);if(e.size>0)return{filePath:i,projectPath:t,fileSize:e.size}}catch{}}return}let r=w(),i;try{i=await s(r)}catch{return}for(let e of i){let t=a(r,e,n);try{let e=await l(t);if(e.size>0)return{filePath:t,projectPath:void 0,fileSize:e.size}}catch{}}}function k(){return G??(G=Buffer.from(`"compact_boundary"`))}function A(e){try{let t=JSON.parse(e);return t.type!==`system`||t.subtype!==`compact_boundary`?null:{hasPreservedSegment:!!t.compactMetadata?.preservedSegment}}catch{return null}}function j(e,t,n,r){let i=r-n;if(!(i<=0)){if(e.len+i>e.buf.length){let t=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+i),e.cap));e.buf.copy(t,0,0,e.len),e.buf=t}t.copy(e.buf,e.len,n,r),e.len+=i}}function M(e,t,n,r){return r-n>=t.length&&e.compare(t,0,t.length,n,n+t.length)===0}function N(e,t,n){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let r=e.carryBuf,i=t.indexOf(J);if(i===-1||i>=n)return 0;let a=i+1;if(M(r,K,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=a,e.lastSnapSrc=null;else if(e.carryLen<K.length)return 0;else{if(M(r,q,0,e.carryLen)){let n=A(r.toString(`utf-8`,0,e.carryLen)+t.toString(`utf-8`,0,i));n?.hasPreservedSegment?e.hasPreservedSegment=!0:n&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null)}j(e.out,r,0,e.carryLen),j(e.out,t,0,a)}return e.bufFileOff+=e.carryLen+a,e.carryLen=0,a}function P(e,t,n){let r=t.indexOf(n),i=0,a=0,o=-1,s=-1,c=t.indexOf(J);for(;c!==-1;){let l=c+1;if(r!==-1&&r<a&&(r=t.indexOf(n,a)),M(t,K,a,l))j(e.out,t,i,a),o=a,s=l,i=l;else if(r>=a&&r<Math.min(a+X,l)){let s=A(t.toString(`utf-8`,a,c));s?.hasPreservedSegment?e.hasPreservedSegment=!0:s&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff+a,e.hasPreservedSegment=!1,e.lastSnapSrc=null,o=-1,e.straddleSnapCarryLen=0,i=a),r=t.indexOf(n,r+n.length)}a=l,c=t.indexOf(J,a)}return j(e.out,t,i,a),{lastSnapStart:o,lastSnapEnd:s,trailStart:a}}function F(e,t,n,r,i){r===-1?e.straddleSnapCarryLen>0&&(e.lastSnapLen=e.straddleSnapCarryLen+e.straddleSnapTailEnd,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),e.carryBuf.copy(e.lastSnapBuf,0,0,e.straddleSnapCarryLen),n.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf):(e.lastSnapLen=i-r,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),t.copy(e.lastSnapBuf,0,r,i),e.lastSnapSrc=e.lastSnapBuf)}function I(e,t,n){e.carryLen=t.length-n,e.carryLen>0&&((e.carryBuf===void 0||e.carryLen>e.carryBuf.length)&&(e.carryBuf=Buffer.allocUnsafe(e.carryLen)),t.copy(e.carryBuf,0,n,t.length))}function L(e){if(e.carryLen>0){let t=e.carryBuf;M(t,K,0,e.carryLen)?(e.lastSnapSrc=t,e.lastSnapLen=e.carryLen):j(e.out,t,0,e.carryLen)}e.lastSnapSrc&&(e.out.len>0&&e.out.buf[e.out.len-1]!==J&&j(e.out,Y,0,1),j(e.out,e.lastSnapSrc,0,e.lastSnapLen))}async function R(e,t){let n=k(),r=U,i={out:{buf:Buffer.allocUnsafe(Math.min(t,8*1024*1024)),len:0,cap:t+1},boundaryStartOffset:0,hasPreservedSegment:!1,lastSnapSrc:null,lastSnapLen:0,lastSnapBuf:void 0,bufFileOff:0,carryLen:0,carryBuf:void 0,straddleSnapCarryLen:0,straddleSnapTailEnd:0},a=Buffer.allocUnsafe(r),s=await o(e,`r`);try{let e=0;for(;e<t;){let{bytesRead:o}=await s.read(a,0,Math.min(r,t-e),e);if(o===0)break;e+=o;let c=N(i,a,o),l;if(i.carryLen>0){let e=i.carryLen+(o-c);l=Buffer.allocUnsafe(e),i.carryBuf.copy(l,0,0,i.carryLen),a.copy(l,i.carryLen,c,o)}else l=a.subarray(c,o);let u=P(i,l,n);F(i,l,a,u.lastSnapStart,u.lastSnapEnd),I(i,l,u.trailStart),i.bufFileOff+=u.trailStart}L(i)}finally{await s.close()}return{boundaryStartOffset:i.boundaryStartOffset,postBoundaryBuf:i.out.buf.subarray(0,i.out.len),hasPreservedSegment:i.hasPreservedSegment}}var z,B,V,H,U,W,G,K,q,J,Y,X,Z=e((()=>{n(),m(),r(),z=65536,B=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,V=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,H=/<command-name>(.*?)<\/command-name>/,U=1024*1024,W=5*1024*1024,K=Buffer.from(`{"type":"attribution-snapshot"`),q=Buffer.from(`{"type":"system"`),J=10,Y=Buffer.from([J]),X=256}));export{m as _,_ as a,w as c,x as d,R as f,f as g,h,y as i,Z as l,C as m,W as n,v as o,O as p,E as r,D as s,z as t,b as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,g as t,x as n}from"./settings-DiBMs2gM.js";t();export{e as getSettingsForSource,n as updateSettingsForSource};
|