claude-code-best 2.5.0 → 2.6.5
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-BYyM_V0q.js +1 -0
- package/dist/chunks/App-BboadKdn.js +1 -0
- package/dist/chunks/ApproveApiKey-BLp4742y.js +1 -0
- package/dist/chunks/ApproveApiKey-DiEe4eui.js +1 -0
- package/dist/chunks/AssistantSessionChooser-B88DM0Oq.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-ByraVuXh.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-BDvmz12S.js +1 -0
- package/dist/chunks/ClaudeInChromeOnboarding-B6XNhFqq.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-B4ocUjev.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-BNhlq7_K.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-BvaB9b0y.js +1 -0
- package/dist/chunks/DesktopHandoff-S-w4bs5T.js +1 -0
- package/dist/chunks/DevChannelsDialog-BljR0X9X.js +1 -0
- package/dist/chunks/Dialog-DYFGqyDs.js +1 -0
- package/dist/chunks/DiffDialog-BhQ2QaLW.js +3 -0
- package/dist/chunks/Doctor-BXb0qv6n.js +3 -0
- package/dist/chunks/Doctor-C5DYPEGl.js +1 -0
- package/dist/chunks/ExitFlow-CSBDxw9H.js +2 -0
- package/dist/chunks/Feedback-DwHzc4UT.js +2 -0
- package/dist/chunks/Grove-DSXRnXKv.js +11 -0
- package/dist/chunks/Grove-DnTo982-.js +1 -0
- package/dist/chunks/HybridTransport-CuT3KI5e.js +4 -0
- package/dist/chunks/ITermBackend-mokGZVH_.js +1 -0
- package/dist/chunks/InProcessTransport-DB52dh4f.js +1 -0
- package/dist/chunks/InvalidConfigDialog-Bi4RKYlk.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-0zKo4-so.js +1 -0
- package/dist/chunks/ListItem-OFARanN7.js +1 -0
- package/dist/chunks/MCPConnectionManager-DYGoS1Ht.js +1 -0
- package/dist/chunks/McpParsingWarnings-EzgsOoHw.js +1 -0
- package/dist/chunks/MessageSelector-DTmUuEKJ.js +3 -0
- package/dist/chunks/Messages-DWiKTx5o.js +11 -0
- package/dist/chunks/Onboarding-odmthwzz.js +1 -0
- package/dist/chunks/OverageCreditUpsell-Cpk_5Lv0.js +1 -0
- package/dist/chunks/PermissionDialog-5MlJf7ew.js +1 -0
- package/dist/chunks/PluginSettings-eYcWehI8.js +17 -0
- package/dist/chunks/PressEnterToContinue-BdA9zDGs.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-DrrkNOuS.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-DMsF4D6d.js +1 -0
- package/dist/chunks/QueryEngine-C_KZts4y.js +1 -0
- package/dist/chunks/REPL-C6YR0VKU.js +1 -0
- package/dist/chunks/REPL-DzHz-LOY.js +97 -0
- package/dist/chunks/RemoteCallout-CnpCWRPk.js +1 -0
- package/dist/chunks/RemoteSessionManager-OWg_Yccq.js +2 -0
- package/dist/chunks/ResumeConversation-BktSnsCm.js +1 -0
- package/dist/chunks/SSETransport-BpnapvlK.js +4 -0
- package/dist/chunks/SearchBox-DfOmUoaI.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-CqFD8vVS.js +1 -0
- package/dist/chunks/SentryErrorBoundary-BUirJRWU.js +1 -0
- package/dist/chunks/SentryErrorBoundary-C-NlfQZw.js +2 -0
- package/dist/chunks/Settings-vfFvcweR.js +2 -0
- package/dist/chunks/TeleportProgress-CYXay2ZL.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-_zbZTvcJ.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-DiHQeZIM.js +1 -0
- package/dist/chunks/ThemePicker-BRh027fA.js +1 -0
- package/dist/chunks/TmuxBackend-BaX2U7iZ.js +9 -0
- package/dist/chunks/TrustDialog-CVbzrv6g.js +1 -0
- package/dist/chunks/TungstenTool-C5IqKVr0.js +1 -0
- package/dist/chunks/TungstenTool-V-Bwqlx3.js +1 -0
- package/dist/chunks/ValidationErrorsList-CdCUgfIl.js +2 -0
- package/dist/chunks/WelcomeV2-DCXcYd2x.js +1 -0
- package/dist/chunks/WindowsTerminalBackend-BE9NX5IH.js +2 -0
- package/dist/chunks/add-dir-ldGd3Ppz.js +1 -0
- package/dist/chunks/agentDisplay-CVnAeURF.js +1 -0
- package/dist/chunks/agents-C08NzRZx.js +2 -0
- package/dist/chunks/agents-DH5fmbVw.js +103 -0
- package/dist/chunks/ajv-B_OpU_Uh.js +8 -0
- package/dist/chunks/analytics-DqMQntaB.js +1 -0
- package/dist/chunks/ant-DJren1Aa.js +1 -0
- package/dist/chunks/api-6tcwJlf_.js +1 -0
- package/dist/chunks/api-CGOR_Xfl.js +1 -0
- package/dist/chunks/asciicast-aoKFhc7C.js +1 -0
- package/dist/chunks/asciicast-o5Zg4dJt.js +4 -0
- package/dist/chunks/assistant-BlzrMSkM.js +1 -0
- package/dist/chunks/assistant-CwbhlCM-.js +1 -0
- package/dist/chunks/assistant-aWkDcurV.js +1 -0
- package/dist/chunks/attributionHooks-PygdohOh.js +1 -0
- package/dist/chunks/attributionTrailer-BpvhXgRP.js +1 -0
- package/dist/chunks/auth-CSB2RDKF.js +1 -0
- package/dist/chunks/auth-GxZhOvQ1.js +1 -0
- package/dist/chunks/autoMode-CWvZs1jO.js +45 -0
- package/dist/chunks/autoModeDenials-Cp6VFdsm.js +1 -0
- package/dist/chunks/autonomy-BkVcSMCZ.js +19 -0
- package/dist/chunks/autonomy-DK42aJYt.js +1 -0
- package/dist/chunks/autonomyPanel-Cn4IhXgE.js +1 -0
- package/dist/chunks/axios-DLnc2dVy.js +1 -0
- package/dist/chunks/axios-DhfaybwJ.js +12 -0
- package/dist/chunks/backgroundHousekeeping-BIZTAYho.js +17 -0
- package/dist/chunks/backgroundHousekeeping-Csh58CxV.js +1 -0
- package/dist/chunks/banner-CVXH2xts.js +2 -0
- package/dist/chunks/base64-js-DIVSFswY.js +1 -0
- package/dist/chunks/bedrockClient-qi1-JCOK.js +15 -0
- package/dist/chunks/bg-DK0E4ZtW.js +9 -0
- package/dist/chunks/bg-Dbh5z3Y8.js +1 -0
- package/dist/chunks/branch-juox_fko.js +3 -0
- package/dist/chunks/break-cache-ByJ7U2Ts.js +8 -0
- package/dist/chunks/bridge-DudsCZkh.js +2 -0
- package/dist/chunks/bridgeConfig-D4tpc568.js +1 -0
- package/dist/chunks/bridgeConfig-lRZfQqmA.js +1 -0
- package/dist/chunks/bridgeEnabled-B8_c_Ppq.js +1 -0
- package/dist/chunks/bridgeEnabled-D2IykaHE.js +1 -0
- package/dist/chunks/bridgeMain-C5RDihlX.js +68 -0
- package/dist/chunks/bridgeMain-D7_lg2iJ.js +1 -0
- package/dist/chunks/bridgeMessaging-CqNURC4-.js +1 -0
- package/dist/chunks/bridgePointer-FvAMj3re.js +1 -0
- package/dist/chunks/browser-fLRXxIsQ.js +1 -0
- package/dist/chunks/btw-DKlE3Dea.js +1 -0
- package/dist/chunks/buddy-DQYgHR63.js +3 -0
- package/dist/chunks/bundledMode-kSQejuY4.js +1 -0
- package/dist/chunks/bypassPermissionsKillswitch-Bof-UtM-.js +1 -0
- package/dist/chunks/caches-B5QZDncQ.js +3 -0
- package/dist/chunks/caches-dGk7xsDu.js +1 -0
- package/dist/chunks/capacityWake-BXlUpptF.js +1 -0
- package/dist/chunks/ccrClient-BaWg4E9-.js +1 -0
- package/dist/chunks/ccshareResume-DWLjTF22.js +1 -0
- package/dist/chunks/changeDetector-DoLfg8a6.js +1 -0
- package/dist/chunks/channelNotification-B7A-9DIl.js +1 -0
- package/dist/chunks/channelNotification-DDErroWn.js +1 -0
- package/dist/chunks/chokidar-BcI3rIKm.js +1 -0
- package/dist/chunks/chokidar-SzksMqYp.js +1 -0
- package/dist/chunks/chrome-jMAks7-w.js +1 -0
- package/dist/chunks/chromeNativeHost-4U39yLtd.js +1 -0
- package/dist/chunks/chunk-DR8-3Aex.js +1 -0
- package/dist/chunks/classPrivateFieldSet2-EAQNhHs8.js +1 -0
- package/dist/chunks/claudeDesktop-D0S1eq1F.js +1 -0
- package/dist/chunks/cleanup-Bg_gFgcj.js +1 -0
- package/dist/chunks/clear-OudnCGa7.js +1 -0
- package/dist/chunks/cliLaunch-BQa48gsr.js +1 -0
- package/dist/chunks/client-CPn1wQyc.js +7 -0
- package/dist/chunks/client-DxDmXXTh.js +1 -0
- package/dist/chunks/client-_sjL0I7A.js +35 -0
- package/dist/chunks/color-DG_R5-hl.js +1 -0
- package/dist/chunks/color-convert-ULbeSgNC.js +1 -0
- package/dist/chunks/commands-BWIOEBPs.js +1 -0
- package/dist/chunks/commitAttribution-BA4fcbHf.js +1 -0
- package/dist/chunks/commitAttribution-C22a3OCi.js +2 -0
- package/dist/chunks/common-B379wT22.js +1 -0
- package/dist/chunks/common-B_BC3eMY.js +1 -0
- package/dist/chunks/common-CMCv4N_v.js +1 -0
- package/dist/chunks/compact-BWvnb4or.js +3 -0
- package/dist/chunks/companion-Bkn2lSLj.js +1 -0
- package/dist/chunks/completionCache-DHfUBBMH.js +1 -0
- package/dist/chunks/completionCache-DORrtxkS.js +4 -0
- package/dist/chunks/computerUseLock-BjoDJH2h.js +1 -0
- package/dist/chunks/config-BvpTbJ5p.js +1 -0
- package/dist/chunks/config-D-dzD6n-.js +1 -0
- package/dist/chunks/connectHeadless-CwsFt-Mh.js +1 -0
- package/dist/chunks/constants-41VpZw2G.js +1 -0
- package/dist/chunks/context-DzNahdyP.js +1 -0
- package/dist/chunks/context-noninteractive-CM1-lUSe.js +1 -0
- package/dist/chunks/context-noninteractive-yiyJriiw.js +54 -0
- package/dist/chunks/controlMessageCompat-BJhFiS7u.js +1 -0
- package/dist/chunks/conversation-DKlz47xf.js +1 -0
- package/dist/chunks/conversation-cUxdb8MN.js +1 -0
- package/dist/chunks/copy-9k9JPRqW.js +7 -0
- package/dist/chunks/createSSHSession-BZf-Loo5.js +6 -0
- package/dist/chunks/createSession-BuJcoBAj.js +1 -0
- package/dist/chunks/createSession-kiTHYXSL.js +1 -0
- package/dist/chunks/cron-DiW7eIPP.js +1 -0
- package/dist/chunks/cronJitterConfig-CYP7yrQu.js +6 -0
- package/dist/chunks/crossProjectResume-BJisir9Z.js +40 -0
- package/dist/chunks/cwd--iizewsn.js +1 -0
- package/dist/chunks/cwd-BgpSJxd7.js +1 -0
- package/dist/chunks/daemon-VYRit6Aq.js +2 -0
- package/dist/chunks/dangerousBackend-BU_PHGR2.js +1 -0
- package/dist/chunks/datadog-Bg-zL-i7.js +1 -0
- package/dist/chunks/datadog-CVeFkaQu.js +1 -0
- package/dist/chunks/debug-DM5ezCBS.js +1 -0
- package/dist/chunks/debug-UI3T040K.js +5 -0
- package/dist/chunks/debugUtils-BBMFODKH.js +1 -0
- package/dist/chunks/defineProperty-80gRi2ZW.js +1 -0
- package/dist/chunks/desktop-DpaStjc-.js +1 -0
- package/dist/chunks/detached-D300jlhj.js +5 -0
- package/dist/chunks/detect-libc-DNuQfUvI.js +1 -0
- package/dist/chunks/detectRepository-CBk3S2zv.js +1 -0
- package/dist/chunks/detectRepository-DCTvg4p0.js +1 -0
- package/dist/chunks/detection-CQsNad64.js +1 -0
- package/dist/chunks/detection-DJ-vTbBf.js +1 -0
- package/dist/chunks/diff-N_VSBo3Z.js +1 -0
- package/dist/chunks/directoryCompletion-DP_4B1GL.js +1 -0
- package/dist/chunks/dist-CanSxOZ1.js +5 -0
- package/dist/chunks/dist-Cg1a1Exw.js +29 -0
- package/dist/chunks/dist-Q7YNoZ0H.js +20 -0
- package/dist/chunks/dist-es-4z5T3Jzm.js +1 -0
- package/dist/chunks/dist-es-B2jg52tM2.js +1 -0
- package/dist/chunks/dist-es-B6OXHQ1S.js +1 -0
- package/dist/chunks/dist-es-B8NEy5hc.js +1 -0
- package/dist/chunks/dist-es-BVGppqE4.js +1 -0
- package/dist/chunks/dist-es-Bcw5GZko.js +1 -0
- package/dist/chunks/dist-es-BoIJpncb.js +9 -0
- package/dist/chunks/dist-es-Bu_Fshi1.js +1 -0
- package/dist/chunks/dist-es-C-1vn4OP2.js +1 -0
- package/dist/chunks/dist-es-C41b_0B5.js +1 -0
- package/dist/chunks/dist-es-CCZYybbG2.js +1 -0
- package/dist/chunks/dist-es-CLK1mey-.js +1 -0
- package/dist/chunks/dist-es-CQz2aNf72.js +1 -0
- package/dist/chunks/dist-es-CSfI8B8l.js +1 -0
- package/dist/chunks/dist-es-CUZBYppo.js +1 -0
- package/dist/chunks/dist-es-CZkzHpjF.js +1 -0
- package/dist/chunks/dist-es-Cbf0_D8d.js +5 -0
- package/dist/chunks/dist-es-ChHe-SVL.js +1 -0
- package/dist/chunks/dist-es-ClYOf0My.js +1 -0
- package/dist/chunks/dist-es-D-kJbj4A2.js +1 -0
- package/dist/chunks/dist-es-D1LN6CJd.js +1 -0
- package/dist/chunks/dist-es-DC1sC3ph.js +1 -0
- package/dist/chunks/dist-es-DGn8uOwQ2.js +1 -0
- package/dist/chunks/dist-es-DK5fTeKM2.js +1 -0
- package/dist/chunks/dist-es-DN7otr6F.js +1 -0
- package/dist/chunks/dist-es-DPM0mPK5.js +1 -0
- package/dist/chunks/dist-es-DqZAh3nG.js +1 -0
- package/dist/chunks/dist-es-DuAZyxJ02.js +5 -0
- package/dist/chunks/dist-es-HVQrM0oE.js +1 -0
- package/dist/chunks/dist-es-OVleIB54.js +1 -0
- package/dist/chunks/dist-es-UAs0rdXg.js +1 -0
- package/dist/chunks/dist-es-WvMMuHmx2.js +1 -0
- package/dist/chunks/dist-es-fjXft-jH.js +1 -0
- package/dist/chunks/dist-es-hdN_ShpZ.js +3 -0
- package/dist/chunks/dist-es-neiUvMJb.js +1 -0
- package/dist/chunks/dist-es-yMYpDtui2.js +1 -0
- package/dist/chunks/dist-es-zjcbuB72.js +1 -0
- package/dist/chunks/distRoot-CcxmnzqQ.js +1 -0
- package/dist/chunks/doctor-CUWjbh1X.js +1 -0
- package/dist/chunks/earlyInput-JGJo1zcC.js +1 -0
- package/dist/chunks/earlyInput-tRkbxFv2.js +2 -0
- package/dist/chunks/effort-loH1TUvE.js +9 -0
- package/dist/chunks/entry-D58E-E6Y.js +14 -0
- package/dist/chunks/env-chR0gV31.js +1 -0
- package/dist/chunks/envLessBridgeConfig-CT8sdmFu.js +1 -0
- package/dist/chunks/envLessBridgeConfig-SPEr9oqO.js +1 -0
- package/dist/chunks/envUtils-BWeoiL4Y.js +1 -0
- package/dist/chunks/escHotkey-Cyz0yyh1.js +259 -0
- package/dist/chunks/esm--xjzB1hI.js +1 -0
- package/dist/chunks/esm-B2HIF0XY.js +1 -0
- package/dist/chunks/esm-BGQPWnJy.js +1 -0
- package/dist/chunks/esm-C-1qL9Mn.js +1 -0
- package/dist/chunks/esm-C3jcs1DH.js +1 -0
- package/dist/chunks/esm-C97WL9nC.js +1 -0
- package/dist/chunks/esm-CIL-SKM8.js +1 -0
- package/dist/chunks/esm-CJlBxjtx.js +1 -0
- package/dist/chunks/esm-CsGLyWmS.js +56 -0
- package/dist/chunks/esm-DQHmDm-H.js +1 -0
- package/dist/chunks/esm-DcdOXSzi.js +1 -0
- package/dist/chunks/esm-DhNYgGTV.js +1 -0
- package/dist/chunks/esm-DxPW7qPs.js +1 -0
- package/dist/chunks/esm-FBUWr3vI.js +1 -0
- package/dist/chunks/esm-QgL6y---.js +10 -0
- package/dist/chunks/esm-v0kPjgVS.js +1 -0
- package/dist/chunks/esm-vIn-YV_h.js +1 -0
- package/dist/chunks/event-streams-BV7ngMXu.js +1 -0
- package/dist/chunks/eventLoopStallDetector-Dnh1fc31.js +1 -0
- package/dist/chunks/execAsync-BkA6ogic.js +1 -0
- package/dist/chunks/execFileNoThrow-CuQN1sz8.js +1 -0
- package/dist/chunks/execSyncWrapper-C2XQnFVo.js +1 -0
- package/dist/chunks/execa-CGue6Z3n.js +34 -0
- package/dist/chunks/executor-4EeD8GNm.js +1561 -0
- package/dist/chunks/executor-BHEuNh5F.js +1 -0
- package/dist/chunks/exit-D-tuPpbx.js +1 -0
- package/dist/chunks/exit-_obETqBv.js +2 -0
- package/dist/chunks/export-BIZ_SPXJ.js +2 -0
- package/dist/chunks/exportRenderer-CWPSMaqM.js +1 -0
- package/dist/chunks/extra-usage-CCMwIa85.js +1 -0
- package/dist/chunks/extra-usage-core-BNW4VT7o.js +1 -0
- package/dist/chunks/extra-usage-noninteractive-B_WjXO1E.js +1 -0
- package/dist/chunks/extra-usage-rdJ7ecEb.js +1 -0
- package/dist/chunks/extraUsage-CNMMTNJi.js +1 -0
- package/dist/chunks/extractMemories-BrvZVsmM.js +1 -0
- package/dist/chunks/fast-CG1v3fRr.js +1 -0
- package/dist/chunks/fast-CLKKsx2H.js +1 -0
- package/dist/chunks/featureCheck-Cm0YNDXO.js +1 -0
- package/dist/chunks/featureCheck-p7OeCYzj.js +1 -0
- package/dist/chunks/feedback-CG4mS_-B.js +1 -0
- package/dist/chunks/figures-gfT9mM8P.js +1 -0
- package/dist/chunks/fileStateCache-C7-TxF8G.js +1 -0
- package/dist/chunks/files-DYvAZGxp.js +2 -0
- package/dist/chunks/firstPartyEventLogger-Y_jAnHoR.js +1 -0
- package/dist/chunks/flushGate-COPcye5f.js +1 -0
- package/dist/chunks/foundry-sdk-BFN5VDFQ.js +1 -0
- package/dist/chunks/fpsMetrics-DeezdcwV.js +1 -0
- package/dist/chunks/fuse-Ch_OAlm3.js +1 -0
- package/dist/chunks/gates-CSHuXnUx.js +1 -0
- package/dist/chunks/gates-CSKxLmMJ.js +1 -0
- package/dist/chunks/gemini-B3uSLiNp.js +1 -0
- package/dist/chunks/generateRecap-D7rG3jIm.js +1 -0
- package/dist/chunks/generateSessionName-zbqanivg.js +1 -0
- package/dist/chunks/genericProcessUtils-BGvcwuPt.js +23 -0
- package/dist/chunks/getMachineId-bsd-BMtYGBUL.js +1 -0
- package/dist/chunks/getMachineId-darwin-CiLdFH7z.js +2 -0
- package/dist/chunks/getMachineId-linux-Cr27rIeY.js +1 -0
- package/dist/chunks/getMachineId-unsupported-ceiBLwAN.js +1 -0
- package/dist/chunks/getMachineId-win-DFTmsQHq.js +1 -0
- package/dist/chunks/git-CN3qtTb_.js +6 -0
- package/dist/chunks/git-D23Mzu_K.js +1 -0
- package/dist/chunks/githubRepoPathMapping-B04nEUDG.js +1 -0
- package/dist/chunks/graceful-fs-Cgc0rjGF.js +2 -0
- package/dist/chunks/grok-CDOpos8E.js +1 -0
- package/dist/chunks/growthbook-C_EY78Sn.js +1 -0
- package/dist/chunks/hash-BRmOQc3c.js +1 -0
- package/dist/chunks/heapdump-CpmhJ55b.js +5 -0
- package/dist/chunks/help-EHn2neTv.js +1 -0
- package/dist/chunks/hooks-BFdX17Za.js +1 -0
- package/dist/chunks/hooks-BV6HqbU4.js +79 -0
- package/dist/chunks/hostAdapter-_SmFAVNf.js +1 -0
- package/dist/chunks/hostGuard-zim_4F9V.js +1 -0
- package/dist/chunks/httpAuthSchemes-Wq4XWeLL.js +13 -0
- package/dist/chunks/ide-DkN0KdTR.js +2 -0
- package/dist/chunks/inboundAttachments-BVUunfAX.js +1 -0
- package/dist/chunks/inboundAttachments-DnGQw7Pf.js +1 -0
- package/dist/chunks/index.min-BJnb9GQI.js +1 -0
- package/dist/chunks/initReplBridge-tPRGPBq7.js +1 -0
- package/dist/chunks/insights-Bs9kJDG6.js +822 -0
- package/dist/chunks/install-CFX_ph9z.js +1 -0
- package/dist/chunks/install-github-app-CvRjY1Wi.js +147 -0
- package/dist/chunks/install-slack-app-DjhnVSe0.js +1 -0
- package/dist/chunks/instinctParser-DHMa8xa0.js +1 -0
- package/dist/chunks/instrumentation-c5zlOWom.js +12 -0
- package/dist/chunks/intl-Pse97ORk.js +1 -0
- package/dist/chunks/isObject-DaxDnPKm.js +1 -0
- package/dist/chunks/isSymbol-Dp3irZaY.js +1 -0
- package/dist/chunks/job-3QwLq609.js +2 -0
- package/dist/chunks/json-bigint-OxRwRvup.js +8 -0
- package/dist/chunks/jsx-runtime-D-D469L8.js +1 -0
- package/dist/chunks/jws-2vqRyZtR.js +3 -0
- package/dist/chunks/jwtUtils-CpXwh_du.js +1 -0
- package/dist/chunks/keybindings-7mDm3UKD.js +2 -0
- package/dist/chunks/lang-DyyjY20G.js +1 -0
- package/dist/chunks/language-CPRGmY8Q.js +1 -0
- package/dist/chunks/language-Cf6bMI4N.js +1 -0
- package/dist/chunks/launchAgentsPlatform-CpsMsTqQ.js +1 -0
- package/dist/chunks/launchAutofixPr-D9h6YAZY.js +2 -0
- package/dist/chunks/launchCommand-Du91jxMC.js +1 -0
- package/dist/chunks/launchLocalMemory-DlYQcEQJ.js +3 -0
- package/dist/chunks/launchLocalVault-CP0AyPjj.js +3 -0
- package/dist/chunks/launchMemoryStores-BHoDFkJ5.js +1 -0
- package/dist/chunks/launchOnboarding-CFTNXcnc.js +8 -0
- package/dist/chunks/launchSchedule-5KQr6x_A.js +1 -0
- package/dist/chunks/launchSkillStore-D0yGuE68.js +1 -0
- package/dist/chunks/launchTeleport-DRKnXOwY.js +3 -0
- package/dist/chunks/launchVault-XA-zAswX.js +1 -0
- package/dist/chunks/lazySchema-2sOku3cX.js +1 -0
- package/dist/chunks/lib-B4Q0Nrpb.js +14 -0
- package/dist/chunks/lib-Ca3QWJjN.js +2 -0
- package/dist/chunks/lib-inCisXen.js +8 -0
- package/dist/chunks/loadAgentsDir-DCyiY0MN.js +1 -0
- package/dist/chunks/loadAgentsDir-DI1a76pd.js +4601 -0
- package/dist/chunks/loadPluginHooks-C0Ei-0E2.js +1 -0
- package/dist/chunks/loadSso-sDs471GC.js +1 -0
- package/dist/chunks/localSearch-CDOJNc_E.js +1 -0
- package/dist/chunks/localSearch-MBx7KzC2.js +1 -0
- package/dist/chunks/lockfile-DBwdlC3K.js +1 -0
- package/dist/chunks/log-CzsijfHZ.js +1 -0
- package/dist/chunks/login-D8UKKaud.js +1 -0
- package/dist/chunks/login-nwTOoyxv.js +1 -0
- package/dist/chunks/logoV2Utils-DDUoPClc.js +1 -0
- package/dist/chunks/logout-B0BjqlGi.js +1 -0
- package/dist/chunks/magicDocs-CmUlOWjI.js +57 -0
- package/dist/chunks/main-C6be1KFk.js +31 -0
- package/dist/chunks/main-CeG_nUsC.js +1108 -0
- package/dist/chunks/mappers-CJ8IO1o1.js +1 -0
- package/dist/chunks/mcp-CanCqnch.js +2 -0
- package/dist/chunks/mcp-Dq0kxZFx.js +6 -0
- package/dist/chunks/mcp-zbxZM9BP.js +1 -0
- package/dist/chunks/mcpServer-DPHQVYdC.js +1 -0
- package/dist/chunks/mcpServer-lIneUZ5p.js +1 -0
- package/dist/chunks/memoize-DNnuA2aU.js +1 -0
- package/dist/chunks/memoize-DxwLawI2.js +1 -0
- package/dist/chunks/memory-BcWBkKV8.js +1 -0
- package/dist/chunks/mobile-umu5P0cM.js +2 -0
- package/dist/chunks/modalContext-CmSKRyea.js +1 -0
- package/dist/chunks/model-DJLzVvcF.js +1 -0
- package/dist/chunks/model-H3rtl6eR.js +1 -0
- package/dist/chunks/normalization-Cox8C0dP.js +1 -0
- package/dist/chunks/oauth-CdZEzMww.js +1 -0
- package/dist/chunks/oauth-CmensepG.js +1 -0
- package/dist/chunks/observationStore-tvkldXUo.js +4 -0
- package/dist/chunks/onChangeAppState-Dxbl8fvk.js +1 -0
- package/dist/chunks/open-CDditBQ-.js +1 -0
- package/dist/chunks/openai-DkYK4THc.js +10 -0
- package/dist/chunks/openaiShared-D5lOejS1.js +16 -0
- package/dist/chunks/output-style-XDb9-2Kk.js +1 -0
- package/dist/chunks/overageCreditGrant-DLKadMYU.js +1 -0
- package/dist/chunks/p-map-9Ud1LOrJ.js +1 -0
- package/dist/chunks/p-map-D7WEmnBE.js +1 -0
- package/dist/chunks/package-BhL7chzt.js +1 -0
- package/dist/chunks/panel-ByW1omJn.js +1 -0
- package/dist/chunks/panel-Bz_8td5D.js +1 -0
- package/dist/chunks/parseConnectUrl-BS6i9JPo.js +1 -0
- package/dist/chunks/parser-CmngCwjB.js +1 -0
- package/dist/chunks/parser-SWIZo39J.js +1 -0
- package/dist/chunks/passes-BIfuerjL.js +1 -0
- package/dist/chunks/path-C4kbwvSH.js +1 -0
- package/dist/chunks/paths-BBvuDQl9.js +39 -0
- package/dist/chunks/permissions-DXLfdE7b.js +1 -0
- package/dist/chunks/permissions-Ps_D01ZB.js +1 -0
- package/dist/chunks/permissions-S2EvIRKj.js +3 -0
- package/dist/chunks/pipeTransport-DVoIA1uN.js +1 -0
- package/dist/chunks/plan--lnWxB3Q.js +1 -0
- package/dist/chunks/platform-CuyedWpe.js +2 -0
- package/dist/chunks/plist-BO4ZqMZc.js +6 -0
- package/dist/chunks/plugin-DWLyrLw4.js +1 -0
- package/dist/chunks/pluginAutoupdate-CGXIWBrb.js +1 -0
- package/dist/chunks/pluginBlocklist-DJrMdzT0.js +1 -0
- package/dist/chunks/pluginCliCommands-C08q9dHk.js +1 -0
- package/dist/chunks/pluginFlagging-Dggxke70.js +1 -0
- package/dist/chunks/pluginOperations-CNCImIe8.js +2 -0
- package/dist/chunks/pluginStartupCheck-BW2fjg2P.js +1 -0
- package/dist/chunks/pluginStartupCheck-DpxQPXJE.js +1 -0
- package/dist/chunks/plugins-DQ3CRWWO.js +4 -0
- package/dist/chunks/policyLimits-BotYrS-v.js +1 -0
- package/dist/chunks/pollConfig-DAQ-ives.js +1 -0
- package/dist/chunks/poller-Ds0Y6Cir.js +1 -0
- package/dist/chunks/poor-DqfrQT61.js +1 -0
- package/dist/chunks/poorMode-DEAe3hiK.js +1 -0
- package/dist/chunks/poorMode-DzYT47KW.js +1 -0
- package/dist/chunks/postCommitAttribution-Ehmwzzuq.js +1 -0
- package/dist/chunks/print-GGVp62vj.js +39 -0
- package/dist/chunks/privacy-settings-agwqjYJo.js +1 -0
- package/dist/chunks/process-CWupreF6.js +1 -0
- package/dist/chunks/process-DMKLUQIO.js +1 -0
- package/dist/chunks/processBashCommand-DHHN8Ca4.js +1 -0
- package/dist/chunks/processSlashCommand-COtIO6Jy.js +6 -0
- package/dist/chunks/projectContext-0fpRKUeH.js +1 -0
- package/dist/chunks/projectContext-eXMSfgdZ.js +1 -0
- package/dist/chunks/prompt-4tea6NJQ.js +54 -0
- package/dist/chunks/prompt-CO160cIr.js +1 -0
- package/dist/chunks/prompt-CjFAtm3w.js +222 -0
- package/dist/chunks/prompt-GY9hlRvI.js +1 -0
- package/dist/chunks/promptEditor-EgosPsy-.js +4 -0
- package/dist/chunks/protocolHandler-mtPUT9U0.js +13 -0
- package/dist/chunks/protocols-CAyQOlkr.js +7 -0
- package/dist/chunks/proxy-CfZp-wce.js +99 -0
- package/dist/chunks/rate-limit-options-C6SFOHue.js +1 -0
- package/dist/chunks/rcDebugLog-CPKZCtR8.js +11 -0
- package/dist/chunks/referral-DeDr9zAE.js +1 -0
- package/dist/chunks/refresh-D7pdoY_X.js +1 -0
- package/dist/chunks/registerProtocol-BZBH8Zgl.js +36 -0
- package/dist/chunks/registry-Dz6AbiYP.js +1 -0
- package/dist/chunks/release-notes-DiUNOrg9.js +4 -0
- package/dist/chunks/releaseNotes-CnhQit0y.js +2 -0
- package/dist/chunks/reload-plugins-Dx52GcaG.js +1 -0
- package/dist/chunks/remote-env-B67Oo3sI.js +1 -0
- package/dist/chunks/remoteBridgeCore-BzSUgPbt.js +1 -0
- package/dist/chunks/remoteControlServer-L8smP7Zu.js +3 -0
- package/dist/chunks/rename-C4PauyTZ.js +1 -0
- package/dist/chunks/renderOptions-BiyC2rj1.js +1 -0
- package/dist/chunks/resume-CrSn26xq.js +2 -0
- package/dist/chunks/rewind-CXplHgh_.js +1 -0
- package/dist/chunks/rollback-DbSpxmJE.js +11 -0
- package/dist/chunks/runtimeObserver-YNy3mIb7.js +1 -0
- package/dist/chunks/runtimeObserver-nAhH4Wca.js +10 -0
- package/dist/chunks/sandbox-adapter-CzwHes1i.js +1 -0
- package/dist/chunks/sandbox-toggle-BYqbcI5d.js +1 -0
- package/dist/chunks/sanitization-CYp-9DbE.js +1 -0
- package/dist/chunks/satisfies-BaHgd_ie.js +1 -0
- package/dist/chunks/schemas-BGAvj1T4.js +40 -0
- package/dist/chunks/sdk-DEtgRZvI.js +1 -0
- package/dist/chunks/sdkHeapDumpMonitor--fevrC5z.js +1 -0
- package/dist/chunks/searchExtraTools-CcpdCO6l.js +1 -0
- package/dist/chunks/semver-Cq33BYay.js +1 -0
- package/dist/chunks/semver-Tw0AFar5.js +1 -0
- package/dist/chunks/sentry-BNVxoVLS.js +13 -0
- package/dist/chunks/server-C5XZSlto.js +1 -0
- package/dist/chunks/server-DzOdtq8A.js +1 -0
- package/dist/chunks/serverBanner-WlSYP-f8.js +1 -0
- package/dist/chunks/serverLog-DtsUvDiY.js +1 -0
- package/dist/chunks/session-BuEmHrqM.js +2 -0
- package/dist/chunks/sessionDataUploader-Ctjo1bgR.js +1 -0
- package/dist/chunks/sessionDiscovery-Mcsfa0g-.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-qnNiGMnE.js +1 -0
- package/dist/chunks/sessionManager-Dw72ZUTg.js +1 -0
- package/dist/chunks/sessionMemory-CMahwDdW.js +1 -0
- package/dist/chunks/sessionMemory-pFSn4HSN.js +1 -0
- package/dist/chunks/sessionMemoryUtils-Du5jUl7M.js +1 -0
- package/dist/chunks/sessionObserver-DG2zQgfi.js +20 -0
- package/dist/chunks/sessionObserver-Je868MC9.js +1 -0
- package/dist/chunks/sessionStorage-D3FhAADV.js +1 -0
- package/dist/chunks/sessionStoragePortable-BI9q2WcJ.js +3 -0
- package/dist/chunks/sessionTitle-zUVSAHO7.js +14 -0
- package/dist/chunks/sessionTracing-DoRJ4nSa.js +11 -0
- package/dist/chunks/settingsSync-B9bz77E1.js +1 -0
- package/dist/chunks/setup-B1JbPepL.js +9 -0
- package/dist/chunks/setup-CCOLlRtP.js +1 -0
- package/dist/chunks/setup-DWkSjA49.js +2 -0
- package/dist/chunks/shadowedRuleDetection-BBR3uEgx.js +1 -0
- package/dist/chunks/shellQuote-DgjT8KBA.js +1 -0
- package/dist/chunks/sideQuestion-DHW5rgKz.js +20 -0
- package/dist/chunks/signin-QEeYpJZw.js +1 -0
- package/dist/chunks/sink-DxDOsLa2.js +1 -0
- package/dist/chunks/sink-cQOgsnw3.js +1 -0
- package/dist/chunks/sinks-BrrTUxkC.js +2 -0
- package/dist/chunks/sinks-Djiz_5-Z.js +1 -0
- package/dist/chunks/skill-learning-C0nOKZfg.js +5 -0
- package/dist/chunks/skillChangeDetector-D8C-uQSQ.js +1 -0
- package/dist/chunks/skillGapStore-Czi5jKjJ.js +1 -0
- package/dist/chunks/skillGapStore-_YuJP5KI.js +5 -0
- package/dist/chunks/skillGenerator-kbaRbpqJ.js +8 -0
- package/dist/chunks/skillLearning-3KWrBczS.js +1 -0
- package/dist/chunks/skillLearning-DBbdGbk-.js +1 -0
- package/dist/chunks/skillPanel-BxDvlPzd.js +28 -0
- package/dist/chunks/skillSearchPanel-D-MX6Qgt.js +21 -0
- package/dist/chunks/skills-NpEgFkFZ.js +1 -0
- package/dist/chunks/slashCommandParsing-Cari0pNg.js +1 -0
- package/dist/chunks/sleep-8Eb9j_Ly.js +1 -0
- package/dist/chunks/sprites-DD4eIkN7.js +1 -0
- package/dist/chunks/src-BIPP3_mo.js +26 -0
- package/dist/chunks/src-BJz1KAd_.js +6 -0
- package/dist/chunks/src-BRAdBA8A.js +1 -0
- package/dist/chunks/src-BRC_BuUP.js +1 -0
- package/dist/chunks/src-BaB-bpCj.js +5 -0
- package/dist/chunks/src-BlLavFUS.js +7 -0
- package/dist/chunks/src-C5yhFG0C.js +19 -0
- package/dist/chunks/src-CI_jaaBj.js +2 -0
- package/dist/chunks/src-CRsA-Z4y.js +1 -0
- package/dist/chunks/src-CYLfL70h.js +1 -0
- package/dist/chunks/src-DJXCzwyJ.js +1 -0
- package/dist/chunks/src-DJXKJavk.js +1 -0
- package/dist/chunks/src-Di342QoJ.js +53 -0
- package/dist/chunks/src-DsMd9Q9e.js +2 -0
- package/dist/chunks/src-DzH9IdOo.js +1 -0
- package/dist/chunks/src-hdbPEvzO.js +9 -0
- package/dist/chunks/src-poaoYkuc.js +1 -0
- package/dist/chunks/src-x7u_sB6m.js +1 -0
- package/dist/chunks/sso-oidc-BX1MlBX0.js +1 -0
- package/dist/chunks/startupProfiler-DnXZaX4A.js +3 -0
- package/dist/chunks/startupProfiler-SOE--nM9.js +1 -0
- package/dist/chunks/state-B2GIOsTB.js +1 -0
- package/dist/chunks/state-Ce1HlR-H.js +1 -0
- package/dist/chunks/state-sIHsFpDu.js +1 -0
- package/dist/chunks/staticRender-Br64h1E1.js +1 -0
- package/dist/chunks/stats-xL3NHwhp.js +1 -0
- package/dist/chunks/status-B5E70xRv.js +1 -0
- package/dist/chunks/statusNoticeHelpers-DcssRhLw.js +1 -0
- package/dist/chunks/stdio-BEEzuxaZ.js +1 -0
- package/dist/chunks/stdio-D4cT86R0.js +3 -0
- package/dist/chunks/stickers-2K05wjSp.js +1 -0
- package/dist/chunks/store-DhI7Lcan.js +1 -0
- package/dist/chunks/sts-BDFJ-6QE.js +1 -0
- package/dist/chunks/subprocessEnv-CggQWZCx.js +1 -0
- package/dist/chunks/subprocessEnv-DV6q6o6w.js +1 -0
- package/dist/chunks/supports-color-lkzOMQ6u.js +1 -0
- package/dist/chunks/systemPromptSections-BcN_XBTx.js +1 -0
- package/dist/chunks/systemPromptSections-DB93ZNWP.js +1 -0
- package/dist/chunks/systemTheme-dDbitcxB.js +1 -0
- package/dist/chunks/tag-BELr-qIa.js +11 -0
- package/dist/chunks/tasks-CrdWcSt-.js +1 -0
- package/dist/chunks/teamHelpers--3ZyNDlv.js +1 -0
- package/dist/chunks/teamHelpers-CUAiXng3.js +1 -0
- package/dist/chunks/teammate-DMYOtLTK.js +1 -0
- package/dist/chunks/teammateModeSnapshot-C6EWhR0X.js +1 -0
- package/dist/chunks/teammateModeSnapshot-DOQMTKbQ.js +1 -0
- package/dist/chunks/teleport-LXFOan9C.js +1 -0
- package/dist/chunks/templateJobs-8IY2Cgig.js +12 -0
- package/dist/chunks/terminalSetup-C4psrmpb.js +1 -0
- package/dist/chunks/terminalSetup-Lyg4NbGA.js +33 -0
- package/dist/chunks/theme-B8GNnJ_q.js +1 -0
- package/dist/chunks/thinkback-DPXwEK3B.js +1 -0
- package/dist/chunks/thinkback-DZW3Mcx_.js +1 -0
- package/dist/chunks/thinkback-play-BMOE-ceh.js +1 -0
- package/dist/chunks/tmux-CvbhsfwG.js +1 -0
- package/dist/chunks/toolEventObserver-D0TSHm01.js +1 -0
- package/dist/chunks/toolEventObserver-DzLd0MSn.js +1 -0
- package/dist/chunks/toolPool-DVOfpjDz.js +1 -0
- package/dist/chunks/toolPool-Dq-Vtvrj.js +1 -0
- package/dist/chunks/trustedDevice-1iTu4LEm.js +1 -0
- package/dist/chunks/trustedDevice-BvYYXfd8.js +1 -0
- package/dist/chunks/tui-BVc2q4Xv.js +6 -0
- package/dist/chunks/turndown.es-Bv06VjMb.js +69 -0
- package/dist/chunks/types-CQ1wrnQ0.js +1 -0
- package/dist/chunks/types-Csi32ZXh.js +17 -0
- package/dist/chunks/types-RJTEOuIt.js +3 -0
- package/dist/chunks/udsClient-BvG_Jip0.js +1 -0
- package/dist/chunks/ultrareviewCommand-BTXAN2wP.js +3 -0
- package/dist/chunks/undercover-C_44e3oN.js +1 -0
- package/dist/chunks/undercover-DvvnEmsX.js +31 -0
- package/dist/chunks/up-D-U4wUCe.js +12 -0
- package/dist/chunks/updateCCB-C-qfLi0j.js +11 -0
- package/dist/chunks/upgrade-CGXa5Dwy.js +1 -0
- package/dist/chunks/upgrade-DTBZSxwv.js +1 -0
- package/dist/chunks/upload-BF8tf_Eo.js +1 -0
- package/dist/chunks/upstreamproxy-DcLeL2XX.js +11 -0
- package/dist/chunks/usage-BRYRRgNt.js +1 -0
- package/dist/chunks/usage-DvSTXEYY.js +1 -0
- package/dist/chunks/useKeybinding-FsOnjW6T.js +1 -0
- package/dist/chunks/useMainLoopModel-CwvuTRXn.js +1 -0
- package/dist/chunks/useManagePlugins-GmnI9K53.js +1 -0
- package/dist/chunks/useMergedTools-Dah5KDMi.js +1 -0
- package/dist/chunks/useSearchInput-BV_azHiA.js +1 -0
- package/dist/chunks/useSettingsErrors-C-j_Zt7g.js +1 -0
- package/dist/chunks/useVoice-DR69NLxp.js +1 -0
- package/dist/chunks/util-BpyJ4Bom.js +1 -0
- package/dist/chunks/utils-CrZcpypC.js +1 -0
- package/dist/chunks/v4-f1i_CNUT.js +1 -0
- package/dist/chunks/validatePlugin-vptAYuYu.js +1 -0
- package/dist/chunks/vertex-sdk-CSGw3fvU.js +9 -0
- package/dist/chunks/vim-DvOw8dfR.js +1 -0
- package/dist/chunks/voice-B3BZs53f.js +2 -0
- package/dist/chunks/voice-DXiiy8HX.js +8 -0
- package/dist/chunks/voiceModeEnabled-DA76xN1Q.js +1 -0
- package/dist/chunks/voiceModeEnabled-DIveLYGb.js +1 -0
- package/dist/chunks/voiceStreamSTT-_w1VjIOs.js +1 -0
- package/dist/chunks/voiceStreamSTT-hpzWd_zl.js +1 -0
- package/dist/chunks/which-DqSAIvp2.js +1 -0
- package/dist/chunks/windowsPaths-C9CigqoF.js +1 -0
- package/dist/chunks/windowsPaths-swxCp7bX.js +2 -0
- package/dist/chunks/workSecret-mS2OrpxF.js +1 -0
- package/dist/chunks/workerRegistry-2_MZVih1.js +1 -0
- package/dist/chunks/worktree-CCuDwRmS.js +1 -0
- package/dist/chunks/worktreeModeEnabled-Db6b_Iy_.js +1 -0
- package/dist/chunks/worktreeModeEnabled-THQb19xR.js +1 -0
- package/dist/chunks/wrapper-BSK0MCQH.js +1 -0
- package/dist/chunks/wrapper-D5qL1aQL.js +6 -0
- package/dist/chunks/xdg-CBxMmQux.js +1 -0
- package/dist/chunks/xml-Dx--sNE1.js +1 -0
- package/dist/chunks/zod-DT6hytkp.js +1 -0
- package/dist/cli.js +1 -10978
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=()=>({stop(){}});export{e as startServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./chunk-DR8-3Aex.js";import{Ar as r,Cn as i,Ei as a,It as o,Ln as s,Mn as c,Tn as l,Tt as u,Xn as d,Yn as f,dn as p,kn as m,kt as h,nn as ee,un as g,vt as _,wn as v,wr as te,xt as ne,zt as re}from"./schemas-BGAvj1T4.js";import{t as ie}from"./v4-f1i_CNUT.js";import{n as ae,t as oe}from"./ajv-B_OpU_Uh.js";var se=e((()=>{r()})),ce=e((()=>{r()})),le=e((()=>{})),ue=e((()=>{se(),ce(),le(),ce()})),de=e((()=>{ue()}));function y(e){return!!e._zod}function b(e,t){return y(e)?a(e,t):e.safeParse(t)}function fe(e){if(!e)return;let t;if(t=y(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function pe(e){if(y(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}var me=e((()=>{de()})),he,ge,x,S,_e,ve,ye,be,C,w,T,xe,E,D,O,k,A,Se,Ce,we,Te,Ee,j,M,De,Oe,ke,N,Ae,je,Me,P,F,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,I,Ue,L,We,Ge,R,Ke,z,B,qe,V,H,Je,U,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,W,G,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,K,Wt,Gt,Kt,qt,q,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,J,rn,an,on,Y,X,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Z,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Q,Pn,Fn=e((()=>{ie(),he=`2025-11-25`,ge=[he,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],x=`io.modelcontextprotocol/related-task`,S=o(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),_e=f([s(),i().int()]),ve=s(),p({ttl:i().optional(),pollInterval:i().optional()}),ye=v({ttl:i().optional()}),be=v({taskId:s()}),C=p({progressToken:_e.optional(),[x]:be.optional()}),w=v({_meta:C.optional()}),T=w.extend({task:ye.optional()}),xe=e=>T.safeParse(e).success,E=v({method:s(),params:w.loose().optional()}),D=v({_meta:C.optional()}),O=v({method:s(),params:D.loose().optional()}),k=p({_meta:C.optional()}),A=f([s(),i().int()]),Se=v({jsonrpc:g(`2.0`),id:A,...E.shape}).strict(),Ce=e=>Se.safeParse(e).success,we=v({jsonrpc:g(`2.0`),...O.shape}).strict(),Te=e=>we.safeParse(e).success,Ee=v({jsonrpc:g(`2.0`),id:A,result:k}).strict(),j=e=>Ee.safeParse(e).success,(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(M||(M={})),De=v({jsonrpc:g(`2.0`),id:A.optional(),error:v({code:i().int(),message:s(),data:d().optional()})}).strict(),Oe=e=>De.safeParse(e).success,ke=f([Se,we,Ee,De]),f([Ee,De]),N=k.strict(),Ae=D.extend({requestId:A.optional(),reason:s().optional()}),je=O.extend({method:g(`notifications/cancelled`),params:Ae}),Me=v({src:s(),mimeType:s().optional(),sizes:u(s()).optional(),theme:_([`light`,`dark`]).optional()}),P=v({icons:u(Me).optional()}),F=v({name:s(),title:s().optional()}),Ne=F.extend({...F.shape,...P.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),Pe=ee(v({applyDefaults:h().optional()}),c(s(),d())),Fe=m(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ee(v({form:Pe.optional(),url:S.optional()}),c(s(),d()).optional())),Ie=p({list:S.optional(),cancel:S.optional(),requests:p({sampling:p({createMessage:S.optional()}).optional(),elicitation:p({create:S.optional()}).optional()}).optional()}),Le=p({list:S.optional(),cancel:S.optional(),requests:p({tools:p({call:S.optional()}).optional()}).optional()}),Re=v({experimental:c(s(),S).optional(),sampling:v({context:S.optional(),tools:S.optional()}).optional(),elicitation:Fe.optional(),roots:v({listChanged:h().optional()}).optional(),tasks:Ie.optional(),extensions:c(s(),S).optional()}),ze=w.extend({protocolVersion:s(),capabilities:Re,clientInfo:Ne}),Be=E.extend({method:g(`initialize`),params:ze}),Ve=v({experimental:c(s(),S).optional(),logging:S.optional(),completions:S.optional(),prompts:v({listChanged:h().optional()}).optional(),resources:v({subscribe:h().optional(),listChanged:h().optional()}).optional(),tools:v({listChanged:h().optional()}).optional(),tasks:Le.optional(),extensions:c(s(),S).optional()}),He=k.extend({protocolVersion:s(),capabilities:Ve,serverInfo:Ne,instructions:s().optional()}),I=O.extend({method:g(`notifications/initialized`),params:D.optional()}),Ue=e=>I.safeParse(e).success,L=E.extend({method:g(`ping`),params:w.optional()}),We=v({progress:i(),total:l(i()),message:l(s())}),Ge=v({...D.shape,...We.shape,progressToken:_e}),R=O.extend({method:g(`notifications/progress`),params:Ge}),Ke=w.extend({cursor:ve.optional()}),z=E.extend({params:Ke.optional()}),B=k.extend({nextCursor:ve.optional()}),qe=_([`working`,`input_required`,`completed`,`failed`,`cancelled`]),V=v({taskId:s(),status:qe,ttl:f([i(),ne()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:l(i()),statusMessage:l(s())}),H=k.extend({task:V}),Je=D.merge(V),U=O.extend({method:g(`notifications/tasks/status`),params:Je}),Ye=E.extend({method:g(`tasks/get`),params:w.extend({taskId:s()})}),Xe=k.merge(V),Ze=E.extend({method:g(`tasks/result`),params:w.extend({taskId:s()})}),k.loose(),Qe=z.extend({method:g(`tasks/list`)}),$e=B.extend({tasks:u(V)}),et=E.extend({method:g(`tasks/cancel`),params:w.extend({taskId:s()})}),tt=k.merge(V),nt=v({uri:s(),mimeType:l(s()),_meta:c(s(),d()).optional()}),rt=nt.extend({text:s()}),it=s().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),at=nt.extend({blob:it}),W=_([`user`,`assistant`]),G=v({audience:u(W).optional(),priority:i().min(0).max(1).optional(),lastModified:te({offset:!0}).optional()}),ot=v({...F.shape,...P.shape,uri:s(),description:l(s()),mimeType:l(s()),size:l(i()),annotations:G.optional(),_meta:l(p({}))}),st=v({...F.shape,...P.shape,uriTemplate:s(),description:l(s()),mimeType:l(s()),annotations:G.optional(),_meta:l(p({}))}),ct=z.extend({method:g(`resources/list`)}),lt=B.extend({resources:u(ot)}),ut=z.extend({method:g(`resources/templates/list`)}),dt=B.extend({resourceTemplates:u(st)}),ft=w.extend({uri:s()}),pt=ft,mt=E.extend({method:g(`resources/read`),params:pt}),ht=k.extend({contents:u(f([rt,at]))}),gt=O.extend({method:g(`notifications/resources/list_changed`),params:D.optional()}),_t=ft,vt=E.extend({method:g(`resources/subscribe`),params:_t}),yt=ft,bt=E.extend({method:g(`resources/unsubscribe`),params:yt}),xt=D.extend({uri:s()}),St=O.extend({method:g(`notifications/resources/updated`),params:xt}),Ct=v({name:s(),description:l(s()),required:l(h())}),wt=v({...F.shape,...P.shape,description:l(s()),arguments:l(u(Ct)),_meta:l(p({}))}),Tt=z.extend({method:g(`prompts/list`)}),Et=B.extend({prompts:u(wt)}),Dt=w.extend({name:s(),arguments:c(s(),s()).optional()}),Ot=E.extend({method:g(`prompts/get`),params:Dt}),kt=v({type:g(`text`),text:s(),annotations:G.optional(),_meta:c(s(),d()).optional()}),At=v({type:g(`image`),data:it,mimeType:s(),annotations:G.optional(),_meta:c(s(),d()).optional()}),jt=v({type:g(`audio`),data:it,mimeType:s(),annotations:G.optional(),_meta:c(s(),d()).optional()}),Mt=v({type:g(`tool_use`),name:s(),id:s(),input:c(s(),d()),_meta:c(s(),d()).optional()}),Nt=v({type:g(`resource`),resource:f([rt,at]),annotations:G.optional(),_meta:c(s(),d()).optional()}),Pt=ot.extend({type:g(`resource_link`)}),Ft=f([kt,At,jt,Pt,Nt]),It=v({role:W,content:Ft}),Lt=k.extend({description:s().optional(),messages:u(It)}),Rt=O.extend({method:g(`notifications/prompts/list_changed`),params:D.optional()}),zt=v({title:s().optional(),readOnlyHint:h().optional(),destructiveHint:h().optional(),idempotentHint:h().optional(),openWorldHint:h().optional()}),Bt=v({taskSupport:_([`required`,`optional`,`forbidden`]).optional()}),Vt=v({...F.shape,...P.shape,description:s().optional(),inputSchema:v({type:g(`object`),properties:c(s(),S).optional(),required:u(s()).optional()}).catchall(d()),outputSchema:v({type:g(`object`),properties:c(s(),S).optional(),required:u(s()).optional()}).catchall(d()).optional(),annotations:zt.optional(),execution:Bt.optional(),_meta:c(s(),d()).optional()}),Ht=z.extend({method:g(`tools/list`)}),Ut=B.extend({tools:u(Vt)}),K=k.extend({content:u(Ft).default([]),structuredContent:c(s(),d()).optional(),isError:h().optional()}),K.or(k.extend({toolResult:d()})),Wt=T.extend({name:s(),arguments:c(s(),d()).optional()}),Gt=E.extend({method:g(`tools/call`),params:Wt}),Kt=O.extend({method:g(`notifications/tools/list_changed`),params:D.optional()}),qt=v({autoRefresh:h().default(!0),debounceMs:i().int().nonnegative().default(300)}),q=_([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Jt=w.extend({level:q}),Yt=E.extend({method:g(`logging/setLevel`),params:Jt}),Xt=D.extend({level:q,logger:s().optional(),data:d()}),Zt=O.extend({method:g(`notifications/message`),params:Xt}),Qt=v({name:s().optional()}),$t=v({hints:u(Qt).optional(),costPriority:i().min(0).max(1).optional(),speedPriority:i().min(0).max(1).optional(),intelligencePriority:i().min(0).max(1).optional()}),en=v({mode:_([`auto`,`required`,`none`]).optional()}),tn=v({type:g(`tool_result`),toolUseId:s().describe(`The unique identifier for the corresponding tool call.`),content:u(Ft).default([]),structuredContent:v({}).loose().optional(),isError:h().optional(),_meta:c(s(),d()).optional()}),nn=re(`type`,[kt,At,jt]),J=re(`type`,[kt,At,jt,Mt,tn]),rn=v({role:W,content:f([J,u(J)]),_meta:c(s(),d()).optional()}),an=T.extend({messages:u(rn),modelPreferences:$t.optional(),systemPrompt:s().optional(),includeContext:_([`none`,`thisServer`,`allServers`]).optional(),temperature:i().optional(),maxTokens:i().int(),stopSequences:u(s()).optional(),metadata:S.optional(),tools:u(Vt).optional(),toolChoice:en.optional()}),on=E.extend({method:g(`sampling/createMessage`),params:an}),Y=k.extend({model:s(),stopReason:l(_([`endTurn`,`stopSequence`,`maxTokens`]).or(s())),role:W,content:nn}),X=k.extend({model:s(),stopReason:l(_([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(s())),role:W,content:f([J,u(J)])}),sn=v({type:g(`boolean`),title:s().optional(),description:s().optional(),default:h().optional()}),cn=v({type:g(`string`),title:s().optional(),description:s().optional(),minLength:i().optional(),maxLength:i().optional(),format:_([`email`,`uri`,`date`,`date-time`]).optional(),default:s().optional()}),ln=v({type:_([`number`,`integer`]),title:s().optional(),description:s().optional(),minimum:i().optional(),maximum:i().optional(),default:i().optional()}),un=v({type:g(`string`),title:s().optional(),description:s().optional(),enum:u(s()),default:s().optional()}),dn=v({type:g(`string`),title:s().optional(),description:s().optional(),oneOf:u(v({const:s(),title:s()})),default:s().optional()}),fn=v({type:g(`string`),title:s().optional(),description:s().optional(),enum:u(s()),enumNames:u(s()).optional(),default:s().optional()}),pn=f([un,dn]),mn=v({type:g(`array`),title:s().optional(),description:s().optional(),minItems:i().optional(),maxItems:i().optional(),items:v({type:g(`string`),enum:u(s())}),default:u(s()).optional()}),hn=v({type:g(`array`),title:s().optional(),description:s().optional(),minItems:i().optional(),maxItems:i().optional(),items:v({anyOf:u(v({const:s(),title:s()}))}),default:u(s()).optional()}),gn=f([mn,hn]),_n=f([fn,pn,gn]),vn=f([_n,sn,cn,ln]),yn=T.extend({mode:g(`form`).optional(),message:s(),requestedSchema:v({type:g(`object`),properties:c(s(),vn),required:u(s()).optional()})}),bn=T.extend({mode:g(`url`),message:s(),elicitationId:s(),url:s().url()}),xn=f([yn,bn]),Sn=E.extend({method:g(`elicitation/create`),params:xn}),Cn=D.extend({elicitationId:s()}),wn=O.extend({method:g(`notifications/elicitation/complete`),params:Cn}),Z=k.extend({action:_([`accept`,`decline`,`cancel`]),content:m(e=>e===null?void 0:e,c(s(),f([s(),i(),h(),u(s())])).optional())}),Tn=v({type:g(`ref/resource`),uri:s()}),En=v({type:g(`ref/prompt`),name:s()}),Dn=w.extend({ref:f([En,Tn]),argument:v({name:s(),value:s()}),context:v({arguments:c(s(),s()).optional()}).optional()}),On=E.extend({method:g(`completion/complete`),params:Dn}),kn=k.extend({completion:p({values:u(s()).max(100),total:l(i().int()),hasMore:l(h())})}),An=v({uri:s().startsWith(`file://`),name:s().optional(),_meta:c(s(),d()).optional()}),jn=E.extend({method:g(`roots/list`),params:w.optional()}),Mn=k.extend({roots:u(An)}),Nn=O.extend({method:g(`notifications/roots/list_changed`),params:D.optional()}),f([L,Be,On,Yt,Ot,Tt,ct,ut,mt,vt,bt,Gt,Ht,Ye,Ze,Qe,et]),f([je,R,I,Nn,U]),f([N,Y,X,Z,Mn,Xe,$e,H]),f([L,on,Sn,jn,Ye,Ze,Qe,et]),f([je,R,Zt,St,gt,Kt,Rt,U,wn]),f([N,He,kn,Lt,Et,lt,dt,ht,K,Ut,Xe,$e,H]),Q=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===M.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Pn(e.elicitations,n)}return new e(t,n,r)}},Pn=class extends Q{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(M.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}}));function $(e){return e===`completed`||e===`failed`||e===`cancelled`}var In=e((()=>{})),Ln=e((()=>{})),Rn=e((()=>{})),zn=e((()=>{})),Bn=e((()=>{})),Vn=e((()=>{})),Hn=e((()=>{})),Un=e((()=>{})),Wn=e((()=>{})),Gn=e((()=>{})),Kn=e((()=>{})),qn=e((()=>{})),Jn=e((()=>{})),Yn=e((()=>{})),Xn=e((()=>{})),Zn=e((()=>{})),Qn=e((()=>{})),$n=e((()=>{})),er=e((()=>{})),tr=e((()=>{})),nr=e((()=>{})),rr=e((()=>{})),ir=e((()=>{})),ar=e((()=>{})),or=e((()=>{})),sr=e((()=>{})),cr=e((()=>{})),lr=e((()=>{})),ur=e((()=>{})),dr=e((()=>{})),fr=e((()=>{})),pr=e((()=>{})),mr=e((()=>{})),hr=e((()=>{})),gr=e((()=>{})),_r=e((()=>{})),vr=e((()=>{})),yr=e((()=>{})),br=e((()=>{})),xr=e((()=>{Ln(),Rn(),zn(),Bn(),vr(),yr(),Vn(),Hn(),Un(),Wn(),Gn(),Kn(),qn(),Jn(),Yn(),Xn(),Zn(),Qn(),tr(),nr(),rr(),ir(),or(),sr(),cr(),lr(),ur(),dr(),gr(),er(),fr(),$n(),pr(),mr(),ar(),hr(),_r(),br()}));function Sr(e){let t=fe(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=pe(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function Cr(e,t){let n=b(e,t);if(!n.success)throw n.error;return n.data}var wr=e((()=>{me(),xr()}));function Tr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Er(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];Tr(a)&&Tr(i)?n[r]={...a,...i}:n[r]=i}return n}var Dr,Or=e((()=>{me(),Fn(),In(),wr(),Dr=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(je,e=>{this._oncancel(e)}),this.setNotificationHandler(R,e=>{this._onprogress(e)}),this.setRequestHandler(L,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ye,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Q(M.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(Ze,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new Q(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new Q(M.InvalidParams,`Task not found: ${r}`);if(!$(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if($(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[x]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(Qe,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new Q(M.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(et,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Q(M.InvalidParams,`Task not found: ${e.params.taskId}`);if($(n.status))throw new Q(M.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Q(M.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof Q?e:new Q(M.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Q.fromError(M.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),j(e)||Oe(e)?this._onresponse(e):Ce(e)?this._onrequest(e,t):Te(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=Q.fromError(M.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[x]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:M.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=xe(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new Q(M.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:M.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),j(e)?n(e):n(new Q(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(j(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),j(e)?r(e):r(Q.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof Q?e:new Q(M.InternalError,String(e))}}return}let i;try{let r=await this.request(e,H,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new Q(M.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},$(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new Q(M.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new Q(M.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof Q?e:new Q(M.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[x]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof Q?e:new Q(M.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=b(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(Q.fromError(M.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},Xe,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},$e,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},tt,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[x]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[x]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[x]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=Sr(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=Cr(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=Sr(e);this._notificationHandlers.set(n,n=>{let r=Cr(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&Ce(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new Q(M.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new Q(M.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new Q(M.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new Q(M.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=U.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),$(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new Q(M.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if($(a.status))throw new Q(M.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=U.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),$(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}}})),kr=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:se,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:v,int32:{type:`number`,validate:re},int64:{type:`number`,validate:ie},float:{type:`number`,validate:ae},double:{type:`number`,validate:ae},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,ee=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function g(e){return h.test(e)&&ee.test(e)}var _=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(e){return _.lastIndex=0,_.test(e)}var te=-(2**31),ne=2**31-1;function re(e){return Number.isInteger(e)&&e<=ne&&e>=te}function ie(e){return Number.isInteger(e)}function ae(){return!0}var oe=/[^\\]\\Z/;function se(e){if(oe.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),Ar=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;var t=oe(),n=ae(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),jr=n(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=kr(),r=Ar(),i=ae(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s}));function Mr(){let e=new Nr.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Pr.default)(e),e}var Nr,Pr,Fr,Ir=e((()=>{Nr=t(oe(),1),Pr=t(jr(),1),Fr=class{constructor(e){this._ajv=e??Mr()}getValidator(e){let t=`$id`in e&&typeof e.$id==`string`?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}})),Lr,Rr=e((()=>{Fn(),Lr=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},Y,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??`form`;switch(r){case`url`:if(!n?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!n?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let i=r===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:i},Z,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}}));function zr(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`tools/call`:if(!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Br(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`sampling/createMessage`:if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case`elicitation/create`:if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Vr=e((()=>{})),Hr,Ur=e((()=>{Or(),Fn(),Ir(),me(),Rr(),Vr(),Hr=class extends Dr{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(q.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Fr,this.setRequestHandler(Be,e=>this._oninitialize(e)),this.setNotificationHandler(I,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Yt,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=q.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Lr(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=Er(this._capabilities,e)}setRequestHandler(e,t){let n=fe(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r;if(y(n)){let e=n;r=e._zod?.def?.value??e.value}else{let e=n;r=e._def?.value??e.value}if(typeof r!=`string`)throw Error(`Schema method literal must be a string`);return r===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let r=b(Gt,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new Q(M.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=b(H,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new Q(M.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let o=b(K,a);if(!o.success){let e=o.error instanceof Error?o.error.message:String(o.error);throw new Q(M.InvalidParams,`Invalid tools/call result: ${e}`)}return o.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){Br(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&zr(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:ge.includes(t)?t:he,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},N)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},X,t):this.request({method:`sampling/createMessage`,params:e},Y,t)}async elicitInput(e,t){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let n=e;return this.request({method:`elicitation/create`,params:n},Z,t)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},Z,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new Q(M.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof Q?e:new Q(M.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},Mn,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}}}));export{lt as A,Fn as B,Lt as C,qt as D,he as E,Rt as F,me as G,Ce as H,ht as I,y as K,gt as L,Ht as M,Ut as N,Et as O,Q as P,ge as R,M as S,ke as T,j as U,Ue as V,fe as W,H as _,Vr as a,wn as b,Dr as c,Gt as d,K as f,X as g,Y as h,zr as i,jn as j,dt as k,Or as l,on as m,Ur as n,Fr as o,kn as p,b as q,Br as r,Ir as s,Hr as t,Er as u,Sn as v,He as w,N as x,Z as y,Kt as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=()=>{};export{e as printBanner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=()=>({});export{e as createServerLogger};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,p as i,t as a,tt as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{d as l,s as u}from"./debug-UI3T040K.js";import{MS as d,jS as f}from"./loadAgentsDir-DI1a76pd.js";import{t as p}from"./useKeybinding-FsOnjW6T.js";import{t as m}from"./lib-B4Q0Nrpb.js";function h({onDone:e}){let t=d(e=>e.remoteSessionUrl),[n,a]=(0,_.useState)(``);if((0,_.useEffect)(()=>{if(!t)return;let e=t;async function n(){a(await(0,g.toString)(e,{type:`utf8`,errorCorrectionLevel:`L`}))}n().catch(e=>{l(`QR code generation failed`,e)})},[t]),o(`confirm:no`,e,{context:`Confirmation`}),!t)return(0,v.jsxs)(i,{children:[(0,v.jsx)(r,{color:`warning`,children:"Not in remote mode. Start with `claude --remote` to use this command."}),(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})]});let c=n.split(`
|
|
2
|
+
`).filter(e=>e.length>0),u=c.length===0;return(0,v.jsxs)(i,{children:[(0,v.jsx)(s,{marginBottom:1,children:(0,v.jsx)(r,{bold:!0,children:`Remote session`})}),u?(0,v.jsx)(r,{dimColor:!0,children:`Generating QR code…`}):c.map((e,t)=>(0,v.jsx)(r,{children:e},t)),(0,v.jsxs)(s,{marginTop:1,children:[(0,v.jsx)(r,{dimColor:!0,children:`Open in browser: `}),(0,v.jsx)(r,{color:`ide`,children:t})]}),(0,v.jsx)(s,{marginTop:1,children:(0,v.jsx)(r,{dimColor:!0,children:`(press esc to close)`})})]})}var g,_,v,y;e((()=>{g=m(),n(),_=t(n(),1),a(),p(),f(),u(),v=c(),y=async e=>(0,v.jsx)(h,{onDone:e})}))();export{y as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=()=>{};export{e as createSessionTurnUploader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,s as t}from"./debug-UI3T040K.js";t();async function n(){let{fetchCodeSessionsFromSessionsAPI:t}=await import(`./api-6tcwJlf_.js`),n;try{n=await t()}catch(t){throw e(`[assistant:discovery] fetchCodeSessionsFromSessionsAPI failed: ${t}`),t}return n.filter(e=>e.status===`idle`||e.status===`working`||e.status===`waiting`).map(e=>({id:e.id,title:e.title||`Untitled`,status:e.status,created_at:e.created_at??``}))}export{n as discoverAssistantSessions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{gu as e,vu as t}from"./loadAgentsDir-DI1a76pd.js";e();export{t as registerSessionFileAccessHooks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{async destroyAll(){}};export{e as SessionManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{W as r,cn as i}from"./state-sIHsFpDu.js";import{S as a,_ as o,g as s,mc as c,pc as l}from"./paths-BBvuDQl9.js";import{L as u,R as d,V as f,h as ee,p as te}from"./debug-UI3T040K.js";import{n as ne,r as p}from"./analytics-DqMQntaB.js";import{b as m,x as h}from"./teammate-DMYOtLTK.js";import{$O as g,Bc as re,DD as _,Fo as v,GO as y,In as b,JO as x,KO as S,Ln as ie,Lo as ae,Ml as oe,OD as se,Ol as ce,Pl as C,QO as le,Rn as ue,UO as w,VO as T,Vc as E,XO as D,YO as O,ZO as k,bo as A,cl as j,dk as M,dt as N,ek as P,fk as F,fl as I,ft as L,jO as R,kl as z,lk as B,ml as V,ok as H,pk as de,pl as fe,qO as pe,sk as me,sl as he,tk as ge}from"./loadAgentsDir-DI1a76pd.js";import{On as U,jn as _e}from"./prompt-CjFAtm3w.js";import{X as ve}from"./rcDebugLog-CPKZCtR8.js";import{writeFile as W}from"fs/promises";function ye(){return o(`tengu_session_memory`,!1)}function G(){return s(`tengu_sm_config`,{})}function be(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=m(e,e=>e.type===`tool_use`))}}return n}function K(e){let t=B(e);if(!O()){if(!S(t))return!1;le()}let n=pe(t),r=be(e,X)>=y(),i=v(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&(X=t.uuid),!0}return!1}async function q(e){let t=te(),n=b();await t.mkdir(n,{mode:448});let r=ie();try{await W(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await W(r,await V(),{encoding:`utf-8`,mode:384})}catch(e){if(d(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await re.call({file_path:r},e),a=``,o=i.data;return o.type===`text`&&(a=o.file.content),p(`tengu_session_memory_file_read`,{content_length:a.length}),{memoryPath:r,currentMemory:a}}function xe(){if(r())return;let e=j();process.env.USER_TYPE===`ant`&&p(`tengu_session_memory_init`,{auto_compact_enabled:e}),e&&se($)}async function Se(e,t){if(e.length===0)return{success:!1,error:`No messages to summarize`};k();try{let n=z(t),{memoryPath:r,currentMemory:i}=await q(n),a=await I(i,r),{tools:o,mainLoopModel:s}=t.options,[c,l,u]=await Promise.all([N(o,s),F(),M()]),d=ve(c);return await C({promptMessages:[A({content:a})],cacheSafeParams:{systemPrompt:d,userContext:l,systemContext:u,toolUseContext:n,forkContextMessages:e},canUseTool:J(r),querySource:`session_memory`,forkLabel:`session_memory_manual`,overrides:{readFileState:n.readFileState}}),p(`tengu_session_memory_manual_extraction`,{}),g(B(e)),Y(e),{success:!0,memoryPath:r}}catch(e){return{success:!1,error:u(e)}}finally{D()}}function J(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${U} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${U} on ${e} is allowed`}}}}function Y(e){if(!v(e)){let t=e[e.length-1];t?.uuid&&P(t.uuid)}}var X,Z,Q,$,Ce=e((()=>{n(),i(),L(),de(),_e(),E(),h(),oe(),ee(),_(),ae(),ue(),l(),R(),me(),ne(),he(),fe(),x(),f(),a(),Z=t(()=>{let e=G();ge({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:T.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:T.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:T.toolCallsBetweenUpdates})}),Q=!1,$=c(async function(e){let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`)return;{let{isPoorModeActive:e}=await import(`./poorMode-DEAe3hiK.js`);if(e())return}if(!ye()){process.env.USER_TYPE===`ant`&&!Q&&(Q=!0,p(`tengu_session_memory_gate_disabled`,{}));return}if(Z(),!K(t))return;k();let i=z(n),{memoryPath:a,currentMemory:o}=await q(i);await C({promptMessages:[A({content:await I(o,a)})],cacheSafeParams:ce(e),canUseTool:J(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let s=t[t.length-1],c=s?H(s):void 0,l=w();p(`tengu_session_memory_extraction`,{input_tokens:c?.input_tokens,output_tokens:c?.output_tokens,cache_read_input_tokens:c?.cache_read_input_tokens??void 0,cache_creation_input_tokens:c?.cache_creation_input_tokens??void 0,config_min_message_tokens_to_init:l.minimumMessageTokensToInit,config_min_tokens_between_update:l.minimumTokensBetweenUpdate,config_tool_calls_between_updates:l.toolCallsBetweenUpdates}),g(B(t)),Y(t),D()})}));export{K as a,Se as i,xe as n,Ce as r,J as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./sessionMemory-CMahwDdW.js";t();export{e as manuallyExtractSessionMemory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{JO as e,WO as t}from"./loadAgentsDir-DI1a76pd.js";e();export{t as getSessionMemoryContent};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{jO as t,nt as n,tt as r}from"./loadAgentsDir-DI1a76pd.js";import{X as i}from"./rcDebugLog-CPKZCtR8.js";import{i as a,l as o,r as s,t as c,u as l}from"./instinctParser-DHMa8xa0.js";function u(e){g.set(e.name,e),_||(_=e.name)}function d(e){if(!g.has(e))throw Error(`Observer backend "${e}" is not registered`);_=e}function f(){let e=_?g.get(_):void 0;if(!e)throw Error(`No observer backend is active — register one before analyzing observations`);return e}async function p(e,t){return Promise.resolve(f().analyze(e,t))}function m(){let e=process.env.SKILL_LEARNING_OBSERVER_BACKEND?.trim();return e&&g.has(e)?e:void 0}function h(){let e=m();return e&&d(e),f()}var g,_,v=e((()=>{g=new Map})),y,b=e((()=>{y=[`workflow`,`testing`,`debugging`,`code-style`,`security`,`git`,`project`]}));async function x(e,t){if(e.length===0)return[];if(Date.now()<L)return S(e,t);let r=e.slice(-P),a=C(r),s=N(o().llm.timeoutMs),c;try{let e=await n({systemPrompt:i([R]),userPrompt:a,signal:s,options:{querySource:`skill_learning_observer`,enablePromptCaching:!0,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[]}});I=0,c=E(e.message?.content)}catch{return I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),S(e,t)}let l=D(c,t,r);return l.length===0?(I++,I>=o().llm.failureThreshold&&(L=Date.now()+o().llm.circuitCooldownMs),S(e,t)):l}async function S(e,t){try{let{heuristicObserverBackend:n}=await import(`./sessionObserver-Je868MC9.js`),r=n.analyze(e,t);return Array.isArray(r)?r:await r}catch{return[]}}function C(e){return`Observations (chronological, newest last):\n${e.map((e,t)=>w(e,t)).join(`
|
|
2
|
+
`)}\n\nExtract up to ${F} atomic instincts. JSON array only.`}function w(e,t){let n=[`#${t+1}`,`event=${e.event}`];return e.toolName&&n.push(`tool=${e.toolName}`),e.outcome&&n.push(`outcome=${e.outcome}`),e.messageText&&n.push(`text=${JSON.stringify(T(e.messageText,200))}`),e.toolInput&&n.push(`in=${JSON.stringify(T(e.toolInput,120))}`),e.toolOutput&&n.push(`out=${JSON.stringify(T(e.toolOutput,120))}`),n.join(` | `)}function T(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function E(e){if(!Array.isArray(e))return``;let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;e.type===`text`&&typeof e.text==`string`&&t.push(e.text)}return t.join(``).trim()}function D(e,t,n){let r=O(e);if(!r)return[];let i;try{i=JSON.parse(r)}catch{return[]}if(!Array.isArray(i))return[];let a=n.map(e=>e.id),o=[];for(let e of i.slice(0,F)){let n=k(e,t,a);n&&o.push(n)}return o}function O(e){if(!e)return;let t=e.indexOf(`[`),n=e.lastIndexOf(`]`);if(!(t<0||n<=t))return e.slice(t,n+1)}function k(e,t,n){if(!e||typeof e!=`object`)return;let r=e,i=A(r.trigger,80),a=A(r.action,120);if(!i||!a)return;let o=te(r.evidence);if(o.length!==0)return{trigger:i,action:a,confidence:j(r.confidence),domain:M(r.domain),source:`session-observation`,scope:ee(r.scope),projectId:t?.project?.projectId,projectName:t?.project?.projectName,evidence:o,observationIds:n}}function A(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)return n.length>t?n.slice(0,t):n}function j(e){return typeof e!=`number`||!Number.isFinite(e)?.5:e<0?0:e>1?1:e}function M(e){return typeof e==`string`&&y.includes(e)?e:`project`}function ee(e){return e===`global`?`global`:`project`}function te(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(e&&(t.push(e.length>200?`${e.slice(0,200)}…`:e),t.length===3))break}return t}function N(e){return AbortSignal.timeout(e)}var P,F,I,L,R,z,B=e((()=>{r(),t(),l(),b(),P=30,F=3,I=0,L=0,R=`You analyse a short sequence of observations from a coding-assistant session (user messages, tool invocations with outcomes, assistant messages) and extract atomic, reusable "instincts" — behavioural patterns that would help the assistant act correctly in future similar situations.
|
|
3
|
+
|
|
4
|
+
Respond with ONLY a JSON array (no prose, no code fences, no commentary). Each item must match this schema:
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
"trigger": string, // <= 80 chars, short phrase describing WHEN the instinct applies
|
|
8
|
+
"action": string, // <= 120 chars, short phrase describing WHAT to do
|
|
9
|
+
"confidence": number, // 0..1 — how strongly these observations support the pattern
|
|
10
|
+
"domain": "workflow"|"testing"|"debugging"|"code-style"|"security"|"git"|"project",
|
|
11
|
+
"scope": "project"|"global",
|
|
12
|
+
"evidence": string[] // 1..3 short excerpts copied/paraphrased from the observations
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Rules:
|
|
16
|
+
- Return [] if nothing clearly reusable. No guessing.
|
|
17
|
+
- At most 3 items, highest confidence first.
|
|
18
|
+
- confidence > 0.7 only when observations show the pattern in action (a correction followed by a successful retry, a repeated sequence, an explicit rule).
|
|
19
|
+
- Never include secrets, tokens, full file contents, or personally-identifying data.
|
|
20
|
+
- Scope "global" only when the pattern is obviously project-agnostic (generic testing, git hygiene); default to "project".`,z={name:`llm`,analyze(e,t){return x(e,t)}}}));function V(e,t){return[...W(e),...G(e),...K(e,t),...q(e)]}function H(e,t){let n=f();return(n.name===`heuristic`?V(e,t):U(n.analyze(e))).map(e=>s(e))}function U(e){if(Array.isArray(e))return e;throw Error(`Active observer backend returned a Promise; use analyzeObservationsAsync instead`)}function W(e){return e.flatMap((t,n)=>{if(t.event!==`user_message`||!t.messageText)return[];let r=t.messageText.trim(),i=X(r);return i?[{...c(t),trigger:i.trigger,action:i.action,confidence:.7,domain:Z(r),source:`session-observation`,scope:`project`,evidence:[r],evidenceOutcome:J(e,n),observationIds:[t.id]}]:[]})}function G(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.event!==`tool_complete`||r.outcome!==`failure`)continue;let i=e.slice(n+1,n+6).find(e=>e.event===`tool_complete`&&e.outcome===`success`&&e.toolName===r.toolName);!i||!r.toolName||t.push({...c(r),trigger:`When ${r.toolName} fails during this project`,action:`Use the follow-up successful ${r.toolName} invocation as the resolution pattern before retrying blindly.`,confidence:.5,domain:`debugging`,source:`session-observation`,scope:`project`,evidence:[r.toolOutput??`${r.toolName} failed`,i.toolOutput??`${i.toolName} succeeded`],evidenceOutcome:`success`,observationIds:[r.id,i.id]})}return t}function K(e,t){let n=t?.minRepeatedSequenceCount??Q,r=e.filter(e=>e.event===`tool_start`||e.event===`tool_complete`),i=r.map(e=>e.toolName??``),a=[`Grep`,`Read`,`Edit`],o=[],s=0;for(let e=0;e<=i.length-a.length;e++)a.every((t,n)=>i[e+n]===t)&&(s++,o.push(...r.slice(e,e+a.length).map(e=>e.id)));if(s<n)return[];let l=`Observed ${s} repeated Grep -> Read -> Edit workflow sequences.`,u=r.find(e=>o.includes(e.id)),d=o[o.length-1],f=r.find(e=>e.id===d),p=f?.event===`tool_complete`?f.outcome:void 0;return[{...c(u??e[0]),trigger:`When changing code in this project`,action:`Prefer the Grep -> Read -> Edit workflow: locate symbols, inspect context, then apply the smallest edit.`,confidence:s>=3?.65:.5,domain:`workflow`,source:`session-observation`,scope:`project`,evidence:[l],evidenceOutcome:Y(p),observationIds:Array.from(new Set(o))}]}function q(e){return e.flatMap((t,n)=>{if(t.event!==`user_message`||!t.messageText)return[];let r=t.messageText.trim();return/(项目约定|规范|必须|convention|always|must)/i.test(r)?[{...c(t),trigger:`When working in this project`,action:`Follow the project convention: ${r}`,confidence:.4,domain:`project`,source:`session-observation`,scope:`project`,evidence:[r],evidenceOutcome:J(e,n),observationIds:[t.id]}]:[]})}function J(e,t){for(let n=t-1;n>=0;n--){let t=e[n];if(t.event===`tool_complete`)return Y(t.outcome)}}function Y(e){if(e===`success`||e===`failure`||e===`unknown`)return e}function X(e){let t=/(?:不要|别|不应(?:该)?|不要再)\s*(?<avoid>[^,,。.;;]+)[,,\s]*(?:用|使用|改用|应该用|要用)\s*(?<prefer>[^,,。.;;]+)/i,n=/(?:do not|don't|avoid)\s+(?<avoid>[^,.;]+)[,;\s]+(?:use|prefer)\s+(?<prefer>[^,.;]+)/i,r=/(?:你应该|应该先|must|should)\s*(?<prefer>[^,,。.;;]+)/i,i=e.match(t)??e.match(n);if(i?.groups){let e=i.groups.avoid.trim(),t=i.groups.prefer.trim();return{trigger:`When choosing between ${e} and ${t}`,action:`Prefer ${t}; avoid ${e}.`}}let a=e.match(r);return a?.groups?{trigger:`When this user gives a corrective instruction`,action:`Prefer this corrected action: ${a.groups.prefer.trim()}.`}:null}function Z(e){let t=e.toLowerCase();return/test|mock|testing-library|vitest|jest|bun test/.test(t)?`testing`:/git|commit|branch/.test(t)?`git`:/security|secret|token|password/.test(t)?`security`:/style|format|lint|naming/.test(t)?`code-style`:`project`}var Q,$,ne=e((()=>{a(),v(),B(),Q=2,$={name:`heuristic`,analyze(e,t){return V(e)}},u($),u(z)}));export{B as a,b as c,v as d,u as f,ne as i,p as l,d as m,V as n,z as o,h as p,$ as r,y as s,H as t,f as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./sessionObserver-DG2zQgfi.js";e();export{t as heuristicObserverBackend};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ar as e,Lr as t,oi as n}from"./loadAgentsDir-DI1a76pd.js";e();export{t as linkSessionToPR,n as recordTranscript};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{i as r,t as i}from"./hash-BRmOQc3c.js";import{join as a}from"path";import{open as o,readdir as s,realpath as c}from"fs/promises";import{promisify as l}from"util";import{execFile as u}from"child_process";async function d(e){try{let{stdout:t}=await f(`git`,[`worktree`,`list`,`--porcelain`],{cwd:e,timeout:5e3});return t?t.split(`
|
|
2
|
+
`).filter(e=>e.startsWith(`worktree `)).map(e=>e.slice(9).normalize(`NFC`)):[]}catch{return[]}}var f,p=e((()=>{f=l(u)}));function m(e){return typeof e==`string`&&R.test(e)?e:null}function h(e){if(!e.includes(`\\`))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function g(e,t){let n=[`"${t}":"`,`"${t}": "`];for(let t of n){let n=e.indexOf(t);if(n<0)continue;let r=n+t.length,i=r;for(;i<e.length;){if(e[i]===`\\`){i+=2;continue}if(e[i]===`"`)return h(e.slice(r,i));i++}}}function _(e,t){let n=[`"${t}":"`,`"${t}": "`],r;for(let t of n){let n=0;for(;;){let i=e.indexOf(t,n);if(i<0)break;let a=i+t.length,o=a;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]===`"`){r=h(e.slice(a,o));break}o++}n=o+1}}return r}function v(e){let t=0,n=``;for(;t<e.length;){let r=e.indexOf(`
|
|
3
|
+
`,t),i=r>=0?e.slice(t,r):e.slice(t);if(t=r>=0?r+1:e.length,!(!i.includes(`"type":"user"`)&&!i.includes(`"type": "user"`))&&!i.includes(`"tool_result"`)&&!(i.includes(`"isMeta":true`)||i.includes(`"isMeta": true`))&&!(i.includes(`"isCompactSummary":true`)||i.includes(`"isCompactSummary": true`)))try{let e=JSON.parse(i);if(e.type!==`user`)continue;let t=e.message;if(!t)continue;let r=t.content,a=[];if(typeof r==`string`)a.push(r);else if(Array.isArray(r))for(let e of r)e.type===`text`&&typeof e.text==`string`&&a.push(e.text);for(let e of a){let t=e.replace(/\n/g,` `).trim();if(!t)continue;let r=B.exec(t);if(r){n||(n=r[1]);continue}let i=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(t);if(i)return`! ${i[1].trim()}`;if(!z.test(t))return t.length>200&&(t=t.slice(0,200).trim()+`…`),t}}catch{}}return n||``}async function y(e,t,n){try{let r=await o(e,`r`);try{let e=await r.read(n,0,L,0);if(e.bytesRead===0)return{head:``,tail:``};let i=n.toString(`utf8`,0,e.bytesRead),a=Math.max(0,t-L),o=i;if(a>0){let e=await r.read(n,0,L,a);o=n.toString(`utf8`,0,e.bytesRead)}return{head:i,tail:o}}finally{await r.close()}}catch{return{head:``,tail:``}}}async function b(e){try{let t=await o(e,`r`);try{let e=await t.stat(),n=Buffer.allocUnsafe(L),r=await t.read(n,0,L,0);if(r.bytesRead===0)return null;let i=n.toString(`utf8`,0,r.bytesRead),a=Math.max(0,e.size-L),o=i;if(a>0){let e=await t.read(n,0,L,a);o=n.toString(`utf8`,0,e.bytesRead)}return{mtime:e.mtime.getTime(),size:e.size,head:i,tail:o}}finally{await t.close()}}catch{return null}}function x(e){return Math.abs(i(e)).toString(36)}function S(e){let t=e.replace(/[^a-zA-Z0-9]/g,`-`);if(t.length<=200)return t;let n=typeof Bun<`u`?Bun.hash(e).toString(36):x(e);return`${t.slice(0,200)}-${n}`}function C(){return a(t(),`projects`)}function w(e){return a(C(),S(e))}async function T(e){try{return(await c(e)).normalize(`NFC`)}catch{return e.normalize(`NFC`)}}async function E(e){let t=w(e);try{return await s(t),t}catch{let t=S(e);if(t.length<=200)return;let n=t.slice(0,200),r=C();try{let e=(await s(r,{withFileTypes:!0})).find(e=>e.isDirectory()&&e.name.startsWith(n+`-`));return e?a(r,e.name):void 0}catch{return}}}function D(){return U??(U=Buffer.from(`"compact_boundary"`))}function O(e){try{let t=JSON.parse(e);return t.type!==`system`||t.subtype!==`compact_boundary`?null:{hasPreservedSegment:!!t.compactMetadata?.preservedSegment}}catch{return null}}function k(e,t,n,r){let i=r-n;if(!(i<=0)){if(e.len+i>e.buf.length){let t=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+i),e.cap));e.buf.copy(t,0,0,e.len),e.buf=t}t.copy(e.buf,e.len,n,r),e.len+=i}}function A(e,t,n,r){return r-n>=t.length&&e.compare(t,0,t.length,n,n+t.length)===0}function j(e,t,n){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let r=e.carryBuf,i=t.indexOf(K);if(i===-1||i>=n)return 0;let a=i+1;if(A(r,W,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=a,e.lastSnapSrc=null;else if(e.carryLen<W.length)return 0;else{if(A(r,G,0,e.carryLen)){let n=O(r.toString(`utf-8`,0,e.carryLen)+t.toString(`utf-8`,0,i));n?.hasPreservedSegment?e.hasPreservedSegment=!0:n&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null)}k(e.out,r,0,e.carryLen),k(e.out,t,0,a)}return e.bufFileOff+=e.carryLen+a,e.carryLen=0,a}function M(e,t,n){let r=t.indexOf(n),i=0,a=0,o=-1,s=-1,c=t.indexOf(K);for(;c!==-1;){let l=c+1;if(r!==-1&&r<a&&(r=t.indexOf(n,a)),A(t,W,a,l))k(e.out,t,i,a),o=a,s=l,i=l;else if(r>=a&&r<Math.min(a+J,l)){let s=O(t.toString(`utf-8`,a,c));s?.hasPreservedSegment?e.hasPreservedSegment=!0:s&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff+a,e.hasPreservedSegment=!1,e.lastSnapSrc=null,o=-1,e.straddleSnapCarryLen=0,i=a),r=t.indexOf(n,r+n.length)}a=l,c=t.indexOf(K,a)}return k(e.out,t,i,a),{lastSnapStart:o,lastSnapEnd:s,trailStart:a}}function N(e,t,n,r,i){r===-1?e.straddleSnapCarryLen>0&&(e.lastSnapLen=e.straddleSnapCarryLen+e.straddleSnapTailEnd,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),e.carryBuf.copy(e.lastSnapBuf,0,0,e.straddleSnapCarryLen),n.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf):(e.lastSnapLen=i-r,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),t.copy(e.lastSnapBuf,0,r,i),e.lastSnapSrc=e.lastSnapBuf)}function P(e,t,n){e.carryLen=t.length-n,e.carryLen>0&&((e.carryBuf===void 0||e.carryLen>e.carryBuf.length)&&(e.carryBuf=Buffer.allocUnsafe(e.carryLen)),t.copy(e.carryBuf,0,n,t.length))}function F(e){if(e.carryLen>0){let t=e.carryBuf;A(t,W,0,e.carryLen)?(e.lastSnapSrc=t,e.lastSnapLen=e.carryLen):k(e.out,t,0,e.carryLen)}e.lastSnapSrc&&(e.out.len>0&&e.out.buf[e.out.len-1]!==K&&k(e.out,q,0,1),k(e.out,e.lastSnapSrc,0,e.lastSnapLen))}async function I(e,t){let n=D(),r=V,i={out:{buf:Buffer.allocUnsafe(Math.min(t,8*1024*1024)),len:0,cap:t+1},boundaryStartOffset:0,hasPreservedSegment:!1,lastSnapSrc:null,lastSnapLen:0,lastSnapBuf:void 0,bufFileOff:0,carryLen:0,carryBuf:void 0,straddleSnapCarryLen:0,straddleSnapTailEnd:0},a=Buffer.allocUnsafe(r),s=await o(e,`r`);try{let e=0;for(;e<t;){let{bytesRead:o}=await s.read(a,0,Math.min(r,t-e),e);if(o===0)break;e+=o;let c=j(i,a,o),l;if(i.carryLen>0){let e=i.carryLen+(o-c);l=Buffer.allocUnsafe(e),i.carryBuf.copy(l,0,0,i.carryLen),a.copy(l,i.carryLen,c,o)}else l=a.subarray(c,o);let u=M(i,l,n);N(i,l,a,u.lastSnapStart,u.lastSnapEnd),P(i,l,u.trailStart),i.bufFileOff+=u.trailStart}F(i)}finally{await s.close()}return{boundaryStartOffset:i.boundaryStartOffset,postBoundaryBuf:i.out.buf.subarray(0,i.out.len),hasPreservedSegment:i.hasPreservedSegment}}var L,R,z,B,V,H,U,W,G,K,q,J,Y=e((()=>{n(),p(),r(),L=65536,R=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,z=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,B=/<command-name>(.*?)<\/command-name>/,V=1024*1024,H=5*1024*1024,W=Buffer.from(`{"type":"attribution-snapshot"`),G=Buffer.from(`{"type":"system"`),K=10,q=Buffer.from([K]),J=256}));export{g as a,C as c,b as d,I as f,p as g,d as h,v as i,Y as l,m,H as n,_ as o,S as p,T as r,E as s,L as t,y as u};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Ln as t,wn as n}from"./schemas-BGAvj1T4.js";import{t as r}from"./v4-f1i_CNUT.js";import{U as i,cn as a}from"./state-sIHsFpDu.js";import{d as o,s}from"./debug-UI3T040K.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{s as u,u as d}from"./types-Csi32ZXh.js";import{n as f,t as p}from"./lazySchema-2sOku3cX.js";import{Co as m,Lo as h,jO as g,nt as _,tt as v}from"./loadAgentsDir-DI1a76pd.js";import{X as y}from"./rcDebugLog-CPKZCtR8.js";function b(e){let t=[];for(let n of e){if(n.type!==`user`&&n.type!==`assistant`||`isMeta`in n&&n.isMeta||`origin`in n&&n.origin&&n.origin.kind!==`human`)continue;let e=n.message.content;if(typeof e==`string`)t.push(e);else if(Array.isArray(e))for(let n of e)`type`in n&&n.type===`text`&&`text`in n&&t.push(n.text)}let n=t.join(`
|
|
2
|
+
`);return n.length>S?n.slice(-S):n}async function x(e,t){let n=e.trim();if(!n)return null;try{let e=m((await _({systemPrompt:y([C]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{title:{type:`string`}},required:[`title`],additionalProperties:!1}},signal:t,options:{querySource:`generate_session_title`,agents:[],isNonInteractiveSession:i(),hasAppendSystemPrompt:!1,mcpTools:[]}})).message.content),r=w().safeParse(d(e)),a=r.success&&r.data.title.trim()||null;return l(`tengu_session_title_generated`,{success:a!==null}),a}catch(e){return o(`generateSessionTitle failed: ${e}`,{level:`error`}),l(`tengu_session_title_generated`,{success:!1}),null}}var S,C,w,T=e((()=>{r(),a(),c(),v(),s(),u(),p(),h(),g(),S=1e3,C=`Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.
|
|
3
|
+
|
|
4
|
+
Return JSON with a single "title" field.
|
|
5
|
+
|
|
6
|
+
Good examples:
|
|
7
|
+
{"title": "Fix login button on mobile"}
|
|
8
|
+
{"title": "Add OAuth authentication"}
|
|
9
|
+
{"title": "Debug failing CI tests"}
|
|
10
|
+
{"title": "Refactor API client error handling"}
|
|
11
|
+
|
|
12
|
+
Bad (too vague): {"title": "Code changes"}
|
|
13
|
+
Bad (too long): {"title": "Investigate and fix the issue where the login button does not respond on mobile devices"}
|
|
14
|
+
Bad (wrong case): {"title": "Fix Login Button On Mobile"}`,w=f(()=>n({title:t()}))}));export{x as n,T as r,b as t};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{n as r,r as i,s as a}from"./esm-CJlBxjtx.js";import{Ct as o,N as s,U as c,cn as l,pt as u}from"./state-sIHsFpDu.js";import{Ac as d,Ec as f,J as p,S as m,Z as h,Zt as ee,_ as g,at as _,on as te,st as ne}from"./paths-BBvuDQl9.js";import{E as v,T as re,V as ie,d as ae,s as oe,w as se}from"./debug-UI3T040K.js";import{i as ce,t as le}from"./hash-BRmOQc3c.js";import{i as ue,l as de,n as fe,t as pe}from"./teammate-DMYOtLTK.js";import"path";import"fs";import{createHash as me}from"crypto";import"fs/promises";import{AsyncLocalStorage as he}from"async_hooks";function ge(e){let t=BigInt(58),n=Array(b).fill(y[0]),r=b-1,i=e;for(;i>0n;)n[r]=y[Number(i%t)],i/=t,r--;return n.join(``)}function _e(e){let t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Invalid UUID hex length: ${t.length}`);return BigInt(`0x`+t)}function ve(e,t){return`${e}_${ye}${ge(_e(t))}`}var y,ye,b,be=e((()=>{y=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,ye=`01`,b=22}));function x(e){let t=xe[e],r=process.env[e];return r===void 0?t:n(r)}function S(){let e=f(),t=o(),n={"user.id":e};x(`OTEL_METRICS_INCLUDE_SESSION_ID`)&&(n[`session.id`]=t),x(`OTEL_METRICS_INCLUDE_VERSION`)&&(n[`app.version`]=`2.6.5`);let r=ee();if(r){let e=r.organizationUuid,t=r.emailAddress,i=r.accountUuid;e&&(n[`organization.id`]=e),t&&(n[`user.email`]=t),i&&x(`OTEL_METRICS_INCLUDE_ACCOUNT_UUID`)&&(n[`user.account_uuid`]=i,n[`user.account_id`]=process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID||ve(`user`,i))}return _.terminal&&(n[`terminal.type`]=_.terminal),n}var xe,C=e((()=>{l(),te(),d(),ne(),t(),be(),xe={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}}));function Se(){return n(process.env.OTEL_LOG_USER_PROMPTS)}function Ce(e){return Se()?e:`<REDACTED>`}async function w(e,t={}){let n=s();if(!n){T||(T=!0,ae(`[3P telemetry] Event dropped (no event logger initialized): ${e}`,{level:`warn`}));return}let r={...S(),"event.name":e,"event.timestamp":new Date().toISOString(),"event.sequence":we++},i=u();i&&(r[`prompt.id`]=i);let a=process.env.CLAUDE_CODE_WORKSPACE_HOST_PATHS;a&&(r[`workspace.host_paths`]=a.split(`|`));for(let[e,n]of Object.entries(t))n!==void 0&&(r[e]=n);n.emit({body:`claude_code.${e}`,attributes:r})}var we,T,Te=e((()=>{l(),oe(),t(),C(),we=0,T=!1}));function Ee(e){return Math.abs(le(e))||1}function De(e){let t=L.get(e);return t===void 0?(I++,L.set(e,I),I):t}function E(){let e=pe()??o(),t=fe()??`main`,n=ue(),r=P.get(e);if(r)return r;let i={agentId:e,agentName:t,parentAgentId:n,processId:e===o()?1:De(e),threadId:Ee(t)};return P.set(e,i),F++,i}function D(){return(Date.now()-Be)*1e3}function O(){return`span_${++Ve}`}function Oe(){let e=process.env.CLAUDE_CODE_PERFETTO_TRACE;ae(`[Perfetto] initializePerfettoTracing called, env value: ${e}`)}function ke(e){A&&(j.push({name:`process_name`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:0,args:{name:e.agentName}}),j.push({name:`thread_name`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:e.threadId,args:{name:e.agentName}}),e.parentAgentId&&j.push({name:`parent_agent`,cat:`__metadata`,ph:`M`,ts:0,pid:e.processId,tid:0,args:{parent_agent_id:e.parentAgentId}}))}function k(){return A}function Ae(e,t,n){if(!A)return;let r={agentId:e,agentName:t,parentAgentId:n,processId:De(e),threadId:Ee(t)};P.set(e,r),F++,ke(r)}function je(e){A&&(P.delete(e),L.delete(e))}function Me(e){if(!A)return``;let t=O(),n=E();return N.set(t,{name:`API Call`,category:`api`,startTime:D(),agentInfo:n,args:{model:e.model,prompt_tokens:e.promptTokens,message_id:e.messageId,is_speculative:e.isSpeculative??!1,query_source:e.querySource}}),M.push({name:`API Call`,cat:`api`,ph:`B`,ts:N.get(t).startTime,pid:n.processId,tid:n.threadId,args:N.get(t).args}),t}function Ne(e,t){if(!A||!e)return;let n=N.get(e);if(!n)return;let r=D(),i=r-n.startTime,a=t.promptTokens??n.args.prompt_tokens,o=t.ttftMs,s=t.ttltMs,c=t.outputTokens,l=t.cacheReadTokens,u=o!==void 0&&a!==void 0&&o>0?Math.round(a/(o/1e3)*100)/100:void 0,d=s!==void 0&&o!==void 0?s-o:void 0,f=d!==void 0&&c!==void 0&&d>0?Math.round(c/(d/1e3)*100)/100:void 0,p=l!==void 0&&a!==void 0&&a>0?Math.round(l/a*1e4)/100:void 0,m=t.requestSetupMs,h=t.attemptStartTimes,ee={...n.args,ttft_ms:o,ttlt_ms:s,prompt_tokens:a,output_tokens:c,cache_read_tokens:l,cache_creation_tokens:t.cacheCreationTokens,message_id:t.messageId??n.args.message_id,success:t.success??!0,error:t.error,duration_ms:i/1e3,request_setup_ms:m,itps:u,otps:f,cache_hit_rate_pct:p},g=m!==void 0&&m>0?m*1e3:0;if(g>0){let e=n.startTime+g;if(M.push({name:`Request Setup`,cat:`api,setup`,ph:`B`,ts:n.startTime,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{request_setup_ms:m,attempt_count:h?.length??1}}),h&&h.length>1){let e=h[0];for(let t=0;t<h.length-1;t++){let r=n.startTime+(h[t]-e)*1e3,i=n.startTime+(h[t+1]-e)*1e3;M.push({name:`Attempt ${t+1} (retry)`,cat:`api,retry`,ph:`B`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{attempt:t+1}}),M.push({name:`Attempt ${t+1} (retry)`,cat:`api,retry`,ph:`E`,ts:i,pid:n.agentInfo.processId,tid:n.agentInfo.threadId})}}M.push({name:`Request Setup`,cat:`api,setup`,ph:`E`,ts:e,pid:n.agentInfo.processId,tid:n.agentInfo.threadId})}if(o!==void 0){let e=n.startTime+g,t=e+o*1e3;M.push({name:`First Token`,cat:`api,ttft`,ph:`B`,ts:e,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{ttft_ms:o,prompt_tokens:a,itps:u,cache_hit_rate_pct:p}}),M.push({name:`First Token`,cat:`api,ttft`,ph:`E`,ts:t,pid:n.agentInfo.processId,tid:n.agentInfo.threadId});let r=s===void 0?void 0:s-o-g/1e3;r!==void 0&&r>0&&(M.push({name:`Sampling`,cat:`api,sampling`,ph:`B`,ts:t,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:{sampling_ms:r,output_tokens:c,otps:f}}),M.push({name:`Sampling`,cat:`api,sampling`,ph:`E`,ts:t+r*1e3,pid:n.agentInfo.processId,tid:n.agentInfo.threadId}))}M.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:ee}),N.delete(e)}function Pe(e,t){if(!A)return``;let n=O(),r=E();return N.set(n,{name:`Tool: ${e}`,category:`tool`,startTime:D(),agentInfo:r,args:{tool_name:e,...t}}),M.push({name:`Tool: ${e}`,cat:`tool`,ph:`B`,ts:N.get(n).startTime,pid:r.processId,tid:r.threadId,args:N.get(n).args}),n}function Fe(e,t){if(!A||!e)return;let n=N.get(e);if(!n)return;let r=D(),i=r-n.startTime,a={...n.args,success:t?.success??!0,error:t?.error,result_tokens:t?.resultTokens,duration_ms:i/1e3};M.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:a}),N.delete(e)}function Ie(e){if(!A)return``;let t=O(),n=E();return N.set(t,{name:`Waiting for User Input`,category:`user_input`,startTime:D(),agentInfo:n,args:{context:e}}),M.push({name:`Waiting for User Input`,cat:`user_input`,ph:`B`,ts:N.get(t).startTime,pid:n.processId,tid:n.threadId,args:N.get(t).args}),t}function Le(e,t){if(!A||!e)return;let n=N.get(e);if(!n)return;let r=D(),i=r-n.startTime,a={...n.args,decision:t?.decision,source:t?.source,duration_ms:i/1e3};M.push({name:n.name,cat:n.category,ph:`E`,ts:r,pid:n.agentInfo.processId,tid:n.agentInfo.threadId,args:a}),N.delete(e)}function Re(e){if(!A)return``;let t=O(),n=E();return N.set(t,{name:`Interaction`,category:`interaction`,startTime:D(),agentInfo:n,args:{user_prompt_length:e?.length}}),M.push({name:`Interaction`,cat:`interaction`,ph:`B`,ts:N.get(t).startTime,pid:n.processId,tid:n.threadId,args:N.get(t).args}),t}function ze(e){if(!A||!e)return;let t=N.get(e);if(!t)return;let n=D(),r=n-t.startTime;M.push({name:t.name,cat:t.category,ph:`E`,ts:n,pid:t.agentInfo.processId,tid:t.agentInfo.threadId,args:{...t.args,duration_ms:r/1e3}}),N.delete(e)}var A,j,M,N,P,F,Be,Ve,I,L,He=e((()=>{l(),oe(),t(),ie(),ce(),se(),de(),A=!1,j=[],M=[],N=new Map,P=new Map,F=0,Be=0,Ve=0,I=1,L=new Map}));function Ue(){H.clear(),U.clear()}function R(){return n(process.env.ENABLE_BETA_TRACING_DETAILED)&&process.env.BETA_TRACING_ENDPOINT?process.env.USER_TYPE===`ant`?!0:c()||g(`tengu_trace_lantern`,!1):!1}function z(e,t=Qe){return e.length<=t?{content:e,truncated:!1}:{content:e.slice(0,t)+`
|
|
2
|
+
|
|
3
|
+
[TRUNCATED - Content exceeds 60KB limit]`,truncated:!0}}function B(e){return me(`sha256`).update(e).digest(`hex`).slice(0,12)}function We(e){return`sp_${B(e)}`}function Ge(e){return`msg_${B(v(e.message.content))}`}function V(e){let t=e.trim().match($e);return t&&t[1]?t[1].trim():null}function Ke(e){let t=[],n=[];for(let r of e){let e=r.message.content;if(typeof e==`string`){let r=V(e);r?n.push(r):t.push(`[USER]\n${e}`)}else if(Array.isArray(e)){for(let r of e)if(r.type===`text`){let e=V(r.text);e?n.push(e):t.push(`[USER]\n${r.text}`)}else if(r.type===`tool_result`){let e=typeof r.content==`string`?r.content:v(r.content),i=V(e);i?n.push(i):t.push(`[TOOL RESULT: ${r.tool_use_id}]\n${e}`)}}}return{contextParts:t,systemReminders:n}}function qe(e,t){if(!R())return;let{content:n,truncated:r}=z(`[USER PROMPT]\n${t}`);e.setAttributes({new_context:n,...r&&{new_context_truncated:!0,new_context_original_length:t.length}})}function Je(e,t,n){if(R()){if(t?.systemPrompt){let n=We(t.systemPrompt),r=t.systemPrompt.slice(0,500);if(e.setAttribute(`system_prompt_hash`,n),e.setAttribute(`system_prompt_preview`,r),e.setAttribute(`system_prompt_length`,t.systemPrompt.length),!H.has(n)){H.add(n);let{content:e,truncated:r}=z(t.systemPrompt);w(`system_prompt`,{system_prompt_hash:n,system_prompt:e,system_prompt_length:String(t.systemPrompt.length),...r&&{system_prompt_truncated:`true`}})}}if(t?.tools)try{let n=re(t.tools).map(e=>{let t=v(e),n=B(t);return{name:typeof e.name==`string`?e.name:`unknown`,hash:n,json:t}});e.setAttribute(`tools`,v(n.map(({name:e,hash:t})=>({name:e,hash:t})))),e.setAttribute(`tools_count`,n.length);for(let{name:e,hash:t,json:r}of n)if(!H.has(`tool_${t}`)){H.add(`tool_${t}`);let{content:n,truncated:i}=z(r);w(`tool`,{tool_name:h(e),tool_hash:t,tool:n,...i&&{tool_truncated:`true`}})}}catch{e.setAttribute(`tools_parse_error`,!0)}if(n&&n.length>0&&t?.querySource){let r=t.querySource,i=U.get(r),a=0;if(i)for(let e=0;e<n.length;e++){let t=n[e];if(t&&Ge(t)===i){a=e+1;break}}let o=n.slice(a).filter(e=>e.type===`user`);if(o.length>0){let{contextParts:t,systemReminders:i}=Ke(o);if(t.length>0){let n=t.join(`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
`),{content:r,truncated:i}=z(n);e.setAttributes({new_context:r,new_context_message_count:o.length,...i&&{new_context_truncated:!0,new_context_original_length:n.length}})}if(i.length>0){let t=i.join(`
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
`),{content:n,truncated:r}=z(t);e.setAttributes({system_reminders:n,system_reminders_count:i.length,...r&&{system_reminders_truncated:!0,system_reminders_original_length:t.length}})}let a=n[n.length-1];a&&U.set(r,Ge(a))}}}}function Ye(e,t){if(!(!R()||!t)){if(t.modelOutput!==void 0){let{content:n,truncated:r}=z(t.modelOutput);e[`response.model_output`]=n,r&&(e[`response.model_output_truncated`]=!0,e[`response.model_output_original_length`]=t.modelOutput.length)}if(process.env.USER_TYPE===`ant`&&t.thinkingOutput!==void 0){let{content:n,truncated:r}=z(t.thinkingOutput);e[`response.thinking_output`]=n,r&&(e[`response.thinking_output_truncated`]=!0,e[`response.thinking_output_original_length`]=t.thinkingOutput.length)}}}function Xe(e,t,n){if(!R())return;let{content:r,truncated:i}=z(`[TOOL INPUT: ${t}]\n${n}`);e.setAttributes({tool_input:r,...i&&{tool_input_truncated:!0,tool_input_original_length:n.length}})}function Ze(e,t,n){if(!R())return;let{content:r,truncated:i}=z(`[TOOL RESULT: ${t}]\n${n}`);e.new_context=r,i&&(e.new_context_truncated=!0,e.new_context_original_length=n.length)}var H,U,Qe,$e,et=e((()=>{l(),m(),p(),t(),se(),Te(),H=new Set,U=new Map,Qe=60*1024,$e=/^<system-reminder>\n?([\s\S]*?)\n?<\/system-reminder>$/}));function W(e){return e.spanContext().spanId||``}function tt(){if($)return;$=!0;let e=setInterval(()=>{let e=Date.now()-_t;for(let[t,n]of X){let r=n.deref();r===void 0?(X.delete(t),Z.delete(t)):r.startTime<e&&(r.ended||r.span.end(),X.delete(t),Z.delete(t))}},6e4);typeof e.unref==`function`&&e.unref()}function nt(){return!1}function G(){return nt()||R()}function K(){return i.getTracer(`com.anthropic.claude_code.tracing`,`1.0.0`)}function q(e,t={}){return{...S(),"span.type":e,...t}}function rt(e){tt();let t=k()?Re(e):void 0;if(!G()){if(t){let e=i.getActiveSpan()||K().startSpan(`dummy`),n=W(e),r={span:e,startTime:Date.now(),attributes:{},perfettoSpanId:t};return X.set(n,new WeakRef(r)),J.enterWith(r),e}return i.getActiveSpan()||K().startSpan(`dummy`)}let r=K(),a=n(process.env.OTEL_LOG_USER_PROMPTS)?e:`<REDACTED>`;Q++;let o=q(`interaction`,{user_prompt:a,user_prompt_length:e.length,"interaction.sequence":Q}),s=r.startSpan(`claude_code.interaction`,{attributes:o});qe(s,e);let c=W(s),l={span:s,startTime:Date.now(),attributes:o,perfettoSpanId:t};return X.set(c,new WeakRef(l)),J.enterWith(l),s}function it(){let e=J.getStore();if(!e||e.ended)return;if(e.perfettoSpanId&&ze(e.perfettoSpanId),!G()){e.ended=!0,X.delete(W(e.span)),J.enterWith(void 0);return}let t=Date.now()-e.startTime;e.span.setAttributes({"interaction.duration_ms":t}),e.span.end(),e.ended=!0,X.delete(W(e.span)),J.enterWith(void 0)}function at(e,t,n,r){let o=k()?Me({model:e,querySource:t?.querySource,messageId:void 0}):void 0;if(!G()){if(o){let t=i.getActiveSpan()||K().startSpan(`dummy`),n=W(t),r={span:t,startTime:Date.now(),attributes:{model:e},perfettoSpanId:o};return X.set(n,new WeakRef(r)),Z.set(n,r),t}return i.getActiveSpan()||K().startSpan(`dummy`)}let s=K(),c=J.getStore(),l=q(`llm_request`,{model:e,"llm_request.context":c?`interaction`:`standalone`,speed:r?`fast`:`normal`}),u=c?i.setSpan(a.active(),c.span):a.active(),d=s.startSpan(`claude_code.llm_request`,{attributes:l},u);t?.querySource&&d.setAttribute(`query_source`,t.querySource),Je(d,t,n);let f=W(d),p={span:d,startTime:Date.now(),attributes:l,perfettoSpanId:o};return X.set(f,new WeakRef(p)),Z.set(f,p),d}function ot(e,t){let n;if(e){let t=W(e);n=X.get(t)?.deref()}else n=Array.from(X.values()).findLast(e=>{let t=e.deref();return t?.attributes[`span.type`]===`llm_request`||t?.attributes.model})?.deref();if(!n)return;let r=Date.now()-n.startTime;if(n.perfettoSpanId&&Ne(n.perfettoSpanId,{ttftMs:t?.ttftMs,ttltMs:r,promptTokens:t?.inputTokens,outputTokens:t?.outputTokens,cacheReadTokens:t?.cacheReadTokens,cacheCreationTokens:t?.cacheCreationTokens,success:t?.success,error:t?.error,requestSetupMs:t?.requestSetupMs,attemptStartTimes:t?.attemptStartTimes}),!G()){let e=W(n.span);X.delete(e),Z.delete(e);return}let i={duration_ms:r};t&&(t.inputTokens!==void 0&&(i.input_tokens=t.inputTokens),t.outputTokens!==void 0&&(i.output_tokens=t.outputTokens),t.cacheReadTokens!==void 0&&(i.cache_read_tokens=t.cacheReadTokens),t.cacheCreationTokens!==void 0&&(i.cache_creation_tokens=t.cacheCreationTokens),t.success!==void 0&&(i.success=t.success),t.statusCode!==void 0&&(i.status_code=t.statusCode),t.error!==void 0&&(i.error=t.error),t.attempt!==void 0&&(i.attempt=t.attempt),t.hasToolCall!==void 0&&(i[`response.has_tool_call`]=t.hasToolCall),t.ttftMs!==void 0&&(i.ttft_ms=t.ttftMs),Ye(i,t)),n.span.setAttributes(i),n.span.end();let a=W(n.span);X.delete(a),Z.delete(a)}function st(e,t,n){let r=k()?Pe(e,t):void 0;if(!G()){if(r){let t=i.getActiveSpan()||K().startSpan(`dummy`),n=W(t),a={span:t,startTime:Date.now(),attributes:{"span.type":`tool`,tool_name:e},perfettoSpanId:r};return X.set(n,new WeakRef(a)),Y.enterWith(a),t}return i.getActiveSpan()||K().startSpan(`dummy`)}let o=K(),s=J.getStore(),c=q(`tool`,{tool_name:e,...t}),l=s?i.setSpan(a.active(),s.span):a.active(),u=o.startSpan(`claude_code.tool`,{attributes:c},l);n&&Xe(u,e,n);let d=W(u),f={span:u,startTime:Date.now(),attributes:c,perfettoSpanId:r};return X.set(d,new WeakRef(f)),Y.enterWith(f),u}function ct(){let e=k()?Ie(`tool_permission`):void 0;if(!G()){if(e){let t=i.getActiveSpan()||K().startSpan(`dummy`),n=W(t),r={span:t,startTime:Date.now(),attributes:{"span.type":`tool.blocked_on_user`},perfettoSpanId:e};return X.set(n,new WeakRef(r)),Z.set(n,r),t}return i.getActiveSpan()||K().startSpan(`dummy`)}let t=K(),n=Y.getStore(),r=q(`tool.blocked_on_user`),o=n?i.setSpan(a.active(),n.span):a.active(),s=t.startSpan(`claude_code.tool.blocked_on_user`,{attributes:r},o),c=W(s),l={span:s,startTime:Date.now(),attributes:r,perfettoSpanId:e};return X.set(c,new WeakRef(l)),Z.set(c,l),s}function lt(e,t){let n=Array.from(X.values()).findLast(e=>e.deref()?.attributes[`span.type`]===`tool.blocked_on_user`)?.deref();if(!n)return;if(n.perfettoSpanId&&Le(n.perfettoSpanId,{decision:e,source:t}),!G()){let e=W(n.span);X.delete(e),Z.delete(e);return}let r={duration_ms:Date.now()-n.startTime};e&&(r.decision=e),t&&(r.source=t),n.span.setAttributes(r),n.span.end();let i=W(n.span);X.delete(i),Z.delete(i)}function ut(){if(!G())return i.getActiveSpan()||K().startSpan(`dummy`);let e=K(),t=Y.getStore(),n=q(`tool.execution`),r=t?i.setSpan(a.active(),t.span):a.active(),o=e.startSpan(`claude_code.tool.execution`,{attributes:n},r),s=W(o),c={span:o,startTime:Date.now(),attributes:n};return X.set(s,new WeakRef(c)),Z.set(s,c),o}function dt(e){if(!G())return;let t=Array.from(X.values()).findLast(e=>e.deref()?.attributes[`span.type`]===`tool.execution`)?.deref();if(!t)return;let n={duration_ms:Date.now()-t.startTime};e&&(e.success!==void 0&&(n.success=e.success),e.error!==void 0&&(n.error=e.error)),t.span.setAttributes(n),t.span.end();let r=W(t.span);X.delete(r),Z.delete(r)}function ft(e,t){let n=Y.getStore();if(!n)return;if(n.perfettoSpanId&&Fe(n.perfettoSpanId,{success:!0,resultTokens:t}),!G()){let e=W(n.span);X.delete(e),Y.enterWith(void 0);return}let r={duration_ms:Date.now()-n.startTime};e&&Ze(r,n.attributes.tool_name||`unknown`,e),t!==void 0&&(r.result_tokens=t),n.span.setAttributes(r),n.span.end();let i=W(n.span);X.delete(i),Y.enterWith(void 0)}function pt(){return n(process.env.OTEL_LOG_TOOL_CONTENT)}function mt(e,t){if(!G()||!pt())return;let n=Y.getStore();if(!n)return;let r={};for(let[e,n]of Object.entries(t))if(typeof n==`string`){let{content:t,truncated:i}=z(n);r[e]=t,i&&(r[`${e}_truncated`]=!0,r[`${e}_original_length`]=n.length)}else r[e]=n;n.span.addEvent(e,r)}function ht(e,t,n,r){if(!R())return i.getActiveSpan()||K().startSpan(`dummy`);let o=K(),s=Y.getStore()??J.getStore(),c=q(`hook`,{hook_event:e,hook_name:t,num_hooks:n,hook_definitions:r}),l=s?i.setSpan(a.active(),s.span):a.active(),u=o.startSpan(`claude_code.hook`,{attributes:c},l),d=W(u),f={span:u,startTime:Date.now(),attributes:c};return X.set(d,new WeakRef(f)),Z.set(d,f),u}function gt(e,t){if(!R())return;let n=W(e),r=X.get(n)?.deref();if(!r)return;let i={duration_ms:Date.now()-r.startTime};t&&(t.numSuccess!==void 0&&(i.num_success=t.numSuccess),t.numBlocking!==void 0&&(i.num_blocking=t.numBlocking),t.numNonBlockingError!==void 0&&(i.num_non_blocking_error=t.numNonBlockingError),t.numCancelled!==void 0&&(i.num_cancelled=t.numCancelled)),r.span.setAttributes(i),r.span.end(),X.delete(n),Z.delete(n)}var J,Y,X,Z,Q,$,_t,vt=e((()=>{r(),m(),t(),C(),et(),He(),J=new he,Y=new he,X=new Map,Z=new Map,Q=0,$=!1,_t=1800*1e3}));export{je as C,S as D,Ce as E,C as O,Ae as S,w as T,et as _,lt as a,Oe as b,vt as c,rt as d,at as f,Ue as g,st as h,ot as i,nt as l,ut as m,gt as n,dt as o,ct as p,it as r,ft as s,mt as t,ht as u,R as v,Te as w,k as x,He as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Cn as t,Ln as n,Mn as r,wn as i}from"./schemas-BGAvj1T4.js";import{t as a}from"./v4-f1i_CNUT.js";import{cn as o}from"./state-sIHsFpDu.js";import{Ac as s,Fa as c,S as l,on as u,oo as d}from"./paths-BBvuDQl9.js";import{V as f}from"./debug-UI3T040K.js";import{P as p,v as m}from"./git-CN3qtTb_.js";import{u as h}from"./oauth-CdZEzMww.js";import{n as g,t as _}from"./lazySchema-2sOku3cX.js";import{qa as v,xk as y}from"./loadAgentsDir-DI1a76pd.js";import"path";import"fs/promises";var b,x=e((()=>{a(),_(),b=g(()=>i({entries:r(n(),n())})),g(()=>i({userId:n(),version:t(),lastModified:n(),checksum:n(),content:b()}))})),S=e((()=>{o(),h(),u(),y(),s(),p(),f(),m(),c(),d(),l(),v(),x()}));export{S as t};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{l as t,n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{i as a,t as o}from"./src-BJz1KAd_.js";import{H as ee,U as s,cn as te,yt as ne}from"./state-sIHsFpDu.js";import{Ac as c,Pc as l,S as u,Sc as d,_ as f}from"./paths-BBvuDQl9.js";import{E as p,V as m,W as re,d as h,s as g,w as _}from"./debug-UI3T040K.js";import{n as v,t as ie}from"./bundledMode-kSQejuY4.js";import{i as y,o as ae}from"./platform-CuyedWpe.js";import{n as oe,r as se}from"./execFileNoThrow-CuQN1sz8.js";import{n as b,t as x}from"./distRoot-CcxmnzqQ.js";import{a as S,c as C,d as w,n as T,r as E,t as D}from"./common-CMCv4N_v.js";import{a as O,i as k}from"./prompt-4tea6NJQ.js";import{homedir as A}from"os";import{join as j}from"path";import{chmod as M,mkdir as N,readFile as P,readdir as F,writeFile as I}from"fs/promises";function L(){return process.env.USER_TYPE===`ant`?[B,V,H]:[B]}async function R(e,t){if(e.length===0)return t?.(`[Claude in Chrome] No browser paths to check`),{isInstalled:!1,browser:null};let n=L();for(let{browser:r,path:i}of e){let e=[];try{e=await F(i,{withFileTypes:!0})}catch(e){if(re(e))continue;throw e}let a=e.filter(e=>e.isDirectory()).filter(e=>e.name===`Default`||e.name.startsWith(`Profile `)).map(e=>e.name);a.length>0&&t?.(`[Claude in Chrome] Found ${r} profiles: ${a.join(`, `)}`);for(let e of a)for(let a of n){let n=j(i,e,`Extensions`,a);try{return await F(n),t?.(`[Claude in Chrome] Extension ${a} found in ${r} ${e}`),{isInstalled:!0,browser:r}}catch{}}}return t?.(`[Claude in Chrome] Extension not found in any browser`),{isInstalled:!1,browser:null}}async function z(e,t){return(await R(e,t)).isInstalled}var B,V,H,U=e((()=>{m(),B=`fcoeoabgfenejglbffodgkkbkcdhcgfn`,V=`dihbgbndebgnbjfmelmegjepbnkhlgni`,H=`dngcpimnedloihjnnfngkgjoidhnaolf`}));function W(e){if(s()&&e!==!0)return!1;if(e===!0)return!0;if(e===!1)return!1;if(i(process.env.CLAUDE_CODE_ENABLE_CFC))return!0;if(t(process.env.CLAUDE_CODE_ENABLE_CFC))return!1;let n=d();return n.claudeInChromeDefaultEnabled===void 0?!1:n.claudeInChromeDefaultEnabled}function G(){return $===void 0&&($=ee()&&ue()&&(process.env.USER_TYPE===`ant`||f(`tengu_chrome_auto_enable`,!1))),$}function K(){let e=v(),t=a.map(e=>`mcp__claude-in-chrome__${e.name}`),n={};ne()&&(n.CLAUDE_CHROME_PERMISSION_MODE=`skip_all_permission_checks`);let r=Object.keys(n).length>0;if(e)return J(`"${process.execPath}" --chrome-native-host`).then(e=>q(e)).catch(e=>h(`[Claude in Chrome] Failed to install native host: ${e}`,{level:`error`})),{mcpConfig:{[D]:{type:`stdio`,command:process.execPath,args:[`--claude-in-chrome-mcp`],scope:`dynamic`,...r&&{env:n}}},allowedTools:t,systemPrompt:k()};{let e=j(x,`cli.js`);return J(`"${process.execPath}" "${e}" --chrome-native-host`).then(e=>q(e)).catch(e=>h(`[Claude in Chrome] Failed to install native host: ${e}`,{level:`error`})),{mcpConfig:{[D]:{type:`stdio`,command:process.execPath,args:[`${e}`,`--claude-in-chrome-mcp`],scope:`dynamic`,...r&&{env:n}}},allowedTools:t,systemPrompt:k()}}}function ce(){if(y()===`windows`){let e=A();return[j(process.env.APPDATA||j(e,`AppData`,`Local`),`Claude Code`,`ChromeNativeHost`)]}return E().map(({path:e})=>e)}async function q(e){let t=ce();if(t.length===0)throw Error(`Claude in Chrome Native Host not supported on this platform`);let n=p({name:Z,description:`Claude Code Browser Extension Native Host`,path:e,type:`stdio`,allowed_origins:[`chrome-extension://fcoeoabgfenejglbffodgkkbkcdhcgfn/`,...process.env.USER_TYPE===`ant`?[`chrome-extension://dihbgbndebgnbjfmelmegjepbnkhlgni/`,`chrome-extension://dngcpimnedloihjnnfngkgjoidhnaolf/`]:[]]},null,2),r=!1;for(let e of t){let t=j(e,Q);if(await P(t,`utf-8`).catch(()=>null)!==n)try{await N(e,{recursive:!0}),await I(t,n),h(`[Claude in Chrome] Installed native host manifest at: ${t}`),r=!0}catch(e){h(`[Claude in Chrome] Failed to install manifest at ${t}: ${e}`)}}y()===`windows`&&le(j(t[0],Q)),r&&Y().then(e=>{e?(h(`[Claude in Chrome] First-time install detected, opening reconnect page in browser`),w(X)):h(`[Claude in Chrome] First-time install detected, but extension not installed, skipping reconnect`)})}function le(e){let t=S();for(let{browser:n,key:r}of t){let t=`${r}\\${Z}`;oe(`reg`,[`add`,t,`/ve`,`/t`,`REG_SZ`,`/d`,e,`/f`]).then(e=>{e.code===0?h(`[Claude in Chrome] Registered native host for ${n} in Windows registry: ${t}`):h(`[Claude in Chrome] Failed to register native host for ${n} in Windows registry: ${e.stderr}`)})}}async function J(e){let t=y(),r=j(n(),`chrome`),i=t===`windows`?j(r,`chrome-native-host.bat`):j(r,`chrome-native-host`),a=t===`windows`?`@echo off
|
|
2
|
+
REM Chrome native host wrapper script
|
|
3
|
+
REM Generated by Claude Code - do not edit manually
|
|
4
|
+
${e}
|
|
5
|
+
`:`#!/bin/sh
|
|
6
|
+
# Chrome native host wrapper script
|
|
7
|
+
# Generated by Claude Code - do not edit manually
|
|
8
|
+
exec ${e}
|
|
9
|
+
`;return await P(i,`utf-8`).catch(()=>null)===a?i:(await N(r,{recursive:!0}),await I(i,a),t!==`windows`&&await M(i,493),h(`[Claude in Chrome] Created Chrome native host wrapper script: ${i}`),i)}function ue(){return Y().then(e=>{e&&d().cachedChromeExtensionInstalled!==e&&l(t=>({...t,cachedChromeExtensionInstalled:e}))}),d().cachedChromeExtensionInstalled??!1}async function Y(){let e=T();return e.length===0?(h(`[Claude in Chrome] Unsupported platform for extension detection: ${y()}`),!1):z(e,h)}var X,Z,Q,$,de=e((()=>{o(),te(),u(),ie(),b(),c(),g(),r(),se(),ae(),_(),C(),O(),U(),X=`https://clau.de/chrome/reconnect`,Z=`com.anthropic.claude_code_browser_extension`,Q=`${Z}.json`}));export{W as a,G as i,Y as n,K as r,de as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{is as e,ls as t}from"./paths-BBvuDQl9.js";import{n,t as r}from"./bundledMode-kSQejuY4.js";import{o as i,r as a,t as o}from"./common-B379wT22.js";import{n as s,t as c}from"./distRoot-CcxmnzqQ.js";import{i as l,t as u}from"./src-BlLavFUS.js";import{i as d,t as f}from"./gates-CSKxLmMJ.js";import{join as p}from"path";u(),t(),r(),s(),i(),d();function m(){let t=l(o,f()).map(t=>e(a,t.name)),r=n()?[`--computer-use-mcp`]:[p(c,`cli.js`),`--computer-use-mcp`];return{mcpConfig:{[a]:{type:`stdio`,command:process.execPath,args:r,scope:`dynamic`}},allowedTools:t}}export{m as setupComputerUseMCP};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as e,s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{In as r,Ln as i}from"./src-Di342QoJ.js";import{Ct as ee,U as a,cn as o,dr as s,jr as c,lr as l,ut as te}from"./state-sIHsFpDu.js";import{Ac as u,Cn as ne,Pc as d,Sc as f,at as p,bc as m,it as h,on as g,rt as _,st as v}from"./paths-BBvuDQl9.js";import{L as y,V as b}from"./debug-UI3T040K.js";import{n as x,r as S}from"./analytics-DqMQntaB.js";import{n as C,t as w}from"./cwd--iizewsn.js";import{F as T,P as E,f as re,n as D,r as O,v as k}from"./git-CN3qtTb_.js";import{a as A,n as j}from"./env-chR0gV31.js";import{o as M,s as N}from"./log-CzsijfHZ.js";import{a as P,n as F}from"./startupProfiler-DnXZaX4A.js";import{Ar as I,Bv as L,Gi as R,Hm as z,Hv as B,LS as V,Mb as H,Mt as U,Mv as W,Nv as G,RS as K,Rb as q,Um as J,Xi as Y,_t as X,bt as Z,gE as ie,gk as ae,hE as oe,vn as se,vt as ce,wt as le,xi as ue,xk as de,yn as fe,zS as pe}from"./loadAgentsDir-DI1a76pd.js";import{l as me,u as he}from"./terminalSetup-Lyg4NbGA.js";import{c as ge,n as _e}from"./releaseNotes-CnhQit0y.js";import{s as ve,u as ye}from"./logoV2Utils-DDUoPClc.js";import{i as be,r as xe}from"./runtimeObserver-nAhH4Wca.js";import{n as Q,r as Se}from"./sessionMemory-CMahwDdW.js";import{t as Ce}from"./sinks-BrrTUxkC.js";import{homedir as we}from"os";import{join as Te}from"path";import{copyFile as Ee,stat as De}from"fs/promises";t(),i(),o(),x(),C(),b(),E(),A(),k(),g(),v(),_(),de(),ie(),K(),he(),W(),z(),Y(),I(),fe(),ge(),be(),Se(),u(),M();function $(){d(e=>({...e,iterm2SetupInProgress:!1}))}function Oe(){let e=f();return{inProgress:e.iterm2SetupInProgress??!1,backupPath:e.iterm2BackupPath||null}}function ke(){return Te(we(),`Library`,`Preferences`,`com.googlecode.iterm2.plist`)}async function Ae(){let{inProgress:e,backupPath:t}=Oe();if(!e)return{status:`no_backup`};if(!t)return $(),{status:`no_backup`};try{await De(t)}catch{return $(),{status:`no_backup`}}try{return await Ee(t,ke()),$(),{status:`restored`}}catch(e){return N(Error(`Failed to restore iTerm2 settings with: ${e}`)),$(),{status:`failed`,backupPath:t}}}u(),M(),ye(),H(),B(),F(),le();async function je(t,i,o,u,d,g,_,v,b){T(`info`,`setup_started`);let x=process.version.match(/^v(\d+)\./)?.[1];if((!x||parseInt(x,10)<18)&&(console.error(r.bold.red(`Error: Claude Code requires Node.js version 18 or higher.`)),process.exit(1)),_&&c(oe(_)),e(),!e()&&h()){let{captureTeammateModeSnapshot:e}=await import(`./teammateModeSnapshot-C6EWhR0X.js`);e()}if(!a()){if(h()){let e=await Ae();e.status===`restored`?console.log(r.yellow(`Detected an interrupted iTerm2 setup. Your original settings have been restored. You may need to restart iTerm2 for the changes to take effect.`)):e.status===`failed`&&console.error(r.red(`Failed to restore iTerm2 settings. Please manually restore your original settings with: defaults import com.googlecode.iterm2 ${e.backupPath}.`))}try{let e=await me();e.status===`restored`?console.log(r.yellow(`Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect.`)):e.status===`failed`&&console.error(r.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){N(e)}}J(t);let C=Date.now();if(V(),T(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-C}),G(t),u){let e=se(),n=await re();!e&&!n&&(process.stderr.write(r.red(`Error: Can only use --worktree in a git repository, but ${r.bold(t)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.\n`)),process.exit(1));let i=v?`pr-${v}`:d??L(),a;if(n){let e=D(w());e||(process.stderr.write(r.red(`Error: Could not determine the main git repository root.
|
|
2
|
+
`)),process.exit(1)),e!==(O(w())??w())&&(T(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),J(e)),a=g?Z(e,U(i)):void 0}else a=g?Z(w(),U(i)):void 0;let o;try{o=await ce(ee(),i,a,v?{prNumber:v}:void 0)}catch(e){process.stderr.write(r.red(`Error creating worktree: ${y(e)}\n`)),process.exit(1)}if(S(`tengu_worktree_created`,{tmux_enabled:g}),g&&a){let e=await X(a,o.worktreePath);e.created?console.log(r.green(`Created tmux session: ${r.bold(a)}\nTo attach: ${r.bold(`tmux attach -t ${a}`)}`)):console.error(r.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(o.worktreePath),J(o.worktreePath),l(w()),s(w()),ue(o),ae(),pe()}T(`info`,`setup_background_jobs_starting`),e()||(Q(),xe()),q(),T(`info`,`setup_background_jobs_launched`),P(`setup_before_prefetch`),T(`info`,`setup_prefetch_starting`);let E=a()&&n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)||e();if(E||R(te()),import(`./loadPluginHooks-C0Ei-0E2.js`).then(e=>{E||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),e()||(process.env.USER_TYPE===`ant`&&import(`./commitAttribution-BA4fcbHf.js`).then(async e=>{if(await e.isInternalModelRepo()){let{clearSystemPromptSections:e}=await import(`./systemPromptSections-DB93ZNWP.js`);e()}}),setImmediate(()=>{import(`./attributionHooks-PygdohOh.js`).then(({registerAttributionHooks:e})=>{e()})}),import(`./sessionFileAccessHooks-qnNiGMnE.js`).then(e=>e.registerSessionFileAccessHooks())),Ce(),S(`tengu_started`,{}),ne(a()),P(`setup_after_prefetch`),!e()){let{hasReleaseNotes:e}=await _e(f().lastReleaseNotesSeen);e&&await ve()}if((i===`bypassPermissions`||o)&&(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!n(process.env.CLAUDE_CODE_BUBBLEWRAP)&&(console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1)),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`claude-desktop`)){let[e,t]=await Promise.all([p.getIsDocker(),j.hasInternetAccess()]),n=p.getIsBubblewrapSandbox(),r=process.env.IS_SANDBOX===`1`;(!(e||n||r)||t)&&(console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${e}, Bubblewrap: ${n}, IS_SANDBOX: ${r}, hasInternet: ${t}`),process.exit(1))}let k=m();k.lastCost!==void 0&&k.lastDuration!==void 0&&S(`tengu_exit`,{last_session_cost:k.lastCost,last_session_api_duration:k.lastAPIDuration,last_session_tool_duration:k.lastToolDuration,last_session_duration:k.lastDuration,last_session_lines_added:k.lastLinesAdded,last_session_lines_removed:k.lastLinesRemoved,last_session_total_input_tokens:k.lastTotalInputTokens,last_session_total_output_tokens:k.lastTotalOutputTokens,last_session_total_cache_creation_input_tokens:k.lastTotalCacheCreationInputTokens,last_session_total_cache_read_input_tokens:k.lastTotalCacheReadInputTokens,last_session_fps_average:k.lastFpsAverage,last_session_fps_low_1_pct:k.lastFpsLow1Pct,last_session_id:k.lastSessionId,...k.lastSessionMetrics})}export{je as setup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{H as t,K as n,U as r,W as i,q as a}from"./loadAgentsDir-DI1a76pd.js";import{In as o}from"./prompt-CjFAtm3w.js";function s(e){return e===`projectSettings`||e===`policySettings`||e===`command`}function c(e){return a(e)}function l(e,t,n){let r=c(t.source),i=c(n.source),a=t.ruleValue.toolName;return e===`deny`?`Remove the "${a}" deny rule from ${r}, or remove the specific allow rule from ${i}`:`Remove the "${a}" ask rule from ${r}, or remove the specific allow rule from ${i}`}function u(e,t,n){let{toolName:r,ruleContent:i}=e.ruleValue;if(i===void 0)return{shadowed:!1};let a=t.find(e=>e.ruleValue.toolName===r&&e.ruleValue.ruleContent===void 0);return!a||r===`Bash`&&n.sandboxAutoAllowEnabled&&!s(a.source)?{shadowed:!1}:{shadowed:!0,shadowedBy:a,shadowType:`ask`}}function d(e,t){let{toolName:n,ruleContent:r}=e.ruleValue;if(r===void 0)return{shadowed:!1};let i=t.find(e=>e.ruleValue.toolName===n&&e.ruleValue.ruleContent===void 0);return i?{shadowed:!0,shadowedBy:i,shadowType:`deny`}:{shadowed:!1}}function f(e,n){let a=[],o=t(e),s=r(e),f=i(e);for(let e of o){let t=d(e,f);if(t.shadowed){let n=c(t.shadowedBy.source);a.push({rule:e,reason:`Blocked by "${t.shadowedBy.ruleValue.toolName}" deny rule (from ${n})`,shadowedBy:t.shadowedBy,shadowType:`deny`,fix:l(`deny`,t.shadowedBy,e)});continue}let r=u(e,s,n);if(r.shadowed){let t=c(r.shadowedBy.source);a.push({rule:e,reason:`Shadowed by "${r.shadowedBy.ruleValue.toolName}" ask rule (from ${t})`,shadowedBy:r.shadowedBy,shadowType:`ask`,fix:l(`ask`,r.shadowedBy,e)})}}return a}var p=e((()=>{o(),n()}));export{p as n,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./chunk-DR8-3Aex.js";import{E as r,w as i}from"./debug-UI3T040K.js";import{o as a,s as o}from"./log-CzsijfHZ.js";var s=n(((e,t)=>{t.exports=function(e){return e.map(function(e){return e===``?`''`:e&&typeof e==`object`?e.op.replace(/(.)/g,`\\$1`):/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,`$1\\$2`)}).join(` `)}})),c=n(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`"((\\\\"|[^"])*?)"`,o=`'((\\\\'|[^'])*?)'`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r.push(i),t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||(d={});var f=d.escape||`\\`,p=`(\\`+f+`['"`+i+`]|[^\\s'"`+i+`])+`,m=h(e,new RegExp([`(`+n+`)`,`(`+p+`|`+a+`|`+o+`)+`].join(`|`),`g`));if(m.length===0)return[];t||(t={});var _=!1;return m.map(function(n){var i=n[0];if(!i||_)return;if(r.test(i))return{op:i};var a=!1,o=!1,d=``,p=!1,m;function h(){m+=1;var e,n,r=i.charAt(m);if(r===`{`){if(m+=1,i.charAt(m)===`}`)throw Error(`Bad substitution: `+i.slice(m-2,m+1));if(e=i.indexOf(`}`,m),e<0)throw Error(`Bad substitution: `+i.slice(m));n=i.slice(m,e),m=e}else if(/[*@#?$!_-]/.test(r))n=r,m+=1;else{var a=i.slice(m);e=a.match(/[^\w\d_]/),e?(n=a.slice(0,e.index),m+=e.index-1):(n=a,m=i.length)}return g(t,``,n)}for(m=0;m<i.length;m++){var v=i.charAt(m);if(p=p||!a&&(v===`*`||v===`?`),o)d+=v,o=!1;else if(a)v===a?a=!1:a==c?d+=v:v===f?(m+=1,v=i.charAt(m),v===l||v===f||v===u?d+=v:d+=f+v):v===u?d+=h():d+=v;else if(v===l||v===c)a=v;else if(r.test(v))return{op:i};else if(s.test(v)){_=!0;var y={comment:e.slice(n.index+m+1)};return d.length?[d,y]:[y]}else v===f?o=!0:v===u?d+=h():d+=v}return p?{op:`glob`,pattern:d}:d}).reduce(function(e,t){return t===void 0?e:e.concat(t)},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e.concat(t);var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?e.concat(n[0]):e.concat(n.filter(Boolean).map(function(e){return m.test(e)?JSON.parse(e.split(d)[1]):e}))},[]):r}})),l=n((e=>{e.quote=s(),e.parse=c()}));function u(e,t){try{return{success:!0,tokens:(0,h.parse)(e,t)}}catch(e){return e instanceof Error&&o(e),{success:!1,error:e instanceof Error?e.message:`Unknown parse error`}}}function d(e){try{return{success:!0,quoted:(0,h.quote)(e.map((e,t)=>{if(e==null)return String(e);let n=typeof e;if(n===`string`)return e;if(n===`number`||n===`boolean`)return String(e);throw Error(n===`object`?`Cannot quote argument at index ${t}: object values are not supported`:n===`symbol`?`Cannot quote argument at index ${t}: symbol values are not supported`:n===`function`?`Cannot quote argument at index ${t}: function values are not supported`:`Cannot quote argument at index ${t}: unsupported type ${n}`)}))}}catch(e){return e instanceof Error&&o(e),{success:!1,error:e instanceof Error?e.message:`Unknown quote error`}}}function f(e,t){let n=!1,r=!1,i=0,a=0;for(let t=0;t<e.length;t++){let o=e[t];if(o===`\\`&&!n){t++;continue}o===`"`&&!n?(i++,r=!r):o===`'`&&!r&&(a++,n=!n)}if(i%2!=0||a%2!=0)return!0;for(let e of t)if(typeof e==`string`&&((e.match(/{/g)||[]).length!==(e.match(/}/g)||[]).length||(e.match(/\(/g)||[]).length!==(e.match(/\)/g)||[]).length||(e.match(/\[/g)||[]).length!==(e.match(/\]/g)||[]).length||(e.match(/(?<!\\)"/g)||[]).length%2!=0||(e.match(/(?<!\\)'/g)||[]).length%2!=0))return!0;return!1}function p(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&!t){r++;continue}if(i===`"`&&!t){n=!n;continue}if(i===`'`&&!n&&(t=!t,!t)){let t=0,n=r-1;for(;n>=0&&e[n]===`\\`;)t++,n--;if(t>0&&t%2==1||t>0&&t%2==0&&e.indexOf(`'`,r+1)!==-1)return!0}}return!1}function m(e){let t=d([...e]);if(t.success)return t.quoted;try{return(0,h.quote)(e.map(e=>{if(e==null)return String(e);let t=typeof e;return t===`string`||t===`number`||t===`boolean`?String(e):r(e)}))}catch(e){throw e instanceof Error&&o(e),Error(`Failed to quote shell arguments safely`)}}var h,g=e((()=>{h=t(l(),1),a(),i()}));export{u as a,m as i,p as n,l as o,g as r,f as t};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Co as t,Lo as n,Ml as r,Pl as i,bo as a}from"./loadAgentsDir-DI1a76pd.js";import{B as o,P as s}from"./rcDebugLog-CPKZCtR8.js";function c(e){let t=[],n=e.matchAll(d);for(let e of n)e.index!==void 0&&t.push({word:e[0],start:e.index,end:e.index+e[0].length});return t}async function l({question:e,cacheSafeParams:t}){let n=await i({promptMessages:[a({content:`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
|
|
2
|
+
|
|
3
|
+
IMPORTANT CONTEXT:
|
|
4
|
+
- You are a separate, lightweight agent spawned to answer this one question
|
|
5
|
+
- The main agent is NOT interrupted - it continues working independently in the background
|
|
6
|
+
- You share the conversation context but are a completely separate instance
|
|
7
|
+
- Do NOT reference being interrupted or what you were "previously doing" - that framing is incorrect
|
|
8
|
+
|
|
9
|
+
CRITICAL CONSTRAINTS:
|
|
10
|
+
- You have NO tools available - you cannot read files, run commands, search, or take any actions
|
|
11
|
+
- This is a one-off response - there will be no follow-up turns
|
|
12
|
+
- You can ONLY provide information based on what you already know from the conversation context
|
|
13
|
+
- NEVER say things like "Let me try...", "I'll now...", "Let me check...", or promise to take any action
|
|
14
|
+
- If you don't know the answer, say so - do not offer to look it up or investigate
|
|
15
|
+
|
|
16
|
+
Simply answer the question with the information you have.</system-reminder>
|
|
17
|
+
|
|
18
|
+
${e}`})],cacheSafeParams:t,canUseTool:async()=>({behavior:`deny`,message:`Side questions cannot use tools`,decisionReason:{type:`other`,reason:`side_question`}}),querySource:`side_question`,forkLabel:`side_question`,maxTurns:1,skipCacheWrite:!0});return{response:u(n.messages),usage:n.totalUsage}}function u(e){let n=e.flatMap(e=>e.type===`assistant`?e.message.content:[]);if(n.length>0){let e=t(n,`
|
|
19
|
+
|
|
20
|
+
`).trim();if(e)return e;let r=n.find(e=>e.type===`tool_use`);if(r)return`(The model tried to call ${`name`in r?r.name:`a tool`} instead of answering directly. Try rephrasing or ask in the main conversation.)`}let r=e.find(e=>e.type===`system`&&`subtype`in e&&e.subtype===`api_error`);return r?`(API error: ${o(r.error)})`:null}var d,f=e((()=>{s(),r(),n(),d=/^\/btw\b/gi}));export{f as n,l as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./defineProperty-80gRi2ZW.js";import{a as r,i,t as ee}from"./dist-es-C41b_0B5.js";import{A as te,C as ne,D as re,E as ie,F as ae,I as oe,L as se,M as ce,N as le,O as ue,P as de,R as fe,S as pe,_ as me,a as he,b as ge,c as _e,d as ve,f as ye,g as be,h as xe,i as Se,j as Ce,k as we,l as Te,m as Ee,p as De,r as Oe,s as ke,t as Ae,u as je,v as Me,w as Ne,x as Pe,y as Fe,z as Ie}from"./dist-es-Cbf0_D8d.js";import{C as Le,S as Re,c as ze,d as Be,f as Ve,g as He,n as Ue,t as a,v as We}from"./httpAuthSchemes-Wq4XWeLL.js";import{n as Ge,r as Ke,t as qe}from"./dist-es-Bu_Fshi1.js";import{i as Je,n as Ye,t as Xe}from"./dist-es-BVGppqE4.js";import{I as Ze,L as Qe,N as $e,P as et,R as tt,v as o,x as nt,y as s,z as rt}from"./protocols-CAyQOlkr.js";import{n as it,t as at}from"./dist-es-CSfI8B8l.js";import{a as ot,d as st,g as ct,h as lt,i as ut,m as dt,n as ft,o as pt,r as mt,t as ht,u as gt}from"./dist-es-OVleIB54.js";import{g as _t,i as vt,p as yt,t as bt}from"./client-CPn1wQyc.js";import{n as c,t as xt}from"./dist-es-zjcbuB72.js";import{a as St,c as Ct,d as wt,f as Tt,i as Et,n as Dt,o as Ot,s as kt,t as l,u as At}from"./dist-es-UAs0rdXg.js";import{n as jt,t as Mt}from"./package-BhL7chzt.js";function Nt(e){return{schemeId:`aws.auth#sigv4`,signingProperties:{name:`signin`,region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function Pt(e){return{schemeId:`smithy.api#noAuth`}}var Ft,It,Lt,Rt=e((()=>{a(),qe(),Ft=async(e,t,n)=>({operation:Ke(t).operation,region:await Ge(e.region)()||(()=>{throw Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),It=e=>{let t=[];switch(e.operation){case`CreateOAuth2Token`:t.push(Pt(e));break;default:t.push(Nt(e))}return t},Lt=e=>{let t=Ue(e);return Object.assign(t,{authSchemePreference:Ge(e.authSchemePreference??[])})}})),zt,Bt,Vt=e((()=>{zt=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:`signin`}),Bt={UseFIPS:{type:`builtInParams`,name:`useFipsEndpoint`},Endpoint:{type:`builtInParams`,name:`endpoint`},Region:{type:`builtInParams`,name:`region`},UseDualStack:{type:`builtInParams`,name:`useDualstackEndpoint`}}})),u,d,f,p,m,h,g,_,v,y,b,x,S,C,Ht,w,Ut,Wt,Gt=e((()=>{gt(),u=`ref`,d=-1,f=!0,p=`isSet`,m=`PartitionResult`,h=`booleanEquals`,g=`getAttr`,_=`stringEquals`,v={[u]:`Endpoint`},y={[u]:m},b={fn:g,argv:[y,`name`]},x={},S=[{[u]:`Region`}],C={conditions:[[p,[v]],[p,S],[`aws.partition`,S,m],[h,[{[u]:`UseFIPS`},f]],[h,[{[u]:`UseDualStack`},f]],[h,[{fn:g,argv:[y,`supportsDualStack`]},f]],[h,[{fn:g,argv:[y,`supportsFIPS`]},f]],[_,[b,`aws`]],[_,[b,`aws-cn`]],[_,[b,`aws-us-gov`]]],results:[[d],[d,`Invalid Configuration: FIPS and custom endpoint are not supported`],[d,`Invalid Configuration: Dualstack and custom endpoint are not supported`],[v,x],[`https://{Region}.signin.aws.amazon.com`,x],[`https://{Region}.signin.amazonaws.cn`,x],[`https://{Region}.signin.amazonaws-us-gov.com`,x],[`https://signin-fips.{Region}.{PartitionResult#dualStackDnsSuffix}`,x],[d,`FIPS and DualStack are enabled, but this partition does not support one or both`],[`https://signin-fips.{Region}.{PartitionResult#dnsSuffix}`,x],[d,`FIPS is enabled but this partition does not support FIPS`],[`https://signin.{Region}.{PartitionResult#dualStackDnsSuffix}`,x],[d,`DualStack is enabled but this partition does not support DualStack`],[`https://signin.{Region}.{PartitionResult#dnsSuffix}`,x],[d,`Invalid Configuration: Missing Region`]]},Ht=2,w=1e8,Ut=new Int32Array([-1,1,-1,0,15,3,1,4,w+14,2,5,w+14,3,11,6,4,10,7,7,w+4,8,8,w+5,9,9,w+6,w+13,5,w+11,w+12,4,13,12,6,w+9,w+10,5,14,w+8,6,w+7,w+8,3,w+1,16,4,w+2,w+3]),Wt=ct.from(Ut,Ht,C.conditions,C.results)})),Kt,qt,Jt=e((()=>{te(),gt(),Gt(),Kt=new lt({size:50,params:[`Endpoint`,`Region`,`UseDualStack`,`UseFIPS`]}),qt=(e,t={})=>Kt.get(e,()=>st(Wt,{endpointParams:e,logger:t.logger})),dt.aws=Ce})),T,E=e((()=>{l(),T=class e extends Ct{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}})),Yt,Xt,Zt,Qt,$t=e((()=>{E(),t(),Yt=class e extends T{constructor(t){super({name:`AccessDeniedException`,$fault:`client`,...t}),n(this,`name`,`AccessDeniedException`),n(this,`$fault`,`client`),n(this,`error`,void 0),Object.setPrototypeOf(this,e.prototype),this.error=t.error}},Xt=class e extends T{constructor(t){super({name:`InternalServerException`,$fault:`server`,...t}),n(this,`name`,`InternalServerException`),n(this,`$fault`,`server`),n(this,`error`,void 0),Object.setPrototypeOf(this,e.prototype),this.error=t.error}},Zt=class e extends T{constructor(t){super({name:`TooManyRequestsError`,$fault:`client`,...t}),n(this,`name`,`TooManyRequestsError`),n(this,`$fault`,`client`),n(this,`error`,void 0),Object.setPrototypeOf(this,e.prototype),this.error=t.error}},Qt=class e extends T{constructor(t){super({name:`ValidationException`,$fault:`client`,...t}),n(this,`name`,`ValidationException`),n(this,`$fault`,`client`),n(this,`error`,void 0),Object.setPrototypeOf(this,e.prototype),this.error=t.error}}})),en,tn,nn,rn,an,on,sn,cn,ln,un,dn,D,O,k,A,j,fn,M,N,P,pn,F,I,L,R,z,B,V,H,U,mn,hn,gn,W,G,K,_n,q,vn,yn,J,bn,xn,Y,Sn,Cn,wn,Tn,En,Dn,X=e((()=>{o(),$t(),E(),en=`AccessDeniedException`,tn=`AccessToken`,nn=`CreateOAuth2Token`,rn=`CreateOAuth2TokenRequest`,an=`CreateOAuth2TokenRequestBody`,on=`CreateOAuth2TokenResponseBody`,sn=`CreateOAuth2TokenResponse`,cn=`InternalServerException`,ln=`RefreshToken`,un=`TooManyRequestsError`,dn=`ValidationException`,D=`accessKeyId`,O=`accessToken`,k=`client`,A=`clientId`,j=`codeVerifier`,fn=`code`,M=`error`,N=`expiresIn`,P=`grantType`,pn=`http`,F=`httpError`,I=`idToken`,L=`jsonName`,R=`message`,z=`refreshToken`,B=`redirectUri`,V=`smithy.ts.sdk.synthetic.com.amazonaws.signin`,H=`secretAccessKey`,U=`sessionToken`,mn=`server`,hn=`tokenInput`,gn=`tokenOutput`,W=`tokenType`,G=`com.amazonaws.signin`,K=s.for(V),_n=[-3,V,`SigninServiceException`,0,[],[]],K.registerError(_n,T),q=s.for(G),vn=[-3,G,en,{[M]:k},[M,R],[0,0],2],q.registerError(vn,Yt),yn=[-3,G,cn,{[M]:mn,[F]:500},[M,R],[0,0],2],q.registerError(yn,Xt),J=[-3,G,un,{[M]:k,[F]:429},[M,R],[0,0],2],q.registerError(J,Zt),bn=[-3,G,dn,{[M]:k,[F]:400},[M,R],[0,0],2],q.registerError(bn,Qt),xn=[K,q],Y=[0,G,ln,8,0],Sn=[3,G,tn,8,[D,H,U],[[0,{[L]:D}],[0,{[L]:H}],[0,{[L]:U}]],3],Cn=[3,G,rn,0,[hn],[[()=>wn,16]],1],wn=[3,G,an,0,[A,P,fn,B,j,z],[[0,{[L]:A}],[0,{[L]:P}],0,[0,{[L]:B}],[0,{[L]:j}],[()=>Y,{[L]:z}]],2],Tn=[3,G,sn,0,[gn],[[()=>En,16]],1],En=[3,G,on,0,[O,W,N,z,I],[[()=>Sn,{[L]:O}],[0,{[L]:W}],[1,{[L]:N}],[()=>Y,{[L]:z}],[0,{[L]:I}]],4],Dn=[9,G,nn,{[pn]:[`POST`,`/v1/token`,200]},()=>Cn,()=>Tn]})),On,kn=e((()=>{a(),he(),Ve(),l(),at(),Qe(),Xe(),Rt(),Jt(),X(),On=e=>({apiVersion:`2023-01-01`,base64Decoder:e?.base64Decoder??rt,base64Encoder:e?.base64Encoder??tt,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??qt,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??It,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:`aws.auth#sigv4`,identityProvider:e=>e.getIdentityProvider(`aws.auth#sigv4`),signer:new Be},{schemeId:`smithy.api#noAuth`,identityProvider:e=>e.getIdentityProvider(`smithy.api#noAuth`)||(async()=>({})),signer:new He}],logger:e?.logger??new Dt,protocol:e?.protocol??ke,protocolSettings:e?.protocolSettings??{defaultNamespace:`com.amazonaws.signin`,errorTypeRegistries:xn,version:`2023-01-01`,serviceTarget:`Signin`},serviceId:e?.serviceId??`Signin`,urlParser:e?.urlParser??it,utf8Decoder:e?.utf8Decoder??Je,utf8Encoder:e?.utf8Encoder??Ye})})),An,jn=e((()=>{Mt(),bt(),a(),Ee(),ht(),De(),me(),xt(),$e(),l(),je(),_e(),vt(),kn(),An=e=>{Ot(process.version);let t=Te(e),n=()=>t().then(kt),r=On(e);_t(process.version);let i={profile:e?.profile,logger:r.logger};return{...r,...e,runtime:`node`,defaultsMode:t,authSchemePreference:e?.authSchemePreference??c(ze,i),bodyLengthChecker:e?.bodyLengthChecker??ve,defaultUserAgentProvider:e?.defaultUserAgentProvider??be({serviceId:r.serviceId,clientVersion:jt.version}),maxAttempts:e?.maxAttempts??c(Fe,e),region:e?.region??c(ut,{...mt,...i}),requestHandler:Ze.create(e?.requestHandler??n),retryMode:e?.retryMode??c({...ge,default:async()=>(await n()).retryMode||yt},e),sha256:e?.sha256??ye.bind(null,`sha256`),streamCollector:e?.streamCollector??et,useDualstackEndpoint:e?.useDualstackEndpoint??c(pt,i),useFipsEndpoint:e?.useFipsEndpoint??c(ot,i),userAgentAppId:e?.userAgentAppId??c(xe,i)}}})),Mn,Nn,Pn=e((()=>{Mn=e=>{let t=e.httpAuthSchemes,n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){let n=t.findIndex(t=>t.schemeId===e.schemeId);n===-1?t.push(e):t.splice(n,1,e)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider(){return n},setCredentials(e){r=e},credentials(){return r}}},Nn=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()})})),Fn,In=e((()=>{Ae(),ee(),l(),Pn(),Fn=(e,t)=>{let n=Object.assign(Oe(e),Et(e),i(e),Mn(e));return t.forEach(e=>e.configure(n)),Object.assign(e,Se(n),St(n),r(n),Nn(n))}})),Z,Ln=e((()=>{fe(),ae(),le(),ue(),ht(),Ve(),o(),re(),pe(),me(),l(),Rt(),Vt(),jn(),In(),t(),Z=class extends Tt{constructor(...[e]){let t=An(e||{});super(t),n(this,`config`,void 0),this.initConfig=t,this.config=Fn(Lt(ne(Ie(ft(Pe(ce(zt(t))))))),e?.extensions||[]),this.middlewareStack.use(nt(this.config)),this.middlewareStack.use(we(this.config)),this.middlewareStack.use(Me(this.config)),this.middlewareStack.use(ie(this.config)),this.middlewareStack.use(se(this.config)),this.middlewareStack.use(oe(this.config)),this.middlewareStack.use(de(this.config)),this.middlewareStack.use(Le(this.config,{httpAuthSchemeParametersProvider:Ft,identityProviderConfigProvider:async e=>new We({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use(Re(this.config))}destroy(){super.destroy()}}})),Q,Rn=e((()=>{pe(),l(),Vt(),X(),Q=class extends wt.classBuilder().ep(Bt).m(function(e,t,n,r){return[Ne(n,e.getEndpointParameterInstructions())]}).s(`Signin`,`CreateOAuth2Token`,{}).n(`SigninClient`,`CreateOAuth2TokenCommand`).sc(Dn).build(){}})),zn,$,Bn=e((()=>{l(),Rn(),Ln(),zn={CreateOAuth2TokenCommand:Q},$=class extends Z{},At(zn,$)})),Vn=e((()=>{Rn()})),Hn=e((()=>{})),Un=e((()=>{}));e((()=>{Ln(),Bn(),Vn(),X(),Hn(),$t(),Un(),E()}))();export{Q as CreateOAuth2TokenCommand,Z as SigninClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{B as t,F as n,M as r,R as i,S as a,V as o,d as s}from"./paths-BBvuDQl9.js";import{a as c,n as l,t as u}from"./analytics-DqMQntaB.js";import{i as d,t as f}from"./datadog-Bg-zL-i7.js";function p(){if(o(`datadog`))return!1;if(y!==void 0)return y;try{return s(v)}catch{return!1}}function m(e,t){let r=i(e);if(r===0)return;let a=r===null?t:{...t,sample_rate:r};p()&&d(e,c(a)),n(e,a)}function h(e,t){return m(e,t),Promise.resolve()}function g(){y=s(v)}function _(){u({logEvent:m,logEventAsync:h})}var v,y,b=e((()=>{f(),r(),a(),l(),t(),v=`tengu_log_datadog_events`}));export{g as n,_ as r,b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./sink-DxDOsLa2.js";t();export{e as initializeAnalyticsSink};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,t}from"./axios-DhfaybwJ.js";import{Ct as n,cn as r}from"./state-sIHsFpDu.js";import{E as i,J as a,X as o,Y as s,d as c,h as l,p as u,q as d,s as f,w as p}from"./debug-UI3T040K.js";import{o as m,r as h,t as g,v as _,y as v}from"./log-CzsijfHZ.js";import{i as y,t as b}from"./sentry-BNVxoVLS.js";import{r as x,t as S}from"./sink-DxDOsLa2.js";import{dirname as C,join as w}from"path";t(),r(),a(),v(),s(),f(),l(),m(),p(),y();var T=h(new Date);function E(){return w(_.errors(),T+`.jsonl`)}function D(e){return w(_.mcpLogs(e),T+`.jsonl`)}function O(e){let t=d(e);return{write(e){t.write(i(e)+`
|
|
2
|
+
`)},flush:t.flush,dispose:t.dispose}}var k=new Map;function A(e){let t=k.get(e);if(!t){let n=C(e);t=O({writeFn:t=>{try{u().appendFileSync(e,t)}catch{u().mkdirSync(n),u().appendFileSync(e,t)}},flushIntervalMs:1e3,maxBufferSize:50}),k.set(e,t),o(async()=>t?.dispose())}return t}function j(e,t){if(process.env.USER_TYPE!==`ant`)return;let r={timestamp:new Date().toISOString(),...t,cwd:u().cwd(),userType:process.env.USER_TYPE,sessionId:n(),version:`2.6.5`};A(e).write(r)}function M(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`)return t.message;if(typeof t.error==`object`&&t.error&&`message`in t.error&&typeof t.error.message==`string`)return t.error.message}}function N(t){let n=t.stack||t.message,r=``;if(e.isAxiosError(t)&&t.config?.url){let e=[`url=${t.config.url}`];t.response?.status!==void 0&&e.push(`status=${t.response.status}`);let n=M(t.response?.data);n&&e.push(`body=${n}`),r=`[${e.join(`,`)}] `}c(`${t.name}: ${r}${n}`,{level:`error`}),j(E(),{error:`${r}${n}`}),b(t)}function P(e,t){c(`MCP server "${e}" ${t}`,{level:`error`});let r=D(e),i={error:t instanceof Error?t.stack||t.message:String(t),timestamp:new Date().toISOString(),sessionId:n(),cwd:u().cwd()};A(r).write(i)}function F(e,t){c(`MCP server "${e}": ${t}`);let r=D(e),i={debug:t,timestamp:new Date().toISOString(),sessionId:n(),cwd:u().cwd()};A(r).write(i)}function I(){g({logError:N,logMCPError:P,logMCPDebug:F,getErrorsPath:E,getMCPLogsPath:D}),c(`Error log sink initialized`)}S();function L(){I(),x()}export{L as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./sinks-BrrTUxkC.js";export{e as initSinks};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{c as r,d as i,f as a}from"./skillGenerator-kbaRbpqJ.js";import{d as o,g as s,h as c,l,m as u,p as d,x as f}from"./runtimeObserver-nAhH4Wca.js";import{o as p,r as m}from"./observationStore-tvkldXUo.js";import{c as h,o as g}from"./projectContext-eXMSfgdZ.js";import{t as _}from"./sessionObserver-DG2zQgfi.js";import{i as v,r as y}from"./skillGapStore-_YuJP5KI.js";import{t as b}from"./skillLearning-DBbdGbk-.js";import{join as x}from"node:path";function S(e,t){let n=e.find(e=>e.startsWith(`${t}=`));if(n)return n.slice(t.length+1)||void 0;let r=e.indexOf(t);if(r>=0&&e[r+1]&&!e[r+1].startsWith(`--`))return e[r+1]}function C(e,t,n){let r=S(e,t);if(r===void 0)return n;let i=Number(r);return Number.isFinite(i)?i:n}var w;e((()=>{n(),b(),w=async e=>{let n=e.trim().split(/\s+/).filter(Boolean),b=n[0]??`status`,w=h(process.cwd()),T=process.env.CLAUDE_SKILL_LEARNING_HOME,E={project:w,rootDir:T};switch(b){case`status`:{let[e,t]=await Promise.all([p(E),d(E)]);return{type:`text`,value:[`Skill Learning status for ${w.projectName} (${w.projectId})`,`Observations: ${e.length}`,`Instincts: ${t.length}`].join(`
|
|
2
|
+
`)}}case`ingest`:{let e=n[1];if(!e)return{type:`text`,value:`Usage: /skill-learning ingest <transcript.jsonl> [--min-session-length=<n>]`};let t=C(n,`--min-session-length`,10),r=await m(e,E);if(r.length<t)return{type:`text`,value:`Session too short for learning (${r.length} < min=${t}). Skipping instinct extraction.`};let i=_(r),a=[];for(let e of i)a.push(await s(e,E));return{type:`text`,value:`Ingested ${r.length} observations and saved ${a.length} instincts.`}}case`evolve`:{let e=n.includes(`--generate`),o=f(await d(E),{cwd:process.cwd()}),s=[];if(e)for(let e of o){let n=a(e,await i(e,[x(process.cwd(),`.claude`,`skills`),x(t(),`skills`)])),o=await r(n);s.push(`${n.type}: ${o.activePath??o.archivedPath??o.deletedPath??`no active write`}`)}return{type:`text`,value:e?`Generated ${s.length} learned skill(s):\n${s.join(`
|
|
3
|
+
`)}`:`Found ${o.length} skill candidate(s). Use --generate to write them.`}}case`export`:{let e=n[1]??`skill-learning-instincts.json`,t=S(n,`--scope`),r=C(n,`--min-conf`,void 0),i=S(n,`--domain`),a=e=>e.filter(e=>!(t&&e.scope!==t||r!==void 0&&e.confidence<r||i&&e.domain!==i)),s=await d(E),c=a(s);if(c.length!==s.length){await o(e,E);let{writeFile:t}=await import(`node:fs/promises`);await t(e,`${JSON.stringify(c,null,2)}\n`)}else await o(e,E);let l=[`Exported ${c.length} instincts to ${e}`];if(t||r!==void 0||i){let e=[];t&&e.push(`scope=${t}`),r!==void 0&&e.push(`min-conf=${r}`),i&&e.push(`domain=${i}`),l.push(`(filters: ${e.join(`, `)})`)}return{type:`text`,value:l.join(` `)}}case`import`:{let e=n[1];if(!e)return{type:`text`,value:`Usage: /skill-learning import <instincts.json> [--scope=<scope>] [--min-conf=<n>] [--domain=<d>] [--dry-run]`};let t=S(n,`--scope`),r=C(n,`--min-conf`,void 0),i=S(n,`--domain`),a=n.includes(`--dry-run`),{readFile:o}=await import(`node:fs/promises`),c=JSON.parse(await o(e,`utf8`)),l=c.filter(e=>!(t&&e.scope!==t||r!==void 0&&e.confidence<r||i&&e.domain!==i));if(a)return{type:`text`,value:`Dry run: would import ${l.length}/${c.length} instincts.`};for(let e of l)await s(e,E);return{type:`text`,value:`Imported ${l.length}/${c.length} instincts.`}}case`prune`:{let e=n.indexOf(`--max-age`);return{type:`text`,value:`Pruned ${(await u(e>=0&&n[e+1]?Number(n[e+1]):30,E)).length} pending instincts.`}}case`promote`:{let e=n[1];if(!e){let e=await v(w,T),t=l(await d(E));return{type:`text`,value:[`Promotion candidates for ${w.projectName} (${w.projectId}):`,`Pending gaps: ${e.filter(e=>e.status===`pending`).length}`,`Global-eligible instincts (>=2 projects, avg confidence >=0.8): ${t.length}`,``,`Usage:`,` /skill-learning promote gap <gap-key> # pending gap -> draft`,` /skill-learning promote instinct <instinct-id> # project instinct -> global`].join(`
|
|
4
|
+
`)}}if(e===`gap`){let e=n[2];if(!e)return{type:`text`,value:`Usage: /skill-learning promote gap <gap-key>`};let t=await y(e,w,T);return t?{type:`text`,value:`Promoted gap ${e} to status=${t.status} (draft=${t.draft?.skillPath??`none`}).`}:{type:`text`,value:`No gap found for key "${e}".`}}if(e===`instinct`){let e=n[2];if(!e)return{type:`text`,value:`Usage: /skill-learning promote instinct <instinct-id>`};let t=(await d(E)).find(t=>t.id===e);return t?t.scope===`global`?{type:`text`,value:`Instinct ${e} is already global.`}:(await c({...t,scope:`global`},{scope:`global`,rootDir:T}),{type:`text`,value:`Promoted instinct ${e} to global scope.`}):{type:`text`,value:`No project-scoped instinct found for id "${e}".`}}return{type:`text`,value:`Usage: /skill-learning promote [gap <gap-key>|instinct <instinct-id>]`}}case`projects`:{let e=g();if(e.length===0)return{type:`text`,value:`No known project scopes yet.`};let t=[`Known project scopes:`];for(let n of e){let e={project:n,rootDir:T},[r,i]=await Promise.all([d(e),p(e)]);t.push(`- ${n.projectName} (${n.projectId}) — instincts: ${r.length}, observations: ${i.length}, lastSeen: ${n.lastSeenAt}`)}return{type:`text`,value:t.join(`
|
|
5
|
+
`)}}default:return{type:`text`,value:`Usage: /skill-learning [status|ingest|evolve|export|import|prune|promote|projects]`}}}}))();export{w as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./chokidar-SzksMqYp.js";import{Ct as n,Fr as r,Pr as i,cn as a,et as o,g as s,jr as ee,lr as c,nr as l,tr as te}from"./state-sIHsFpDu.js";import{Br as ne,Pr as re}from"./paths-BBvuDQl9.js";import{X as ie,Y as ae,d as u,h as oe,p as se,s as d}from"./debug-UI3T040K.js";import{n as ce,r as le}from"./analytics-DqMQntaB.js";import{n as ue,t as f}from"./cwd--iizewsn.js";import{$v as de,Ac as fe,Ar as pe,At as p,Cm as m,Hm as h,Hv as g,Lo as me,Pt as he,Ri as ge,Tm as _e,Um as _,Vv as v,Xi as ve,Yn as ye,_m as y,_o as b,cd as x,di as S,ei as C,fi as w,gE as T,gk as E,gn as D,hE as O,i as k,iE as A,kc as j,o as M,pd as N,r as P,rE as be,ty as xe,vi as Se,vm as Ce,wm as we,wt as Te,xi as F,xk as Ee,xm as De,xt as I,yn as Oe,zi as ke}from"./loadAgentsDir-DI1a76pd.js";import{zt as L}from"./prompt-CjFAtm3w.js";import{f as Ae,l as je,t as Me}from"./commitAttribution-C22a3OCi.js";import{F as Ne,P as Pe}from"./teamHelpers--3ZyNDlv.js";import{n as R,r as Fe}from"./systemPromptSections-BcN_XBTx.js";import{r as Ie}from"./asciicast-o5Zg4dJt.js";import*as z from"path";import{dirname as Le}from"path";a(),Fe(),y(),M(),L(),T(),Ee(),je(),x(),ue(),d(),xe(),me(),re(),g(),h(),pe(),Pe(),A(),Te();function Re(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.type!==`assistant`)continue;let r=n.message.content.find(e=>e.type===`tool_use`&&e.name===`TodoWrite`);if(!r||r.type!==`tool_use`)continue;let i=r.input;if(typeof i!=`object`||!i)return[];let a=be().safeParse(i.todos);return a.success?a.data:[]}return[]}function ze(e,t){if(e.fileHistorySnapshots&&e.fileHistorySnapshots.length>0&&de(e.fileHistorySnapshots,e=>{t(t=>({...t,fileHistory:e}))}),e.attributionSnapshots&&e.attributionSnapshots.length>0&&Me(e.attributionSnapshots,e=>{t(t=>({...t,attribution:e}))}),!Ne()&&e.messages&&e.messages.length>0){let r=Re(e.messages);if(r.length>0){let e=n();t(t=>({...t,todos:{...t.todos,[e]:r}}))}}}function Be(e){if(e.attributionSnapshots&&e.attributionSnapshots.length>0)return Ae(e.attributionSnapshots)}function B(e,t){if(!(!e&&!t))return{name:e??``,color:t===`default`?void 0:t}}function V(e,t,n){if(t)return{agentDefinition:t,agentType:void 0};if(!e)return l(void 0),{agentDefinition:void 0,agentType:void 0};let r=n.activeAgents.find(t=>t.agentType===e);return r?(l(r.agentType),!o()&&r.model&&r.model!==`inherit`&&te(ne(r.model)),{agentDefinition:r,agentType:r.agentType}):(u(`Resumed session had agent "${e}" but it is no longer available. Using default behavior.`),l(void 0),{agentDefinition:void 0,agentType:void 0})}async function Ve(e,t,n,r){if(!e)return r;k.cache.clear?.();let i=await k(t),a=[...i.allAgents,...n];return{...i,allAgents:a,activeAgents:P(a)}}function H(e){let t=I();if(t){F(t);return}if(e){try{process.chdir(e.worktreePath)}catch{F(null);return}_(e.worktreePath),c(f()),p(e),E(),R(),v.cache.clear?.()}}function He(){let e=I();if(e){p(null),E(),R(),v.cache.clear?.();try{process.chdir(e.originalCwd)}catch{return}_(e.originalCwd),c(f())}}async function Ue(e,t,n){let r;if(r=n.modeApi?.matchSessionMode(e.mode),r&&e.messages.push(b(r,`warning`)),t.forkSession)e.contentReplacements?.length&&await C(e.contentReplacements);else{let n=t.sessionIdOverride??e.sessionId;n&&(ee(O(n),t.transcriptPath?Le(t.transcriptPath):null),await Ie(),await S(),Ce(n))}w(t.forkSession?{...e,worktreeSession:void 0}:e),t.forkSession||(H(e.worktreeSession),ye());let{agentDefinition:i,agentType:a}=V(e.agentSetting,n.mainThreadAgentDefinition,n.agentDefinitions);Se(n.modeApi?.isCoordinatorMode()?`coordinator`:`normal`);let o=t.includeAttribution?Be(e):void 0,s=B(e.agentName,e.agentColor);N(e.agentName);let c=await Ve(!!r,n.currentCwd,n.cliAgents,n.agentDefinitions);return{messages:e.messages,fileHistorySnapshots:e.fileHistorySnapshots,contentReplacements:e.contentReplacements,agentName:e.agentName,agentColor:e.agentColor===`default`?void 0:e.agentColor,restoredAgentDef:i,initialState:{...n.initialState,...a&&{agent:a},...o&&{attribution:o},...s&&{standaloneAgentContext:s},agentDefinitions:c}}}e(),a(),ve(),ce(),we(),j(),ae(),d(),oe(),Oe(),r();var We=1e3,Ge=500,Ke=300,qe=2e3,Je=typeof Bun<`u`,U=null,W=null,G=new Set,K=!1,q=!1,J=!1,Y=null,X=i(),Z=null;async function Ye(){if(K||q)return;K=!0,J||(J=!0,_e(()=>{ge(),X.emit()}));let e=await Ze();e.length!==0&&(u(`Watching for changes in skill/command directories: ${e.join(`, `)}...`),U=t.watch(e,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:Z?.stabilityThreshold??We,pollInterval:Z?.pollInterval??Ge},ignored:(e,t)=>t&&!t.isFile()&&!t.isDirectory()?!0:e.split(z.sep).some(e=>e===`.git`),ignorePermissionErrors:!0,usePolling:Je,interval:Z?.chokidarInterval??qe,atomic:!0}),U.on(`add`,$),U.on(`change`,$),U.on(`unlink`,$),Y=ie(async()=>{await Q()}))}function Q(){q=!0,Y&&(Y(),Y=null);let e=Promise.resolve();return U&&(e=U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),e}var Xe=X.subscribe;async function Ze(){let e=se(),t=[],n=m(`userSettings`,`skills`);if(n)try{await e.stat(n),t.push(n)}catch{}let r=m(`userSettings`,`commands`);if(r)try{await e.stat(r),t.push(r)}catch{}let i=m(`projectSettings`,`skills`);if(i)try{let n=z.resolve(i);await e.stat(n),t.push(n)}catch{}let a=m(`projectSettings`,`commands`);if(a)try{let n=z.resolve(a);await e.stat(n),t.push(n)}catch{}for(let n of s()){let r=z.join(n,`.claude`,`skills`);try{await e.stat(r),t.push(r)}catch{}}return t}function $(e){u(`Detected skill change: ${e}`),le(`tengu_skill_file_changed`,{source:`chokidar`}),Qe(e)}function Qe(e){G.add(e),W&&clearTimeout(W),W=setTimeout(async()=>{W=null;let e=[...G];if(G.clear(),D(await he(`skills`,e[0]))){u(`ConfigChange hook blocked skill reload (${e.length} paths)`);return}De(),ke(),fe(),X.emit()},Z?.reloadDebounce??Ke)}async function $e(e){U&&(await U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),K=!1,q=!1,Z=e??null}var et={initialize:Ye,dispose:Q,subscribe:Xe,resetForTesting:$e};export{V as a,Ue as i,B as n,ze as o,He as r,H as s,et as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./skillGapStore-_YuJP5KI.js";i();export{c as findGapKeyByDraftPath,o as promoteGapToDraft,n as readSkillGaps,e as recordDraftHit,a as recordSkillGap,s as rejectSkillGap,t as shouldPromoteToActive,r as shouldPromoteToDraft};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{i as t,r as n}from"./instinctParser-DHMa8xa0.js";import{i as r,o as i,s as a}from"./skillGenerator-kbaRbpqJ.js";import{a as o,c as s,n as c}from"./projectContext-eXMSfgdZ.js";import{dirname as l,join as u}from"node:path";import{existsSync as d}from"node:fs";import{createHash as f}from"node:crypto";import{mkdir as p,readFile as m,rename as h,writeFile as g}from"node:fs/promises";async function _(e){let t=e.prompt.trim();if(!t)throw Error(`Cannot record an empty skill gap`);let n=e.project??s(e.cwd),r=await A(n,e.rootDir),i=F(t),a=new Date().toISOString(),o=r.gaps[i],c={key:i,prompt:t,count:(o?.count??0)+1,draftHits:o?.draftHits??0,draftHitSessions:o?.draftHitSessions??[],status:o?.status??`pending`,sessionId:e.sessionId??`unknown-session`,cwd:e.cwd??n.cwd,projectId:n.projectId,projectName:n.projectName,recommendations:(e.recommendations??[]).slice(0,5).map(e=>({name:e.name,description:e.description,score:e.score})),createdAt:o?.createdAt??a,updatedAt:a,draft:o?.draft,active:o?.active};return c.status===`rejected`?(r.gaps[i]=c,await N(n,r,e.rootDir),c):(!c.draft&&C(c)&&(c.draft=await T(c,n),c.status=`draft`,await z()),c.draft&&!c.active&&w(c)&&(c.active=await E(c,n),c.status=`active`,await z()),r.gaps[i]=c,await N(n,r,e.rootDir),c)}async function v(e=s(),t){let n=await A(e,t);return Object.values(n.gaps).sort((e,t)=>e.key.localeCompare(t.key))}async function y(e,t=s(),n){let r=await A(t,n);for(let t of Object.values(r.gaps))if(t.draft?.skillPath===e)return t.key}async function b(e,t=s(),n,r=`unknown-session`){let i=await A(t,n),a=i.gaps[e];if(!a||!a.draft||a.active)return a;let o=a.draftHitSessions??[];if(o.includes(r))return a;let c=new Date().toISOString(),l={...a,draftHits:a.draftHits+1,draftHitSessions:[...o,r],updatedAt:c};return w(l)&&(l.active=await E(l,t),l.status=`active`,await z()),i.gaps[e]=l,await N(t,i,n),l}async function x(e,t=s(),n){let r=await A(t,n),i=r.gaps[e];if(!i)return;if(i.status===`rejected`||i.draft)return i;let a={...i,draft:await T(i,t),status:`draft`,updatedAt:new Date().toISOString()};return r.gaps[e]=a,await N(t,r,n),await z(),a}async function S(e,t=s(),n){let r=await A(t,n),i=r.gaps[e];if(!i)return;let a={...i,status:`rejected`,updatedAt:new Date().toISOString()};return r.gaps[e]=a,await N(t,r,n),a}function C(e){return e.count>=B}function w(e){return e.draft?e.count>=V||e.draftHits>=H:!1}async function T(e,t){let n=D(e,`pending`),i=u(t.projectRoot??t.cwd,`.claude`,`skills`,`.drafts`),o=r([n],{cwd:t.projectRoot??t.cwd,outputRoot:i,scope:`project`,name:`draft-${I(e.prompt)}`,description:`Draft learned skill candidate. Promote after repeated evidence or explicit user correction.`}),s=u(o.outputPath,`SKILL.md`);return d(s)||await a({...o,content:o.content+`
|
|
2
|
+
## Promotion Rule
|
|
3
|
+
|
|
4
|
+
Do not move this draft into active skills until the same gap repeats or the user explicitly confirms this should become reusable.
|
|
5
|
+
`}),{type:`draft`,name:o.name,skillPath:s}}async function E(e,t){let n=r([D(e,`active`)],{cwd:t.projectRoot??t.cwd,scope:`project`,name:I(e.prompt),description:O(e.prompt)}),i=u(n.outputPath,`SKILL.md`);return d(i)||await a(n),{type:`active`,name:n.name,skillPath:i}}function D(e,t){return n({trigger:`When the user asks for ${L(e.prompt,120)}`,action:O(e.prompt),confidence:t===`active`?.82:.55,domain:k(e.prompt),source:`session-observation`,scope:`project`,projectId:e.projectId,projectName:e.projectName,evidence:[`Skill gap prompt: ${L(e.prompt,180)}`,`No high-confidence active skill was auto-loaded.`,`Observed ${e.count} time(s).`],status:t})}function O(e){return/feature\s*\(|feature flag|flag_name|stub|no-op|noop|最小实现/i.test(e)?`Audit feature flags by scanning feature() call sites, excluding generated/dependency noise, classifying each candidate as stub, shell, MVP, or thin-toggle, and writing an evidence-backed document.`:/skill|技能|学习|进化|evolve|learning/i.test(e)?`Run skill discovery first; auto-load only high-confidence matching skills; record a skill gap when none match; promote repeated or corrected gaps into learned skills.`:/test|测试|stub|调用链|参数/i.test(e)?`Infer tests from existing files, parameters, exports, and call chains before simplifying mocks or inventing behavior.`:`Reuse the workflow learned from this prompt: ${L(e,180)}.`}function k(e){let t=e.toLowerCase();return/test|测试|stub|fixture|断言/.test(t)?`testing`:/error|bug|fix|失败|错误|修复|debug/.test(t)?`debugging`:/security|安全|漏洞|secret|token/.test(t)?`security`:/git|commit|branch|pr\b/.test(t)?`git`:/style|lint|format|命名|规范/.test(t)?`code-style`:`workflow`}async function A(e,t){let n=P(e,t),r;try{r=await m(n,`utf8`)}catch(e){if(e.code===`ENOENT`)return{version:1,gaps:{}};throw e}try{return j(JSON.parse(r))}catch{let e=`${n}.corrupt-${Date.now()}`;try{await g(e,r,`utf8`)}catch{}return{version:1,gaps:{}}}}function j(e){let t={};for(let[n,r]of Object.entries(e.gaps??{})){let e=r,i=typeof e.draftHits==`number`&&Number.isFinite(e.draftHits)?e.draftHits:0,a=typeof e.count==`number`?e.count:1,o=M(e.status),s=!!e.draft,c=!!e.active,l=o;l===`draft`&&a<B&&!s&&(l=`pending`),l===`active`&&!c&&(l=s?`draft`:`pending`);let u=Array.isArray(e.draftHitSessions)?e.draftHitSessions.filter(e=>typeof e==`string`):[];t[n]={...r,count:a,draftHits:i,draftHitSessions:u,status:l}}return{version:1,gaps:t}}function M(e){return e===`pending`||e===`draft`||e===`active`||e===`rejected`?e:`pending`}async function N(e,t,n){let r=P(e,n);await p(l(r),{recursive:!0});let i=`${r}.tmp-${process.pid}-${Date.now()}`;await g(i,`${JSON.stringify(t,null,2)}\n`,`utf8`),await h(i,r)}function P(e,t){return u(t?e.projectId===`global`?u(t,`global`):u(t,`projects`,e.projectId):c(e.projectId),`skill-gaps.json`)}function F(e){return`${I(e)}-${R(e).slice(0,8)}`}function I(e){let t=e.replaceAll(`技能`,` skill `).replaceAll(`学习`,` learning `).replaceAll(`进化`,` evolution `).replaceAll(`测试`,` testing `).replaceAll(`最小实现`,` minimal implementation `).toLowerCase(),n=new Set([`the`,`and`,`for`,`with`,`this`,`that`,`user`,`about`,`feature`,`flag`,`name`]);return((t.match(/[a-z0-9][a-z0-9_-]{2,}/g)??[]).filter(e=>!n.has(e)).slice(0,5).join(`-`)||`learned-gap`).slice(0,54).replace(/-+$/g,``)}function L(e,t){return e.replace(/\s+/g,` `).trim().slice(0,t)}function R(e){return f(`sha1`).update(e).digest(`hex`)}async function z(){try{let{clearCommandsCache:e}=await import(`./commands-BWIOEBPs.js`);e()}catch{}}var B,V,H,U=e((()=>{t(),o(),i(),B=2,V=4,H=2}));export{b as a,w as c,v as i,C as l,U as n,_ as o,x as r,S as s,y as t};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{o as r,t as i}from"./localSearch-CDOJNc_E.js";import{l as a,u as o}from"./instinctParser-DHMa8xa0.js";import{basename as s,dirname as c,join as l}from"node:path";import{existsSync as u}from"node:fs";import{mkdir as d,readFile as f,readdir as p,rename as ee,rm as m,writeFile as h}from"node:fs/promises";function g(e){return e.length===0?!1:e.reduce((e,t)=>e+t.confidence,0)/e.length>=a().minConfidence}function _(e){let t=b[e[0]?.domain??`project`],n=new Set;for(let t of e){for(let e of`${t.trigger} ${t.action}`.toLowerCase().split(/[^a-z0-9]+/))if(te(e)&&n.add(e),n.size>=5)break;if(n.size>=5)break}let r=v([t,...n].join(`-`));return y(r)?`${t}-learned-pattern`:r}function v(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,64).replace(/-$/g,``)||`learned-skill`}function y(e){return x.has(e)}function te(e){return e.length>2&&![`when`,`with`,`this`,`that`,`user`,`project`,`prefer`,`avoid`,`use`,`using`,`the`,`and`,`for`].includes(e)}var b,x,S=e((()=>{o(),b={workflow:`workflow`,testing:`testing`,debugging:`debugging`,"code-style":`style`,security:`security`,git:`git`,project:`project`},x=new Set([`learned-skill`,`better-skill`,`new-skill`,`project-skill`,`workflow-skill`])}));async function C(e,t,n){let r=n.length>0&&typeof n[0]==`string`?await w(e,n):n,i=L(`${t.name} ${t.description} ${t.content}`);return r.map(e=>({skill:e,score:R(i,L(`${e.name} ${e.description} ${e.content}`))})).filter(e=>e.score>=.18).sort((e,t)=>t.score-e.score).map(e=>e.skill)}async function ne(e,t){return C(`skill`,e,t)}async function w(e,t){if(e===`skill`)return D(t);let n=[];for(let e of t)u(e)&&await P(e,n);return n}function T(e,t,n={}){let r=t.find(e=>j(e));if(n.allowHardDelete&&r)return{type:`delete`,targetSkill:r,reason:`Existing skill is low quality, unreferenced, and safe to delete.`,confirmed:!0};let i=t[0];if(!i)return{type:`create`,draft:e,reason:`No overlapping active skill found.`};let a=R(L(`${e.name} ${e.description} ${e.content}`),L(`${i.name} ${i.description} ${i.content}`));return a>=.72&&e.confidence>=.75&&ae(e,i)?{type:`replace`,targetSkill:i,draft:e,reason:`New learned skill has high overlap (${a.toFixed(2)}) and higher confidence.`}:a>=.35?{type:`merge`,targetSkill:i,patch:ie(e),reason:`Existing skill overlaps with the learned pattern (${a.toFixed(2)}).`}:{type:`create`,draft:e,reason:`Overlap is too low to merge.`}}async function E(e,t={}){switch(e.type){case`create`:return{activePath:await W(e.draft)};case`merge`:return I(e.targetSkill)?{activePath:await re(e.targetSkill,e.patch)}:(process.stderr.write(`[skill-learning] skip user-authored skill: ${e.targetSkill.path}\n`),{});case`replace`:{if(!I(e.targetSkill))return process.stderr.write(`[skill-learning] skip user-authored skill: ${e.targetSkill.path}\n`),{};let n=e.draft.outputPath;if(e.hardDelete){let{deletedPath:r,manifestPath:i,tombstonePath:a}=await k(e.targetSkill,e.reason,{newSkill:e.draft.name,newPath:n},{...t,allowHardDelete:!0});return{activePath:await W(e.draft),deletedPath:r,manifestPath:i,tombstonePath:a}}let{archivedPath:r,manifestPath:i}=await O(e.targetSkill,e.reason,{newSkill:e.draft.name,newPath:n},t);return{activePath:await W(e.draft),archivedPath:r,manifestPath:i}}case`archive`:return await O(e.targetSkill,e.reason,void 0,t);case`delete`:return await k(e.targetSkill,e.reason,void 0,{...t,allowHardDelete:t.allowHardDelete&&e.confirmed!==!1})}}async function D(e){let t=[];for(let n of e)u(n)&&await N(n,t);return t}async function O(e,t,n,r={}){let a=c(e.path),o=r.archiveRoot??l(c(a),`.archive`),u=l(o,`${s(a)}-${M(r.now)}`);await d(o,{recursive:!0}),await ee(a,u);let f=await A(r.manifestRoot??u,{oldSkill:e.name,oldPath:e.path,newSkill:n?.newSkill,newPath:n?.newPath,action:`archive`,reason:t,replacedAt:(r.now??new Date).toISOString(),recoverable:!0});return i(),{archivedPath:u,manifestPath:f}}async function k(e,t,n,r={}){if(!r.allowHardDelete)throw Error(`Hard delete requires allowHardDelete=true`);let a=c(e.path),o=u(e.path)?await f(e.path,`utf8`):``,s=r.manifestRoot??l(c(a),`.tombstones`),d=await A(s,{oldSkill:e.name,oldPath:e.path,newSkill:n?.newSkill,newPath:n?.newPath,action:`delete`,reason:t,replacedAt:(r.now??new Date).toISOString(),recoverable:!1}),p=l(s,`${e.name}-${M(r.now)}.tombstone.json`);return await h(p,`${JSON.stringify({deletedSkill:e.name,oldPath:e.path,content:o},null,2)}\n`,`utf8`),await m(a,{recursive:!0,force:!0}),i(),{deletedPath:e.path,manifestPath:d,tombstonePath:p}}async function A(e,t){await d(e,{recursive:!0});let n=l(e,`replacement-manifest.json`);return await h(n,`${JSON.stringify(t,null,2)}\n`,`utf8`),n}async function re(e,t){let n=l(c(e.path),`learned-skill.patch.md`);return await h(n,t,`utf8`),i(),n}function ie(e){return[`# Learned Skill Merge Patch`,``,`Target learned skill: ${e.name}`,`Confidence: ${e.confidence}`,``,`## Suggested additions`,``,e.content].join(`
|
|
2
|
+
`)}function ae(e,t){if(t.status===`superseded`||t.status===`archived`)return!0;let n=e.confidence-(t.confidence??.5),r=e.content.length-t.content.length;return n>=.15||r>160}function j(e){return e.safeToDelete===!0&&(e.referencedBy?.length??0)===0&&e.quality===`low`}function M(e=new Date){return e.toISOString().replace(/[:.]/g,`-`)}async function N(e,t){let n=await p(e,{withFileTypes:!0});for(let r of n){let n=l(e,r.name);if(r.isDirectory()){if(r.name===`.archive`)continue;await N(n,t);continue}if(r.isFile()&&r.name===`SKILL.md`){let e=await f(n,`utf8`);t.push({name:F(e,`name`)??s(c(n)),description:F(e,`description`)??``,path:n,content:e})}}}async function P(e,t){let n=await p(e,{withFileTypes:!0});for(let r of n){let n=l(e,r.name);if(r.isDirectory()){if(r.name===`.archive`)continue;await P(n,t);continue}if(r.isFile()&&r.name.endsWith(`.md`)){let e=await f(n,`utf8`);t.push({name:F(e,`name`)??r.name.replace(/\.md$/,``),description:F(e,`description`)??``,path:n,content:e})}}}function F(e,t){let n=e.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(n)return n[1].match(RegExp(`^${t}:\\s*"?([^"\\n]+)"?`,`m`))?.[1]?.trim()}function I(e){return F(e.content,`origin`)===`skill-learning`}function L(e){return new Set(e.toLowerCase().split(/[^a-z0-9]+/).filter(e=>e.length>2))}function R(e,t){if(e.size===0||t.size===0)return 0;let n=0;for(let r of e)t.has(r)&&n++;return n/Math.min(e.size,t.size)}function z(e,t){return R(L(`${e.name} ${e.description} ${e.content}`),L(`${t.name} ${t.description} ${t.content}`))}var B=e((()=>{r(),$()}));function V(e,t){if(e.length===0)throw Error(`Cannot generate a skill draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=t?.name?v(t.name):K(e),i=e.reduce((e,t)=>e+t.confidence,0)/e.length,a=t?.description??q(e),o=G(r,n,t),s=J({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function H(e,t,n){let r=V(e,t),i=await C(`skill`,r,n);for(let t of i){let n=z(r,t);if(n>=.8)return{action:`append-evidence`,target:t,overlap:n,appendedPath:await U(t,e)}}return{action:`create`,draft:r}}async function U(e,t){let n=await f(e.path,`utf8`).catch(()=>e.content);if(Buffer.byteLength(n,`utf8`)>=Q)return e.path;let r=t.flatMap(e=>e.evidence.map(e=>`- ${e}`)),a=r.slice(0,X);a.length<r.length&&a.push(`- [... ${r.length-a.length} more evidence entries omitted]`);let o=[``,`## Learned evidence (${new Date().toISOString()})`,``,...a,``].join(`
|
|
3
|
+
`),s=n.endsWith(`
|
|
4
|
+
`)?n+o:`${n}\n${o}`,c=Buffer.byteLength(s,`utf8`)>Q?s.slice(0,Q):s;return await h(e.path,c,`utf8`),i(),e.path}async function W(e){await d(e.outputPath,{recursive:!0});let t=l(e.outputPath,`SKILL.md`);await h(t,e.content,`utf8`),i();try{let{clearCommandsCache:e}=await import(`./commands-BWIOEBPs.js`);e()}catch{}return t}function G(e,n,r){return r?.outputRoot?l(r.outputRoot,e):n===`project`?l(r?.cwd??process.cwd(),`.claude`,`skills`,e):l(r?.globalSkillsDir??l(t(),`skills`),e)}function K(e){return _(e)}function q(e){let t=(e[0]?.action??`Apply a learned project pattern`).replace(/\s+/g,` `).slice(0,120);return t.length>0?t:`Apply learned project patterns`}function J(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# ${oe(t)}`,``,`## Trigger`,``,i.map(e=>`- ${e.trigger}`).join(`
|
|
5
|
+
`),``,`## Action`,``,i.map(e=>`- ${e.action}`).join(`
|
|
6
|
+
`),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).slice(0,Z).join(`
|
|
7
|
+
`),``].join(`
|
|
8
|
+
`)}function oe(e){return e.split(`-`).filter(Boolean).map(e=>e[0]?.toUpperCase()+e.slice(1)).join(` `)}var Y,X,Z,Q,$=e((()=>{n(),r(),S(),B(),Y=.8,X=20,Z=20,Q=5e4}));export{g as C,v as S,z as _,G as a,S as b,E as c,ne as d,T as f,D as g,w as h,V as i,O as l,B as m,U as n,$ as o,k as p,H as r,W as s,Y as t,C as u,A as v,y as x,_ as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./featureCheck-Cm0YNDXO.js";import"./instinctParser-DHMa8xa0.js";import"./skillGenerator-kbaRbpqJ.js";import{p as e}from"./runtimeObserver-nAhH4Wca.js";import{o as t}from"./observationStore-tvkldXUo.js";import{c as n}from"./projectContext-eXMSfgdZ.js";import"./sessionObserver-DG2zQgfi.js";import"./toolEventObserver-DzLd0MSn.js";import"./skillGapStore-_YuJP5KI.js";import{t as r}from"./skillLearning-DBbdGbk-.js";r();export{e as loadInstincts,t as readObservations,n as resolveProjectContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./featureCheck-Cm0YNDXO.js";import{b as n,m as r,o as i}from"./skillGenerator-kbaRbpqJ.js";import{S as a,T as o,f as s,i as c,k as l,u}from"./runtimeObserver-nAhH4Wca.js";import{i as d}from"./observationStore-tvkldXUo.js";import{a as f}from"./projectContext-eXMSfgdZ.js";import{a as p,c as m,d as h,i as g}from"./sessionObserver-DG2zQgfi.js";import{n as _}from"./toolEventObserver-DzLd0MSn.js";import{n as v}from"./skillGapStore-_YuJP5KI.js";var y=e((()=>{t(),a(),n(),s(),d(),u(),f(),c(),h(),p(),l(),o(),_(),g(),v(),i(),r(),m()}));export{y as t};
|