claude-code-best 2.7.1 → 2.7.2
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-C7od6sFQ.js → AddWorkspaceDirectory-V2tF7iCY.js} +1 -1
- package/dist/chunks/{App-EfHjElWP.js → App-DLdRpU7c.js} +1 -1
- package/dist/chunks/ApproveApiKey-B7_TCGwt.js +1 -0
- package/dist/chunks/{ApproveApiKey-CSz0291w.js → ApproveApiKey-DPws3jax.js} +1 -1
- package/dist/chunks/{AssistantSessionChooser-mLIhDlxW.js → AssistantSessionChooser-D6rS0OVe.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-hGlbm5z5.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-BCdft-m_.js → BypassPermissionsModeDialog-CuEpdRVd.js} +1 -1
- package/dist/chunks/{ClaudeInChromeOnboarding-BPlrCIo-.js → ClaudeInChromeOnboarding-CTTKMRbt.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-D8fk-Ib5.js → ClaudeMdExternalIncludesDialog-B-GkVoA_.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DxJK9NiM.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-LPZ97jsm.js +1 -0
- package/dist/chunks/{DesktopHandoff-BQwx7qWA.js → DesktopHandoff-BjPylhOT.js} +1 -1
- package/dist/chunks/{DevChannelsDialog-CujM8Ivu.js → DevChannelsDialog-c4YVqBX9.js} +1 -1
- package/dist/chunks/{DiffDialog-Byv1UJvS.js → DiffDialog-I5wuXw2C.js} +1 -1
- package/dist/chunks/{Doctor-Cv7wbi6C.js → Doctor-Cr_MlSPc.js} +1 -1
- package/dist/chunks/Doctor-hgf3dMAW.js +1 -0
- package/dist/chunks/{ExitFlow-DKusdm_v.js → ExitFlow-Bz5grDWv.js} +2 -2
- package/dist/chunks/{Feedback-Diw8XUr-.js → Feedback-COgMI5tY.js} +1 -1
- package/dist/chunks/Grove-Bwmghb-e.js +1 -0
- package/dist/chunks/{Grove-CAi037VV.js → Grove-m57x4tY1.js} +1 -1
- package/dist/chunks/{HybridTransport-CP0RopXu.js → HybridTransport-Bok4-Ptt.js} +1 -1
- package/dist/chunks/{ITermBackend-RvD4VX7c.js → ITermBackend-BBSP-NNa.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-Bhlgysxl.js → InvalidConfigDialog-uTSuSBvO.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-dGStgJZN.js → InvalidSettingsDialog-B-Os12-H.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-D5a9ysw2.js → MCPConnectionManager-y97Inszc.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-B_z9pZ_8.js → McpParsingWarnings-DMFUZw92.js} +1 -1
- package/dist/chunks/MessageSelector-DwdAC2io.js +3 -0
- package/dist/chunks/{Messages-DTmFVhRG.js → Messages-FEBcX-cT.js} +3 -3
- package/dist/chunks/{Onboarding-BoAtphYb.js → Onboarding-B8qMJaBh.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-DA7Ne7Mj.js → OverageCreditUpsell-DnFv5z-z.js} +1 -1
- package/dist/chunks/PluginSettings-B_xVgTTp.js +17 -0
- package/dist/chunks/{PromptInputHelpMenu-B__j9zE6.js → PromptInputHelpMenu-CoMkWchC.js} +1 -1
- package/dist/chunks/QueryEngine-C7r7O-hH.js +1 -0
- package/dist/chunks/{REPL-B1BS9jwx.js → REPL-CmJdJrGO.js} +36 -36
- package/dist/chunks/REPL-nP7H_-qa.js +1 -0
- package/dist/chunks/{RemoteCallout-Bwe1ESr9.js → RemoteCallout-4JOZROfT.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-BKD4YmzY.js → RemoteSessionManager-jcPnywfY.js} +2 -2
- package/dist/chunks/ResumeConversation-CZ2Uedkf.js +1 -0
- package/dist/chunks/{SSETransport-D3e5KNL3.js → SSETransport-kEH_p4Yq.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-C64oVFUD.js +1 -0
- package/dist/chunks/SentryErrorBoundary-2E2qGV11.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-D-YZTGQG.js → SentryErrorBoundary-97iY7Nb7.js} +1 -1
- package/dist/chunks/Settings-CuljH0mu.js +2 -0
- package/dist/chunks/{TeleportProgress-C3Ubx1Se.js → TeleportProgress-Ctdqi7iS.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-D_ax3xQy.js → TeleportRepoMismatchDialog-DyTBg1YD.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-DeVKIXQp.js → TeleportResumeWrapper-B66clYsG.js} +1 -1
- package/dist/chunks/{ThemePicker-DKmIL5Ku.js → ThemePicker-WKmYvrqz.js} +1 -1
- package/dist/chunks/{TmuxBackend-Bm_cRJ2x.js → TmuxBackend-OKX2NP14.js} +2 -2
- package/dist/chunks/{TrustDialog-ClXFMKj6.js → TrustDialog-0anSIf-G.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-SdQADfvA.js → ValidationErrorsList-CfgC1KJb.js} +1 -1
- package/dist/chunks/{WelcomeV2-BijS6i2Z.js → WelcomeV2-BMHXiNt3.js} +1 -1
- package/dist/chunks/{WindowsTerminalBackend-CGEQ5ClB.js → WindowsTerminalBackend-fCSGVe4W.js} +2 -2
- package/dist/chunks/{add-dir-B7kleB6k.js → add-dir-CMtuW667.js} +1 -1
- package/dist/chunks/{agentDisplay-Dr1XbOAu.js → agentDisplay-CgYKW3G7.js} +1 -1
- package/dist/chunks/{agents-CpLvvWpO.js → agents-CdqcGm9o.js} +7 -7
- package/dist/chunks/{agents-Dy5YOJC9.js → agents-D90TsYOf.js} +1 -1
- package/dist/chunks/{ant-gwf-4eGN.js → ant-DZjimiuz.js} +1 -1
- package/dist/chunks/{api-CDmgYrwN.js → api-CQWbpxLP.js} +1 -1
- package/dist/chunks/api-quOYYOhi.js +1 -0
- package/dist/chunks/assistant-B5_xx00q.js +1 -0
- package/dist/chunks/{assistant-BULedprW.js → assistant-CEmC_DlU.js} +1 -1
- package/dist/chunks/{assistant-1usDIXtk.js → assistant-CyVcFPIR.js} +1 -1
- package/dist/chunks/auth-CjtaiRtF.js +1 -0
- package/dist/chunks/{auth-CvHVr2A5.js → auth-DsQEVs9W.js} +1 -1
- package/dist/chunks/{autoMode-DSMM2seL.js → autoMode-DEbM9UaE.js} +1 -1
- package/dist/chunks/{autonomy-TtBO2TAe.js → autonomy-Clap6Swl.js} +1 -1
- package/dist/chunks/{autonomy-Dj6Nzxus.js → autonomy-lNpGnyiu.js} +3 -3
- package/dist/chunks/{autonomyPanel-CbmU7lPg.js → autonomyPanel-BqEvfI0e.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-D-jt-ocx.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-Cp2RvmEN.js → backgroundHousekeeping-KvOpP_4M.js} +2 -2
- package/dist/chunks/{branch-Cj5TGroO.js → branch-CSYB04xC.js} +1 -1
- package/dist/chunks/{bridge-CsqJAoEg.js → bridge-DDgASypO.js} +2 -2
- package/dist/chunks/bridgeConfig-BdZVEqhx.js +1 -0
- package/dist/chunks/{bridgeConfig-pjDV5Z2l.js → bridgeConfig-DjC4oig1.js} +1 -1
- package/dist/chunks/{bridgeEnabled-D9jI6X-w.js → bridgeEnabled-Csn6Ym3k.js} +1 -1
- package/dist/chunks/bridgeEnabled-DLRIH243.js +1 -0
- package/dist/chunks/{bridgeMain-CNmR9iDD.js → bridgeMain-B5wsmwkN.js} +11 -11
- package/dist/chunks/bridgeMain-BN0Sag35.js +1 -0
- package/dist/chunks/{bridgeMessaging-DN0X35NX.js → bridgeMessaging-ChOzzVWj.js} +1 -1
- package/dist/chunks/{btw-BOg0RTKl.js → btw-BgjcOoeo.js} +1 -1
- package/dist/chunks/{buddy-BFuPeIxM.js → buddy-C1wE3noR.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-kxVnIVRs.js → bypassPermissionsKillswitch-C0diGLRB.js} +1 -1
- package/dist/chunks/{caches-BumkMuGA.js → caches-CIoVGP24.js} +2 -2
- package/dist/chunks/caches-DMYdTEAr.js +1 -0
- package/dist/chunks/{ccrClient-BI1QPLmN.js → ccrClient-C1msT1E3.js} +1 -1
- package/dist/chunks/changeDetector-DoOBZOt1.js +1 -0
- package/dist/chunks/{channelNotification-CoZSFUlb.js → channelNotification-CWlu9ZWs.js} +1 -1
- package/dist/chunks/channelNotification-oZ6vG5R5.js +1 -0
- package/dist/chunks/{chrome-C_5EZcdc.js → chrome-Bo9uNZ7s.js} +1 -1
- package/dist/chunks/clear-BxdX_MUP.js +1 -0
- package/dist/chunks/client-BSoJ_vaA.js +1 -0
- package/dist/chunks/color-CkzktPHt.js +1 -0
- package/dist/chunks/commands-hyVX9-Lh.js +1 -0
- package/dist/chunks/commitAttribution-BwT0TbYF.js +1 -0
- package/dist/chunks/{commitAttribution-iKd8bTOI.js → commitAttribution-csu3NO7Y.js} +1 -1
- package/dist/chunks/{compact-B6Muofhz.js → compact-DNGIVZRN.js} +3 -3
- package/dist/chunks/{companion-B_LrjSk5.js → companion-Diuav3lA.js} +1 -1
- package/dist/chunks/{config-CQd4IkXo.js → config-B25IrkTA.js} +1 -1
- package/dist/chunks/{config-CJd9kJ57.js → config-ODoYZY8i.js} +1 -1
- package/dist/chunks/{context-qAHTuazZ.js → context-CZ5enuPE.js} +1 -1
- package/dist/chunks/{context-noninteractive-DZsSp-ES.js → context-noninteractive-62P5EnN5.js} +1 -1
- package/dist/chunks/context-noninteractive-CjuzL9q5.js +1 -0
- package/dist/chunks/conversation-DyhWeHw2.js +1 -0
- package/dist/chunks/conversation-uY-V0SNK.js +1 -0
- package/dist/chunks/{copy-B2jhZndZ.js → copy-9JLr2-Xs.js} +1 -1
- package/dist/chunks/{createSSHSession-CKdoEmAg.js → createSSHSession-B1hTuDpB.js} +1 -1
- package/dist/chunks/createSession-Qurw-N4x.js +1 -0
- package/dist/chunks/{createSession-WkBw7wdn.js → createSession-fzjzy0aS.js} +1 -1
- package/dist/chunks/cron-DwR6OJuW.js +1 -0
- package/dist/chunks/{cronJitterConfig-2u6WAlti.js → cronJitterConfig-9OmmYmIT.js} +1 -1
- package/dist/chunks/{crossProjectResume-CjJISRBQ.js → crossProjectResume-B6efoIur.js} +3 -3
- package/dist/chunks/datadog-C-llbwzP.js +1 -0
- package/dist/chunks/{datadog-YsyhnDmr.js → datadog-SSxsxcC-.js} +1 -1
- package/dist/chunks/{desktop-BN9pHpK_.js → desktop-CQnMcbex.js} +1 -1
- package/dist/chunks/{diff-BTtUFuf-.js → diff-uAwKYa51.js} +1 -1
- package/dist/chunks/{doctor-BKBb426q.js → doctor-CBF0fkBF.js} +1 -1
- package/dist/chunks/{effort-ClhxMqY6.js → effort-F-bhAM2u.js} +1 -1
- package/dist/chunks/{entry-CJlJ47nP.js → entry-DHN_Gr1b.js} +3 -3
- package/dist/chunks/envLessBridgeConfig-CDVtIEWT.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-C9UUbQCo.js → envLessBridgeConfig-Dg0hNsdi.js} +1 -1
- package/dist/chunks/{exit-DxY3yJrp.js → exit-CqcvZJwI.js} +1 -1
- package/dist/chunks/{export-DS2esu8D.js → export-c6WoGlsG.js} +1 -1
- package/dist/chunks/{exportRenderer-DX2L5fQ7.js → exportRenderer-CaegIP5N.js} +1 -1
- package/dist/chunks/{extra-usage-XJxfHsbe.js → extra-usage-Cj8fokgc.js} +1 -1
- package/dist/chunks/extra-usage-Dk-wcvAu.js +1 -0
- package/dist/chunks/{extra-usage-core-D84ifgBo.js → extra-usage-core-sHzc4eE1.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-fxqxHnIt.js → extra-usage-noninteractive-D0kqrqsg.js} +1 -1
- package/dist/chunks/{extraUsage-P_NGI1-I.js → extraUsage-CbkqfG1U.js} +1 -1
- package/dist/chunks/extractMemories-BP8Opsbp.js +1 -0
- package/dist/chunks/{fast-CpN8lLnE.js → fast-DS3iQ1CH.js} +1 -1
- package/dist/chunks/fast-DklfqySb.js +1 -0
- package/dist/chunks/{feedback-CqRsOG3c.js → feedback-QJynmG5q.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-CM0V7Uev.js → firstPartyEventLogger-DlW8BUXq.js} +1 -1
- package/dist/chunks/{flushGate-DNutWuOE.js → flushGate-CK5B9-Zn.js} +1 -1
- package/dist/chunks/gates-6amRNsYl.js +1 -0
- package/dist/chunks/{gates-C4JvRq4i.js → gates-vlrMjO-X.js} +1 -1
- package/dist/chunks/{gemini-B0M6SQSG.js → gemini-B5ZRjDrh.js} +1 -1
- package/dist/chunks/{generateRecap-DhDOgXn3.js → generateRecap-SgRMdsyN.js} +1 -1
- package/dist/chunks/{generateSessionName-CoFR2wgK.js → generateSessionName-sZFzpwsq.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-DGiSNykv.js → githubRepoPathMapping-DUGvTwPB.js} +1 -1
- package/dist/chunks/{goal-DRb6pPAp.js → goal-Dy-GGn9r.js} +3 -3
- package/dist/chunks/{grok-emDua_hT.js → grok-BG4_buNt.js} +1 -1
- package/dist/chunks/{growthbook-COAneL48.js → growthbook-Br1dDRtd.js} +1 -1
- package/dist/chunks/{heapdump-CA6DHA8G.js → heapdump-B9PVKMxa.js} +1 -1
- package/dist/chunks/{help-XXY7deZm.js → help-BfWF7xij.js} +1 -1
- package/dist/chunks/hooks-BVrhxysz.js +1 -0
- package/dist/chunks/{hooks-C6zZYnDi.js → hooks-KK32pxq3.js} +2 -2
- package/dist/chunks/{hostAdapter-DZbdeXCV.js → hostAdapter-TBJav3vX.js} +1 -1
- package/dist/chunks/{ide-BLRNkzVx.js → ide-BU1A79BE.js} +2 -2
- package/dist/chunks/{inboundAttachments-60kD5Qt_.js → inboundAttachments-D4tBPCB8.js} +1 -1
- package/dist/chunks/inboundAttachments-DWJplT9p.js +1 -0
- package/dist/chunks/initReplBridge-99sUBVEk.js +1 -0
- package/dist/chunks/{insights-BBugI3tW.js → insights-lDHodCMG.js} +1 -1
- package/dist/chunks/{install-CuVHbwyW.js → install-Bg4ZgW81.js} +1 -1
- package/dist/chunks/{install-github-app-ByyzrlM9.js → install-github-app-RLbUq5EL.js} +2 -2
- package/dist/chunks/{install-slack-app-CJGtmacz.js → install-slack-app-CHmIwsbm.js} +1 -1
- package/dist/chunks/{instrumentation-C8zvzMg1.js → instrumentation-BCiV3SKX.js} +3 -3
- package/dist/chunks/{job-DBf6aPQX.js → job-xOGf0j5Q.js} +1 -1
- package/dist/chunks/{keybindings-Bi7SMp5-.js → keybindings-DMbReZ4p.js} +1 -1
- package/dist/chunks/{lang-CVDkUhjk.js → lang-A6LUGP_7.js} +1 -1
- package/dist/chunks/language-Bzp5KDCE.js +1 -0
- package/dist/chunks/{language-BYeqMX74.js → language-CGfURU2y.js} +1 -1
- package/dist/chunks/{launchAgentsPlatform-BKqxMFFn.js → launchAgentsPlatform-Dbpm7Jyo.js} +1 -1
- package/dist/chunks/{launchAutofixPr-CauX6gOB.js → launchAutofixPr-RZfqx5eM.js} +3 -3
- package/dist/chunks/{launchLocalMemory-Brrd_BJC.js → launchLocalMemory-DIntbsvg.js} +2 -2
- package/dist/chunks/{launchLocalVault-DtAn656A.js → launchLocalVault-CCUw0ayu.js} +3 -3
- package/dist/chunks/{launchMemoryStores-x7_Id7Yr.js → launchMemoryStores-QJTh8KSP.js} +1 -1
- package/dist/chunks/{launchOnboarding-DkamFByn.js → launchOnboarding--Pe30AYd.js} +1 -1
- package/dist/chunks/{launchSchedule-DjNQNxW4.js → launchSchedule-DjN1RbRX.js} +1 -1
- package/dist/chunks/{launchSkillStore-D2GUGhDD.js → launchSkillStore-CcKmVDz1.js} +1 -1
- package/dist/chunks/{launchTeleport-DTfhiZkf.js → launchTeleport-BKlEo0yF.js} +3 -3
- package/dist/chunks/{launchVault-BZ2Po4r8.js → launchVault-C7UHA-IG.js} +1 -1
- package/dist/chunks/{loadAgentsDir-C_wFhytF.js → loadAgentsDir-ClTeo0nk.js} +560 -560
- package/dist/chunks/loadAgentsDir-CshktEpX.js +1 -0
- package/dist/chunks/loadPluginHooks-DVZmzYLl.js +1 -0
- package/dist/chunks/localSearch-BtLNJRij.js +1 -0
- package/dist/chunks/{localSearch-B0p0_bjP.js → localSearch-Koc8naSr.js} +1 -1
- package/dist/chunks/login-BngE89_j.js +1 -0
- package/dist/chunks/{login-C1uE6Pg9.js → login-C3MZQTDL.js} +1 -1
- package/dist/chunks/{logoV2Utils-BJHvwGup.js → logoV2Utils-DAIIwt5R.js} +1 -1
- package/dist/chunks/logout-CXZBaUen.js +1 -0
- package/dist/chunks/{magicDocs-DPZzG7Z2.js → magicDocs-C_inI3JJ.js} +1 -1
- package/dist/chunks/{main-CNwSLti2.js → main-qqcmncHA.js} +36 -36
- package/dist/chunks/{mappers-Dxs_kNJH.js → mappers-7BSMbYvH.js} +1 -1
- package/dist/chunks/{mcp-CbDDqdzF.js → mcp-DRBiobrN.js} +1 -1
- package/dist/chunks/mcp-DV8Prhgi.js +1 -0
- package/dist/chunks/mcp-HQ8-nEZ1.js +6 -0
- package/dist/chunks/{mcpServer-BJNjQXsU.js → mcpServer-CLIYAgGs.js} +1 -1
- package/dist/chunks/{mcpServer-Py4Iz9Hx.js → mcpServer-DS0yRfcu.js} +1 -1
- package/dist/chunks/memory-Cz_JaFLF.js +1 -0
- package/dist/chunks/{mode-CqGusjoT.js → mode-Kx0kSZkr.js} +1 -1
- package/dist/chunks/model-Bwvn_acH.js +1 -0
- package/dist/chunks/{model-BBULcn7y.js → model-CNXtfiLg.js} +1 -1
- package/dist/chunks/{onChangeAppState-BkRihYau.js → onChangeAppState-C4ic-Mib.js} +1 -1
- package/dist/chunks/{openai-yNI_zoao.js → openai-CGGSfpPh.js} +3 -3
- package/dist/chunks/{overageCreditGrant-Cbh0_fbM.js → overageCreditGrant-BqW_6R5v.js} +1 -1
- package/dist/chunks/{panelCall-t10Sud9A.js → panelCall-DgPjuhQf.js} +1 -1
- package/dist/chunks/{passes-D_iS6DaC.js → passes-sYE91Vtr.js} +1 -1
- package/dist/chunks/{paths-Ci1iwL5Y.js → paths-DO4WOQtD.js} +2 -2
- package/dist/chunks/{permissions-CHvu4-yX.js → permissions-BPerbf1I.js} +3 -3
- package/dist/chunks/{pipeTransport-EAYXsubu.js → pipeTransport-CW9zF_UN.js} +1 -1
- package/dist/chunks/{plan-CP5nq_EB.js → plan-CDKBVRw6.js} +1 -1
- package/dist/chunks/{plugin-8apy_RBT.js → plugin-C6US4b8W.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-ClrgF5b3.js → pluginAutoupdate-BQKtcAhC.js} +1 -1
- package/dist/chunks/{pluginBlocklist-B1LVo0j_.js → pluginBlocklist-B8DKXi0i.js} +1 -1
- package/dist/chunks/{pluginCliCommands-eqyMBWcP.js → pluginCliCommands-DWCeXYTl.js} +1 -1
- package/dist/chunks/{pluginFlagging-BiTDVP10.js → pluginFlagging-DFMlWw2P.js} +1 -1
- package/dist/chunks/{pluginOperations-gZ-iCmhu.js → pluginOperations-CKmwDC3G.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DCDWHam6.js → pluginStartupCheck-D6IbyWKe.js} +1 -1
- package/dist/chunks/pluginStartupCheck-cYnLsWOs.js +1 -0
- package/dist/chunks/{plugins-BAIVqfi8.js → plugins-BwZIRMh_.js} +1 -1
- package/dist/chunks/policyLimits-CFLBtFh3.js +1 -0
- package/dist/chunks/{pollConfig-_2W7bHoW.js → pollConfig-C3NjXYFc.js} +1 -1
- package/dist/chunks/{poor-Dii0mpOW.js → poor-BHhbua95.js} +1 -1
- package/dist/chunks/poorMode-CCK7Ek5w.js +1 -0
- package/dist/chunks/{poorMode-aDmmvJ_e.js → poorMode-mtlnXU-z.js} +1 -1
- package/dist/chunks/{print-BwSmcUQu.js → print-kxnXkqGc.js} +12 -12
- package/dist/chunks/{privacy-settings-DaAgSLKw.js → privacy-settings-DjY1annR.js} +1 -1
- package/dist/chunks/{processBashCommand-BZ1_JKu4.js → processBashCommand-BrqLqSva.js} +1 -1
- package/dist/chunks/processSlashCommand-DJGdVGbK.js +6 -0
- package/dist/chunks/prompt-BZjXpviP.js +1 -0
- package/dist/chunks/{prompt-6ZKyqv6z.js → prompt-CfM_xGPc.js} +1 -1
- package/dist/chunks/prompt-CusKF4-p.js +1 -0
- package/dist/chunks/{promptEditor-Dz41P-3I.js → promptEditor-FI_ewCpV.js} +2 -2
- package/dist/chunks/{protocolHandler-CHGHjfdf.js → protocolHandler-B7ybKpgJ.js} +1 -1
- package/dist/chunks/{rate-limit-options-BlU9av7g.js → rate-limit-options-DPJMNNou.js} +1 -1
- package/dist/chunks/{rcDebugLog-C42A0pX1.js → rcDebugLog-CwU_wJBE.js} +1 -1
- package/dist/chunks/{referral-IIcY3jkp.js → referral-Da4mpbd3.js} +1 -1
- package/dist/chunks/{refresh-DTGEx7X_.js → refresh-B6X4xb9r.js} +1 -1
- package/dist/chunks/{registerProtocol-BkNncGMI.js → registerProtocol-D8fFnceq.js} +1 -1
- package/dist/chunks/registry-y_z3pTg3.js +1 -0
- package/dist/chunks/{release-notes-BxzOD-zP.js → release-notes--tnd4K56.js} +1 -1
- package/dist/chunks/{releaseNotes-C8KQGZHq.js → releaseNotes-BPA229-J.js} +2 -2
- package/dist/chunks/{reload-plugins-gYyC6_g8.js → reload-plugins-yQ7tEUVh.js} +1 -1
- package/dist/chunks/{remote-env-CEJH5aJh.js → remote-env-CER5UxTX.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-Dte7ZUAN.js → remoteBridgeCore-Bi31i8gt.js} +1 -1
- package/dist/chunks/{remoteControlServer-GN-eDbEz.js → remoteControlServer-oUAcWB4i.js} +1 -1
- package/dist/chunks/{rename-BEU6BNRp.js → rename-BTngRRZU.js} +1 -1
- package/dist/chunks/{resume-D36S2rXg.js → resume-DZHKfBmm.js} +2 -2
- package/dist/chunks/{runtimeObserver-CDMCeww2.js → runtimeObserver-B4KekIF0.js} +1 -1
- package/dist/chunks/{runtimeObserver-DaKaKNVW.js → runtimeObserver-BUOcYxiK.js} +2 -2
- package/dist/chunks/sandbox-adapter-C--j-c76.js +1 -0
- package/dist/chunks/{sandbox-toggle-BPO26t48.js → sandbox-toggle-DLBL7myN.js} +1 -1
- package/dist/chunks/searchExtraTools-CBYp5XeI.js +1 -0
- package/dist/chunks/{sentry-9EbPa1Xu.js → sentry-B7ZBc8fA.js} +1 -1
- package/dist/chunks/{session-D18B22u4.js → session-DWYQk9YN.js} +1 -1
- package/dist/chunks/{sessionDiscovery-B-OTvXJf.js → sessionDiscovery-BP0nv36F.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-DVilA3Mm.js +1 -0
- package/dist/chunks/sessionMemory-cMgcTxtP.js +1 -0
- package/dist/chunks/{sessionMemory-Ctauybzs.js → sessionMemory-pT4lc1C-.js} +1 -1
- package/dist/chunks/sessionMemoryUtils-BgYf2OvX.js +1 -0
- package/dist/chunks/sessionObserver-CzyEF7mg.js +1 -0
- package/dist/chunks/{sessionObserver-ardnTJ37.js → sessionObserver-D4SV0Ar3.js} +1 -1
- package/dist/chunks/sessionStorage-CXBgVAx-.js +1 -0
- package/dist/chunks/{sessionTitle-DEKvIVCK.js → sessionTitle-CkrnWEW1.js} +1 -1
- package/dist/chunks/{sessionTracing-CJUUEWZ4.js → sessionTracing-Caw-kvQr.js} +1 -1
- package/dist/chunks/{settingsSync-BWt3oUR7.js → settingsSync-Dn_lGonC.js} +1 -1
- package/dist/chunks/{setup-CDxkPTCq.js → setup-DGkOT4DX.js} +2 -2
- package/dist/chunks/{setup-BECFDOT9.js → setup-Dihjl7jo.js} +1 -1
- package/dist/chunks/{setup-CmCTB2T_.js → setup-II1titXI.js} +1 -1
- package/dist/chunks/{shadowedRuleDetection-BbALfdxE.js → shadowedRuleDetection-DASW3j9H.js} +1 -1
- package/dist/chunks/{sideQuestion-BHK6dd1q.js → sideQuestion-C1qbLTAL.js} +1 -1
- package/dist/chunks/sink-BSPyC453.js +1 -0
- package/dist/chunks/{sink-Do5fWbUC.js → sink-CqOAfFlL.js} +1 -1
- package/dist/chunks/{sinks-Dc9V7k6a.js → sinks-BT_lBY6T.js} +2 -2
- package/dist/chunks/sinks-CpuRIC3H.js +1 -0
- package/dist/chunks/{skill-learning-BHW9G3Dn.js → skill-learning-kh0HKn6u.js} +1 -1
- package/dist/chunks/skillChangeDetector-DQuNepIV.js +1 -0
- package/dist/chunks/{skillGapStore-Wa7s6orv.js → skillGapStore-B1gUQXhE.js} +2 -2
- package/dist/chunks/{skillGapStore-DVMbI2yy.js → skillGapStore-CFmLJlYm.js} +1 -1
- package/dist/chunks/{skillGenerator-CBuoIFsH.js → skillGenerator-DIAwRpPg.js} +2 -2
- package/dist/chunks/skillLearning-Bxu1Uzl-.js +1 -0
- package/dist/chunks/skillLearning-CxAbHYEk.js +1 -0
- package/dist/chunks/{skillPanel-2w82nkOl.js → skillPanel-B9zJLHKV.js} +3 -3
- package/dist/chunks/{skillSearchPanel-7BhCBkdh.js → skillSearchPanel-C1O9sxYS.js} +2 -2
- package/dist/chunks/{skills-D5rMEo2w.js → skills-C6_3snFY.js} +1 -1
- package/dist/chunks/{sprites-uNWgVZT6.js → sprites-59l7vF4l.js} +1 -1
- package/dist/chunks/{stats-D0CJB2HV.js → stats-BmGdg4nj.js} +1 -1
- package/dist/chunks/{status-nte1Arzy.js → status-KLPT7uYP.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-Lqf99003.js → statusNoticeHelpers-DuqyBY-N.js} +1 -1
- package/dist/chunks/{tag-BnvWS9HE.js → tag-0vahEnrx.js} +1 -1
- package/dist/chunks/{tasks-CEs-pxkC.js → tasks-zVPemGv7.js} +1 -1
- package/dist/chunks/teamHelpers-B83RwCCC.js +1 -0
- package/dist/chunks/{teamHelpers-D8R_gGLb.js → teamHelpers-CXAmvFco.js} +1 -1
- package/dist/chunks/teammateModeSnapshot-AdUFmPGC.js +1 -0
- package/dist/chunks/{teammateModeSnapshot-Bdra3VIJ.js → teammateModeSnapshot-CdiglTzv.js} +1 -1
- package/dist/chunks/teleport-D6PvdjPy.js +1 -0
- package/dist/chunks/{templateJobs-BDKGtmr3.js → templateJobs-Ox5ZTKjW.js} +1 -1
- package/dist/chunks/{terminalSetup-Bbvq-9Xl.js → terminalSetup-Dh70ynBX.js} +1 -1
- package/dist/chunks/{terminalSetup-C1X-sXwp.js → terminalSetup-hLCi-2uB.js} +1 -1
- package/dist/chunks/{theme-DXv6bV7f.js → theme-DxgUVq9C.js} +1 -1
- package/dist/chunks/thinkback-C5vFU8dM.js +1 -0
- package/dist/chunks/{thinkback-CMsW7mvG.js → thinkback-DWgU7Qhr.js} +1 -1
- package/dist/chunks/{thinkback-play-CFdkpzlj.js → thinkback-play-CDzY6Ux4.js} +1 -1
- package/dist/chunks/{toolEventObserver-CF7T7FBH.js → toolEventObserver-DPoMAJwr.js} +1 -1
- package/dist/chunks/{toolEventObserver-DDJV8cvW.js → toolEventObserver-jO6-mlFU.js} +1 -1
- package/dist/chunks/toolPool-BmA-BnAq.js +1 -0
- package/dist/chunks/{toolPool-BJv0sBnR.js → toolPool-Dgn1Clq8.js} +1 -1
- package/dist/chunks/{trustedDevice-C9nJhhyZ.js → trustedDevice-CYR5AgSB.js} +1 -1
- package/dist/chunks/{trustedDevice-C5s2au0k.js → trustedDevice-D35gYkBT.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-BEv1_AS1.js → ultrareviewCommand-o4GjzoXK.js} +2 -2
- package/dist/chunks/{undercover-DPVt2WN7.js → undercover-B4xr62Ux.js} +1 -1
- package/dist/chunks/undercover-nakrQDLh.js +1 -0
- package/dist/chunks/{updateCCB-D-4naIUu.js → updateCCB-Cthn50OV.js} +1 -1
- package/dist/chunks/{upgrade-CSld83v7.js → upgrade-D4Id4ebd.js} +1 -1
- package/dist/chunks/upgrade-DJTCV8sr.js +1 -0
- package/dist/chunks/{upload-DVlE8SRp.js → upload-BFDXvdfb.js} +1 -1
- package/dist/chunks/{usage-D4Ubnttz.js → usage-Csbso5mD.js} +1 -1
- package/dist/chunks/{usage-B_bY46ep.js → usage-DxudeFLL.js} +1 -1
- package/dist/chunks/{useMainLoopModel-D3tJJC3y.js → useMainLoopModel-CEqP4HOc.js} +1 -1
- package/dist/chunks/{useManagePlugins-B4kcqcyY.js → useManagePlugins-BmS3Adja.js} +1 -1
- package/dist/chunks/{useMergedTools-CTQl4cdV.js → useMergedTools-wR6Bglqq.js} +1 -1
- package/dist/chunks/{useSearchInput-JPayBRPC.js → useSearchInput-BhKAGgEN.js} +1 -1
- package/dist/chunks/{useSettingsErrors-YTgPxnRZ.js → useSettingsErrors-CjK3P-Ki.js} +1 -1
- package/dist/chunks/{useVoice-CaBv3G13.js → useVoice-DP1hHBWA.js} +1 -1
- package/dist/chunks/{util-Q70qdjeS.js → util-CMSErQoz.js} +1 -1
- package/dist/chunks/utils-CAQfwbv8.js +1 -0
- package/dist/chunks/{validatePlugin-6lg9B564.js → validatePlugin-_g0AqWZG.js} +1 -1
- package/dist/chunks/{vim-zOsQBIp4.js → vim-8y-2Q09k.js} +1 -1
- package/dist/chunks/{voice-DBQevAhk.js → voice-BJAsr0K-.js} +1 -1
- package/dist/chunks/{voiceModeEnabled-CjBjjeNR.js → voiceModeEnabled-BD9GZhQ3.js} +1 -1
- package/dist/chunks/voiceModeEnabled-DZbxaFIg.js +1 -0
- package/dist/chunks/{voiceStreamSTT-B8CTbb_6.js → voiceStreamSTT-B1T-8adN.js} +1 -1
- package/dist/chunks/voiceStreamSTT-B39XaGOU.js +1 -0
- package/dist/chunks/{web-tools-CGqBqo07.js → web-tools-DVIvcP41.js} +1 -1
- package/dist/chunks/{workerRegistry-Bx6FvTZF.js → workerRegistry-60_UCyc3.js} +1 -1
- package/dist/chunks/worktree-DNK8NprA.js +1 -0
- package/dist/chunks/{xml-CVF7dWfi.js → xml-CTdKuU6f.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-Cc5SaLqs.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-OkUSMj0I.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-BbPaorIs.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-Dyv4mI_o.js +0 -1
- package/dist/chunks/Doctor-CRrE5Sf4.js +0 -1
- package/dist/chunks/Grove-CgX5Fdeh.js +0 -1
- package/dist/chunks/MessageSelector-CEvbAZGv.js +0 -3
- package/dist/chunks/PluginSettings-D3bQRsge.js +0 -17
- package/dist/chunks/QueryEngine-CMcQGyql.js +0 -1
- package/dist/chunks/REPL-C9f3ToGu.js +0 -1
- package/dist/chunks/ResumeConversation-DxqbAKA4.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BVAhywUI.js +0 -1
- package/dist/chunks/SentryErrorBoundary-M1ipwe1n.js +0 -1
- package/dist/chunks/Settings-D5EWYL40.js +0 -2
- package/dist/chunks/api-BdbBnz5c.js +0 -1
- package/dist/chunks/assistant-BMviqf0l.js +0 -1
- package/dist/chunks/auth-ORBmEqnH.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BAvSPaZ5.js +0 -1
- package/dist/chunks/bridgeConfig-B49H_B9L.js +0 -1
- package/dist/chunks/bridgeEnabled-DsG2JvIr.js +0 -1
- package/dist/chunks/bridgeMain-DYCShrcV.js +0 -1
- package/dist/chunks/caches-BsYvQnWV.js +0 -1
- package/dist/chunks/changeDetector-By54zja0.js +0 -1
- package/dist/chunks/channelNotification-Cx82K1CD.js +0 -1
- package/dist/chunks/clear-BQr2zTyP.js +0 -1
- package/dist/chunks/client-BbavFXJZ.js +0 -1
- package/dist/chunks/color-DOsgZO2n.js +0 -1
- package/dist/chunks/commands-CfwfGt3T.js +0 -1
- package/dist/chunks/commitAttribution-CH9C_hoL.js +0 -1
- package/dist/chunks/context-noninteractive-DCYvLxWx.js +0 -1
- package/dist/chunks/conversation-DYUVAAQt.js +0 -1
- package/dist/chunks/conversation-NrAy2em3.js +0 -1
- package/dist/chunks/createSession-Czx7_nf6.js +0 -1
- package/dist/chunks/cron-g_P3I5uT.js +0 -1
- package/dist/chunks/datadog-QSR9B7CZ.js +0 -1
- package/dist/chunks/envLessBridgeConfig-DSJqg3Ox.js +0 -1
- package/dist/chunks/extra-usage-DaxUQk9I.js +0 -1
- package/dist/chunks/extractMemories-B3cTWsph.js +0 -1
- package/dist/chunks/fast-CHiQGMBE.js +0 -1
- package/dist/chunks/gates-DvjyKZVA.js +0 -1
- package/dist/chunks/hooks-DOej0jqp.js +0 -1
- package/dist/chunks/inboundAttachments-BBYxcnvj.js +0 -1
- package/dist/chunks/initReplBridge-Dt2aQBia.js +0 -1
- package/dist/chunks/language-BoKr5ylY.js +0 -1
- package/dist/chunks/loadAgentsDir-whRB0phu.js +0 -1
- package/dist/chunks/loadPluginHooks-CYZjzxyO.js +0 -1
- package/dist/chunks/localSearch-DAwFmV2Y.js +0 -1
- package/dist/chunks/login-DOyB64Rv.js +0 -1
- package/dist/chunks/logout-DTPo3Myl.js +0 -1
- package/dist/chunks/mcp-CVnFM6nR.js +0 -6
- package/dist/chunks/mcp-CzfQB8BT.js +0 -1
- package/dist/chunks/memory-BdUqEKio.js +0 -1
- package/dist/chunks/model-BOc_-7m0.js +0 -1
- package/dist/chunks/pluginStartupCheck-EjLvCXru.js +0 -1
- package/dist/chunks/policyLimits-Cdp3QwZ1.js +0 -1
- package/dist/chunks/poorMode-DzEL0cu0.js +0 -1
- package/dist/chunks/processSlashCommand-v1Rvzxwn.js +0 -6
- package/dist/chunks/prompt-DPqKtC0b.js +0 -1
- package/dist/chunks/prompt-WjMHPk90.js +0 -1
- package/dist/chunks/registry-CBqb7wbi.js +0 -1
- package/dist/chunks/sandbox-adapter-DqTuhgud.js +0 -1
- package/dist/chunks/searchExtraTools-Brae4wmG.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-BXsK8Dwf.js +0 -1
- package/dist/chunks/sessionMemory-Bv-AYifm.js +0 -1
- package/dist/chunks/sessionMemoryUtils-D-bzdsAT.js +0 -1
- package/dist/chunks/sessionObserver-j8D9hidw.js +0 -1
- package/dist/chunks/sessionStorage-Cw5ibYWA.js +0 -1
- package/dist/chunks/sink-DFWgcGHX.js +0 -1
- package/dist/chunks/sinks-BnkxTOU9.js +0 -1
- package/dist/chunks/skillChangeDetector-DwAvG835.js +0 -1
- package/dist/chunks/skillLearning-BI2YDG3K.js +0 -1
- package/dist/chunks/skillLearning-BZMJRJPp.js +0 -1
- package/dist/chunks/teamHelpers-D4vCj2hP.js +0 -1
- package/dist/chunks/teammateModeSnapshot-BDJ1JTcl.js +0 -1
- package/dist/chunks/teleport-RxTr4aCi.js +0 -1
- package/dist/chunks/thinkback-DRJBz3Is.js +0 -1
- package/dist/chunks/toolPool-0zCdXfEu.js +0 -1
- package/dist/chunks/undercover-DYa00dVv.js +0 -1
- package/dist/chunks/upgrade-BHj8ALep.js +0 -1
- package/dist/chunks/utils-Cr-x1Oyd.js +0 -1
- package/dist/chunks/voiceModeEnabled-DK6u8Aaj.js +0 -1
- package/dist/chunks/voiceStreamSTT-CCkOfmdI.js +0 -1
- package/dist/chunks/worktree-DPpgPLLG.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,Et as oe,Fa as T,Ki as se,Ma as E,Na as ce,Ot as D,Pr as O,Qo as le,Rr as ue,S as de,Si as fe,Xn as pe,Xo as me,Yn as k,_ as he,a as ge,bl as _e,c as ve,cl as ye,hl as A,kt as be,ll as xe,ml as Se,no as Ce,on as j,oo as we,pi as Te,qi as Ee,rs as De,to as Oe,us as M,vi as ke,xi as N,xl as Ae,yi as je,zo as Me}from"./paths-
|
|
1
|
+
import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,Et as oe,Fa as T,Ki as se,Ma as E,Na as ce,Ot as D,Pr as O,Qo as le,Rr as ue,S as de,Si as fe,Xn as pe,Xo as me,Yn as k,_ as he,a as ge,bl as _e,c as ve,cl as ye,hl as A,kt as be,ll as xe,ml as Se,no as Ce,on as j,oo as we,pi as Te,qi as Ee,rs as De,to as Oe,us as M,vi as ke,xi as N,xl as Ae,yi as je,zo as Me}from"./paths-DO4WOQtD.js";import{D as Ne,E as Pe,J as Fe,O as P,Q as Ie,U as Le,Z as Re,_ as ze,h as Be,l as F,p as I,u as L,z as R}from"./debug-otxXY3j-.js";import{n as Ve,r as z}from"./analytics-DqMQntaB.js";import{n as He,t as Ue}from"./cwd--iizewsn.js";import{i as We,n as B,o as V}from"./process-DMKLUQIO.js";import{F as Ge,I as Ke,P as H}from"./git-C0IuvuIy.js";import{J as qe,K as Je,c as Ye,et as U,i as Xe,o as Ze,s as W}from"./log-DSV4Ht5l.js";import{i as Qe,n as $e}from"./path-BE28AJwZ.js";import{s as et,u as tt}from"./types-KeqFPzY5.js";import{C as nt,c as rt,d as it,l as at,m as ot,s as st,x as G}from"./teammate-CbskW5G9.js";import{n as ct,t as lt}from"./sleep-C6koP5Ka.js";import{$C as ut,$D as dt,$T as ft,$v as pt,Ay as mt,BA as ht,Bc as gt,Bf as _t,CD as vt,CE as K,Cc as yt,Cg as bt,Cn as xt,D as St,DD as Ct,DO as wt,Dc as Tt,Dg as Et,Dj as Dt,Dn as Ot,ED as kt,Ec as At,Eg as jt,Ey as Mt,F as Nt,FA as Pt,Fb as Ft,Fr as It,Fw as Lt,G as Rt,GO as zt,Gi as Bt,Gt as Vt,Gv as Ht,Hc as Ut,Hs as Wt,Hw as Gt,IC as Kt,IE as qt,Ij as Jt,Iw as Yt,Ji as Xt,Ju as Zt,Jv as Qt,Jx as $t,K as en,KE as tn,KO as nn,Ka as rn,Kw as an,Kx as on,LE as sn,LO as cn,Ll as ln,MA as un,Mi as dn,Ni as fn,Nr as pn,O as mn,OD as hn,Oj as gn,On as _n,Ow as vn,Pr as yn,QO as bn,Qs as xn,Qv as Sn,Qx as Cn,RC as wn,RE as Tn,RO as En,Rj as Dn,Rl as On,Rw as kn,S as An,SD as jn,SE as Mn,Sc as Nn,Sy as Pn,TE as Fn,Tc as In,Tj as Ln,Tw as Rn,Ty as zn,Uo as Bn,Us as Vn,Vc as Hn,Vw as Un,WA as Wn,WO as Gn,Wa as Kn,XE as qn,Xb as Jn,YE as Yn,YO as Xn,Yb as Zn,Ys as Qn,Yv as $n,Yx as er,Zi as tr,Zu as nr,_i as rr,_p as ir,ak as ar,bc as or,bi as sr,bs as cr,cE as lr,cO as ur,cb as dr,cu as fr,dO as pr,ds as mr,du as hr,dv as gr,eE as _r,eO as vr,ew as yr,ey as br,fO as xr,fs as Sr,gD as Cr,gO as wr,gi as Tr,gj as Er,gp as Dr,hD as Or,hE as kr,hO as Ar,ha as jr,hg as Mr,hw as Nr,iD as Pr,iS as Fr,ii as Ir,ik as Lr,jj as Rr,jy as zr,lO as Br,lr as Vr,lu as Hr,mC as Ur,mO as Wr,mr as Gr,ms as Kr,nD as qr,na as Jr,nw as Yr,o as Xr,oO as q,p as Zr,pC as Qr,pE as $r,pO as ei,qE as ti,qs as ni,qu as ri,rS as ii,s as ai,sO as oi,sb as si,tS as ci,ty as li,u as ui,uO as di,uv as fi,vE as pi,vO as mi,vc as hi,vs as gi,w as _i,wD as vi,wE as yi,wO as bi,wc as xi,wi as Si,wy as Ci,x as wi,xc as Ti,xi as Ei,yE as Di,yO as Oi,yc as ki,yo as Ai,zC as ji,zE as Mi,zO as J,zb as Ni,zc as Pi,zf as Fi}from"./loadAgentsDir-ClTeo0nk.js";import{$n as Ii,$t as Li,F as Ri,Gt as zi,M as Bi,Mn as Vi,Ot as Hi,Qn as Ui,Wt as Wi,kt as Gi,wn as Ki}from"./prompt-CfM_xGPc.js";import{i as qi,o as Ji}from"./xml-CTdKuU6f.js";import{a as Yi,o as Xi,s as Zi}from"./fileStateCache-BhVfo23e.js";import{A as Qi,C as $i,D as ea,N as ta,O as na,P as ra,Z as ia,_ as aa,d as oa,g as sa,h as ca,m as la,u as ua,v as da,y as fa}from"./rcDebugLog-CwU_wJBE.js";import{c as pa,l as ma}from"./commitAttribution-csu3NO7Y.js";import{P as ha,V as ga,a as _a,d as va}from"./teamHelpers-CXAmvFco.js";import{t as ya}from"./pollConfig-C3NjXYFc.js";import{r as ba}from"./inboundAttachments-D4tBPCB8.js";import{i as xa,n as Sa,s as Ca}from"./mappers-7BSMbYvH.js";import{n as wa,r as Ta}from"./sessionTitle-CkrnWEW1.js";import{n as Ea,t as Da}from"./ccrClient-C1msT1E3.js";import{n as Oa,t as ka}from"./HybridTransport-Bok4-Ptt.js";import{n as Aa,t as ja}from"./SSETransport-kEH_p4Yq.js";import{t as Ma}from"./pluginBlocklist-B8DKXi0i.js";import{c as Na,d as Pa,f as Fa,l as Ia,o as La,r as Ra,s as za,u as Ba}from"./channelNotification-CWlu9ZWs.js";import{t as Va}from"./onChangeAppState-C4ic-Mib.js";import{t as Ha}from"./settingsSync-Dn_lGonC.js";import{a as Ua,c as Wa,d as Ga,f as Ka,l as qa,m as Ja,o as Ya,p as Xa,r as Za,t as Qa}from"./cronJitterConfig-9OmmYmIT.js";import{i as $a,n as eo}from"./toolPool-Dgn1Clq8.js";import{n as to,r as no}from"./QueryEngine-C7r7O-hH.js";import{n as ro,r as io}from"./sideQuestion-C1qbLTAL.js";import{n as ao,r as oo}from"./context-noninteractive-62P5EnN5.js";import{a as so,o as co,t as lo}from"./skillChangeDetector-DQuNepIV.js";import{n as uo,t as fo}from"./refresh-B6X4xb9r.js";import{dirname as po,join as mo}from"path";import{PassThrough as ho}from"stream";import{randomUUID as Y}from"crypto";import{readFile as go,stat as _o}from"fs/promises";import{URL as vo}from"url";import{cwd as X}from"process";a(),_(),He(),Re(),Le(),Pe(),ze(),B(),F(),H(),U(),Ze(),Qe(),et(),G(),M(),we(),T(),E(),Ee(),O(),k(),lt(),j(),at(),de(),ge(),Ui(),Vi(),ht(),Pt(),nn(),di(),vr(),Cr(),ta(),ti(),ha(),yi(),lr(),na(),fi(),oa(),Hn(),gt(),Sr(),Bn(),Jr(),It(),_n(),xt(),Ha(),r(),Aa();function yo(e,t={},n,r){if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let i=new vo(e.href);return i.protocol===`wss:`?i.protocol=`https:`:i.protocol===`ws:`&&(i.protocol=`http:`),i.pathname=i.pathname.replace(/\/$/,``)+`/worker/events/stream`,new ja(i,t,n,r)}if(e.protocol===`ws:`||e.protocol===`wss:`)return i(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ka(e,t,n,r):new Oa(e,t,n,r);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Aa();var bo=class extends Ga{constructor(e,t,n){let r=new ho({encoding:`utf8`});super(r,n),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=r,this.url=new vo(e);let a={},s=ea();s?a.Authorization=`Bearer ${s}`:I(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;if(c&&(a[`x-environment-runner-version`]=c),this.transport=yo(this.url,a,u(),()=>{let e={},t=ea();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e}),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=L(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&V(e.endsWith(`
|
|
2
2
|
`)?e:e+`
|
|
3
|
-
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),i(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof ja))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Da(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{Ge(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Ea?e.reason:`unknown`}),W(Error(`CCRClient initialization failed: ${R(e)}`)),
|
|
3
|
+
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),i(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof ja))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Da(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{Ge(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Ea?e.reason:`unknown`}),W(Error(`CCRClient initialization failed: ${R(e)}`)),Mn(1,`other`)}),Ie(async()=>this.ccrClient?.close()),fn((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),dn(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};xr((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),da((e,t)=>{this.ccrClient?.reportState(e,t)}),aa(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let l=ya().session_keepalive_interval_v2_ms;if(this.isBridge&&l>0&&(this.keepAliveTimer=setInterval(()=>{I(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{I(`[remote-io] keep_alive write failed: ${R(e)}`)})},l),this.keepAliveTimer.unref?.()),Ie(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
|
|
4
4
|
`)})()}}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)&&V(Ka(e)+`
|
|
5
5
|
`)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};Ki(),Me(),Li(),zi(),[...Wi],Re(),F();var xo=`[stdout-guard]`,So=!1,Z=``,Co=null;function wo(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function To(){So||(So=!0,Co=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`);Z+=r;let i,a=!0;for(;(i=Z.indexOf(`
|
|
6
6
|
`))!==-1;){let e=Z.slice(0,i);Z=Z.slice(i+1),wo(e)?a=Co(e+`
|
|
7
7
|
`):(process.stderr.write(`${xo} ${e}\n`),I(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},Ie(async()=>{Z.length>0&&(Co&&wo(Z)?Co(Z+`
|
|
8
|
-
`):process.stderr.write(`${xo} ${Z}\n`),Z=``),Co&&(process.stdout.write=Co,Co=null),So=!1}))}ye(),le(),
|
|
8
|
+
`):process.stderr.write(`${xo} ${Z}\n`),Z=``),Co&&(process.stdout.write=Co,Co=null),So=!1}))}ye(),le(),Jt(),Ln(),qi(),Gi(),Xi(),ra(),Ct(),Pr(),Un(),vn(),zr(),Sn(),Qt(),nr(),In(),ni(),gi(),en(),Xr(),Ba(),Na(),eo(),Ht(),Le(),Ze(),na(),Pn(),F(),yi();function Eo(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&&(I(`Exiting after ${n}ms of idle time`),K())},n))},stop(){i&&(clearTimeout(i),i=null)}}}_e(),Se(),ke(),Lr(),jn(),sn(),_r(),Ur(),Zn(),Ni(),On(),Kn(),_i(),Ta(),ro();function Do(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(gr(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:Y(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}s(),D(),bi(),wr(),ur(),ma(),pi(),ut(),Kt(),ci(),_t(),fr(),Sa(),oo(),F();async function Oo(){try{let e=await go(Nn(),`utf-8`),t=De().safeParse(Ne(e));return t.success?t.data:(I(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function ko(e){await hi(Nn(),P(e,null,2))}async function Ao(e,t){let n=Ti();if(!n)return;let r=await jo(t);r!==null&&await hi(mo(n,or(e)),r)}async function jo(e){let t=[mo(e,`.claude-plugin`,`marketplace.json`),mo(e,`marketplace.json`),e];for(let e of t)try{return await go(e,`utf-8`)}catch{}return null}async function Mo(){let e=await Qn();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await Ao(t,n.installLocation)}catch(e){I(`Failed to save marketplace JSON for ${t}: ${e}`)}await ko({...await Oo(),...e})}Ve(),Re(),F(),H(),Ze(),ni(),In();async function No(){let e=Tt();I(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await xn();t&&(Wt(),Kr(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Be().mkdir(yt()),await Be().mkdir(xi()));let n=Object.keys(Vn()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)I(`installPluginsForHeadless: no marketplaces declared`);else{let t=await Ke(`headless_marketplace_reconcile`,()=>Wa({skip:e?(e,t)=>!At(t):void 0,onProgress:e=>{e.type===`installed`?I(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&I(`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&&I(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(Wt(),Kr(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Mo();let t=await Ma();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&Kr(`headlessPluginInstall: plugins changed`),e&&Ie(ki),i}catch(e){return W(e),!1}finally{z(`tengu_headless_plugin_install`,r)}}Ve(),F(),H(),di(),oa(),Ze(),B(),fi(),yi(),Re(),He(),_(),It(),Bn(),Pe(),r(),fo(),gi(),Mr(),_a(),qn(),si(),Dr(),Le();var Q=(Mi(),e(Tn)),$=(fa(),e($i)),Po=(Ya(),e(Ua)),Fo=(Za(),e(Qa)),Io=(Bi(),e(Ri)),Lo=`<system-reminder>
|
|
9
9
|
You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
|
|
10
10
|
|
|
11
11
|
You MUST shut down your team before preparing your final response:
|
|
@@ -18,22 +18,22 @@ The user cannot receive your response until the team is completely shut down.
|
|
|
18
18
|
</system-reminder>
|
|
19
19
|
|
|
20
20
|
Shut down your team and prepare your final response for the user.`,Ro=1e4,zo=new Set,Bo=[];function Vo(e){if(zo.has(e))return!1;if(zo.add(e),Bo.push(e),Bo.length>Ro){let e=Bo.splice(0,Bo.length-Ro);for(let t of e)zo.delete(t)}return!0}function Ho(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Uo(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
|
|
21
|
-
`):e.flatMap(Ho)}function Wo(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Go(e,t,n,r,a,o,s,c){if(process.env.USER_TYPE===`ant`&&i(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),
|
|
21
|
+
`):e.flatMap(Ho)}function Wo(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Go(e,t,n,r,a,o,s,c){if(process.env.USER_TYPE===`ant`&&i(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),Wn.subscribe(e=>{Qr(e,n),N()&&n(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),$&&!$.isProactiveActive()&&i(process.env.CLAUDE_CODE_PROACTIVE)&&$.activateProactive(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),oi(),q(`runHeadless_entry`),await Di()&&await kr(),q(`after_grove_check`),re(),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
22
22
|
`),K(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
|
|
23
23
|
`),K(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
|
|
24
|
-
`),K(1);return}let l=rs(e,c);c.outputFormat===`stream-json`&&To();let d=
|
|
24
|
+
`),K(1);return}let l=rs(e,c);c.outputFormat===`stream-json`&&To();let d=un.getSandboxUnavailableReason();if(d){if(un.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${d}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),K(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${d}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(un.isSandboxingEnabled())try{await un.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${R(e)}\n`),K(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&Ut(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:Y(),session_id:u()};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:Y(),session_id:u()};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:Y(),session_id:u()}}})();l.write(t)}),c.setupTrigger&&await br(c.setupTrigger),q(`before_loadInitialMessages`);let f=t(),{messages:p,turnInterruptionState:m,agentSetting:h}=await ns(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}),g=li();if(g&&l.prependUserMessage(g),!c.agent&&!x()&&h){let{agentDefinition:e}=so(h,void 0,{activeAgents:s,allAgents:s});if(e){if(n(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!ai(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}sr(e.agentType)}}if(p.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){let e=p.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`),K(1);return}let r=t(),i=await Xo(c.rewindFiles,r,n,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),K(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),K(0);return}let ee=typeof c.resume==`string`&&(!!gr(c.resume)||c.resume.endsWith(`.jsonl`)),_=!!c.sdkUrl;if(!e&&!ee&&!_){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
|
|
25
25
|
`),K(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
26
|
-
`),K(1);return}let te=
|
|
26
|
+
`),K(1);return}let te=Zt(f.mcp.tools,f.toolPermissionContext),v=[...a,...te],y=Jo(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{n(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),ca(`requires_action`,e)});c.permissionPromptToolName&&(v=v.filter(e=>!Ii(e,c.permissionPromptToolName))),We(),q(`after_loadInitialMessages`),await C(),q(`after_modelStrings`);let b=c.outputFormat===`json`&&c.verbose,S=[],w;q(`before_runHeadlessStreaming`);for await(let e of Ko(l,f.mcp.clients,[...r,...f.mcp.commands],v,p,y,o,t,n,s,c,m))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`&&(b&&S.push(e),w=e);switch(c.outputFormat){case`json`:if(!w||w.type!==`result`)throw Error(`No messages returned`);if(c.verbose){V(P(S)+`
|
|
27
27
|
`);break}V(P(w)+`
|
|
28
28
|
`);break;case`stream-json`:break;default:if(!w||w.type!==`result`)throw Error(`No messages returned`);switch(w.subtype){case`success`:V(w.result.endsWith(`
|
|
29
29
|
`)?w.result:w.result+`
|
|
30
30
|
`);break;case`error_during_execution`:V(`Execution error`);break;case`error_max_turns`:V(`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`:V(`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`:V(`Error: Failed to provide valid structured output after maximum retries.
|
|
31
|
-
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(zr(),ve())try{let{drainPendingExtraction:e}=await import(`./extractMemories-B3cTWsph.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,T=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),jn(0)}),Ie(async()=>{let t={};for(let e of Xn(g()))mi(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},le;v.enableAuthStatus&&(le=se.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let de=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};or.add(de);let k=s,ge=qr(s,X(),100),_e=Yi(100),ve=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&ve&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),J({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let ye=Vn().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=Tt(n),i=En(n),a=fe(e.value),o=pe(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:hn(n)?[...Er]:Er.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Se=v.userSpecifiedModel;function Ce(e,t){let n=Mi(e,ue(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let j=[],we=[],Te=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||Te.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{Ye(t,`Elicitation request received in print mode: ${P(n)}`);let i=n.params.mode===`url`?`url`:`form`;z(`tengu_mcp_elicitation_shown`,{mode:i});let a=await Cn(t,n.params,r.signal);if(a)return Ye(t,`Elicitation resolved by hook: ${P(a)}`),z(`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 Ni(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return z(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;Ye(t,`Elicitation completion notification: ${n}`),zt({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Te.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(h)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Fr(h,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,we=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(me(t)))),...we]}})),mn(j)}}De();let M={clients:[],tools:[],configs:{}},ke=e=>{let t=er(e.toolPermissionContext,e.mcp.tools),n=xe($a([...o,...we,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Ii(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Hi(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,je=0;function Me(){if(!N)return;let e=Math.min(je,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=k.length,t.length>0&&N.writeMessages(t)}let Ne=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Pe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await os(e,{configs:h,clients:j,tools:we},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),j=n.newSdkState.clients,we=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(me(t)))),...we]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Ne=Ne.then(t,t),Ne}function Le(){let e=g(),t=e.mcp.clients,n=xe([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...j.map(e=>e.name)]);return[...t,...j,...M.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`?In(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,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}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,capabilities:i}})}async function Re(){try{await Promise.all([Promise.resolve(),Ke(`headless_managed_settings_wait`,()=>ei())]),await No()&&await He()}catch(e){W(e)}}let ze=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?ze=Re():Re());let Be=Eo(()=>!x),F=a,L=te;async function Ve(){let{agentDefinitions:e}=await uo(_);F=await nr(X());let t=L.filter(e=>e.source===`flagSettings`);L=[...e.allAgents,...t]}async function He(){let{servers:e}=await qt(),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(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Pe(t);r&&De(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Rt(),nr(X()).then(e=>{F=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Ai({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await ti({commands:e});return}for(let t of e)J({...t,uuid:Y()});B()})().catch(e=>{W(e),I(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};bn(()=>{E&&Wn(`now`).length>0&&E.abort(`interrupt`)});let B=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Be.stop(),q(`run_entry`),await De(),q(`after_updateSdkMcp`),ze){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([ze,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),z(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await ze;ze=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-CYZjzxyO.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=rn(t);){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(;Wo(r,Zn(t));)i.push(rn(t));let a=await Wr(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(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(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...j,...M.clients];Ee(c);for(let e of c)$o(e);let l=ke(s);for(let e of o)pr(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`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.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:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&z(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&>(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=dt(),q(`before_ask`),hr();let h=r,ee=!1;try{if(await be(h.workload??v.workload,async()=>{for await(let t of to({commands:xe([...F,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Se,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>_e.size===0?ge:Zi(ge,_e),setReadFileCache:e=>{ge=e;for(let[e,t]of _e.entries()){let n=ge.get(e);(!n||t.timestamp>n.timestamp)&&ge.set(e,t)}_e.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.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:L,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Me(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);Xn(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&mi(e))?T=t:(T=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await Ar({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await Ar({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)J({...t,uuid:Y()})}}catch(e){throw await Ar({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)pr(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=on();if(!t)bi(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await Ot(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};T?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){bi(`aborted`,void 0,void 0,`sdk`);return}W(Fe(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}zr(),Hr(),li()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=Xn(g()).some(e=>mi(e)&&e.type!==`in_process_teammate`),n=Zn(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);T&&(D.enqueue(T),T=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.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:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[R(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Nn()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&Zn(t)===void 0&&!C){We();return}if(Zn(t)!==void 0){B();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){I(`[print.ts] No more active teammates, stopping poll`);break}let n=await wt(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await At(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=vt(e.text);if(n&&r){let e=n.from;I(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),I(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}J({mode:`prompt`,value:n.map(e=>`<${Je} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Je}>`).join(`
|
|
31
|
+
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(Br(),ve())try{let{drainPendingExtraction:e}=await import(`./extractMemories-BP8Opsbp.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,T=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),Mn(0)}),Ie(async()=>{let t={};for(let e of Yn(g()))dr(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},le;v.enableAuthStatus&&(le=se.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let de=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};ar.add(de);let k=s,ge=qr(s,X(),100),_e=Yi(100),ve=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&ve&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),J({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let ye=Fi().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=Dt(n),i=Dn(n),a=fe(e.value),o=pe(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:gn(n)?[...Er]:Er.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Se=v.userSpecifiedModel;function Ce(e,t){let n=Ai(e,ue(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let j=[],we=[],Te=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||Te.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{Ye(t,`Elicitation request received in print mode: ${P(n)}`);let i=n.params.mode===`url`?`url`:`form`;z(`tengu_mcp_elicitation_shown`,{mode:i});let a=await wn(t,n.params,r.signal);if(a)return Ye(t,`Elicitation resolved by hook: ${P(a)}`),z(`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 ji(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return z(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;Ye(t,`Elicitation completion notification: ${n}`),Vt({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Te.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(h)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Fr(h,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,we=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(me(t)))),...we]}})),hn(j)}}De();let M={clients:[],tools:[],configs:{}},ke=e=>{let t=ri(e.toolPermissionContext,e.mcp.tools),n=xe($a([...o,...we,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Ii(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Hi(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,je=0;function Me(){if(!N)return;let e=Math.min(je,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=k.length,t.length>0&&N.writeMessages(t)}let Ne=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Pe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await os(e,{configs:h,clients:j,tools:we},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),j=n.newSdkState.clients,we=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(me(t)))),...we]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Ne=Ne.then(t,t),Ne}function Le(){let e=g(),t=e.mcp.clients,n=xe([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...j.map(e=>e.name)]);return[...t,...j,...M.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`?Rn(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,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}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,capabilities:i}})}async function Re(){try{await Promise.all([Promise.resolve(),Ke(`headless_managed_settings_wait`,()=>$r())]),await No()&&await He()}catch(e){W(e)}}let ze=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?ze=Re():Re());let Be=Eo(()=>!x),F=a,L=te;async function Ve(){let{agentDefinitions:e}=await uo(_);F=await tr(X());let t=L.filter(e=>e.source===`flagSettings`);L=[...e.allAgents,...t]}async function He(){let{servers:e}=await Yt(),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(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Pe(t);r&&De(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Bt(),tr(X()).then(e=>{F=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Oi({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await ei({commands:e});return}for(let t of e)J({...t,uuid:Y()});B()})().catch(e=>{W(e),I(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};bn(()=>{E&&Gn(`now`).length>0&&E.abort(`interrupt`)});let B=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Be.stop(),q(`run_entry`),await De(),q(`after_updateSdkMcp`),ze){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([ze,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),z(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await ze;ze=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-DVZmzYLl.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=cn(t);){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(;Wo(r,Xn(t));)i.push(cn(t));let a=await Wr(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(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(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...j,...M.clients];Ee(c);for(let e of c)$o(e);let l=ke(s);for(let e of o)pr(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`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.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:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&z(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&vt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=dt(),q(`before_ask`),hr();let h=r,ee=!1;try{if(await be(h.workload??v.workload,async()=>{for await(let t of to({commands:xe([...F,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Se,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>_e.size===0?ge:Zi(ge,_e),setReadFileCache:e=>{ge=e;for(let[e,t]of _e.entries()){let n=ge.get(e);(!n||t.timestamp>n.timestamp)&&ge.set(e,t)}_e.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.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:L,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Me(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);Yn(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&dr(e))?T=t:(T=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await Ar({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await Ar({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)J({...t,uuid:Y()})}}catch(e){throw await Ar({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)pr(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=ln();if(!t)vi(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await kt(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};T?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){vi(`aborted`,void 0,void 0,`sdk`);return}W(Fe(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}Br(),Hr(),oi()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=Yn(g()).some(e=>dr(e)&&e.type!==`in_process_teammate`),n=Xn(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);T&&(D.enqueue(T),T=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.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:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[R(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Fn()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&Xn(t)===void 0&&!C){We();return}if(Xn(t)!==void 0){B();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){I(`[print.ts] No more active teammates, stopping poll`);break}let n=await Et(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await jt(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=bt(e.text);if(n&&r){let e=n.from;I(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),I(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}J({mode:`prompt`,value:n.map(e=>`<${Je} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Je}>`).join(`
|
|
32
32
|
|
|
33
|
-
`),uuid:Y()}),B();return}if(C&&!re){re=!0,I(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),J({mode:`prompt`,value:Lo,uuid:Y()}),B();return}await ct(500)}}}C&&(await(async()=>{let e=g();rt(e)&&await ot(_,e);let t=g(),n=t.teamContext;return n&&Object.keys(n.teammates).length>0||st(t)})()?(J({mode:`prompt`,value:Lo,uuid:Y()}),B()):(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await
|
|
33
|
+
`),uuid:Y()}),B();return}if(C&&!re){re=!0,I(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),J({mode:`prompt`,value:Lo,uuid:Y()}),B();return}await ct(500)}}}C&&(await(async()=>{let e=g();rt(e)&&await ot(_,e);let t=g(),n=t.teamContext;return n&&Object.keys(n.teammates).length>0||st(t)})()?(J({mode:`prompt`,value:Lo,uuid:Y()}),B()):(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Pi(),Ue(),le?.(),ar.delete(de),D.done()))},V=null;if(Io.isKairosCronEnabled()){let e=e=>{C||(async()=>{let t=await mi({basePrompt:e.basePrompt,trigger:`scheduled-task`,currentDir:X(),sourceId:e.sourceId,sourceLabel:e.sourceLabel,workload:oe,shouldCreate:()=>!C});if(t){if(C){await ei({commands:[t]});return}await e.onSuccess(t)}})().catch(t=>{W(t),I(`[ScheduledTasks] failed to enqueue headless task${e.logSuffix}: ${t}`,{level:`error`})})},t=e=>{J({...e,uuid:Y()}),B()};V=Po.createCronScheduler({onFire:n=>{e({basePrompt:n,sourceId:n,sourceLabel:n,logSuffix:``,onSuccess:t})},onFireTask:n=>{if(n.agentId){e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:async e=>{await wt(e.autonomy.runId,`No teammate runtime available for scheduled task owner ${n.agentId} in headless mode.`,e.autonomy.rootDir)}});return}e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:t})},isLoading:()=>x||C,getJitterConfig:Fo?.getCronJitterConfig,isKilled:()=>!Io?.isKairosCronEnabled()}),V.start()}let H=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},U=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},Ze=new Set;e.setUnexpectedResponseCallback(async e=>{await is({message:e,setAppState:_,handledToolUseIds:Ze,onEnqueued:()=>{B()}})});let Qe=new Map,et=new Map,tt=new Set,at=new Map,G=null;return(async()=>{let t=!1;Ge(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&pr(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);else if(o.subtype===`end_session`){I(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)h[e]={type:`sdk`,name:e};await Yo(i.request,i.request_id,t,D,a,ye,e,!!v.enableAuthStatus,v,te,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&he(`tengu_slate_prism`,!0)&&ee(!0),t=!0,zt()&&B()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Zo(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e===`default`?ie():e;Se=t,b(t),la({model:t}),Ce(e,t),H(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?v.thinkingConfig=void 0:i.request.max_thinking_tokens===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},H(i);else if(i.request.subtype===`mcp_status`)H(i,{mcpServers:Le()});else if(i.request.subtype===`get_context_usage`)try{let e=g();H(i,{...await ao({messages:k,getAppState:g,options:{mainLoopModel:ae(),tools:ke(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt}})})}catch(e){U(i,R(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=j.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),H(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await Xo(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?H(i,t):U(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid;H(i,{cancelled:En(t=>t.uuid===e).length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=$e(i.request.path),t=Math.floor((await _o(e)).mtimeMs);if(t<=i.request.mtime){let n=await go(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
34
34
|
`,`
|
|
35
|
-
`);_e.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}H(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Pe(i.request.servers);H(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=L.filter(e=>e.source===`flagSettings`);L=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([nr(X()),He(),lr()]);r.status===`fulfilled`?F=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),H(i,{commands:F.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Jt(e),argumentHint:e.argumentHint||``})),agents:L.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Le(),error_count:e.error_count})}catch(e){U(i,R(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Te.delete(t);let n=On(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await oi(t,n),r=me(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...A(n.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:Ae(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Te.delete(t);let a=On(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){en(t,!0);let e=await oi(t,a),n=me(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...A(r.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:Ae(r.mcp.resources,t)}})),e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{en(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await Yt(t,a);let o=me(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:A(e.mcp.tools,e=>e.name?.startsWith(o)),commands:A(e.mcp.commands,e=>Nr(e,t)),resources:Ae(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...j,...M.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=On(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=vr(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?H(i,{authUrl:s,requiresUserAction:!0}):H(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(Ut(e)||tt.has(e))return;let t=await oi(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{I(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,R(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.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)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,H(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else H(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),z(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new ft,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await qn(t),z(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>I(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);H(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,R(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ce()}})},e=>U(i,R(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=On(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await Yr(e,n);let t=await oi(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),Un.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Se=a;let e=n.model?String(n.model):`default`;la({model:a}),Ce(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=Tt(t)?Rr(t,e.effortValue):void 0;H(i,{...Oe(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await ar(e,{getAppState:g,setAppState:_}),H(i,{})}catch(e){U(i,R(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:dt()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{Oi(u(),r)}catch(e){W(e)}H(i,{title:r})}catch(e){U(i,R(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=on();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:dt()}}:await no({tools:ke(g()),commands:F,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:k,readFileState:ge,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:L})})).response})}catch(e){U(i,R(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),H(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)H(i,{session_url:Gt(N.bridgeSessionId,N.sessionIngressUrl),connect_url:an(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-Dt2aQBia.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;J({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),B()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Se=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),I(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(N=r,je=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:Gt(r.bridgeSessionId,r.sessionIngressUrl),connect_url:an(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,R(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),H(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await Vr(e,o.uuid);if(t||zo.has(o.uuid)){I(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(I(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.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&&pr(o.uuid,`completed`);continue}Vo(o.uuid)}J({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{Ir(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}C=!0,V?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Fi(),Ue(),le?.(),or.delete(de),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await It(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=Et(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 Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await It(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=>Ii(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`),K(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`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){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=Qr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!ci(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=Ce()?.outputStyle||`default`,p=await mr(Ue()),m=ne();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}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Jt(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ce()},pid:process.pid};if(N()&&je()){let e=d();ee.fast_mode_state=Te(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=se.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!Dt())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!jt(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await vn(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await ln(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${R(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(pn())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`&&!bt()){let e=kn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${Ei(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Mt(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;Ye(t,`Channel notifications registered`),z(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;Ye(t,`notifications/claude/channel: ${n.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),J({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;Ye(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;Ye(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),J({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(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:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(P(t)+`
|
|
35
|
+
`);_e.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}H(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Pe(i.request.servers);H(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=L.filter(e=>e.source===`flagSettings`);L=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([tr(X()),He(),cr()]);r.status===`fulfilled`?F=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),H(i,{commands:F.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Xt(e),argumentHint:e.argumentHint||``})),agents:L.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Le(),error_count:e.error_count})}catch(e){U(i,R(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Te.delete(t);let n=kn(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await ii(t,n),r=me(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...A(n.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:Ae(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Te.delete(t);let a=kn(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){an(t,!0);let e=await ii(t,a),n=me(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...A(r.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:Ae(r.mcp.resources,t)}})),e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{an(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await $t(t,a);let o=me(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:A(e.mcp.tools,e=>e.name?.startsWith(o)),commands:A(e.mcp.commands,e=>Nr(e,t)),resources:Ae(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...j,...M.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=kn(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=yr(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?H(i,{authUrl:s,requiresUserAction:!0}):H(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(Gt(e)||tt.has(e))return;let t=await ii(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{I(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,R(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.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)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,H(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else H(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),z(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new ft,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Jn(t),z(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>I(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);H(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,R(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ce()}})},e=>U(i,R(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=kn(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await Yr(e,n);let t=await ii(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),Wn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Se=a;let e=n.model?String(n.model):`default`;la({model:a}),Ce(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=Dt(t)?Rr(t,e.effortValue):void 0;H(i,{...Oe(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await ir(e,{getAppState:g,setAppState:_}),H(i,{})}catch(e){U(i,R(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:dt()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{Ei(u(),r)}catch(e){W(e)}H(i,{title:r})}catch(e){U(i,R(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=ln();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:dt()}}:await no({tools:ke(g()),commands:F,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:k,readFileState:ge,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:L})})).response})}catch(e){U(i,R(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),H(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)H(i,{session_url:qt(N.bridgeSessionId,N.sessionIngressUrl),connect_url:Ft(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-99sUBVEk.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;J({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),B()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Se=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),I(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(N=r,je=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:qt(r.bridgeSessionId,r.sessionIngressUrl),connect_url:Ft(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,R(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),H(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await Vr(e,o.uuid);if(t||zo.has(o.uuid)){I(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(I(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.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&&pr(o.uuid,`completed`);continue}Vo(o.uuid)}J({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{Ir(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}C=!0,V?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Pi(),Ue(),le?.(),ar.delete(de),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Rt(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=Ot(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 Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Rt(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=>Ii(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`),K(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`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){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=Zr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!ai(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=Ce()?.outputStyle||`default`,p=await mr(Ue()),m=ne();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}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Xt(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ce()},pid:process.pid};if(N()&&je()){let e=d();ee.fast_mode_state=Te(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=se.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!zn())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Ci(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Mt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await mt(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${R(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(mn())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`&&!St()){let e=An();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${wi(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Nt(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;Ye(t,`Channel notifications registered`),z(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;Ye(t,`notifications/claude/channel: ${n.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),J({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;Ye(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;Ye(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),J({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(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:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(P(t)+`
|
|
36
36
|
`)}else process.stderr.write(e+`
|
|
37
|
-
`)}function ts(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function ns(t,n){let r=!v();if(n.continue)try{z(`tengu_continue_print`,{});let i=await
|
|
38
|
-
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(
|
|
39
|
-
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(
|
|
37
|
+
`)}function ts(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function ns(t,n){let r=!v();if(n.continue)try{z(`tengu_continue_print`,{});let i=await $n(void 0,void 0);if(i){if(Q){let n=Q.matchSessionMode(i.mode);if(n){process.stderr.write(n+`
|
|
38
|
+
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Xr(),e(ui));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return n.forkSession||i.sessionId&&(te(tn(i.sessionId),i.fullPath?po(i.fullPath):null),r&&await Tr()),co(i,t),rr(n.forkSession?{...i,worktreeSession:void 0}:i),Q&&Si(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}}catch(e){return W(e),K(1),{messages:[]}}if(n.teleport)try{if(!rn(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(z(`tengu_teleport_print`,{}),typeof n.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:t,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-D6PvdjPy.js`);await i();let a=await r(n.teleport),{branchError:o}=await e(a.branch);return{messages:t(a.log,o)}}catch(e){return W(e),K(1),{messages:[]}}if(n.resume)try{z(`tengu_resume_print`,{});let a=Do(typeof n.resume==`string`?n.resume:``);if(!a){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof n.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${n.resume}" is not a valid UUID`),es(e,n.outputFormat),K(1),{messages:[]}}if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,e]=await Promise.all([pn(a.sessionId),n.restoredWorkerState]);e&&(t(Va(e)),typeof e.model==`string`&&b(e.model))}else a.isUrl&&a.ingressUrl&&i(process.env.ENABLE_SESSION_PERSISTENCE)&&await yn(a.sessionId,a.ingressUrl);let o=await $n(a.sessionId,a.jsonlFile||void 0);if(!o||o.messages.length===0)return a.isUrl||i(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(n.sessionStartHooksPromise??pt(`startup`))}:(es(`No conversation found with session ID: ${a.sessionId}`,n.outputFormat),K(1),{messages:[]});if(n.resumeSessionAt){let e=o.messages.findIndex(e=>e.uuid===n.resumeSessionAt);if(e<0)return es(`No message found with message.uuid of: ${n.resumeSessionAt}`,n.outputFormat),K(1),{messages:[]};o.messages=e>=0?o.messages.slice(0,e+1):[]}if(Q){let n=Q.matchSessionMode(o.mode);if(n){process.stderr.write(n+`
|
|
39
|
+
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Xr(),e(ui));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return!n.forkSession&&o.sessionId&&(te(tn(o.sessionId),o.fullPath?po(o.fullPath):null),r&&await Tr()),co(o,t),rr(n.forkSession?{...o,worktreeSession:void 0}:o),Q&&Si(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:o.messages,turnInterruptionState:o.turnInterruptionState,agentSetting:o.agentSetting}}catch(e){return W(e),es(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,n.outputFormat),K(1),{messages:[]}}return{messages:await(n.sessionStartHooksPromise??pt(`startup`))}}function rs(e,t){let n;return n=typeof e==`string`?e.trim()===``?Or([]):Or([P({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new bo(t.sdkUrl,n,t.replayUserMessages):new Ga(n,t.replayUserMessages)}async function is({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(I(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return I(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await Gr(t);return a?(r.add(t),I(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),J({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(I(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function as(e){return{...e,scope:`dynamic`}}async function os(e,t,n,r){let{allowed:i,blocked:a}=Lt(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 ss(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 ss(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?!0:!on(r,as(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){W(e)}await $t(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=as(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await er(t,r);if(d.push(e),e.type===`connected`){let t=await Cn(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Fe(e);u[t]=n.message,W(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=as(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{Go as runHeadless};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{_E as a,gE as o,vE as s,yE as c}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{_E as a,gE as o,vE as s,yE as c}from"./loadAgentsDir-ClTeo0nk.js";import{n as l,r as u,t as d}from"./Grove-m57x4tY1.js";async function f(e){if(!await c())return e(m),null;let[t,n]=await Promise.all([a(),o()]);if(!t.success)return e(m),null;let r=t.data,s=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await a();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:s?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),s(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-DR8-3Aex.js";import{Rn as t,t as n,x as r}from"./src-Di342QoJ.js";import{t as i}from"./jsx-runtime-D-D469L8.js";import{Ka as a,oo as o}from"./paths-
|
|
1
|
+
import{a as e}from"./chunk-DR8-3Aex.js";import{Rn as t,t as n,x as r}from"./src-Di342QoJ.js";import{t as i}from"./jsx-runtime-D-D469L8.js";import{Ka as a,oo as o}from"./paths-DO4WOQtD.js";import{F as s,U as c,z as l}from"./debug-otxXY3j-.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{$g as f,$m as p,$o as m,Eo as h,GC as g,Qg as _,Qm as v,So as y,To as b,Uo as x,WC as S,dh as C,uh as w,vu as T,yu as E}from"./loadAgentsDir-ClTeo0nk.js";import{Gt as D,Kt as O}from"./prompt-CfM_xGPc.js";import{r as k,t as A}from"./xml-CTdKuU6f.js";import{randomUUID as j}from"crypto";t(),n(),E(),f(),C();var M=i();function N({input:e,progress:t,verbose:n}){return(0,M.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(_,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),t?(0,M.jsx)(w,{fullOutput:t.fullOutput,output:t.output,elapsedTimeSeconds:t.elapsedTimeSeconds,totalLines:t.totalLines,verbose:n}):T.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}u(),c(),S(),x(),o();function P(){return a().defaultShell??`bash`}E(),D(),k();async function F(t,n,r,i,a){let o=O()&&P()===`powershell`;d(`tengu_input_bash`,{powershell:o});let c=h({content:m({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),u;a({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{u=e?.jsx}},s=e=>{a({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),u]}),shouldHidePromptInput:!1,showSpinner:!1})},l=null;o&&(l=(p(),e(v)).PowerShellTool);let d=l??T,f=(l?await l.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s):await T.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s)).data;if(!f)throw Error(`No result received from shell command`);let m=f.stderr,_=await g(d,{...f,stderr:``},j()),b=typeof _.content==`string`?_.content:A(f.stdout);return{messages:[y(),c,...r,h({content:`<bash-stdout>${b}</bash-stdout><bash-stderr>${A(m)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof s?e.interrupted?{messages:[y(),c,b({toolUse:!1}),...r],shouldQuery:!1}:{messages:[y(),c,...r,h({content:`<bash-stdout>${A(e.stdout)}</bash-stdout><bash-stderr>${A(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[y(),c,...r,h({content:`<bash-stderr>Command failed: ${A(l(e))}</bash-stderr>`})],shouldQuery:!1}}finally{a(null)}}export{F as processBashCommand};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Ct as r,cn as i,mr as a,t as o}from"./state-sIHsFpDu.js";import{$ as s,Bc as c,Dt as l,Ot as u,Uc as d,tt as f,vs as p,ys as m}from"./paths-DO4WOQtD.js";import{P as h,U as g,_,h as v,j as y,l as b,p as x}from"./debug-otxXY3j-.js";import{n as S,r as C}from"./analytics-DqMQntaB.js";import{O as w,et as T,k as E,o as D,s as O}from"./log-DSV4Ht5l.js";import{n as k,t as ee}from"./sleep-C6koP5Ka.js";import{$D as te,$_ as ne,$o as A,$w as re,A as ie,Ao as ae,BO as oe,CS as se,Co as ce,Dl as le,Eo as j,Fc as ue,Fk as de,G as fe,Il as M,Jo as pe,K as me,KO as he,Mc as N,Nc as P,O_ as F,Q_ as I,Qw as L,Rk as R,Rl as ge,So as z,TS as _e,To as ve,Ui as ye,Uo as be,Wo as xe,Xi as Se,Z_ as Ce,Zo as we,Zw as Te,_D as Ee,aA as De,bO as Oe,cp as ke,eO as Ae,gD as je,ha as B,hv as V,k_ as H,kl as Me,lj as Ne,lv as Pe,mv as Fe,nO as Ie,na as Le,pv as Re,qi as ze,rA as Be,rO as Ve,sp as He,ta as Ue,uj as We,uv as Ge,vo as U,vv as Ke,w as qe,wO as Je,xO as Ye,zO as Xe,zl as Ze}from"./loadAgentsDir-ClTeo0nk.js";import{a as W,i as Qe,o as G}from"./xml-CTdKuU6f.js";import{E as $e,T as et,w as tt}from"./sessionTracing-Caw-kvQr.js";import{n as nt,t as rt}from"./slashCommandParsing-BfanVchF.js";import{randomUUID as K}from"crypto";function it(e,t,n,r,i){let a=0;for(let o of p){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{x(`Removing one-shot hook for event ${o} in skill '${r}'`),ne(e,t,o,s)}:void 0;Ce(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&x(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{m(),b(),I()}));function ot(){return!1}function st(){if(!ot())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function q(e,t,n,r,i,a,o){let s=Pe(),u=e.pluginInfo?G(e.pluginInfo.repository).marketplace:void 0;C(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...u&&{_PROTO_marketplace_name:u},...V(e.pluginInfo)}});let{skillContent:d,modifiedGetAppState:f,baseAgent:p,promptMessages:m}=await Ze(e,t,n),h=e.effort===void 0?p:{...p,effort:e.effort};x(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let g=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&st();let _=!1;if(g.kairosEnabled&&(_=!0),_){let t=te(),r=B(e),i=l(),c=e=>oe({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await Oe({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)Xe(t)},d=async e=>{o?.runId&&await Ye({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 k(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of H({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let d=M(l,`Command completed`);x(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){O(e)}})().catch(async e=>{O(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await d(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let v=[],y=[],b=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:d,agentId:s},parentToolUseID:b,toolUseID:`${b}-${S}`,timestamp:new Date().toISOString(),uuid:K()}),T=()=>{i({jsx:ke(y,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of H({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){v.push(t);let e=we([t]);if(t.type===`assistant`){let r=de(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(y.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(y.push(w(t)),T())}}}finally{i(null)}let E=M(v,`Command completed`);return x(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${c(Ie(s))}\n${E}`),{messages:[j({content:A({inputString:`/${B(e)} ${t}`.trim(),precedingInputBlocks:r})}),j({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function ct(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function lt(e,t,n,r,i,o,s,c,l,u){let d=nt(e);if(!d){C(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[z(),...r,j({content:A({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,h=m?`mcp`:ye().has(f)?f:`custom`;if(!Ue(f,i.options.commands)){let n=!1;try{await v().stat(`/${f}`),n=!0}catch{}if(ct(f)&&!n){C(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[z(),...r,j({content:A({inputString:e,precedingInputBlocks:t})}),...p?[ce(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let i=K();return a(i),C(`tengu_input_prompt`,{}),et(`user_prompt`,{prompt_length:String(e.length),prompt:$e(e),"prompt.id":i}),{messages:[j({content:A({inputString:e,precedingInputBlocks:t}),uuid:s}),...r],shouldQuery:!0}}let{messages:g,shouldQuery:_,allowedTools:y,model:b,effort:x,command:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}=await ut(f,p,o,i,t,n,c,l,s,u);if(g.length===0){let e={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=G(n),i=W(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,V(S.pluginInfo))}return C(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:b,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}if(g.length===2&&g[1].type===`user`&&typeof g[1].message.content==`string`&&g[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||C(`tengu_input_slash_invalid`,{input:f}),{messages:[z(),...g],shouldQuery:_,allowedTools:y,model:b};let O={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=G(t),r=W(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,V(S.pluginInfo))}C(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=g.length>0&&g[0]&&xe(g[0]);return{messages:_||g.every(pe)||k?g:[z(),...g],shouldQuery:_,allowedTools:y,model:b,effort:x,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}async function ut(e,t,n,r,i,a,o,s,c,l){let u=Se(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&Fe(e),u.userInvocable===!1)return{messages:[j({content:A({inputString:`/${e}`,precedingInputBlocks:i})}),j({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:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>j({content:e,isMeta:!0})),s=_e()&&typeof n==`string`&&n.endsWith(` dismissed`),c=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[U(J(u,c)),U(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[j({content:A({inputString:J(u,c),precedingInputBlocks:i})}),j(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${Ne}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{O(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=j({content:A({inputString:J(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=z(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[j({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return De(),{messages:le(r),shouldQuery:!1,command:u}}return{messages:[e,U(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return O(t),{messages:[e,U(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await q(u,t,r,i,n,s??fe,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof y?{messages:[j({content:A({inputString:J(u,t),precedingInputBlocks:i})}),ve({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[j({content:A({inputString:J(u,t),precedingInputBlocks:i})}),j({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof h)return{messages:[j({content:A({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function J(e,t){return ae(B(e),t)}function Y(e,t=`loading`){return[`<${w}>${e}</${w}>`,`<${E}>${e}</${E}>`,`<skill-format>true</skill-format>`].join(`
|
|
2
|
+
`)}function dt(e,t){return[`<${w}>${e}</${w}>`,`<${E}>/${e}</${E}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
|
|
3
|
+
`)}function X(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?Y(e.name,e.progressMessage):dt(e.name,t)}async function ft(e,t,n,r,i=[]){let a=ze(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,i,a=[],c=[],l){if(n(process.env.CLAUDE_CODE_COORDINATOR_MODE)&&!i.agentId){let n=X(e,t),r=[`Skill "/${e.name}" is available for workers.`];e.description&&r.push(`Description: ${e.description}`),e.whenToUse&&r.push(`When to use: ${e.whenToUse}`);let i=e.allowedTools??[];i.length>0&&r.push(`This skill grants workers additional tool permissions: ${i.join(`, `)}`),r.push(`\nInstruct a worker to use this skill by including "Use the /${e.name} skill" in your Agent prompt. The worker has access to the Skill tool and will receive the skill's content and permissions when it invokes it.`);let a=[{type:`text`,text:r.join(`
|
|
4
|
+
`)}];return{messages:[j({content:n,uuid:l}),j({content:a,isMeta:!0})],shouldQuery:!0,model:e.model,effort:e.effort,command:e}}let u=await e.getPromptForCommand(t,i),d=!L(`hooks`)||re(e.source);if(e.hooks&&d){let t=r();it(i.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=u.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
5
|
+
|
|
6
|
+
`);o(e.name,f,p,s()?.agentId??null);let m=X(e,t),h=ie(e.allowedTools??[]),g=c.length>0||a.length>0?[...c,...a,...u]:u,_=await Ee(P(u.filter(e=>e.type===`text`).map(e=>e.text).join(` `),i,null,[],i.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[j({content:m,uuid:l}),j({content:g,isMeta:!0}),..._,N({type:`command_permissions`,allowedTools:h,model:e.model})],shouldQuery:!0,allowedTools:h,model:e.model,effort:e.effort,command:e}}var Q,$;e((()=>{i(),Le(),We(),T(),S(),Ve(),Me(),Be(),F(),He(),Ae(),f(),ue(),b(),t(),g(),d(),ge(),_(),se(),je(),at(),D(),he(),be(),qe(),me(),Qe(),Te(),rt(),ee(),Re(),tt(),Ke(),R(),Ge(),Je(),u(),Q=200,$=1e4}))();export{Y as formatSkillLoadingMetadata,ft as processPromptSlashCommand,lt as processSlashCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./prompt-CfM_xGPc.js";t();export{e as isDeferredTool};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{n as c,t as l}from"./defineProperty-80gRi2ZW.js";import{Cn as u,Ln as d,Xn as f,wn as p}from"./schemas-BGAvj1T4.js";import{t as ee}from"./v4-f1i_CNUT.js";import{t as te}from"./ajv-B_OpU_Uh.js";import{St as ne,cn as re,n as ie,ut as ae,vn as oe}from"./state-sIHsFpDu.js";import{Bo as se,Dr as ce,Ho as le,Ko as ue,Pr as de,Ro as fe,S as pe,Vo as me,_ as he,v as ge,zo as _e}from"./paths-
|
|
1
|
+
import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{n as c,t as l}from"./defineProperty-80gRi2ZW.js";import{Cn as u,Ln as d,Xn as f,wn as p}from"./schemas-BGAvj1T4.js";import{t as ee}from"./v4-f1i_CNUT.js";import{t as te}from"./ajv-B_OpU_Uh.js";import{St as ne,cn as re,n as ie,ut as ae,vn as oe}from"./state-sIHsFpDu.js";import{Bo as se,Dr as ce,Ho as le,Ko as ue,Pr as de,Ro as fe,S as pe,Vo as me,_ as he,v as ge,zo as _e}from"./paths-DO4WOQtD.js";import{E as ve,I as ye,K as be,O as xe,U as Se,_ as Ce,h as we,l as Te,p as Ee}from"./debug-otxXY3j-.js";import{J as De,et as Oe,o as ke,s as Ae}from"./log-DSV4Ht5l.js";import{i as je,o as Me}from"./platform-mh9ypxS8.js";import{s as Ne,u as Pe}from"./types-KeqFPzY5.js";import{n as Fe,t as Ie}from"./lazySchema-B0QShMaQ.js";import{i as Le,r as Re,t as ze}from"./cron-DwR6OJuW.js";import{join as Be}from"path";import{join as m,parse as Ve,resolve as h,sep as He}from"node:path";import{readFileSync as Ue}from"fs";import{createHash as We}from"node:crypto";import{randomUUID as Ge}from"crypto";import{mkdir as Ke,writeFile as qe}from"fs/promises";import{appendFile as Je,mkdir as Ye,readFile as g,readdir as Xe,rm as Ze,writeFile as Qe}from"node:fs/promises";function $e(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function et(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function tt(e,t){return e.find(e=>et(e,t))}function nt(e){return{...it,userFacingName:()=>e.name,...e}}var rt,it,at=e((()=>{rt=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),it={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),_,ot=e((()=>{_=`Bash`}));function st(){return`A powerful search tool built on ripgrep
|
|
2
2
|
|
|
3
3
|
Usage:
|
|
4
4
|
- ALWAYS use ${v} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${_} command. The ${v} tool has been optimized for correct permissions and access.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{TA as e,yA as t}from"./loadAgentsDir-ClTeo0nk.js";e();export{t as clearPromptCache};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{A as a,E as o,_ as s,h as c,l,p as u}from"./debug-otxXY3j-.js";import{n as d,t as f}from"./execSyncWrapper-Bn7EJqtD.js";import{r as p,t as m}from"./which-BnEnzWhs.js";import{Ax as h,GS as g,
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{A as a,E as o,_ as s,h as c,l,p as u}from"./debug-otxXY3j-.js";import{n as d,t as f}from"./execSyncWrapper-Bn7EJqtD.js";import{r as p,t as m}from"./which-BnEnzWhs.js";import{Ax as h,GS as g,Hv as _,KS as v,US as y,Uv as b,VS as x,zx as S}from"./loadAgentsDir-ClTeo0nk.js";import{basename as C}from"path";import{spawn as w,spawnSync as T}from"child_process";function E(e){return!!p(e)}function D(e){let t=C(e.split(` `)[0]??``);return A.find(e=>t.includes(e))}function O(e,t,n){return n?M.has(e)?[`-g`,`${t}:${n}`]:e===`subl`?[`${t}:${n}`]:[t]:[t]}function k(e,t){let n=N();if(!n)return!1;let i=n.split(` `),a=i[0]??n,o=i.slice(1),s=D(n);if(s){let r=O(s,e,t),i={detached:!0,stdio:`ignore`},c;return c=process.platform===`win32`?w(`${n} ${r.map(e=>`"${e}"`).join(` `)}`,{...i,shell:!0}):w(a,[...o,...r],i),c.on(`error`,e=>u(`editor spawn failed: ${e}`,{level:`error`})),c.unref(),!0}let c=r.get(process.stdout);if(!c)return!1;let l=t&&j.test(C(a));c.enterAlternateScreen();try{let r={stdio:`inherit`},i;return i=process.platform===`win32`?T(`${n} ${l?`+${t} `:``}"${e}"`,{...r,shell:!0}):T(a,[...o,...l?[`+${t}`,e]:[e]],r),i.error?(u(`editor spawn failed: ${i.error}`,{level:`error`}),!1):!0}finally{c.exitAlternateScreen()}}var A,j,M,N,P=e((()=>{n(),i(),l(),m(),A=[`code`,`cursor`,`windsurf`,`codium`,`subl`,`atom`,`gedit`,`notepad++`,`notepad`],j=/\b(vi|vim|nvim|nano|emacs|pico|micro|helix|hx)\b/,M=new Set([`code`,`cursor`,`windsurf`,`codium`]),N=t(()=>process.env.VISUAL?.trim()?process.env.VISUAL.trim():process.env.EDITOR?.trim()?process.env.EDITOR.trim():process.platform===`win32`?`start /wait notepad`:[`code`,`vi`,`nano`].find(e=>E(e)))}));function F(e){return D(e)!==void 0}function I(e){let t=c(),n=r.get(process.stdout);if(!n)throw Error(`Ink instance not found - cannot pause rendering`);let i=N();if(!i)return{content:null};try{t.statSync(e)}catch{return{content:null}}let a=!F(i);a?n.enterAlternateScreen():(n.pause(),n.suspendStdin());try{return f(`${z[i]??i} "${e}"`,{stdio:`inherit`}),{content:t.readFileSync(e,{encoding:`utf-8`})}}catch(e){if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let t=e.status;if(t!==0)return{content:null,error:`${S(i)} exited with code ${t}`}}return{content:null}}finally{a?n.exitAlternateScreen():(n.resumeStdin(),n.resume())}}function L(e,t,n){let r=e;for(let[e,t]of Object.entries(n))if(t.type===`text`){let n=parseInt(e,10),i=t.content,a=r.indexOf(i);if(a!==-1){let e=y(n,g(i));r=r.slice(0,a)+e+r.slice(a+i.length)}}return r}function R(e,t){let n=c(),r=_();try{a(r,t?x(e,t):e,{encoding:`utf-8`,flush:!0});let n=I(r);if(n.content===null)return n;let i=n.content;return i.endsWith(`
|
|
2
2
|
`)&&!i.endsWith(`
|
|
3
3
|
|
|
4
|
-
`)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{v(),i(),P(),d(),s(),h(),o(),
|
|
4
|
+
`)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{v(),i(),P(),d(),s(),h(),o(),b(),z={code:`code -w`,subl:`subl --wait`}}));export{P as a,N as i,R as n,k as o,B as r,I as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{dc as e,yc as t}from"./paths-
|
|
1
|
+
import{dc as e,yc as t}from"./paths-DO4WOQtD.js";import{E as n,O as r,l as i,p as a}from"./debug-otxXY3j-.js";import{n as o,t as s}from"./which-BnEnzWhs.js";import{r as c,t as l}from"./execFileNoThrow-azCkYhmF.js";import{n as u,t as d}from"./githubRepoPathMapping-DUGvTwPB.js";import{n as f}from"./banner-D9Cq292T.js";import{a as p,i as m,n as h}from"./registerProtocol-D8fFnceq.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";n(),m(),h(),t(),i(),c(),s();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 t=e().deepLinkTerminal;if(t){let e=y.find(e=>e.app===t);if(e)return{name:e.name,command:e.app}}let n=process.env.TERM_PROGRAM;if(n){let e=n.replace(/\.app$/i,``).toLowerCase(),t=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(t)return{name:t.name,command:t.app}}for(let e of y){let{code:t,stdout:n}=await l(`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 l(`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 o(e);if(t)return{name:_(e),command:t}}let t=await o(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await o(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await o(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await o(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await o(`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,t){let n=await w();if(!n)return a(`No terminal emulator detected`,{level:`error`}),!1;a(`Launching in terminal: ${n.name} (${n.command})`);let r=[`--deep-link-origin`];switch(t.repo&&(r.push(`--deep-link-repo`,t.repo),t.lastFetchMs!==void 0&&r.push(`--deep-link-last-fetch`,String(t.lastFetchMs))),t.query&&r.push(`--prefill`,t.query),process.platform){case`darwin`:return E(n,e,r,t.cwd);case`linux`:return D(n,e,r,t.cwd);case`win32`:return O(n,e,r,t.cwd);default:return!1}}async function E(e,t,n,r){switch(e.command){case`iTerm`:{let{code:e}=await l(`osascript`,[`-e`,`tell application "iTerm"
|
|
2
2
|
if running then
|
|
3
3
|
create window with default profile
|
|
4
4
|
else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,f as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$t as o,Da as s,S as c,Zt as l,_ as u,ka as d,on as f,tn as p}from"./paths-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,f as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$t as o,Da as s,S as c,Zt as l,_ as u,ka as d,on as f,tn as p}from"./paths-DO4WOQtD.js";import{n as m,r as h}from"./analytics-DqMQntaB.js";import{_a as g,aS as _,c_ as v,l_ as y,oS as b,s_ as x,u_ as S,va as C}from"./loadAgentsDir-ClTeo0nk.js";import{n as w,t as T}from"./extra-usage-Cj8fokgc.js";import{n as E,t as D}from"./upgrade-D4Id4ebd.js";function O({onDone:e,context:t}){let[n,i]=(0,A.useState)(null),a=v(),c=p(),d=o(),f=l()?.hasExtraUsageEnabled===!0,m=c===`max`&&d===`default_claude_max_20x`,g=c===`team`||c===`enterprise`,b=u(`tengu_jade_anvil_4`,!1),x=(0,A.useMemo)(()=>{let e=[];if(y.isEnabled()){let t=s(),n=g&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}!m&&!g&&C.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`});let t={label:`Stop and wait for limit to reset`,value:`cancel`};return b?[...e,t]:[t,...e]},[b,m,g,f,a.overageStatus,a.overageDisabledReason]);function S(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function w(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),D(e,t).then(e=>{e&&i(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),T(e,t).then(e=>{e&&i(e)})):n===`cancel`&&S()}return n||(0,j.jsx)(r,{title:`What do you want to do?`,onCancel:S,color:`suggestion`,children:(0,j.jsx)(_,{options:x,onChange:w,visibleOptionCount:x.length})})}async function k(e,t){return(0,j.jsx)(O,{onDone:e,context:t})}var A,j;e((()=>{A=t(n(),1),b(),i(),c(),m(),x(),f(),d(),w(),S(),g(),E(),j=a()}))();export{k as call};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,U as a,br as o,cn as s,wt as c}from"./state-sIHsFpDu.js";import{ea as l,na as u,ra as d,ta as f}from"./paths-
|
|
1
|
+
import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,U as a,br as o,cn as s,wt as c}from"./state-sIHsFpDu.js";import{ea as l,na as u,ra as d,ta as f}from"./paths-DO4WOQtD.js";import{Q as p,U as m,Z as h,_ as g,h as _,l as ee,p as v,z as te}from"./debug-otxXY3j-.js";import{F as y,P as ne}from"./git-C0IuvuIy.js";import{join as re}from"node:path";import{appendFileSync as ie,existsSync as ae,mkdirSync as oe}from"node:fs";import{homedir as se}from"node:os";import{randomUUID as b}from"crypto";var ce=e((()=>{})),le,ue=e((()=>{le={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`}})),de=e((()=>{}));function fe(e){return e}var pe=e((()=>{})),me=e((()=>{ce(),ue(),de(),pe()}));function he(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function ge(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=he(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 _e[t]??t}var _e,ve=e((()=>{_e={"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 ye(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function be(){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 xe(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=ye(t),r=be();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 x[t]?x[t]:n&&S[n]?S[n]:t}var x,S,Se=e((()=>{x={"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`},S={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function Ce(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function we(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=Ce(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 Te=e((()=>{})),C,Ee=e((()=>{C=`_geminiThoughtSignature`}));function w(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function De(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=je(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=ke(t,r);e.parts.length>0&&n.push(e)}}let i=Oe(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function Oe(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
2
2
|
|
|
3
3
|
`)}function ke(e,t){let n=e.message.content;return typeof n==`string`?{role:`user`,parts:T(n)}:Array.isArray(n)?{role:`user`,parts:n.flatMap(e=>Ae(e,t))}:{role:`user`,parts:[]}}function Ae(e,t){if(typeof e==`string`)return T(e);if(e.type===`text`)return T(e.text);if(e.type===`tool_result`){let n=e;return[{functionResponse:{name:t.get(n.tool_use_id)??n.tool_use_id,response:Pe(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 T(`[image: ${t.url}]`)}return[]}function je(e){let t=e.message.content;if(typeof t==`string`)return{role:`model`,parts:T(t)};if(!Array.isArray(t))return{role:`model`,parts:[]};let n=[];for(let e of t){if(typeof e==`string`){n.push(...T(e));continue}if(e.type===`text`){n.push(...T(e.text,E(e)));continue}if(e.type===`thinking`){let t=Me(e.thinking,e.signature);t&&n.push(t);continue}if(e.type===`tool_use`){let t=e;n.push({functionCall:{name:t.name,args:Ne(t.input)},...E(e)&&{thoughtSignature:E(e)}})}}return{role:`model`,parts:n}}function T(e,t){return typeof e!=`string`||e.length===0?[]:[{text:e,...t&&{thoughtSignature:t}}]}function Me(e,t){if(!(typeof e!=`string`||e.length===0))return{text:e,thought:!0,...t&&{thoughtSignature:t}}}function Ne(e){if(typeof e==`string`){let t=w(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 Pe(e){let t=Fe(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 Fe(e){if(typeof e==`string`)return w(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
4
|
`);return w(t)??t}return e??``}function E(e){let t=e[C];return typeof t==`string`&&t.length>0?t:void 0}var Ie=e((()=>{Ee()}));function Le(e){if(typeof e==`string`)return O.has(e)?e:void 0;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`&&O.has(e)),n=Array.from(new Set(t));return n.length===0?void 0:n.length===1?n[0]:n}}function Re(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 ze(e){let t=e.map(Re).filter(e=>e!==void 0),n=Array.from(new Set(t));if(n.length!==0)return n.length===1?n[0]:n}function Be(e){return e===void 0?[`null`]:Array.isArray(e)?e.includes(`null`)?e:[...e,`null`]:e===`null`?e:[e,`null`]}function Ve(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).map(([e,t])=>[e,D(t)]).filter(([,e])=>Object.keys(e).length>0);if(t.length!==0)return Object.fromEntries(t)}function He(e){if(!Array.isArray(e))return;let t=e.map(e=>D(e)).filter(e=>Object.keys(e).length>0);return t.length>0?t:void 0}function D(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n={},r=Le(t.type);t.const===void 0?Array.isArray(t.enum)&&t.enum.length>0&&(n.enum=t.enum,r=r??ze(t.enum)):(n.enum=[t.const],r=r??Re(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=Be(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=Ve(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=D(t.additionalProperties);Object.keys(e).length>0&&(n.additionalProperties=e)}let a=D(t.items);Object.keys(a).length>0&&(n.items=a);let o=He(t.prefixItems);o&&(n.prefixItems=o);let s=He(t.anyOf??t.oneOf);return s&&(n.anyOf=s),n}function Ue(e){let t=D(e);return Object.keys(t).length>0?t:{type:`object`,properties:{}}}function We(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:Ue(t.input_schema??{type:`object`,properties:{}})}});return t.length>0?[{functionDeclarations:t}]:[]}function Ge(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 O,Ke=e((()=>{O=new Set([`string`,`number`,`integer`,`boolean`,`object`,`array`,`null`])}));async function*qe(e,t){let n=`msg_${b().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_${b().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=Je(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:Ye(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 Je(e){return typeof e.text==`string`?e.thought?`thinking`:`text`:null}function Ye(e,t){switch(e){case`MAX_TOKENS`:return`max_tokens`;default:return t?`tool_use`:`end_turn`}}var Xe=e((()=>{}));function k(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=nt.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 Ze(e){let t=k(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 A(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 Qe(e){let t=e.message;return t?A(t):``}function $e(e){return typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null}function et(e){if(!$e(e))return null;let t=e.error,n=t?.error?.message;if(typeof n==`string`&&n.length>0){let e=A(n);if(e.length>0)return e}let r=t?.message;if(typeof r==`string`&&r.length>0){let e=A(r);if(e.length>0)return e}return null}function tt(e){let t=k(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 et(e)??`API error (status ${e.status??`unknown`})`;let n=Qe(e);return n!==e.message&&n.length>0?n:e.message}var nt,rt=e((()=>{nt=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 it(e,t,n){let r=[],i=at(t);i&&r.push({role:`system`,content:i});for(let t of e)switch(t.type){case`user`:r.push(...ot(t));break;case`assistant`:r.push(...ct(t));break;default:break}return r}function at(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{Cc as r,Zt as i,dc as a,dn as o,on as s,tn as c,yc as l}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{Cc as r,Zt as i,dc as a,dn as o,on as s,tn as c,yc as l}from"./paths-DO4WOQtD.js";import{l as u,p as d}from"./debug-otxXY3j-.js";import{l as f,u as p}from"./oauth-CdZEzMww.js";import{d as m,f as h,o as g,s as _}from"./log-DSV4Ht5l.js";import{a as v,l as y,o as b}from"./api-CQWbpxLP.js";async function x(e=`claude_code_guest_pass`){let{accessToken:n,orgUUID:r}=await y(),i={...v(n),"x-organization-uuid":r},a=`${f().BASE_API_URL}/api/oauth/organizations/${r}/referral/eligibility`;return(await t.get(a,{headers:i,params:{campaign:e},timeout:5e3})).data}async function S(e=`claude_code_guest_pass`){let{accessToken:n,orgUUID:r}=await y(),i={...v(n),"x-organization-uuid":r},a=`${f().BASE_API_URL}/api/oauth/organizations/${r}/referral/redemptions`;return(await t.get(a,{headers:i,params:{campaign:e},timeout:1e4})).data}function C(){return!!(i()?.organizationUuid&&o()&&c()===`max`)}function w(){if(!C())return{eligible:!1,needsRefresh:!1,hasCache:!1};let e=i()?.organizationUuid;if(!e)return{eligible:!1,needsRefresh:!1,hasCache:!1};let t=a().passesEligibilityCache?.[e];if(!t)return{eligible:!1,needsRefresh:!0,hasCache:!1};let{eligible:n,timestamp:r}=t;return{eligible:n,needsRefresh:Date.now()-r>j,hasCache:!0}}function T(e){let t=N[e.currency]??`${e.currency} `,n=e.amount_minor_units/100;return`${t}${n%1==0?n.toString():n.toFixed(2)}`}function E(){let e=i()?.organizationUuid;return e?a().passesEligibilityCache?.[e]?.referrer_reward??null:null}function D(){let e=i()?.organizationUuid;return e?a().passesEligibilityCache?.[e]?.remaining_passes??null:null}async function O(){if(M)return d(`Passes: Reusing in-flight eligibility fetch`),M;let e=i()?.organizationUuid;return e?(M=(async()=>{try{let t=await x(),n={...t,timestamp:Date.now()};return r(t=>({...t,passesEligibilityCache:{...t.passesEligibilityCache,[e]:n}})),d(`Passes eligibility cached for org ${e}: ${t.eligible}`),t}catch(e){return d(`Failed to fetch and cache passes eligibility`),_(e),null}finally{M=null}})(),M):null}async function k(){if(!C())return null;let e=i()?.organizationUuid;if(!e)return null;let t=a().passesEligibilityCache?.[e],n=Date.now();if(!t)return d(`Passes: No cache, fetching eligibility in background (command unavailable this session)`),O(),null;if(n-t.timestamp>j){d(`Passes: Cache stale, returning cached data and refreshing in background`),O();let{timestamp:e,...n}=t;return n}d(`Passes: Using fresh cached eligibility data`);let{timestamp:r,...o}=t;return o}async function A(){h()||k()}var j,M,N,P=e((()=>{n(),p(),s(),l(),u(),g(),m(),b(),j=1440*60*1e3,M=null,N={USD:`$`,EUR:`€`,GBP:`£`,BRL:`R$`,CAD:`CA$`,AUD:`A$`,NZD:`NZ$`,SGD:`S$`}}));export{E as a,A as c,k as i,S as n,D as o,T as r,P as s,w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{U as r,l as i,p as a,z as o}from"./debug-otxXY3j-.js";import{o as s,s as c}from"./log-DSV4Ht5l.js";import{Bh as l,Gh as u,Hh as d,Oc as f,Wh as p,Yp as m,
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{U as r,l as i,p as a,z as o}from"./debug-otxXY3j-.js";import{o as s,s as c}from"./log-DSV4Ht5l.js";import{Bh as l,Gh as u,Hh as d,Oc as f,Wh as p,Yp as m,ay as h,gc as g,hc as _,i as v,iy as y,kc as b,nT as x,o as S,qp as C,tT as w,vs as T,ys as E}from"./loadAgentsDir-ClTeo0nk.js";async function D(e){a(`refreshActivePlugins: clearing all plugin caches`),_(),C();let t=await E(),[r,i]=await Promise.all([f(),v(n())]),{enabled:s,disabled:l,errors:p}=t,[m,g]=await Promise.all([Promise.all(s.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await x(e,p);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(s.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await u(e,p);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),y=m.reduce((e,t)=>e+t,0),b=g.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:s,disabled:l,commands:r,errors:O(e.plugins.errors,p),needsRefresh:!1},agentDefinitions:i,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),d();let S=!1;try{await h()}catch(e){S=!0,c(e),a(`refreshActivePlugins: loadPluginHooks failed: ${o(e)}`)}let w=s.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 a(`refreshActivePlugins: ${s.length} enabled, ${r.length} commands, ${i.allAgents.length} agents, ${w} hooks, ${y} MCP, ${b} LSP`),{enabled_count:s.length,disabled_count:l.length,command_count:r.length,agent_count:i.allAgents.length,hook_count:w,mcp_count:y,lsp_count:b,error_count:p.length+ +!!S,agentDefinitions:i,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((()=>{t(),l(),S(),i(),r(),s(),g(),b(),y(),p(),w(),m(),T()}));export{D as n,A as t};
|