@readmagic/workmate 0.0.20 → 0.0.22
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-DWgTWJ7R.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-s0Orgord.js +1 -0
- package/dist/chunks/App-BcEI6U5j.js +1 -0
- package/dist/chunks/ApproveApiKey-DegdTXZl.js +1 -0
- package/dist/chunks/ApproveApiKey-_VXIMSwY.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-D2Gesf-u.js +1 -0
- package/dist/chunks/CustomSelect-B46Eh0gU.js +1 -0
- package/dist/chunks/DiffDialog-v2IiYyi3.js +6 -0
- package/dist/chunks/Doctor-BP0Rqraa.js +1 -0
- package/dist/chunks/Doctor-By_y3C2V.js +3 -0
- package/dist/chunks/ExitFlow-BasHk1mk.js +2 -0
- package/dist/chunks/Grove-C3mhgshv.js +11 -0
- package/dist/chunks/InvalidConfigDialog-DYVQK5js.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-Dg6OiStR.js +1 -0
- package/dist/chunks/KeybindingProviderSetup-Bn1jzN5F.js +1 -0
- package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +1 -0
- package/dist/chunks/MCPToolListView-DLSrQHDc.js +1 -0
- package/dist/chunks/McpParsingWarnings-DZejAh8b.js +1 -0
- package/dist/chunks/MessageSelector-CdDlJE48.js +3 -0
- package/dist/chunks/Messages-DuL_r1Or.js +10 -0
- package/dist/chunks/Onboarding-CE2GNA-h.js +1 -0
- package/dist/chunks/PermissionDialog-BaibiQae.js +1 -0
- package/dist/chunks/PressEnterToContinue-DZc_s_pE.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-lkr_A5jQ.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-DaQKKyM5.js +1 -0
- package/dist/chunks/QueryEngine-DNNy1UCD.js +1 -0
- package/dist/chunks/REPL-CEhW-C41.js +1 -0
- package/dist/chunks/REPL-CkSL4C_8.js +124 -0
- package/dist/chunks/ResumeConversation-BMCO_3X7.js +1 -0
- package/dist/chunks/{SearchBox-CwwV0W-w.js → SearchBox-C9xxQzh1.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +1 -0
- package/dist/chunks/SelectMulti-CNE06VAN.js +1 -0
- package/dist/chunks/Settings-mDykHLok.js +2 -0
- package/dist/chunks/Spinner-DwsJJUtn.js +1 -0
- package/dist/chunks/SpinnerGlyph-A6G-gloN.js +1 -0
- package/dist/chunks/TextInput-7uqPhq9T.js +22 -0
- package/dist/chunks/ThemePicker-DT9zVy-0.js +1 -0
- package/dist/chunks/TrustDialog-G4jM9IfM.js +1 -0
- package/dist/chunks/{ValidationErrorsList-BfZ5gcIv.js → ValidationErrorsList-BLtP647v.js} +1 -1
- package/dist/chunks/add-dir-7RfQAC3h.js +1 -0
- package/dist/chunks/{agentDisplay-BM4QG_RX.js → agentDisplay-vLQHFrmq.js} +1 -1
- package/dist/chunks/agents-BNg_skSm.js +101 -0
- package/dist/chunks/{agents-BbDBN5l9.js → agents-DLz0kfsr.js} +1 -1
- package/dist/chunks/allErrors-DaztSMrw.js +1 -0
- package/dist/chunks/appleTerminalBackup-BYKdf3of.js +1 -0
- package/dist/chunks/auth-BTB00dq5.js +10 -0
- package/dist/chunks/auth-Bbc0Ny8i.js +1 -0
- package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +1 -0
- package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +17 -0
- package/dist/chunks/banner-mqZEluky.js +2 -0
- package/dist/chunks/branch-exFKkymg.js +2 -0
- package/dist/chunks/{break-cache-CcwOjTKt.js → break-cache-BL2gnDLX.js} +2 -2
- package/dist/chunks/btw-3l78DYET.js +1 -0
- package/dist/chunks/caches-6Nx6tsk9.js +1 -0
- package/dist/chunks/caches-ouaWB9bY.js +1 -0
- package/dist/chunks/claudeDesktop-D3PEgx3U.js +1 -0
- package/dist/chunks/{clear-DmqQBNKg.js → clear-CXfhVRp8.js} +1 -1
- package/dist/chunks/client-C01Bnxxv.js +1 -0
- package/dist/chunks/client-DYRgRQsr.js +1 -0
- package/dist/chunks/{client-C_jBL1yC.js → client-DdenNfkQ.js} +1 -1
- package/dist/chunks/client-DvhWKIOx.js +1 -0
- package/dist/chunks/commands-BoxOw75F.js +1 -0
- package/dist/chunks/compact-BOYr105K.js +2 -0
- package/dist/chunks/config-BddEvZZl.js +3 -0
- package/dist/chunks/config-GEv9hUzz.js +1 -0
- package/dist/chunks/config-kw4xg7Nk.js +1 -0
- package/dist/chunks/context-3s9wtn4L.js +1 -0
- package/dist/chunks/{context-noninteractive-BzDVMnWC.js → context-noninteractive-CJhUu_4y.js} +9 -9
- package/dist/chunks/context-noninteractive-DFvoZ2L9.js +1 -0
- package/dist/chunks/conversation-CoGharlH.js +1 -0
- package/dist/chunks/conversation-MxEVm54C.js +1 -0
- package/dist/chunks/conversationRecovery-Da_8uldZ.js +1 -0
- package/dist/chunks/convert-legacy-node-http-options-BZnGSjx2.js +1 -0
- package/dist/chunks/crossProjectResume-CzPCHq_K.js +40 -0
- package/dist/chunks/cwd-BcO6WHKo.js +1 -0
- package/dist/chunks/cwd-CDUelriw.js +1 -0
- package/dist/chunks/{datadog-Bc6wkPne.js → datadog-v_mXWncN.js} +1 -1
- package/dist/chunks/{debug-D58GQBDG.js → debug-8DCufdSp.js} +4 -4
- package/dist/chunks/detectRepository-DfX8xXw2.js +1 -0
- package/dist/chunks/{diff-DIg66U_d.js → diff-DJSt7QO6.js} +1 -1
- package/dist/chunks/directoryCompletion-CT6YVeg7.js +1 -0
- package/dist/chunks/doctor-DWvioSU9.js +1 -0
- package/dist/chunks/entry-ex0-RyYV.js +13 -0
- package/dist/chunks/esm-0CwQE5CJ.js +10 -0
- package/dist/chunks/esm-BCmY8V0C.js +1 -0
- package/dist/chunks/esm-BQY8jJNR.js +1 -0
- package/dist/chunks/esm-BUJtY-Rb.js +1 -0
- package/dist/chunks/esm-BadZVa27.js +1 -0
- package/dist/chunks/esm-BbMeEYcz.js +1 -0
- package/dist/chunks/esm-sVMjGuep.js +1 -0
- package/dist/chunks/execFileNoThrow-BsfuytkN.js +34 -0
- package/dist/chunks/exit-BxC_ZEtO.js +1 -0
- package/dist/chunks/extraUsage-DYm33Occ.js +1 -0
- package/dist/chunks/extractMemories-CzN3Ax2B.js +1 -0
- package/dist/chunks/fast-DqUpl_Lr.js +1 -0
- package/dist/chunks/fast-NUdUyAaM.js +1 -0
- package/dist/chunks/fetchModelList-CqsTAWEN.js +1 -0
- package/dist/chunks/fetchModelList-DBMHE6Ng.js +1 -0
- package/dist/chunks/fileSuggestions-B-SLfb-o.js +3 -0
- package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +3 -0
- package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +1 -0
- package/dist/chunks/fpsMetrics-wxj9GAsd.js +1 -0
- package/dist/chunks/gemini-BC9kHhwe.js +2 -0
- package/dist/chunks/generateSessionName-ChvKBVxB.js +1 -0
- package/dist/chunks/{genericProcessUtils-6E7fB1dI.js → genericProcessUtils-BYi0OefF.js} +3 -3
- package/dist/chunks/goal-ByyimpVU.js +3 -0
- package/dist/chunks/grok-DenjixMl.js +1 -0
- package/dist/chunks/grove-Dq8QbQ9o.js +7 -0
- package/dist/chunks/help-CK90i4hE.js +1 -0
- package/dist/chunks/history-CNQNd6hT.js +1 -0
- package/dist/chunks/{hooks-7iyENdDG.js → hooks-BRFDg9DV.js} +2 -2
- package/dist/chunks/hooks-BaYwmkxD.js +1 -0
- package/dist/chunks/install-ZMll-dAa.js +1 -0
- package/dist/chunks/instrumentation-BwVyvRfY.js +21 -0
- package/dist/chunks/{job-CXz7SLZp.js → job-G_ukhLc4.js} +1 -1
- package/dist/chunks/keybindings-wNxBzDVQ.js +1 -0
- package/dist/chunks/launchLocalMemory-BcRlXLm6.js +3 -0
- package/dist/chunks/launchOnboarding-CDjQ64RO.js +8 -0
- package/dist/chunks/{loadAgentsDir-DaNpxaO-.js → loadAgentsDir-C1LkW7gl.js} +571 -641
- package/dist/chunks/loadAgentsDir-DKXap_Om.js +1 -0
- package/dist/chunks/loadPluginHooks-DtmHtEiS.js +1 -0
- package/dist/chunks/{loader-C33o_5kS.js → loader-C61fB6vU.js} +1 -1
- package/dist/chunks/localSearch-BB9x5C2N.js +1 -0
- package/dist/chunks/{localSearch-C2SZ9bGW.js → localSearch-DFo_WTMm.js} +1 -1
- package/dist/chunks/log-DaILwWJa.js +1 -0
- package/dist/chunks/logoUtils-Dj_2SWmO.js +1 -0
- package/dist/chunks/{magicDocs-CrTwULyJ.js → magicDocs-DYc9TFmI.js} +2 -2
- package/dist/chunks/main-BRg8L_aw.js +346 -0
- package/dist/chunks/managedEnv-DsqAYOJ4.js +1 -0
- package/dist/chunks/managedEnv-lybrMred.js +1 -0
- package/dist/chunks/mcp-Bsw3cMiJ.js +6 -0
- package/dist/chunks/mcp-DDdud6Y7.js +1 -0
- package/dist/chunks/mcp-DbgTDUt7.js +2 -0
- package/dist/chunks/memory-CzwTzihf.js +1 -0
- package/dist/chunks/modalContext-DDZdU1J8.js +1 -0
- package/dist/chunks/mode-Pan-Q2c4.js +2 -0
- package/dist/chunks/model-BYfmXKHf.js +1 -0
- package/dist/chunks/model-BwBE0Pt5.js +1 -0
- package/dist/chunks/modelOptions-DvNBapgG.js +1 -0
- package/dist/chunks/nativeInstaller-DnSNJWIi.js +1 -0
- package/dist/chunks/notifications-B0DTaYoy.js +1 -0
- package/dist/chunks/omit-Dl1Us_PY.js +1 -0
- package/dist/chunks/onChangeAppState-4KOJMN82.js +1 -0
- package/dist/chunks/openai-C_6C1_0N.js +10 -0
- package/dist/chunks/overlayContext-CMV7nYR9.js +1 -0
- package/dist/chunks/panel-D9fGQgln.js +1 -0
- package/dist/chunks/parser-BKAVMTyD.js +1 -0
- package/dist/chunks/{parser-eVu-cTRs.js → parser-D8slvrJP.js} +1 -1
- package/dist/chunks/partition-B504IgAa.js +1 -0
- package/dist/chunks/pasteStore-DNV1M5Xd.js +1 -0
- package/dist/chunks/permissions-CLFMhdRk.js +3 -0
- package/dist/chunks/pidLock-D9do1Afy.js +3 -0
- package/dist/chunks/plan-CQLnPLuE.js +1 -0
- package/dist/chunks/{platform-DMQxcm4K.js → platform-Dzff1WWw.js} +1 -1
- package/dist/chunks/plugin-BYdF7uob.js +17 -0
- package/dist/chunks/pluginAutoupdate-BJaAqwTH.js +1 -0
- package/dist/chunks/pluginBlocklist-DKKmOnWM.js +1 -0
- package/dist/chunks/pluginCliCommands-z8TtJMKH.js +1 -0
- package/dist/chunks/{pluginFlagging-DRA0m76J.js → pluginFlagging-DQP8tBi2.js} +1 -1
- package/dist/chunks/pluginOperations-BcfJCDco.js +2 -0
- package/dist/chunks/{pluginStartupCheck-BF1N4Lih.js → pluginStartupCheck-CfRvCrFg.js} +1 -1
- package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +1 -0
- package/dist/chunks/plugins-CTM8jpOw.js +4 -0
- package/dist/chunks/policyLimits-a7ix6GnU.js +1 -0
- package/dist/chunks/poorMode-C11JEH3d.js +1 -0
- package/dist/chunks/{poorMode-CKQfWf3S.js → poorMode-J5SYJvoY.js} +1 -1
- package/dist/chunks/print-u6MzL5Cr.js +13 -0
- package/dist/chunks/processBashCommand-DIwrI2QC.js +1 -0
- package/dist/chunks/processSlashCommand-B-Gujpxm.js +5 -0
- package/dist/chunks/projectOnboardingState-CJycxw5P.js +1 -0
- package/dist/chunks/{prompt-8u06WVES.js → prompt-BGqgPgCU.js} +3 -3
- package/dist/chunks/prompt-BPJDGlx5.js +1 -0
- package/dist/chunks/prompt-DEdZzkEz.js +1 -0
- package/dist/chunks/promptEditor-CmQ9p4oe.js +4 -0
- package/dist/chunks/{protocolHandler-DzHVaPl3.js → protocolHandler-CJo9-PfZ.js} +2 -2
- package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CB17QimU.js} +2 -2
- package/dist/chunks/reconciler-DSKLuOS7.js +1 -0
- package/dist/chunks/refresh-BbZFCNpn.js +1 -0
- package/dist/chunks/registerProtocol-CLIpzVwF.js +1 -0
- package/dist/chunks/reload-plugins-DjugL8jH.js +1 -0
- package/dist/chunks/rename-DOtCOtEr.js +1 -0
- package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-Zqfm2U1y.js} +1 -1
- package/dist/chunks/resume-BB4T4WIV.js +2 -0
- package/dist/chunks/ripgrep-BuzOTf1S.js +5 -0
- package/dist/chunks/ripgrep-CZ2CqaHb.js +1 -0
- package/dist/chunks/{runtimeObserver-DzesbvgI.js → runtimeObserver-CK_iZ6OB.js} +1 -1
- package/dist/chunks/{runtimeObserver-L6041elO.js → runtimeObserver-CpP0L9T9.js} +4 -4
- package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +1 -0
- package/dist/chunks/sandbox-toggle-KOHYvbQT.js +1 -0
- package/dist/chunks/searchExtraTools-CdJghGkj.js +1 -0
- package/dist/chunks/select-C_KXmqbI.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +1 -0
- package/dist/chunks/sessionObserver-DB-sLv-X.js +1 -0
- package/dist/chunks/{sessionObserver-0D8xFoRK.js → sessionObserver-WOYv2n7C.js} +2 -2
- package/dist/chunks/sessionStorage-sgOAbDn7.js +1 -0
- package/dist/chunks/sessionTracing-yBre24PH.js +11 -0
- package/dist/chunks/settings-C-KNkvsM.js +1 -0
- package/dist/chunks/settings-DKN4xSpQ.js +24 -0
- package/dist/chunks/setup-CN_Pk7AR.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-Cy9tsuKc.js → shadowedRuleDetection-Df-kZ_pK.js} +1 -1
- package/dist/chunks/{sideQuestion-Ds7Elgs4.js → sideQuestion-CMB8hfgX.js} +3 -3
- package/dist/chunks/sinks-BS17vtN0.js +1 -0
- package/dist/chunks/sinks-D1EjkHb4.js +1 -0
- package/dist/chunks/skillChangeDetector-CBKuGuEi.js +1 -0
- package/dist/chunks/{skillGapStore-BxCxKPev.js → skillGapStore-CfmlO6pb.js} +2 -2
- package/dist/chunks/{skillLifecycle-CfyNC3sW.js → skillLifecycle-BQ2LMfMx.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CMNJFIEC.js → skillSearchPanel-BwYuwLFs.js} +4 -4
- package/dist/chunks/skills-BVHPQma0.js +1 -0
- package/dist/chunks/src-9vmGsuSI.js +1 -0
- package/dist/chunks/{src-CgZmCiiH.js → src-BacxF9BD.js} +2 -2
- package/dist/chunks/startupProfiler-B_U4QDtf.js +1 -0
- package/dist/chunks/startupProfiler-DTs9w9EN.js +3 -0
- package/dist/chunks/{state-D5D6QpTX.js → state-BowF111d.js} +1 -1
- package/dist/chunks/state-CGuyDES7.js +1 -0
- package/dist/chunks/staticRender-BVWx0IM1.js +1 -0
- package/dist/chunks/status-BurdTfyz.js +2 -0
- package/dist/chunks/status-DMq1An5h.js +1 -0
- package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +1 -0
- package/dist/chunks/stringUtils-BQm3OfeJ.js +4 -0
- package/dist/chunks/{switcher-DQF5ZNal.js → switcher-Bq1Ct_Sn.js} +1 -1
- package/dist/chunks/switcher-DGD4ORVf.js +1 -0
- package/dist/chunks/{tasks-C8pb6ftc.js → tasks-0c8Uy04D.js} +1 -1
- package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
- package/dist/chunks/{templateJobs-DJ4dcfcL.js → templateJobs-BdFzE9XG.js} +1 -1
- package/dist/chunks/terminalSetup-Cf_r6pwK.js +32 -0
- package/dist/chunks/{terminalSetup-7PdC4fV5.js → terminalSetup-D7J6bxcn.js} +1 -1
- package/dist/chunks/theme-Bby4fssR.js +1 -0
- package/dist/chunks/tipRegistry-CyRXWWTz.js +2 -0
- package/dist/chunks/{toolEventObserver-D2nk8ZbW.js → toolEventObserver-CzFZUIsM.js} +1 -1
- package/dist/chunks/toolPool-CnrZcprA.js +1 -0
- package/dist/chunks/types-zk5Ltv5q.js +81 -0
- package/dist/chunks/udsClient-ftP0yIpe.js +1 -0
- package/dist/chunks/use-select-navigation-DMaC_3iw.js +1 -0
- package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-CjW3gUOt.js +1 -0
- package/dist/chunks/useMainLoopModel-DWscpA9I.js +1 -0
- package/dist/chunks/useManagePlugins-CYXVcql2.js +1 -0
- package/dist/chunks/useMergedTools-DarmnCEw.js +1 -0
- package/dist/chunks/useSearchInput-C2JuUW3g.js +1 -0
- package/dist/chunks/useSettingsErrors-DutJBiKZ.js +1 -0
- package/dist/chunks/util-Bq5l7FF5.js +1 -0
- package/dist/chunks/validatePlugin-DIdEydz_.js +1 -0
- package/dist/chunks/{vim-BagKUX4j.js → vim-D8prM2IH.js} +1 -1
- package/dist/chunks/worktree-Caqt2WRZ.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +3 -21
- package/dist/chunks/AddWorkspaceDirectory-BYNvxNrD.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CMEGV4Md.js +0 -1
- package/dist/chunks/App-W_9d1DjK.js +0 -1
- package/dist/chunks/ApproveApiKey-Bf1Rb8Ql.js +0 -1
- package/dist/chunks/ApproveApiKey-wpdvXpFr.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-lGn1Wj1k.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-CjVjyNf8.js +0 -1
- package/dist/chunks/DiffDialog-DCpchgp5.js +0 -6
- package/dist/chunks/Doctor-6SjW91rd.js +0 -1
- package/dist/chunks/Doctor-FPYTivHw.js +0 -3
- package/dist/chunks/ExitFlow-Dy8_1D8J.js +0 -2
- package/dist/chunks/Grove-Dd6rjs5P.js +0 -11
- package/dist/chunks/HybridTransport-CJVkWa2u.js +0 -2
- package/dist/chunks/InvalidConfigDialog-Bisj9ic_.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-DyTPNRQR.js +0 -1
- package/dist/chunks/MCPConnectionManager-DfyoZaiu.js +0 -1
- package/dist/chunks/MCPToolListView-Dioupv8F.js +0 -1
- package/dist/chunks/McpParsingWarnings-BUlgpZAF.js +0 -1
- package/dist/chunks/MessageSelector-D8fylxPg.js +0 -3
- package/dist/chunks/Messages-BZDFMYBT.js +0 -10
- package/dist/chunks/Onboarding-BKLomZYo.js +0 -1
- package/dist/chunks/PermissionDialog-BPhvs5xH.js +0 -1
- package/dist/chunks/PressEnterToContinue-Dwoh6CaW.js +0 -1
- package/dist/chunks/PromptInputFooterSuggestions-DCum89fF.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-DG2lRqis.js +0 -1
- package/dist/chunks/QueryEngine-CyGHpX7M.js +0 -1
- package/dist/chunks/REPL-BDsz8KIx.js +0 -1
- package/dist/chunks/REPL-CCBNfZfs.js +0 -128
- package/dist/chunks/RemoteSessionManager-BfsOv4K6.js +0 -2
- package/dist/chunks/ResumeConversation-pC8NLq0F.js +0 -1
- package/dist/chunks/SSETransport-B3K6eH9I.js +0 -2
- package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +0 -1
- package/dist/chunks/Settings-CKaGmKg2.js +0 -2
- package/dist/chunks/TeleportProgress-CkgSp1cs.js +0 -1
- package/dist/chunks/TeleportRepoMismatchDialog-DdO_rECq.js +0 -1
- package/dist/chunks/TeleportResumeWrapper-BeG4N-2z.js +0 -1
- package/dist/chunks/ThemePicker-iD9ufy99.js +0 -1
- package/dist/chunks/TrustDialog-qO5OdQt8.js +0 -1
- package/dist/chunks/add-dir-C4eSVlZ6.js +0 -1
- package/dist/chunks/agents-D3APE_8d.js +0 -101
- package/dist/chunks/allErrors-BkgB7JNK.js +0 -1
- package/dist/chunks/api-BHBK9axp.js +0 -1
- package/dist/chunks/api-DyUWfg3a.js +0 -1
- package/dist/chunks/auth-0rn1U4Eq.js +0 -10
- package/dist/chunks/auth-BEoTPSgC.js +0 -1
- package/dist/chunks/auth-BPug7U_u.js +0 -1
- package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +0 -1
- package/dist/chunks/backgroundHousekeeping-km82qEh0.js +0 -17
- package/dist/chunks/banner-BkUdig-T.js +0 -2
- package/dist/chunks/bg-tGgpwpYx.js +0 -9
- package/dist/chunks/branch-CQ38cx5n.js +0 -2
- package/dist/chunks/bridgeConfig-C5L-7KaP.js +0 -1
- package/dist/chunks/bridgeConfig-CJMjDoaP.js +0 -1
- package/dist/chunks/bridgeMessaging-DVC3qj-C.js +0 -1
- package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
- package/dist/chunks/bridgeStatusUtil-Cex6VowM.js +0 -1
- package/dist/chunks/btw-_P96ffHR.js +0 -1
- package/dist/chunks/bundledMode--fG1S62b.js +0 -1
- package/dist/chunks/caches-DH-q8Fjf.js +0 -1
- package/dist/chunks/caches-Dq0pJFDP.js +0 -1
- package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
- package/dist/chunks/ccrClient-DO563xlf.js +0 -1
- package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
- package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
- package/dist/chunks/client-9uHzAmFH.js +0 -1
- package/dist/chunks/client-BVal_QII.js +0 -1
- package/dist/chunks/client-C19cqYQS.js +0 -1
- package/dist/chunks/client-Dd7CKMRX.js +0 -1
- package/dist/chunks/commands-BkpqHY9F.js +0 -1
- package/dist/chunks/compact-DuVIvqMu.js +0 -2
- package/dist/chunks/config-DMP6-Ccr.js +0 -1
- package/dist/chunks/config-DRy1I12M.js +0 -3
- package/dist/chunks/config-e0Goy478.js +0 -1
- package/dist/chunks/context-DjgMzIfe.js +0 -1
- package/dist/chunks/context-noninteractive-DV7bIJCm.js +0 -1
- package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
- package/dist/chunks/conversation-BBOE_EoE.js +0 -1
- package/dist/chunks/conversation-WxH5pb2z.js +0 -1
- package/dist/chunks/createSSHSession-LVGVXHXL.js +0 -5
- package/dist/chunks/createSession-BUzna9-E.js +0 -1
- package/dist/chunks/createSession-Dgwxk1WA.js +0 -1
- package/dist/chunks/crossProjectResume-6B2NYy8a.js +0 -40
- package/dist/chunks/cwd-DLK3znO7.js +0 -1
- package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
- package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
- package/dist/chunks/detached-Biz-xhu0.js +0 -4
- package/dist/chunks/detectRepository-CDOJ-M7h.js +0 -1
- package/dist/chunks/detectRepository-Cv9-k6dg.js +0 -1
- package/dist/chunks/directoryCompletion-BDGcGDuv.js +0 -1
- package/dist/chunks/doctor-BhUmhHQU.js +0 -1
- package/dist/chunks/entry-B-Y-AYeK.js +0 -13
- package/dist/chunks/esm-BYnFh4pG.js +0 -1
- package/dist/chunks/esm-Bx6rTxIs.js +0 -1
- package/dist/chunks/esm-C367Cyo-.js +0 -1
- package/dist/chunks/esm-CXM9jqO_.js +0 -1
- package/dist/chunks/esm-CXczu_-W.js +0 -1
- package/dist/chunks/esm-CXt5K8Xt.js +0 -1
- package/dist/chunks/esm-Cb-L4oAk.js +0 -1
- package/dist/chunks/esm-CvHtYRrr.js +0 -1
- package/dist/chunks/esm-DhRjocaU.js +0 -1
- package/dist/chunks/esm-DklLYEuz.js +0 -1
- package/dist/chunks/esm-IYgGg4wR.js +0 -1
- package/dist/chunks/esm-lyfry1WB.js +0 -10
- package/dist/chunks/execFileNoThrow-Bmb5HEFz.js +0 -34
- package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
- package/dist/chunks/exit-CW2eqUrR.js +0 -1
- package/dist/chunks/extraUsage-CkTon7ib.js +0 -1
- package/dist/chunks/extractMemories-CfmbvayQ.js +0 -1
- package/dist/chunks/fast-ByahC7Gw.js +0 -1
- package/dist/chunks/fast-xtIP4u4y.js +0 -1
- package/dist/chunks/fetchModelList-D9aePIPW.js +0 -1
- package/dist/chunks/fetchModelList-Dy-x4h3G.js +0 -1
- package/dist/chunks/fileSuggestions-CFkJktgc.js +0 -3
- package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +0 -1
- package/dist/chunks/firstPartyEventLogger-DqGSujCz.js +0 -3
- package/dist/chunks/flushGate-BjKW7PFC.js +0 -1
- package/dist/chunks/fpsMetrics-Dk_pnSHJ.js +0 -1
- package/dist/chunks/gemini-NnmxBoEp.js +0 -1
- package/dist/chunks/generateSessionName-EpqGW-T2.js +0 -1
- package/dist/chunks/git-By_J4XJL.js +0 -5
- package/dist/chunks/git-zJCasBa6.js +0 -1
- package/dist/chunks/githubRepoPathMapping-CzgPGOHQ.js +0 -1
- package/dist/chunks/goal-DbS8yJfB.js +0 -3
- package/dist/chunks/grok-BxZ4vTDw.js +0 -1
- package/dist/chunks/grove-CYE1Cfcz.js +0 -7
- package/dist/chunks/hash-Tu-My5Vp.js +0 -1
- package/dist/chunks/help-DatnwM25.js +0 -1
- package/dist/chunks/hooks-DjbqtbUV.js +0 -1
- package/dist/chunks/initReplBridge-BEZW5PEY.js +0 -1
- package/dist/chunks/install-DJukI-kL.js +0 -1
- package/dist/chunks/instrumentation-2HH15DPu.js +0 -21
- package/dist/chunks/jwtUtils-C_LG1txt.js +0 -1
- package/dist/chunks/keybindings-C9l5il16.js +0 -1
- package/dist/chunks/launchLocalMemory-BfGenqj1.js +0 -3
- package/dist/chunks/launchOnboarding-DjMmXeQE.js +0 -8
- package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
- package/dist/chunks/lib-BlVGipXx.js +0 -14
- package/dist/chunks/loadAgentsDir-DcI-8FQF.js +0 -1
- package/dist/chunks/loadPluginHooks-CGgpcyEC.js +0 -1
- package/dist/chunks/localSearch-CTTwYTU1.js +0 -1
- package/dist/chunks/log-CZ7ploQm.js +0 -1
- package/dist/chunks/logoUtils-CbIqOFrX.js +0 -1
- package/dist/chunks/main-Blm02_Js.js +0 -31
- package/dist/chunks/main-bJXadFi0.js +0 -356
- package/dist/chunks/managedEnv-CUsdYhAI.js +0 -1
- package/dist/chunks/managedEnv-DXeaUDSK.js +0 -1
- package/dist/chunks/mappers-_B-s9fNz.js +0 -1
- package/dist/chunks/mcp-BbbYzWpy.js +0 -6
- package/dist/chunks/mcp-D91sH9a8.js +0 -1
- package/dist/chunks/mcp-Dx-zgUgu.js +0 -2
- package/dist/chunks/memoize-CumjjK2Q.js +0 -1
- package/dist/chunks/memory-BeL7ui9m.js +0 -1
- package/dist/chunks/modalContext-wY9CeN4G.js +0 -1
- package/dist/chunks/mode-D695kgLI.js +0 -2
- package/dist/chunks/model-DX0TtzqX.js +0 -1
- package/dist/chunks/model-Do0f476p.js +0 -1
- package/dist/chunks/model-DpcM8dz5.js +0 -1
- package/dist/chunks/modelOptions-B3nis9cC.js +0 -1
- package/dist/chunks/nativeInstaller-CymO8TNe.js +0 -1
- package/dist/chunks/oauth-D38aRTUb.js +0 -1
- package/dist/chunks/oauth-U649LV5H.js +0 -1
- package/dist/chunks/omit-DO61BHZu.js +0 -1
- package/dist/chunks/onChangeAppState-vKml_lit.js +0 -1
- package/dist/chunks/openai-DdupGVdC.js +0 -10
- package/dist/chunks/panel-CVd1dzYl.js +0 -1
- package/dist/chunks/parser-Cq9X7HMP.js +0 -1
- package/dist/chunks/partition-BivH9MBJ.js +0 -1
- package/dist/chunks/permissions-C9iqR4_N.js +0 -3
- package/dist/chunks/pidLock-DiKz5Tza.js +0 -3
- package/dist/chunks/plan-KDN5IGWY.js +0 -1
- package/dist/chunks/plugin-D0rzUb8E.js +0 -17
- package/dist/chunks/pluginAutoupdate-C2xTKLR_.js +0 -1
- package/dist/chunks/pluginBlocklist-xdiUmUpt.js +0 -1
- package/dist/chunks/pluginCliCommands-CIDDvVN7.js +0 -1
- package/dist/chunks/pluginOperations-BEYsarAn.js +0 -2
- package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +0 -1
- package/dist/chunks/plugins-CWWU4BKs.js +0 -4
- package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
- package/dist/chunks/poorMode-BTIe8W_H.js +0 -1
- package/dist/chunks/print-B5H2xbBS.js +0 -14
- package/dist/chunks/processBashCommand-EQ9EWaRV.js +0 -1
- package/dist/chunks/processSlashCommand-C4PKNyFT.js +0 -5
- package/dist/chunks/prompt-B9sDzLPK.js +0 -1
- package/dist/chunks/prompt-WsoTRhoh.js +0 -1
- package/dist/chunks/promptEditor-Cr4w-4Bz.js +0 -4
- package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
- package/dist/chunks/reconciler-RIKmaPg7.js +0 -1
- package/dist/chunks/refresh-CCSCAjgz.js +0 -1
- package/dist/chunks/registerProtocol-C0IlPEoa.js +0 -1
- package/dist/chunks/reload-plugins-DC-tbXVv.js +0 -1
- package/dist/chunks/remoteBridgeCore-NGTnhQgw.js +0 -1
- package/dist/chunks/remoteManagedSettings-BoOYHzYP.js +0 -1
- package/dist/chunks/rename-DS1AmW-F.js +0 -1
- package/dist/chunks/resume-Cf5PSoPw.js +0 -2
- package/dist/chunks/ripgrep-C3jtZL7k.js +0 -5
- package/dist/chunks/ripgrep-CBUbn6Po.js +0 -1
- package/dist/chunks/sandbox-adapter-Z4Phj31K.js +0 -1
- package/dist/chunks/sandbox-toggle-COZE8Lo4.js +0 -1
- package/dist/chunks/searchExtraTools-CvkRbL2m.js +0 -1
- package/dist/chunks/session-BvA99K4j.js +0 -2
- package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +0 -1
- package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
- package/dist/chunks/sessionObserver-CRWUBJEY.js +0 -1
- package/dist/chunks/sessionState-CQhbGfmh.js +0 -11
- package/dist/chunks/sessionStorage-DqEuxDlb.js +0 -1
- package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
- package/dist/chunks/sessionTracing-BoOZsXU2.js +0 -11
- package/dist/chunks/settings-3xZ0fsvE.js +0 -19
- package/dist/chunks/settings-Crx1cI1u.js +0 -1
- package/dist/chunks/settingsSync-rkWmClKS.js +0 -1
- package/dist/chunks/setup-D8L275fT.js +0 -3
- package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
- package/dist/chunks/sinks-BXX72cbf.js +0 -1
- package/dist/chunks/sinks-DMp6uEzM.js +0 -1
- package/dist/chunks/skillChangeDetector-CtithJ4a.js +0 -1
- package/dist/chunks/skills-DXMk-498.js +0 -1
- package/dist/chunks/src-D3yIF9I42.js +0 -1
- package/dist/chunks/src-DQOX_xI1.js +0 -1
- package/dist/chunks/src-Dt5IJd3C.js +0 -1
- package/dist/chunks/src-Dvp6-vB7.js +0 -19
- package/dist/chunks/src-PM8NIIu_.js +0 -1
- package/dist/chunks/startupProfiler-CbzxVmbv.js +0 -3
- package/dist/chunks/startupProfiler-uHetQush.js +0 -1
- package/dist/chunks/state-BStOuCh4.js +0 -1
- package/dist/chunks/staticRender-D9AbnQFr.js +0 -1
- package/dist/chunks/stats-Ce15gc3E.js +0 -1
- package/dist/chunks/status-CFrLuGbf.js +0 -2
- package/dist/chunks/status-D5OCkMZG.js +0 -1
- package/dist/chunks/statusNoticeHelpers-CZoOse-_.js +0 -1
- package/dist/chunks/stringUtils-CKD8qDqx.js +0 -4
- package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
- package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
- package/dist/chunks/switcher-AiMcRzoi.js +0 -1
- package/dist/chunks/syncCache-qWJ_VfBo.js +0 -1
- package/dist/chunks/teleport-Bi_1VFIZ.js +0 -1
- package/dist/chunks/terminalSetup-kWdZRKWq.js +0 -32
- package/dist/chunks/theme-CEKOCSLw.js +0 -1
- package/dist/chunks/tmux-CpGd0Aca.js +0 -1
- package/dist/chunks/toolPool-Df5iUqJ-.js +0 -1
- package/dist/chunks/trustedDevice-CB6rNzl-.js +0 -1
- package/dist/chunks/trustedDevice-DXGePUAC.js +0 -1
- package/dist/chunks/types-APu4OCXJ.js +0 -17
- package/dist/chunks/udsClient-U7MEfYj7.js +0 -1
- package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js +0 -1
- package/dist/chunks/useMainLoopModel-CIG2cjS2.js +0 -1
- package/dist/chunks/useManagePlugins-MSHw-qHx.js +0 -1
- package/dist/chunks/useMergedTools-Bb-INJa2.js +0 -1
- package/dist/chunks/useSearchInput-QL_VtdJD.js +0 -1
- package/dist/chunks/useSettingsErrors-Dvi6zLCr.js +0 -1
- package/dist/chunks/userAgent-i-oGzf40.js +0 -1
- package/dist/chunks/util-CLQvtXuD.js +0 -1
- package/dist/chunks/validatePlugin-1mTZ3TJR.js +0 -1
- package/dist/chunks/which-BxQ1hpjp.js +0 -1
- package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
- package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
- package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
- package/dist/chunks/workerRegistry-BjxoZ12l.js +0 -2
- package/dist/chunks/worktree-DpksgxdF.js +0 -1
- /package/dist/chunks/{src-DL3w8VPk2.js → src-DL3w8VPk.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{mt as i,pt as a}from"./esm-BQY8jJNR.js";import{n as o,t as s}from"./axios-DaWTGg7G.js";import{My as c,jy as l,lC as u,vC as d}from"./loadAgentsDir-C1LkW7gl.js";import{C as f,L as ee,N as p,c as m,i as h,x as g}from"./debug-8DCufdSp.js";import{en as _,h as v,t as y,tn as b}from"./settings-DKN4xSpQ.js";import{c as te,m as x,v as S}from"./config-BddEvZZl.js";import{o as C,s as w}from"./log-DaILwWJa.js";import{n as T,r as E}from"./analytics-DJobLaWP.js";import{$n as D,Bt as ne,Cn as re,En as ie,Er as ae,Ft as oe,It as se,Jn as O,Kt as k,Lt as A,Qn as j,Rt as M,St as N,Xn as P,Xt as F,Yn as I,Zn as L,ar as R,at as z,cr as B,ct as V,ft as H,ht as U,ir as W,jt as G,pt as K,qt as ce,rr as le,sr as ue,tn as de,tr as q,wr as fe,yt as pe}from"./model-BwBE0Pt5.js";import{d as me,u as he}from"./firstPartyEventLogger-C0q45h_4.js";import{i as ge,r as _e}from"./grove-Dq8QbQ9o.js";import{t as ve}from"./policyLimits-a7ix6GnU.js";import{d as ye,n as be,t as xe}from"./status-BurdTfyz.js";import{createHash as Se,randomBytes as J}from"crypto";import{createServer as Ce}from"http";N(),de(),x(),ce(),ne(),he();async function Y(){K.cache?.clear?.(),F(),M(),me(),_e.cache?.clear?.(),ge.cache?.clear?.(),await ve()}async function X({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-BwVyvRfY.js`);await t(),await oe(),k().delete(),await Y(),S(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),ee(),g(),h(),T(),v(),ae(),B(),D(),u(),s(),b(),x(),ie(),C(),i();async function we(){try{if(te().claudeCodeFirstTokenDate!==void 0)return;let e=re();if(e.error){w(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${_().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await o.get(t,{headers:{...e.headers,"User-Agent":a()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){w(Error(`Received invalid first_token_date from API: ${n}`));return}}S(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){w(e)}}l(),b(),C();var Te=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ce(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,E(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=W(e)?_().CLAUDEAI_SUCCESS_URL:_().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,E(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=_().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,E(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){w(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function Z(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Ee(){return Z(J(32))}function De(e){let t=Se(`sha256`);return t.update(e),Z(t.digest())}function Oe(){return Z(J(32))}T(),D(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Ee()}async startOAuthFlow(e,t){this.authCodeListener=new Te,this.port=await this.authCodeListener.start();let n=De(this.codeVerifier),r=Oe(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=O({...i,isManual:!0}),o=O({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await c(o))}),l=this.authCodeListener?.hasPendingResponse()??!1;E(`tengu_oauth_auth_code_received`,{automatic:l});try{let e=await P(s,r,this.codeVerifier,this.port,!l,t?.expiresIn),n=await j(e.access_token);if(l){let t=q(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw l&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:q(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};T(),D(),N(),x(),C(),ye();async function $(e){await X({clearOnboarding:!1});let t=e.profile??await ue(e.accessToken);t?R({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&R({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=se(e);if(z(),n.warning&&E(`tengu_oauth_storage_warning`,{warning:n.warning}),await L(e.accessToken).catch(e=>m(String(e),{level:`error`})),W(e.scopes))await we().catch(e=>m(String(e),{level:`error`}));else if(!await I(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function ke({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
|
|
2
|
+
`),process.exit(1));let i=y(),a=i.forceLoginMethod?i.forceLoginMethod===`claudeai`:!n,o=i.forceLoginOrgUUID,s=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(s){let e=process.env.CLAUDE_CODE_OAUTH_SCOPES;e||(process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
|
|
3
|
+
Set it to the space-separated scopes the refresh token was issued with
|
|
4
|
+
(e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
|
|
5
|
+
`),process.exit(1));let t=e.split(/\s+/).filter(Boolean);try{E(`tengu_login_from_refresh_token`,{});let e=await le(s,{scopes:t});await $(e);let n=await A();n.valid||(process.stderr.write(`${n.message}\n`),process.exit(1)),S(e=>e.hasCompletedOnboarding?e:{...e,hasCompletedOnboarding:!0}),E(`tengu_oauth_success`,{loginWithClaudeAi:W(e.scopes)}),process.stdout.write(`Login successful.
|
|
6
|
+
`),process.exit(0)}catch(e){w(e);let t=d(e);process.stderr.write(`Login failed: ${p(e)}\n${t?`${t}\n`:``}`),process.exit(1)}}let c=t?`sso`:void 0,l=new Q;try{E(`tengu_oauth_flow_start`,{loginWithClaudeAi:a}),await $(await l.startOAuthFlow(async e=>{process.stdout.write(`Opening browser to sign in…
|
|
7
|
+
`),process.stdout.write(`If the browser didn't open, visit: ${e}\n`)},{loginWithClaudeAi:a,loginHint:e,loginMethod:c,orgUUID:o}));let t=await A();t.valid||(process.stderr.write(`${t.message}\n`),process.exit(1)),E(`tengu_oauth_success`,{loginWithClaudeAi:a}),process.stdout.write(`Login successful.
|
|
8
|
+
`),process.exit(0)}catch(e){w(e);let t=d(e);process.stderr.write(`Login failed: ${p(e)}\n${t?`${t}\n`:``}`),process.exit(1)}finally{l.cleanup()}}async function Ae(t){let{source:n,hasToken:r}=H(),{source:i}=V(),a=!!process.env.ANTHROPIC_API_KEY&&!e(),o=U(),s=pe(),c=G(),l=r||i!==`none`||a||c,u=`none`;if(c?u=`third_party`:n===`claude.ai`?u=`claude.ai`:n===`apiKeyHelper`?u=`api_key_helper`:n===`none`?i===`ANTHROPIC_API_KEY`||a?u=`api_key`:i===`/login managed key`&&(u=`claude.ai`):u=`oauth_token`,t.text){let e=[...be(),...xe()],t=!1;for(let n of e){let e=typeof n.value==`string`?n.value:Array.isArray(n.value)?n.value.join(`, `):null;e===null||e===`none`||(t=!0,n.label?process.stdout.write(`${n.label}: ${e}\n`):process.stdout.write(`${e}\n`))}!t&&a&&process.stdout.write(`API key: ANTHROPIC_API_KEY
|
|
9
|
+
`),l||process.stdout.write(`Not logged in.
|
|
10
|
+
`)}else{let e=fe(),t=i===`none`?a?`ANTHROPIC_API_KEY`:null:i,n={loggedIn:l,authMethod:u,apiProvider:e};t&&(n.apiKeySource=t),u===`claude.ai`&&(n.email=o?.emailAddress??null,n.orgId=o?.organizationUuid??null,n.orgName=o?.organizationName??null,n.subscriptionType=s??null),process.stdout.write(`${f(n,null,2)}\n`)}process.exit(+!l)}export{Q as i,Ae as n,$ as r,ke as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./auth-BTB00dq5.js";export{t as authLogin,e as authStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./backgroundHousekeeping-bEZtlJSf.js";export{e as startBackgroundHousekeeping};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{$b as n,$s as r,CS as i,FC as a,HS as o,Ou as s,Q as c,St as l,X as u,Zg as d,Zi as f,cr as p,dt as ee,dv as te,ec as ne,fv as re,ju as m,tx as h,vr as g,wS as _,zd as v}from"./loadAgentsDir-C1LkW7gl.js";import{I as y,V as b,zt as x}from"./state-BowF111d.js";import{n as ie,t as ae}from"./cwd-BcO6WHKo.js";import{H as oe,L as S,c as C,f as w,i as T,u as E,x as D}from"./debug-8DCufdSp.js";import{d as O,h as k,v as A}from"./settings-DKN4xSpQ.js";import{x as j}from"./config-BddEvZZl.js";import{_ as M,o as N,s as P,v as F}from"./log-DaILwWJa.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{f as R,u as z}from"./model-BwBE0Pt5.js";import{_n as B,vn as V}from"./prompt-BGqgPgCU.js";import{i as H,t as U}from"./nativeInstaller-DnSNJWIi.js";import{n as W,t as G}from"./allErrors-DaztSMrw.js";import{r as K,t as se}from"./pasteStore-DNV1M5Xd.js";import{r as ce}from"./magicDocs-DYc9TFmI.js";import{n as le,t as ue}from"./pluginAutoupdate-BJaAqwTH.js";import{n as de}from"./registerProtocol-CLIpzVwF.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ie(),D(),w(),T(),F(),k(),V(),R(),ne(),g(),ce(),u(),N(),S(),f(),d(),u(),re(),S(),N(),f(),d(),v();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),s=n(ae(),`.workmate`,`skills`,e,`SKILL.md`),l;try{l=await r.readFile(s,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${s}`));return}let u=t.map(e=>`- ${e.section}: ${e.change}`).join(`
|
|
2
|
+
`),d=z(),f=await c({messages:[o({content:`You are editing a skill definition file. Apply the following improvements to the skill.
|
|
3
|
+
|
|
4
|
+
<current_skill_file>
|
|
5
|
+
${l}
|
|
6
|
+
</current_skill_file>
|
|
7
|
+
|
|
8
|
+
<improvements>
|
|
9
|
+
${u}
|
|
10
|
+
</improvements>
|
|
11
|
+
|
|
12
|
+
Rules:
|
|
13
|
+
- Integrate the improvements naturally into the existing structure
|
|
14
|
+
- Preserve frontmatter (--- block) exactly as-is
|
|
15
|
+
- Preserve the overall format and style
|
|
16
|
+
- Do not remove existing content unless an improvement explicitly replaces it
|
|
17
|
+
- Output the complete updated file inside <updated_file> tags`})],systemPrompt:a([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:te().signal,options:{getToolPermissionContext:async()=>B(),model:d,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),p=i(_(Array.isArray(f.message.content)?f.message.content:[]).trim(),`updated_file`);if(!p){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(s,p,`utf-8`)}catch(e){P(oe(e))}}I(),m(),j(),N(),U(),K(),W(),h(),l();var pe=30;function J(){let e=((O()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await E().readdir(e);for(let a of i)try{he(a.name)<t&&(await E().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=E(),t=J(),n=M.errors(),r=M.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},r=p(),i=E(),a;try{a=await i.readdir(r)}catch{return t}for(let o of a){if(!o.isDirectory())continue;let a=q(r,o.name),s;try{s=await i.readdir(a)}catch{t.errors++;continue}for(let r of s)if(r.isFile()){if(!r.name.endsWith(`.jsonl`)&&!r.name.endsWith(`.cast`))continue;try{await X(q(a,r.name),e,i)&&t.messages++}catch{t.errors++}}else if(r.isDirectory()){let o=q(a,r.name),s=q(o,n),c;try{c=await i.readdir(s)}catch{await Z(o,i);continue}for(let n of c)if(n.isFile())try{await X(q(s,n.name),e,i)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let r=q(s,n.name),a;try{a=await i.readdir(r)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(r,n.name),e,i)&&t.messages++}catch{t.errors++}await Z(r,i)}await Z(s,i),await Z(o,i)}await Z(a,i)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=E(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=E();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=E();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=E(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=G();if(e.length>0&&A(`cleanupPeriodDays`)){C(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await s(),await se(J());let t=await ee(J());t>0&&L(`tengu_worktree_cleanup`,{removed:t})}x(),U(),le();var $=600*1e3;function Ce(){import(`./extractMemories-CzN3Ax2B.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),r(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await H()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Z as e,zt as t}from"./state-BowF111d.js";import{c as n,i as r}from"./debug-8DCufdSp.js";import{An as i,Fn as a,Kr as o,Lr as s,Pr as c,Ur as l,Yr as u}from"./settings-DKN4xSpQ.js";import{c as d,m as f,v as p}from"./config-BddEvZZl.js";import{_ as m,f as h,p as g}from"./startupProfiler-DTs9w9EN.js";import{n as _,r as v}from"./detectRepository-DfX8xXw2.js";import{homedir as y}from"os";import{join as b,sep as x}from"path";import{realpath as S,stat as C}from"fs/promises";t(),f(),r(),v(),i(),u(),l();async function w(){try{let t=await _();if(!t){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=e(),i=c(r)??r,a;try{a=(await S(i)).normalize(`NFC`)}catch{a=i}let o=t.toLowerCase(),s=d().githubRepoPaths?.[o]??[];if(s[0]===a){n(`Path ${a} already tracked for repo ${o}`);return}let l=s.filter(e=>e!==a),u=[a,...l];p(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[o]:u}})),n(`Added ${a} to tracked paths for repo ${o}`)}catch(e){n(`Error updating repo path mapping: ${e}`)}}function T(e){let t=d(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function E(e){let t=await Promise.all(e.map(a));return e.filter((e,n)=>t[n])}m(),u(),l();var D=10080*60*1e3,O=1e3;function k(e){let t=[`This session was opened by an external deep link in ${M(e.cwd)}`];if(e.repo){let n=e.lastFetch?g(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>D;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>O?`The prompt below (${h(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
|
|
2
|
+
`)}async function A(e){let t=await s(e);if(!t)return;let n=await o(t),[r,i]=await Promise.all([j(b(t,`FETCH_HEAD`)),n?j(b(n,`FETCH_HEAD`)):Promise.resolve(void 0)]);return r&&i?r>i?r:i:r??i}async function j(e){try{let{mtime:t}=await C(e);return t}catch{return}}function M(e){let t=y();return e===t?`~`:e.startsWith(t+x)?`~${e.slice(t.length)}`:e}export{w as a,T as i,A as n,E as r,k as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ci as t,hr as n,mr as r,ni as i,sr as a,vr as o,wr as s}from"./loadAgentsDir-C1LkW7gl.js";import{l as c,u as l}from"./types-zk5Ltv5q.js";import{Z as u,ut as d,zt as f}from"./state-BowF111d.js";import{C as p,x as m}from"./debug-8DCufdSp.js";import{i as h,o as g}from"./stringUtils-BQm3OfeJ.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let t=y(),i=d(),o=a(u()),c=n(t),f=r();await b(o,{recursive:!0,mode:448});let m;try{m=await x(f)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=l(m),g=h.filter(e=>s(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let n={...e,sessionId:t,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:t};w.push(r),C.push(p(n)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:t,replacements:_};C.push(p(e))}return await S(c,`${C.join(`
|
|
2
|
+
`)}\n`,{encoding:`utf8`,mode:384}),{sessionId:t,title:e,forkPath:c,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let n=`${e} (Branch)`;if((await t(n,{exact:!0})).length===0)return n;let r=await t(`${e} (Branch`),i=new Set([1]),a=RegExp(`^${h(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of r){let t=e.customTitle?.match(a);t&&(t[1]?i.add(parseInt(t[1],10)):i.add(1))}let o=2;for(;i.has(o);)o++;return`${e} (Branch ${o})`}async function E(e,t,n){let r=n?.trim()||void 0,a=d();try{let{sessionId:n,title:o,forkPath:s,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(o??d);await i(n,f,s),v(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!o});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:s,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=o?` "${o}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${a}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{f(),_(),c(),o(),m(),g()}))();export{E as call,C as deriveFirstPrompt};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DcaKZlRU.js";import{L as r,zt as i}from"./state-BowF111d.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
|
|
2
2
|
`).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,`${JSON.stringify(r)}\n`,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
|
|
3
3
|
`)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
|
|
4
4
|
`)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: The prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
|
|
5
5
|
`)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
|
|
6
6
|
`)}}var y,b,x,S=e((()=>{i(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
|
|
7
|
-
`),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-
|
|
7
|
+
`),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-D9fGQgln.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as n,Bs as r,Ch as i,DS as a,FC as o,Sh as s,Yb as c,Zg as l,Zi as u,at as d,dv as f,fv as p,ot as m,td as h,wh as g,zs as _}from"./loadAgentsDir-C1LkW7gl.js";import{I as v,P as y,ai as b,bn as x,ot as S,t as C,vn as w,xt as T}from"./src-DL3w8VPk.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{L as D,N as O}from"./debug-8DCufdSp.js";import{Ht as k}from"./settings-DKN4xSpQ.js";import{m as A,v as j}from"./config-BddEvZZl.js";import{n as M,t as N}from"./SpinnerGlyph-A6G-gloN.js";import{n as P,r as F}from"./sideQuestion-CMB8hfgX.js";import{i as I,n as L}from"./modalContext-DDZdU1J8.js";function R({question:e,context:t,onDone:r}){let[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(0),u=(0,H.useRef)(null),{rows:d}=I(S());x(()=>l(e=>e+1),i||o?null:80);function p(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),r(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),u.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),u.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=f();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?a(r.response):s(`No response received`))}catch(e){n.signal.aborted||s(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let m=Math.max(5,d-W-G);return(0,U.jsxs)(v,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:p,children:[(0,U.jsxs)(v,{children:[(0,U.jsxs)(y,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(y,{dimColor:!0,children:e})]}),(0,U.jsx)(v,{marginTop:1,marginLeft:2,maxHeight:m,children:(0,U.jsx)(T,{ref:u,flexDirection:`column`,flexGrow:1,children:o?(0,U.jsx)(y,{color:`error`,children:o}):i?(0,U.jsx)(n,{children:i}):(0,U.jsxs)(v,{children:[(0,U.jsx)(N,{frame:c,messageColor:`warning`}),(0,U.jsx)(y,{color:`warning`,children:`Answering...`})]})})}),(i||o)&&(0,U.jsx)(v,{marginTop:1,children:(0,U.jsxs)(y,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=a(z(e.messages)),n=_();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,c,l]=await Promise.all([d(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),i(),s()]);return{systemPrompt:o(r),userContext:c,systemContext:l,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(j(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{H=t(b(),1),w(),h(),M(),k(),m(),L(),g(),c(),C(),p(),A(),D(),r(),u(),P(),l(),U=E(),W=5,G=6,K=3}))();export{V as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./caches-ouaWB9bY.js";e();export{t as clearSessionCaches};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{C_ as t,Ch as n,Dh as r,Eh as i,G as a,Pd as o,Pi as s,Qf as c,Sh as l,Th as u,Ti as d,Ui as f,Yh as p,Zf as m,Zh as h,dx as g,ff as _,ju as v,ku as y,ns as b,q as x,qi as S,rs as C,uf as w,ux as T,w_ as E,wh as D,xh as O}from"./loadAgentsDir-C1LkW7gl.js";import{bn as k,l as A,zt as j}from"./state-BowF111d.js";import{Gr as M,Yr as N}from"./settings-DKN4xSpQ.js";import{a as P,n as F}from"./fileSuggestions-B-SLfb-o.js";import{r as I,t as L}from"./magicDocs-DYc9TFmI.js";import{r as R,t as z}from"./detectRepository-DfX8xXw2.js";function B(e=new Set){let t=e.size>0;n.cache.clear?.(),l.cache.clear?.(),O.cache.clear?.(),i.cache.clear?.(),F(),d(),t||h(),u(null),k(null),_(),C(),E(`session_start`),y(),z(),a(),A(e),M(),f(),c(),L(),T(),import(`./SearchExtraToolsTool-DSy_jDhf.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-DKXap_Om.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-BPJDGlx5.js`).then(({clearPromptCache:e})=>e())}var V=e((()=>{j(),s(),r(),D(),P(),o(),p(),w(),m(),I(),S(),b(),x(),t(),R(),N(),v(),g()}));export{V as n,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,f as t,i as n,l as r}from"./types-zk5Ltv5q.js";import{L as i,P as a}from"./debug-8DCufdSp.js";import{o,s}from"./log-DaILwWJa.js";import{i as c,o as l,t as u}from"./platform-Dzff1WWw.js";import{homedir as d}from"os";import{join as f}from"path";import{readFile as p,readdir as m,stat as h}from"fs/promises";e(),i(),r(),o(),l();async function g(){let e=c();if(!u.includes(e))throw Error(`Unsupported platform: ${e} - Work Mate Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Work Mate`,`claude_desktop_config.json`);let t=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(t){let e=`/mnt/c${t.replace(/^[A-Z]:/,``)}/AppData/Roaming/Work Mate/claude_desktop_config.json`;try{return await h(e),e}catch{}}try{let e=`/mnt/c/Users`;try{let t=await m(e,{withFileTypes:!0});for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=f(e,n.name,`AppData`,`Roaming`,`Work Mate`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){s(e)}throw Error(`Could not find Work Mate Desktop config file in Windows. Make sure Work Mate Desktop is installed on Windows.`)}async function _(){if(!u.includes(c()))throw Error(`Unsupported platform - Work Mate Desktop integration only works on macOS and WSL.`);try{let e=await g(),r;try{r=await p(e,{encoding:`utf8`})}catch(e){if(a(e)===`ENOENT`)return{};throw e}let i=t(r);if(!i||typeof i!=`object`)return{};let o=i.mcpServers;if(!o||typeof o!=`object`)return{};let s={};for(let[e,t]of Object.entries(o)){if(!t||typeof t!=`object`)continue;let r=n().safeParse(t);r.success&&(s[e]=r.data)}return s}catch(e){return s(e),{}}}export{_ as readClaudeDesktopMcpServers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-MxEVm54C.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./client-DdenNfkQ.js";e();export{t as clearOpenAIClientCache};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./client-DvhWKIOx.js";e();export{t as getGrokClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-CB17QimU.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let t=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:t,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:n({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),t(),m=null}));export{f as n,h as r,p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-CB17QimU.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";function a(e){if(s)return s;let t=new r({apiKey:process.env.GROK_API_KEY||process.env.XAI_API_KEY||``,baseURL:process.env.GROK_BASE_URL||o,maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:n({forAnthropicAPI:!1}),...e?.fetchOverride&&{fetch:e.fetchOverride}});return e?.fetchOverride||(s=t),t}var o,s,c=e((()=>{i(),t(),o=`https://api.x.ai/v1`,s=null}));export{c as n,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Pi as e,Ti as t,ki as n}from"./loadAgentsDir-C1LkW7gl.js";e();export{t as clearCommandsCache,n as getCommands};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ch as t,DS as n,Fm as r,Im as i,Jb as a,Ju as o,Mh as s,Nh as c,Oh as l,Rm as u,Sh as d,Vh as f,Xh as p,Yh as m,Yu as h,Zi as g,at as _,bh as v,ff as y,hn as b,if as x,kh as S,of as C,ot as w,qb as T,qh as E,uf as D,wh as O,yh as k,zm as A}from"./loadAgentsDir-C1LkW7gl.js";import{di as j,fi as M}from"./src-DL3w8VPk.js";import{Vt as N,zt as P}from"./state-BowF111d.js";import{I as F,L as I}from"./debug-8DCufdSp.js";import{o as L,s as R}from"./log-DaILwWJa.js";function z(e,t){let n=o(`tip`),r=T(`app:toggleTranscript`,`Global`,`ctrl+o`),i=[...e.options.verbose?[]:[`(${r} to see full summary)`],...t?[t]:[],...n?[n]:[]];return j.dim(`Compacted ${i.join(`
|
|
2
|
+
`)}`)}async function B(e,n){let r=e.getAppState(),i=await _(e.options.tools,e.options.mainLoopModel,Array.from(r.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),a=k({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:i,appendSystemPrompt:e.options.appendSystemPrompt}),[o,s]=await Promise.all([t(),d()]);return{systemPrompt:a,userContext:o,systemContext:s,toolUseContext:e,forkContextMessages:n}}var V;e((()=>{M(),P(),w(),O(),a(),m(),A(),s(),l(),D(),x(),f(),I(),b(),L(),g(),h(),v(),V=async(e,a)=>{let{abortController:o}=a,{messages:s}=a;if(s=n(s),s.length===0)throw Error(`No messages to compact`);let l=e.trim();try{if(!l){let e=await C(s,a.agentId);if(e)return t.cache.clear?.(),y(),p(a.options.querySource??`compact`,a.agentId),N(),c(),{type:`compact`,compactionResult:e,displayText:z(a)}}let e=(await S(s,a)).messages,n=await u(e,a,await B(a,e),!1,l,!1);return E(void 0),c(),t.cache.clear?.(),y(),{type:`compact`,compactionResult:n,displayText:z(a,n.userDisplayMessage)}}catch(e){throw o.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(i):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(r):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,i as c,l,o as u}from"./envUtils-DcaKZlRU.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{f,h as p,l as m,m as h}from"./types-zk5Ltv5q.js";import{Cr as g,Xr as _,Yr as v,Z as ee,_r as te,br as ne,ci as re,di as ie,dr as ae,fi as oe,fr as se,ft as ce,gr as le,hr as ue,ii as de,ni as fe,ri as pe,si as me,ti as he,tt as ge,vr as _e,wr as ve,yr as ye,zt as be}from"./state-BowF111d.js";import{n as xe,t as Se}from"./cwd-BcO6WHKo.js";import{C as y,L as Ce,O as b,P as x,S as we,c as S,et as Te,f as Ee,i as De,tt as Oe,u as C,x as ke}from"./debug-8DCufdSp.js";import{An as Ae,Kt as w,Nr as je,Ur as Me,Vn as Ne,_i as Pe,bi as Fe,cr as Ie,di as Le,gi as Re,h as ze,in as Be,lr as T,ni as Ve,nn as He,qt as Ue,s as E,t as We,ti as Ge,ui as Ke,wr as qe,xi as Je}from"./settings-DKN4xSpQ.js";import{d as Ye,o as Xe,s as Ze,u as Qe}from"./log-DaILwWJa.js";import{n as $e,r as D}from"./analytics-DJobLaWP.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as j,resolve as nt,sep as rt}from"path";import{unwatchFile as it,watchFile as at}from"fs";import{randomBytes as ot}from"crypto";var M,st=t((()=>{oe(),Le(),fe(),pe(),M=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ie(t,he(e)),e=Ke(e);return t}:de}));function ct(e){return me(e,Pe,M)}var lt=t((()=>{re(),st(),Re()}));function ut(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(l(e))return!1;if(s(e))return!0;if(l(process.env.CLAUDE_CODE_SIMPLE)||l(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=We();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function dt(){return!1}function ft(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:c()}function pt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=j(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=j(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+rt).normalize(`NFC`)}function mt(){return pt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function ht(){return pt(E(`policySettings`)?.autoMemoryDirectory??E(`flagSettings`)?.autoMemoryDirectory??E(`localSettings`)?.autoMemoryDirectory??E(`userSettings`)?.autoMemoryDirectory,!0)}function gt(){return mt()!==void 0}function _t(){return je(ge())??ge()}function vt(){return A(N(),xt)}function yt(e){return j(e).startsWith(N())}var bt,xt,N,St=t((()=>{o(),be(),u(),Me(),Ie(),ze(),bt=`memory`,xt=`MEMORY.md`,N=a(()=>(mt()??ht())||(A(A(ft(),`projects`),qe(_t()),bt)+rt).normalize(`NFC`),()=>ge())}));function Ct(e,t,n,i){if(!r(e))return e;t=ye(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=_e(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:_(t[a+1])?[]:{})}Fe(c,l,u),c=c[l]}return e}var wt=t((()=>{Je(),ne(),v(),i(),te()}));function Tt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ue(e,o);n(s,o)&&Ct(a,ye(o,e),s)}return a}var Et=t((()=>{le(),wt(),ne()}));function P(e,t){if(e==null)return{};var n=g(ct(e),function(e){return[e]});return t=ae(t),Tt(e,n,function(e,n){return t(e,n[0])})}var Dt=t((()=>{ve(),se(),Et(),lt()})),Ot=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),kt=n((e=>{var t=Ot();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),At=n(((e,t)=>{t.exports=kt()})),jt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Mt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=jt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Nt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Pt=n(((t,n)=>{var r=e(`path`),i=d(),a=At(),o=Mt(),s=Nt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),Ft=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),It=n(((e,t)=>{var n=Pt(),{toPromise:r,toSync:i,toSyncOptions:a}=Ft();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function F(){return I||(I=It()),I}function Lt(e,t){return F().lock(e,t)}function Rt(e,t){return F().lockSync(e,t)}function zt(e,t){return F().check(e,t)}var I,Bt=t((()=>{}));function L(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Vt(){return un||(un=Ht())}function Ht(){if(ce())return!0;let e=V(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=T(Se());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=T(nt(n,`..`));if(t===n)break;n=t}return!1}function R(e){let t=q.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function z(e){let t=null;try{Yt(w(),L,n=>{let r=e(n);return r===n?n:(t={...r,projects:Gt(n.projects)},t)})&&t&&B(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=U(w(),L);if(R(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Gt(r.projects)},Jt(w(),t,K),B(t)}}function Ut(){let e=Y+X;e>0&&D(`tengu_config_cache_stats`,{cache_hits:Y,cache_misses:X,hit_rate:Y/e}),Y=0,X=0}function Wt(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Gt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Kt(){if(Z)return;Z=!0;let e=w();at(e,{interval:fn,persistent:!1},t=>{t.mtimeMs<=q.mtime||C().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=q.mtime)return;let n=f(p(e));typeof n!=`object`||!n||(q={config:Wt({...L(),...n}),mtime:t.mtimeMs},J={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Oe(async()=>{it(e),Z=!1})}function B(e){q={config:e,mtime:Date.now()},J=null}function V(){if(q.config)return Y++,q.config;X++;try{let e=null;try{e=C().statSync(w())}catch{}let t=Wt(U(w(),L));return q={config:t,mtime:e?.mtimeMs??Date.now()},J=e?{mtime:e.mtimeMs,size:e.size}:null,Kt(),t}catch{return Wt(U(w(),L))}}function qt(e){let t=V();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Jt(e,t,n){let r=k(e);C().mkdirSync(r),Ne(e,y(P(t,(e,t)=>y(e)!==y(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===w()&&dn++}function Yt(e,t,n){let r=t(),i=k(e),a=C();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=Rt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Work Mate instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),J&&e===w())try{let t=a.statSync(e);(t.mtimeMs!==J.mtime||t.size!==J.size)&&D(`tengu_config_stale_write`,{read_mtime:J.mtime,write_mtime:t.mtimeMs,read_size:J.size,write_size:t.size})}catch(e){if(x(e)!==`ENOENT`)throw e}let l=U(e,t);if(e===w()&&R(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.workmate.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=P(u,(e,t)=>y(e)!==y(r[t]));try{let t=O(e),n=H();try{a.mkdirSync(n)}catch(e){if(x(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){x(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return Ne(e,y(d,null,2),{encoding:`utf-8`,mode:384}),e===w()&&dn++,!0}finally{o&&o()}}function Xt(){if(Q)return;let e=Date.now();Ve(`info`,`enable_configs_started`),Q=!0,U(w(),L,!0),Ve(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function H(){return A(c(),`backups`)}function Zt(e){let t=C(),n=O(e),r=H();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function U(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=C();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=we(p(n));return{...t(),...e}}catch(n){throw new b(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(x(i)===`ENOENT`){let n=Zt(e);return n&&process.stderr.write(`\nWork Mate configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof b&&n)throw i;if(i instanceof b){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!W){W=!0;try{Ze(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{W=!1}}process.stderr.write(`\nWork Mate configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=H();try{r.mkdirSync(n)}catch(e){if(x(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=Zt(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
|
|
2
|
+
`),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
|
|
3
|
+
`)}return t()}}function Qt(){let e=$(),t=V();if(!t.projects)return G;let n=t.projects[e]??G;return typeof n.allowedTools==`string`&&(n.allowedTools=f(n.allowedTools)??[]),n}function $t(e){let t=$(),n=null;try{Yt(w(),L,r=>{let i=r.projects?.[t]??G,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&B(n)}catch(r){S(`Failed to save config with lock: ${r}`,{level:`error`});let i=U(w(),L);if(R(i)){S(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??G,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Jt(w(),n,K),B(n)}}function en(){return rn()!==null}function tn(){return en()&&!l(process.env.FORCE_AUTOUPDATE_PLUGINS)}function nn(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function rn(){if(!l(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(l(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=Qe();if(e)return{type:`env`,envVar:e};let t=V();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function an(){let e=V();if(e.userID)return e.userID;let t=ot(32).toString(`hex`);return z(e=>({...e,userID:t})),t}function on(){if(!V().firstStartTime){let e=new Date().toISOString();z(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function sn(e){let t=ee();switch(e){case`User`:return A(c(),`AGENTS.md`);case`Local`:return A(t,`AGENTS.local.md`);case`Project`:return A(t,`AGENTS.md`);case`Managed`:return A(He(),`AGENTS.md`);case`AutoMem`:return vt();default:return A(c(),`AGENTS.md`)}}function cn(){return A(He(),`.workmate`,`rules`)}function ln(){return A(c(),`rules`)}var W,G,K,un,q,J,Y,X,dn,fn,Z,Q,$,pn=t((()=>{o(),Dt(),be(),St(),$e(),xe(),Te(),De(),Ge(),Ue(),u(),Ce(),Ae(),Ee(),Me(),m(),h(),Bt(),Xe(),Ie(),Ye(),Be(),ke(),W=!1,G={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!1},K=L(),un=!1,{...K},{...G},q={config:null,mtime:0},J=null,Y=0,X=0,dn=0,Oe(async()=>{Ut()}),fn=1e3,Z=!1,Q=!1,$=a(()=>{let e=ee();return T(je(e)||nt(e))})}));export{gt as A,Dt as C,vt as D,wt as E,ct as F,lt as I,M as L,yt as M,ut as N,N as O,dt as P,st as R,Lt as S,Ct as T,$t as _,rn as a,zt as b,V as c,an as d,$ as f,on as g,en as h,nn as i,St as j,ft as k,cn as l,pn as m,Vt as n,Qt as o,ln as p,Xt as r,qt as s,K as t,sn as u,z as v,P as w,Bt as x,tn as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-mDykHLok.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as e,r as t}from"./config-BddEvZZl.js";e();export{t as enableConfigs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{DS as r,Oh as i,Zi as a,gh as o,kh as s,vh as c}from"./loadAgentsDir-C1LkW7gl.js";import{I as l,P as u,s as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{An as m,Dn as h,hn as g,mn as _}from"./settings-DKN4xSpQ.js";import{_ as v,g as y}from"./startupProfiler-DTs9w9EN.js";import{Et as b,Ot as x,Yt as S,in as C,rn as w,tn as T}from"./prompt-BGqgPgCU.js";import{n as E,t as D}from"./staticRender-BVWx0IM1.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),N(e,t),ee(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=L&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<P||r<F)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=y(t);switch(e){case w:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case b:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=P&&r>=F||a>=I&&n.resultTokens>=F&&t.push({severity:`info`,title:`File reads using ${y(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function N(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=R&&n>=z){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${h(e.path)} (${y(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${y(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function ee(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<L&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var P,F,I,L,R,z,B=e((()=>{C(),T(),x(),m(),v(),P=15,F=1e4,I=5,L=80,R=5,z=5e3}));function V({suggestions:e}){return e.length===0?null:(0,H.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,H.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,H.jsxs)(l,{children:[(0,H.jsx)(d,{status:e.severity,withSpace:!0}),(0,H.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,H.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,y(e.savingsTokens)]}):null]}),(0,H.jsx)(l,{marginLeft:2,children:(0,H.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var H,U=e((()=>{t(),f(),v(),H=p()}));function W(){return null}function G(e){let t=new Map;for(let n of e){let e=_(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Y){let r=t.get(e);r&&n.set(e,r)}return n}function K({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:g}=e,_=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==J&&!e.isDeferred),v=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===J);return(0,q.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,q.jsx)(u,{bold:!0,children:`Context Usage`}),(0,q.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,q.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,q.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,q.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===J?(0,q.jsx)(u,{color:e.color,children:`⛝ `},t):(0,q.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,q.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,q.jsxs)(u,{dimColor:!0,children:[o,` · `,y(n),`/`,y(r),` tokens (`,i,`%)`]}),(0,q.jsx)(W,{}),m!==void 0&&g!==void 0&&(0,q.jsxs)(u,{color:m<g?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<g?` (below ${g}% threshold)`:``]}),(0,q.jsx)(u,{children:` `}),(0,q.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),_.map((e,t)=>{let n=y(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===J,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:e.color,children:s}),(0,q.jsxs)(u,{children:[` `,o,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{dimColor:!0,children:`⛶`}),(0,q.jsx)(u,{children:` Free space: `}),(0,q.jsxs)(u,{dimColor:!0,children:[y(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{color:b.color,children:`⛝`}),(0,q.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,q.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`MCP tools`}),(0,q.jsxs)(u,{dimColor:!0,children:[` · /mcp`,v?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),v&&c.some(e=>!e.isLoaded)&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,q.jsx)(l,{children:(0,q.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!v&&c.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Custom agents`}),(0,q.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(G(f).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Memory files`}),(0,q.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,h(e.path),`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(l,{children:[(0,q.jsx)(u,{bold:!0,children:`Skills`}),(0,q.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(G(p.skillFrontmatter).entries()).map(([e,t])=>(0,q.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(l,{children:[(0,q.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,q.jsx)(V,{suggestions:O(e)})]})}var q,J,Y,X=e((()=>{f(),B(),m(),v(),g(),U(),q=p(),J=`Autocompact buffer`,Y=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Z(e){return r(e)}async function Q(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,c=Z(n),{messages:l}=await s(c),u=process.stdout.columns||80,d=r();return e(await E((0,$.jsx)(K,{data:await o(l,i,async()=>d.toolPermissionContext,a,d.agentDefinitions,u,t,void 0,c)}))),null}var $;e((()=>{X(),i(),c(),a(),D(),$=p()}))();export{Q as call};
|
package/dist/chunks/{context-noninteractive-BzDVMnWC.js → context-noninteractive-CJhUu_4y.js}
RENAMED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{DS as t,Oh as n,Zi as r,gh as i,kh as a,vh as o}from"./loadAgentsDir-C1LkW7gl.js";import{hn as s,mn as c}from"./settings-DKN4xSpQ.js";import{_ as l,g as u}from"./startupProfiler-DTs9w9EN.js";async function d(e){let{messages:n,getAppState:r,options:{mainLoopModel:o,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=t(n),{messages:f}=await a(d),p=r();return i(f,o,async()=>p.toolPermissionContext,s,c,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,model:a,memoryFiles:o,mcpTools:s,agents:l,skills:d}=e,f=`## Context Usage
|
|
2
2
|
|
|
3
|
-
`;f+=`**Model:** ${a} \n`,f+=`**Tokens:** ${
|
|
3
|
+
`;f+=`**Model:** ${a} \n`,f+=`**Tokens:** ${u(n)} / ${u(r)} (${i}%)\n`,f+=`
|
|
4
4
|
`;let p=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(p.length>0){f+=`### Estimated usage by category
|
|
5
5
|
|
|
6
6
|
`,f+=`| Category | Tokens | Percentage |
|
|
7
7
|
`,f+=`|----------|--------|------------|
|
|
8
|
-
`;for(let e of p){let t=(e.tokens/r*100).toFixed(1);f+=`| ${e.name} | ${
|
|
8
|
+
`;for(let e of p){let t=(e.tokens/r*100).toFixed(1);f+=`| ${e.name} | ${u(e.tokens)} | ${t}% |\n`}let e=t.find(e=>e.name===`Free space`);if(e&&e.tokens>0){let t=(e.tokens/r*100).toFixed(1);f+=`| Free space | ${u(e.tokens)} | ${t}% |\n`}let n=t.find(e=>e.name===`Autocompact buffer`);if(n&&n.tokens>0){let e=(n.tokens/r*100).toFixed(1);f+=`| Autocompact buffer | ${u(n.tokens)} | ${e}% |\n`}f+=`
|
|
9
9
|
`}if(s.length>0){f+=`### MCP Tools
|
|
10
10
|
|
|
11
11
|
`,f+=`| Tool | Server | Tokens |
|
|
12
12
|
`,f+=`|------|--------|--------|
|
|
13
|
-
`;for(let e of s)f+=`| ${e.name} | ${e.serverName} | ${
|
|
14
|
-
`}if(
|
|
13
|
+
`;for(let e of s)f+=`| ${e.name} | ${e.serverName} | ${u(e.tokens)} |\n`;f+=`
|
|
14
|
+
`}if(l.length>0){f+=`### Custom Agents
|
|
15
15
|
|
|
16
16
|
`,f+=`| Agent Type | Source | Tokens |
|
|
17
17
|
`,f+=`|------------|--------|--------|
|
|
18
|
-
`;for(let e of
|
|
18
|
+
`;for(let e of l){let t;switch(e.source){case`projectSettings`:t=`Project`;break;case`userSettings`:t=`User`;break;case`localSettings`:t=`Local`;break;case`flagSettings`:t=`Flag`;break;case`policySettings`:t=`Policy`;break;case`plugin`:t=`Plugin`;break;case`built-in`:t=`Built-in`;break;default:t=String(e.source)}f+=`| ${e.agentType} | ${t} | ${u(e.tokens)} |\n`}f+=`
|
|
19
19
|
`}if(o.length>0){f+=`### Memory Files
|
|
20
20
|
|
|
21
21
|
`,f+=`| Type | Path | Tokens |
|
|
22
22
|
`,f+=`|------|------|--------|
|
|
23
|
-
`;for(let e of o)f+=`| ${e.type} | ${e.path} | ${
|
|
23
|
+
`;for(let e of o)f+=`| ${e.type} | ${e.path} | ${u(e.tokens)} |\n`;f+=`
|
|
24
24
|
`}if(d&&d.tokens>0&&d.skillFrontmatter.length>0){f+=`### Skills
|
|
25
25
|
|
|
26
26
|
`,f+=`| Skill | Source | Tokens |
|
|
27
27
|
`,f+=`|-------|--------|--------|
|
|
28
|
-
`;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${c(e.source)} | ${
|
|
29
|
-
`}return f}var m=e((()=>{
|
|
28
|
+
`;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${c(e.source)} | ${u(e.tokens)} |\n`;f+=`
|
|
29
|
+
`}return f}var m=e((()=>{n(),o(),l(),r(),s()}));export{d as n,m as r,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./context-noninteractive-CJhUu_4y.js";t();export{n as call,e as collectContextData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./conversation-MxEVm54C.js";e();export{t as clearConversation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$f as n,Aw as r,Dn as i,Kn as a,On as o,St as s,Tn as c,Tw as l,Um as u,Wm as d,Zr as f,cT as p,cx as m,er as h,fm as g,hn as _,hs as v,lx as y,ms as b,om as x,qt as S,si as C,sm as w,sn as T,tT as E,tp as D,ui as O,um as k,vr as A,yt as j}from"./loadAgentsDir-C1LkW7gl.js";import{H as M,Jt as N,Kt as P,Z as F,_n as I,gn as L,yn as R,zt as z}from"./state-BowF111d.js";import{o as B,s as V}from"./log-DaILwWJa.js";import{n as H,r as U}from"./analytics-DJobLaWP.js";import{n as W,t as G}from"./caches-ouaWB9bY.js";import{randomUUID as K}from"crypto";async function q({setMessages:t,readFileState:o,discoveredSkillNames:s,loadedNestedMemoryPaths:u,getAppState:p,setAppState:m,setConversationId:g}){let _=T();await S(`clear`,{getAppState:p,setAppState:m,signal:AbortSignal.timeout(_),timeoutMs:_});let b=M();b&&U(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:b});let x=new Set,D=[],z=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(p)for(let e of Object.values(p().tasks))z(e)||v(e)&&(x.add(e.agentId),D.push(e));t(()=>[]);let{setContextBlocked:B}=(l(),e(r));B(!1),g&&g(K()),G(x),L(null),I(null),R(null),N(),y(F()),o.clear(),s?.clear(),u?.clear(),m&&m(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!z(r)){t[n]=r;continue}try{r.status===`running`&&(w(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){V(e)}c(n)}return{...e,tasks:t,attribution:n(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),E(),a(),P({setCurrentAsParent:!0}),await f();for(let e of D)e.status===`running`&&i(e.id,h(k(e.agentId)));let{saveMode:H}=(A(),e(O));H(`normal`);let W=j();W&&C(W);let q=await d(`clear`);q.length>0&&t(()=>q)}var J=t((()=>{z(),H(),b(),x(),g(),D(),_(),B(),p(),m(),u(),A(),o(),s(),W()}));export{J as n,q as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ar as e,Da as t,Fr as n,HS as r,PS as i,Sr as a,Um as o,Vn as s,Vp as c,Wm as l,Yp as u,ZS as d,Zi as f,as as p,ba as m,cT as h,dm as g,dr as _,fa as v,fm as y,ir as b,is as x,jr as S,la as C,ns as w,qr as T,rT as E,vr as D,xa as O,zn as k}from"./loadAgentsDir-C1LkW7gl.js";import{t as A,zt as j}from"./state-BowF111d.js";import{n as M,t as N}from"./cwd-BcO6WHKo.js";import{Bt as P,zt as F}from"./settings-DKN4xSpQ.js";import{o as I,s as L}from"./log-DaILwWJa.js";import{relative as R}from"path";M(),j(),y(),P(),w(),u(),I(),f(),h(),o(),D();function z(e){if(e.type!==`attachment`)return e;let t=e.attachment;if(t.type===`new_file`)return{...e,attachment:{...t,type:`file`,displayPath:R(N(),t.filename)}};if(t.type===`new_directory`)return{...e,attachment:{...t,type:`directory`,displayPath:R(N(),t.path)}};if(!(`displayPath`in t)){let n=`filename`in t?t.filename:`path`in t?t.path:`skillDir`in t?t.skillDir:void 0;if(n)return{...e,attachment:{...t,displayPath:R(N(),n)}}}return e}function B(e){return V(e).messages}function V(e){try{let t=e.map(z),n=new Set(F);for(let e of t)e.type===`user`&&e.permissionMode!==void 0&&!n.has(e.permissionMode)&&(e.permissionMode=void 0);let a=C(m(O(t))),o=H(a),s;if(o.kind===`interrupted_turn`){let[e]=v([r({content:`Continue from where you left off.`,isMeta:!0})]);a.push(e),s={kind:`interrupted_prompt`,message:e}}else s=o;let c=a.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`);return c!==-1&&a[c].type===`user`&&a.splice(c+1,0,i({content:d})),{messages:a,turnInterruptionState:s}}catch(e){throw L(e),e}}function H(e){if(e.length===0)return{kind:`none`};let n=e.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`&&!(e.type===`assistant`&&e.isApiErrorMessage)),r=n===-1?void 0:e[n];return!r||r.type===`assistant`?{kind:`none`}:r.type===`user`?r.isMeta||r.isCompactSummary?{kind:`none`}:t(r)?{kind:`interrupted_turn`}:{kind:`interrupted_prompt`,message:r}:r.type===`attachment`?{kind:`interrupted_turn`}:{kind:`none`}}function U(e){for(let t of e)if(t.type===`attachment`){if(t.attachment.type===`invoked_skills`){let e=t.attachment.skills;for(let t of e)t.name&&t.path&&t.content&&A(t.name,t.path,t.content,null)}t.attachment.type===`skill_listing`&&p()}p(),x()}async function W(e){let{messages:t,leafUuids:r}=await n(e),i=null,a=0;for(let e of t.values()){if(e.isSidechain||!r.has(e.uuid))continue;let t=new Date(e.timestamp).getTime();t>a&&(a=t,i=e)}return i?{messages:T(k(t,i)),sessionId:i.sessionId}:{messages:[],sessionId:void 0}}async function G(t,n){try{let r=null,i=null,o;if(t===void 0){let e=S(),t=new Set;try{let{listAllLiveSessions:e}=await import(`./udsClient-ftP0yIpe.js`),n=await e();t=new Set(n.flatMap(e=>e.kind&&e.kind!==`interactive`&&e.sessionId?[e.sessionId]:[]))}catch{}r=(await e).find(e=>{let n=_(e);return!n||!t.has(n)})??null}else if(n){let e=await W(n);i=e.messages,o=e.sessionId}else typeof t==`string`?(r=await b(t),o=t):r=t;if(!r&&!i)return null;r&&(a(r)&&(r=await e(r)),o||(o=_(r)),o&&await E(r,g(o)),c(r),i=r.messages,s(i)),U(i);let u=V(i);i=u.messages;let d=await l(`resume`,{sessionId:o});return i.push(...d),{messages:i,turnInterruptionState:u.turnInterruptionState,fileHistorySnapshots:r?.fileHistorySnapshots,attributionSnapshots:r?.attributionSnapshots,contentReplacements:r?.contentReplacements,contextCollapseCommits:r?.contextCollapseCommits,contextCollapseSnapshot:r?.contextCollapseSnapshot,sessionId:o,agentName:r?.agentName,agentColor:r?.agentColor,agentSetting:r?.agentSetting,customTitle:r?.customTitle,tag:r?.tag,mode:r?.mode,worktreeSession:r?.worktreeSession,prNumber:r?.prNumber,prUrl:r?.prUrl,prRepository:r?.prRepository,fullPath:r?.fullPath,goal:r?.goal}}catch(e){throw L(e),e}}export{G as n,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{n,s as r}from"./esm-lWlUmoUA.js";import{M as i,N as a,R as o,c as s,d as c,n as l}from"./esm-BbMeEYcz.js";import*as u from"path";import{Readable as d}from"stream";import*as f from"fs";import*as p from"zlib";e();var m=class{constructor(e){t(this,`_delegate`,void 0),this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}};e();var h=class extends Error{constructor(e,n,r){super(e),t(this,`code`,void 0),t(this,`name`,`OTLPExporterError`),t(this,`data`,void 0),this.data=r,this.code=n}};function g(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function _(e){if(e!=null)return async()=>e}function v(e,t,n){return{timeoutMillis:g(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function y(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}e();var b=class{constructor(e){t(this,`_concurrencyLimit`,void 0),t(this,`_sendingPromises`,[]),this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}};function ee(e){return new b(e.concurrencyLimit)}l(),n();function te(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function ne(){return{handleResponse(e){e==null||!te(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||r.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}n(),e();var re=class{constructor(e,n,i,a,o){t(this,`_diagLogger`,void 0),t(this,`_transport`,void 0),t(this,`_serializer`,void 0),t(this,`_responseHandler`,void 0),t(this,`_promiseQueue`,void 0),t(this,`_timeout`,void 0),this._transport=e,this._serializer=n,this._responseHandler=i,this._promiseQueue=a,this._timeout=o,this._diagLogger=r.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:s.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:s.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:s.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:s.FAILED,error:e.error});return}else e.status===`retryable`?t({code:s.FAILED,error:e.error??new h(`Export failed with retryable status`)}):t({code:s.FAILED,error:new h(`Export failed with unknown error`)})},e=>t({code:s.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}};function ie(e,t){return new re(e.transport,e.serializer,ne(),e.promiseHandler,t.timeout)}function ae(e,t){let n={attributes:S(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function x(e){return{name:e.name,version:e.version}}function S(e,t){return Object.keys(e).map(n=>C(n,e[n],t))}function C(e,t,n){return{key:e,value:w(t,n)}}function w(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=w(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:w(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}l();function T(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function E(e){return T(e).toString()}var D=typeof BigInt<`u`?E:c;function O(e){return e}var k={encodeHrTime:D,encodeSpanContext:O,encodeOptionalSpanContext:O,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}};n();function A(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{n===void 0?r.warn(`Header "${e}" has invalid value (${n}) and will be ignored`):t[e]=String(n)}),t}function j(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,A(await e())),Object.assign(i,r)}}function M(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function N(e,t,n){return{...v(e,t,n),headers:j(e.headers,t.headers,n.headers),url:M(e.url)??t.url??n.url}}function P(e,t){return{...y(),headers:async()=>e,url:`http://localhost:4318/`+t}}function F(e){return async t=>{let n=t===`http:`,{Agent:r}=await(n?import(`http`):import(`https`));if(n){let{ca:t,cert:n,key:i,...a}=e;return new r(a)}return new r(e)}}function I(e,t,n){return{...N(e,t,n),agentFactory:e.agentFactory??t.agentFactory??n.agentFactory,userAgent:e.userAgent}}function L(e,t){return{...P(e,t),agentFactory:F({keepAlive:!0})}}function R(e){return e===429||e===502||e===503||e===504}function z(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var B=`OTel-OTLP-Exporter-JavaScript/0.215.0`,V=4*1024*1024;function H(e,t,n,r,i,a,o,s){return new Promise(c=>{let l=new URL(t);i?n[`User-Agent`]=`${i} ${B}`:n[`User-Agent`]=B;let u=e({hostname:l.hostname,port:l.port,path:l.pathname,method:`POST`,headers:n,agent:a},e=>{let t=[],n=0;e.on(`data`,r=>{if(n+=r.length,n>4194304){c({status:`failure`,error:Error(`OTLP export response body exceeded size limit of ${V} bytes`)}),e.destroy();return}t.push(r)}),e.on(`end`,()=>{e.statusCode&&e.statusCode<=299?c({status:`success`,data:Buffer.concat(t)}):e.statusCode&&R(e.statusCode)?c({status:`retryable`,retryInMillis:z(e.headers[`retry-after`])}):c({status:`failure`,error:new h(e.statusMessage,e.statusCode,Buffer.concat(t).toString())})}),e.on(`error`,t=>{e.statusCode&&e.statusCode<=299?c({status:`success`}):e.statusCode&&R(e.statusCode)?c({status:`retryable`,error:t,retryInMillis:z(e.headers[`retry-after`])}):c({status:`failure`,error:t})})});u.setTimeout(s,()=>{u.destroy(),c({status:`retryable`,error:Error(`Request timed out`)})}),u.on(`error`,e=>{oe(e)?c({status:`retryable`,error:e}):c({status:`failure`,error:e})}),U(u,r,o,e=>{c({status:`failure`,error:e})})})}function U(e,t,n,r){let i=W(n);t===`gzip`&&(e.setHeader(`Content-Encoding`,`gzip`),i=i.on(`error`,r).pipe(p.createGzip()).on(`error`,r)),i.pipe(e).on(`error`,r)}function W(e){let t=new d;return t.push(e),t.push(null),t}function oe(e){let t=new Set([`ECONNRESET`,`ECONNREFUSED`,`EPIPE`,`ETIMEDOUT`,`EAI_AGAIN`,`ENOTFOUND`,`ENETUNREACH`,`EHOSTUNREACH`]);return`code`in e&&typeof e.code==`string`&&t.has(e.code)}e();var G=class{constructor(e){t(this,`_utils`,null),t(this,`_parameters`,void 0),this._parameters=e}async send(e,t){let{agent:n,request:r}=await this._loadUtils(),i=await this._parameters.headers();return H(r,this._parameters.url,i,this._parameters.compression,this._parameters.userAgent,n,e,t)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let t=new URL(this._parameters.url).protocol,[n,r]=await Promise.all([this._parameters.agentFactory(t),K(t)]);e=this._utils={agent:n,request:r}}return e}};async function K(e){let{request:t}=await(e===`http:`?import(`http`):import(`https`));return t}function q(e){return new G(e)}n(),e();var J=5,se=1e3,ce=5e3,le=1.5,Y=.2;function ue(){return 2*Y*Math.random()-Y}var de=class{constructor(e){t(this,`_transport`,void 0),this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=J,i=se,a=Date.now()+t,o=await this._transport.send(e,t);for(;o.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(i*(1+ue()),ce),0);i*=le;let s=o.retryInMillis??t,c=a-Date.now();if(s>c)return r.info(`Export retry time ${Math.round(s)}ms exceeds remaining timeout ${Math.round(c)}ms, not retrying further.`),o;r.verbose(`Scheduling export retry in ${Math.round(s)}ms`),o=await this.retry(e,c,s)}return o.status===`success`?r.verbose(`Export succeeded after ${J-n} retry attempts.`):o.status===`retryable`?r.info(`Export failed after maximum retry attempts (${J}).`):r.info(`Export failed with non-retryable error: ${o.error}`),o}shutdown(){return this._transport.shutdown()}};function fe(e){return new de(e.transport)}function pe(e,t){return ie({transport:fe({transport:q(e)}),serializer:t,promiseHandler:ee(e)},{timeout:e.timeoutMillis})}l(),n();function X(e){let t=i(e);if(t!=null){if(Number.isFinite(t)&&t>0)return t;r.warn(`Configuration: ${e} is invalid, expected number greater than 0 (actual: ${t})`)}}function me(e){let t=X(`OTEL_EXPORTER_OTLP_${e}_TIMEOUT`),n=X(`OTEL_EXPORTER_OTLP_TIMEOUT`);return t??n}function Z(e){let t=a(e)?.trim();if(t==null||t===`none`||t===`gzip`)return t;r.warn(`Configuration: ${e} is invalid, expected 'none' or 'gzip' (actual: '${t}')`)}function he(e){let t=Z(`OTEL_EXPORTER_OTLP_${e}_COMPRESSION`),n=Z(`OTEL_EXPORTER_OTLP_COMPRESSION`);return t??n}function ge(e){return{timeoutMillis:me(e),compression:he(e)}}l(),n();function _e(e){let t=a(`OTEL_EXPORTER_OTLP_${e}_HEADERS`),n=a(`OTEL_EXPORTER_OTLP_HEADERS`),r=o(t),i=o(n);if(!(Object.keys(r).length===0&&Object.keys(i).length===0))return Object.assign({},o(n),o(t))}function ve(e){try{return new URL(e).toString()}catch{r.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}}function ye(e,t){try{new URL(e)}catch{r.warn(`Configuration: Could not parse environment-provided export URL: '${e}', falling back to undefined`);return}e.endsWith(`/`)||(e+=`/`),e+=t;try{new URL(e)}catch{r.warn(`Configuration: Provided URL appended with '${t}' is not a valid URL, using 'undefined' instead of '${e}'`);return}return e}function be(e){let t=a(`OTEL_EXPORTER_OTLP_ENDPOINT`);if(t!==void 0)return ye(t,e)}function xe(e){let t=a(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`);if(t!==void 0)return ve(t)}function Q(e,t,n){let i=a(e),o=a(t),s=i??o;if(s!=null)try{return f.readFileSync(u.resolve(process.cwd(),s))}catch{r.warn(n);return}else return}function Se(e){return Q(`OTEL_EXPORTER_OTLP_${e}_CLIENT_CERTIFICATE`,`OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE`,`Failed to read client certificate chain file`)}function Ce(e){return Q(`OTEL_EXPORTER_OTLP_${e}_CLIENT_KEY`,`OTEL_EXPORTER_OTLP_CLIENT_KEY`,`Failed to read client certificate private key file`)}function $(e){return Q(`OTEL_EXPORTER_OTLP_${e}_CERTIFICATE`,`OTEL_EXPORTER_OTLP_CERTIFICATE`,`Failed to read root certificate file`)}function we(e,t){return{...ge(e),url:xe(e)??be(t),headers:_(_e(e)),agentFactory:F({keepAlive:!0,ca:$(e),cert:Se(e),key:Ce(e)})}}function Te(e){return typeof e.headers==`function`?e.headers:_(e.headers)}n();function Ee(e){if(typeof e.httpAgentOptions==`function`)return e.httpAgentOptions;let t=e.httpAgentOptions;if(e.keepAlive!=null&&(t={keepAlive:e.keepAlive,...t}),t!=null)return F(t)}function De(e,t,n,i){return e.metadata&&r.warn(`Metadata cannot be set when using http`),I({url:e.url,headers:Te(e),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentFactory:Ee(e),userAgent:e.userAgent},we(t,n),L(i,n))}export{ae as a,C as c,x as i,m as l,pe as n,w as o,k as r,S as s,De as t};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ar as n,Cc as r,Si as i,Sr as a,Ub as o,Yb as s,ad as c,br as l,cC as u,dr as d,fx as f,id as p,ni as ee,px as m,rr as te,sC as h,vr as g,xc as ne,xi as _}from"./loadAgentsDir-C1LkW7gl.js";import{C as re,D as v,Gr as y,H as ie,I as b,P as x,T as S,Wt as C,Xn as ae,ai as w,di as oe,fi as T,hn as se,k as ce,oi as le,ot as ue,p as E,t as de}from"./src-DL3w8VPk.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{Z as fe,ut as pe,zt as me}from"./state-BowF111d.js";import{S as O,c as k,i as A,x as he}from"./debug-8DCufdSp.js";import{Fr as ge,Jn as _e,Ur as ve,qn as j}from"./settings-DKN4xSpQ.js";import{a as M,o as ye,s as be}from"./log-DaILwWJa.js";import{n as xe,r as N}from"./analytics-DJobLaWP.js";import{S as Se,_ as Ce,d as we,p as Te}from"./startupProfiler-DTs9w9EN.js";import{f as Ee,u as De}from"./model-BwBE0Pt5.js";import{n as P,t as Oe}from"./TextInput-7uqPhq9T.js";import{n as ke,t as F}from"./useExitOnCtrlCDWithKeybindings-CjW3gUOt.js";import{n as Ae,t as je}from"./select-C_KXmqbI.js";import{r as Me,t as Ne}from"./Spinner-DwsJJUtn.js";import{l as Pe,u as Fe}from"./SpinnerGlyph-A6G-gloN.js";import{t as Ie}from"./SearchBox-C9xxQzh1.js";import{n as Le,t as Re}from"./useSearchInput-C2JuUW3g.js";import{n as I,t as L}from"./Messages-DuL_r1Or.js";function ze({log:e,onExit:t,onSelect:r}){let[i,o]=R.useState(null);R.useEffect(()=>{o(null),a(e)&&n(e).then(o)},[e]);let s=a(e)&&i===null,c=i??e,l=d(c)||``,u=ne();return C(`confirm:no`,t,{context:`Confirmation`}),C(`confirm:yes`,(0,R.useCallback)(()=>{r(i??e)},[r,i,e]),{context:`Confirmation`}),s?(0,z.jsxs)(b,{flexDirection:`column`,padding:1,children:[(0,z.jsx)(E,{message:`Loading session…`}),(0,z.jsx)(x,{dimColor:!0,children:(0,z.jsx)(S,{children:(0,z.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,z.jsxs)(b,{flexDirection:`column`,children:[(0,z.jsx)(L,{messages:c.messages,tools:u,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:l,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,z.jsxs)(b,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,z.jsxs)(x,{children:[Te(c.modified),` · `,c.messageCount,` messages`,c.gitBranch?` · ${c.gitBranch}`:``]}),(0,z.jsx)(x,{dimColor:!0,children:(0,z.jsxs)(S,{children:[(0,z.jsx)(v,{shortcut:`Enter`,action:`resume`}),(0,z.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var R,z,Be=e((()=>{R=t(w(),1),de(),o(),r(),Ce(),g(),c(),I(),z=D()}));function B(e,t){if(e===H)return 5;let n=y(e),r=t?Math.min(n,t-U-W):n;return Math.max(0,r)+U+W}function Ve(e,t){let n=t-U-W;return y(e)<=n?e:n<=1?e.charAt(0):Se(e,n)}function He({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(qe,K),s=n-a-o-2,c=Math.max(0,Math.min(t,e.length-1)),l=Math.max(20,Math.floor(s/2)),u=e.map(e=>B(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-Ke,n=u[c]??0;for(d=c,f=c+1;d>0||f<e.length;){let r=d>0,i=f<e.length;if(r){let e=(u[d-1]??0)+1;if(n+e<=t){d--,n+=e;continue}}if(i){let e=(u[f]??0)+1;if(n+e<=t){f++,n+=e;continue}}break}}let p=d,ee=e.length-f,m=e.slice(d,f),te=m.map((e,t)=>d+t);return(0,V.jsxs)(b,{flexDirection:`row`,gap:1,children:[(0,V.jsx)(x,{color:`suggestion`,children:i}),p>0&&(0,V.jsxs)(x,{dimColor:!0,children:[G,p]}),m.map((e,t)=>{let n=te[t]===c,r=e===H?e:`#${Ve(e,l-U)}`;return(0,V.jsxs)(x,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),ee>0?(0,V.jsxs)(x,{dimColor:!0,children:[Ue,ee,We]}):(0,V.jsx)(x,{dimColor:!0,children:Ge})]})}var V,H,U,W,G,Ue,We,Ge,Ke,qe,K,Je=e((()=>{de(),Ce(),V=D(),H=`All`,U=2,W=1,G=`← `,Ue=`→`,We=` (tab to cycle)`,Ge=`(tab to cycle)`,Ke=5,qe=18,K=14}));function Ye({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:o=`expanded`,isDisabled:s=!1,hideIndexes:c=!1,isNodeExpanded:l,onExpand:u,onCollapse:d,getParentPrefix:f,getChildPrefix:p,onUpFromFirstItem:ee}){let[m,te]=q.useState(new Set),h=q.useRef(!1),g=q.useRef(null),ne=q.useCallback(e=>l?l(e):m.has(e),[l,m]),_=q.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=ne(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,ne]),re=q.useCallback(e=>e?`▼ `:`▶ `,[]),v=q.useCallback(e=>` ▸ `,[]),y=f??re,ie=p??v,x=q.useCallback(e=>{let t=``;return e.hasChildren?t=y(e.isExpanded):e.depth>0&&(t=ie(e.depth)),t+e.node.label},[y,ie]),S=q.useMemo(()=>_.map(e=>({label:x(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[_,x]),C=q.useMemo(()=>{let e=new Map;return _.forEach(t=>e.set(t.node.id,t.node)),e},[_]),ae=q.useCallback(e=>_.find(t=>t.node.id===e),[_]),w=q.useCallback((e,t)=>{ae(e)?.hasChildren&&(t?u?u(e):te(t=>new Set(t).add(e)):d?d(e):te(t=>{let n=new Set(t);return n.delete(e),n}))},[ae,u,d]);return(0,Xe.jsx)(b,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=ae(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),w(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),w(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,w(t.parentId,!1),r)){let e=C.get(t.parentId);e&&r(e)}}}},children:(0,Xe.jsx)(je,{options:S,onChange:q.useCallback(e=>{let n=C.get(e);n&&t(n)},[C,t]),onFocus:q.useCallback(e=>{if(h.current){h.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=C.get(e);t&&r(t)}},[r,C]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:ee})})}var q,Xe,Ze=e((()=>{q=t(w(),1),de(),Ae(),Xe=D()}));function Qe(e,t){return Se(e.replace(/\s+/g,` `).trim(),t)}function $e({before:e,match:t,after:n},r){return oe.dim(e)+r(t)+oe.dim(n)}function et(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function tt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?ct:i?lt:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${Qe(M(e),l)}${c}${s}`}function nt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=we(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function rt({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:r,onSelect:i,onLogsChanged:a,onLoadMore:o,initialSearchQuery:s,showAllProjects:c=!1,onToggleAllProjects:u,onAgenticSearch:f}){let m=ue(),h=n===void 0?m.columns:n,g=ke(r),ne=ae(),y=l(),[w]=ie(),oe=Pe(w),T=J.useMemo(()=>e=>le(e,oe.warning),[oe.warning]),[E,de]=J.useState(null),[D,me]=J.useState(!1),[O,k]=J.useState(!1),[A,he]=J.useState(!1),_e=J.useMemo(()=>fe(),[]),[ve,j]=J.useState(``),[ye,be]=J.useState(0),[xe,Se]=J.useState(new Set),[Ce,Te]=J.useState(null),[Ee,De]=J.useState(1),[P,F]=J.useState(`list`),[Ae,Me]=J.useState(null),Fe=J.useRef(null),[Ie,Re]=J.useState(0),[I,L]=J.useState({status:`idle`}),[R,z]=J.useState(!1),Be=J.useRef(null),{query:B,setQuery:Ve,cursorOffset:V}=Le({isActive:P===`search`&&I.status!==`searching`,onExit:()=>{F(`list`),N(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{F(`list`),N(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:s||``}),H=J.useDeferredValue(B),[U,W]=J.useState(``);J.useEffect(()=>{if(!H){W(``);return}let e=setTimeout(W,300,H);return()=>clearTimeout(e)},[H]);let[G,Ue]=J.useState(null),[We,Ge]=J.useState(!1);J.useEffect(()=>{ge().then(e=>de(e)),_(_e).then(e=>{he(e.length>1)})},[_e]);let Ke=J.useMemo(()=>new Map(e.map(e=>[e,at(e)])),[e]),qe=J.useMemo(()=>null,[e,Ke,!1]),K=J.useMemo(()=>st(e),[e]),Je=K.length>0,q=J.useMemo(()=>Je?[`All`,...K]:[],[Je,K]),Xe=q.length>0&&Ie<q.length?Ie:0,Ze=q[Xe],rt=Ze===`All`?void 0:Ze,it=+!!Je,ct=J.useMemo(()=>{let t=e;return y&&(t=e.filter(e=>{let t=pe(),n=d(e);return!!(t&&n===t||e.customTitle||te(e.messages)||e.firstPrompt||e.customTitle)})),rt!==void 0&&(t=t.filter(e=>e.tag===rt)),D&&E&&(t=t.filter(e=>e.gitBranch===E)),A&&!O&&(t=t.filter(e=>e.projectPath===_e)),t},[e,y,rt,D,E,A,O,_e]),lt=J.useMemo(()=>{if(!B)return ct;let e=B.toLowerCase();return ct.filter(t=>{let n=M(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[ct,B]);J.useEffect(()=>{},[H,U,!1]),J.useEffect(()=>{Ue(null),Ge(!1)},[U,qe,!1]);let{filteredLogs:ut,snippets:X}=J.useMemo(()=>{let e=new Map,t=lt;if(G&&U&&G.query===U){for(let t of G.results)if(t.searchableText){let n=et(t.searchableText,U,dt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=G.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[lt,G,U]),Z=J.useMemo(()=>I.status===`results`&&I.results.length>0?I.results:ut,[I,ut]),Q=Math.max(30,h-4),ft=J.useMemo(()=>{if(!y)return[];let e=ot(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?$e(i,T):null;if(t.length===1){let t=nt(n,{showProjectPath:c});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:tt(n,Q),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=Z.indexOf(t),i=X.get(t),a=i?$e(i,T):null,o=nt(t,{isChild:!0,showProjectPath:c});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:tt(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),l=nt(n,{showProjectPath:c});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:tt(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${l}\n ${a}`:l,dimDescription:!0,children:s}})},[y,Z,Q,c,X,T]),pt=J.useMemo(()=>y?[]:Z.map((e,t)=>{let n=Qe(M(e)+(e.isSidechain?` (sidechain)`:``),Q),r=we(e),i=c&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?$e(a,T):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[y,Z,T,Q,c,X]),$=Ce?.value.log??null,mt=()=>{if(!y||!$)return``;let e=d($);if(!e)return``;let t=Z.filter(t=>d(t)===e);if(!(t.length>1))return``;let n=xe.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},ht=J.useCallback(async()=>{let e=$?d($):void 0;if(!$||!e){F(`list`),j(``);return}ve.trim()&&(await ee(e,ve.trim(),$.fullPath),y&&a&&a()),F(`list`),j(``)},[$,ve,a,y]),gt=J.useCallback(()=>{F(`list`),N(`tengu_session_search_toggled`,{enabled:!1})},[]),_t=J.useCallback(()=>{F(`search`),N(`tengu_session_search_toggled`,{enabled:!0})},[]),vt=J.useCallback(async()=>{if(!B.trim()||!f||!0)return;Be.current?.abort();let t=new AbortController;Be.current=t,L({status:`searching`}),N(`tengu_agentic_search_started`,{query_length:B.length});try{let n=await f(B,e,t.signal);if(t.signal.aborted)return;L({status:`results`,results:n,query:B}),N(`tengu_agentic_search_completed`,{query_length:B.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;L({status:`error`,message:e instanceof Error?e.message:`Search failed`}),N(`tengu_agentic_search_error`,{query_length:B.length})}},[B,f,!1,e]);J.useEffect(()=>{I.status!==`idle`&&I.status!==`searching`&&(I.status===`results`&&I.query!==B||I.status===`error`)&&L({status:`idle`})},[B,I]),J.useEffect(()=>()=>{Be.current?.abort()},[]);let yt=J.useRef(I.status);J.useEffect(()=>{let e=yt.current;if(yt.current=I.status,e===`searching`&&I.status===`results`){if(y&&ft.length>0)Te(ft[0]);else if(!y&&Z.length>0){let e=Z[0];Te({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[I.status,y,ft,Z]);let bt=J.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Fe.current===t.toString()||(Fe.current=t.toString(),Te({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),De(t+1))},[Z]),xt=J.useCallback(e=>{Te(e);let t=Z.findIndex(t=>d(t)===d(e.value.log));t>=0&&De(t+1)},[Z]);C(`confirm:no`,()=>{Be.current?.abort(),L({status:`idle`}),N(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:P!==`preview`&&I.status===`searching`}),C(`confirm:no`,()=>{F(`list`),j(``)},{context:`Settings`,isActive:P===`rename`&&I.status!==`searching`}),C(`confirm:no`,()=>{Ve(``),z(!1),r?.()},{context:`Confirmation`,isActive:P!==`preview`&&P!==`rename`&&P!==`search`&&R&&I.status!==`searching`}),se((e,t)=>{if(P!==`preview`&&I.status!==`searching`&&P!==`rename`)if(P===`search`)e.toLowerCase()===`n`&&t.ctrl?gt():(t.return||t.downArrow)&&B.trim();else{if(R){if(t.return){vt(),z(!1);return}else if(t.downArrow){z(!1);return}else if(t.upArrow){F(`search`),z(!1);return}}if(Je&&t.tab){let e=t.shift?-1:1;Re(t=>{let n=((t<q.length?t:0)+q.length+e)%q.length,r=q[n];return N(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:K.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&u)u(),N(`tengu_session_all_projects_toggled`,{enabled:!c});else if(r===`b`&&t.ctrl){let e=!D;me(e),N(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&A){let e=!O;k(e),N(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(F(`search`),N(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&$?(F(`rename`),j(``),N(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&$?(Me($),F(`preview`),N(`tengu_session_preview_opened`,{messageCount:$.messageCount})):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(F(`search`),Ve(e),N(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let St=[];D&&E&&St.push(E),A&&!O&&St.push(`current worktree`);let Ct=8+ +(St.length>0&&P!==`search`)+it,wt=Math.max(1,Math.floor((t-Ct-2)/3));return J.useEffect(()=>{if(!o)return;let e=wt*2;Ee+e>=Z.length&&o(wt*3)},[Ee,wt,Z.length,o]),e.length===0?null:P===`preview`&&Ae&&y?(0,Y.jsx)(ze,{log:Ae,onExit:()=>{F(`list`),Me(null)},onSelect:i}):(0,Y.jsxs)(b,{flexDirection:`column`,height:t-1,children:[(0,Y.jsx)(b,{flexShrink:0,children:(0,Y.jsx)(re,{color:`suggestion`})}),(0,Y.jsx)(b,{flexShrink:0,children:(0,Y.jsx)(x,{children:` `})}),Je?(0,Y.jsx)(He,{tabs:q,selectedIndex:Xe,availableWidth:h,showAllProjects:c}):(0,Y.jsx)(b,{flexShrink:0,children:(0,Y.jsxs)(x,{bold:!0,color:`suggestion`,children:[`Resume Session`,P===`list`&&Z.length>wt&&(0,Y.jsxs)(x,{dimColor:!0,children:[` `,`(`,Ee,` of `,Z.length,`)`]})]})}),(0,Y.jsx)(ce,{query:B,isFocused:P===`search`,isTerminalFocused:ne,cursorOffset:V}),St.length>0&&P!==`search`&&(0,Y.jsx)(b,{flexShrink:0,paddingLeft:2,children:(0,Y.jsx)(x,{dimColor:!0,children:(0,Y.jsx)(S,{children:St})})}),(0,Y.jsx)(b,{flexShrink:0,children:(0,Y.jsx)(x,{children:` `})}),I.status===`searching`&&(0,Y.jsxs)(b,{paddingLeft:1,flexShrink:0,children:[(0,Y.jsx)(Ne,{}),(0,Y.jsx)(x,{children:` Searching…`})]}),I.status===`results`&&I.results.length>0&&(0,Y.jsx)(b,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(x,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),I.status===`results`&&I.results.length===0&&ut.length===0&&(0,Y.jsx)(b,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(x,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),I.status===`error`&&ut.length===0&&(0,Y.jsx)(b,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(x,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!B.trim()&&f&&!1,I.status===`searching`?null:P===`rename`&&$?(0,Y.jsxs)(b,{paddingLeft:2,flexDirection:`column`,children:[(0,Y.jsx)(x,{bold:!0,children:`Rename session:`}),(0,Y.jsx)(b,{paddingTop:1,children:(0,Y.jsx)(Oe,{value:ve,onChange:j,onSubmit:ht,placeholder:M($,`Enter new session name`),columns:h,cursorOffset:ye,onChangeCursorOffset:be,showCursor:!0})})]}):y?(0,Y.jsx)(Ye,{nodes:ft,onSelect:e=>{i(e.value.log)},onFocus:xt,onCancel:r,focusNodeId:Ce?.id,visibleOptionCount:wt,layout:`expanded`,isDisabled:P===`search`||R,hideIndexes:!1,isNodeExpanded:e=>{if(P===`search`||D)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?xe.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(Se(e=>new Set(e).add(t)),N(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Se(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:_t}):(0,Y.jsx)(je,{options:pt,onChange:e=>{let t=Z[parseInt(e,10)];t&&i(t)},visibleOptionCount:wt,onCancel:r,onFocus:bt,defaultFocusValue:Ce?.id.toString(),layout:`expanded`,isDisabled:P===`search`||R,onUpFromFirstItem:_t}),(0,Y.jsx)(b,{paddingLeft:2,children:g.pending?(0,Y.jsxs)(x,{dimColor:!0,children:[`Press `,g.keyName,` again to exit`]}):P===`rename`?(0,Y.jsx)(x,{dimColor:!0,children:(0,Y.jsxs)(S,{children:[(0,Y.jsx)(v,{shortcut:`Enter`,action:`save`}),(0,Y.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I.status===`searching`?(0,Y.jsx)(x,{dimColor:!0,children:(0,Y.jsxs)(S,{children:[(0,Y.jsx)(x,{children:`Searching with Work Mate…`}),(0,Y.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):R?(0,Y.jsx)(x,{dimColor:!0,children:(0,Y.jsxs)(S,{children:[(0,Y.jsx)(v,{shortcut:`Enter`,action:`search`}),(0,Y.jsx)(v,{shortcut:`↓`,action:`skip`}),(0,Y.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P===`search`?(0,Y.jsx)(x,{dimColor:!0,children:(0,Y.jsxs)(S,{children:[(0,Y.jsx)(x,{children:`Type to Search`}),(0,Y.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,Y.jsx)(x,{dimColor:!0,children:(0,Y.jsxs)(S,{children:[u&&(0,Y.jsx)(v,{shortcut:`Ctrl+A`,action:`show ${c?`current dir`:`all projects`}`}),E&&(0,Y.jsx)(v,{shortcut:`Ctrl+B`,action:`toggle branch`}),A&&(0,Y.jsx)(v,{shortcut:`Ctrl+W`,action:`show ${O?`current worktree`:`all worktrees`}`}),(0,Y.jsx)(v,{shortcut:`Ctrl+V`,action:`preview`}),(0,Y.jsx)(v,{shortcut:`Ctrl+R`,action:`rename`}),(0,Y.jsx)(x,{children:`Type to search`}),(0,Y.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),mt()&&(0,Y.jsx)(x,{children:mt()})]})})})]})}function it(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function at(e){let t=(e.messages.length<=ut?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(it).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>Z?n.slice(0,Z):n}function ot(e){let t=new Map;for(let n of e){let e=d(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function st(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var J,Y,ct,lt,ut,X,Z,dt,Q=e((()=>{T(),J=t(w(),1),me(),F(),Re(),s(),de(),o(),xe(),Ce(),i(),ve(),ye(),g(),Fe(),c(),Ae(),Ie(),Be(),Me(),Je(),P(),Ze(),Y=D(),ct=2,lt=4,ut=2e3,X=1e3,Z=5e4,dt=50}));function ft(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function pt(e){if(e.length===0)return``;let t=(e.length<=gt?e:[...e.slice(0,gt/2),...e.slice(-100/2)]).map(ft).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>ht?`${t.slice(0,ht)}…`:t}function $(e,t){return!!(M(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&pt(e.messages).toLowerCase().includes(t))}async function mt(e,t,r){if(!e.trim()||t.length===0)return[];let i=e.toLowerCase(),o=t.filter(e=>$(e,i)),s;if(o.length>=_t)s=o.slice(0,_t);else{let e=t.filter(e=>!$(e,i)),n=_t-o.length;s=[...o,...e.slice(0,n)]}k(`Agentic search: ${s.length}/${t.length} logs, query="${e}", matching: ${o.length}, with messages: ${j(s,e=>e.messages?.length>0)}`);let c=s.map(async e=>{if(a(e))try{return await n(e)}catch(t){return be(t),e}return e}),l=await Promise.all(c);k(`Agentic search: loaded ${j(l,e=>e.messages?.length>0)}/${s.length} logs with transcripts`);let d=`Sessions:
|
|
2
|
+
${l.map((e,t)=>{let n=[`${t}:`],r=M(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=pt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
|
|
3
|
+
`)}
|
|
4
|
+
|
|
5
|
+
Search query: "${e}"
|
|
6
|
+
|
|
7
|
+
Find the sessions that are most relevant to this query.`;k(`Agentic search prompt (first 500 chars): ${d.slice(0,500)}...`);try{let e=De();k(`Agentic search using model: ${e}`);let t=(await u({model:e,system:vt,messages:[{role:`user`,content:d}],signal:r,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return k(`No text content in agentic search response`),[];k(`Agentic search response: ${t.text}`);let n=t.text.match(/\{[\s\S]*\}/);if(!n)return k(`Could not find JSON in agentic search response`),[];let i=(O(n[0]).relevant_indices||[]).filter(e=>e>=0&&e<l.length).map(e=>l[e]);return k(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return be(e),k(`Agentic search error: ${e}`),[]}}var ht,gt,_t,vt,yt=e((()=>{_e(),A(),ye(),Ee(),g(),h(),he(),ht=2e3,gt=100,_t=100,vt=`Your goal is to find relevant sessions based on a user's search query.
|
|
8
|
+
|
|
9
|
+
You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
|
|
10
|
+
|
|
11
|
+
Each session may include:
|
|
12
|
+
- Title (display name or custom title)
|
|
13
|
+
- Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
|
|
14
|
+
- Branch (git branch name, shown as [branch: name])
|
|
15
|
+
- Summary (AI-generated summary)
|
|
16
|
+
- First message (beginning of the conversation)
|
|
17
|
+
- Transcript (excerpt of conversation content)
|
|
18
|
+
|
|
19
|
+
IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
|
|
20
|
+
|
|
21
|
+
For each session, consider (in order of priority):
|
|
22
|
+
1. Exact tag matches (highest priority - user explicitly categorized this session)
|
|
23
|
+
2. Partial tag matches or tag-related terms
|
|
24
|
+
3. Title matches (custom titles or first message content)
|
|
25
|
+
4. Branch name matches
|
|
26
|
+
5. Summary and transcript content matches
|
|
27
|
+
6. Semantic similarity and related concepts
|
|
28
|
+
|
|
29
|
+
CRITICAL: Be VERY inclusive in your matching. Include sessions that:
|
|
30
|
+
- Contain the query term anywhere in any field
|
|
31
|
+
- Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
|
|
32
|
+
- Discuss topics that could be related to the query
|
|
33
|
+
- Have transcripts that mention the concept even in passing
|
|
34
|
+
|
|
35
|
+
When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
|
|
36
|
+
|
|
37
|
+
Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
|
|
38
|
+
|
|
39
|
+
Respond with ONLY the JSON object, no markdown formatting:
|
|
40
|
+
{"relevant_indices": [2, 5, 0]}`}));function bt(e,t){let n=fe();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=d(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${m([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var xt=e((()=>{me(),f(),g()}));export{rt as a,yt as i,xt as n,Q as o,mt as r,bt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{D as t,Z as n,zt as r}from"./state-BowF111d.js";import{AsyncLocalStorage as i}from"async_hooks";function a(e,t){return c.run(e,t)}function o(){return c.getStore()??t()}function s(){try{return o()}catch{return n()}}var c,l=e((()=>{r(),c=new i}));export{a as i,l as n,o as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./cwd-BcO6WHKo.js";e();export{t as getCwd};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{Z as r,et as i}from"./esm-BQY8jJNR.js";import{n as a,t as o}from"./axios-DaWTGg7G.js";import{d as s,m as c}from"./config-BddEvZZl.js";import{o as l,s as u}from"./log-DaILwWJa.js";import{Er as d,N as f,O as p,f as m,t as h,wr as g}from"./model-BwBE0Pt5.js";import{f as _,p as v}from"./firstPartyEventLogger-C0q45h_4.js";import{createHash as y}from"crypto";function b(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}async function x(){if(N.length===0)return;let e=N;N=[];try{await a.post(E,e,{headers:{"Content-Type":`application/json`,"DD-API-KEY":D},timeout:A})}catch(e){u(e)}}function S(){P||(P=setTimeout(()=>{P=null,x()},T()).unref())}async function C(){P&&(clearTimeout(P),P=null),await x()}async function w(e,t){if(g()!==`firstParty`)return;let n=F;if(n===null&&(n=await I()),!(!n||!j.has(e)))try{let{envContext:n,...i}=await r({model:t.model,betas:t.betas}),a={...i,...n,...t,userBucket:R()};if(typeof a.toolName==`string`&&a.toolName.startsWith(`mcp__`)&&(a.toolName=`mcp`),typeof a.model==`string`){let e=h(a.model.replace(/\[1m]$/i,``));a.model=e in p?e:`other`}if(typeof a.version==`string`&&(a.version=a.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,`$1`)),a.status!==void 0&&a.status!==null){let e=String(a.status);a.http_status=e;let t=e.charAt(0);t>=`1`&&t<=`5`&&(a.http_status_range=`${t}xx`),delete a.status}let o=a,s={ddsource:`nodejs`,ddtags:[`event:${e}`,...M.filter(e=>o[e]!==void 0&&o[e]!==null).map(e=>`${b(e)}:${o[e]}`)].join(`,`),message:e,service:`workmate`,hostname:`workmate`,env:process.env.USER_TYPE};for(let[e,t]of Object.entries(a))t!=null&&(s[b(e)]=t);N.push(s),N.length>=k?(P&&(clearTimeout(P),P=null),x()):S()}catch(e){u(e)}}function T(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||``,10)||O}var E,D,O,k,A,j,M,N,P,F,I,L,R,z=e((()=>{o(),n(),c(),l(),m(),d(),f(),_(),i(),E=process.env.DATADOG_LOGS_ENDPOINT??``,D=process.env.DATADOG_API_KEY??``,O=15e3,k=100,A=5e3,j=new Set(`tengu_api_error.tengu_api_success.tengu_cancel.tengu_compact_failed.tengu_exit.tengu_flicker.tengu_init.tengu_model_fallback_triggered.tengu_oauth_error.tengu_oauth_success.tengu_oauth_token_refresh_failure.tengu_oauth_token_refresh_success.tengu_oauth_token_refresh_lock_acquiring.tengu_oauth_token_refresh_lock_acquired.tengu_oauth_token_refresh_starting.tengu_oauth_token_refresh_completed.tengu_oauth_token_refresh_lock_releasing.tengu_oauth_token_refresh_lock_released.tengu_query_error.tengu_session_file_read.tengu_started.tengu_tool_use_error.tengu_tool_use_granted_in_prompt_permanent.tengu_tool_use_granted_in_prompt_temporary.tengu_tool_use_rejected_in_prompt.tengu_tool_use_success.tengu_uncaught_exception.tengu_unhandled_rejection.tengu_voice_recording_started.tengu_voice_toggled.tengu_team_mem_sync_pull.tengu_team_mem_sync_push.tengu_team_mem_sync_started.tengu_team_mem_entries_capped`.split(`.`)),M=[`arch`,`clientType`,`errorType`,`http_status_range`,`http_status`,`model`,`platform`,`provider`,`skillMode`,`subscriptionType`,`toolName`,`userBucket`,`userType`,`version`,`versionBase`],N=[],P=null,F=null,I=t(async()=>{if(v()||!E||!D)return F=!1,!1;try{return F=!0,!0}catch(e){return u(e),F=!1,!1}}),L=30,R=t(()=>{let e=s(),t=y(`sha256`).update(e).digest(`hex`);return parseInt(t.slice(0,8),16)%L})}));export{C as n,w as r,z as t};
|